Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore24
-rw-r--r--.mvn/extensions.xml9
-rw-r--r--Jenkinsfile70
-rw-r--r--org.eclipse.core.externaltools/.classpath2
-rw-r--r--org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs37
-rw-r--r--org.eclipse.core.externaltools/.settings/org.eclipse.jdt.ui.prefs52
-rw-r--r--org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.core.externaltools/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.core.externaltools/pom.xml23
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java3
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java2
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties1
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java28
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java49
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java8
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java3
-rw-r--r--org.eclipse.core.variables/.classpath2
-rw-r--r--org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs37
-rw-r--r--org.eclipse.core.variables/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.core.variables/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.core.variables/pom.xml23
-rw-r--r--org.eclipse.core.variables/schema/dynamicVariables.exsd260
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java2
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java65
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java22
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java4
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariable.java4
-rw-r--r--org.eclipse.debug.core/.classpath6
-rw-r--r--org.eclipse.debug.core/.options4
-rw-r--r--org.eclipse.debug.core/.settings/.api_filters19
-rw-r--r--org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--org.eclipse.debug.core/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java63
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IBinaryStreamListener.java38
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java8
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchMode.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureProvider.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureType.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java6
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java26
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java31
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/commands/AbstractDebugCommand.java7
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java36
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamMonitor.java64
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamsProxy.java93
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFlushableStreamMonitor.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILogicalStructureTypeDelegate3.java35
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java1
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java1
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IWatchExpression.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/LaunchConfigurationDelegate.java53
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java228
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupDirector.java43
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceContainerType.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupDirector.java18
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourcePathComputer.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java11
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java9
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java12
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java1
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java167
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java29
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java117
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfiguration.java229
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java17
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java27
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java32
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java17
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java231
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureManager.java15
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureType.java15
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java26
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/NullStreamsProxy.java55
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java291
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/PreferredDelegateModifyListener.java6
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RefreshScopeComparator.java30
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java3
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamDecoder.java (renamed from org.eclipse.ui.console/src/org/eclipse/ui/internal/console/StreamDecoder.java)58
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java77
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/XMLMemento.java47
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java6
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/ForEachCommand.java36
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java11
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepFiltersCommand.java6
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java26
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java14
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ResourceResolver.java3
-rw-r--r--org.eclipse.debug.core/forceQualifierUpdate.txt2
-rw-r--r--org.eclipse.debug.core/plugin.properties2
-rw-r--r--org.eclipse.debug.core/plugin.xml10
-rw-r--r--org.eclipse.debug.core/schema/logicalStructureTypes.exsd272
-rw-r--r--org.eclipse.debug.core/schema/processFactories.exsd244
-rw-r--r--org.eclipse.debug.core/schema/sourceContainerTypes.exsd306
-rw-r--r--org.eclipse.debug.core/schema/watchExpressionDelegates.exsd240
-rw-r--r--org.eclipse.debug.examples.core/.classpath2
-rw-r--r--org.eclipse.debug.examples.core/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs38
-rw-r--r--org.eclipse.debug.examples.core/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.debug.examples.core/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.debug.examples.core/pom.xml23
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java19
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java2
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java18
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java23
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java21
-rw-r--r--org.eclipse.debug.examples.memory/.classpath2
-rw-r--r--org.eclipse.debug.examples.memory/.project6
-rw-r--r--org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs37
-rw-r--r--org.eclipse.debug.examples.memory/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.debug.examples.memory/build.properties2
-rw-r--r--org.eclipse.debug.examples.memory/pom.xml4
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java6
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleModelPresentation.java4
-rwxr-xr-xorg.eclipse.debug.examples.mixedmode/.classpath2
-rwxr-xr-xorg.eclipse.debug.examples.mixedmode/.project6
-rw-r--r--org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs37
-rw-r--r--org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.pde.prefs72
-rwxr-xr-xorg.eclipse.debug.examples.mixedmode/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.debug.examples.mixedmode/pom.xml4
-rw-r--r--org.eclipse.debug.examples.mixedmode/src/org/eclipse/debug/internal/examples/mixedmode/ClearPreferredDelegatesHandler.java6
-rw-r--r--org.eclipse.debug.examples.ui/.classpath2
-rw-r--r--org.eclipse.debug.examples.ui/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs37
-rw-r--r--org.eclipse.debug.examples.ui/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.debug.examples.ui/build.properties1
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java1
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java3
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/DebugUIPlugin.java3
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java2
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/breakpoints/PDAToggleWatchpointsTarget.java8
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/editor/PDAScanner.java2
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java6
-rw-r--r--org.eclipse.debug.tests/.classpath6
-rw-r--r--org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--org.eclipse.debug.tests/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.debug.tests/META-INF/MANIFEST.MF9
-rw-r--r--org.eclipse.debug.tests/Platform Debug Test Suite.launch76
-rwxr-xr-xorg.eclipse.debug.tests/plugin.properties4
-rw-r--r--org.eclipse.debug.tests/plugin.xml59
-rw-r--r--org.eclipse.debug.tests/pom.xml6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/AbstractDebugTest.java65
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java113
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/LocalSuite.java40
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java43
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java132
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointTests.java134
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/SerialExecutorTest.java163
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/TestBreakpoint.java78
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleDocumentAdapterTests.java90
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java21
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java89
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/FileLinkTests.java147
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleFixedWidthTests.java37
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java212
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java631
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java157
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java191
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcessHandle.java119
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java207
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleManagerTests.java29
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java394
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java245
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java15
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/TextConsoleViewerTest.java306
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java23
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AbstractLaunchTest.java12
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AcceleratorSubstitutionTests.java13
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java49
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentsPrinter.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java13
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchConfigurationTests.java308
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchFavoriteTests.java47
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java29
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchHistoryTests.java51
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchManagerTests.java202
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java27
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/RefreshTabTests.java52
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ThrowingLaunchDelegate.java72
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/LogicalStructureCacheTest.java41
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestLogicalStructureTypeDelegate.java29
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestValue.java86
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/sourcelookup/SourceLookupFacilityTests.java34
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java7
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/stepfilters/StepFiltersTests.java9
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor1.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor2.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor3.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/VariableValueEditorManagerTests.java36
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/MemoryRenderingTests.java28
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTests.java146
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTestsMemoryBlock.java173
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/AbstractViewerModelTest.java22
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/CheckTests.java9
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ChildrenUpdateTests.java13
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ColumnPresentationTests.java30
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/ContentTests.java19
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DebugTestModelPresentation.java56
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DeltaTests.java34
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTests.java42
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTransformTests.java62
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerCheckTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerContentTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerDeltaTests.java6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerFilterTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerLazyTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPerformanceTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPopupTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerSelectionTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerStateTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerTopIndexTests.java34
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerUpdateTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/LazyTests.java23
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PerformanceTests.java30
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PopupTests.java12
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java8
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/SelectionTests.java39
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/StateTests.java251
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModelUpdatesListener.java20
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/UpdateTests.java76
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerContentTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerDeltaTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerFilterTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerLazyModeTests.java6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPerformanceTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerPopupTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerSelectionTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerStateTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/VirtualViewerUpdateTests.java4
-rw-r--r--org.eclipse.debug.ui.launchview.tests/.classpath11
-rw-r--r--org.eclipse.debug.ui.launchview.tests/.project28
-rw-r--r--org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.core.prefs421
-rw-r--r--org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.ui.prefs115
-rw-r--r--org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.pde.prefs39
-rw-r--r--org.eclipse.debug.ui.launchview.tests/META-INF/MANIFEST.MF20
-rw-r--r--org.eclipse.debug.ui.launchview.tests/Platform Debug UI LaunchView Test Suite.launch41
-rw-r--r--org.eclipse.debug.ui.launchview.tests/about.html36
-rw-r--r--org.eclipse.debug.ui.launchview.tests/build.properties22
-rw-r--r--org.eclipse.debug.ui.launchview.tests/forceQualifierUpdate.txt1
-rwxr-xr-xorg.eclipse.debug.ui.launchview.tests/plugin.properties17
-rw-r--r--org.eclipse.debug.ui.launchview.tests/plugin.xml19
-rw-r--r--org.eclipse.debug.ui.launchview.tests/pom.xml50
-rw-r--r--org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AbstractLaunchViewTest.java169
-rw-r--r--org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AutomatedSuite.java33
-rw-r--r--org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestUtil.java303
-rw-r--r--org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestsPlugin.java110
-rw-r--r--org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/launchview/LaunchViewSmokeTest.java38
-rw-r--r--org.eclipse.debug.ui.launchview.tests/test.xml64
-rw-r--r--org.eclipse.debug.ui.launchview/.classpath7
-rw-r--r--org.eclipse.debug.ui.launchview/.project33
-rw-r--r--org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.core.prefs439
-rw-r--r--org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.ui.prefs114
-rw-r--r--org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.api.tools.prefs97
-rw-r--r--org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.ds.annotations.prefs6
-rw-r--r--org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.prefs36
-rw-r--r--org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF25
-rw-r--r--org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider.xml7
-rw-r--r--org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel.xml9
-rw-r--r--org.eclipse.debug.ui.launchview/about.html36
-rw-r--r--org.eclipse.debug.ui.launchview/build.properties10
-rw-r--r--org.eclipse.debug.ui.launchview/icons/coverage.pngbin0 -> 599 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/debug_exc.pngbin0 -> 563 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/debug_exc@2x.pngbin0 -> 1453 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/delete_exc.pngbin0 -> 582 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/delete_exc@2x.pngbin0 -> 1296 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/edit_template.pngbin0 -> 402 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/edit_template@2x.pngbin0 -> 1187 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/favorite_star.pngbin0 -> 1249 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/profile_exc.pngbin0 -> 655 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/profile_exc@2x.pngbin0 -> 1462 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/refresh.pngbin0 -> 591 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/refresh@2x.pngbin0 -> 1330 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/run_co.pngbin0 -> 265 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/run_co@2x.pngbin0 -> 561 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/run_exc.pngbin0 -> 620 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/run_exc@2x.pngbin0 -> 1226 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/term_restart.pngbin0 -> 410 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/term_restart@2x.pngbin0 -> 948 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/terminate_all_co.pngbin0 -> 487 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/terminate_all_co@2x.pngbin0 -> 1137 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/terminate_co.pngbin0 -> 330 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/icons/terminate_co@2x.pngbin0 -> 517 bytes
-rw-r--r--org.eclipse.debug.ui.launchview/plugin.properties19
-rw-r--r--org.eclipse.debug.ui.launchview/plugin.xml14
-rw-r--r--org.eclipse.debug.ui.launchview/pom.xml (renamed from org.eclipse.debug.core/pom.xml)15
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/IBackgroundLaunchExecutor.java46
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/LaunchConfigurationViewPlugin.java34
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/AbstractLaunchObjectProvider.java44
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/FileLogger.java60
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewBundleInfo.java21
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewMessages.java52
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/SpecificLaunchListener.java98
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/StreamHelper.java40
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java188
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreProvider.java156
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/launcher/StandaloneLaunchConfigExecutor.java220
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/messages.properties37
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/ILaunchModel.java27
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectContainerModel.java69
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectFavoriteContainerModel.java30
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectModel.java101
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchViewModel.java134
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/EditAction.java50
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchAction.java96
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewContentProvider.java45
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java327
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewLabelProvider.java72
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/RelaunchAction.java57
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/TerminateAction.java57
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java94
-rw-r--r--org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObjectProvider.java77
-rw-r--r--org.eclipse.debug.ui/.classpath2
-rw-r--r--org.eclipse.debug.ui/.options1
-rw-r--r--org.eclipse.debug.ui/.settings/.api_filters32
-rw-r--r--org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs37
-rw-r--r--org.eclipse.debug.ui/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.debug.ui/META-INF/MANIFEST.MF25
-rw-r--r--org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css6
-rw-r--r--org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css6
-rw-r--r--org.eclipse.debug.ui/css/e4-light_debug_prefstyle_system.css14
-rw-r--r--org.eclipse.debug.ui/forceQualifierUpdate.txt3
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co.pngbin544 -> 493 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co@2x.pngbin1234 -> 1172 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts.pngbin355 -> 315 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts@2x.pngbin571 -> 581 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/filter_ps.pngbin311 -> 317 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/filter_ps@2x.pngbin582 -> 507 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts.pngbin344 -> 328 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts@2x.pngbin619 -> 620 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp.pngbin305 -> 479 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp@2x.pngbin910 -> 980 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dtool16/debug_exc.pngbin492 -> 440 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dtool16/debug_exc@2x.pngbin1015 -> 1070 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/breakpoint_view.pngbin364 -> 249 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/breakpoint_view@2x.pngbin431 -> 432 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/debug_persp.pngbin492 -> 440 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/debug_persp@2x.pngbin1015 -> 1070 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/debug_view.pngbin491 -> 440 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/debug_view@2x.pngbin1015 -> 1070 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/register_view.pngbin189 -> 228 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/register_view@2x.pngbin340 -> 406 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/variable_view.pngbin261 -> 260 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/variable_view@2x.pngbin524 -> 528 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/watchlist_view.pngbin358 -> 361 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/dview16/watchlist_view@2x.pngbin675 -> 672 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/debuglast_co.pngbin614 -> 611 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/debuglast_co@2x.pngbin1606 -> 1594 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/export_brkpts.pngbin345 -> 314 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/export_brkpts@2x.pngbin669 -> 670 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/filter_ps.pngbin328 -> 356 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/filter_ps@2x.pngbin655 -> 644 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/import_brkpts.pngbin371 -> 351 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/import_brkpts@2x.pngbin748 -> 743 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/skip_brkp.pngbin429 -> 400 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/elcl16/skip_brkp@2x.pngbin1051 -> 933 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/etool16/debug_exc.pngbin563 -> 538 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/etool16/debug_exc@2x.pngbin1453 -> 1552 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/etool16/watch_exp.pngbin398 -> 407 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/etool16/watch_exp@2x.pngbin772 -> 749 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.gifbin204 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.pngbin250 -> 234 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/breakpoint_view@2x.pngbin426 -> 429 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/debug_persp.gifbin348 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/debug_persp.pngbin563 -> 538 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/debug_persp@2x.pngbin1453 -> 1552 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/debug_view.gifbin348 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/debug_view.pngbin563 -> 538 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/debug_view@2x.pngbin1453 -> 1552 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/details_view.gifbin368 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/memory_view.gifbin325 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/module_view.gifbin338 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/register_view.gifbin115 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/register_view.pngbin204 -> 231 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/register_view@2x.pngbin361 -> 438 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/variable_view.gifbin108 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/variable_view.pngbin284 -> 284 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/variable_view@2x.pngbin574 -> 584 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/watchlist_view.gifbin158 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/watchlist_view.pngbin378 -> 403 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/eview16/watchlist_view@2x.pngbin764 -> 739 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/obj16/launchConfiguration.pngbin0 -> 571 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/obj16/launchConfiguration@2x.pngbin0 -> 1192 bytes
-rw-r--r--org.eclipse.debug.ui/icons/full/obj16/stckframe_obj.gifbin104 -> 0 bytes
-rw-r--r--org.eclipse.debug.ui/plugin.properties15
-rw-r--r--org.eclipse.debug.ui/plugin.xml98
-rw-r--r--org.eclipse.debug.ui/pom.xml6
-rw-r--r--org.eclipse.debug.ui/schema/contextViewBindings.exsd324
-rw-r--r--org.eclipse.debug.ui/schema/debugModelContextBindings.exsd218
-rw-r--r--org.eclipse.debug.ui/schema/variableValueEditors.exsd239
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugListSelectionDialog.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/AbstractDebugSelectionDialog.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugModelPropertyTester.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DelegatingModelPresentation.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/InstructionPointerManager.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/MultipleInputDialog.java45
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/VariableValueEditorManager.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AddToFavoritesAction.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java116
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleBreakpointsTargetManager.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DeleteWorkingsetsMessageDialog.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DisableAllBreakpointsAction.java114
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java145
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/EnableWatchExpressionAction.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionDialog.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueAction.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/ChangeVariableValueInputDialog.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneAssignValueAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/variables/details/DetailPaneMaxLengthDialog.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMining.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMiningProvider.java109
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionsUpdater.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/DebugCommandService.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllHandler.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRelaunchAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAndRemoveAction.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java32
-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/DebugModelContextBindingManager.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/LaunchSuspendTrigger.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/RegisterGroupProxy.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/CommonTabLite.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationTabGroup.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/DebugTextHover.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/hover/ExpressionInformationControlCreator.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java60
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpoints.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardExportBreakpointsPage.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpoints.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java96
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizard.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizardPage.java71
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizard.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizardPage.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ClosedProjectFilter.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CompileErrorProjectPromptStatusHandler.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeletedProjectFilter.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/FavoritesDialog.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java99
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java52
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTypeFilter.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java91
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveManager.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SaveScopeResourcesHandler.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectFavoritesDialog.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UniqueLaunchConfigurationFileFilter.java102
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingManager.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/RenderingBindings.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java222
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/DebugElementLabelProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementContentProvider.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionContentProvider.java43
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ExpressionManagerContentProvider.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/SerialExecutor.java75
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/VariableContentProvider.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java79
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java67
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java111
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java203
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java67
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/AddSourceContainerDialog.java39
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/BasicContainerContentProvider.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerViewer.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementWorkbenchAdapter.java1
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupFacility.java527
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupManager.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupResult.java103
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupService.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIUtils.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveSourceContainerBrowser.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/DirectorySourceContainerDialog.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ExternalArchiveSourceContainerBrowser.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerBrowser.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerDialog.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ProjectSourceContainerBrowser.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/WorkingSetSourceContainerBrowser.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java137
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceResolver.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringVariablePresentationManager.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousModel.java25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousSchedulingRuleFactory.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableModel.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousTableViewer.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ChildrenRequestMonitor.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/ModelNode.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/TableUpdatePolicy.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/AbstractBreadcrumb.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDetails.java64
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java92
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/TreeViewerDropDown.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ChildrenCountUpdate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/FilterTransform.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/HasChildrenUpdate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java83
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalVirtualTreeModelViewer.java118
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerStateTracker.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualCopyToClipboardActionDelegate.java51
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/VirtualFindAction.java67
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ModelDelta.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/PresentationContext.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/VirtualTree.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/provisional/AbstractModelProxy.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultWatchExpressionModelProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/EventHandlerModelProxy.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/ExpressionManagerModelProxy.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchProxy.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java23
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java45
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java369
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java74
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeModelContentProvider.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RemoveRenderingContextAction.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java61
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockAction.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneRenderingMgr.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewTabEnablementManager.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractVirtualContentTableModel.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingCellModifier.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressDialog.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRendering.java25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexRendering.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java200
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingCellModifier.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLine.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/LogicalStructureCache.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java164
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java68
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java22
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java905
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java95
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java9
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java48
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java5
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java19
-rw-r--r--org.eclipse.ui.console/.classpath2
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs38
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs52
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.ui.console/META-INF/MANIFEST.MF8
-rw-r--r--org.eclipse.ui.console/forceQualifierUpdate.txt2
-rw-r--r--org.eclipse.ui.console/icons/full/cview16/console_view.gifbin582 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/eview16/console_view.gifbin582 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/pom.xml23
-rw-r--r--org.eclipse.ui.console/schema/consoleFactories.exsd272
-rw-r--r--org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd306
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java6
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java29
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java9
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java16
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitionerExtension.java120
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java4
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java6
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java146
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java26
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java40
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java4
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java4
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java11
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java68
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java140
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java10
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java6
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java134
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java38
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java16
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java34
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties12
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java3
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java41
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java6
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java20
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java4
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java12
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java24
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java1148
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java181
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java26
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java7
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java4
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java36
-rw-r--r--org.eclipse.ui.externaltools/.classpath2
-rw-r--r--org.eclipse.ui.externaltools/.project68
-rw-r--r--org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs37
-rw-r--r--org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.ui.prefs52
-rw-r--r--org.eclipse.ui.externaltools/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java26
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java14
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsMainTab.java17
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java36
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java10
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java31
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IPreferenceConstants.java36
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java125
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java105
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties4
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/FileSelectionDialog.java37
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/TreeAndListGroup.java16
-rw-r--r--org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/variables/BuildFilesResolver.java61
-rw-r--r--org.eclipse.ui.externaltools/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.ui.externaltools/plugin.xml13
-rw-r--r--org.eclipse.ui.externaltools/pom.xml23
-rw-r--r--org.eclipse.ui.externaltools/schema/configurationDuplicationMaps.exsd234
-rw-r--r--org.eclipse.unittest.ui/.classpath11
-rw-r--r--org.eclipse.unittest.ui/.project34
-rw-r--r--org.eclipse.unittest.ui/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--org.eclipse.unittest.ui/.settings/org.eclipse.core.runtime.prefs2
-rw-r--r--org.eclipse.unittest.ui/.settings/org.eclipse.jdt.core.prefs538
-rw-r--r--org.eclipse.unittest.ui/.settings/org.eclipse.jdt.ui.prefs84
-rw-r--r--org.eclipse.unittest.ui/.settings/org.eclipse.pde.api.tools.prefs102
-rw-r--r--org.eclipse.unittest.ui/.settings/org.eclipse.pde.prefs36
-rw-r--r--org.eclipse.unittest.ui/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.unittest.ui/about.html36
-rw-r--r--org.eclipse.unittest.ui/build.properties25
-rw-r--r--org.eclipse.unittest.ui/icons-work/unitViewIcon.xcfbin0 -> 4483 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/cfilter.pngbin0 -> 212 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/cfilter@2x.pngbin0 -> 348 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/compare.pngbin0 -> 245 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/compare@2x.pngbin0 -> 394 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout.pngbin0 -> 131 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout@2x.pngbin0 -> 180 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout.pngbin0 -> 154 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout@2x.pngbin0 -> 207 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/history_list.pngbin0 -> 378 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/history_list@2x.pngbin0 -> 792 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/lock.pngbin0 -> 422 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/lock@2x.pngbin0 -> 912 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/open_console.pngbin0 -> 430 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/open_console@2x.pngbin0 -> 889 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/relaunch.pngbin0 -> 536 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/relaunch@2x.pngbin0 -> 1216 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf.pngbin0 -> 562 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf@2x.pngbin0 -> 1232 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/select_next.pngbin0 -> 315 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/select_next@2x.pngbin0 -> 567 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/select_prev.pngbin0 -> 315 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/select_prev@2x.pngbin0 -> 538 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/stop.pngbin0 -> 257 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/stop@2x.pngbin0 -> 460 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic.pngbin0 -> 305 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic@2x.pngbin0 -> 599 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal.pngbin0 -> 312 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal@2x.pngbin0 -> 607 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical.pngbin0 -> 258 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical@2x.pngbin0 -> 426 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dtool16/new_testcase.pngbin0 -> 371 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dtool16/new_testcase@2x.pngbin0 -> 625 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite.pngbin0 -> 389 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite@2x.pngbin0 -> 678 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/cfilter.pngbin0 -> 365 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/cfilter@2x.pngbin0 -> 648 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/compare.pngbin0 -> 299 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/compare@2x.pngbin0 -> 591 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/flatLayout.pngbin0 -> 123 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/flatLayout@2x.pngbin0 -> 199 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout.pngbin0 -> 148 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout@2x.pngbin0 -> 230 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/history_list.pngbin0 -> 441 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/history_list@2x.pngbin0 -> 1117 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/lock.pngbin0 -> 541 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/lock@2x.pngbin0 -> 1316 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/open_console.pngbin0 -> 590 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/open_console@2x.pngbin0 -> 1251 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/relaunch.pngbin0 -> 671 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/relaunch@2x.pngbin0 -> 1664 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/relaunchf.pngbin0 -> 687 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/relaunchf@2x.pngbin0 -> 1643 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/select_next.pngbin0 -> 366 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/select_next@2x.pngbin0 -> 767 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/select_prev.pngbin0 -> 364 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/select_prev@2x.pngbin0 -> 730 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/stop.pngbin0 -> 301 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/stop@2x.pngbin0 -> 515 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/th_automatic.pngbin0 -> 383 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/th_automatic@2x.pngbin0 -> 822 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal.pngbin0 -> 383 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal@2x.pngbin0 -> 846 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/th_vertical.pngbin0 -> 315 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/elcl16/th_vertical@2x.pngbin0 -> 586 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/etool16/new_testcase.pngbin0 -> 493 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/etool16/new_testcase@2x.pngbin0 -> 989 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/etool16/new_testsuite.pngbin0 -> 484 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/etool16/new_testsuite@2x.pngbin0 -> 965 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/stackframe.pngbin0 -> 266 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/stackframe@2x.pngbin0 -> 557 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/unit.pngbin0 -> 980 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/unit@2x.pngbin0 -> 1300 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/uniterr.pngbin0 -> 994 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/uniterr@2x.pngbin0 -> 1366 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/uniterrq.pngbin0 -> 1098 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/uniterrq@2x.pngbin0 -> 1610 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/unitsucc.pngbin0 -> 1057 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/unitsucc@2x.pngbin0 -> 1489 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/unitsuccq.pngbin0 -> 1131 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/eview16/unitsuccq@2x.pngbin0 -> 1724 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/exc_catch.pngbin0 -> 377 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/exc_catch@2x.pngbin0 -> 824 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/faillist.pngbin0 -> 167 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/faillist@2x.pngbin0 -> 289 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/failures.pngbin0 -> 262 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/failures@2x.pngbin0 -> 487 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/julaunch.pngbin0 -> 240 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/julaunch@2x.pngbin0 -> 429 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj.pngbin0 -> 266 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj@2x.pngbin0 -> 557 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/test.pngbin0 -> 384 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/test@2x.pngbin0 -> 776 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed.pngbin0 -> 489 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed@2x.pngbin0 -> 1056 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testerr.pngbin0 -> 434 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testerr@2x.pngbin0 -> 925 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testfail.pngbin0 -> 422 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testfail@2x.pngbin0 -> 868 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testfile_obj.pngbin0 -> 492 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testfile_obj@2x.pngbin0 -> 990 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testhier.pngbin0 -> 390 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testhier@2x.pngbin0 -> 796 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testignored.pngbin0 -> 441 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testignored@2x.pngbin0 -> 922 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testok.pngbin0 -> 473 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testok@2x.pngbin0 -> 1052 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testrun.pngbin0 -> 482 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/testrun@2x.pngbin0 -> 1024 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuite.pngbin0 -> 358 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuite@2x.pngbin0 -> 701 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror.pngbin0 -> 447 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror@2x.pngbin0 -> 977 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuitefail.pngbin0 -> 439 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuitefail@2x.pngbin0 -> 942 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuiteok.pngbin0 -> 473 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuiteok@2x.pngbin0 -> 1067 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuiterun.pngbin0 -> 464 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/obj16/tsuiterun@2x.pngbin0 -> 927 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/ovr16/error_ovr.pngbin0 -> 150 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/ovr16/error_ovr@2x.pngbin0 -> 247 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr.pngbin0 -> 155 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr@2x.pngbin0 -> 260 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/ovr16/success_ovr.pngbin0 -> 198 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/ovr16/success_ovr@2x.pngbin0 -> 399 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz.pngbin0 -> 3805 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz@2x.pngbin0 -> 8362 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz.pngbin0 -> 3448 bytes
-rw-r--r--org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz@2x.pngbin0 -> 7413 bytes
-rw-r--r--org.eclipse.unittest.ui/plugin.properties31
-rw-r--r--org.eclipse.unittest.ui/plugin.xml67
-rw-r--r--org.eclipse.unittest.ui/pom.xml (renamed from org.eclipse.debug.examples.ui/pom.xml)9
-rw-r--r--org.eclipse.unittest.ui/schema/unittestViewSupport.exsd98
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPlugin.java98
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPreferencesConstants.java94
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/HistoryEntryHandler.java79
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/IXMLTags.java112
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunHandler.java365
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunSessionSerializer.java322
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestListenerRegistry.java66
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestRunListener.java106
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportExtension.java87
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportRegistry.java145
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/UnitTestLaunchConfigurationConstants.java37
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionListener.java37
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionReport.java50
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestSessionListener.java86
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.java47
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.properties31
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ProgressState.java39
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/Status.java182
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestCaseElement.java99
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestElement.java313
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunListenerAdapter.java110
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunSession.java749
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestSuiteElement.java287
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestLaunchListener.java88
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestModel.java287
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/BasicElementLabels.java135
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultDialog.java323
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultsAction.java74
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CopyFailureListAction.java96
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CounterPanel.java184
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/EnableStackFilterAction.java53
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTableDisplay.java103
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTraceUIBlock.java285
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ITraceDisplay.java28
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/IUnitTestHelpContextIds.java42
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Images.java117
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.java130
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.properties109
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ProgressIcons.java103
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/RerunAction.java58
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ScrollLockAction.java47
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/SelectionProviderMediator.java198
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowNextFailureAction.java43
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowPreviousFailureAction.java43
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowStackTraceInConsoleViewAction.java62
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestRunnerViewPart.java1823
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionLabelProvider.java186
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTableContentProvider.java61
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTreeContentProvider.java70
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestViewer.java871
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TextualTrace.java145
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UITestRunListener.java72
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestCopyAction.java110
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestProgressBar.java216
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestUIPreferencesConstants.java70
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/History.java143
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryDialog.java270
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryHandler.java80
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryItem.java324
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/Messages.java39
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/messages.properties22
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/launcher/ITestRunnerClient.java52
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestCaseElement.java40
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestElement.java184
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestRunSession.java140
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestSuiteElement.java35
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/model/package.html15
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ConfigureViewerSupport.java41
-rw-r--r--org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ITestViewSupport.java110
-rw-r--r--pom.xml7
982 files changed, 32934 insertions, 9833 deletions
diff --git a/.gitignore b/.gitignore
index 1ed7aed0b..6e021b7b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,13 @@
-/*/bin/
-/.project
-*~
-*.rej
-*.bak
-javacore.*
-heapdump.*
-core.*
-Snap.*
-
-# maven
-/*/target/
+/*/bin/
+/.project
+*~
+*.rej
+*.bak
+javacore.*
+heapdump.*
+core.*
+Snap.*
+
+# maven
+/*/target/
/target/
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
new file mode 100644
index 000000000..aa1268d82
--- /dev/null
+++ b/.mvn/extensions.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<extensions>
+ <extension>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-build</artifactId>
+ <version>2.7.0</version>
+ </extension>
+</extensions> \ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 000000000..2552c33df
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,70 @@
+pipeline {
+ options {
+ timeout(time: 40, unit: 'MINUTES')
+ buildDiscarder(logRotator(numToKeepStr:'5'))
+ }
+ agent {
+ label "centos-latest"
+ }
+ tools {
+ maven 'apache-maven-latest'
+ jdk 'openjdk-jdk11-latest'
+ }
+ stages {
+ stage('initialize Gerrit review') {
+ steps {
+ gerritReview labels: [Verified: 0], message: "Build started $BUILD_URL"
+ }
+ }
+ stage('Build') {
+ steps {
+ wrap([$class: 'Xvnc', useXauthority: true]) {
+ sh """
+ mvn clean verify --batch-mode --fail-at-end -Dmaven.repo.local=$WORKSPACE/.m2/repository \
+ -Pbuild-individual-bundles -Pbree-libs -Papi-check \
+ -DskipTests=false -Dcompare-version-with-baselines.skip=false \
+ -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true \
+ -Dmaven.compiler.failOnWarning=true -Dproject.build.sourceEncoding=UTF-8
+ """
+ }
+ }
+ post {
+ always {
+ archiveArtifacts artifacts: '.*log,*/target/work/data/.metadata/.*log,*/tests/target/work/data/.metadata/.*log,apiAnalyzer-workspace/data/.metadata/.*log'
+ junit '**/target/surefire-reports/TEST-*.xml'
+ publishIssues issues:[scanForIssues(tool: java()), scanForIssues(tool: mavenConsole())]
+ }
+ unstable {
+ gerritReview labels: [Verified: -1], message: "Build UNSTABLE (test failures) $BUILD_URL"
+ }
+ failure {
+ gerritReview labels: [Verified: -1], message: "Build FAILED $BUILD_URL"
+ }
+ }
+ }
+ stage('Check freeze period') {
+ when {
+ not {
+ branch 'master'
+ }
+ }
+ steps {
+ sh "wget https://download.eclipse.org/eclipse/relengScripts/scripts/verifyFreezePeriod.sh"
+ sh "chmod +x verifyFreezePeriod.sh"
+ withCredentials([string(credentialsId: 'google-api-key', variable: 'GOOGLE_API_KEY')]) {
+ sh './verifyFreezePeriod.sh'
+ }
+ }
+ post {
+ failure {
+ gerritReview labels: [Verified: -1], message: "Build and test are OK, but Eclipse project is currently in a code freeze period.\nPlease wait for end of code freeze period before merging.\n $BUILD_URL"
+ }
+ }
+ }
+ }
+ post {
+ success {
+ gerritReview labels: [Verified: 1], message: "Build Succcess $BUILD_URL"
+ }
+ }
+}
diff --git a/org.eclipse.core.externaltools/.classpath b/org.eclipse.core.externaltools/.classpath
index eca7bdba8..e801ebfb4 100644
--- a/org.eclipse.core.externaltools/.classpath
+++ b/org.eclipse.core.externaltools/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs
index 59d5c902a..c14a2b56b 100644
--- a/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,11 +135,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
@@ -145,17 +149,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -239,11 +246,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -273,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -297,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -350,6 +364,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -386,9 +402,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -414,8 +433,12 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.ui.prefs
index 8e18452e3..ddcf96428 100644
--- a/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.ui.prefs
@@ -1,55 +1,3 @@
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=false
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_Platform Debug Cleanups
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
diff --git a/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs b/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.core.externaltools/META-INF/MANIFEST.MF b/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
index 4e0d3f0ec..4c9f27f0a 100644
--- a/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
+++ b/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
@@ -3,13 +3,13 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.core.externaltools;singleton:=true
-Bundle-Version: 1.1.400.qualifier
+Bundle-Version: 1.2.200.qualifier
Bundle-Activator: org.eclipse.core.externaltools.internal.ExternalToolsCore
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Export-Package: org.eclipse.core.externaltools.internal;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools,org.eclipse.ant.ui",
diff --git a/org.eclipse.core.externaltools/pom.xml b/org.eclipse.core.externaltools/pom.xml
deleted file mode 100644
index 17143a94f..000000000
--- a/org.eclipse.core.externaltools/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2012, 2016 Eclipse Foundation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Igor Fedorenko - initial implementation
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>eclipse.platform.debug</artifactId>
- <groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
- </parent>
- <groupId>org.eclipse.core</groupId>
- <artifactId>org.eclipse.core.externaltools</artifactId>
- <version>1.1.400-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java
index 396fa8001..968ae1441 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java
@@ -60,8 +60,7 @@ public class BackgroundResourceRefresher implements IDebugEventSetListener {
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getSource() == fProcess && event.getKind() == DebugEvent.TERMINATE) {
DebugPlugin.getDefault().removeDebugEventListener(this);
refresh();
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java
index d75dda2ea..b733eb9ed 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java
@@ -18,10 +18,12 @@ import org.eclipse.osgi.util.NLS;
public class ExternalToolsProgramMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsProgramMessages";//$NON-NLS-1$
+
public static String BackgroundResourceRefresher_0;
public static String ProgramLaunchDelegate_3;
public static String ProgramLaunchDelegate_4;
+ public static String ProgramLaunchDelegate_5;
public static String ExternalToolsUtil_Location_not_specified_by__0__1;
public static String ExternalToolsUtil_invalidLocation__0_;
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties
index 78a74737d..7d9189938 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties
@@ -16,6 +16,7 @@ BackgroundResourceRefresher_0=Refreshing resources...
ProgramLaunchDelegate_3=Running {0}...
ProgramLaunchDelegate_4=An IProcess could not be created for the launch
+ProgramLaunchDelegate_5=[pid: {0}]
ExternalToolsUtil_Location_not_specified_by__0__1=Location not specified by {0}
ExternalToolsUtil_invalidLocation__0_ = The file does not exist for the external tool named {0}.
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java
index 8747d162e..f6efdb87c 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java
@@ -119,7 +119,8 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate {
ExternalToolsProgramMessages.ProgramLaunchDelegate_3,
new String[] { configuration.getName() }),
IProgressMonitor.UNKNOWN);
- process = DebugPlugin.newProcess(launch, p, location.toOSString(), processAttributes);
+ String label = getProcessLabel(location, p);
+ process = DebugPlugin.newProcess(launch, p, label, processAttributes);
}
if (p == null || process == null) {
if (p != null) {
@@ -130,8 +131,8 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate {
IExternalToolConstants.ERR_INTERNAL_ERROR,
ExternalToolsProgramMessages.ProgramLaunchDelegate_4, null));
}
- process.setAttribute(IProcess.ATTR_CMDLINE,
- generateCommandLine(cmdLine));
+ process.setAttribute(IProcess.ATTR_CMDLINE, generateCommandLine(cmdLine));
+ process.setAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP, Long.toString(System.currentTimeMillis()));
if (configuration.getAttribute(ATTR_LAUNCH_IN_BACKGROUND, true)) {
// refresh resources after process finishes
@@ -158,6 +159,17 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate {
}
}
+ private String getProcessLabel(IPath location, Process p) {
+ String label = location.toOSString();
+ try {
+ label += " " + NLS.bind(ExternalToolsProgramMessages.ProgramLaunchDelegate_5, new Object[] { //$NON-NLS-1$
+ p.pid() });
+ } catch (UnsupportedOperationException e) {
+ // ignore, pid() is not implemented in this JVM
+ }
+ return label;
+ }
+
private String[] buildCommandLine(ILaunchConfiguration configuration, IPath location) throws CoreException {
// resolve arguments
String[] arguments = ExternalToolsCoreUtil.getArguments(configuration);
@@ -179,13 +191,13 @@ public class ProgramLaunchDelegate extends LaunchConfigurationDelegate {
return IExternalToolConstants.EMPTY_STRING;
}
StringBuilder buf = new StringBuilder();
- for (int i = 0; i < commandLine.length; i++) {
- buf.append(' ');
- char[] characters = commandLine[i].toCharArray();
+ for (String c : commandLine) {
+ if (buf.length() > 0) {
+ buf.append(' ');
+ }
StringBuilder command = new StringBuilder();
boolean containsSpace = false;
- for (int j = 0; j < characters.length; j++) {
- char character = characters[j];
+ for (char character : c.toCharArray()) {
if (character == '\"') {
command.append('\\');
} else if (character == ' ') {
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
index 01bda1d3a..c87bac400 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
@@ -23,12 +23,9 @@ import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugPlugin;
@@ -127,10 +124,9 @@ public class BuilderCoreUtils {
newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false);
String buildKinds = config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null);
- int[] triggers = buildTypesToArray(buildKinds);
boolean isfull = false, isinc = false;
- for (int i = 0; i < triggers.length; i++) {
- switch (triggers[i]) {
+ for (int trigger : buildTypesToArray(buildKinds)) {
+ switch (trigger) {
case IncrementalProjectBuilder.FULL_BUILD:
newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true);
isfull = true;
@@ -197,8 +193,7 @@ public class BuilderCoreUtils {
// The goal here is to not change the storage format of old,
// unedited builders.
ICommand[] commands = project.getDescription().getBuildSpec();
- for (int i = 0; i < commands.length; i++) {
- ICommand projectCommand = commands[i];
+ for (ICommand projectCommand : commands) {
String name = ExternalToolMigration
.getNameFromCommandArgs(projectCommand.getArguments());
if (name != null && name.equals(config.getName())) {
@@ -248,44 +243,6 @@ public class BuilderCoreUtils {
return folder;
}
- /**
- * Migrates the launch configuration working copy, which is based on an old-
- * style external tool builder, to a new, saved launch configuration. The
- * returned launch configuration will contain the same attributes as the
- * given working copy with the exception of the configuration name, which
- * may be changed during the migration. The name of the configuration will
- * only be changed if the current name is not a valid name for a saved
- * config.
- *
- * @param workingCopy
- * the launch configuration containing attributes from an
- * old-style project builder.
- * @return ILaunchConfiguration a new, saved launch configuration whose
- * attributes match those of the given working copy as well as
- * possible
- * @throws CoreException
- * if an exception occurs while attempting to save the new
- * launch configuration
- */
- public static ILaunchConfiguration migrateBuilderConfiguration(
- IProject project, ILaunchConfigurationWorkingCopy workingCopy)
- throws CoreException {
- workingCopy.setContainer(getBuilderFolder(project, true));
- // Before saving, make sure the name is valid
- String name = workingCopy.getName();
- name = name.replace('/', '.');
- if (name.charAt(0) == ('.')) {
- name = name.substring(1);
- }
- IStatus status = ResourcesPlugin.getWorkspace().validateName(name,
- IResource.FILE);
- if (!status.isOK()) {
- name = "ExternalTool"; //$NON-NLS-1$
- }
- name = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(name);
- workingCopy.rename(name);
- return workingCopy.doSave();
- }
/**
* Converts the build types string into an array of build kinds.
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 37d7d6fa2..ee9b49517 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
@@ -43,7 +43,7 @@ import org.osgi.framework.Bundle;
* build process.
*/
public final class ExternalToolBuilder extends IncrementalProjectBuilder {
- private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor {
+ private static final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor {
private boolean[] fTrueChange;
private IgnoreTeamPrivateChanges(boolean[] trueChange) {
super();
@@ -258,13 +258,13 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder {
}
private boolean buildScopeIndicatesBuild(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- IResourceDelta delta = getDelta(resources[i].getProject());
+ for (IResource resource : resources) {
+ IResourceDelta delta = getDelta(resource.getProject());
if (delta == null) {
//project just added to the workspace..no previous build tree
return true;
}
- IPath path= resources[i].getProjectRelativePath();
+ IPath path = resource.getProjectRelativePath();
IResourceDelta change= delta.findMember(path);
if (change != null) {
final boolean[] trueChange= new boolean[1];
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java
index e89ae3496..b0300ad60 100644
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java
+++ b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java
@@ -267,8 +267,7 @@ public final class ExternalToolMigration {
arguments = buffer.toString();
buffer.setLength(0);
- for (int i = 0; i < targets.size(); i++) {
- String target = targets.get(i);
+ for (String target : targets) {
if (target != null && target.length() > 0) {
buffer.append(target);
buffer.append(","); //$NON-NLS-1$
diff --git a/org.eclipse.core.variables/.classpath b/org.eclipse.core.variables/.classpath
index eca7bdba8..e801ebfb4 100644
--- a/org.eclipse.core.variables/.classpath
+++ b/org.eclipse.core.variables/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs
index 59d5c902a..c14a2b56b 100644
--- a/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,11 +135,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
@@ -145,17 +149,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -239,11 +246,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -273,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -297,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -350,6 +364,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -386,9 +402,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -414,8 +433,12 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.core.variables/.settings/org.eclipse.pde.prefs b/org.eclipse.core.variables/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.core.variables/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.core.variables/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.core.variables/META-INF/MANIFEST.MF b/org.eclipse.core.variables/META-INF/MANIFEST.MF
index 9787d62e1..0e99308db 100644
--- a/org.eclipse.core.variables/META-INF/MANIFEST.MF
+++ b/org.eclipse.core.variables/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.variables; singleton:=true
-Bundle-Version: 3.4.600.qualifier
+Bundle-Version: 3.5.100.qualifier
Bundle-Activator: org.eclipse.core.variables.VariablesPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,5 +10,5 @@ Export-Package: org.eclipse.core.internal.variables;x-internal:=true,
org.eclipse.core.variables
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.eclipse.core.variables
diff --git a/org.eclipse.core.variables/pom.xml b/org.eclipse.core.variables/pom.xml
deleted file mode 100644
index 58043e687..000000000
--- a/org.eclipse.core.variables/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2012, 2016 Eclipse Foundation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Igor Fedorenko - initial implementation
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>eclipse.platform.debug</artifactId>
- <groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
- </parent>
- <groupId>org.eclipse.core</groupId>
- <artifactId>org.eclipse.core.variables</artifactId>
- <version>3.4.600-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/org.eclipse.core.variables/schema/dynamicVariables.exsd b/org.eclipse.core.variables/schema/dynamicVariables.exsd
index dd7c77e26..f7e504293 100644
--- a/org.eclipse.core.variables/schema/dynamicVariables.exsd
+++ b/org.eclipse.core.variables/schema/dynamicVariables.exsd
@@ -1,133 +1,133 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.core.variables">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.core.variables" id="dynamicVariables" name="Dynamic String Substitution Variables"/>
- </appInfo>
- <documentation>
- This extension point provides a mechanism for defining dynamic variables used in string substitution. The value of a dynamic variable is resolved at the time a string substitution is performed, with an optional argument.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="variable" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="variable">
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- specifies a unique name for this variable.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="resolver" type="string" use="required">
- <annotation>
- <documentation>
- specifies a Java class which implements &lt;code&gt;org.eclipse.core.variables.IDynamicVariableResolver&lt;/code&gt;, which is used to determine the value of the variable
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.variables.IDynamicVariableResolver"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="description" type="string" use="required">
- <annotation>
- <documentation>
- specifies a human-readable description of this variable
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="supportsArgument" type="boolean">
- <annotation>
- <documentation>
- Whether this variable supports an argument. When unspecified, the implied value is &lt;code&gt;true&lt;/code&gt;.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is a definition of a dynamic variable that resolves to the name of the selected resource:
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.core.variables.dynamicVariables&quot;&gt;
- &lt;variable
- name=&quot;resource_name&quot;
- expanderClass=&quot;com.example.ResourceNameExpander&quot;
- description=&quot;The name of the selected resource&quot;&gt;
- &lt;/variable&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;resolver&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.core.variables.IDynamicVariableResolver&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.core.variables">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.core.variables" id="dynamicVariables" name="Dynamic String Substitution Variables"/>
+ </appInfo>
+ <documentation>
+ This extension point provides a mechanism for defining dynamic variables used in string substitution. The value of a dynamic variable is resolved at the time a string substitution is performed, with an optional argument.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="variable" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="variable">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a unique name for this variable.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="resolver" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a Java class which implements &lt;code&gt;org.eclipse.core.variables.IDynamicVariableResolver&lt;/code&gt;, which is used to determine the value of the variable
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.core.variables.IDynamicVariableResolver"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a human-readable description of this variable
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="supportsArgument" type="boolean">
+ <annotation>
+ <documentation>
+ Whether this variable supports an argument. When unspecified, the implied value is &lt;code&gt;true&lt;/code&gt;.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is a definition of a dynamic variable that resolves to the name of the selected resource:
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.core.variables.dynamicVariables&quot;&gt;
+ &lt;variable
+ name=&quot;resource_name&quot;
+ expanderClass=&quot;com.example.ResourceNameExpander&quot;
+ description=&quot;The name of the selected resource&quot;&gt;
+ &lt;/variable&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;resolver&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.core.variables.IDynamicVariableResolver&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
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 de6959f19..91c457cf9 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
@@ -73,7 +73,7 @@ public class DynamicVariable extends StringVariable implements IDynamicVariable
@Override
public boolean supportsArgument() {
String arg = getConfigurationElement().getAttribute("supportsArgument"); //$NON-NLS-1$
- return arg == null || Boolean.valueOf(arg).booleanValue();
+ return arg == null || Boolean.parseBoolean(arg);
}
}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java
index 774c50d69..cd413883b 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java
@@ -13,10 +13,11 @@
*******************************************************************************/
package org.eclipse.core.internal.variables;
+import java.util.ArrayDeque;
import java.util.ArrayList;
+import java.util.Deque;
import java.util.HashSet;
import java.util.List;
-import java.util.Stack;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -53,9 +54,9 @@ public class StringSubstitutionEngine {
/**
* Stack of variables to resolve
*/
- private Stack<VariableReference> fStack;
+ private Deque<VariableReference> fStack;
- class VariableReference {
+ static class VariableReference {
// the text inside the variable reference
private StringBuilder fText;
@@ -138,7 +139,7 @@ public class StringSubstitutionEngine {
*/
private HashSet<String> substitute(String expression, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException {
fResult = new StringBuilder(expression.length());
- fStack = new Stack<>();
+ fStack = new ArrayDeque<>();
fSubs = false;
HashSet<String> resolvedVariables = new HashSet<>();
@@ -174,37 +175,35 @@ public class StringSubstitutionEngine {
VariableReference tos = fStack.peek();
tos.append(expression.substring(pos));
pos = expression.length();
+ } else if (start >= 0 && start < end) {
+ // start of a nested variable
+ int length = start - pos;
+ if (length > 0) {
+ VariableReference tos = fStack.peek();
+ tos.append(expression.substring(pos, start));
+ }
+ pos = start + 2;
+ fStack.push(new VariableReference());
} else {
- if (start >= 0 && start < end) {
- // start of a nested variable
- int length = start - pos;
- if (length > 0) {
- VariableReference tos = fStack.peek();
- tos.append(expression.substring(pos, start));
- }
- pos = start + 2;
- fStack.push(new VariableReference());
- } else {
- // end of variable reference
- VariableReference tos = fStack.pop();
- String substring = expression.substring(pos, end);
- tos.append(substring);
- resolvedVariables.add(substring);
+ // end of variable reference
+ VariableReference tos = fStack.pop();
+ String substring = expression.substring(pos, end);
+ tos.append(substring);
+ resolvedVariables.add(substring);
- pos = end + 1;
- String value= resolve(tos, reportUndefinedVariables, resolveVariables, manager);
- if (value == null) {
- value = ""; //$NON-NLS-1$
- }
- if (fStack.isEmpty()) {
- // append to result
- fResult.append(value);
- state = SCAN_FOR_START;
- } else {
- // append to previous variable
- tos = fStack.peek();
- tos.append(value);
- }
+ pos = end + 1;
+ String value= resolve(tos, reportUndefinedVariables, resolveVariables, manager);
+ if (value == null) {
+ value = ""; //$NON-NLS-1$
+ }
+ if (fStack.isEmpty()) {
+ // append to result
+ fResult.append(value);
+ state = SCAN_FOR_START;
+ } else {
+ // append to previous variable
+ tos = fStack.peek();
+ tos.append(value);
}
}
break;
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 fa980503a..533ebb8f1 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
@@ -222,8 +222,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
private void loadDynamicVariables() {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(VariablesPlugin.PI_CORE_VARIABLES, EXTENSION_POINT_DYNAMIC_VARIABLES);
IConfigurationElement elements[]= point.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
String name= element.getAttribute(ATTR_NAME);
if (name == null) {
VariablesPlugin.logMessage(NLS.bind("Variable extension missing required 'name' attribute: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$
@@ -236,7 +235,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
DynamicVariable oldVariable = (DynamicVariable)old;
VariablesPlugin.logMessage(NLS.bind("Dynamic variable extension from bundle ''{0}'' overrides existing extension variable ''{1}'' from bundle ''{2}''", //$NON-NLS-1$
new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(),
- oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null);
+ oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null);
}
}
}
@@ -247,8 +246,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
private void loadContributedValueVariables() {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(VariablesPlugin.PI_CORE_VARIABLES, EXTENSION_POINT_VALUE_VARIABLES);
IConfigurationElement elements[]= point.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
String name= element.getAttribute(ATTR_NAME);
if (name == null) {
VariablesPlugin.logMessage(NLS.bind("Variable extension missing required 'name' attribute: {0}", new String[] {element.getDeclaringExtension().getLabel()}), null); //$NON-NLS-1$
@@ -263,7 +261,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
StringVariable oldVariable = (StringVariable)old;
VariablesPlugin.logMessage(NLS.bind("Contributed variable extension from bundle ''{0}'' overrides existing extension variable ''{1}'' from bundle ''{2}''", //$NON-NLS-1$
new String[] {element.getDeclaringExtension().getContributor().getName(),oldVariable.getName(),
- oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null);
+ oldVariable.getConfigurationElement().getDeclaringExtension().getContributor().getName()}), null);
}
}
}
@@ -363,15 +361,13 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
public synchronized void addVariables(IValueVariable[] variables) throws CoreException {
initialize();
MultiStatus status = new MultiStatus(VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, VariablesMessages.StringVariableManager_26, null);
- for (int i = 0; i < variables.length; i++) {
- IValueVariable variable = variables[i];
+ for (IValueVariable variable : variables) {
if (getValueVariable(variable.getName()) != null) {
status.add(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringVariableManager_27, new String[]{variable.getName()}), null));
}
}
if (status.isOK()) {
- for (int i = 0; i < variables.length; i++) {
- IValueVariable variable = variables[i];
+ for (IValueVariable variable : variables) {
fValueVariables.put(variable.getName(), variable);
}
IValueVariable[] copy = new IValueVariable[variables.length];
@@ -386,8 +382,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
public synchronized void removeVariables(IValueVariable[] variables) {
initialize();
List<IValueVariable> removed = new ArrayList<>(variables.length);
- for (int i = 0; i < variables.length; i++) {
- IValueVariable variable = variables[i];
+ for (IValueVariable variable : variables) {
if (fValueVariables.remove(variable.getName()) != null) {
removed.add(variable);
}
@@ -434,8 +429,7 @@ public class StringVariableManager implements IStringVariableManager, IPreferenc
Document document= getDocument();
Element rootElement= document.createElement(VALUE_VARIABLES_TAG);
document.appendChild(rootElement);
- for (int i = 0; i < variables.length; i++) {
- IValueVariable variable = variables[i];
+ for (IValueVariable variable : variables) {
if (!variable.isReadOnly()){
// don't persist read-only variables or un-initialized contributed variables
if (!variable.isContributed() || ((ContributedValueVariable)variable).isInitialized()) {
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java
index 80efe9b58..29521906b 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.CoreException;
* The following is a definition of a dynamic variable that resolves to the name
* of the selected resource:
* </p>
- *
+ *
* <pre>
* &lt;extension point="org.eclipse.core.variables.dynamicVariables"&gt;
* &lt;variable
@@ -38,7 +38,7 @@ import org.eclipse.core.runtime.CoreException;
* Clients contributing a dynamic variable provide an implementation of
* {@link org.eclipse.core.variables.IDynamicVariableResolver}.
* </p>
- *
+ *
* @since 3.0
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariable.java
index 72d52fdfa..ab37139de 100644
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariable.java
+++ b/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariable.java
@@ -18,7 +18,7 @@ package org.eclipse.core.variables;
* A variable that can be referenced in an expression, which resolves to a
* string value. Variables are referenced in expressions via their name, in the
* following format.
- *
+ *
* <pre>
* ${varname} or ${varname:argument}
* </pre>
@@ -39,7 +39,7 @@ package org.eclipse.core.variables;
* time a string substitution is performed by a contributed resolver. Dynamic
* variables may accept an argument.</li>
* </ul>
- *
+ *
* @since 3.0
* @noimplement This interface is not intended to be implemented by clients.
*/
diff --git a/org.eclipse.debug.core/.classpath b/org.eclipse.debug.core/.classpath
index 9f953dcf0..a88423063 100644
--- a/org.eclipse.debug.core/.classpath
+++ b/org.eclipse.debug.core/.classpath
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="core"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.debug.core/.options b/org.eclipse.debug.core/.options
index 47e155156..e9e46aed3 100644
--- a/org.eclipse.debug.core/.options
+++ b/org.eclipse.debug.core/.options
@@ -1,3 +1,3 @@
-org.eclipse.debug.core/debug=false
-org.eclipse.debug.core/debug/commands=false
+org.eclipse.debug.core/debug=false
+org.eclipse.debug.core/debug/commands=false
org.eclipse.debug.core/debug/events=false \ No newline at end of file
diff --git a/org.eclipse.debug.core/.settings/.api_filters b/org.eclipse.debug.core/.settings/.api_filters
new file mode 100644
index 000000000..584b5ae5c
--- /dev/null
+++ b/org.eclipse.debug.core/.settings/.api_filters
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.debug.core" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter comment="See bug 574403 and bug 578358 comment 8" id="926941240">
+ <message_arguments>
+ <message_argument value="3.19.0"/>
+ <message_argument value="3.18.300"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="core/org/eclipse/debug/core/model/IProcess.java" type="org.eclipse.debug.core.model.IProcess">
+ <filter comment="See bug 574403 and bug 578358 comment 8" id="403767336">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.core.model.IProcess"/>
+ <message_argument value="ATTR_PROCESS_ID"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs
index 4b489c6f5..5db9112e4 100644
--- a/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.core/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -133,7 +133,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
diff --git a/org.eclipse.debug.core/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.core/.settings/org.eclipse.pde.prefs
index 469adc912..45e162048 100644
--- a/org.eclipse.debug.core/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.debug.core/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=1
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=1
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 820ddc853..60eb6d1db 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
-Bundle-Version: 3.14.0.qualifier
+Bundle-Version: 3.19.100.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
@@ -12,9 +12,9 @@ Export-Package: org.eclipse.debug.core,
org.eclipse.debug.core.model,
org.eclipse.debug.core.sourcelookup,
org.eclipse.debug.core.sourcelookup.containers,
- org.eclipse.debug.internal.core;x-friends:="org.eclipse.debug.ui,org.eclipse.debug.tests,org.eclipse.debug.examples.mixedmode",
+ org.eclipse.debug.internal.core;x-friends:="org.eclipse.debug.ui,org.eclipse.debug.tests,org.eclipse.debug.examples.mixedmode,org.eclipse.jdt.launching,org.eclipse.ui.console",
org.eclipse.debug.internal.core.commands;x-friends:="org.eclipse.debug.ui",
- org.eclipse.debug.internal.core.groups,
+ org.eclipse.debug.internal.core.groups;x-friends:="org.eclipse.debug.ui",
org.eclipse.debug.internal.core.groups.observer;x-internal:=true,
org.eclipse.debug.internal.core.sourcelookup;x-friends:="org.eclipse.debug.ui",
org.eclipse.debug.internal.core.sourcelookup.containers;x-friends:="org.eclipse.debug.ui",
@@ -25,6 +25,5 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.9.0,4.0.0)";visibi
org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)",
org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)"
Bundle-ActivationPolicy: lazy
-Import-Package: com.ibm.icu.text
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.eclipse.debug.core
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 acbef267d..6bc20d819 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -81,8 +82,6 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-import com.ibm.icu.text.MessageFormat;
-
/**
* There is one instance of the debug plug-in available from
* <code>DebugPlugin.getDefault()</code>. The debug plug-in provides:
@@ -277,6 +276,14 @@ public class DebugPlugin extends Plugin {
public static final String ATTR_LAUNCH_TIMESTAMP = PI_DEBUG_CORE + ".launch.timestamp"; //$NON-NLS-1$
/**
+ * The launch attribute that stores the time stamp of when a launch configuration was
+ * launched. Value is {@link Long#toString(long)} of {@link System#currentTimeMillis()}.
+ *
+ * @since 3.15
+ */
+ public static final String ATTR_TERMINATE_TIMESTAMP = PI_DEBUG_CORE + ".terminate.timestamp"; //$NON-NLS-1$
+
+ /**
* This launch attribute designates the encoding to be used by the console
* associated with the launch.
* <p>
@@ -349,6 +356,21 @@ public class DebugPlugin extends Plugin {
public static final String ATTR_PATH = PI_DEBUG_CORE + ".ATTR_PATH"; //$NON-NLS-1$
/**
+ * Launch configuration attribute that designates whether or not the
+ * descendants of the {@link IProcess} associated to a launch of this
+ * configuration should be terminated if the main-process is terminated. The
+ * descendants (also called child- or sub-processes) of a operating system
+ * process are the processes started by that process.
+ *
+ * Value is a string representing a boolean - <code>true</code> or
+ * <code>false</code>. When unspecified, the default value is considered
+ * <code>true</code>.
+ *
+ * @since 3.18
+ */
+ public static final String ATTR_TERMINATE_DESCENDANTS = PI_DEBUG_CORE + ".TERMINATE_DESCENDANTS"; //$NON-NLS-1$
+
+ /**
* The singleton debug plug-in instance.
*/
private static DebugPlugin fgDebugPlugin= null;
@@ -584,6 +606,9 @@ public class DebugPlugin extends Plugin {
public synchronized ILaunchManager getLaunchManager() {
if (fLaunchManager == null) {
fLaunchManager = new LaunchManager();
+ fLaunchManager.getAllLaunchConfigurations();
+ // monitor launch configuration renames for launch groups
+ fLaunchManager.addLaunchConfigurationListener(new GroupMemberChangeListener());
}
return fLaunchManager;
}
@@ -719,9 +744,6 @@ public class DebugPlugin extends Plugin {
manager.registerAdapters(actionFactory, ILaunch.class);
manager.registerAdapters(actionFactory, IProcess.class);
manager.registerAdapters(actionFactory, IDebugElement.class);
-
- // monitor launch configuration renames for launch groups
- getLaunchManager().addLaunchConfigurationListener(new GroupMemberChangeListener());
}
/**
@@ -930,12 +952,10 @@ public class DebugPlugin extends Plugin {
}
}
p = pb.start();
+ } else if (workingDirectory == null) {
+ p = Runtime.getRuntime().exec(cmdLine, envp);
} else {
- if (workingDirectory == null) {
- p = Runtime.getRuntime().exec(cmdLine, envp);
- } else {
- p = Runtime.getRuntime().exec(cmdLine, envp, workingDirectory);
- }
+ p = Runtime.getRuntime().exec(cmdLine, envp, workingDirectory);
}
} catch (IOException e) {
Status status = new Status(IStatus.ERROR, getUniqueIdentifier(), ERROR, DebugCoreMessages.DebugPlugin_0, e);
@@ -1055,8 +1075,7 @@ public class DebugPlugin extends Plugin {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.PI_DEBUG_CORE, EXTENSION_POINT_STATUS_HANDLERS);
IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
fStatusHandlers = new HashMap<>(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
+ for (IConfigurationElement configurationElement : infos) {
String id = configurationElement.getAttribute("plugin"); //$NON-NLS-1$
String code = configurationElement.getAttribute("code"); //$NON-NLS-1$
@@ -1083,17 +1102,16 @@ public class DebugPlugin extends Plugin {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.PI_DEBUG_CORE, EXTENSION_POINT_PROCESS_FACTORIES);
IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
fProcessFactories = new HashMap<>(infos.length);
- for (int i= 0; i < infos.length; i++) {
- IConfigurationElement configurationElement = infos[i];
+ for (IConfigurationElement configurationElement : infos) {
String id = configurationElement.getAttribute("id"); //$NON-NLS-1$
String clss = configurationElement.getAttribute("class"); //$NON-NLS-1$
if (id != null && clss != null) {
- fProcessFactories.put(id, configurationElement);
+ fProcessFactories.put(id, configurationElement);
} else {
// invalid process factory
- String badDefiner= infos[i].getContributor().getName();
+ String badDefiner = configurationElement.getContributor().getName();
log(new Status(IStatus.ERROR, DebugPlugin.PI_DEBUG_CORE, ERROR, MessageFormat.format(DebugCoreMessages.DebugPlugin_4, new Object[] {
- badDefiner, id }), null));
+ badDefiner, id }), null));
}
}
}
@@ -1221,8 +1239,8 @@ public class DebugPlugin extends Plugin {
fMode = NOTIFY_EVENTS;
if (DebugOptions.DEBUG_EVENTS) {
- for (int i = 0; i < fEvents.length; i++) {
- DebugOptions.trace(fEvents[i].toString());
+ for (DebugEvent event : fEvents) {
+ DebugOptions.trace(event.toString());
}
}
for (IDebugEventSetListener iDebugEventSetListener : fEventListeners) {
@@ -1603,8 +1621,7 @@ public class DebugPlugin extends Plugin {
boolean containsSpace = false;
char[] characters = arguments[i].toCharArray();
- for (int j = 0; j < characters.length; j++) {
- char ch = characters[j];
+ for (char ch : characters) {
if (ch == ' ' || ch == '\t') {
containsSpace = true;
buf.append('"');
@@ -1636,6 +1653,8 @@ public class DebugPlugin extends Plugin {
} else {
buf.append('\\');
}
+ } else if (isWin32) {
+ backslashes = 0;
}
buf.append(ch);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IBinaryStreamListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBinaryStreamListener.java
new file mode 100644
index 000000000..b21697abe
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IBinaryStreamListener.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.core;
+
+import org.eclipse.debug.core.model.IBinaryStreamMonitor;
+
+/**
+ * A stream listener is notified of changes to a binary stream monitor.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ *
+ * @see IBinaryStreamMonitor
+ * @see IStreamListener
+ * @since 3.16
+ */
+public interface IBinaryStreamListener {
+
+ /**
+ * Notifies this listener that data has been appended to the given stream
+ * monitor.
+ *
+ * @param data the content appended; not <code>null</code>
+ * @param monitor the stream monitor to which content was appended
+ */
+ void streamAppended(byte[] data, IBinaryStreamMonitor monitor);
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
index 858a0bec1..4c5334e88 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java
@@ -518,7 +518,7 @@ public interface ILaunchConfiguration extends IAdaptable {
* <code>launch(String, IProgressMontitor, boolean)</code> with a
* <code>build</code> flag of <code>false</code>.
* </p>
- *
+ *
* @param mode the mode in which to launch, one of the mode constants
* defined by <code>ILaunchManager</code> - <code>RUN_MODE</code>
* or <code>DEBUG_MODE</code>.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
index ef5e72c1e..80fdf58a0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java
@@ -304,7 +304,7 @@ public interface ILaunchConfigurationWorkingCopy extends ILaunchConfiguration, I
* <p>
* This method allows non-object attributes to be removed.
* </p>
- *
+ *
* @param attributeName the name of the attribute to remove
* @return previous value of the attribute or <code>null</code>
*
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
index 5bc8a8172..a7bcc2471 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java
@@ -214,7 +214,7 @@ public interface ILaunchManager {
* <p>
* Since 3.12, the returned configuration may be a launch configuration template.
* </p>
- *
+ *
* @param file launch configuration file
* @return a handle to the launch configuration contained
* in the specified file
@@ -227,7 +227,7 @@ public interface ILaunchManager {
* <p>
* Since 3.12, the returned configuration may be a launch configuration template.
* </p>
- *
+ *
* @param memento launch configuration memento
* @return a handle to the launch configuration specified by
* the given memento
@@ -263,7 +263,7 @@ public interface ILaunchManager {
/**
* Returns all launch configurations defined in the workspace of the specified
* kind(s) (configurations and/or prototypes).
- *
+ *
* @param kinds bit mask of kinds of configurations to consider
* @return all launch configurations defined in the workspace
* @exception CoreException if an exception occurs retrieving configurations
@@ -278,7 +278,7 @@ public interface ILaunchManager {
/**
* Returns all launch configurations of the specified type defined in the workspace
* of the specified kind(s) (configurations and/or prototypes).
- *
+ *
* @param type a launch configuration type
* @param kinds bit mask of kinds of configurations to consider
* @return all launch configurations of the specified type defined in the workspace
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchMode.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchMode.java
index 5d09836ad..3e569f2c9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchMode.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchMode.java
@@ -22,7 +22,7 @@ package org.eclipse.debug.core;
* has an unique identifier specified by the <code>mode</code> attribute and a
* human readable label specified by the <code>label</code> attribute.
* </p>
- *
+ *
* <pre>
* &lt;extension point=&quot;org.eclipse.debug.core.launchModes&quot;&gt;
* &lt;launchMode
@@ -31,7 +31,7 @@ package org.eclipse.debug.core;
* &lt;/launchMode&gt;
* &lt;/extension&gt;
* </pre>
- *
+ *
* @since 3.0
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureProvider.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureProvider.java
index 0526f1927..4839a783c 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureProvider.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureProvider.java
@@ -21,7 +21,7 @@ import org.eclipse.debug.core.model.IValue;
* <p>
* The following is an example of a logical structure provider extension:
* </p>
- *
+ *
* <pre>
* &lt;extension point=&quot;org.eclipse.debug.core.logicalStructureProviders&quot;&gt;
* &lt;logicalStructureProvider
@@ -40,7 +40,7 @@ import org.eclipse.debug.core.model.IValue;
* Clients contributing logical structure providers must implement this
* interface.
* </p>
- *
+ *
* @since 3.1
* @see org.eclipse.debug.core.ILogicalStructureType
*/
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureType.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureType.java
index ff45b549e..50028e999 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILogicalStructureType.java
@@ -26,7 +26,7 @@ import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate2;
* <p>
* Following is example plug-in XML to define a logical structure type.
* </p>
- *
+ *
* <pre>
* &lt;extension point=&quot;org.eclipse.debug.core.logicalStructureTypes&quot;&gt;
* &lt;logicalStructureType
@@ -57,7 +57,7 @@ import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate2;
* logicalStructureProviders extensions may implement this interface to return a
* collection of logical structure types applicable to a value.
* </p>
- *
+ *
* @since 3.0
* @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate
* @see org.eclipse.debug.core.ILogicalStructureProvider
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java
index 468b8ca17..c6399a124 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/IProcessFactory.java
@@ -29,7 +29,7 @@ import org.eclipse.debug.core.model.IProcess;
* <p>
* Following is example plug-in XML that contributes a process factory.
* </p>
- *
+ *
* <pre>
* &lt;extension point="org.eclipse.debug.core.processFactories"&gt;
* &lt;processFactory
@@ -38,7 +38,7 @@ import org.eclipse.debug.core.model.IProcess;
* &lt;/processFactory&gt;
* &lt;/extension&gt;
* </pre>
- *
+ *
* The attributes are specified as follows:
* <ul>
* <li>id - a unique identifier for this extension point</li>
@@ -49,7 +49,7 @@ import org.eclipse.debug.core.model.IProcess;
* Clients contributing a process factory are intended to implement this
* interface.
* </p>
- *
+ *
* @since 3.0
*/
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 0f2cf17a3..9e0b6b228 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
@@ -259,8 +259,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
//stop targets first to free up and sockets, etc held by the target
// terminate or disconnect debug target if it is still alive
IDebugTarget[] targets = getDebugTargets();
- for (int i = 0; i < targets.length; i++) {
- IDebugTarget target= targets[i];
+ for (IDebugTarget target : targets) {
if (target != null) {
if (target.canTerminate()) {
try {
@@ -268,13 +267,11 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
} catch (DebugException e) {
status.merge(e.getStatus());
}
- } else {
- if (target.canDisconnect()) {
- try {
- target.disconnect();
- } catch (DebugException de) {
- status.merge(de.getStatus());
- }
+ } else if (target.canDisconnect()) {
+ try {
+ target.disconnect();
+ } catch (DebugException de) {
+ status.merge(de.getStatus());
}
}
}
@@ -282,8 +279,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
//second kill the underlying process
// terminate the system processes
IProcess[] processes = getProcesses();
- for (int i = 0; i < processes.length; i++) {
- IProcess process = processes[i];
+ for (IProcess process : processes) {
if (process.canTerminate()) {
try {
process.terminate();
@@ -452,8 +448,8 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
*/
protected void addProcesses(IProcess[] processes) {
if (processes != null) {
- for (int i = 0; i < processes.length; i++) {
- addProcess(processes[i]);
+ for (IProcess process : processes) {
+ addProcess(process);
fireChanged();
}
}
@@ -477,6 +473,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
* properly created/initialized.
*/
protected void fireTerminate() {
+ setAttribute(DebugPlugin.ATTR_TERMINATE_TIMESTAMP, Long.toString(System.currentTimeMillis()));
if (!fSuppressChange) {
((LaunchManager)getLaunchManager()).fireUpdate(this, LaunchManager.TERMINATE);
((LaunchManager)getLaunchManager()).fireUpdate(new ILaunch[] {this}, LaunchManager.TERMINATE);
@@ -633,8 +630,7 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getKind() == DebugEvent.TERMINATE) {
Object object = event.getSource();
ILaunch launch = null;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java
index e053e5afb..15bc7aaf7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/RefreshUtil.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.core;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -36,8 +37,6 @@ import org.eclipse.debug.internal.core.IMementoConstants;
import org.eclipse.debug.internal.core.ResourceFactory;
import org.eclipse.debug.internal.core.XMLMemento;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Utilities for launch configurations that persist, restore, and refresh
* collections of resources.
@@ -125,13 +124,13 @@ public class RefreshUtil {
}
MultiStatus status = new MultiStatus(DebugPlugin.getUniqueIdentifier(), 0, DebugCoreMessages.RefreshingResourcesError, null);
try {
- for (int i = 0; i < resources.length; i++) {
+ for (IResource resource : resources) {
if (lmonitor.isCanceled()) {
break;
}
- if (resources[i] != null && resources[i].isAccessible()) {
+ if (resource != null && resource.isAccessible()) {
try {
- resources[i].refreshLocal(depth, null);
+ resource.refreshLocal(depth, null);
} catch (CoreException e) {
status.merge(e.getStatus());
}
@@ -184,14 +183,12 @@ public class RefreshUtil {
if (resource == null) {
// empty selection
return new IResource[]{};
- } else {
- if (memento.equals(MEMENTO_SELECTED_RESOURCE)) {
- return new IResource[] { resource };
- } else if (memento.equals(MEMENTO_SELECTED_CONTAINER)) {
- return new IResource[] {resource.getParent()};
- } else if (memento.equals(MEMENTO_SELECTED_PROJECT)) {
- return new IResource[] {resource.getProject()};
- }
+ } else if (memento.equals(MEMENTO_SELECTED_RESOURCE)) {
+ return new IResource[] { resource };
+ } else if (memento.equals(MEMENTO_SELECTED_CONTAINER)) {
+ return new IResource[] {resource.getParent()};
+ } else if (memento.equals(MEMENTO_SELECTED_PROJECT)) {
+ return new IResource[] {resource.getProject()};
}
}
throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), MessageFormat.format(DebugCoreMessages.RefreshUtil_0, memento)));
@@ -206,9 +203,9 @@ public class RefreshUtil {
*/
public static String toMemento(IResource[] resources) {
XMLMemento memento = XMLMemento.createWriteRoot("resources"); //$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
+ for (IResource resource : resources) {
final XMLMemento itemMemento = memento.createChild(IMementoConstants.MEMENTO_ITEM);
- ResourceFactory.saveState(itemMemento, resources[i]);
+ ResourceFactory.saveState(itemMemento, resource);
}
StringWriter writer = new StringWriter();
try {
@@ -248,8 +245,8 @@ public class RefreshUtil {
}
XMLMemento[] mementos = memento.getChildren(IMementoConstants.MEMENTO_ITEM);
- for (int i = 0; i < mementos.length; i++) {
- resourcesList.add(ResourceFactory.createElement(mementos[i]));
+ for (XMLMemento m : mementos) {
+ resourcesList.add(ResourceFactory.createElement(m));
}
return resourcesList.toArray(new IResource[resourcesList.size()]);
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 89f371ded..a5bcf748d 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
@@ -162,12 +162,17 @@ public abstract class AbstractDebugCommand implements IDebugCommandHandler {
public void sleeping(IJobChangeEvent event) {
}
+ @Override
+ public String toString() {
+ return getName() + " on " + request; //$NON-NLS-1$
+ }
+
}
/**
* Scheduling rule to serialize commands on an object
*/
- private class SerialPerObjectRule implements ISchedulingRule {
+ private static class SerialPerObjectRule implements ISchedulingRule {
private Object fObject = null;
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 ef7c44ebf..492323041 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
@@ -23,7 +23,6 @@ import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
@@ -209,12 +208,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint,
*/
protected void setAttribute(final String attributeName, final boolean value) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttribute(attributeName, value);
- }
- };
+ IWorkspaceRunnable runnable= monitor -> ensureMarker().setAttribute(attributeName, value);
workspace.run(runnable, getMarkerRule(), IWorkspace.AVOID_UPDATE, null);
}
@@ -232,12 +226,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint,
*/
protected void setAttribute(final String attributeName, final int value) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttribute(attributeName, value);
- }
- };
+ IWorkspaceRunnable runnable= monitor -> ensureMarker().setAttribute(attributeName, value);
workspace.run(runnable, getMarkerRule(), IWorkspace.AVOID_UPDATE, null);
}
@@ -255,12 +244,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint,
*/
protected void setAttribute(final String attributeName, final Object value) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttribute(attributeName, value);
- }
- };
+ IWorkspaceRunnable runnable= monitor -> ensureMarker().setAttribute(attributeName, value);
workspace.run(runnable, getMarkerRule(), IWorkspace.AVOID_UPDATE, null);
}
@@ -278,12 +262,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint,
*/
protected void setAttributes(final String[] attributeNames, final Object[] values) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttributes(attributeNames, values);
- }
- };
+ IWorkspaceRunnable runnable= monitor -> ensureMarker().setAttributes(attributeNames, values);
workspace.run(runnable, getMarkerRule(), IWorkspace.AVOID_UPDATE, null);
}
@@ -300,12 +279,7 @@ public abstract class Breakpoint extends PlatformObject implements IBreakpoint,
*/
protected void setAttributes(final Map<String, ? extends Object> attributes) throws CoreException {
IWorkspace workspace= ResourcesPlugin.getWorkspace();
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ensureMarker().setAttributes(attributes);
- }
- };
+ IWorkspaceRunnable runnable= monitor -> ensureMarker().setAttributes(attributes);
workspace.run(runnable, getMarkerRule(), IWorkspace.AVOID_UPDATE, null);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamMonitor.java
new file mode 100644
index 000000000..1fe05444b
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamMonitor.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.core.model;
+
+import org.eclipse.debug.core.IBinaryStreamListener;
+
+/**
+ * A variant of {@link IStreamMonitor} which does not touch the received content
+ * and pass it as bytes instead of strings.
+ * <p>
+ * A stream monitor manages the contents of the stream a process is writing to,
+ * and notifies registered listeners of changes in the stream.
+ * </p>
+ * <p>
+ * Clients may implement this interface. Generally, a client that provides an
+ * implementation of the {@link IBinaryStreamsProxy} interface must also provide
+ * an implementation of this interface.
+ * </p>
+ *
+ * @see org.eclipse.debug.core.model.IStreamsProxy
+ * @see org.eclipse.debug.core.model.IFlushableStreamMonitor
+ * @since 3.16
+ */
+public interface IBinaryStreamMonitor extends IFlushableStreamMonitor {
+ /**
+ * Adds the given listener to this stream monitor's registered listeners.
+ * Has no effect if an identical listener is already registered.
+ *
+ * @param listener the listener to add
+ */
+ void addBinaryListener(IBinaryStreamListener listener);
+
+ /**
+ * Returns the entire current contents of the stream. An empty array is
+ * returned if the stream is empty.
+ * <p>
+ * Note: the current content is influenced by the buffering mechanism.
+ * </p>
+ *
+ * @return the stream contents as array
+ * @see #isBuffered()
+ * @see #flushContents()
+ */
+ byte[] getData();
+
+ /**
+ * Removes the given listener from this stream monitor's registered listeners.
+ * Has no effect if the listener is not already registered.
+ *
+ * @param listener the listener to remove
+ */
+ void removeBinaryListener(IBinaryStreamListener listener);
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamsProxy.java
new file mode 100644
index 000000000..d355e26c7
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBinaryStreamsProxy.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.core.model;
+
+import java.io.IOException;
+
+/**
+ * A variant of {@link IStreamsProxy} which does not touch the proxied content
+ * and pass it as bytes instead of strings.
+ * <p>
+ * A streams proxy acts as proxy between the streams of a process and interested
+ * clients. This abstraction allows implementations of <code>IProcess</code> to
+ * handle I/O related to the standard input, output, and error streams
+ * associated with a process.
+ * </p>
+ * <p>
+ * Clients implementing the <code>IProcess</code> interface for a process which
+ * produce or consumes binary content should consider to implement this
+ * interface instead of just {@link IStreamsProxy}.
+ * </p>
+ *
+ * @see IProcess
+ * @see IStreamsProxy
+ * @since 3.16
+ */
+public interface IBinaryStreamsProxy extends IStreamsProxy2 {
+ /**
+ * Returns a monitor for the error stream of this proxy's process, or
+ * <code>null</code> if not supported.
+ * <p>
+ * The monitor is connected to the error stream of the associated process.
+ * </p>
+ * <p>
+ * In contrast to {@link #getErrorStreamMonitor()} which will decode the
+ * stream content to strings, the {@link IBinaryStreamMonitor} will provide
+ * the raw stream data.
+ * </p>
+ *
+ * @return an error stream monitor, or <code>null</code> if none
+ */
+ IBinaryStreamMonitor getBinaryErrorStreamMonitor();
+
+ /**
+ * Returns a monitor for the output stream of this proxy's process, or
+ * <code>null</code> if not supported.
+ * <p>
+ * The monitor is connected to the output stream of the associated process.
+ * </p>
+ * <p>
+ * In contrast to {@link #getOutputStreamMonitor()} which will decode the
+ * stream content to strings, the {@link IBinaryStreamMonitor} will provide
+ * the raw stream data.
+ * </p>
+ *
+ * @return an output stream monitor, or <code>null</code> if none
+ */
+ IBinaryStreamMonitor getBinaryOutputStreamMonitor();
+
+ /**
+ * Writes the given data to the output stream connected to the standard
+ * input stream of this proxy's process.
+ *
+ * @param data the data to be written
+ * @exception IOException when an error occurs writing to the underlying
+ * <code>OutputStream</code>.
+ */
+ default void write(byte[] data) throws IOException {
+ write(data, 0, data.length);
+ }
+
+ /**
+ * Writes the given data to the output stream connected to the standard
+ * input stream of this proxy's process.
+ *
+ * @param data the data to be written
+ * @param offset start offset in the data
+ * @param length number of bytes to write
+ * @exception IOException when an error occurs writing to the underlying
+ * <code>OutputStream</code>.
+ */
+ void write(byte[] data, int offset, int length) throws IOException;
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
index a0e5f832e..5272b58f9 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpoint.java
@@ -43,12 +43,12 @@ import org.eclipse.debug.core.DebugPlugin;
* markerType="com.example.BreakpointMarker"&gt;
* &lt;/breakpoint&gt;
* &lt;/extension&gt;
- * &lt;extension point="org.eclipse.core.resources.markers"&gt;
- * &lt;marker
+ * &lt;extension
+ * point="org.eclipse.core.resources.markers"
* id="com.example.BreakpointMarker"
- * super type="org.eclipse.debug.core.breakpointMarker"
- * attribute name ="exampleAttribute"&gt;
- * &lt;/marker&gt;
+ * name="Example Breakpoint"&gt;
+ * &lt;super type="org.eclipse.debug.core.breakpointMarker"/&gt;
+ * &lt;attribute name="exampleAttribute"/&gt;
* &lt;/extension&gt;
* </pre>
* <p>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java
index a986fc6fb..c48205f2b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IBreakpointImportParticipant.java
@@ -33,7 +33,7 @@ import org.eclipse.debug.core.IBreakpointManager;
* <p>
* Following is an example of a breakpoint participant extension:
* </p>
- *
+ *
* <pre>
* &lt;extension point="org.eclipse.debug.core.breakpointImportParticipants"&gt;
* &lt;importParticipant
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFlushableStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFlushableStreamMonitor.java
index e0c309ac5..651fbf5ae 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFlushableStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IFlushableStreamMonitor.java
@@ -22,6 +22,8 @@ package org.eclipse.debug.core.model;
* Clients may implement this interface.
* </p>
* @since 2.1
+ * @see IStreamMonitor
+ * @see IBinaryStreamMonitor
*/
public interface IFlushableStreamMonitor extends IStreamMonitor {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILogicalStructureTypeDelegate3.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILogicalStructureTypeDelegate3.java
new file mode 100644
index 000000000..8ba0d52e6
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ILogicalStructureTypeDelegate3.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Julian Honnen
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Julian Honnen <julian.honnen@vector.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.core.model;
+
+/**
+ * Optional extension to <code>ILogicalStructureTypeDelegate</code> that allows
+ * a logical structure type delegate to garbage collect its logical structures
+ * once they're no longer displayed.
+ *
+ * @since 3.17
+ * @see ILogicalStructureTypeDelegate
+ */
+public interface ILogicalStructureTypeDelegate3 {
+
+ /**
+ * Called when the logical structure returned from
+ * {@link ILogicalStructureTypeDelegate#getLogicalStructure(IValue)} is no
+ * longer used and can be discarded.
+ *
+ * @param logicalStructure the logical structure value to discard
+ */
+ void releaseValue(IValue logicalStructure);
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java
index e7d9aa3b2..2df9d2b2d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IProcess.java
@@ -62,6 +62,15 @@ public interface IProcess extends IAdaptable, ITerminate {
String ATTR_PROCESS_LABEL = DebugPlugin.getUniqueIdentifier() + ".ATTR_PROCESS_LABEL"; //$NON-NLS-1$
/**
+ * Attribute key for a common, optional, process property. The value of this
+ * attribute specifies process id, displayed in the console description or
+ * in the debug view.
+ *
+ * @since 3.19
+ */
+ String ATTR_PROCESS_ID = DebugPlugin.getUniqueIdentifier() + ".ATTR_PROCESS_ID"; //$NON-NLS-1$
+
+ /**
* Returns a human-readable label for this process.
*
* @return a label for this process
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java
index 5f4f087a6..8f9f4504e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/ISourceLocator.java
@@ -14,8 +14,6 @@
package org.eclipse.debug.core.model;
-import org.eclipse.debug.core.model.IStackFrame;
-
/**
* A source locator locates source elements for stack frames. A launch (optionally)
* specifies a source locator which is
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java
index 4183815f5..1178f0727 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java
@@ -20,10 +20,10 @@ package org.eclipse.debug.core.model;
*
* <pre>
* &lt;extension point=&quot;org.eclipse.debug.core.stepFilters&quot;&gt;
- * &lt;stepFilters
+ * &lt;stepFilter
* class=&quot;com.example.ExampleStepFilters&quot;
* modelIdentifier=&quot;com.example.debug.model&quot;&gt;
- * &lt;/stepFilters&gt;
+ * &lt;/stepFilter&gt;
* &lt;/extension&gt;
* </pre>
* <p>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java
index aa26d7acb..8a5677e37 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamMonitor.java
@@ -27,6 +27,7 @@ import org.eclipse.debug.core.IStreamListener;
* </p>
* @see org.eclipse.debug.core.model.IStreamsProxy
* @see org.eclipse.debug.core.model.IFlushableStreamMonitor
+ * @see org.eclipse.debug.core.model.IBinaryStreamMonitor
*/
public interface IStreamMonitor {
/**
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java
index 83e5755b2..72d00a2fb 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStreamsProxy.java
@@ -27,6 +27,7 @@ import java.io.IOException;
* provide an implementation of this interface.
* </p>
* @see IProcess
+ * @see IBinaryStreamsProxy
*/
public interface IStreamsProxy {
/**
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
index c347fee52..5b2917983 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IValue.java
@@ -75,7 +75,7 @@ public interface IValue extends IDebugElement {
* For example, if this value represents an object that has been garbage
* collected, <code>false</code> is returned.
* </p>
- *
+ *
* @return whether this value is currently allocated
* @exception DebugException if this method fails. Reasons include:
* <ul>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
index 9b444f037..4966faff7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IVariable.java
@@ -69,7 +69,7 @@ public interface IVariable extends IDebugElement, IValueModification {
* </ul>
*/
String getName() throws DebugException;
-
+
/**
* Returns a description of the type of data this variable is declared to
* reference. Note that the declared type of a variable and the concrete
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IWatchExpression.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IWatchExpression.java
index 7cca45079..01388a582 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IWatchExpression.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IWatchExpression.java
@@ -42,7 +42,7 @@ public interface IWatchExpression extends IErrorReportingExpression {
* generally be asynchronous to avoid blocking the calling thread.
*/
void evaluate();
-
+
/**
* Sets the context for this watch expression, or <code>null</code> if none.
* If the given context is valid for this expression, this expression may
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 142c01828..7399bd968 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
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.debug.core.model;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -44,8 +45,6 @@ import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.debug.internal.core.DebugCoreMessages;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Default implementation of a launch configuration delegate. Provides
* convenience methods for computing the build order of projects,
@@ -163,10 +162,10 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
monitor.subTask(DebugCoreMessages.LaunchConfigurationDelegate_6);
List<IAdaptable> errors = new ArrayList<>();
- for (int i = 0; i < projects.length; i++) {
- monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, new Object[] { projects[i].getName() }));
- if (existsProblems(projects[i])) {
- errors.add(projects[i]);
+ for (IProject project : projects) {
+ monitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchConfigurationDelegate_7, new Object[] { project.getName() }));
+ if (existsProblems(project)) {
+ errors.add(project);
}
}
if (!errors.isEmpty()) {
@@ -203,8 +202,8 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
if (breakpoints == null) {
return true;
}
- for (int i = 0; i < breakpoints.length; i++) {
- if (breakpoints[i].isEnabled()) {
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (breakpoint.isEnabled()) {
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
if (prompter != null) {
boolean launchInDebugModeInstead = ((Boolean)prompter.handleStatus(switchToDebugPromptStatus, configuration)).booleanValue();
@@ -283,9 +282,9 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
*/
protected IProject[] computeReferencedBuildOrder(IProject[] baseProjects) throws CoreException {
HashSet<IProject> unorderedProjects = new HashSet<>();
- for(int i = 0; i< baseProjects.length; i++) {
- unorderedProjects.add(baseProjects[i]);
- addReferencedProjects(baseProjects[i], unorderedProjects);
+ for (IProject baseProject : baseProjects) {
+ unorderedProjects.add(baseProject);
+ addReferencedProjects(baseProject, unorderedProjects);
}
IProject[] projectSet = unorderedProjects.toArray(new IProject[unorderedProjects.size()]);
return computeBuildOrder(projectSet);
@@ -303,9 +302,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
*/
protected void addReferencedProjects(IProject project, Set<IProject> references) throws CoreException {
if (project.isOpen()) {
- IProject[] projects = project.getReferencedProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject refProject= projects[i];
+ for (IProject refProject : project.getReferencedProjects()) {
if (refProject.exists() && !references.contains(refProject)) {
references.add(refProject);
addReferencedProjects(refProject, references);
@@ -330,8 +327,7 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
List<IProject> unorderedProjects = new ArrayList<>(projects.length);
Collections.addAll(unorderedProjects, projects);
- for (int i = 0; i < orderedNames.length; i++) {
- String projectName = orderedNames[i];
+ for (String projectName : orderedNames) {
for (Iterator<IProject> iterator = unorderedProjects.iterator(); iterator.hasNext();) {
IProject project = iterator.next();
if (project.getName().equals(projectName)) {
@@ -364,8 +360,8 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
protected boolean existsProblems(IProject proj) throws CoreException {
IMarker[] markers = proj.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
if (markers.length > 0) {
- for (int i = 0; i < markers.length; i++) {
- if (isLaunchProblem(markers[i])) {
+ for (IMarker marker : markers) {
+ if (isLaunchProblem(marker)) {
return true;
}
}
@@ -400,20 +396,17 @@ public abstract class LaunchConfigurationDelegate implements ILaunchConfiguratio
* @throws CoreException if an exception occurs while building
*/
protected void buildProjects(final IProject[] projects, IProgressMonitor monitor) throws CoreException {
- IWorkspaceRunnable build = new IWorkspaceRunnable(){
- @Override
- public void run(IProgressMonitor pm) throws CoreException {
- SubMonitor localmonitor = SubMonitor.convert(pm, DebugCoreMessages.LaunchConfigurationDelegate_scoped_incremental_build, projects.length);
- try {
- for (int i = 0; i < projects.length; i++ ) {
- if (localmonitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- projects[i].build(IncrementalProjectBuilder.INCREMENTAL_BUILD, localmonitor.newChild(1));
+ IWorkspaceRunnable build = pm -> {
+ SubMonitor localmonitor = SubMonitor.convert(pm, DebugCoreMessages.LaunchConfigurationDelegate_scoped_incremental_build, projects.length);
+ try {
+ for (IProject project : projects) {
+ if (localmonitor.isCanceled()) {
+ throw new OperationCanceledException();
}
- } finally {
- localmonitor.done();
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, localmonitor.newChild(1));
}
+ } finally {
+ localmonitor.done();
}
};
ResourcesPlugin.getWorkspace().run(build, monitor);
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 9f56edef5..62a4e6c5b 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,11 +13,19 @@
*******************************************************************************/
package org.eclipse.debug.core.model;
-
+import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Collectors;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
@@ -30,7 +38,6 @@ import org.eclipse.debug.internal.core.DebugCoreMessages;
import org.eclipse.debug.internal.core.NullStreamsProxy;
import org.eclipse.debug.internal.core.StreamsProxy;
-
/**
* Standard implementation of an <code>IProcess</code> that wrappers a system
* process (<code>java.lang.Process</code>).
@@ -47,8 +54,7 @@ import org.eclipse.debug.internal.core.StreamsProxy;
*/
public class RuntimeProcess extends PlatformObject implements IProcess {
- private static final int MAX_WAIT_FOR_DEATH_ATTEMPTS = 10;
- private static final int TIME_TO_WAIT_FOR_THREAD_DEATH = 500; // ms
+ private static final int TERMINATION_TIMEOUT = 5000; // ms
/**
* The launch this process is contained in
@@ -69,7 +75,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* The monitor which listens for this runtime process' system process
* to terminate.
*/
- private ProcessMonitorThread fMonitor;
+ private final ProcessMonitorThread fMonitor;
/**
* The streams proxy for this process
@@ -97,6 +103,13 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
private boolean fCaptureOutput = true;
/**
+ * Whether the descendants of this process should be terminated too
+ */
+ private boolean fTerminateDescendants = true;
+
+ private final String fThreadNameSuffix;
+
+ /**
* Constructs a RuntimeProcess on the given system process
* with the given name, adding this process to the given
* launch.
@@ -110,25 +123,51 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
public RuntimeProcess(ILaunch launch, Process process, String name, Map<String, String> attributes) {
setLaunch(launch);
initializeAttributes(attributes);
- fProcess= process;
- fName= name;
- fTerminated= true;
+ fProcess = process;
+ try {
+ setAttribute(IProcess.ATTR_PROCESS_ID, Long.toString(process.pid()));
+ } catch (UnsupportedOperationException e) {
+ // ignore, pid() is not implemented in this JVM
+ }
+ fName = name;
+ fTerminated = true;
try {
fExitValue = process.exitValue();
} catch (IllegalThreadStateException e) {
- fTerminated= false;
+ fTerminated = false;
}
String captureOutput = launch.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT);
fCaptureOutput = !("false".equals(captureOutput)); //$NON-NLS-1$
- fStreamsProxy= createStreamsProxy();
- fMonitor = new ProcessMonitorThread(this);
+ try {
+ ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
+ if (launchConfiguration != null) {
+ fTerminateDescendants = launchConfiguration.getAttribute(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true);
+ }
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ fThreadNameSuffix = getPidInfo(process, launch);
+
+ fStreamsProxy = createStreamsProxy();
+ fMonitor = new ProcessMonitorThread(fThreadNameSuffix);
fMonitor.start();
launch.addProcess(this);
fireCreationEvent();
}
+ private static String getPidInfo(Process process, ILaunch launch) {
+ String pid;
+ ILaunchConfiguration lc = launch == null ? null : launch.getLaunchConfiguration();
+ String name = lc == null ? "" : " " + lc.getName(); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ pid = " for PID " + process.pid(); //$NON-NLS-1$
+ } catch (Exception e) {
+ pid = ""; //$NON-NLS-1$
+ }
+ return pid + name;
+ }
/**
* Initialize the attributes of this process to those in the given map.
*
@@ -136,9 +175,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
*/
private void initializeAttributes(Map<String, String> attributes) {
if (attributes != null) {
- for (Entry<String, String> entry : attributes.entrySet()) {
- setAttribute(entry.getKey(), entry.getValue());
- }
+ attributes.forEach(this::setAttribute);
}
}
@@ -198,44 +235,87 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
@Override
public void terminate() throws DebugException {
if (!isTerminated()) {
- if (fStreamsProxy instanceof StreamsProxy) {
- ((StreamsProxy)fStreamsProxy).kill();
- }
- Process process = getSystemProcess();
- if (process != null) {
- process.destroy();
- }
- int attempts = 0;
- while (attempts < MAX_WAIT_FOR_DEATH_ATTEMPTS) {
- try {
- process = getSystemProcess();
- if (process != null) {
- fExitValue = process.exitValue(); // throws exception if process not exited
- }
+ try {
+ Process process = getSystemProcess();
+ if (process == null) {
return;
- } catch (IllegalThreadStateException ie) {
}
- try {
- Thread.sleep(TIME_TO_WAIT_FOR_THREAD_DEATH);
+
+ List<ProcessHandle> descendants = Collections.emptyList();
+ if (fTerminateDescendants) {
+ try { // List of descendants of process is only a snapshot!
+ descendants = process.descendants().collect(Collectors.toList());
+ } catch (UnsupportedOperationException e) {
+ // JVM may not support toHandle() -> assume no
+ // descendants
+ }
+ }
+
+ process.destroy();
+ descendants.forEach(ProcessHandle::destroy);
+
+ // await termination of process and descendants
+ try { // (in total don't wait longer than TERMINATION_TIMEOUT)
+ long waitStart = System.currentTimeMillis();
+ if (process.waitFor(TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS)) {
+ fExitValue = process.exitValue();
+ if (waitFor(descendants, waitStart)) {
+ return;
+ }
+ }
} catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ } finally {
+ if (fStreamsProxy instanceof StreamsProxy) {
+ ((StreamsProxy) fStreamsProxy).kill();
}
- attempts++;
}
+
// clean-up
- if (fMonitor != null) {
- fMonitor.killThread();
- fMonitor = null;
- }
+ fMonitor.killThread();
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugException.TARGET_REQUEST_FAILED, DebugCoreMessages.RuntimeProcess_terminate_failed, null);
throw new DebugException(status);
}
}
/**
+ * Awaits the termination of the processes of the given ProcessHandles.
+ * <p>
+ * If all of the specified processes terminate before {@code waitStart} +
+ * {@link #TERMINATION_TIMEOUT} this methods returns {@code true}. If any
+ * process has not terminated until the so specified timeout this methods
+ * aborts waiting and returns {@code false}.
+ * </p>
+ *
+ * @param descendants the list of handles to the processes to await
+ * @param waitStart the time when await of the process termination started
+ * @return true if each process has terminated (before timeout), else false
+ * @throws InterruptedException if the current thread was interrupted while
+ * waiting
+ */
+ private boolean waitFor(List<ProcessHandle> descendants, long waitStart) throws InterruptedException {
+ try {
+ for (ProcessHandle handle : descendants) {
+ long remainingTime = TERMINATION_TIMEOUT - (System.currentTimeMillis() - waitStart);
+ // await termination of this descendant
+ handle.onExit().get(remainingTime, TimeUnit.MILLISECONDS);
+ }
+ return true;
+ } catch (ExecutionException e) { // should not happen
+ throw new IllegalStateException(e.getCause());
+ } catch (TimeoutException e) {
+ return false; // any sub-processes timed out
+ }
+ }
+
+ /**
* Notification that the system process associated with this process
* has terminated.
*/
protected void terminated() {
+ setAttribute(DebugPlugin.ATTR_TERMINATE_TIMESTAMP, Long.toString(System.currentTimeMillis()));
+
if (fStreamsProxy instanceof StreamsProxy) {
((StreamsProxy)fStreamsProxy).close();
}
@@ -281,7 +361,15 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
return new NullStreamsProxy(getSystemProcess());
}
String encoding = getLaunch().getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING);
- return new StreamsProxy(getSystemProcess(), encoding);
+ Charset charset = null;
+ if (encoding != null) {
+ try {
+ charset = Charset.forName(encoding);
+ } catch (UnsupportedCharsetException | IllegalCharsetNameException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ return new StreamsProxy(getSystemProcess(), charset, fThreadNameSuffix);
}
/**
@@ -354,9 +442,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
if (adapter.equals(IDebugTarget.class)) {
ILaunch launch = getLaunch();
IDebugTarget[] targets = launch.getDebugTargets();
- for (int i = 0; i < targets.length; i++) {
- if (this.equals(targets[i].getProcess())) {
- return (T) targets[i];
+ for (IDebugTarget target : targets) {
+ if (this.equals(target.getProcess())) {
+ return (T) target;
}
}
return null;
@@ -370,6 +458,7 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
}
return super.getAdapter(adapter);
}
+
/**
* @see IProcess#getExitValue()
*/
@@ -385,68 +474,40 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* Monitors a system process, waiting for it to terminate, and
* then notifies the associated runtime process.
*/
- class ProcessMonitorThread extends Thread {
+ private class ProcessMonitorThread extends Thread {
/**
* Whether the thread has been told to exit.
*/
- protected boolean fExit;
- /**
- * The underlying <code>java.lang.Process</code> being monitored.
- */
- protected Process fOSProcess;
- /**
- * The <code>IProcess</code> which will be informed when this
- * monitor detects that the underlying process has terminated.
- */
- protected RuntimeProcess fRuntimeProcess;
-
- /**
- * The <code>Thread</code> which is monitoring the underlying process.
- */
- protected Thread fThread;
-
- /**
- * A lock protecting access to <code>fThread</code>.
- */
- private final Object fThreadLock = new Object();
+ private volatile boolean fExit;
/**
* @see Thread#run()
*/
@Override
public void run() {
- synchronized (fThreadLock) {
- if (fExit) {
- return;
- }
- fThread = Thread.currentThread();
- }
- while (fOSProcess != null) {
+ Process fOSProcess = RuntimeProcess.this.getSystemProcess();
+ if (!fExit && fOSProcess != null) {
try {
fOSProcess.waitFor();
} catch (InterruptedException ie) {
// clear interrupted state
Thread.interrupted();
} finally {
- fOSProcess = null;
- fRuntimeProcess.terminated();
+ RuntimeProcess.this.terminated();
}
}
- fThread = null;
}
/**
* Creates a new process monitor and starts monitoring the process for
* termination.
*
- * @param process process to monitor for termination
+ * @param suffix Thread name suffix
*/
- public ProcessMonitorThread(RuntimeProcess process) {
- super(DebugCoreMessages.ProcessMonitorJob_0);
+ private ProcessMonitorThread(String suffix) {
+ super(DebugCoreMessages.ProcessMonitorJob_0 + suffix);
setDaemon(true);
- fRuntimeProcess= process;
- fOSProcess= process.getSystemProcess();
}
/**
@@ -456,14 +517,9 @@ public class RuntimeProcess extends PlatformObject implements IProcess {
* case of an underlying process which has not informed this
* monitor of its termination.
*/
- protected void killThread() {
- synchronized (fThreadLock) {
- if (fThread == null) {
- fExit = true;
- } else {
- fThread.interrupt();
- }
- }
+ private void killThread() {
+ fExit = true;
+ this.interrupt(); // ignored if monitor thread is not yet running
}
}
}
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 3612cb1ff..153a7e980 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
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.debug.core.sourcelookup;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -41,8 +42,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Directs source lookup among a collection of source lookup participants,
* and a common collection of source containers.
@@ -132,16 +131,16 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
CoreException single = null;
ISourceLookupParticipant[] participants = getParticipants();
try {
- for(int i=0; i < participants.length; i++) {
- setCurrentParticipant(participants[i]);
+ for (ISourceLookupParticipant participant : participants) {
+ setCurrentParticipant(participant);
Object[] sourceArray;
try {
- sourceArray = participants[i].findSourceElements(fElement);
+ sourceArray = participant.findSourceElements(fElement);
if (sourceArray !=null && sourceArray.length > 0) {
if (isFindDuplicates()) {
- for(int j=0; j<sourceArray.length; j++) {
- if(!checkDuplicate(sourceArray[j], fSourceElements)) {
- fSourceElements.add(sourceArray[j]);
+ for (Object s : sourceArray) {
+ if (!checkDuplicate(s, fSourceElements)) {
+ fSourceElements.add(s);
}
}
} else {
@@ -214,8 +213,8 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
}
fParticipants.clear();
if (fSourceContainers != null) {
- for (int i = 0; i < fSourceContainers.length; i++) {
- fSourceContainers[i].dispose();
+ for (ISourceContainer container : fSourceContainers) {
+ container.dispose();
}
}
fSourceContainers = null;
@@ -370,9 +369,8 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
}
rootNode.appendChild(pathNode);
if(fSourceContainers !=null){
- for(int i=0; i<fSourceContainers.length; i++){
+ for (ISourceContainer container : fSourceContainers) {
Element node = doc.createElement(CONTAINER_NODE);
- ISourceContainer container = fSourceContainers[i];
ISourceContainerType type = container.getType();
node.setAttribute(CONTAINER_TYPE_ATTR, type.getId());
node.setAttribute(CONTAINER_MEMENTO_ATTR, type.getMemento(container));
@@ -434,15 +432,14 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
synchronized (this) {
List<ISourceContainer> list = Arrays.asList(containers);
ISourceContainer[] old = getSourceContainers();
- for (int i = 0; i < old.length; i++) {
+ for (ISourceContainer container : old) {
// skip overlapping containers
- if (!list.contains(old[i])) {
- old[i].dispose();
+ if (!list.contains(container)) {
+ container.dispose();
}
}
fSourceContainers = containers;
- for (int i = 0; i < containers.length; i++) {
- ISourceContainer container = containers[i];
+ for (ISourceContainer container : containers) {
container.init(this);
}
}
@@ -450,8 +447,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
fResolvedElements = null;
// notify participants
ISourceLookupParticipant[] participants = getParticipants();
- for (int i = 0; i < participants.length; i++) {
- ISourceLookupParticipant participant = participants[i];
+ for (ISourceLookupParticipant participant : participants) {
participant.sourceContainersChanged(this);
}
}
@@ -538,7 +534,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
return false;
}
for (Object obj : sources) {
- if (obj.equals(sourceToAdd)) {
+ if (equalSourceElements(obj, sourceToAdd)) {
return true;
}
}
@@ -663,8 +659,7 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
@Override
public void addParticipants(ISourceLookupParticipant[] participants) {
- for (int i = 0; i < participants.length; i++) {
- ISourceLookupParticipant participant = participants[i];
+ for (ISourceLookupParticipant participant : participants) {
addSourceLookupParticipant(participant);
participant.sourceContainersChanged(this);
}
@@ -672,8 +667,8 @@ public abstract class AbstractSourceLookupDirector implements ISourceLookupDirec
@Override
public void removeParticipants(ISourceLookupParticipant[] participants) {
- for (int i = 0; i < participants.length; i++) {
- removeSourceLookupParticipant(participants[i]);
+ for (ISourceLookupParticipant participant : participants) {
+ removeSourceLookupParticipant(participant);
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
index 50728d593..6a3da24a8 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/AbstractSourceLookupParticipant.java
@@ -58,9 +58,9 @@ public abstract class AbstractSourceLookupParticipant implements ISourceLookupPa
String name = getSourceName(object);
if (name != null) {
ISourceContainer[] containers = getSourceContainers();
- for (int i = 0; i < containers.length; i++) {
+ for (ISourceContainer c : containers) {
try {
- ISourceContainer container = getDelegateContainer(containers[i]);
+ ISourceContainer container = getDelegateContainer(c);
if (container != null) {
Object[] objects = container.findSourceElements(name);
if (objects.length > 0) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceContainerType.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceContainerType.java
index 49053aad3..6576b4d92 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceContainerType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceContainerType.java
@@ -26,7 +26,7 @@ package org.eclipse.debug.core.sourcelookup;
* the work specific to the contributed type. Following is an example
* contribution.
* </p>
- *
+ *
* <pre>
* &lt;extension point=&quot;org.eclipse.debug.core.sourceContainerTypes&quot;&gt;
* &lt;sourceContainerType
@@ -41,7 +41,7 @@ package org.eclipse.debug.core.sourcelookup;
* Clients contributing a source container type implement
* {@link org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate}.
* </p>
- *
+ *
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer
* @see org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate
* @since 3.0
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupDirector.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupDirector.java
index 0f97d1e5c..dd247c2a6 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupDirector.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourceLookupDirector.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.core.sourcelookup;
+import java.util.Objects;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -182,4 +184,20 @@ public interface ISourceLookupDirector extends IPersistableSourceLocator2 {
*/
Object getSourceElement(Object element);
+ /**
+ * Answers if the objects should be considered as same source elements (e.g.
+ * resulting in the physically same storage element), independently if in
+ * the modelled world they may be different views on same data.
+ *
+ * @param element1 first source element
+ * @param element2 second source element
+ * @return Returns {@code true} if two source elements represent physically
+ * same data. Default implementation just delegates to
+ * {@link Objects#equals(Object, Object)}.
+ * @since 3.17
+ */
+ default boolean equalSourceElements(Object element1, Object element2) {
+ return Objects.equals(element1, element2);
+ }
+
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourcePathComputer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourcePathComputer.java
index 357b96217..58687b098 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourcePathComputer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/ISourcePathComputer.java
@@ -24,7 +24,7 @@ import org.eclipse.debug.core.DebugPlugin;
* compute the path specific to a launch configuration. Following is an example
* contribution.
* </p>
- *
+ *
* <pre>
* &lt;extension point=&quot;org.eclipse.debug.core.sourcePathComputers&quot;&gt;
* &lt;sourcePathComputer
@@ -44,7 +44,7 @@ import org.eclipse.debug.core.DebugPlugin;
* Clients contributing a source path computer provide an implementation of
* {@link org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate}.
* </p>
- *
+ *
* @since 3.0
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
index 7799c478c..dc45d5b69 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/CompositeSourceContainer.java
@@ -73,8 +73,7 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
if (isFindDuplicates()) {
results = new ArrayList<>();
}
- for (int i = 0; i < containers.length; i++) {
- ISourceContainer container = containers[i];
+ for (ISourceContainer container : containers) {
try {
Object[] objects = container.findSourceElements(name);
if (objects.length > 0) {
@@ -124,8 +123,7 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
public synchronized ISourceContainer[] getSourceContainers() throws CoreException {
if (fContainers == null) {
fContainers = createSourceContainers();
- for (int i = 0; i < fContainers.length; i++) {
- ISourceContainer container = fContainers[i];
+ for (ISourceContainer container : fContainers) {
container.init(getDirector());
}
}
@@ -136,8 +134,7 @@ public abstract class CompositeSourceContainer extends AbstractSourceContainer {
public void dispose() {
super.dispose();
if (fContainers != null) {
- for (int i = 0; i < fContainers.length; i++) {
- ISourceContainer container = fContainers[i];
+ for (ISourceContainer container : fContainers) {
container.dispose();
}
}
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 a7347bff9..f54a3ad59 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
@@ -122,9 +122,8 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
//check sub-folders
if ((isFindDuplicates() && fSubfolders) || (sources.isEmpty() && fSubfolders)) {
- ISourceContainer[] containers = getSourceContainers();
- for (int i=0; i < containers.length; i++) {
- Object[] objects = containers[i].findSourceElements(name);
+ for (ISourceContainer container : getSourceContainers()) {
+ Object[] objects = container.findSourceElements(name);
if (objects == null || objects.length == 0) {
continue;
}
@@ -172,15 +171,13 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
if(fSubfolders) {
IResource[] resources = getContainer().members();
List<ISourceContainer> list = new ArrayList<>(resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.getType() == IResource.FOLDER) {
list.add(new FolderSourceContainer((IFolder)resource, fSubfolders));
}
}
ISourceContainer[] containers = list.toArray(new ISourceContainer[list.size()]);
- for (int i = 0; i < containers.length; i++) {
- ISourceContainer container = containers[i];
+ for (ISourceContainer container : containers) {
container.init(getDirector());
}
return containers;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
index 12bab3aa2..4e0da41cd 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/DirectorySourceContainer.java
@@ -105,8 +105,8 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
//check sub-folders
if ((isFindDuplicates() && fSubfolders) || (sources.isEmpty() && fSubfolders)) {
ISourceContainer[] containers = getSourceContainers();
- for (int i=0; i < containers.length; i++) {
- Object[] objects = containers[i].findSourceElements(name);
+ for (ISourceContainer container : containers) {
+ Object[] objects = container.findSourceElements(name);
if (objects == null || objects.length == 0) {
continue;
}
@@ -150,16 +150,14 @@ public class DirectorySourceContainer extends CompositeSourceContainer {
String[] files = fDirectory.list();
if (files != null) {
List<ISourceContainer> dirs = new ArrayList<>();
- for (int i = 0; i < files.length; i++) {
- String name = files[i];
+ for (String name : files) {
File file = new File(getDirectory(), name);
if (file.exists() && file.isDirectory()) {
dirs.add(new DirectorySourceContainer(file, true));
}
}
ISourceContainer[] containers = dirs.toArray(new ISourceContainer[dirs.size()]);
- for (int i = 0; i < containers.length; i++) {
- ISourceContainer container = containers[i];
+ for (ISourceContainer container : containers) {
container.init(getDirector());
}
return containers;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java
index 368ac4e81..799ad7b51 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ExternalArchiveSourceContainer.java
@@ -15,6 +15,7 @@ package org.eclipse.debug.core.sourcelookup.containers;
import java.io.File;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
@@ -32,8 +33,6 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils;
-import com.ibm.icu.text.MessageFormat;
-
/**
* An archive in the local file system. Returns instances
* of <code>ZipEntryStorage</code> as source elements.
@@ -78,6 +77,8 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
fDetectRoots = detectRootPaths;
}
+ // Suppress resource leak warning. The ZipFile is provided from
+ // SourceLookupUtils which take care to close them at some point.
@SuppressWarnings("resource")
@Override
public Object[] findSourceElements(String name) throws CoreException {
@@ -172,11 +173,11 @@ public class ExternalArchiveSourceContainer extends AbstractSourceContainer {
fPotentialRoots.add(entry.getName());
} else {
String entryName = entry.getName();
- int index = entryName.lastIndexOf('/');
+ int index = entryName.lastIndexOf('/');
while (index > 0) {
if (fPotentialRoots.add(entryName.substring(0, index + 1))) {
entryName = entryName.substring(0, index);
- index = entryName.lastIndexOf('/');
+ index = entryName.lastIndexOf('/');
} else {
break;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
index 7259a4504..b7bb7eef4 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ProjectSourceContainer.java
@@ -93,9 +93,9 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
ISourceContainer[] folders = super.createSourceContainers();
List<ISourceContainer> all = new ArrayList<>(folders.length + projects.length);
Collections.addAll(all, folders);
- for (int i = 0; i < projects.length; i++) {
+ for (IProject p : projects) {
if (project.exists() && project.isOpen()) {
- ProjectSourceContainer container = new ProjectSourceContainer(projects[i], false);
+ ProjectSourceContainer container = new ProjectSourceContainer(p, false);
container.init(getDirector());
all.add(container);
}
@@ -115,10 +115,10 @@ public class ProjectSourceContainer extends ContainerSourceContainer {
private void getAllReferencedProjects(Set<IProject> all, IProject project) throws CoreException {
IProject[] refs = project.getReferencedProjects();
- for (int i = 0; i < refs.length; i++) {
- if (!all.contains(refs[i]) && refs[i].exists() && refs[i].isOpen()) {
- all.add(refs[i]);
- getAllReferencedProjects(all, refs[i]);
+ for (IProject ref : refs) {
+ if (!all.contains(ref) && ref.exists() && ref.isOpen()) {
+ all.add(ref);
+ getAllReferencedProjects(all, ref);
}
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java
index 2bf9eeef3..5ffe0fcb4 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ZipEntryStorage.java
@@ -38,6 +38,7 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupMessages;
* @since 3.0
* @noextend This class is not intended to be subclassed by clients.
*/
+@SuppressWarnings("resource")
public class ZipEntryStorage extends PlatformObject implements IStorage {
/**
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 9766252cb..8725666b5 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.core;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -55,8 +56,6 @@ import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IBreakpointImportParticipant;
import org.eclipse.debug.core.model.ITriggerPoint;
-import com.ibm.icu.text.MessageFormat;
-
/**
* The breakpoint manager manages all registered breakpoints for the Debug plug-in. It is
* instantiated by the Debug plug-in at startup.
@@ -195,7 +194,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*
* @since 3.5
*/
- class DefaultImportParticipant implements IBreakpointImportParticipant {
+ static class DefaultImportParticipant implements IBreakpointImportParticipant {
@Override
public boolean matches(Map<String, Object> attributes, IBreakpoint breakpoint) throws CoreException {
@@ -231,9 +230,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
if (delta == null) {
return false;
}
- IMarkerDelta[] markerDeltas= delta.getMarkerDeltas();
- for (int i= 0; i < markerDeltas.length; i++) {
- IMarkerDelta markerDelta= markerDeltas[i];
+ for (IMarkerDelta markerDelta : delta.getMarkerDeltas()) {
if (markerDelta.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
switch (markerDelta.getKind()) {
case IResourceDelta.ADDED :
@@ -275,10 +272,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
private void loadBreakpoints(IResource resource, boolean notify) throws CoreException {
initBreakpointExtensions();
- IMarker[] markers= getPersistedMarkers(resource);
List<IBreakpoint> added = new ArrayList<>();
- for (int i = 0; i < markers.length; i++) {
- IMarker marker= markers[i];
+ for (IMarker marker : getPersistedMarkers(resource)) {
try {
IBreakpoint breakpoint = createBreakpoint(marker);
synchronized (fPostChangMarkersChanged) {
@@ -315,11 +310,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* @throws CoreException if a problem is encountered
*/
protected IMarker[] getPersistedMarkers(IResource resource) throws CoreException {
- IMarker[] markers= resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
final List<IMarker> delete = new ArrayList<>();
List<IMarker> persisted = new ArrayList<>();
- for (int i = 0; i < markers.length; i++) {
- IMarker marker= markers[i];
+ for (IMarker marker : resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE)) {
// ensure the marker has a valid model identifier attribute
// and delete the breakpoint if not
String modelId = marker.getAttribute(IBreakpoint.ID, null);
@@ -337,13 +330,9 @@ 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()]);
- 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();
- }
+ IWorkspaceRunnable wr = pm -> {
+ for (IMarker marker : delMarkers) {
+ marker.delete();
}
};
new BreakpointManagerJob(wr).schedule();
@@ -381,16 +370,15 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
private void initBreakpointExtensions() {
IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_BREAKPOINTS);
- IConfigurationElement[] elements = ep.getConfigurationElements();
- for (int i= 0; i < elements.length; i++) {
- String markerType = elements[i].getAttribute(IConfigurationElementConstants.MARKER_TYPE);
- String className = elements[i].getAttribute(IConfigurationElementConstants.CLASS);
+ for (IConfigurationElement element : ep.getConfigurationElements()) {
+ String markerType = element.getAttribute(IConfigurationElementConstants.MARKER_TYPE);
+ String className = element.getAttribute(IConfigurationElementConstants.CLASS);
if (markerType == null) {
- DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + elements[i].getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: markerType", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + element.getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: markerType", null)); //$NON-NLS-1$ //$NON-NLS-2$
} else if (className == null){
- DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + elements[i].getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: class", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ DebugPlugin.log(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, "Breakpoint extension " + element.getDeclaringExtension().getUniqueIdentifier() + " missing required attribute: class", null)); //$NON-NLS-1$ //$NON-NLS-2$
} else {
- fBreakpointExtensions.put(markerType, elements[i]);
+ fBreakpointExtensions.put(markerType, element);
}
}
}
@@ -471,14 +459,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* workspace. Start listening to resource deltas.
*/
private void initializeBreakpoints() {
- setBreakpoints(new Vector<IBreakpoint>(10));
+ setBreakpoints(new Vector<>(10));
try {
loadBreakpoints(getWorkspace().getRoot(), false);
getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
getWorkspace().addResourceChangeListener(fPostChangeListener, IResourceChangeEvent.POST_CHANGE);
} catch (CoreException ce) {
DebugPlugin.log(ce);
- setBreakpoints(new Vector<IBreakpoint>(0));
+ setBreakpoints(new Vector<>(0));
}
}
@@ -506,8 +494,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
public void removeBreakpoints(IBreakpoint[] breakpoints, final boolean delete) throws CoreException {
final List<IBreakpoint> remove = new ArrayList<>(breakpoints.length);
List<IBreakpoint> bps = getBreakpoints0();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
+ for (IBreakpoint breakpoint : breakpoints) {
if (bps.contains(breakpoint)) {
remove.add(breakpoint);
}
@@ -516,26 +503,25 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
for (IBreakpoint breakpoint : remove) {
bps.remove(breakpoint);
fMarkersToBreakpoints.remove(breakpoint.getMarker());
+ // If the breakpoint is a trigger point, remove else do nothing.
+ removeTriggerPoint(breakpoint);
}
fireUpdate(remove, null, REMOVED);
refreshTriggerpointDisplay();
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor montitor) throws CoreException {
- for (IBreakpoint breakpoint : remove) {
- if (delete) {
- breakpoint.delete();
- } else {
- // if the breakpoint is being removed from the manager
- // because the project is closing, the breakpoint should
- // remain as registered, otherwise, the breakpoint should
- // be marked as unregistered
- IMarker marker = breakpoint.getMarker();
- if (marker.exists()) {
- IProject project = breakpoint.getMarker().getResource().getProject();
- if (project == null || project.isOpen()) {
- breakpoint.setRegistered(false);
- }
+ IWorkspaceRunnable r = monitor -> {
+ for (IBreakpoint breakpoint : remove) {
+ if (delete) {
+ breakpoint.delete();
+ } else {
+ // if the breakpoint is being removed from the manager
+ // because the project is closing, the breakpoint should
+ // remain as registered, otherwise, the breakpoint should
+ // be marked as unregistered
+ IMarker marker = breakpoint.getMarker();
+ if (marker.exists()) {
+ IProject project = breakpoint.getMarker().getResource().getProject();
+ if (project == null || project.isOpen()) {
+ breakpoint.setRegistered(false);
}
}
}
@@ -610,8 +596,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
private void addBreakpoints(IBreakpoint[] breakpoints, boolean notify) throws CoreException {
List<IBreakpoint> added = new ArrayList<>(breakpoints.length);
final List<IBreakpoint> update = new ArrayList<>();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
+ for (IBreakpoint breakpoint : breakpoints) {
if (!getBreakpoints0().contains(breakpoint)) {
verifyBreakpoint(breakpoint);
if (breakpoint.isRegistered()) {
@@ -619,6 +604,10 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
added.add(breakpoint);
getBreakpoints0().add(breakpoint);
fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
+ if (breakpoint instanceof ITriggerPoint && ((ITriggerPoint) breakpoint).isTriggerPoint()) {
+ addTriggerPoint(breakpoint);
+ }
+
} else {
// need to update the 'registered' and/or 'group' attributes
update.add(breakpoint);
@@ -629,15 +618,12 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fireUpdate(added, null, ADDED);
}
if (!update.isEmpty()) {
- IWorkspaceRunnable r = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- List<IBreakpoint> bps = getBreakpoints0();
- for (IBreakpoint breakpoint : update) {
- bps.add(breakpoint);
- breakpoint.setRegistered(true);
- fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
- }
+ IWorkspaceRunnable r = monitor -> {
+ List<IBreakpoint> bps = getBreakpoints0();
+ for (IBreakpoint breakpoint : update) {
+ bps.add(breakpoint);
+ breakpoint.setRegistered(true);
+ fMarkersToBreakpoints.put(breakpoint.getMarker(), breakpoint);
}
};
// Need to suppress change notification, since this is really
@@ -757,13 +743,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
public void update() {
if (!fMoved.isEmpty()) {
// delete moved markers
- IWorkspaceRunnable wRunnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker[] markers = fMoved.toArray(new IMarker[fMoved.size()]);
- for (int i = 0; i < markers.length; i++) {
- markers[i].delete();
- }
+ IWorkspaceRunnable wRunnable= monitor -> {
+ for (IMarker marker : fMoved) {
+ marker.delete();
}
};
try {
@@ -780,17 +762,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
if (!fAdded.isEmpty()) {
try {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- for (IBreakpoint breakpoint : fAdded) {
- breakpoint.getMarker().setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, false);
- breakpoint.setRegistered(true);
- }
+ IWorkspaceRunnable runnable= monitor -> {
+ for (IBreakpoint breakpoint : fAdded) {
+ breakpoint.getMarker().setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, false);
+ breakpoint.setRegistered(true);
}
};
getWorkspace().run(runnable, null, 0, null);
- addBreakpoints(fAdded.toArray(new IBreakpoint[fAdded.size()]), false);
+ addBreakpoints(fAdded.toArray(new IBreakpoint[fAdded.size()]), true);
} catch (CoreException e) {
DebugPlugin.log(e);
}
@@ -813,9 +792,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
handleProjectResourceOpenStateChange(delta.getResource());
return false;
}
- IMarkerDelta[] markerDeltas= delta.getMarkerDeltas();
- for (int i= 0; i < markerDeltas.length; i++) {
- IMarkerDelta markerDelta= markerDeltas[i];
+ for (IMarkerDelta markerDelta : delta.getMarkerDeltas()) {
if (markerDelta.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
switch (markerDelta.getKind()) {
case IResourceDelta.ADDED :
@@ -883,11 +860,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* @return matching breakpoint if exists else return <code>null</code>
*/
private IBreakpoint findMatchingBreakpoint(IMarker marker) {
- Vector<IBreakpoint> breakpoints = getBreakpoints0();
try {
Integer line = (Integer) marker.getAttribute(IMarker.LINE_NUMBER);
- for (int i = 0; i < breakpoints.size(); i++) {
- IBreakpoint breakpoint = breakpoints.get(i);
+ for (IBreakpoint breakpoint : getBreakpoints0()) {
IMarker bpMarker = breakpoint.getMarker();
if (bpMarker != null && marker.getResource().equals(bpMarker.getResource()) && bpMarker.getAttribute(IMarker.LINE_NUMBER, -1) == (line == null ? -1 : line.intValue())) {
return breakpoint;
@@ -1303,18 +1278,17 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fImportParticipants = new HashMap<>();
fDefaultParticipant = new DefaultImportParticipant();
IExtensionPoint ep = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS);
- IConfigurationElement[] elements = ep.getConfigurationElements();
String type = null;
ArrayList<BreakpointImportParticipantDelegate> list = null;
- for(int i = 0; i < elements.length; i++) {
- type = elements[i].getAttribute(IConfigurationElementConstants.TYPE);
+ for (IConfigurationElement element : ep.getConfigurationElements()) {
+ type = element.getAttribute(IConfigurationElementConstants.TYPE);
if(type != null) {
list = fImportParticipants.get(type);
if(list == null) {
list = new ArrayList<>();
fImportParticipants.put(type, list);
}
- list.add(new BreakpointImportParticipantDelegate(elements[i]));
+ list.add(new BreakpointImportParticipantDelegate(element));
}
}
}
@@ -1412,21 +1386,16 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* Touch and refresh display of all breakpoints
*/
private void touchAllBreakpoints() {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- IBreakpoint[] breakpoints = getBreakpoints();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- // Touch the marker (but don't actually change anything) so
- // that the icon in
- // the editor ruler will be updated (editors listen to
- // marker changes).
- try {
- breakpoint.getMarker().setAttribute(IBreakpoint.ENABLED, breakpoint.isEnabled());
- } catch (CoreException e) {
- // don't care if marker was already deleted
- }
+ IWorkspaceRunnable runnable = monitor -> {
+ for (IBreakpoint breakpoint : getBreakpoints()) {
+ // Touch the marker (but don't actually change anything) so
+ // that the icon in
+ // the editor ruler will be updated (editors listen to
+ // marker changes).
+ try {
+ breakpoint.getMarker().setAttribute(IBreakpoint.ENABLED, breakpoint.isEnabled());
+ } catch (CoreException e) {
+ // don't care if marker was already deleted
}
}
};
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
index d38a64f67..d17d3fcd5 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
@@ -89,7 +89,6 @@ public class DebugCoreMessages extends NLS {
public static String LogicalStructureProvider_1;
public static String LogicalStructureType_1;
public static String SystemPropertyResolver_0;
- public static String InputStreamMonitor_label;
public static String Launch_terminate_failed;
public static String LaunchConfiguration_Failed_to_delete_launch_configuration__1;
public static String LaunchConfigurationDelegate_6;
@@ -115,7 +114,6 @@ public class DebugCoreMessages extends NLS {
public static String LaunchManager_invalid_config_name_char;
public static String LaunchManager_Source_locator_does_not_exist___0__13;
public static String LogicalStructureType_0;
- public static String OutputStreamMonitor_label;
public static String ProcessMonitorJob_0;
public static String RuntimeProcess_terminate_failed;
public static String RuntimeProcess_Exit_value_not_available_until_process_terminates__1;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
index eae7e6de4..70ee71cf0 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
@@ -44,7 +44,6 @@ GroupLaunchConfigurationDelegate_Waiting_for_termination=Waiting for termination
GroupLaunchElement_inherit_launch_mode_label=Inherit
GroupLaunchElement_outputRegexp=Wait for console output (regexp)
SystemPropertyResolver_0=System property not specified
-InputStreamMonitor_label=Input Stream Monitor
Launch_terminate_failed=Terminate failed
LaunchConfiguration_Failed_to_delete_launch_configuration__1=Failed to delete launch configuration.
LaunchConfiguration_9=Preparing launch delegate...
@@ -114,7 +113,6 @@ LogicalStructureType_0=<Missing Description>
LogicalStructureType_1=Required attribute {0} missing for logicalStructureType extension.
LogicalStructureProvider_0=Required attribute modelIdentifier missing for logicalStructureType extension.
LogicalStructureProvider_1=Required attribute class missing for logicalStructureType extension.
-OutputStreamMonitor_label=Output Stream Monitor
ProcessMonitorJob_0=Process monitor
RuntimeProcess_terminate_failed=Terminate failed
RuntimeProcess_Exit_value_not_available_until_process_terminates__1=Exit value not available until process terminates.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
index 841b06ae6..e03eec7e3 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java
@@ -56,8 +56,8 @@ public class DebugOptions implements DebugOptionsListener {
public void optionsChanged(org.eclipse.osgi.service.debug.DebugOptions options) {
fgDebugTrace = options.newDebugTrace(DebugPlugin.getUniqueIdentifier());
DEBUG = options.getBooleanOption(DEBUG_FLAG, false);
- DEBUG_COMMANDS = DEBUG & options.getBooleanOption(DEBUG_FLAG_COMMANDS, false);
- DEBUG_EVENTS = DEBUG & options.getBooleanOption(DEBUG_FLAG_EVENTS, false);
+ DEBUG_COMMANDS = DEBUG && options.getBooleanOption(DEBUG_FLAG_COMMANDS, false);
+ DEBUG_EVENTS = DEBUG && options.getBooleanOption(DEBUG_FLAG_EVENTS, false);
}
/**
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 d3a27a28d..5c71e8a7e 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
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.core;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -45,8 +46,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import com.ibm.icu.text.MessageFormat;
-
/**
* The expression manager manages all registered expressions
* for the debug plug-in. It is instantiated by the debug plug-in
@@ -107,9 +106,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
*/
private void loadWatchExpressionDelegates() {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), "watchExpressionDelegates"); //$NON-NLS-1$
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
if (element.getName().equals("watchExpressionDelegate")) { //$NON-NLS-1$
String debugModel = element.getAttribute("debugModel"); //$NON-NLS-1$
if (debugModel == null || debugModel.length() == 0) {
@@ -236,8 +233,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
Document document= LaunchManager.getDocument();
Element rootElement= document.createElement(WATCH_EXPRESSIONS_TAG);
document.appendChild(rootElement);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression= expressions[i];
+ for (IExpression expression : expressions) {
if (expression instanceof IWatchExpression) {
Element element= document.createElement(EXPRESSION_TAG);
element.setAttribute(TEXT_TAG, expression.getExpressionText());
@@ -275,8 +271,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
if (fExpressions == null) {
fExpressions = new Vector<>(expressions.length);
}
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
+ for (IExpression expression : expressions) {
if (fExpressions.indexOf(expression) == -1) {
added.add(expression);
fExpressions.add(expression);
@@ -336,8 +331,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
insertionIndex++;
}
inserted = new ArrayList<>(expressions.length);
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
+ for (IExpression expression : expressions) {
if (fExpressions.indexOf(expression) == -1) {
//Insert in the same order as the array is passed
fExpressions.add(insertionIndex+inserted.size(), expression);
@@ -387,10 +381,10 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
insertionIndex++;
}
- for (int i = 0; i < expressions.length; i++) {
- int removeIndex = fExpressions.indexOf(expressions[i]);
+ for (IExpression expression : expressions) {
+ int removeIndex = fExpressions.indexOf(expression);
if (removeIndex >= 0){
- movedExpressions.add(expressions[i]);
+ movedExpressions.add(expression);
if (removeIndex < insertionIndex){
insertionIndex--;
}
@@ -421,8 +415,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
if (fExpressions == null) {
return;
}
- for (int i = 0; i < expressions.length; i++) {
- IExpression expression = expressions[i];
+ for (IExpression expression : expressions) {
if (fExpressions.remove(expression)) {
removed.add(expression);
}
@@ -566,8 +559,8 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fType = update;
for (IExpressionListener iExpressionListener : fListeners) {
fListener = iExpressionListener;
- for (int j = 0; j < expressions.length; j++) {
- fExpression = expressions[j];
+ for (IExpression expression : expressions) {
+ fExpression = expression;
SafeRunner.run(this);
}
}
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 c6df05c1f..eacd9e3cb 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,22 +10,23 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Paul Pazderski - Bug 558463: add handling of raw stream content instead of strings
*******************************************************************************/
package org.eclipse.debug.internal.core;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.Charset;
import java.util.Vector;
import org.eclipse.debug.core.DebugPlugin;
/**
- * Writes to the input stream of a system process,
- * queueing output if the stream is blocked.
+ * Writes to the input stream of a system process, queuing output if the stream
+ * is blocked.
*
- * The input stream monitor writes to system in via
- * an output stream.
+ * The input stream monitor writes to system in via an output stream.
*/
public class InputStreamMonitor {
@@ -33,14 +34,17 @@ public class InputStreamMonitor {
* The stream which is being written to (connected to system in).
*/
private OutputStream fStream;
+
/**
* The queue of output.
*/
- private Vector<String> fQueue;
+ private Vector<byte[]> fQueue;
+
/**
* The thread which writes to the stream.
*/
private Thread fThread;
+
/**
* A lock for ensuring that writes to the queue are contiguous
*/
@@ -52,9 +56,9 @@ public class InputStreamMonitor {
private boolean fClosed = false;
/**
- * The encoding of the input stream.
+ * The charset of the input stream.
*/
- private String fEncoding;
+ private Charset fCharset;
/**
* Creates an input stream monitor which writes to system in via the given output stream.
@@ -62,44 +66,83 @@ public class InputStreamMonitor {
* @param stream output stream
*/
public InputStreamMonitor(OutputStream stream) {
- this(stream, null);
+ this(stream, (Charset) null);
}
/**
- * Creates an input stream monitor which writes to system in via the given output stream.
+ * Creates an input stream monitor which writes to system in via the given
+ * output stream.
+ *
+ * @param stream output stream
+ * @param charset stream charset or <code>null</code> for system default
+ */
+ public InputStreamMonitor(OutputStream stream, Charset charset) {
+ fStream = stream;
+ fQueue = new Vector<>();
+ fLock = new Object();
+ fCharset = charset;
+ }
+
+ /**
+ * Creates an input stream monitor which writes to system in via the given
+ * output stream.
*
* @param stream output stream
* @param encoding stream encoding or <code>null</code> for system default
+ * @deprecated use {@link #InputStreamMonitor(OutputStream, Charset)}
+ * instead
*/
+ @Deprecated
public InputStreamMonitor(OutputStream stream, String encoding) {
- fStream= stream;
- fQueue = new Vector<>();
- fLock= new Object();
- fEncoding= encoding;
+ this(stream, Charset.forName(encoding));
}
/**
- * Appends the given text to the stream, or
- * queues the text to be written at a later time
- * if the stream is blocked.
+ * Appends the given text to the stream, or queues the text to be written at
+ * a later time if the stream is blocked.
*
* @param text text to append
*/
public void write(String text) {
- synchronized(fLock) {
- fQueue.add(text);
+ synchronized (fLock) {
+ fQueue.add(fCharset == null ? text.getBytes() : text.getBytes(fCharset));
fLock.notifyAll();
}
}
/**
- * Starts a thread which writes the stream.
+ * Appends the given binary data to the stream, or queues the text to be
+ * written at a later time if the stream is blocked.
+ *
+ * @param data data to append; not <code>null</code>
+ * @param offset start offset in data
+ * @param length number of bytes in data
*/
+ public void write(byte[] data, int offset, int length) {
+ synchronized (fLock) {
+ byte[] copy = new byte[length];
+ System.arraycopy(data, offset, copy, 0, length);
+ fQueue.add(copy);
+ fLock.notifyAll();
+ }
+ }
+
public void startMonitoring() {
- if (fThread == null) {
- fThread = new Thread((Runnable) this::write, DebugCoreMessages.InputStreamMonitor_label);
- fThread.setDaemon(true);
- fThread.start();
+ startMonitoring("Input Stream Monitor"); //$NON-NLS-1$
+ }
+
+ /**
+ * Starts a thread which writes the stream.
+ *
+ * @param threadName Thread name
+ */
+ public void startMonitoring(String threadName) {
+ synchronized (this) {
+ if (fThread == null) {
+ fThread = new Thread((Runnable) this::write, threadName);
+ fThread.setDaemon(true);
+ fThread.start();
+ }
}
}
@@ -108,9 +151,12 @@ public class InputStreamMonitor {
* monitor and the underlying stream.
*/
public void close() {
- if (fThread != null) {
- Thread thread= fThread;
- fThread= null;
+ Thread thread = null;
+ synchronized (this) {
+ thread = fThread;
+ fThread = null;
+ }
+ if (thread != null) {
thread.interrupt();
}
}
@@ -136,14 +182,10 @@ public class InputStreamMonitor {
*/
protected void writeNext() {
while (!fQueue.isEmpty() && !fClosed) {
- String text = fQueue.firstElement();
+ byte[] data = fQueue.firstElement();
fQueue.removeElementAt(0);
try {
- if (fEncoding != null) {
- fStream.write(text.getBytes(fEncoding));
- } else {
- fStream.write(text.getBytes());
- }
+ fStream.write(data);
fStream.flush();
} catch (IOException e) {
DebugPlugin.log(e);
@@ -151,7 +193,11 @@ public class InputStreamMonitor {
}
try {
synchronized(fLock) {
- fLock.wait();
+ // Queue could receive more input between last empty check and
+ // lock acquire. See https://bugs.eclipse.org/550834
+ if (fQueue.isEmpty()) {
+ fLock.wait();
+ }
}
} catch (InterruptedException e) {
}
@@ -161,7 +207,8 @@ 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
+ * @exception IOException if an exception occurs closing the input stream or
+ * stream is already closed
*/
public void closeInputStream() throws IOException {
if (!fClosed) {
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 eece9bb85..bc9cdfea3 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -67,8 +68,6 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Launch configuration handle.
*
@@ -263,7 +262,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
- boolean local = (Boolean.valueOf(localString)).booleanValue();
+ boolean local = Boolean.parseBoolean(localString);
IPath iPath = new Path(path);
String name = getSimpleName(iPath.lastSegment());
IContainer container = null;
@@ -602,7 +601,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
Document doc = LaunchManager.getDocument();
Element node = doc.createElement(IConfigurationElementConstants.LAUNCH_CONFIGURATION);
doc.appendChild(node);
- node.setAttribute(IConfigurationElementConstants.LOCAL, (Boolean.valueOf(local)).toString());
+ node.setAttribute(IConfigurationElementConstants.LOCAL, Boolean.toString(local));
node.setAttribute(IConfigurationElementConstants.PATH, relativePath.toString());
return LaunchManager.serializeDocument(doc);
} catch (IOException ioe) {
@@ -682,12 +681,10 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
String memento = getAttribute(ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
if (memento == null) {
locator.initializeDefaults(this);
+ } else if(locator instanceof IPersistableSourceLocator2) {
+ ((IPersistableSourceLocator2)locator).initializeFromMemento(memento, this);
} else {
- if(locator instanceof IPersistableSourceLocator2) {
- ((IPersistableSourceLocator2)locator).initializeFromMemento(memento, this);
- } else {
- locator.initializeFromMemento(memento);
- }
+ locator.initializeFromMemento(memento);
}
launch.setSourceLocator(locator);
}
@@ -732,59 +729,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.LaunchConfiguration_9, 23);
try {
// bug 28245 - force the delegate to load in case it is interested in launch notifications
- Set<String> modes = getModes();
- modes.add(mode);
- ILaunchDelegate[] delegates = getType().getDelegates(modes);
- ILaunchConfigurationDelegate delegate = null;
- switch (delegates.length) {
- case 1:
- delegate = delegates[0].getDelegate();
- break;
- case 0:
- {
- IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus);
- if (handler != null) {
- handler.handleStatus(delegateNotAvailable, new Object[] {this, mode});
- }
- IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_11, null);
- throw new CoreException(status);
- }
- default:
- {
- ILaunchDelegate del = getPreferredDelegate(modes);
- if(del == null) {
- del = getType().getPreferredDelegate(modes);
- }
- if(del == null) {
- IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus);
- IStatus status = null;
- if (handler != null) {
- status = (IStatus) handler.handleStatus(duplicateDelegates, new Object[] {this, mode});
- }
- if(status != null && status.isOK()) {
- del = getPreferredDelegate(modes);
- if(del == null) {
- del = getType().getPreferredDelegate(modes);
- }
- if(del != null) {
- delegate = del.getDelegate();
- }
- else {
- status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
- throw new CoreException(status);
- }
- }
- else {
- status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
- throw new CoreException(status);
- }
- }
- else {
- delegate = del.getDelegate();
- }
- break;
- }
- }
+ ILaunchConfigurationDelegate delegate = getPreferredLaunchDelegate(mode);
ILaunchConfigurationDelegate2 delegate2 = null;
if (delegate instanceof ILaunchConfigurationDelegate2) {
@@ -792,64 +737,62 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
}
// allow the delegate to provide a launch implementation
ILaunch launch = null;
- if (delegate2 != null) {
- launch = delegate2.getLaunch(this, mode);
- }
- if (launch == null) {
- launch = new Launch(this, mode, null);
- } else {
- // ensure the launch mode is valid
+ try {
+ if (delegate2 != null) {
+ launch = delegate2.getLaunch(this, mode);
+ }
+ if (launch == null) {
+ launch = new Launch(this, mode, null);
+ } else // ensure the launch mode is valid
if (!mode.equals(launch.getLaunchMode())) {
IStatus status = new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR,
MessageFormat.format(DebugCoreMessages.LaunchConfiguration_14, mode, launch.getLaunchMode()), null);
throw new CoreException(status);
}
- }
- 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$
- } else {
- launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
- }
- launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, getLaunchManager().getEncoding(this));
- if (register) {
- getLaunchManager().addLaunch(launch);
- }
- // perform initial pre-launch sanity checks
- lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_8);
-
- if (delegate2 != null) {
- if (!(delegate2.preLaunchCheck(this, mode, lmonitor.split(1)))) {
- getLaunchManager().removeLaunch(launch);
- return launch;
+ 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$
+ } else {
+ launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
}
- }
- lmonitor.setWorkRemaining(22);
- // perform pre-launch build
- if (build) {
- lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_7 + DebugCoreMessages.LaunchConfiguration_6);
- boolean tempbuild = build;
+ launch.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, getLaunchManager().getEncoding(this));
+ if (register) {
+ getLaunchManager().addLaunch(launch);
+ }
+ // perform initial pre-launch sanity checks
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_8);
+
if (delegate2 != null) {
- tempbuild = delegate2.buildForLaunch(this, mode, lmonitor.split(7));
+ if (!(delegate2.preLaunchCheck(this, mode, lmonitor.split(1)))) {
+ getLaunchManager().removeLaunch(launch);
+ return launch;
+ }
}
- if (tempbuild) {
- lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_7 + DebugCoreMessages.LaunchConfiguration_5);
- ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, lmonitor.split(3));
+ lmonitor.setWorkRemaining(22);
+ // perform pre-launch build
+ if (build) {
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_7 + DebugCoreMessages.LaunchConfiguration_6);
+ boolean tempbuild = build;
+ if (delegate2 != null) {
+ tempbuild = delegate2.buildForLaunch(this, mode, lmonitor.split(7));
+ }
+ if (tempbuild) {
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_7 + DebugCoreMessages.LaunchConfiguration_5);
+ ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, lmonitor.split(3));
+ }
}
- }
- lmonitor.setWorkRemaining(12);
- // final validation
- lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_4);
- if (delegate2 != null) {
- if (!(delegate2.finalLaunchCheck(this, mode, lmonitor.split(1)))) {
- getLaunchManager().removeLaunch(launch);
- return launch;
+ lmonitor.setWorkRemaining(12);
+ // final validation
+ lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_4);
+ if (delegate2 != null) {
+ if (!(delegate2.finalLaunchCheck(this, mode, lmonitor.split(1)))) {
+ getLaunchManager().removeLaunch(launch);
+ return launch;
+ }
}
- }
- lmonitor.setWorkRemaining(11);
+ lmonitor.setWorkRemaining(11);
- try {
//initialize the source locator
lmonitor.subTask(DebugCoreMessages.LaunchConfiguration_3);
initializeSourceLocator(launch);
@@ -860,13 +803,13 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
delegate.launch(this, mode, launch, lmonitor.split(10));
} catch (CoreException e) {
// if there was an exception, and the launch is empty, remove it
- if (!launch.hasChildren()) {
+ if (launch != null && !launch.hasChildren()) {
getLaunchManager().removeLaunch(launch);
}
throw e;
} catch (RuntimeException e) {
// if there was a runtime exception, and the launch is empty, remove it
- if (!launch.hasChildren()) {
+ if (launch != null && !launch.hasChildren()) {
getLaunchManager().removeLaunch(launch);
}
throw e;
@@ -969,8 +912,7 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
public Collection<ILaunchConfiguration> getPrototypeChildren() throws CoreException {
ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(getType());
List<ILaunchConfiguration> proteges = new ArrayList<>();
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration config = configurations[i];
+ for (ILaunchConfiguration config : configurations) {
if (this.equals(config.getPrototype())) {
proteges.add(config);
}
@@ -1038,4 +980,63 @@ public class LaunchConfiguration extends PlatformObject implements ILaunchConfig
public void setPrototypeAttributeVisibility(String attribute, boolean visible) throws CoreException {
getInfo().setAttributeVisibility(attribute, visible);
}
+
+ /*
+ * Get Preferred delegate with all fallbacks
+ *
+ */
+ public ILaunchConfigurationDelegate getPreferredLaunchDelegate(String mode) throws CoreException {
+ Set<String> modes = getModes();
+ modes.add(mode);
+ ILaunchDelegate[] delegates = getType().getDelegates(modes);
+ ILaunchConfigurationDelegate delegate = null;
+ switch (delegates.length) {
+ case 1:
+ delegate = delegates[0].getDelegate();
+ break;
+ case 0: {
+ IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus);
+ if (handler != null) {
+ handler.handleStatus(delegateNotAvailable, new Object[] {
+ this, mode });
+ }
+ IStatus status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_11, null);
+ throw new CoreException(status);
+ }
+ default: {
+ ILaunchDelegate del = getPreferredDelegate(modes);
+ if (del == null) {
+ del = getType().getPreferredDelegate(modes);
+ }
+ if (del == null) {
+ IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus);
+ IStatus status = null;
+ if (handler != null) {
+ status = (IStatus) handler.handleStatus(duplicateDelegates, new Object[] {
+ this, mode });
+ }
+ if (status != null && status.isOK()) {
+ del = getPreferredDelegate(modes);
+ if (del == null) {
+ del = getType().getPreferredDelegate(modes);
+ }
+ if (del != null) {
+ delegate = del.getDelegate();
+ } else {
+ status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
+ throw new CoreException(status);
+ }
+ } else {
+ status = new Status(IStatus.CANCEL, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.LaunchConfiguration_13, null);
+ throw new CoreException(status);
+ }
+ } else {
+ delegate = del.getDelegate();
+ }
+ break;
+ }
+ }
+
+ return delegate;
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
index 12b52d174..4da5fa03d 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.core;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -44,8 +45,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import com.ibm.icu.text.MessageFormat;
-
/**
* The information associated with a launch configuration handle.
*/
@@ -123,7 +122,7 @@ public class LaunchConfigurationInfo {
* Constructs a new empty info
*/
protected LaunchConfigurationInfo() {
- setAttributeTable(new TreeMap<String, Object>());
+ setAttributeTable(new TreeMap<>());
}
/**
@@ -152,10 +151,10 @@ public class LaunchConfigurationInfo {
*/
protected void setAttributes(Map<String, ?> map) {
if (map == null) {
- setAttributeTable(new TreeMap<String, Object>());
+ setAttributeTable(new TreeMap<>());
return;
}
- setAttributeTable(new TreeMap<String, Object>(map));
+ setAttributeTable(new TreeMap<>(map));
}
/**
@@ -897,7 +896,7 @@ public class LaunchConfigurationInfo {
String strAttr1 = null;
String strAttr2 = null;
if (fgIsSun14x) {
- if(attr2 instanceof String & attr1 instanceof String) {
+ if(attr2 instanceof String && attr1 instanceof String) {
// this is a hack for bug 110215, on SUN 1.4.x, \r
// is stripped off when the stream is written to the
// DOM
@@ -914,10 +913,8 @@ public class LaunchConfigurationInfo {
if (strAttr1 == null && strAttr2 == null && !attr1.equals(attr2)) {
return false;
}
- } else {
- if (comp.compare(attr1, attr2) != 0) {
- return false;
- }
+ } else if (comp.compare(attr1, attr2) != 0) {
+ return false;
}
return true;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
index 5ced04ca5..f830a1d41 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java
@@ -15,6 +15,7 @@
package org.eclipse.debug.internal.core;
+import java.text.MessageFormat;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -42,8 +43,6 @@ import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
-import com.ibm.icu.text.MessageFormat;
-
/**
* A launch configuration type wrappers a configuration
* element for a <code>launchConfigurationType</code>
@@ -235,8 +234,8 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
LaunchDelegate delegate = null;
List<Set<String>> modelist = null;
Set<ILaunchDelegate> tmp = null;
- for (int i = 0; i < launchDelegates.length; i++) {
- delegate = launchDelegates[i];
+ for (LaunchDelegate launchDelegate : launchDelegates) {
+ delegate = launchDelegate;
modelist = delegate.getModes();
for (Set<String> modes : modelist) {
tmp = fDelegates.get(modes);
@@ -286,10 +285,10 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
//so it can be reused to try and find the source path computer
if(fSourceLocator == null) {
LaunchDelegate[] delegates = getLaunchDelegateExtensions();
- for(int i = 0; i < delegates.length; i++) {
- fSourceLocator = delegates[i].getSourceLocatorId();
- if(fSourceLocator != null) {
- fSourceProvider = delegates[i];
+ for (LaunchDelegate delegate : delegates) {
+ fSourceLocator = delegate.getSourceLocatorId();
+ if (fSourceLocator != null) {
+ fSourceProvider = delegate;
return fSourceLocator;
}
}
@@ -315,10 +314,10 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
//if not provided check all the applicable delegates for one and record the delegate if found,
//so it can be reused to try and find the source path computer
LaunchDelegate[] delegates = getLaunchDelegateExtensions();
- for(int i = 0; i < delegates.length; i++) {
- id = delegates[i].getSourcePathComputerId();
- if(id != null) {
- fSourceProvider = delegates[i];
+ for (LaunchDelegate delegate : delegates) {
+ id = delegate.getSourcePathComputerId();
+ if (id != null) {
+ fSourceProvider = delegate;
fSourcePathComputer = DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id);
if(fSourcePathComputer != null) {
return fSourcePathComputer;
@@ -338,8 +337,8 @@ public class LaunchConfigurationType extends PlatformObject implements ILaunchCo
fModes = new HashSet<>();
LaunchDelegate[] delegates = getLaunchDelegateExtensions();
List<Set<String>> modesets = null;
- for(int i= 0; i < delegates.length; i++) {
- modesets = delegates[i].getModes();
+ for (LaunchDelegate delegate : delegates) {
+ modesets = delegate.getModes();
for (Set<String> modes : modesets) {
fModes.addAll(modes);
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index 58ed8c08b..8a4959bc7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -19,11 +19,13 @@ import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import org.eclipse.core.filesystem.EFS;
@@ -34,6 +36,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -46,8 +49,6 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import com.ibm.icu.text.MessageFormat;
-
/**
* A working copy launch configuration
*/
@@ -609,13 +610,8 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
IContainer newContainer = getContainer();
IContainer originalContainer = ((LaunchConfiguration)getOriginal()).getContainer();
- if (newContainer == originalContainer) {
- return false;
- }
- if (newContainer == null) {
- return !originalContainer.equals(newContainer);
- }
- return !newContainer.equals(originalContainer);
+
+ return !isSameContainerLocation(newContainer, originalContainer);
}
/**
@@ -637,9 +633,22 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
return fSuppressChange;
}
+ private boolean isSameContainerLocation(IContainer newContainer, IContainer originalContainer) {
+ // Verify that containers are not nested
+ if (newContainer != null && originalContainer != null) {
+ IPath newPath = newContainer.getLocation();
+ IPath originalPath = originalContainer.getLocation();
+
+ if (Objects.equals(newPath, originalPath)) {
+ return true;
+ }
+ }
+ return Objects.equals(newContainer, originalContainer);
+ }
+
@Override
public void setContainer(IContainer container) {
- if (equalOrNull(getContainer(), container)) {
+ if (isSameContainerLocation(container, getContainer())) {
return;
}
super.setContainer(container);
@@ -659,8 +668,7 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
if(resources != null && resources.length > 0) {
paths = new ArrayList<>(resources.length);
types = new ArrayList<>(resources.length);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if(resource != null) {
paths.add(resource.getFullPath().toPortableString());
types.add(Integer.valueOf(resource.getType()).toString());
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java
index 303d37875..843e1bf3e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchDelegate.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -27,8 +28,6 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchDelegate;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Proxy to a launch delegate extension.
* <p>
@@ -130,8 +129,8 @@ public final class LaunchDelegate implements ILaunchDelegate {
String modes = element.getAttribute(IConfigurationElementConstants.MODES);
if (modes != null) {
String[] strings = modes.split(","); //$NON-NLS-1$
- for (int i = 0; i < strings.length; i++) {
- set.add(strings[i].trim());
+ for (String string : strings) {
+ set.add(string.trim());
}
}
return set;
@@ -144,10 +143,10 @@ public final class LaunchDelegate implements ILaunchDelegate {
fPerspectiveIds = new HashMap<>();
IConfigurationElement[] children = fElement.getChildren(IConfigurationElementConstants.MODE_COMBINATION);
Set<String> modeset = null;
- for (int i = 0; i < children.length; i++) {
- modeset = parseModes(children[i]);
+ for (IConfigurationElement child : children) {
+ modeset = parseModes(child);
fLaunchModes.add(modeset);
- fPerspectiveIds.put(modeset, children[i].getAttribute(IConfigurationElementConstants.PERSPECTIVE));
+ fPerspectiveIds.put(modeset, child.getAttribute(IConfigurationElementConstants.PERSPECTIVE));
}
//try to get the modes from the old definition and make each one
//a separate set of one element
@@ -155,9 +154,9 @@ public final class LaunchDelegate implements ILaunchDelegate {
String modes = fElement.getAttribute(IConfigurationElementConstants.MODES);
if (modes != null) {
String[] strings = modes.split(","); //$NON-NLS-1$
- for (int i = 0; i < strings.length; i++) {
+ for (String string : strings) {
modeset = new HashSet<>();
- modeset.add(strings[i].trim());
+ modeset.add(string.trim());
fLaunchModes.add(modeset);
}
}
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 ddce2a193..d4689d0a6 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -31,6 +31,8 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -115,8 +117,6 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Manages launch configurations, launch configuration types, and registered launches.
*
@@ -284,12 +284,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
if (registered != null) {
registered.add(fNotifierLaunches[j]);
}
- } else {
- if (registered == null) {
- registered = new ArrayList<>(fNotifierLaunches.length);
- for (int k = 0; k < j; k++) {
- registered.add(fNotifierLaunches[k]);
- }
+ } else if (registered == null) {
+ registered = new ArrayList<>(fNotifierLaunches.length);
+ for (int k = 0; k < j; k++) {
+ registered.add(fNotifierLaunches[k]);
}
}
}
@@ -444,7 +442,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* Collects files whose extension matches the launch configuration file
* extension.
*/
- class ResourceProxyVisitor implements IResourceProxyVisitor {
+ static class ResourceProxyVisitor implements IResourceProxyVisitor {
private List<IResource> fList;
@@ -455,7 +453,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
@Override
public boolean visit(IResourceProxy proxy) {
if (proxy.getType() == IResource.FILE) {
- if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension()) | ILaunchConfiguration.LAUNCH_CONFIGURATION_PROTOTYPE_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension())) {
+ if (ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension()) || ILaunchConfiguration.LAUNCH_CONFIGURATION_PROTOTYPE_FILE_EXTENSION.equalsIgnoreCase(proxy.requestFullPath().getFileExtension())) {
fList.add(proxy.requestResource());
}
return false;
@@ -469,7 +467,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*
* @since 3.3
*/
- class PreferredDelegate {
+ static class PreferredDelegate {
private ILaunchDelegate fDelegate = null;
private String fTypeid = null;
private Set<String> fModes = null;
@@ -528,13 +526,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
/**
- * Serializes a XML document into a string - encoded in UTF8 format,
- * with platform line separators.
+ * Serializes a XML document into a string - encoded in UTF8 format, with
+ * platform line separators.
*
* @param doc document to serialize
* @return the document as a string
- * @throws TransformerException if an unrecoverable error occurs during the serialization
- * @throws IOException if the encoding attempted to be used is not supported
+ * @throws TransformerException if an unrecoverable error occurs during the
+ * serialization
+ * @throws IOException if I/O error occurs
*/
public static String serializeDocument(Document doc) throws TransformerException, IOException {
ByteArrayOutputStream s = new ByteArrayOutputStream();
@@ -545,7 +544,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
DOMSource source = new DOMSource(doc);
StreamResult outputTarget = new StreamResult(s);
transformer.transform(source, outputTarget);
- return s.toString("UTF8"); //$NON-NLS-1$
+ return s.toString(StandardCharsets.UTF_8);
}
/**
@@ -689,9 +688,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
@Override
public void addLaunches(ILaunch[] launches) {
List<ILaunch> added = new ArrayList<>(launches.length);
- for (int i = 0; i < launches.length; i++) {
- if (internalAddLaunch(launches[i])) {
- added.add(launches[i]);
+ for (ILaunch launch : launches) {
+ if (internalAddLaunch(launch)) {
+ added.add(launch);
}
}
if (!added.isEmpty()) {
@@ -780,7 +779,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
String line = reader.readLine();
String key = null;
String value = null;
- String newLine = System.getProperty("line.separator"); //$NON-NLS-1$
+ String newLine = System.lineSeparator();
while (line != null) {
int func = line.indexOf("=()"); //$NON-NLS-1$
if (func > 0) {
@@ -974,10 +973,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*/
public ILaunchConfiguration findLaunchConfiguration(String name) {
if(name != null) {
- ILaunchConfiguration[] configs = getLaunchConfigurations();
- for (int i = 0; i < configs.length; i++) {
- if(name.equals(configs[i].getName())) {
- return configs[i];
+ for (ILaunchConfiguration config : getLaunchConfigurations()) {
+ if(name.equals(config.getName())) {
+ return config;
}
}
}
@@ -994,32 +992,22 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
final File directory = containerPath.toFile();
if (directory.isDirectory()) {
List<ILaunchConfiguration> configs = new ArrayList<>();
- FilenameFilter configFilter = new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return dir.equals(directory) &&
- name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
- }
- };
+ FilenameFilter configFilter = (dir, name) -> dir.equals(directory) &&
+ name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
File[] configFiles = directory.listFiles(configFilter);
if (configFiles != null && configFiles.length > 0) {
LaunchConfiguration config = null;
- for (int i = 0; i < configFiles.length; i++) {
- config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(configFiles[i].getName()), null, false);
+ for (File configFile : configFiles) {
+ config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(configFile.getName()), null, false);
configs.add(config);
}
}
- FilenameFilter prototypeFilter = new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return dir.equals(directory) && name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_PROTOTYPE_FILE_EXTENSION);
- }
- };
+ FilenameFilter prototypeFilter = (dir, name) -> dir.equals(directory) && name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_PROTOTYPE_FILE_EXTENSION);
File[] prototypeFiles = directory.listFiles(prototypeFilter);
if (prototypeFiles != null && prototypeFiles.length > 0) {
LaunchConfiguration config = null;
- for (int i = 0; i < prototypeFiles.length; i++) {
- config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(prototypeFiles[i].getName()), null, true);
+ for (File prototypeFile : prototypeFiles) {
+ config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(prototypeFile.getName()), null, true);
configs.add(config);
}
}
@@ -1130,7 +1118,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*
* @return all launch configuration handles
*/
- private synchronized List<ILaunchConfiguration> getAllLaunchConfigurations() {
+ public synchronized List<ILaunchConfiguration> getAllLaunchConfigurations() {
if (fLaunchConfigurationIndex == null) {
try {
fLaunchConfigurationIndex = new ArrayList<>(20);
@@ -1376,13 +1364,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
}
+ } else if (store != null){
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new Object[] {
+ config.getName(), store.toURI().toString() }), null);
} else {
- if (store != null){
- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new Object[] {
- config.getName(), store.toURI().toString() }), null);
- } else {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, new Object[] { config.getName() }), null);
- }
+ throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist_no_store_found, new Object[] { config.getName() }), null);
}
}
return info;
@@ -1497,10 +1483,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
@Override
public ILaunchConfigurationType getLaunchConfigurationType(String id) {
- ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
- for(int i = 0; i < types.length; i++) {
- if (types[i].getIdentifier().equals(id)) {
- return types[i];
+ for (ILaunchConfigurationType type : getLaunchConfigurationTypes()) {
+ if (type.getIdentifier().equals(id)) {
+ return type;
}
}
return null;
@@ -1577,10 +1562,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*/
public ILaunchDelegate getLaunchDelegate(String id) {
if(id != null) {
- ILaunchDelegate[] delegates = getLaunchDelegates();
- for(int i = 0; i < delegates.length; i++) {
- if(id.equals(delegates[i].getId())) {
- return delegates[i];
+ for (ILaunchDelegate delegate : getLaunchDelegates()) {
+ if(id.equals(delegate.getId())) {
+ return delegate;
}
}
}
@@ -1597,19 +1581,17 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fLaunchDelegates = new HashMap<>();
//get all launch delegate contributions
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES);
- IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
LaunchDelegate delegate = null;
- for(int i = 0; i < infos.length; i++) {
- delegate = new LaunchDelegate(infos[i]);
+ for (IConfigurationElement info : extensionPoint.getConfigurationElements()) {
+ delegate = new LaunchDelegate(info);
fLaunchDelegates.put(delegate.getId(), delegate);
}
//get all delegates from launch configuration type contributions
extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
- infos = extensionPoint.getConfigurationElements();
- for(int i = 0; i < infos.length; i++) {
+ for (IConfigurationElement info : extensionPoint.getConfigurationElements()) {
//must check to see if delegate is provided in contribution
- if(infos[i].getAttribute(IConfigurationElementConstants.DELEGATE) != null) {
- delegate = new LaunchDelegate(infos[i]);
+ if(info.getAttribute(IConfigurationElementConstants.DELEGATE) != null) {
+ delegate = new LaunchDelegate(info);
fLaunchDelegates.put(delegate.getId(), delegate);
}
}
@@ -1646,7 +1628,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
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) {
+ if(!IInternalDebugCoreConstants.EMPTY_STRING.equals(typeid) && modeset != null) {
fPreferredDelegates.add(new PreferredDelegate(delegate, typeid, modeset));
}
}
@@ -1680,7 +1662,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
// compatibility.
initializePreferredDelegates();
for (PreferredDelegate pd : fPreferredDelegates) {
- if(pd.getModes().equals(modes) & pd.getTypeId().equals(typeid)) {
+ if (pd.getModes().equals(modes) && pd.getTypeId().equals(typeid)) {
return pd.getDelegate();
}
}
@@ -1721,12 +1703,11 @@ 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())) {
- List<Set<String>> modesets = extensions[j].getModes();
+ for (LaunchDelegate extension : getLaunchDelegates(typeId)) {
+ if(id.equals(extension.getId())) {
+ List<Set<String>> modesets = extension.getModes();
if(modesets.contains(modeset)) {
- return extensions[j];
+ return extension;
}
}
}
@@ -1760,12 +1741,12 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
try {
IResource[] resources = config.getMappedResources();
if(resources != null) {
- for(int j = 0; j < resources.length; j++) {
- if(resources[j].equals(resource)) {
+ for (IResource res : resources) {
+ if(res.equals(resource)) {
configurations.add(config);
break;
- } else if (resource.getType() == IResource.PROJECT && resources[j].getType() == IResource.FILE){
- if (resources[j].getProject().equals(resource)) {
+ } else if (resource.getType() == IResource.PROJECT && res.getType() == IResource.FILE){
+ if (res.getProject().equals(resource)) {
configurations.add(config);
break;
}
@@ -1895,8 +1876,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fComparators = new HashMap<>(infos.length);
IConfigurationElement configurationElement = null;
String attr = null;
- for (int i= 0; i < infos.length; i++) {
- configurationElement = infos[i];
+ for (IConfigurationElement info : infos) {
+ configurationElement = info;
attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$
if (attr != null) {
fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
@@ -1919,8 +1900,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
fLaunchConfigurationTypes = new ArrayList<>(infos.length);
- for (int i= 0; i < infos.length; i++) {
- fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i]));
+ for (IConfigurationElement info : infos) {
+ fLaunchConfigurationTypes.add(new LaunchConfigurationType(info));
}
}
}
@@ -1935,8 +1916,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
fLaunchModes = new HashMap<>();
ILaunchMode mode = null;
- for (int i= 0; i < infos.length; i++) {
- mode = new LaunchMode(infos[i]);
+ for (IConfigurationElement info : infos) {
+ mode = new LaunchMode(info);
fLaunchModes.put(mode.getIdentifier(), mode);
}
}
@@ -1952,18 +1933,18 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_CONTAINER_TYPES);
IConfigurationElement[] extensions = extensionPoint.getConfigurationElements();
sourceContainerTypes = new HashMap<>();
- for (int i = 0; i < extensions.length; i++) {
+ for (IConfigurationElement extension : extensions) {
sourceContainerTypes.put(
- extensions[i].getAttribute(IConfigurationElementConstants.ID),
- new SourceContainerType(extensions[i]));
+ extension.getAttribute(IConfigurationElementConstants.ID),
+ new SourceContainerType(extension));
}
extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_PATH_COMPUTERS);
extensions = extensionPoint.getConfigurationElements();
sourcePathComputers = new HashMap<>();
- for (int i = 0; i < extensions.length; i++) {
+ for (IConfigurationElement extension : extensions) {
sourcePathComputers.put(
- extensions[i].getAttribute(IConfigurationElementConstants.ID),
- new SourcePathComputer(extensions[i]));
+ extension.getAttribute(IConfigurationElementConstants.ID),
+ new SourcePathComputer(extension));
}
}
}
@@ -1978,8 +1959,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fSourceLocators = new HashMap<>(infos.length);
IConfigurationElement configurationElement = null;
String id = null;
- for (int i= 0; i < infos.length; i++) {
- configurationElement = infos[i];
+ for (IConfigurationElement info : infos) {
+ configurationElement = info;
id = configurationElement.getAttribute(IConfigurationElementConstants.ID);
if (id != null) {
fSourceLocators.put(id,configurationElement);
@@ -2229,16 +2210,16 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
@Override
public void removeLaunches(ILaunch[] launches) {
List<ILaunch> removed = new ArrayList<>(launches.length);
- for (int i = 0; i < launches.length; i++) {
- if (internalRemoveLaunch(launches[i])) {
- removed.add(launches[i]);
+ for (ILaunch launch : launches) {
+ if (internalRemoveLaunch(launch)) {
+ removed.add(launch);
}
}
if (!removed.isEmpty()) {
ILaunch[] removedLaunches = removed.toArray(new ILaunch[removed.size()]);
fireUpdate(removedLaunches, REMOVED);
- for (int i = 0; i < removedLaunches.length; i++) {
- fireUpdate(removedLaunches[i], REMOVED);
+ for (ILaunch launch : removedLaunches) {
+ fireUpdate(launch, REMOVED);
}
}
}
@@ -2292,14 +2273,14 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
try {
ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations();
IResource[] resources = null;
- for(int i = 0; i < configs.length; i++) {
- if(configs[i].isLocal()) {
- resources = configs[i].getMappedResources();
+ for (ILaunchConfiguration config : configs) {
+ if(config.isLocal()) {
+ resources = config.getMappedResources();
if(resources != null) {
- for(int j = 0; j < resources.length; j++){
- if(resource.equals(resources[j]) ||
- resource.getFullPath().isPrefixOf(resources[j].getFullPath())) {
- list.add(configs[i]);
+ for (IResource res : resources) {
+ if(resource.equals(res) ||
+ resource.getFullPath().isPrefixOf(res.getFullPath())) {
+ list.add(config);
break;
}
}
@@ -2333,10 +2314,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fListeners = new ListenerList<>();
fLaunchesListeners = new ListenerList<>();
fLaunchConfigurationListeners = new ListenerList<>();
- ILaunch[] launches = getLaunches();
- ILaunch launch = null;
- for (int i= 0; i < launches.length; i++) {
- launch = launches[i];
+ for (ILaunch launch : getLaunches()) {
if(launch != null) {
try {
if (launch instanceof IDisconnect) {
@@ -2367,8 +2345,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*/
public void persistPreferredLaunchDelegates() {
ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
- for(int i = 0; i < types.length; i++) {
- persistPreferredLaunchDelegate((LaunchConfigurationType)types[i]);
+ for (ILaunchConfigurationType type : types) {
+ persistPreferredLaunchDelegate((LaunchConfigurationType)type);
}
}
@@ -2413,10 +2391,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
ILaunch[] launches = getLaunches();
ILaunchConfiguration[] configs = getMappedConfigurations(resource);
try {
- for(int i = 0; i < launches.length; i++) {
- for(int j = 0; j < configs.length; j++) {
- if(configs[j].equals(launches[i].getLaunchConfiguration()) & launches[i].canTerminate()) {
- launches[i].terminate();
+ for (ILaunch launch : launches) {
+ for (ILaunchConfiguration config : configs) {
+ if (config.equals(launch.getLaunchConfiguration()) && launch.canTerminate()) {
+ launch.terminate();
}
}
}
@@ -2545,11 +2523,10 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
}
List<Status> stati = null;
SubMonitor lmonitor = SubMonitor.convert(monitor, DebugCoreMessages.LaunchManager_29, files.length);
- for (int i = 0; i < files.length; i++) {
+ for (File source : files) {
if (lmonitor.isCanceled()) {
break;
}
- File source = files[i];
lmonitor.subTask(MessageFormat.format(DebugCoreMessages.LaunchManager_28, new Object[] { source.getName() }));
IPath location = new Path(LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.toOSString()).append(source.getName());
File target = location.toFile();
@@ -2622,13 +2599,11 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
*/
public synchronized boolean launchModeAvailable(String mode) {
if (fActiveModes == null) {
- ILaunchConfigurationType[] types = getLaunchConfigurationTypes();
- ILaunchMode[] modes = getLaunchModes();
fActiveModes = new HashSet<>(3);
- for (int i = 0; i < types.length; i++) {
- for (int j = 0; j < modes.length; j++) {
- if (types[i].supportsMode(modes[j].getIdentifier())) {
- fActiveModes.add(modes[j].getIdentifier());
+ for (ILaunchConfigurationType type : getLaunchConfigurationTypes()) {
+ for (ILaunchMode launchMode : getLaunchModes()) {
+ if (type.supportsMode(launchMode.getIdentifier())) {
+ fActiveModes.add(launchMode.getIdentifier());
}
}
}
@@ -2646,15 +2621,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
catch(IllegalArgumentException iae) {
//blanket change all reserved names
if(Platform.OS_WIN32.equals(Platform.getOS())) {
- for(int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) {
- if(UNSUPPORTED_WIN32_CONFIG_NAMES[i].equals(name)) {
+ for (String element : UNSUPPORTED_WIN32_CONFIG_NAMES) {
+ if(element.equals(name)) {
name = "launch_configuration"; //$NON-NLS-1$
}
}
}
//blanket replace all invalid chars
- for (int i = 0; i < DISALLOWED_CONFIG_NAME_CHARS.length; i++) {
- name = name.replace(DISALLOWED_CONFIG_NAME_CHARS[i], '_');
+ for (char element : DISALLOWED_CONFIG_NAME_CHARS) {
+ name = name.replace(element, '_');
}
}
//run it through the generator once more in case a replaced name has already been done
@@ -2664,15 +2639,15 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
@Override
public boolean isValidLaunchConfigurationName(String configname) throws IllegalArgumentException {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
- for(int i = 0; i < UNSUPPORTED_WIN32_CONFIG_NAMES.length; i++) {
- if(configname.equals(UNSUPPORTED_WIN32_CONFIG_NAMES[i])) {
+ for (String element : UNSUPPORTED_WIN32_CONFIG_NAMES) {
+ if(configname.equals(element)) {
throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name, new Object[] { configname }));
}
}
}
- for (int i = 0; i < DISALLOWED_CONFIG_NAME_CHARS.length; i++) {
- if (configname.indexOf(DISALLOWED_CONFIG_NAME_CHARS[i]) > -1) {
- throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name_char, new Object[] { String.valueOf(DISALLOWED_CONFIG_NAME_CHARS[i]) }));
+ for (char element : DISALLOWED_CONFIG_NAME_CHARS) {
+ if (configname.indexOf(element) > -1) {
+ throw new IllegalArgumentException(MessageFormat.format(DebugCoreMessages.LaunchManager_invalid_config_name_char, new Object[] { String.valueOf(element) }));
}
}
return true;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java
index 147def062..221da7915 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchMode.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
@@ -20,8 +22,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchMode;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Proxy to a launch mode extension.
*
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 fd03c0510..a7f92d2e6 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
@@ -188,10 +188,9 @@ public class LogicalStructureManager {
}
// 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];
+ for (ILogicalStructureType type : structureTypes) {
if (type.getId().equals(id)) {
+ // Return the type with the retrieved id
return type;
}
}
@@ -228,8 +227,7 @@ public class LogicalStructureManager {
*/
protected String getComboString(ILogicalStructureType[] types) {
StringBuilder comboKey= new StringBuilder();
- for (int i = 0; i < types.length; i++) {
- ILogicalStructureType type = types[i];
+ for (ILogicalStructureType type : types) {
int typeIndex = fStructureTypeIds.indexOf(type.getId());
if (typeIndex == -1) {
typeIndex= fStructureTypeIds.size();
@@ -246,8 +244,7 @@ public class LogicalStructureManager {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LOGICAL_STRUCTURE_TYPES);
IConfigurationElement[] extensions = point.getConfigurationElements();
fTypes = new ArrayList<>(extensions.length);
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement extension = extensions[i];
+ for (IConfigurationElement extension : extensions) {
LogicalStructureType type;
try {
type = new LogicalStructureType(extension);
@@ -260,9 +257,9 @@ public class LogicalStructureManager {
point= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LOGICAL_STRUCTURE_PROVIDERS);
extensions= point.getConfigurationElements();
fTypeProviders = new ArrayList<>(extensions.length);
- for (int i= 0; i < extensions.length; i++) {
+ for (IConfigurationElement extension : extensions) {
try {
- fTypeProviders.add(new LogicalStructureProvider(extensions[i]));
+ fTypeProviders.add(new LogicalStructureProvider(extension));
} catch (CoreException e) {
DebugPlugin.log(e);
}
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 470438bbe..074fc67d7 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
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
@@ -21,16 +23,15 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILogicalStructureType;
import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate;
import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate2;
+import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate3;
import org.eclipse.debug.core.model.IValue;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Proxy to a logical structure type extension.
*
* @see IConfigurationElementConstants
*/
-public class LogicalStructureType implements ILogicalStructureType {
+public class LogicalStructureType implements ILogicalStructureType, ILogicalStructureTypeDelegate3 {
private IConfigurationElement fConfigurationElement;
private ILogicalStructureTypeDelegate fDelegate;
@@ -108,6 +109,14 @@ public class LogicalStructureType implements ILogicalStructureType {
return false;
}
+ @Override
+ public void releaseValue(IValue logicalStructure) {
+ ILogicalStructureTypeDelegate delegate = getDelegate();
+ if (delegate instanceof ILogicalStructureTypeDelegate3) {
+ ((ILogicalStructureTypeDelegate3) delegate).releaseValue(logicalStructure);
+ }
+ }
+
/**
* Returns the <code>ILogicalStructuresTypeDelegate</code> delegate
* @return the delegate
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 65d9d71aa..aa3c53412 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
@@ -84,8 +84,8 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi
if (listeners != null) {
fType = update;
Object[] copiedListeners= listeners.toArray(new IMemoryBlockListener[listeners.size()]);
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IMemoryBlockListener)copiedListeners[i];
+ for (Object copiedListener : copiedListeners) {
+ fListener = (IMemoryBlockListener) copiedListener;
fMemoryBlocks = memBlocks;
SafeRunner.run(this);
}
@@ -118,11 +118,11 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi
if(mem.length > 0) {
ArrayList<IMemoryBlock> newMemoryBlocks = new ArrayList<>();
- for (int i=0; i<mem.length; i++) {
+ for (IMemoryBlock m : mem) {
// do not allow duplicates
- if (!memoryBlocks.contains(mem[i])) {
- newMemoryBlocks.add(mem[i]);
- memoryBlocks.add(mem[i]);
+ if (!memoryBlocks.contains(m)) {
+ newMemoryBlocks.add(m);
+ memoryBlocks.add(m);
// add listener for the first memory block added
if (memoryBlocks.size() == 1) {
DebugPlugin.getDefault().addDebugEventListener(this);
@@ -144,16 +144,16 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi
}
if(memBlocks.length > 0) {
- for (int i=0; i<memBlocks.length; i++) {
- memoryBlocks.remove(memBlocks[i]);
+ for (IMemoryBlock memBlock : memBlocks) {
+ memoryBlocks.remove(memBlock);
// remove listener after the last memory block has been removed
if (memoryBlocks.isEmpty()) {
DebugPlugin.getDefault().removeDebugEventListener(this);
}
- if (memBlocks[i] instanceof IMemoryBlockExtension) {
+ if (memBlock instanceof IMemoryBlockExtension) {
try {
- ((IMemoryBlockExtension)memBlocks[i]).dispose();
- } catch (DebugException e) {
+ ((IMemoryBlockExtension) memBlock).dispose();
+ }catch (DebugException e) {
DebugPlugin.log(e);
}
}
@@ -242,8 +242,8 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i=0; i < events.length; i++) {
- handleDebugEvent(events[i]);
+ for (DebugEvent event : events) {
+ handleDebugEvent(event);
}
}
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 9a399e27d..a7ce39e00 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,14 +16,17 @@ package org.eclipse.debug.internal.core;
import java.io.IOException;
import java.io.InputStream;
+import org.eclipse.debug.core.IBinaryStreamListener;
import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IBinaryStreamMonitor;
+import org.eclipse.debug.core.model.IBinaryStreamsProxy;
import org.eclipse.debug.core.model.IStreamMonitor;
-import org.eclipse.debug.core.model.IStreamsProxy2;
-public class NullStreamsProxy implements IStreamsProxy2 {
+public class NullStreamsProxy implements IBinaryStreamsProxy {
private NullStreamMonitor outputStreamMonitor;
private NullStreamMonitor errorStreamMonitor;
+ @SuppressWarnings("resource")
public NullStreamsProxy(Process process) {
outputStreamMonitor = new NullStreamMonitor(process.getInputStream());
errorStreamMonitor = new NullStreamMonitor(process.getErrorStream());
@@ -47,7 +50,21 @@ public class NullStreamsProxy implements IStreamsProxy2 {
public void write(String input) throws IOException {
}
- private class NullStreamMonitor implements IStreamMonitor {
+ @Override
+ public IBinaryStreamMonitor getBinaryErrorStreamMonitor() {
+ return errorStreamMonitor;
+ }
+
+ @Override
+ public IBinaryStreamMonitor getBinaryOutputStreamMonitor() {
+ return outputStreamMonitor;
+ }
+
+ @Override
+ public void write(byte[] data, int offset, int length) throws IOException {
+ }
+
+ private static class NullStreamMonitor implements IBinaryStreamMonitor {
private InputStream fStream;
public NullStreamMonitor(InputStream stream) {
@@ -58,8 +75,8 @@ public class NullStreamsProxy implements IStreamsProxy2 {
private void startReaderThread() {
Thread thread = new Thread((Runnable) () -> {
byte[] bytes = new byte[1024];
- try {
- while (fStream.read(bytes) >= 0) {
+ try (InputStream stream = fStream) {
+ while (stream.read(bytes) >= 0) {
// do nothing
}
} catch (IOException e) {
@@ -80,7 +97,33 @@ public class NullStreamsProxy implements IStreamsProxy2 {
}
@Override
+ public void flushContents() {
+ }
+
+ @Override
+ public void setBuffered(boolean buffer) {
+ }
+
+ @Override
+ public boolean isBuffered() {
+ return false;
+ }
+
+ @Override
public void removeListener(IStreamListener listener) {
}
+
+ @Override
+ public void addBinaryListener(IBinaryStreamListener listener) {
+ }
+
+ @Override
+ public byte[] getData() {
+ return new byte[0];
+ }
+
+ @Override
+ public void removeBinaryListener(IBinaryStreamListener listener) {
+ }
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
index 34aa133a8..218d87027 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,85 +11,113 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Paul Pazderski - Bug 545769: fixed rare UTF-8 character corruption bug
+ * Paul Pazderski - Bug 558463: add handling of raw stream content instead of strings
*******************************************************************************/
package org.eclipse.debug.internal.core;
import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.nio.charset.Charset;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBinaryStreamListener;
import org.eclipse.debug.core.IStreamListener;
-import org.eclipse.debug.core.model.IFlushableStreamMonitor;
+import org.eclipse.debug.core.model.IBinaryStreamMonitor;
/**
- * Monitors the output stream of a system process and notifies
- * listeners of additions to the stream.
- *
- * The output stream monitor reads system out (or err) via
- * and input stream.
+ * Monitors the output stream of a system process and notifies listeners of
+ * additions to the stream.
+ * <p>
+ * The output stream monitor reads system out (or err) via and input stream.
*/
-public class OutputStreamMonitor implements IFlushableStreamMonitor {
+public class OutputStreamMonitor implements IBinaryStreamMonitor {
+ /**
+ * The size of the read buffer.
+ */
+ private static final int BUFFER_SIZE = 8192;
+
/**
* The stream being monitored (connected system out or err).
*/
private InputStream fStream;
/**
- * A collection of listeners
+ * A collection of listeners interested in decoded content.
*/
private ListenerList<IStreamListener> fListeners = new ListenerList<>();
/**
- * Whether content is being buffered
+ * A collection of listeners interested in the raw content.
*/
- private boolean fBuffered = true;
+ private ListenerList<IBinaryStreamListener> fBinaryListeners = new ListenerList<>();
/**
- * The local copy of the stream contents
+ * The buffered stream content since last flush. Value of <code>null</code>
+ * indicates disabled buffering.
+ *
+ * @see #isBuffered()
*/
- private StringBuilder fContents;
+ private ByteArrayOutputStream fContents;
/**
- * The thread which reads from the stream
+ * Decoder used for the buffered content. This is required to keep the state
+ * of an incomplete character.
*/
- private Thread fThread;
+ private StreamDecoder fBufferedDecoder;
+ private String fCachedDecodedContents;
/**
- * The size of the read buffer
+ * The thread which reads from the stream
*/
- private static final int BUFFER_SIZE= 8192;
+ private Thread fThread;
/**
- * Whether or not this monitor has been killed.
- * When the monitor is killed, it stops reading
- * from the stream immediately.
+ * Whether or not this monitor has been killed. When the monitor is killed,
+ * it stops reading from the stream immediately.
*/
- private boolean fKilled= false;
+ private boolean fKilled = false;
- private long lastSleep;
+ private Charset fCharset;
- private String fEncoding;
+ private StreamDecoder fDecoder;
private final AtomicBoolean fDone;
/**
- * Creates an output stream monitor on the
- * given stream (connected to system out or err).
+ * Creates an output stream monitor on the given stream (connected to system
+ * out or err).
+ *
+ * @param stream input stream to read from
+ * @param charset stream charset or <code>null</code> for system default;
+ * unused if only the binary interface is used
+ */
+ public OutputStreamMonitor(InputStream stream, Charset charset) {
+ // java.lang.ProcessImpl returns a buffered stream anyway
+ fStream = stream instanceof BufferedInputStream ? stream : new BufferedInputStream(stream);
+ fCharset = charset;
+ fDecoder = new StreamDecoder(charset == null ? Charset.defaultCharset() : charset);
+ fDone = new AtomicBoolean(false);
+ setBuffered(true);
+ }
+
+ /**
+ * Creates an output stream monitor on the given stream (connected to system
+ * out or err).
*
* @param stream input stream to read from
* @param encoding stream encoding or <code>null</code> for system default
+ * @deprecated use {@link #OutputStreamMonitor(InputStream, Charset)}
+ * instead
*/
+ @Deprecated
public OutputStreamMonitor(InputStream stream, String encoding) {
- fStream = new BufferedInputStream(stream, 8192);
- fEncoding = encoding;
- fContents= new StringBuilder();
- fDone = new AtomicBoolean(false);
+ this(stream, Charset.forName(encoding));
}
@Override
@@ -97,35 +125,99 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
fListeners.add(listener);
}
+ @Override
+ public synchronized void addBinaryListener(IBinaryStreamListener listener) {
+ fBinaryListeners.add(listener);
+ }
+
/**
- * Causes the monitor to close all
- * communications between it and the
+ * Causes the monitor to close all communications between it and the
* underlying stream by waiting for the thread to terminate.
*/
protected void close() {
- if (fThread != null) {
- Thread thread= fThread;
- fThread= null;
+ Thread thread = null;
+
+ synchronized (this) {
+ thread = fThread;
+ fThread = null;
+ }
+
+ if (thread != null) {
try {
thread.join();
} catch (InterruptedException ie) {
}
- fListeners = new ListenerList<>();
+
+ fListeners.clear();
+ fBinaryListeners.clear();
}
}
/**
- * Notifies the listeners that text has
- * been appended to the stream.
- * @param text the text that was appended to the stream
+ * Notifies the listeners that content has been appended to the stream. Will
+ * notify both, binary and text listeners.
+ *
+ * @param data that has been appended; not <code>null</code>
+ * @param offset start of valid data
+ * @param length number of valid bytes
*/
- private void fireStreamAppended(String text) {
- getNotifier().notifyAppend(text);
+ private void fireStreamAppended(final byte[] data, int offset, int length) {
+ if (!fListeners.isEmpty()) {
+ String text = fDecoder.decode(data, offset, length);
+ for (final IStreamListener listener : fListeners) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ listener.streamAppended(text, OutputStreamMonitor.this);
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ DebugPlugin.log(exception);
+ }
+ });
+ }
+ }
+ if (!fBinaryListeners.isEmpty()) {
+ final byte[] validData;
+ if (offset > 0 || length < data.length) {
+ validData = new byte[length];
+ System.arraycopy(data, offset, validData, 0, length);
+ } else {
+ validData = data;
+ }
+ for (final IBinaryStreamListener listener : fBinaryListeners) {
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ listener.streamAppended(validData, OutputStreamMonitor.this);
+ }
+
+ @Override
+ public void handleException(Throwable exception) {
+ DebugPlugin.log(exception);
+ }
+ });
+ }
+ }
}
@Override
public synchronized String getContents() {
- return fContents.toString();
+ if (!isBuffered()) {
+ return ""; //$NON-NLS-1$
+ }
+ if (fCachedDecodedContents != null) {
+ return fCachedDecodedContents;
+ }
+ byte[] data = getData();
+ fCachedDecodedContents = fBufferedDecoder.decode(data, 0, data.length);
+ return fCachedDecodedContents;
+ }
+
+ @Override
+ public synchronized byte[] getData() {
+ return isBuffered() ? fContents.toByteArray() : new byte[0];
}
private void read() {
@@ -139,30 +231,29 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
/**
* Continually reads from the stream.
* <p>
- * This method, along with the <code>startReading</code>
- * method is used to allow <code>OutputStreamMonitor</code>
- * to implement <code>Runnable</code> without publicly
- * exposing a <code>run</code> method.
+ * This method, along with the {@link #startMonitoring()} method is used to
+ * allow {@link OutputStreamMonitor} to implement {@link Runnable} without
+ * publicly exposing a {@link Runnable#run()} method.
*/
private void internalRead() {
- lastSleep = System.currentTimeMillis();
+ long lastSleep = System.currentTimeMillis();
long currentTime = lastSleep;
- char[] chars = new char[BUFFER_SIZE];
+ byte[] buffer = new byte[BUFFER_SIZE];
int read = 0;
- try (InputStreamReader reader = (fEncoding == null ? new InputStreamReader(fStream) : new InputStreamReader(fStream, fEncoding))) {
+ try {
while (read >= 0) {
try {
if (fKilled) {
break;
}
- read = reader.read(chars);
+ read = fStream.read(buffer);
if (read > 0) {
- String text = new String(chars, 0, read);
synchronized (this) {
if (isBuffered()) {
- fContents.append(text);
+ fCachedDecodedContents = null;
+ fContents.write(buffer, 0, read);
}
- fireStreamAppended(text);
+ fireStreamAppended(buffer, 0, read);
}
}
} catch (IOException ioe) {
@@ -182,20 +273,21 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
currentTime = System.currentTimeMillis();
if (currentTime - lastSleep > 1000) {
lastSleep = currentTime;
- try {
- // just give up CPU to maintain UI responsiveness.
- Thread.sleep(1);
- } catch (InterruptedException e) {
- }
+ Thread.yield();// just give up CPU to maintain UI
+ // responsiveness.
}
}
- } catch (IOException e) {
- DebugPlugin.log(e);
+ } finally {
+ try {
+ fStream.close();
+ } catch (IOException e) {
+ DebugPlugin.log(e);
+ }
}
}
protected void kill() {
- fKilled= true;
+ fKilled = true;
}
@Override
@@ -203,72 +295,61 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
fListeners.remove(listener);
}
+ @Override
+ public synchronized void removeBinaryListener(IBinaryStreamListener listener) {
+ fBinaryListeners.remove(listener);
+ }
+
/**
* Starts a thread which reads from the stream
+ *
+ * @param name Thread name
*/
- protected void startMonitoring() {
- if (fThread == null) {
- fDone.set(false);
- fThread = new Thread((Runnable) this::read, DebugCoreMessages.OutputStreamMonitor_label);
- fThread.setDaemon(true);
- fThread.setPriority(Thread.MIN_PRIORITY);
- fThread.start();
+ protected void startMonitoring(String name) {
+ synchronized (this) {
+ if (fThread == null) {
+ fDone.set(false);
+ fThread = new Thread((Runnable) this::read, name);
+ fThread.setDaemon(true);
+ fThread.setPriority(Thread.MIN_PRIORITY);
+ fThread.start();
+ }
}
}
@Override
public synchronized void setBuffered(boolean buffer) {
- fBuffered = buffer;
+ if (isBuffered() != buffer) {
+ fCachedDecodedContents = null;
+ if (buffer) {
+ fContents = new ByteArrayOutputStream();
+ fBufferedDecoder = new StreamDecoder(fCharset == null ? Charset.defaultCharset() : fCharset);
+ } else {
+ fContents = null;
+ fBufferedDecoder = null;
+ }
+ }
}
@Override
public synchronized void flushContents() {
- fContents.setLength(0);
+ if (isBuffered()) {
+ fCachedDecodedContents = null;
+ fContents.reset();
+ }
}
@Override
public synchronized boolean isBuffered() {
- return fBuffered;
- }
-
- private ContentNotifier getNotifier() {
- return new ContentNotifier();
+ return fContents != null;
}
/**
* @return {@code true} if reading the underlying stream is done.
- * {@code false} if reading the stream has not started or is not done.
+ * {@code false} if reading the stream has not started or is not
+ * done.
*/
public boolean isReadingDone() {
return fDone.get();
}
-
- class ContentNotifier implements ISafeRunnable {
-
- private IStreamListener fListener;
- private String fText;
-
- @Override
- public void handleException(Throwable exception) {
- DebugPlugin.log(exception);
- }
-
- @Override
- public void run() throws Exception {
- fListener.streamAppended(fText, OutputStreamMonitor.this);
- }
-
- public void notifyAppend(String text) {
- if (text == null) {
- return;
- }
- fText = text;
- for (IStreamListener iStreamListener : fListeners) {
- fListener = iStreamListener;
- SafeRunner.run(this);
- }
- fListener = null;
- fText = null;
- }
- }
}
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 c7dfd261b..313392498 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
@@ -27,7 +27,7 @@ import org.osgi.service.prefs.BackingStoreException;
* @since 3.6 TODO can we roll this into general preference listening?
*/
public class PreferredDelegateModifyListener extends PreferenceModifyListener {
- class Visitor implements IPreferenceNodeVisitor {
+ static class Visitor implements IPreferenceNodeVisitor {
@Override
public boolean visit(IEclipsePreferences node) throws BackingStoreException {
@@ -36,8 +36,8 @@ public class PreferredDelegateModifyListener extends PreferenceModifyListener {
LaunchManager manager = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
manager.resetPreferredDelegates();
ILaunchConfigurationType[] types = manager.getLaunchConfigurationTypes();
- for (int i = 0; i < types.length; i++) {
- ((LaunchConfigurationType) types[i]).resetPreferredDelegates();
+ for (ILaunchConfigurationType type : types) {
+ ((LaunchConfigurationType) type).resetPreferredDelegates();
}
return false;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RefreshScopeComparator.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RefreshScopeComparator.java
index a875896d8..3a88dc34e 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RefreshScopeComparator.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RefreshScopeComparator.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
+import java.util.Arrays;
import java.util.Comparator;
import org.eclipse.core.resources.IResource;
@@ -27,26 +28,21 @@ import org.eclipse.debug.core.RefreshUtil;
* @since 3.6
*/
public class RefreshScopeComparator implements Comparator<String> {
-
- @Override
- public int compare(String o1, String o2) {
- String m1 = o1;
- String m2 = o2;
+ private static IResource[] toResources(String memento) {
try {
- IResource[] r1 = RefreshUtil.toResources(m1);
- IResource[] r2 = RefreshUtil.toResources(m2);
- if (r1.length == r2.length) {
- for (int i = 0; i < r2.length; i++) {
- if (!r1[i].equals(r2[i])) {
- return -1;
- }
- }
- return 0;
- }
+ return RefreshUtil.toResources(memento);
} catch (CoreException e) {
- return -1;
+ return null;
}
- return -1;
+ }
+
+ private static final Comparator<IResource> RESOURCE = Comparator.nullsFirst(Comparator.comparing(r -> r.toString()));
+ private static final Comparator<IResource[]> ARRAY = Comparator.nullsFirst((IResource[] s1, IResource[] s2) -> Arrays.compare(s1, s2, RESOURCE));
+ private static final Comparator<String> MEMENTO = Comparator.nullsFirst(Comparator.comparing(m -> toResources(m), ARRAY));
+
+ @Override
+ public int compare(String o1, String o2) {
+ return MEMENTO.compare(o1, o2);
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
index a2ecfb295..115702444 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
@@ -84,8 +84,7 @@ public class StepFilterManager implements ILaunchListener {
public void setUseStepFilters(boolean useFilters) {
Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), PREF_USE_STEP_FILTERS, useFilters, null);
ILaunch[] launchs = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- for (int i = 0; i < launchs.length; i++) {
- ILaunch launch = launchs[i];
+ for (ILaunch launch : launchs) {
launchChanged(launch);
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/StreamDecoder.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamDecoder.java
index 0bc54f2af..f64d3d4d0 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/StreamDecoder.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamDecoder.java
@@ -12,7 +12,7 @@
* Andreas Loth - initial API and implementation
*******************************************************************************/
-package org.eclipse.ui.internal.console;
+package org.eclipse.debug.internal.core;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -20,27 +20,40 @@ import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
-
+import java.util.Set;
/**
- * @since 3.7
+ * Wraps CharsetDecoder to decode a byte stream statefully to characters.
+ *
+ * @since 3.7 org.eclipse.ui.console
*/
public class StreamDecoder {
+ // For more context see https://bugs.eclipse.org/bugs/show_bug.cgi?id=507664
- static private final int BUFFER_SIZE = 4096;
+ /** size of java.io.BufferedInputStream.DEFAULT_BUFFER_SIZE **/
+ private static final int INPUT_BUFFER_SIZE = 8192;
+ private final Charset charset;
private final CharsetDecoder decoder;
private final ByteBuffer inputBuffer;
private final CharBuffer outputBuffer;
- private boolean finished;
+ private volatile boolean finished;
+
+ /**
+ * Incomplete list of known Single Byte Character Sets (see
+ * sun.nio.cs.SingleByte) which do not need a buffer
+ **/
+ Set<String> singlebyteCharsetNames = Set.of("ISO_8859_1", "US_ASCII", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255", "windows-1256", "windows-1257", "windows-1258"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$
public StreamDecoder(Charset charset) {
- this.decoder = charset.newDecoder();
- this.decoder.onMalformedInput(CodingErrorAction.REPLACE);
- this.decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- this.inputBuffer = ByteBuffer.allocate(StreamDecoder.BUFFER_SIZE);
- this.inputBuffer.flip();
- this.outputBuffer = CharBuffer.allocate(StreamDecoder.BUFFER_SIZE);
+ this.charset = charset;
+ CharsetDecoder d = charset.newDecoder();
+ d.onMalformedInput(CodingErrorAction.REPLACE);
+ d.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ boolean unbuffered = singlebyteCharsetNames.contains(charset.name());
+ this.decoder = unbuffered ? null : d;
+ this.inputBuffer = unbuffered ? null : ByteBuffer.allocate(StreamDecoder.INPUT_BUFFER_SIZE).flip();
+ this.outputBuffer = unbuffered ? null : CharBuffer.allocate((int) (StreamDecoder.INPUT_BUFFER_SIZE * d.maxCharsPerByte()));
this.finished = false;
}
@@ -79,12 +92,31 @@ public class StreamDecoder {
} while (!finishedReading);
}
- public void decode(StringBuilder consumer, byte[] buffer, int offset, int length) {
+ public String decode(byte[] buffer, int offset, int length) {
+ if (this.decoder == null) {
+ // fast path for single byte encodings
+ return new String(buffer, offset, length, charset);
+ }
+ StringBuilder builder = new StringBuilder();
+ decode(builder, buffer, offset, length);
+ return builder.toString();
+ }
+
+ private void decode(StringBuilder consumer, byte[] buffer, int offset, int length) {
this.internalDecode(consumer, buffer, offset, length);
this.consume(consumer);
}
- public void finish(StringBuilder consumer) {
+ public String finish() {
+ if (this.decoder == null) {
+ return ""; //$NON-NLS-1$
+ }
+ StringBuilder builder = new StringBuilder();
+ finish(builder);
+ return builder.toString();
+ }
+
+ private void finish(StringBuilder consumer) {
if (this.finished) {
return;
}
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 616e79674..3996d9546 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,16 +15,21 @@ package org.eclipse.debug.internal.core;
import java.io.IOException;
+import java.nio.charset.Charset;
+import org.eclipse.debug.core.model.IBinaryStreamMonitor;
+import org.eclipse.debug.core.model.IBinaryStreamsProxy;
import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.core.model.IStreamsProxy;
import org.eclipse.debug.core.model.IStreamsProxy2;
/**
- * Standard implementation of a streams proxy for IStreamsProxy.
+ * Standard implementation of a streams proxy for {@link IStreamsProxy},
+ * {@link IStreamsProxy2} and {@link IBinaryStreamsProxy}.
+ * <p>
+ * Will use the same monitor instances for binary and string stream handling.
*/
-
-public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 {
+public class StreamsProxy implements IBinaryStreamsProxy {
/**
* The monitor for the output stream (connected to standard out of the process)
*/
@@ -43,30 +48,48 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 {
* <code>false</code> by default.
*/
private boolean fClosed;
+
/**
- * Creates a <code>StreamsProxy</code> on the streams
- * of the given system process.
+ * Creates a <code>StreamsProxy</code> on the streams of the given system
+ * process.
*
* @param process system process to create a streams proxy on
- * @param encoding the process's encoding or <code>null</code> if default
+ * @param charset the process's charset or <code>null</code> if default
+ * @param suffix Thread name suffix
*/
- public StreamsProxy(Process process, String encoding) {
+ @SuppressWarnings("resource")
+ public StreamsProxy(Process process, Charset charset, String suffix) {
if (process == null) {
return;
}
- fOutputMonitor= new OutputStreamMonitor(process.getInputStream(), encoding);
- fErrorMonitor= new OutputStreamMonitor(process.getErrorStream(), encoding);
- fInputMonitor= new InputStreamMonitor(process.getOutputStream(), encoding);
- fOutputMonitor.startMonitoring();
- fErrorMonitor.startMonitoring();
- fInputMonitor.startMonitoring();
+ fOutputMonitor = new OutputStreamMonitor(process.getInputStream(), charset);
+ fErrorMonitor = new OutputStreamMonitor(process.getErrorStream(), charset);
+ fInputMonitor = new InputStreamMonitor(process.getOutputStream(), charset);
+ fOutputMonitor.startMonitoring("Output Stream Monitor" + suffix); //$NON-NLS-1$
+ fErrorMonitor.startMonitoring("Error Stream Monitor" + suffix); //$NON-NLS-1$
+ fInputMonitor.startMonitoring("Input Stream Monitor" + suffix); //$NON-NLS-1$
}
/**
- * Causes the proxy to close all
- * communications between it and the
- * underlying streams after all remaining data
- * in the streams is read.
+ * Creates a <code>StreamsProxy</code> on the streams of the given system
+ * process.
+ *
+ * @param process system process to create a streams proxy on
+ * @param encoding the process's encoding or <code>null</code> if default
+ * @deprecated use {@link #StreamsProxy(Process, Charset)} instead
+ */
+ @Deprecated
+ public StreamsProxy(Process process, String encoding) {
+ // This constructor was once removed in favor of the Charset variant
+ // but Bug 562653 brought up a client which use this internal class via
+ // reflection and breaks without this constructor. So we restored the
+ // old constructor for the time being.
+ this(process, Charset.forName(encoding), ""); //$NON-NLS-1$
+ }
+
+ /**
+ * Causes the proxy to close all communications between it and the
+ * underlying streams after all remaining data in the streams is read.
*/
public void close() {
if (!isClosed(true)) {
@@ -137,4 +160,22 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 {
}
+ @Override
+ public IBinaryStreamMonitor getBinaryErrorStreamMonitor() {
+ return fErrorMonitor;
+ }
+
+ @Override
+ public IBinaryStreamMonitor getBinaryOutputStreamMonitor() {
+ return fOutputMonitor;
+ }
+
+ @Override
+ public void write(byte[] data, int offset, int length) throws IOException {
+ if (!isClosed(false)) {
+ fInputMonitor.write(data, offset, length);
+ } else {
+ throw new IOException();
+ }
+ }
}
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 d8b6fe817..55ad375a5 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -19,6 +19,7 @@ import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
+import java.util.Arrays;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -43,6 +44,8 @@ public final class XMLMemento {
private Element element;
+ private static String FILE_STRING = "file"; //$NON-NLS-1$
+
/**
* Creates a <code>Document</code> from the <code>Reader</code>
* and returns a memento on the first <code>Element</code> for reading
@@ -61,6 +64,27 @@ public final class XMLMemento {
}
/**
+ * Clients who need to use the "file" protocol can override this method to
+ * return the original attribute value
+ *
+ * @param attributeOldValue
+ * @return return the new attribute value after concatenating the "file"
+ * protocol restriction if does not exist already
+ */
+ private static String getAttributeNewValue(Object attributeOldValue) {
+ StringBuffer strNewValue = new StringBuffer(FILE_STRING);
+ if (attributeOldValue instanceof String && ((String) attributeOldValue).length() != 0) {
+ String strOldValue = (String) attributeOldValue;
+ boolean exists = Arrays.asList(strOldValue.split(",")).stream().anyMatch(x -> x.trim().equals(FILE_STRING)); //$NON-NLS-1$
+ if (!exists) {
+ strNewValue.append(", ").append(strOldValue); //$NON-NLS-1$
+ } else {
+ strNewValue = new StringBuffer(strOldValue);
+ }
+ }
+ return strNewValue.toString();
+ }
+ /**
* Creates a <code>Document</code> from the <code>Reader</code>
* and returns a memento on the first <code>Element</code> for reading
* the document.
@@ -78,10 +102,20 @@ public final class XMLMemento {
throws Exception {
String errorMessage = null;
Exception exception = null;
-
+ DocumentBuilderFactory factory = null;
+ Object attributeDTDOldValue = null;
+ Object attributeSchemaOldValue = null;
try {
- DocumentBuilderFactory factory = DocumentBuilderFactory
- .newInstance();
+ factory = DocumentBuilderFactory.newInstance();
+ try {
+ attributeDTDOldValue = factory.getAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD);
+ attributeSchemaOldValue = factory.getAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA);
+ } catch (NullPointerException | IllegalArgumentException e) {
+ // Attributes not defined
+ }
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, getAttributeNewValue(attributeDTDOldValue));
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA, getAttributeNewValue(attributeSchemaOldValue));
+
DocumentBuilder parser = factory.newDocumentBuilder();
InputSource source = new InputSource(reader);
if (baseDir != null) {
@@ -104,6 +138,11 @@ public final class XMLMemento {
} catch (SAXException e) {
exception = e;
// errorMessage = WorkbenchMessages.XMLMemento_formatError;
+ } finally {
+ if (factory != null) {
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_DTD, attributeDTDOldValue);
+ factory.setAttribute(javax.xml.XMLConstants.ACCESS_EXTERNAL_SCHEMA, attributeSchemaOldValue);
+ }
}
String problemText = null;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java
index eac8a170a..14c8f661a 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/DebugCommandRequest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.core.commands;
+import java.util.Arrays;
+
import org.eclipse.debug.core.commands.IDebugCommandRequest;
/**
@@ -31,5 +33,9 @@ public class DebugCommandRequest extends Request implements IDebugCommandRequest
return fElements;
}
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " on " + Arrays.toString(fElements); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/ForEachCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/ForEachCommand.java
index a890c4c95..e222a72b5 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/ForEachCommand.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/ForEachCommand.java
@@ -15,8 +15,10 @@ package org.eclipse.debug.internal.core.commands;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.core.commands.AbstractDebugCommand;
+import org.eclipse.debug.core.commands.IDebugCommandRequest;
import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
@@ -26,10 +28,12 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
*/
public abstract class ForEachCommand extends AbstractDebugCommand {
+ private final ExclusiveRule exclusiveRule = new ExclusiveRule();
+
@Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
- for (int i = 0; i < targets.length; i++) {
- execute(targets[i]);
+ for (Object target : targets) {
+ execute(target);
monitor.worked(1);
}
}
@@ -38,8 +42,8 @@ public abstract class ForEachCommand extends AbstractDebugCommand {
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request) throws CoreException {
- for (int i = 0; i < targets.length; i++) {
- if (!isExecutable(targets[i])) {
+ for (Object target : targets) {
+ if (!isExecutable(target)) {
return false;
}
monitor.worked(1);
@@ -49,4 +53,28 @@ public abstract class ForEachCommand extends AbstractDebugCommand {
protected abstract boolean isExecutable(Object target);
+ /*
+ * Do not allow parallel update requests for the same command, since those
+ * can result in race conditions, where one selected element enables a
+ * command and another selected element disables the command. Depending on
+ * which request is processed first, the debug command could end up with the
+ * wrong enabled state. See bug 560274.
+ */
+ @Override
+ protected ISchedulingRule getEnabledStateSchedulingRule(IDebugCommandRequest request) {
+ return exclusiveRule;
+ }
+
+ static class ExclusiveRule implements ISchedulingRule {
+
+ @Override
+ public boolean contains(ISchedulingRule rule) {
+ return rule == this;
+ }
+
+ @Override
+ public boolean isConflicting(ISchedulingRule rule) {
+ return contains(rule);
+ }
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java
index dc03bf01a..55f8ac79f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java
@@ -35,8 +35,8 @@ public abstract class StepCommand extends AbstractDebugCommand {
@Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
- for (int i = 0; i < targets.length; i++) {
- step(targets[i]);
+ for (Object target : targets) {
+ step(target);
}
}
@@ -45,8 +45,8 @@ public abstract class StepCommand extends AbstractDebugCommand {
@Override
protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest collector) throws CoreException {
if (isThreadCompatible(targets)) {
- for (int i = 0; i < targets.length; i++) {
- if (!isSteppable(targets[i])) {
+ for (Object target : targets) {
+ if (!isSteppable(target)) {
return false;
}
}
@@ -64,8 +64,7 @@ public abstract class StepCommand extends AbstractDebugCommand {
}
// check if frames from same thread
Set<IThread> threads = new HashSet<>(targets.length);
- for (int i = 0; i < targets.length; i++) {
- Object object = targets[i];
+ for (Object object : targets) {
IStackFrame frame = null;
if (object instanceof IStackFrame) {
frame = (IStackFrame) object;
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 7ac3e1cea..191be6f80 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
@@ -72,8 +72,7 @@ public class StepFiltersCommand extends ForEachCommand implements IStepFiltersHa
return;
}
IStepFilters[] filters = (IStepFilters[]) target;
- for (int i = 0; i < filters.length; i++) {
- IStepFilters filter = filters[i];
+ for (IStepFilters filter : filters) {
filter.setStepFiltersEnabled(DebugPlugin.isUseStepFilters());
}
}
@@ -81,8 +80,7 @@ public class StepFiltersCommand extends ForEachCommand implements IStepFiltersHa
@Override
protected boolean isExecutable(Object target) {
IStepFilters[] filters = (IStepFilters[]) target;
- for (int i = 0; i < filters.length; i++) {
- IStepFilters filter = filters[i];
+ for (IStepFilters filter : filters) {
if (filter == null || !filter.supportsStepFilters()) {
return false;
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java
index 6a5c79613..851d35a95 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/groups/GroupLaunchConfigurationDelegate.java
@@ -19,7 +19,6 @@ package org.eclipse.debug.internal.core.groups;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -127,10 +126,8 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat
// loop detected. report as appropriate and die.
IStatusHandler cycleHandler = DebugPlugin.getDefault().getStatusHandler(GROUP_CYCLE);
cycleHandler.handleStatus(GROUP_CYCLE, conf.getName());
- } else {
- if (!launchChild(progress.newChild(1000 / launches.size()), group, le, conf, localMode, (i == launches.size() - 1))) {
- break;
- }
+ } else if (!launchChild(progress.newChild(1000 / launches.size()), group, le, conf, localMode, (i == launches.size() - 1))) {
+ break;
}
// in case the group has been terminated while waiting in the
@@ -286,10 +283,9 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat
protected static ILaunchConfiguration findLaunchConfiguration(String name) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations();
- for (int i = 0; i < launchConfigurations.length; i++) {
- ILaunchConfiguration lConf = launchConfigurations[i];
- if (lConf.getName().equals(name)) {
- return lConf;
+ for (ILaunchConfiguration config : launchConfigurations) {
+ if (config.getName().equals(name)) {
+ return config;
}
}
return null;
@@ -322,9 +318,9 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat
public static List<GroupLaunchElement> createLaunchElements(ILaunchConfiguration configuration) {
List<GroupLaunchElement> result = new ArrayList<>();
try {
- Map<?, ?> attrs = configuration.getAttributes();
- for (Iterator<?> iterator = attrs.keySet().iterator(); iterator.hasNext();) {
- String attr = (String) iterator.next();
+ Map<String, Object> attrs = configuration.getAttributes();
+ for (Map.Entry<String, Object> entry : attrs.entrySet()) {
+ String attr = entry.getKey();
try {
if (attr.startsWith(MULTI_LAUNCH_CONSTANTS_PREFIX)) {
String prop = attr.substring(MULTI_LAUNCH_CONSTANTS_PREFIX.length() + 1);
@@ -335,7 +331,7 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat
if (name.equals(NAME_PROP)) {
GroupLaunchElement el = new GroupLaunchElement();
el.index = index;
- el.name = (String) attrs.get(attr);
+ el.name = (String) entry.getValue();
Object actionParam = null;
String actionStr = (String) attrs.get(getProp(index, ACTION_PROP));
@@ -407,9 +403,7 @@ public class GroupLaunchConfigurationDelegate extends LaunchConfigurationDelegat
public static void removeLaunchElements(ILaunchConfigurationWorkingCopy configuration) {
try {
- Map<?, ?> attrs = configuration.getAttributes();
- for (Iterator<?> iterator = attrs.keySet().iterator(); iterator.hasNext();) {
- String attr = (String) iterator.next();
+ for (String attr : configuration.getAttributes().keySet()) {
try {
if (attr.startsWith(MULTI_LAUNCH_CONSTANTS_PREFIX)) {
configuration.removeAttribute(attr);
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java
index 1be76866d..5ec80ab85 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLocatorMementoComparator.java
@@ -24,6 +24,15 @@ public class SourceLocatorMementoComparator implements Comparator<String> {
@Override
public int compare(String o1, String o2) {
+ if (o1 == null && o2 == null) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
String m1 = o1;
String m2 = o2;
int i1 = 0, i2 = 0;
@@ -32,7 +41,7 @@ public class SourceLocatorMementoComparator implements Comparator<String> {
i2 = skipWhitespace(m2, i2);
if (i1 < m1.length() && i2 < m2.length()) {
if (m1.charAt(i1) != m2.charAt(i2)) {
- return -1;
+ return m1.charAt(i1) - m2.charAt(i2);
}
i1++;
i2++;
@@ -40,6 +49,9 @@ public class SourceLocatorMementoComparator implements Comparator<String> {
if (i2 < m2.length()) {
return -1;
}
+ if (i1 < m1.length()) {
+ return 1;
+ }
return 0;
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java
index 92c019db8..5891e9258 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/sourcelookup/SourceLookupUtils.java
@@ -51,6 +51,7 @@ public class SourceLookupUtils {
* @exception IOException if unable to create the specified zip
* file
*/
+ @SuppressWarnings("resource")
public static ZipFile getZipFile(String name) throws IOException {
synchronized (fgZipFileCache) {
if (fgCleaner == null) {
@@ -107,8 +108,7 @@ public class SourceLookupUtils {
@Override
public void launchesRemoved(ILaunch[] launches) {
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
+ for (ILaunch launch : launches) {
if (!launch.isTerminated()) {
SourceLookupUtils.closeArchives();
return;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ResourceResolver.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ResourceResolver.java
index 9d13dfe6d..e0a97a1f7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ResourceResolver.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/variables/ResourceResolver.java
@@ -15,6 +15,7 @@ package org.eclipse.debug.internal.core.variables;
import java.io.File;
import java.net.URI;
+import java.text.MessageFormat;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.resources.IResource;
@@ -31,8 +32,6 @@ import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugPlugin;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Common function of variable resolvers.
* Moved to debug core in 3.5, existed in debug.iu since 3.0.
diff --git a/org.eclipse.debug.core/forceQualifierUpdate.txt b/org.eclipse.debug.core/forceQualifierUpdate.txt
new file mode 100644
index 000000000..e3185a3bd
--- /dev/null
+++ b/org.eclipse.debug.core/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update add the bug here
+Bug 566471 - I20200828-0150 - Comparator Errors Found
diff --git a/org.eclipse.debug.core/plugin.properties b/org.eclipse.debug.core/plugin.properties
index 886721320..aa747ccd7 100644
--- a/org.eclipse.debug.core/plugin.properties
+++ b/org.eclipse.debug.core/plugin.properties
@@ -75,3 +75,5 @@ Breakpoint.name = Breakpoint
GroupLaunch.name=Launch Group
GroupLaunch.description=Launch several other configurations sequentially
+
+LaunchConfiguration=Launch Configuration
diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml
index 233aae3b4..13360fa45 100644
--- a/org.eclipse.debug.core/plugin.xml
+++ b/org.eclipse.debug.core/plugin.xml
@@ -280,4 +280,14 @@
public="true">
</launchConfigurationType>
</extension>
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
+ <content-type
+ base-type="org.eclipse.core.runtime.xml"
+ file-extensions="launch"
+ id="org.eclipse.debug.core.launch"
+ name="%LaunchConfiguration"
+ priority="normal">
+ </content-type>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.core/schema/logicalStructureTypes.exsd b/org.eclipse.debug.core/schema/logicalStructureTypes.exsd
index de67dd53f..d46ad85bd 100644
--- a/org.eclipse.debug.core/schema/logicalStructureTypes.exsd
+++ b/org.eclipse.debug.core/schema/logicalStructureTypes.exsd
@@ -1,139 +1,139 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.debug.core" id="logicalStructureTypes" name="Logical Structure Types"/>
- </appInfo>
- <documentation>
- This extension point allows debuggers to present alternative logical structures of values. Often, complex data structures are more convenient to navigate in terms of their logical structure, rather than in terms of their implementation. For example, no matter how a list is implemented (linked, array, etc.), a user may simply want to see the elements in the list in terms of an ordered collection. This extension point allows the contribution of logical structure types, to provide translations from a raw implementation value to a logical value.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="logicalStructureType" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="logicalStructureType">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- a unique identifier for this logical structure type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- a description of this logical structure. Since 3.1, this attribute is optional. When unspecified, a logical structure type delegate must also implement &lt;code&gt;ILogicalStructureTypeDelegate2&lt;/code&gt; to provide descriptions for values that logical structures are provided for.
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- fully qualified name of a Java class that implements &lt;code&gt;ILogicalStructureTypeDelegate&lt;/code&gt;. The class may optionally implement &lt;code&gt;ILogicalStructureTypeDelegate2&lt;/code&gt;.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILogicalStructureTypeDelegate"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="modelIdentifier" type="string" use="required">
- <annotation>
- <documentation>
- identifier of the debug model this logical structure type is associated with
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a logical structure type extension point:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.debug.core.logicalStructureTypes&quot;&gt;
- &lt;logicalStructureType
- id=&quot;com.example.ExampleLogicalStructure&quot;
- class=&quot;com.example.ExampleLogicalStructureDelegate&quot;
- modelIdentifier=&quot;com.example.debug.model&quot;
- description=&quot;Ordered Collection&quot;&gt;
- &lt;/logicalStructureType&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-
-In the example above, the specified logical structure type will be consulted for alternative logical values for values from the &lt;code&gt;com.example.debug.model&lt;/code&gt; debug model as they are displayed in the variables view.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.ILogicalStructureTypeDelegate&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.core" id="logicalStructureTypes" name="Logical Structure Types"/>
+ </appInfo>
+ <documentation>
+ This extension point allows debuggers to present alternative logical structures of values. Often, complex data structures are more convenient to navigate in terms of their logical structure, rather than in terms of their implementation. For example, no matter how a list is implemented (linked, array, etc.), a user may simply want to see the elements in the list in terms of an ordered collection. This extension point allows the contribution of logical structure types, to provide translations from a raw implementation value to a logical value.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="logicalStructureType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="logicalStructureType">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique identifier for this logical structure type
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ a description of this logical structure. Since 3.1, this attribute is optional. When unspecified, a logical structure type delegate must also implement &lt;code&gt;ILogicalStructureTypeDelegate2&lt;/code&gt; to provide descriptions for values that logical structures are provided for.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ fully qualified name of a Java class that implements &lt;code&gt;ILogicalStructureTypeDelegate&lt;/code&gt;. The class may optionally implement &lt;code&gt;ILogicalStructureTypeDelegate2&lt;/code&gt;.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILogicalStructureTypeDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="modelIdentifier" type="string" use="required">
+ <annotation>
+ <documentation>
+ identifier of the debug model this logical structure type is associated with
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a logical structure type extension point:
+
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.debug.core.logicalStructureTypes&quot;&gt;
+ &lt;logicalStructureType
+ id=&quot;com.example.ExampleLogicalStructure&quot;
+ class=&quot;com.example.ExampleLogicalStructureDelegate&quot;
+ modelIdentifier=&quot;com.example.debug.model&quot;
+ description=&quot;Ordered Collection&quot;&gt;
+ &lt;/logicalStructureType&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+
+In the example above, the specified logical structure type will be consulted for alternative logical values for values from the &lt;code&gt;com.example.debug.model&lt;/code&gt; debug model as they are displayed in the variables view.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.ILogicalStructureTypeDelegate&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.debug.core/schema/processFactories.exsd b/org.eclipse.debug.core/schema/processFactories.exsd
index 4a37fa036..b24683cdf 100644
--- a/org.eclipse.debug.core/schema/processFactories.exsd
+++ b/org.eclipse.debug.core/schema/processFactories.exsd
@@ -1,125 +1,125 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.debug.core" id="processFactories" name="Process Factories"/>
- </appInfo>
- <documentation>
- This extension point provides a mechanism for specifying a process factory to be used with a launch configuration to create the appropriate instance of &lt;b&gt;IProcess&lt;/b&gt;.
- The launch configuration will require the &lt;b&gt;DebugPlugin.ATTR_PROCESS_FACTORY_ID&lt;/b&gt; attribute set to the appropriate process factory ID that will be
- used to create the &lt;b&gt;IProcess&lt;/b&gt;
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="processFactory" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="processFactory">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="name"/>
- </appInfo>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- specifies a unique identifier for this process factory.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- specifies the fully qualified name of the Java class that implements &lt;code&gt;IProcessFactory&lt;/code&gt;.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.debug.core.IProcessFactory"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a process factory extension point:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.debug.core.processFactories&quot;&gt;
- &lt;processFactory
- id=&quot;com.example.ExampleIdentifier&quot;
- class=&quot;com.example.ExampleProcessFactory&quot;&gt;
- &lt;/processFactory&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.IProcessFactory&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.core" id="processFactories" name="Process Factories"/>
+ </appInfo>
+ <documentation>
+ This extension point provides a mechanism for specifying a process factory to be used with a launch configuration to create the appropriate instance of &lt;b&gt;IProcess&lt;/b&gt;.
+ The launch configuration will require the &lt;b&gt;DebugPlugin.ATTR_PROCESS_FACTORY_ID&lt;/b&gt; attribute set to the appropriate process factory ID that will be
+ used to create the &lt;b&gt;IProcess&lt;/b&gt;
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="processFactory" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="processFactory">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="name"/>
+ </appInfo>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a unique identifier for this process factory.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the fully qualified name of the Java class that implements &lt;code&gt;IProcessFactory&lt;/code&gt;.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.debug.core.IProcessFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a process factory extension point:
+
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.debug.core.processFactories&quot;&gt;
+ &lt;processFactory
+ id=&quot;com.example.ExampleIdentifier&quot;
+ class=&quot;com.example.ExampleProcessFactory&quot;&gt;
+ &lt;/processFactory&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.IProcessFactory&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.debug.core/schema/sourceContainerTypes.exsd b/org.eclipse.debug.core/schema/sourceContainerTypes.exsd
index 91a043ec0..b60aeefd4 100644
--- a/org.eclipse.debug.core/schema/sourceContainerTypes.exsd
+++ b/org.eclipse.debug.core/schema/sourceContainerTypes.exsd
@@ -1,156 +1,156 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.debug.core" id="sourceContainerTypes" name="Source Container Types"/>
- </appInfo>
- <documentation>
- This extension point allows for an extensible set of source container types to be contributed by the debug platform
- source lookup facilities.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="sourceContainerType" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="sourceContainerType">
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- The unique id used to refer to this type
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The name of this source container type used for presentation purposes.
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- A class that implements &lt;code&gt;ISourceContainerTypeDelegate&lt;/code&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- A short description of this source container for presentation purposes.
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a source container type definition:
-&lt;pre&gt;
-&lt;extension point=&quot;org.eclipse.debug.core.sourceContainerTypes&quot;&gt;
- &lt;sourceContainerType
- name=&quot;Project&quot;
- class=&quot;org.eclipse.debug.internal.core.sourcelookup.containers.ProjectSourceContainerType&quot;
- id=&quot;org.eclipse.debug.core.containerType.project&quot;
- description=&quot;A project in the workspace&quot;&gt;
- &lt;/sourceContainerType&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;ISourceContainerType&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.core" id="sourceContainerTypes" name="Source Container Types"/>
+ </appInfo>
+ <documentation>
+ This extension point allows for an extensible set of source container types to be contributed by the debug platform
+ source lookup facilities.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="sourceContainerType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="sourceContainerType">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique id used to refer to this type
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The name of this source container type used for presentation purposes.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements &lt;code&gt;ISourceContainerTypeDelegate&lt;/code&gt;
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.debug.internal.core.sourcelookup.ISourceContainerTypeDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ A short description of this source container for presentation purposes.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a source container type definition:
+&lt;pre&gt;
+&lt;extension point=&quot;org.eclipse.debug.core.sourceContainerTypes&quot;&gt;
+ &lt;sourceContainerType
+ name=&quot;Project&quot;
+ class=&quot;org.eclipse.debug.internal.core.sourcelookup.containers.ProjectSourceContainerType&quot;
+ id=&quot;org.eclipse.debug.core.containerType.project&quot;
+ description=&quot;A project in the workspace&quot;&gt;
+ &lt;/sourceContainerType&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;ISourceContainerType&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.debug.core/schema/watchExpressionDelegates.exsd b/org.eclipse.debug.core/schema/watchExpressionDelegates.exsd
index 7e11331f1..b90de4e07 100644
--- a/org.eclipse.debug.core/schema/watchExpressionDelegates.exsd
+++ b/org.eclipse.debug.core/schema/watchExpressionDelegates.exsd
@@ -1,123 +1,123 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.debug.core" id="watchExpressionDelegates" name="Watch Expression Delegates"/>
- </appInfo>
- <documentation>
- This extension provides a mechanism for providing delegates to evaluate watch expressions on a per debug model basis. Watch expression delegates perform evaluations for watch expressions and report the results asynchronously.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="watchExpressionDelegate" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="watchExpressionDelegate">
- <complexType>
- <attribute name="debugModel" type="string" use="required">
- <annotation>
- <documentation>
- specifies the id of the debug model that this delegate provides evaluations for
- </documentation>
- </annotation>
- </attribute>
- <attribute name="delegateClass" type="string" use="required">
- <annotation>
- <documentation>
- specifies a Java class which implements &lt;code&gt;org.eclipse.debug.core.model.IWatchExpressionDelegate&lt;/code&gt;, which is used to evaluate the value of an expression.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.IWatchExpressionDelegate"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- &lt;pre&gt;
-The following is the definition of a watch expression delegate for the com.example.foo plug-in:
- &lt;extension point=&quot;org.eclipse.debug.core.watchExpressionDelegates&quot;&gt;
- &lt;watchExpressionDelegate
- debugModel=&quot;org.eclipse.jdt.debug&quot;
- delegateClass=&quot;org.eclipse.jdt.internal.debug.ui.JavaWatchExpressionDelegate&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;delegateClass&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.IWatchExpressionDelegate&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.core" id="watchExpressionDelegates" name="Watch Expression Delegates"/>
+ </appInfo>
+ <documentation>
+ This extension provides a mechanism for providing delegates to evaluate watch expressions on a per debug model basis. Watch expression delegates perform evaluations for watch expressions and report the results asynchronously.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="watchExpressionDelegate" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="watchExpressionDelegate">
+ <complexType>
+ <attribute name="debugModel" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the id of the debug model that this delegate provides evaluations for
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="delegateClass" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a Java class which implements &lt;code&gt;org.eclipse.debug.core.model.IWatchExpressionDelegate&lt;/code&gt;, which is used to evaluate the value of an expression.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.IWatchExpressionDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;pre&gt;
+The following is the definition of a watch expression delegate for the com.example.foo plug-in:
+ &lt;extension point=&quot;org.eclipse.debug.core.watchExpressionDelegates&quot;&gt;
+ &lt;watchExpressionDelegate
+ debugModel=&quot;org.eclipse.jdt.debug&quot;
+ delegateClass=&quot;org.eclipse.jdt.internal.debug.ui.JavaWatchExpressionDelegate&quot;/&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;delegateClass&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.IWatchExpressionDelegate&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.debug.examples.core/.classpath b/org.eclipse.debug.examples.core/.classpath
index 89e6e3861..53d4bb995 100644
--- a/org.eclipse.debug.examples.core/.classpath
+++ b/org.eclipse.debug.examples.core/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src_ant"/>
diff --git a/org.eclipse.debug.examples.core/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.debug.examples.core/.settings/org.eclipse.core.runtime.prefs
index c522e1f4a..5a0ad22d2 100644
--- a/org.eclipse.debug.examples.core/.settings/org.eclipse.core.runtime.prefs
+++ b/org.eclipse.debug.examples.core/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
index 237d3ce90..d3220e286 100644
--- a/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,12 +135,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
@@ -146,17 +149,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -240,11 +246,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -274,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -298,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -351,6 +364,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -387,9 +402,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -415,8 +433,12 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.examples.core/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.examples.core/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.debug.examples.core/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.debug.examples.core/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
index bc6d3458d..653c87811 100644
--- a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.debug.examples.core;singleton:=true
-Bundle-Version: 1.4.500.qualifier
+Bundle-Version: 1.5.0.qualifier
Bundle-Activator: org.eclipse.debug.examples.core.pda.DebugCorePlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
@@ -19,7 +19,7 @@ Export-Package: org.eclipse.debug.examples.ant.tasks;x-friends:="org.eclipse.deb
org.eclipse.debug.examples.core.pda.protocol;x-friends:="org.eclipse.debug.examples.ui",
org.eclipse.debug.examples.core.pda.sourcelookup;x-friends:="org.eclipse.debug.examples.ui",
org.eclipse.debug.examples.pdavm;x-friends:="org.eclipse.debug.examples.ui"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor
Automatic-Module-Name: org.eclipse.debug.examples.core
diff --git a/org.eclipse.debug.examples.core/pom.xml b/org.eclipse.debug.examples.core/pom.xml
deleted file mode 100644
index 3e909388e..000000000
--- a/org.eclipse.debug.examples.core/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2012, 2017 Eclipse Foundation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Igor Fedorenko - initial implementation
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>eclipse.platform.debug</artifactId>
- <groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
- </parent>
- <groupId>org.eclipse.debug</groupId>
- <artifactId>org.eclipse.debug.examples.core</artifactId>
- <version>1.4.500-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
index 54f1cf8d5..5ea7600b8 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2018 IBM Corporation and others.
+ * Copyright (c) 2008, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -87,7 +87,7 @@ public class MidiLaunch extends Launch implements ISuspendResume {
@Override
public boolean canTerminate() {
- return getSequencer().isOpen();
+ return fSequencer.isOpen();
}
@Override
@@ -100,10 +100,11 @@ public class MidiLaunch extends Launch implements ISuspendResume {
@Override
public void terminate() throws DebugException {
- getSequencer().stop();
- getSequencer().close();
+ fSequencer.stop();
+ fSequencer.close();
fireTerminate();
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[]{new DebugEvent(getSequencer(), DebugEvent.TERMINATE)});
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {
+ new DebugEvent(fSequencer, DebugEvent.TERMINATE) });
}
@Override
@@ -129,16 +130,16 @@ public class MidiLaunch extends Launch implements ISuspendResume {
@Override
public void resume() throws DebugException {
- getSequencer().start();
+ fSequencer.start();
fireChanged();
- fireEvent(new DebugEvent(getSequencer(), DebugEvent.RESUME, DebugEvent.CLIENT_REQUEST));
+ fireEvent(new DebugEvent(fSequencer, DebugEvent.RESUME, DebugEvent.CLIENT_REQUEST));
}
@Override
public void suspend() throws DebugException {
- getSequencer().stop();
+ fSequencer.stop();
fireChanged();
- fireEvent(new DebugEvent(getSequencer(), DebugEvent.SUSPEND, DebugEvent.CLIENT_REQUEST));
+ fireEvent(new DebugEvent(fSequencer, DebugEvent.SUSPEND, DebugEvent.CLIENT_REQUEST));
}
/**
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
index a12de2219..0f810255f 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
@@ -113,6 +113,7 @@ public abstract class SequencerControl {
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
}
+ @SuppressWarnings("resource")
@Override
public boolean equals(Object obj) {
if (obj != null) {
@@ -124,6 +125,7 @@ public abstract class SequencerControl {
return false;
}
+ @SuppressWarnings("resource")
@Override
public int hashCode() {
return getSequencer().hashCode() + getClass().hashCode();
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 c1a21a99b..c7a207b07 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
@@ -19,7 +19,6 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.LineBreakpoint;
import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
@@ -62,16 +61,13 @@ public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListen
* @throws CoreException if unable to create the breakpoint
*/
public PDALineBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$
- setMarker(marker);
- marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
- marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
- marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
- marker.setAttribute(IMarker.MESSAGE, "Line Breakpoint: " + resource.getName() + " [line: " + lineNumber + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ IWorkspaceRunnable runnable = monitor -> {
+ IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$
+ setMarker(marker);
+ marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
+ marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
+ marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
+ marker.setAttribute(IMarker.MESSAGE, "Line Breakpoint: " + resource.getName() + " [line: " + lineNumber + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
run(getMarkerRule(resource), runnable);
}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java
index 55eb369ba..e9629042a 100644
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java
+++ b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java
@@ -18,8 +18,6 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IBreakpoint;
@@ -38,18 +36,15 @@ public class PDARunToLineBreakpoint extends PDALineBreakpoint {
* @exception DebugException if unable to create the breakpoint
*/
public PDARunToLineBreakpoint(final IFile resource, final int lineNumber) throws DebugException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- // associate with workspace root to avoid drawing in editor ruler
- IMarker marker = ResourcesPlugin.getWorkspace().getRoot().createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$
- setMarker(marker);
- marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
- marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
- marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
- setRegistered(false);
- fSourceFile = resource;
- }
+ IWorkspaceRunnable runnable = monitor -> {
+ // associate with workspace root to avoid drawing in editor ruler
+ IMarker marker = ResourcesPlugin.getWorkspace().getRoot().createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"); //$NON-NLS-1$
+ setMarker(marker);
+ marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
+ marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
+ marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
+ setRegistered(false);
+ fSourceFile = resource;
};
run(getMarkerRule(resource), runnable);
}
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 9685b6f6e..912d83454 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
@@ -91,13 +91,13 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
private boolean fTerminated = false;
// threads
- private Map<Integer, PDAThread> fThreads = Collections.synchronizedMap(new LinkedHashMap<Integer, PDAThread>());
+ private Map<Integer, PDAThread> fThreads = Collections.synchronizedMap(new LinkedHashMap<>());
// event dispatch job
private EventDispatchJob fEventDispatch;
// event listeners
- private List<IPDAEventListener> fEventListeners = Collections.synchronizedList(new ArrayList<IPDAEventListener>());
+ private List<IPDAEventListener> fEventListeners = Collections.synchronizedList(new ArrayList<>());
/**
* Listens to events from the PDA VM and fires corresponding
@@ -126,9 +126,8 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
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);
+ for (Object listener : fEventListeners.toArray()) {
+ ((IPDAEventListener)listener).handleEvent(event);
}
}
} catch (IOException e) {
@@ -392,9 +391,8 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
* manager.
*/
private void installDeferredBreakpoints() {
- IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getModelIdentifier());
- for (int i = 0; i < breakpoints.length; i++) {
- breakpointAdded(breakpoints[i]);
+ for (IBreakpoint breakpoint : getBreakpointManager().getBreakpoints(getModelIdentifier())) {
+ breakpointAdded(breakpoint);
}
}
@@ -489,12 +487,11 @@ public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBr
*/
@Override
public void breakpointManagerEnablementChanged(boolean enabled) {
- IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getModelIdentifier());
- for (int i = 0; i < breakpoints.length; i++) {
+ for (IBreakpoint breakpoint : getBreakpointManager().getBreakpoints(getModelIdentifier())) {
if (enabled) {
- breakpointAdded(breakpoints[i]);
+ breakpointAdded(breakpoint);
} else {
- breakpointRemoved(breakpoints[i], null);
+ breakpointRemoved(breakpoint, null);
}
}
}
diff --git a/org.eclipse.debug.examples.memory/.classpath b/org.eclipse.debug.examples.memory/.classpath
index eca7bdba8..e801ebfb4 100644
--- a/org.eclipse.debug.examples.memory/.classpath
+++ b/org.eclipse.debug.examples.memory/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.debug.examples.memory/.project b/org.eclipse.debug.examples.memory/.project
index f33707338..295a16f35 100644
--- a/org.eclipse.debug.examples.memory/.project
+++ b/org.eclipse.debug.examples.memory/.project
@@ -20,15 +20,9 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
diff --git a/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs
index fb248dec4..d3220e286 100644
--- a/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.memory/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,11 +135,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
@@ -145,17 +149,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -239,11 +246,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -273,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -297,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -350,6 +364,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -386,9 +402,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -414,8 +433,12 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.examples.memory/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.memory/META-INF/MANIFEST.MF
index 32532e0e3..8b33f4f91 100644
--- a/org.eclipse.debug.examples.memory/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.memory/META-INF/MANIFEST.MF
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.debug.examples.memory;singleton:=true
-Bundle-Version: 1.102.200.qualifier
-Bundle-ClassPath: bin/
+Bundle-Version: 1.103.0.qualifier
+Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.examples.internal.memory.MemoryViewSamplePlugin
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
@@ -19,5 +19,5 @@ Require-Bundle: org.eclipse.core.expressions,
org.eclipse.core.resources,
org.eclipse.jface.text
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.eclipse.debug.examples.memory
diff --git a/org.eclipse.debug.examples.memory/build.properties b/org.eclipse.debug.examples.memory/build.properties
index 547e6eced..97953d662 100644
--- a/org.eclipse.debug.examples.memory/build.properties
+++ b/org.eclipse.debug.examples.memory/build.properties
@@ -16,7 +16,7 @@ bin.includes = .classpath,\
build.properties,\
icons/,\
plugin.xml,\
- bin/,\
+ .,\
META-INF/,\
plugin.properties
output.. = bin/
diff --git a/org.eclipse.debug.examples.memory/pom.xml b/org.eclipse.debug.examples.memory/pom.xml
index 55989fac1..1d5d60005 100644
--- a/org.eclipse.debug.examples.memory/pom.xml
+++ b/org.eclipse.debug.examples.memory/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.debug</artifactId>
<groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.debug</groupId>
<artifactId>org.eclipse.debug.examples.memory</artifactId>
- <version>1.102.200-SNAPSHOT</version>
+ <version>1.103.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<skipAPIAnalysis>true</skipAPIAnalysis>
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java
index eca5fbf46..de6a8e67d 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java
@@ -170,9 +170,9 @@ public class SampleEngine {
MemoryByte[] bytes = unit.getBytes();
- for (int i = 0; i < bytes.length; i++) {
- bytes[i].setChanged(false);
- bytes[i].setHistoryKnown(true);
+ for (MemoryByte b : bytes) {
+ b.setChanged(false);
+ b.setHistoryKnown(true);
}
unit.setBytes(bytes);
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleModelPresentation.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleModelPresentation.java
index 4be98a329..04258b62a 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleModelPresentation.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleModelPresentation.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.MemoryByte;
-import org.eclipse.debug.examples.internal.memory.MemoryViewSamplePlugin;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.debug.ui.memory.MemoryRenderingElement;
@@ -29,6 +28,7 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
/**
@@ -47,7 +47,7 @@ public class SampleModelPresentation implements IDebugModelPresentation, IColorP
UIJob job = new UIJob("get colors") { //$NON-NLS-1$
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- Display display = MemoryViewSamplePlugin.getDefault().getWorkbench().getDisplay();
+ Display display = PlatformUI.getWorkbench().getDisplay();
blue = display.getSystemColor(SWT.COLOR_BLUE);
return Status.OK_STATUS;
}
diff --git a/org.eclipse.debug.examples.mixedmode/.classpath b/org.eclipse.debug.examples.mixedmode/.classpath
index eca7bdba8..e801ebfb4 100755
--- a/org.eclipse.debug.examples.mixedmode/.classpath
+++ b/org.eclipse.debug.examples.mixedmode/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.debug.examples.mixedmode/.project b/org.eclipse.debug.examples.mixedmode/.project
index a32ac4eca..11ac20e32 100755
--- a/org.eclipse.debug.examples.mixedmode/.project
+++ b/org.eclipse.debug.examples.mixedmode/.project
@@ -23,15 +23,9 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
diff --git a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.core.runtime.prefs
index c522e1f4a..5a0ad22d2 100644
--- a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.core.runtime.prefs
+++ b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs
index fb248dec4..d3220e286 100644
--- a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,11 +135,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
@@ -145,17 +149,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -239,11 +246,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -273,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -297,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -350,6 +364,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -386,9 +402,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -414,8 +433,12 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.debug.examples.mixedmode/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.examples.mixedmode/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.mixedmode/META-INF/MANIFEST.MF
index 39ebef3dd..920308969 100755
--- a/org.eclipse.debug.examples.mixedmode/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.mixedmode/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.debug.examples.mixedmode;singleton:=true
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.3.0.qualifier
Bundle-Activator: org.eclipse.debug.internal.examples.mixedmode.Activator
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui,
@@ -12,5 +12,5 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.workbench.texteditor
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.debug.internal.examples.mixedmode;x-internal:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.eclipse.debug.examples.mixedmode
diff --git a/org.eclipse.debug.examples.mixedmode/pom.xml b/org.eclipse.debug.examples.mixedmode/pom.xml
index 4db202fd7..dd8250edc 100644
--- a/org.eclipse.debug.examples.mixedmode/pom.xml
+++ b/org.eclipse.debug.examples.mixedmode/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.debug</artifactId>
<groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.debug</groupId>
<artifactId>org.eclipse.debug.examples.mixedmode</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<skipAPIAnalysis>true</skipAPIAnalysis>
diff --git a/org.eclipse.debug.examples.mixedmode/src/org/eclipse/debug/internal/examples/mixedmode/ClearPreferredDelegatesHandler.java b/org.eclipse.debug.examples.mixedmode/src/org/eclipse/debug/internal/examples/mixedmode/ClearPreferredDelegatesHandler.java
index 5d6ac3b98..a41543482 100644
--- a/org.eclipse.debug.examples.mixedmode/src/org/eclipse/debug/internal/examples/mixedmode/ClearPreferredDelegatesHandler.java
+++ b/org.eclipse.debug.examples.mixedmode/src/org/eclipse/debug/internal/examples/mixedmode/ClearPreferredDelegatesHandler.java
@@ -35,12 +35,12 @@ public class ClearPreferredDelegatesHandler extends AbstractHandler {
ILaunchConfigurationType[] types = lm.getLaunchConfigurationTypes();
Set<Set<String>> modes = null;
Set<String> mode = null;
- for (int i = 0; i < types.length; i++) {
- modes = types[i].getSupportedModeCombinations();
+ for (ILaunchConfigurationType type : types) {
+ modes = type.getSupportedModeCombinations();
for (Iterator<Set<String>> iter = modes.iterator(); iter.hasNext();) {
mode = iter.next();
try {
- types[i].setPreferredDelegate(mode, null);
+ type.setPreferredDelegate(mode, null);
} catch (CoreException ce) {
// /do nothing
}
diff --git a/org.eclipse.debug.examples.ui/.classpath b/org.eclipse.debug.examples.ui/.classpath
index eca7bdba8..e801ebfb4 100644
--- a/org.eclipse.debug.examples.ui/.classpath
+++ b/org.eclipse.debug.examples.ui/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.debug.examples.ui/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.debug.examples.ui/.settings/org.eclipse.core.runtime.prefs
index c522e1f4a..5a0ad22d2 100644
--- a/org.eclipse.debug.examples.ui/.settings/org.eclipse.core.runtime.prefs
+++ b/org.eclipse.debug.examples.ui/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs
index fb248dec4..d3220e286 100644
--- a/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.examples.ui/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,11 +135,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
@@ -145,17 +149,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -239,11 +246,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -273,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -297,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -350,6 +364,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -386,9 +402,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -414,8 +433,12 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.examples.ui/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.examples.ui/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.debug.examples.ui/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.debug.examples.ui/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
index a66e1b983..47d40d8f4 100644
--- a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.debug.examples.ui;singleton:=true
-Bundle-Version: 1.6.200.qualifier
+Bundle-Version: 1.7.100.qualifier
Bundle-Activator: org.eclipse.debug.examples.ui.pda.DebugUIPlugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
org.eclipse.core.resources,
@@ -26,7 +26,8 @@ Export-Package: org.eclipse.debug.examples.ui.midi.adapters;x-internal:=true,
org.eclipse.debug.examples.ui.pda.launcher;x-internal:=true,
org.eclipse.debug.examples.ui.pda.presentation;x-internal:=true,
org.eclipse.debug.examples.ui.pda.views;x-internal:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor
+Bundle-ClassPath: .
Automatic-Module-Name: org.eclipse.debug.examples.ui
diff --git a/org.eclipse.debug.examples.ui/build.properties b/org.eclipse.debug.examples.ui/build.properties
index cccc56d18..2cd51cbe8 100644
--- a/org.eclipse.debug.examples.ui/build.properties
+++ b/org.eclipse.debug.examples.ui/build.properties
@@ -14,7 +14,6 @@
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
- bin/,\
about.html,\
META-INF/,\
.,\
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java
index fcf283156..f19183a1c 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerControlsModelProxy.java
@@ -72,6 +72,7 @@ public class SequencerControlsModelProxy extends EventHandlerModelProxy {
return new DebugEventHandler[]{fHandler};
}
+ @SuppressWarnings("resource")
@Override
protected boolean containsEvent(DebugEvent event) {
if (event.getSource() instanceof SequencerControl) {
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java
index 521edaf02..fde0493d5 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/launcher/MidiLaunchShortcut.java
@@ -71,8 +71,7 @@ public class MidiLaunchShortcut implements ILaunchShortcut {
List<ILaunchConfiguration> candiates = new ArrayList<>();
try {
ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(getLaunchType());
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration configuration = configurations[i];
+ for (ILaunchConfiguration configuration : configurations) {
IResource[] resources = configuration.getMappedResources();
if (resources != null && resources.length == 1 &&
resources[0].equals(file)) {
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 66d18e20a..54db02c0d 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
@@ -32,6 +32,7 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -213,7 +214,7 @@ public class DebugUIPlugin extends AbstractUIPlugin {
* @return the active workbench window
*/
public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
/**
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 3e002de85..37d115b47 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
@@ -67,7 +67,7 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
private final TreeModelViewer fClientViewer;
- protected class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
+ protected static class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
private boolean fViewerUpdatesComplete = false;
private boolean fLabelUpdatesComplete = false;
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 0fe58af12..489f4772a 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
@@ -54,11 +54,9 @@ public class PDAToggleWatchpointsTarget extends PDABreakpointAdapter {
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;
- }
+ } else if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ return ss.getFirstElement() instanceof PDAVariable;
}
return false;
}
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 aa586afe5..4de0f7c77 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
@@ -39,7 +39,7 @@ public class PDAScanner extends BufferedRuleBasedScanner {
/**
* Detects potential keywords
*/
- class PDAWordDetector implements IWordDetector {
+ static class PDAWordDetector implements IWordDetector {
@Override
public boolean isWordStart(char c) {
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java
index 9434e1a6b..61614a587 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java
@@ -178,10 +178,8 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
if (member == null) {
setErrorMessage("Specified program does not exist"); //$NON-NLS-1$
return false;
- } else {
- if (member.getType() != IResource.FILE) {
- setWarningMessage("Specified program is not a file."); //$NON-NLS-1$
- }
+ } else if (member.getType() != IResource.FILE) {
+ setWarningMessage("Specified program is not a file."); //$NON-NLS-1$
}
} else {
setMessage("Specify a program"); //$NON-NLS-1$
diff --git a/org.eclipse.debug.tests/.classpath b/org.eclipse.debug.tests/.classpath
index eca7bdba8..4a00becd8 100644
--- a/org.eclipse.debug.tests/.classpath
+++ b/org.eclipse.debug.tests/.classpath
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
index 4cdc29f3e..c15cc50fd 100644
--- a/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -133,7 +133,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
diff --git a/org.eclipse.debug.tests/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.tests/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.debug.tests/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.debug.tests/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.tests/META-INF/MANIFEST.MF b/org.eclipse.debug.tests/META-INF/MANIFEST.MF
index 180427110..1dffc2bae 100644
--- a/org.eclipse.debug.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.tests;singleton:=true
-Bundle-Version: 3.11.400.qualifier
+Bundle-Version: 3.12.700.qualifier
Bundle-Activator: org.eclipse.debug.tests.TestsPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
@@ -15,18 +15,21 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)",
org.eclipse.ui.externaltools;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.7.0,4.0.0)",
- org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)"
+ org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.ui.workbench.texteditor;bundle-version="[3.15.100,4.0.0)"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: %providerName
Export-Package: org.eclipse.debug.tests,
org.eclipse.debug.tests.breakpoint,
org.eclipse.debug.tests.console,
org.eclipse.debug.tests.expressions,
org.eclipse.debug.tests.launching,
+ org.eclipse.debug.tests.logicalstructure,
org.eclipse.debug.tests.sourcelookup,
org.eclipse.debug.tests.statushandlers,
org.eclipse.debug.tests.stepfilters,
+ org.eclipse.debug.tests.ui,
org.eclipse.debug.tests.view.memory,
org.eclipse.debug.tests.viewer.model
Eclipse-BundleShape: dir
diff --git a/org.eclipse.debug.tests/Platform Debug Test Suite.launch b/org.eclipse.debug.tests/Platform Debug Test Suite.launch
index 4372b9637..f0d9ba813 100644
--- a/org.eclipse.debug.tests/Platform Debug Test Suite.launch
+++ b/org.eclipse.debug.tests/Platform Debug Test Suite.launch
@@ -1,41 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
-<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="askclear" value="false"/>
-<booleanAttribute key="automaticAdd" value="true"/>
-<booleanAttribute key="automaticValidate" value="false"/>
-<stringAttribute key="bootstrap" value=""/>
-<stringAttribute key="checked" value="[NONE]"/>
-<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
-<booleanAttribute key="clearwslog" value="false"/>
-<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
-<booleanAttribute key="default" value="true"/>
-<booleanAttribute key="includeOptional" value="true"/>
-<stringAttribute key="location" value="${workspace_loc}/../debug-junit-workspace"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.debug.tests.AutomatedSuite"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.debug.tests"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx384m"/>
-<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
-<booleanAttribute key="run_in_ui_thread" value="true"/>
-<booleanAttribute key="show_selected_only" value="false"/>
-<booleanAttribute key="tracing" value="false"/>
-<booleanAttribute key="useCustomFeatures" value="false"/>
-<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="false"/>
-<booleanAttribute key="useProduct" value="true"/>
+ <booleanAttribute key="append.args" value="true"/>
+ <booleanAttribute key="askclear" value="false"/>
+ <booleanAttribute key="automaticAdd" value="true"/>
+ <booleanAttribute key="automaticValidate" value="false"/>
+ <stringAttribute key="bootstrap" value=""/>
+ <stringAttribute key="checked" value="[NONE]"/>
+ <booleanAttribute key="clearConfig" value="true"/>
+ <booleanAttribute key="clearws" value="true"/>
+ <booleanAttribute key="clearwslog" value="false"/>
+ <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+ <booleanAttribute key="default" value="true"/>
+ <booleanAttribute key="includeOptional" value="true"/>
+ <stringAttribute key="location" value="${workspace_loc}/../debug-junit-workspace"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+ <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+ <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+ <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.debug.tests.AutomatedSuite"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.debug.tests"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx384m"/>
+ <stringAttribute key="pde.version" value="3.3"/>
+ <stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+ <booleanAttribute key="run_in_ui_thread" value="true"/>
+ <booleanAttribute key="show_selected_only" value="false"/>
+ <booleanAttribute key="tracing" value="false"/>
+ <booleanAttribute key="useCustomFeatures" value="false"/>
+ <booleanAttribute key="useDefaultConfig" value="true"/>
+ <booleanAttribute key="useDefaultConfigArea" value="false"/>
+ <booleanAttribute key="useProduct" value="true"/>
</launchConfiguration>
diff --git a/org.eclipse.debug.tests/plugin.properties b/org.eclipse.debug.tests/plugin.properties
index 2643d02af..56ca2e3b1 100755
--- a/org.eclipse.debug.tests/plugin.properties
+++ b/org.eclipse.debug.tests/plugin.properties
@@ -20,4 +20,6 @@ renderingType.name.0 = Rendering Two
renderingType.name.1 = Rendering Default
launchConfigurationType.name = Test Launch Type
extension.name = Debug File System
-launchConfigurationType.name.0 = Cancelling Launch Type \ No newline at end of file
+launchConfigurationType.name.0 = Cancelling Launch Type
+launchConfigurationType.name.1 = Throwing Launch Type
+testBreakpoint.name = Test Breakpoint \ No newline at end of file
diff --git a/org.eclipse.debug.tests/plugin.xml b/org.eclipse.debug.tests/plugin.xml
index b697fbdca..3738652a0 100644
--- a/org.eclipse.debug.tests/plugin.xml
+++ b/org.eclipse.debug.tests/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
- Copyright (c) 2009 IBM Corporation and others.
+ Copyright (c) 2009, 2020 IBM Corporation and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
@@ -31,7 +31,7 @@
id="rendering_type_3"
name="%renderingType.name.1"
class="org.eclipse.debug.tests.view.memory.RenderingTypeDelegate">
- </renderingType>
+ </renderingType>
<renderingBindings
primaryId="rendering_type_1">
<enablement>
@@ -55,7 +55,7 @@
<enablement>
<instanceof value="org.eclipse.debug.tests.view.memory.MemoryBlockDynamic"/>
</enablement>
- </renderingBindings>
+ </renderingBindings>
</extension>
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
@@ -71,6 +71,12 @@
modes="run"
name="%launchConfigurationType.name.0">
</launchConfigurationType>
+ <launchConfigurationType
+ delegate="org.eclipse.debug.tests.launching.ThrowingLaunchDelegate"
+ id="throwing.type"
+ modes="run"
+ name="%launchConfigurationType.name.1">
+ </launchConfigurationType>
</extension>
<extension
id="debugFS"
@@ -111,5 +117,50 @@
class="org.eclipse.debug.tests.stepfilters.TestStepFilter"
modelIdentifier="com.example.debug.model">
</stepFilter>
- </extension>
+ </extension>
+ <extension point="org.eclipse.debug.core.breakpoints">
+ <breakpoint
+ id="org.eclipse.debug.tests.testBreakpoint"
+ class="org.eclipse.debug.tests.breakpoint.TestBreakpoint"
+ markerType="org.eclipse.debug.core.breakpointMarker">
+ </breakpoint>
+ </extension>
+ <extension
+ id="org.eclipse.debug.tests.testBreakpointMarker"
+ name="%testBreakpoint.name"
+ point="org.eclipse.core.resources.markers">
+ <super
+ type="org.eclipse.debug.core.breakpointMarker">
+ </super>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.debugModelPresentations">
+ <debugModelPresentation
+ class="org.eclipse.debug.tests.viewer.model.DebugTestModelPresentation"
+ id="org.eclipse.debug.tests">
+ </debugModelPresentation>
+ </extension>
+ <extension
+ point="org.eclipse.debug.core.logicalStructureTypes">
+ <logicalStructureType
+ class="org.eclipse.debug.tests.logicalstructure.TestLogicalStructureTypeDelegate"
+ id="org.eclipse.debug.tests.logicalStructureType1"
+ modelIdentifier="org.eclipse.debug.tests">
+ </logicalStructureType>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.variableValueEditors">
+ <variableValueEditor
+ modelId="testModel"
+ priority="x"
+ class="org.eclipse.debug.tests.ui.TestVariableValueEditor1"/>
+ <variableValueEditor
+ modelId="testModel"
+ priority="10"
+ class="org.eclipse.debug.tests.ui.TestVariableValueEditor2"/>
+ <variableValueEditor
+ modelId="testModel"
+ priority="-1"
+ class="org.eclipse.debug.tests.ui.TestVariableValueEditor3"/>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.tests/pom.xml b/org.eclipse.debug.tests/pom.xml
index 37b4110ce..c55bdbc41 100644
--- a/org.eclipse.debug.tests/pom.xml
+++ b/org.eclipse.debug.tests/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2019 Eclipse Foundation and others.
+ Copyright (c) 2012, 2021 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.platform.debug</artifactId>
<groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.debug</groupId>
<artifactId>org.eclipse.debug.tests</artifactId>
- <version>3.11.400-SNAPSHOT</version>
+ <version>3.12.700-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AbstractDebugTest.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AbstractDebugTest.java
index 66719dbbc..8110b2464 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AbstractDebugTest.java
@@ -14,10 +14,13 @@
package org.eclipse.debug.tests;
import java.util.function.Function;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceMemento;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
@@ -25,10 +28,12 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.intro.IIntroManager;
import org.eclipse.ui.intro.IIntroPart;
import org.eclipse.ui.progress.UIJob;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
-import junit.framework.TestCase;
-
-public class AbstractDebugTest extends TestCase {
+public class AbstractDebugTest {
private static boolean welcomeClosed;
@@ -37,26 +42,26 @@ public class AbstractDebugTest extends TestCase {
*/
protected long testTimeout = 30000;
- public AbstractDebugTest() {
- super();
- }
+ /**
+ * Preference helper to restore changed preference values after test run.
+ */
+ private final PreferenceMemento prefMemento = new PreferenceMemento();
+
+ @Rule
+ public TestName name = new TestName();
- public AbstractDebugTest(String name) {
- super(name);
- }
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- TestUtil.log(IStatus.INFO, getName(), "setUp");
+ @Before
+ public void setUp() throws Exception {
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "setUp");
assertWelcomeScreenClosed();
}
- @Override
- protected void tearDown() throws Exception {
- TestUtil.log(IStatus.INFO, getName(), "tearDown");
- TestUtil.cleanUp(getName());
- super.tearDown();
+ @After
+ public void tearDown() throws Exception {
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "tearDown");
+ TestUtil.cleanUp(name.getMethodName());
+ prefMemento.resetPreferences();
}
/**
@@ -137,4 +142,28 @@ public class AbstractDebugTest extends TestCase {
}
}
}
+
+ /**
+ * Change a preference value for this test run. The preference will be reset
+ * to its value before test started automatically on {@link #tearDown()}.
+ *
+ * @param <T> preference value type. The type must have a corresponding
+ * {@link IPreferenceStore} setter.
+ * @param store preference store to manipulate (must not be
+ * <code>null</code>)
+ * @param name preference to change
+ * @param value new preference value
+ * @throws IllegalArgumentException when setting a type which is not
+ * supported by {@link IPreferenceStore}
+ *
+ * @see IPreferenceStore#setValue(String, double)
+ * @see IPreferenceStore#setValue(String, float)
+ * @see IPreferenceStore#setValue(String, int)
+ * @see IPreferenceStore#setValue(String, long)
+ * @see IPreferenceStore#setValue(String, boolean)
+ * @see IPreferenceStore#setValue(String, String)
+ */
+ protected <T> void setPreference(IPreferenceStore store, String name, T value) {
+ prefMemento.setValue(store, name, value);
+ }
}
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 317599be1..be2dc6124 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2019 IBM Corporation and others.
+ * Copyright (c) 2009, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,13 +16,21 @@
package org.eclipse.debug.tests;
import org.eclipse.debug.tests.breakpoint.BreakpointOrderingTests;
+import org.eclipse.debug.tests.breakpoint.BreakpointTests;
+import org.eclipse.debug.tests.breakpoint.SerialExecutorTest;
import org.eclipse.debug.tests.console.ConsoleDocumentAdapterTests;
import org.eclipse.debug.tests.console.ConsoleManagerTests;
import org.eclipse.debug.tests.console.ConsoleTests;
+import org.eclipse.debug.tests.console.FileLinkTests;
+import org.eclipse.debug.tests.console.IOConsoleFixedWidthTests;
import org.eclipse.debug.tests.console.IOConsoleTests;
+import org.eclipse.debug.tests.console.InputStreamMonitorTests;
+import org.eclipse.debug.tests.console.OutputStreamMonitorTests;
import org.eclipse.debug.tests.console.ProcessConsoleManagerTests;
import org.eclipse.debug.tests.console.ProcessConsoleTests;
+import org.eclipse.debug.tests.console.RuntimeProcessTests;
import org.eclipse.debug.tests.console.StreamsProxyTests;
+import org.eclipse.debug.tests.console.TextConsoleViewerTest;
import org.eclipse.debug.tests.launching.AcceleratorSubstitutionTests;
import org.eclipse.debug.tests.launching.ArgumentParsingTests;
import org.eclipse.debug.tests.launching.LaunchConfigurationTests;
@@ -32,10 +40,13 @@ import org.eclipse.debug.tests.launching.LaunchHistoryTests;
import org.eclipse.debug.tests.launching.LaunchManagerTests;
import org.eclipse.debug.tests.launching.LaunchTests;
import org.eclipse.debug.tests.launching.RefreshTabTests;
+import org.eclipse.debug.tests.logicalstructure.LogicalStructureCacheTest;
import org.eclipse.debug.tests.sourcelookup.SourceLookupFacilityTests;
import org.eclipse.debug.tests.statushandlers.StatusHandlerTests;
import org.eclipse.debug.tests.stepfilters.StepFiltersTests;
+import org.eclipse.debug.tests.ui.VariableValueEditorManagerTests;
import org.eclipse.debug.tests.view.memory.MemoryRenderingTests;
+import org.eclipse.debug.tests.view.memory.TableRenderingTests;
import org.eclipse.debug.tests.viewer.model.ChildrenUpdateTests;
import org.eclipse.debug.tests.viewer.model.FilterTransformTests;
import org.eclipse.debug.tests.viewer.model.PresentationContextTests;
@@ -46,81 +57,81 @@ import org.eclipse.debug.tests.viewer.model.VirtualViewerLazyModeTests;
import org.eclipse.debug.tests.viewer.model.VirtualViewerSelectionTests;
import org.eclipse.debug.tests.viewer.model.VirtualViewerStateTests;
import org.eclipse.debug.tests.viewer.model.VirtualViewerUpdateTests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* Tests for integration and nightly builds.
*
* @since 3.6
*/
-public class AutomatedSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to use the JUnit Launcher.
- *
- * @return the test suite
- */
- public static Test suite() {
- return new AutomatedSuite();
- }
-
- /**
- * Constructs the automated test suite. Adds all tests.
- */
- public AutomatedSuite() {
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
// Source lookup tests
- addTest(new TestSuite(SourceLookupFacilityTests.class));
+ SourceLookupFacilityTests.class,
// BP tests
- addTest(new TestSuite(BreakpointOrderingTests.class));
+ BreakpointOrderingTests.class,
+ BreakpointTests.class,
+ SerialExecutorTest.class,
// 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(VirtualViewerLazyModeTests.class));
- addTest(new TestSuite(VirtualViewerSelectionTests.class));
- addTest(new TestSuite(VirtualViewerStateTests.class));
- addTest(new TestSuite(VirtualViewerUpdateTests.class));
- addTest(new TestSuite(VirtualViewerFilterTests.class));
+ VirtualViewerDeltaTests.class,
+ VirtualViewerContentTests.class,
+ VirtualViewerLazyModeTests.class,
+ VirtualViewerSelectionTests.class,
+ VirtualViewerStateTests.class,
+ VirtualViewerUpdateTests.class,
+ VirtualViewerFilterTests.class,
// Viewer neutral tests
- addTest(new TestSuite(FilterTransformTests.class));
- addTest(new TestSuite(ChildrenUpdateTests.class));
- addTest(new TestSuite(PresentationContextTests.class));
+ FilterTransformTests.class,
+ ChildrenUpdateTests.class,
+ PresentationContextTests.class,
+ VariableValueEditorManagerTests.class,
// Memory view
- addTest(new TestSuite(MemoryRenderingTests.class));
+ MemoryRenderingTests.class,
+ TableRenderingTests.class,
// Launch framework
- addTest(new TestSuite(LaunchConfigurationTests.class));
- addTest(new TestSuite(AcceleratorSubstitutionTests.class));
- addTest(new TestSuite(LaunchHistoryTests.class));
- addTest(new TestSuite(LaunchFavoriteTests.class));
- addTest(new TestSuite(LaunchManagerTests.class));
- addTest(new TestSuite(RefreshTabTests.class));
- addTest(new TestSuite(ArgumentParsingTests.class));
- addTest(new TestSuite(LaunchTests.class));
+ LaunchConfigurationTests.class,
+ AcceleratorSubstitutionTests.class,
+ LaunchHistoryTests.class,
+ LaunchFavoriteTests.class,
+ LaunchManagerTests.class,
+ RefreshTabTests.class,
+ ArgumentParsingTests.class,
+ LaunchTests.class,
// Status handlers
- addTest(new TestSuite(StatusHandlerTests.class));
+ StatusHandlerTests.class,
// Step filters
- addTest(new TestSuite(StepFiltersTests.class));
+ StepFiltersTests.class,
// Console view
- addTest(new TestSuite(ConsoleDocumentAdapterTests.class));
- addTest(new TestSuite(ConsoleManagerTests.class));
- addTest(new TestSuite(ConsoleTests.class));
- addTest(new TestSuite(IOConsoleTests.class));
- addTest(new TestSuite(ProcessConsoleManagerTests.class));
- addTest(new TestSuite(ProcessConsoleTests.class));
- addTest(new TestSuite(StreamsProxyTests.class));
+ ConsoleDocumentAdapterTests.class,
+ ConsoleManagerTests.class,
+ ConsoleTests.class,
+ IOConsoleTests.class,
+ IOConsoleFixedWidthTests.class,
+ ProcessConsoleManagerTests.class,
+ ProcessConsoleTests.class,
+ StreamsProxyTests.class,
+ TextConsoleViewerTest.class,
+ RuntimeProcessTests.class,
+ OutputStreamMonitorTests.class,
+ InputStreamMonitorTests.class,
+ FileLinkTests.class,
// Launch Groups
- addTest(new TestSuite(LaunchGroupTests.class));
- }
+ LaunchGroupTests.class,
+
+ // Logical structure
+ LogicalStructureCacheTest.class,
+})
+public class AutomatedSuite {
}
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 58ef4f76a..b9f2c9e83 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
@@ -13,9 +13,6 @@
*******************************************************************************/
package org.eclipse.debug.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.debug.tests.viewer.model.ColumnPresentationTests;
import org.eclipse.debug.tests.viewer.model.JFaceViewerCheckTests;
import org.eclipse.debug.tests.viewer.model.JFaceViewerContentTests;
@@ -26,6 +23,8 @@ import org.eclipse.debug.tests.viewer.model.JFaceViewerSelectionTests;
import org.eclipse.debug.tests.viewer.model.JFaceViewerStateTests;
import org.eclipse.debug.tests.viewer.model.JFaceViewerTopIndexTests;
import org.eclipse.debug.tests.viewer.model.JFaceViewerUpdateTests;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* Tests to run locally. They require a user terminal to execute correctly
@@ -33,31 +32,14 @@ import org.eclipse.debug.tests.viewer.model.JFaceViewerUpdateTests;
*
* @since 3.7
*/
-public class LocalSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to use the JUnit Launcher.
- *
- * @return the test suite
- */
- public static Test suite() {
- return new LocalSuite();
- }
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ JFaceViewerCheckTests.class, JFaceViewerContentTests.class,
+ JFaceViewerDeltaTests.class, JFaceViewerSelectionTests.class,
+ JFaceViewerStateTests.class, JFaceViewerUpdateTests.class,
+ JFaceViewerLazyTests.class, JFaceViewerTopIndexTests.class,
+ JFaceViewerFilterTests.class, ColumnPresentationTests.class
+})
+public class LocalSuite {
- /**
- * Constructs the automated test suite. Adds all tests.
- */
- public LocalSuite() {
- // JFace viewer tests
- addTest(new TestSuite(JFaceViewerCheckTests.class));
- addTest(new TestSuite(JFaceViewerContentTests.class));
- addTest(new TestSuite(JFaceViewerDeltaTests.class));
- 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));
- }
}
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 4d44939fd..74eee6e9b 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
@@ -13,37 +13,19 @@
*******************************************************************************/
package org.eclipse.debug.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.debug.tests.viewer.model.JFaceViewerPerformanceTests;
import org.eclipse.debug.tests.viewer.model.VirtualViewerPerformanceTests;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* Tests for release builds.
*
* @since 3.6
*/
-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();
- }
-
- /**
- * 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));
- }
-
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ JFaceViewerPerformanceTests.class,
+ VirtualViewerPerformanceTests.class })
+public class PerformanceSuite {
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java
index 3ad0c414e..e7644a8c1 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestUtil.java
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.tests;
+import static org.junit.Assert.fail;
+
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.util.ArrayList;
@@ -22,14 +24,14 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
+import java.util.function.Supplier;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.junit.Assert;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
public class TestUtil {
@@ -108,8 +110,8 @@ public class TestUtil {
* background thread, just waits.
*
* @param <T> type of the context
- * @param context test context
* @param condition function which will be evaluated while waiting
+ * @param context test context
* @param timeout max wait time in milliseconds to wait on given condition
* @param errorMessage message which will be used to construct the failure
* exception in case the condition will still return {@code true}
@@ -129,8 +131,41 @@ public class TestUtil {
}
Boolean stillTrue = condition.apply(context);
if (stillTrue) {
- TestCase.fail(errorMessage.apply(context));
+ fail(errorMessage.apply(context));
+ }
+ }
+
+ /**
+ * A simplified variant of
+ * {@link #waitWhile(Function, Object, long, Function)}.
+ * <p>
+ * Waits while given condition is {@code true} for a given amount of
+ * milliseconds.
+ * <p>
+ * Will process UI events while waiting in UI thread, if called from
+ * background thread, just waits.
+ *
+ * @param condition function which will be evaluated while waiting
+ * @param timeout max wait time in milliseconds to wait on given condition
+ * @return value of condition when method returned
+ */
+ public static boolean waitWhile(Supplier<Boolean> condition, long timeout) throws Exception {
+ if (condition == null) {
+ condition = () -> true;
+ }
+ long start = System.currentTimeMillis();
+ Display display = Display.getCurrent();
+ while (System.currentTimeMillis() - start < timeout && condition.get()) {
+ Thread.yield();
+ if (display != null && !display.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ Thread.sleep(1);
+ }
+ } else {
+ Thread.sleep(5);
+ }
}
+ return condition.get();
}
/**
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java
index 5d28ab511..91a3d9318 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java
@@ -13,22 +13,18 @@
*******************************************************************************/
package org.eclipse.debug.tests.breakpoint;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.List;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsComparator;
import org.eclipse.debug.tests.AbstractDebugTest;
-import org.eclipse.debug.tests.TestsPlugin;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.jface.viewers.IBaseLabelProvider;
@@ -38,6 +34,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.IEditorInput;
+import org.junit.Test;
/**
* Test the ordering used in the breakpoints view.
@@ -46,114 +43,6 @@ import org.eclipse.ui.IEditorInput;
*/
public class BreakpointOrderingTests extends AbstractDebugTest {
- public BreakpointOrderingTests(String name) {
- super(name);
- }
-
- /**
- * Test only implementation of IBreakpoint.
- */
- static class TestBreakpoint implements IBreakpoint {
-
- private final String fText;
- private IMarker fMarker = null;
-
- TestBreakpoint(String text) {
- this(text, IBreakpoint.BREAKPOINT_MARKER);
- }
-
- TestBreakpoint(String text, final String markerType) {
- fText = text;
- final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-
- @Override
- public void run( IProgressMonitor monitor ) throws CoreException {
- // create the marker
- setMarker(resource.createMarker(markerType));
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( wr, null );
- }
- catch ( CoreException e ) {
- fail("Unexpected exception: " + e); //$NON-NLS-1$
- }
-
- }
-
- void ReportFailure(String msg) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, msg));
- }
-
-
- String getText() {
- return fText;
- }
-
- @Override
- public void delete() throws CoreException {
- fMarker.delete();
- }
-
- @Override
- public IMarker getMarker() {
- return fMarker;
- }
-
- @Override
- public String getModelIdentifier() {
- return "Test"; //$NON-NLS-1$
- }
-
- @Override
- public boolean isEnabled() throws CoreException {
- fail("not implemented in test"); //$NON-NLS-1$
- return false;
- }
-
- @Override
- public boolean isPersisted() throws CoreException {
- fail("not implemented in test"); //$NON-NLS-1$
- return false;
- }
-
- @Override
- public boolean isRegistered() throws CoreException {
- fail("not implemented in test"); //$NON-NLS-1$
- return false;
- }
-
- @Override
- public void setEnabled(boolean enabled) throws CoreException {
- fail("not implemented in test"); //$NON-NLS-1$
- }
-
- @Override
- public void setMarker(IMarker marker) throws CoreException {
- assertTrue(fMarker == null && marker != null);
- fMarker = marker;
- }
-
- @Override
- public void setPersisted(boolean registered) throws CoreException {
- fail("not implemented in test"); //$NON-NLS-1$
- }
-
- @Override
- public void setRegistered(boolean registered) throws CoreException {
- fail("not implemented in test"); //$NON-NLS-1$
-
- }
-
- @Override
- public <T> T getAdapter(Class<T> adapter) {
- fail("not implemented in test"); //$NON-NLS-1$
- return null;
- }
-
- }
-
/**
* Test only implementation of ILineBreakpoint.
*/
@@ -366,15 +255,22 @@ public class BreakpointOrderingTests extends AbstractDebugTest {
return fTestBps;
}
+ @Test
public void testBreakpointOrdering0() throws CoreException {
executeTest(createTestBreakpoints0());
}
+
+ @Test
public void testBreakpointOrdering1() throws CoreException {
executeTest(createTestBreakpoints1());
}
+
+ @Test
public void testBreakpointOrdering2() throws CoreException {
executeTest(createTestBreakpoints2());
}
+
+ @Test
public void testBreakpointOrdering3() throws CoreException {
executeTest(createTestBreakpoints3());
}
@@ -407,8 +303,8 @@ public class BreakpointOrderingTests extends AbstractDebugTest {
}
assertFalse(failed);
} finally {
- for (int index = 0; index < testBps.length; index++) {
- testBps[index].delete();
+ for (TestBreakpoint testBp : testBps) {
+ testBp.delete();
}
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointTests.java
new file mode 100644
index 000000000..39c127bfb
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointTests.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.breakpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.core.BreakpointManager;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.eclipse.debug.tests.TestUtil;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
+
+public class BreakpointTests extends AbstractDebugTest {
+
+ private final IBreakpointManager bpm = DebugPlugin.getDefault().getBreakpointManager();
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ for (IBreakpoint bp : getTestBreakpoints()) {
+ bp.delete();
+ }
+ }
+
+ /**
+ * Get all {@link TestBreakpoint}s known by the default
+ * {@link BreakpointManager}.
+ *
+ * @return {@link TestBreakpoint}s or empty list
+ */
+ private List<TestBreakpoint> getTestBreakpoints() {
+ List<TestBreakpoint> bps = new ArrayList<>();
+ for (IBreakpoint bp : bpm.getBreakpoints(TestBreakpoint.MODEL)) {
+ assertTrue(bp instanceof TestBreakpoint);
+ bps.add((TestBreakpoint) bp);
+ }
+ return bps;
+ }
+
+ /**
+ * Test for bug 424561 where a breakpoint is deleted and the sequence undo
+ * (recreate breakpoint), redo (delete again), undo (recreate breakpoint)
+ * does not recreate the breakpoint.
+ */
+ @Test
+ public void testBug424561_undoRedoUndoGone() throws Exception {
+ boolean viewVisible = true;
+ BreakpointsView view = ((BreakpointsView) DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().findView(IDebugUIConstants.ID_BREAKPOINT_VIEW));
+ if (view == null) {
+ viewVisible = false;
+ view = ((BreakpointsView) DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().showView(IDebugUIConstants.ID_BREAKPOINT_VIEW));
+ }
+ assertNotNull("Failed to obtain breakpoint view.", view);
+
+ try {
+ String content = "Bug 424561";
+ TestBreakpoint bp = new TestBreakpoint(content);
+ IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
+ IUndoContext context = DebugUITools.getBreakpointsUndoContext();
+
+ bpm.addBreakpoint(bp);
+ TestUtil.waitWhile(c -> c.getTestBreakpoints().size() == 0, this, testTimeout, c -> "Breakpoint is not created");
+ assertTrue("Breakpoint marker missing", bp.getMarker().exists());
+ assertTrue("Breakpoint not registered", bp.isRegistered());
+
+ DebugUITools.deleteBreakpoints(new IBreakpoint[] {
+ bp }, null, null);
+ assertTrue(operationHistory.canUndo(context));
+ TestUtil.waitWhile(c -> c.getTestBreakpoints().size() > 0, this, testTimeout, c -> "Breakpoint is not deleted");
+ assertFalse("Breakpoint marker not removed", bp.getMarker().exists());
+ assertFalse("Breakpoint still registered", bp.isRegistered());
+
+ operationHistory.undo(context, null, null);
+ assertTrue(operationHistory.canRedo(context));
+ TestUtil.waitWhile(c -> c.getTestBreakpoints().size() == 0, this, testTimeout, c -> "Breakpoint is not recreated");
+ bp = getTestBreakpoints().get(0);
+ assertEquals("Breakpoint attributes not correctly restored", content, bp.getText());
+ assertTrue("Breakpoint marker missing", bp.getMarker().exists());
+ assertTrue("Breakpoint not registered", bp.isRegistered());
+
+ operationHistory.redo(context, null, null);
+ assertTrue(operationHistory.canUndo(context));
+ TestUtil.waitWhile(c -> c.getTestBreakpoints().size() > 0, this, testTimeout, c -> "Breakpoint is not deleted");
+ assertFalse("Breakpoint marker not removed", bp.getMarker().exists());
+ assertFalse("Breakpoint still registered", bp.isRegistered());
+
+ operationHistory.undo(context, null, null);
+ assertTrue(operationHistory.canRedo(context));
+ TestUtil.waitWhile(c -> c.getTestBreakpoints().size() == 0, this, testTimeout, c -> "Breakpoint is not recreated");
+ bp = getTestBreakpoints().get(0);
+ assertEquals("Breakpoint attributes not correctly restored", content, bp.getText());
+ assertTrue("Breakpoint marker missing", bp.getMarker().exists());
+ assertTrue("Breakpoint not registered", bp.isRegistered());
+
+ final BreakpointsView finalView = view;
+ final TestBreakpoint finalBp = bp;
+ TestUtil.waitWhile(c -> {
+ TreeItem item = (TreeItem) finalView.getTreeModelViewer().testFindItem(finalBp);
+ return item == null || item.getText() == null || !item.getText().contains(content);
+ }, this, testTimeout, c -> "Breakpoint not restored in view");
+ } finally {
+ if (!viewVisible) {
+ DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().hideView(view);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/SerialExecutorTest.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/SerialExecutorTest.java
new file mode 100644
index 000000000..73e63efb5
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/SerialExecutorTest.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Joerg Kubitz and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Joerg Kubitz - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.breakpoint;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.internal.ui.model.elements.SerialExecutor;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@SuppressWarnings("restriction")
+public class SerialExecutorTest extends AbstractDebugTest {
+ @Override
+ public void tearDown() throws Exception {
+ Job.getJobManager().cancel(this);
+ super.tearDown();
+ }
+
+ @Test
+ public void testSimpleExecution() throws InterruptedException {
+ SerialExecutor serialExecutor = new SerialExecutor("test", this);
+ AtomicInteger executions = new AtomicInteger(0);
+ serialExecutor.schedule(() -> executions.incrementAndGet());
+ Job.getJobManager().join(this, null);
+ assertEquals(1, executions.get());
+ serialExecutor.schedule(() -> executions.incrementAndGet());
+ Job.getJobManager().join(this, null);
+ assertEquals(2, executions.get());
+ serialExecutor.schedule(() -> executions.incrementAndGet());
+ serialExecutor.schedule(() -> executions.incrementAndGet());
+ Job.getJobManager().join(this, null);
+ assertEquals(4, executions.get());
+ }
+
+ @Test
+ public void testSerialExecution() throws InterruptedException {
+ SerialExecutor serialExecutor = new SerialExecutor("test", this);
+ AtomicInteger executions = new AtomicInteger(0);
+ AtomicInteger parallelExecutions = new AtomicInteger(0);
+ final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
+ int RUNS = 20;
+ int WAIT_MILLIS = 2;
+ long start = System.nanoTime();
+ for (int i = 0; i < RUNS; i++) {
+ serialExecutor.schedule(() -> {
+ WriteLock writeLock = rwl.writeLock();
+ if (writeLock.tryLock()) {
+ try {
+ Thread.sleep(WAIT_MILLIS);
+ executions.incrementAndGet();
+ } catch (InterruptedException e) {
+ // interrupt should not happen -> fail test
+ parallelExecutions.incrementAndGet();
+ }
+ writeLock.unlock();
+ } else {
+ // another thread already holding the lock
+ // should not happen -> fail test
+ parallelExecutions.incrementAndGet();
+ }
+ Job[] jobs = Job.getJobManager().find(SerialExecutorTest.this);
+ if (jobs.length != 1) {
+ parallelExecutions.incrementAndGet();
+ }
+ });
+ }
+ Job.getJobManager().join(this, null);
+ Job[] jobs = Job.getJobManager().find(this);
+ assertEquals(0, jobs.length);
+ long stop = System.nanoTime();
+ long millis = (stop - start) / 1000_000;
+ assertEquals(RUNS, executions.get());
+ assertEquals(0, parallelExecutions.get());
+ long minimalMillis = RUNS * WAIT_MILLIS;
+ assertTrue("Test did finish too fast (" + millis + " ms)", millis >= minimalMillis);
+ }
+
+ @Test
+ public void testSchedulingQueue() throws InterruptedException {
+ // Executor has to execute every task. Even when they are faster
+ // scheduled then executed
+ SerialExecutor serialExecutor = new SerialExecutor("test", this);
+ AtomicInteger executions = new AtomicInteger();
+ int RUNS = 20;
+ int WAIT_MILLIS = 2;
+ for (int i = 0; i < RUNS; i++) {
+ serialExecutor.schedule(() -> {
+ try {
+ Thread.sleep(WAIT_MILLIS);
+ executions.incrementAndGet();
+ } catch (InterruptedException e) {
+ // error
+ }
+ });
+ }
+ Job.getJobManager().join(this, null);
+ Job[] jobs = Job.getJobManager().find(this);
+ assertEquals(0, jobs.length);
+ assertEquals(RUNS, executions.get());
+ }
+
+ @Test
+ @Ignore("See https://bugs.eclipse.org/bugs/show_bug.cgi?id=574883")
+ public void testHeavyScheduling() throws InterruptedException {
+ // Executor has to execute every task. Even when they are scheduled fast
+ // and execute fast
+ SerialExecutor serialExecutor = new SerialExecutor("test", this);
+ AtomicInteger executions = new AtomicInteger();
+ int RUNS = 200;
+ for (int i = 0; i < RUNS; i++) {
+ serialExecutor.schedule(() -> executions.incrementAndGet());
+ }
+ Job.getJobManager().join(this, null);
+ Job[] jobs = Job.getJobManager().find(this);
+ assertEquals(0, jobs.length);
+ assertEquals(RUNS, executions.get());
+ }
+
+ @Test
+ public void testJoin() throws InterruptedException {
+ // The last scheduled job has to be done before join() returns
+ for (int run = 0; run < 100; run++) {
+ SerialExecutor serialExecutor = new SerialExecutor("test", this);
+ AtomicInteger executions = new AtomicInteger();
+ int RUNS = 20;
+ int WAIT_MILLIS = 1;
+ for (int i = 0; i < RUNS; i++) {
+ serialExecutor.schedule(() -> {
+ try {
+ Thread.sleep(WAIT_MILLIS);
+ executions.incrementAndGet();
+ } catch (InterruptedException e) {
+ // error
+ }
+ });
+ }
+ Job.getJobManager().join(this, null);
+ Job[] jobs = Job.getJobManager().find(this);
+ assertEquals(0, jobs.length);
+ assertEquals("failed on run " + run, RUNS, executions.get());
+ // does fail on run ~ 40 if the final job.join() is removed.
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/TestBreakpoint.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/TestBreakpoint.java
new file mode 100644
index 000000000..2a1cc3289
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/TestBreakpoint.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.breakpoint;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.model.Breakpoint;
+import org.eclipse.debug.core.model.IBreakpoint;
+
+/**
+ * Test only implementation of IBreakpoint.
+ */
+public class TestBreakpoint extends Breakpoint {
+
+ public static final String MODEL = "org.eclipse.debug.tests"; //$NON-NLS-1$
+ public static final String TEXT_ATTRIBUTE = "org.eclipse.debug.tests.breakpoint.TestBreakpoint.text"; //$NON-NLS-1$
+
+ public TestBreakpoint() {
+ super();
+ }
+
+ TestBreakpoint(String text) {
+ this(text, IBreakpoint.BREAKPOINT_MARKER);
+ }
+
+ TestBreakpoint(String text, final String markerType) {
+ final IResource resource = ResourcesPlugin.getWorkspace().getRoot();
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ // create the marker
+ setMarker(resource.createMarker(markerType));
+ ensureMarker().setAttribute(ID, getModelIdentifier());
+ ensureMarker().setAttribute(TEXT_ATTRIBUTE, text);
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run(wr, null);
+ } catch (CoreException e) {
+ fail("Unexpected exception: " + e); //$NON-NLS-1$
+ }
+
+ }
+
+ public String getText() {
+ return getMarker().getAttribute(TEXT_ATTRIBUTE, null);
+ }
+
+ @Override
+ public String getModelIdentifier() {
+ return MODEL;
+ }
+
+ @Override
+ public void setMarker(IMarker marker) throws CoreException {
+ assertTrue(getMarker() == null && marker != null);
+ super.setMarker(marker);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleDocumentAdapterTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleDocumentAdapterTests.java
index 02205f1d6..f2b58e55d 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleDocumentAdapterTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleDocumentAdapterTests.java
@@ -13,6 +13,12 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
@@ -32,6 +38,7 @@ import org.eclipse.swt.custom.TextChangeListener;
import org.eclipse.swt.custom.TextChangedEvent;
import org.eclipse.swt.custom.TextChangingEvent;
import org.eclipse.ui.internal.console.ConsoleDocumentAdapter;
+import org.junit.Test;
/**
* Tests {@link ConsoleDocumentAdapter}.
@@ -42,17 +49,10 @@ import org.eclipse.ui.internal.console.ConsoleDocumentAdapter;
@SuppressWarnings("restriction")
public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
- public ConsoleDocumentAdapterTests() {
- super(ConsoleDocumentAdapterTests.class.getSimpleName());
- }
-
- public ConsoleDocumentAdapterTests(String name) {
- super(name);
- }
-
/**
* Test {@link ConsoleDocumentAdapter#setText(String)}.
*/
+ @Test
public void testSetText() {
final ExpectingTextChangeListener eventListener = new ExpectingTextChangeListener(true, null);
final IDocumentAdapter docAdapter = new ConsoleDocumentAdapter(-1);
@@ -77,6 +77,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
/**
* Test fixed width line wrap. (mostly with changes affecting a single line)
*/
+ @Test
public void testLineWrap() {
final Random rand = new Random(4);
final int wrapWidth = 10;
@@ -199,7 +200,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
// add text starting at fixed width border
addText = "kl";
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, 0, 1));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, docAdapter.getCharCount(), addText, 0, addText.length(), 0, 1));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(docAdapter.getCharCount(), 0, addText);
assertNumberOfLines(docAdapter, 5);
@@ -213,7 +214,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
// insert text starting at fixed width border
addText = ">";
offset = docAdapter.getCharCount() - 2;
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, 1, 1));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, offset, addText, 0, addText.length(), 0, 0));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(offset, 0, addText);
assertNumberOfLines(docAdapter, 5);
@@ -225,7 +226,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
checkLineMapping(docAdapter, rand);
// delete character at fixed width border
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, 1, 1));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, offset, "", 1, 0, 0, 0));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(offset, 1, "");
assertNumberOfLines(docAdapter, 5);
@@ -338,7 +339,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
docAdapter.replaceTextRange(offset, 0, addText);
replaceText = "uvwxyz_-=|";
offset = docAdapter.getCharCount() - 3;
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, 1, 1));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, offset, replaceText, 3, replaceText.length(), 0, 0));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(offset, 3, replaceText);
assertNumberOfLines(docAdapter, 7);
@@ -357,7 +358,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
// remove last wrapped line
offset = docAdapter.getOffsetAtLine(docAdapter.getLineCount() - 1);
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, 1, 0));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, offset, "", 10, 0, 1, 0));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(offset, 10, "");
assertNumberOfLines(docAdapter, 6);
@@ -376,7 +377,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
// remove 5th line including it's real line delimiter
offset = docAdapter.getOffsetAtLine(5 - 1);
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, null, null));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, offset, "", 11, 0, 1, 0));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(offset, 11, "");
assertNumberOfLines(docAdapter, 5);
@@ -406,6 +407,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
/**
* Test inserting text containing line delimiters.
*/
+ @Test
public void testMultilineInserts() {
final Random rand = new Random(4);
final int wrapWidth = 10;
@@ -577,6 +579,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
/**
* Test text remove affecting than one line.
*/
+ @Test
public void testMultilineRemove() {
final Random rand = new Random(4);
final int wrapWidth = 10;
@@ -637,7 +640,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
// remove at fixed width border
offset = 10;
remove = 1;
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, 1, 0));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, offset, "", remove, 0, 1, 0));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(offset, remove, "");
assertNumberOfLines(docAdapter, 1);
@@ -701,6 +704,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
/**
* Test text change affecting and inserting more than one line.
*/
+ @Test
public void testMultilineReplace() {
final Random rand = new Random(4);
final int wrapWidth = 10;
@@ -763,6 +767,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
assertLine(docAdapter, 3, "#B");
checkLineMapping(docAdapter, rand);
+ // replace last (real) line with new content
addText = "*+";
offset = docAdapter.getCharCount() - 2;
length = 1;
@@ -774,6 +779,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
assertLine(docAdapter, 3, "*+B");
checkLineMapping(docAdapter, rand);
+ // replace last character (at fixed width border) with new content
docAdapter.setText("");
docAdapter.replaceTextRange(docAdapter.getCharCount(), 0, "0123456789");
docAdapter.replaceTextRange(docAdapter.getCharCount(), 0, "ABCDEFGHIJ");
@@ -781,7 +787,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
addText = "$b";
offset = docAdapter.getCharCount() - 1;
length = 1;
- eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, null, null, null, null, 1, 1));
+ eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGING, offset, addText, length, addText.length(), 0, 0));
eventListener.addExpectation(new TextEventExpectation(TextChangeEventType.CHANGED));
docAdapter.replaceTextRange(offset, length, addText);
assertNumberOfLines(docAdapter, 3);
@@ -795,6 +801,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
/**
* Test line wrapping is correctly updated if fixed width changed.
*/
+ @Test
public void testSetWidth() {
final Random rand = new Random(7);
final ConsoleDocumentAdapter docAdapter = new ConsoleDocumentAdapter(-1);
@@ -861,6 +868,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
* Some test cases derived from JavaDoc examples of {@link IDocumentAdapter}
* (and its super interfaces).
*/
+ @Test
public void testInterfaceContract() {
final ConsoleDocumentAdapter docAdapter = new ConsoleDocumentAdapter(-1);
docAdapter.setDocument(new Document());
@@ -907,6 +915,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
* {@link IDocumentAdapter#setDocument(org.eclipse.jface.text.IDocument)}
* and ensure old document is indeed disconnected and not notified anymore.
*/
+ @Test
public void testChangeDocument() {
final IDocumentAdapter docAdapter = new ConsoleDocumentAdapter(-1);
final IDocument doc1 = new Document();
@@ -1025,6 +1034,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
/**
* Test adapter with a larger number of lines. (especially tests array grow)
*/
+ @Test
public void testManyLines() {
final ConsoleDocumentAdapter docAdapter = new ConsoleDocumentAdapter(80);
docAdapter.setDocument(new Document());
@@ -1164,6 +1174,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
* and {@link #docAdapter} is set do some additional validations.
*/
TextChangingEvent lastEvent;
+ int eventLineBeforeChange = -1;
int linesBeforeReplace = -1;
int lengthBeforeReplace = -1;
@@ -1180,31 +1191,30 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
@Override
public void textChanging(TextChangingEvent event) {
final TextEventExpectation expectation = checkCommon(TextChangeEventType.CHANGING);
- if (expectation == null) {
- return;
- }
-
- if (expectation.start != null) {
- assertEquals("event.start", (int) expectation.start, event.start);
- }
- if (expectation.newText != null) {
- assertEquals("event.newText", expectation.newText, event.newText);
- }
- if (expectation.replaceCharCount != null) {
- assertEquals("event.replaceCharCount", (int) expectation.replaceCharCount, event.replaceCharCount);
- }
- if (expectation.newCharCount != null) {
- assertEquals("event.newCharCount", (int) expectation.newCharCount, event.newCharCount);
- }
- if (expectation.replaceLineCount != null) {
- assertEquals("event.replaceLineCount", (int) expectation.replaceLineCount, event.replaceLineCount);
- }
- if (expectation.newLineCount != null) {
- assertEquals("event.newLineCount", (int) expectation.newLineCount, event.newLineCount);
+ if (expectation != null) {
+ if (expectation.start != null) {
+ assertEquals("event.start", (int) expectation.start, event.start);
+ }
+ if (expectation.newText != null) {
+ assertEquals("event.newText", expectation.newText, event.newText);
+ }
+ if (expectation.replaceCharCount != null) {
+ assertEquals("event.replaceCharCount", (int) expectation.replaceCharCount, event.replaceCharCount);
+ }
+ if (expectation.newCharCount != null) {
+ assertEquals("event.newCharCount", (int) expectation.newCharCount, event.newCharCount);
+ }
+ if (expectation.replaceLineCount != null) {
+ assertEquals("event.replaceLineCount", (int) expectation.replaceLineCount, event.replaceLineCount);
+ }
+ if (expectation.newLineCount != null) {
+ assertEquals("event.newLineCount", (int) expectation.newLineCount, event.newLineCount);
+ }
}
if (!allowUnexpectedEvents && docAdapter != null) {
lastEvent = event;
+ eventLineBeforeChange = docAdapter.getLineAtOffset(event.start);
linesBeforeReplace = docAdapter.getLineCount();
lengthBeforeReplace = docAdapter.getCharCount();
@@ -1223,7 +1233,7 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
if (docAdapter != null && lastEvent != null) {
final int lastEventOffset = lastEvent.start;
final int lastEventLineIndex = docAdapter.getLineAtOffset(lastEventOffset);
- assertEquals("Line of offset " + lastEventOffset + " has changed after text change.", lastEventLineIndex, docAdapter.getLineAtOffset(lastEventOffset));
+ assertTrue("Line of event offset " + lastEventOffset + " has moved up.", eventLineBeforeChange <= lastEventLineIndex);
// check if predicted changes are correct
final int predictedDocLength = lengthBeforeReplace - lastEvent.replaceCharCount + lastEvent.newCharCount;
@@ -1249,10 +1259,6 @@ public class ConsoleDocumentAdapterTests extends AbstractDebugTest {
return null;
}
assertNotNull("Unexpected event.", expectation);
- if (expectation == null) {
- // prevents wrong compiler warning 'expectation may be null'
- return null;
- }
if (expectation.type != eventType && allowUnexpectedEvents) {
return null;
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
index 4e7639ab8..52e59cd9f 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleManagerTests.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -35,6 +39,9 @@ import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.part.MessagePage;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests console manager
@@ -49,7 +56,8 @@ public class ConsoleManagerTests extends AbstractDebugTest {
ConsoleMock firstConsole;
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
assertNotNull("Must run in UI thread, but was in: " + Thread.currentThread().getName(), //$NON-NLS-1$
Display.getCurrent());
@@ -77,13 +85,13 @@ public class ConsoleManagerTests extends AbstractDebugTest {
firstConsole = new ConsoleMock(0);
manager.addConsoles(new ConsoleMock[] { firstConsole });
manager.showConsoleView(firstConsole);
- TestUtil.waitForJobs(getName(), 200, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
TestUtil.processUIEvents(100);
ConsoleMock.allShownConsoles.set(0);
}
- @Override
- protected void tearDown() throws Exception {
+ @Override @After
+ public void tearDown() throws Exception {
executorService.shutdownNow();
manager.removeConsoles(consoles);
manager.removeConsoles(new ConsoleMock[] { firstConsole });
@@ -100,6 +108,7 @@ public class ConsoleManagerTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testShowAllConsoles() throws Exception {
// Create a number of threads which will start and wait for the last one
// created to call ConsoleManager.show.
@@ -111,7 +120,7 @@ public class ConsoleManagerTests extends AbstractDebugTest {
// Console manager starts a job with delay, let wait for him a bit
System.out.println("Waiting on jobs now..."); //$NON-NLS-1$
- TestUtil.waitForJobs(getName(), 200, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
// Give UI a chance to proceed pending console manager jobs
System.out.println("Done with jobs, processing UI events again..."); //$NON-NLS-1$
@@ -154,7 +163,7 @@ public class ConsoleManagerTests extends AbstractDebugTest {
latch.await(1, TimeUnit.MINUTES);
System.out.println("Requesting to show: " + console); //$NON-NLS-1$
manager.showConsoleView(console);
- TestUtil.waitForJobs(getName(), 200, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
} catch (InterruptedException e) {
e.printStackTrace();
Thread.interrupted();
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
index a291dcb18..a35d4d343 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ConsoleTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017, 2019 Andreas Loth and others.
+ * Copyright (c) 2017, 2020 Andreas Loth and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,10 @@
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
@@ -34,69 +38,65 @@ import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IOConsoleOutputStream;
import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+import org.junit.Test;
-import junit.framework.TestCase;
public class ConsoleTests extends AbstractDebugTest {
- public ConsoleTests() {
- super("ConsoleTests"); //$NON-NLS-1$
- }
-
- public ConsoleTests(String name) {
- super(name);
- }
-
+ @Test
public void testConsoleOutputStreamEncoding() throws IOException {
String testString = "abc\u00e4\u00f6\u00fcdef"; //$NON-NLS-1$
// abcdef need 1 byte in UTF-8 each
// äöü (\u00e4\u00f6\u00fc) need 2 bytes each
byte[] testStringBuffer = testString.getBytes(StandardCharsets.UTF_8);
- TestCase.assertEquals("Test string \"" + testString + "\" should consist of 12 UTF-8 bytes", 12, testStringBuffer.length); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Test string \"" + testString + "\" should consist of 12 UTF-8 bytes", 12, testStringBuffer.length); //$NON-NLS-1$ //$NON-NLS-2$
MessageConsole console = new MessageConsole("Test Console", //$NON-NLS-1$
IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true);
IDocument document = console.getDocument();
- TestUtil.waitForJobs(getName(), 200, 5000);
- TestCase.assertEquals("Document should be empty", "", document.get()); //$NON-NLS-1$ //$NON-NLS-2$
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
+ assertEquals("Document should be empty", "", document.get()); //$NON-NLS-1$ //$NON-NLS-2$
try (IOConsoleOutputStream outStream = console.newOutputStream()) {
outStream.write(testStringBuffer, 0, 6);
// half of ö (\u00f6) is written so we don't expect this char in
// output but all previous chars can be decoded
- TestUtil.waitForJobs(getName(), 200, 5000);
- TestCase.assertEquals("First 4 chars should be written", testString.substring(0, 4), document.get()); //$NON-NLS-1$
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
+ assertEquals("First 4 chars should be written", testString.substring(0, 4), document.get()); //$NON-NLS-1$
outStream.write(testStringBuffer, 6, 6);
// all remaining bytes are written so we expect the whole string
// including the ö (\u00f6) which was at buffer boundary
- TestUtil.waitForJobs(getName(), 200, 5000);
- TestCase.assertEquals("whole test string should be written", testString, document.get()); //$NON-NLS-1$
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
+ assertEquals("whole test string should be written", testString, document.get()); //$NON-NLS-1$
}
- TestUtil.waitForJobs(getName(), 200, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
// after closing the stream, the document content should still be the
// same
- TestCase.assertEquals("closing the stream should not alter the document", testString, document.get()); //$NON-NLS-1$
+ assertEquals("closing the stream should not alter the document", testString, document.get()); //$NON-NLS-1$
}
+ @Test
public void testConsoleOutputStreamLastR() throws IOException {
String testString = "a\r"; //$NON-NLS-1$
byte[] testStringBuffer = testString.getBytes(StandardCharsets.UTF_8);
- TestCase.assertEquals("Test string \"" + testString + "\" should consist of 2 UTF-8 bytes", 2, testStringBuffer.length); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Test string \"" + testString + "\" should consist of 2 UTF-8 bytes", 2, testStringBuffer.length); //$NON-NLS-1$ //$NON-NLS-2$
MessageConsole console = new MessageConsole("Test Console 2", //$NON-NLS-1$
IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true);
IDocument document = console.getDocument();
- TestUtil.waitForJobs(getName(), 200, 5000);
- TestCase.assertEquals("Document should be empty", "", document.get()); //$NON-NLS-1$ //$NON-NLS-2$
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
+ assertEquals("Document should be empty", "", document.get()); //$NON-NLS-1$ //$NON-NLS-2$
try (IOConsoleOutputStream outStream = console.newOutputStream()) {
outStream.write(testStringBuffer);
// everything but pending \r should be written
- TestUtil.waitForJobs(getName(), 200, 5000);
- TestCase.assertEquals("First char should be written", testString.substring(0, 1), document.get()); //$NON-NLS-1$
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
+ assertEquals("First char should be written", testString.substring(0, 1), document.get()); //$NON-NLS-1$
}
- TestUtil.waitForJobs(getName(), 200, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 200, 5000);
// after closing the stream, the document content should still be the
// same
- TestCase.assertEquals("closing the stream should write the pending \\r", testString, document.get()); //$NON-NLS-1$
+ assertEquals("closing the stream should write the pending \\r", testString, document.get()); //$NON-NLS-1$
}
+ @Test
public void testConsoleOutputStreamDocumentClosed() throws IOException {
MessageConsole console = new MessageConsole("Test Console 3", //$NON-NLS-1$
IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true);
@@ -106,13 +106,14 @@ public class ConsoleTests extends AbstractDebugTest {
document.getDocumentPartitioner().disconnect();
try {
outStream.write("write2"); //$NON-NLS-1$
- TestCase.fail("IOException with message \"Document is closed\" expected"); //$NON-NLS-1$
+ fail("IOException with message \"Document is closed\" expected"); //$NON-NLS-1$
} catch (IOException ioe) {
- TestCase.assertEquals("Document is closed", ioe.getMessage()); //$NON-NLS-1$
+ assertEquals("Document is closed", ioe.getMessage()); //$NON-NLS-1$
}
}
}
+ @Test
public void testConsoleOutputStreamClosed() throws IOException {
MessageConsole console = new MessageConsole("Test Console 4", //$NON-NLS-1$
IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true);
@@ -121,13 +122,14 @@ public class ConsoleTests extends AbstractDebugTest {
outStream.close();
try {
outStream.write("test2".getBytes(StandardCharsets.UTF_8)); //$NON-NLS-1$
- TestCase.fail("IOException with message \"Output Stream is closed\" expected"); //$NON-NLS-1$
+ fail("IOException with message \"Output Stream is closed\" expected"); //$NON-NLS-1$
} catch (IOException ioe) {
- TestCase.assertEquals("Output Stream is closed", ioe.getMessage()); //$NON-NLS-1$
+ assertEquals("Output Stream is closed", ioe.getMessage()); //$NON-NLS-1$
}
}
}
+ @Test
public void testConsoleOutputStreamDocumentStreamClosed() throws IOException {
MessageConsole console = new MessageConsole("Test Console 5", //$NON-NLS-1$
IConsoleConstants.MESSAGE_CONSOLE_TYPE, null, StandardCharsets.UTF_8.name(), true);
@@ -137,19 +139,20 @@ public class ConsoleTests extends AbstractDebugTest {
document.getDocumentPartitioner().disconnect();
try {
outStream.write("write2"); //$NON-NLS-1$
- TestCase.fail("IOException with message \"Document is closed\" expected"); //$NON-NLS-1$
+ fail("IOException with message \"Document is closed\" expected"); //$NON-NLS-1$
} catch (IOException ioe) {
- TestCase.assertEquals("Document is closed", ioe.getMessage()); //$NON-NLS-1$
+ assertEquals("Document is closed", ioe.getMessage()); //$NON-NLS-1$
}
try {
outStream.write("write3"); //$NON-NLS-1$
- TestCase.fail("IOException with message \"Output Stream is closed\" expected"); //$NON-NLS-1$
+ fail("IOException with message \"Output Stream is closed\" expected"); //$NON-NLS-1$
} catch (IOException ioe) {
- TestCase.assertEquals("Output Stream is closed", ioe.getMessage()); //$NON-NLS-1$
+ assertEquals("Output Stream is closed", ioe.getMessage()); //$NON-NLS-1$
}
}
}
+ @Test
public void testSetNullEncoding() throws IOException {
MessageConsole console = new MessageConsole("Test Console 6", null); //$NON-NLS-1$
try (IOConsoleOutputStream outStream = console.newOutputStream()) {
@@ -158,13 +161,14 @@ public class ConsoleTests extends AbstractDebugTest {
}
/**
- * Validate that we can use find and replace after opening a console in the
- * Console View.
+ * Validate that we can use commands findReplace, findNext and findPrevious
+ * after opening a console in the Console View.
*
* @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=268608">bug
* 268608</a>
*/
- public void testFindReplaceIsEnabledOnConsoleOpen() throws Exception {
+ @Test
+ public void testFindCommandsAreEnabledOnConsoleOpen() throws Exception {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart consoleView = activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW);
@@ -177,11 +181,15 @@ public class ConsoleTests extends AbstractDebugTest {
try {
consoleManager.addConsoles(consoles);
consoleManager.showConsoleView(console);
- TestUtil.waitForJobs(getName(), 100, 3000);
+ TestUtil.waitForJobs(name.getMethodName(), 100, 3000);
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
- Command command = commandService.getCommand(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
- TestCase.assertTrue("expected FindReplace command to be enabled after opening console", command.isEnabled());
+ Command commandFindReplace = commandService.getCommand(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
+ assertTrue("expected FindReplace command to be enabled after opening console", commandFindReplace.isEnabled());
+ Command commandFindNext = commandService.getCommand(IWorkbenchActionDefinitionIds.FIND_NEXT);
+ assertTrue("expected FindNext command to be enabled after opening console", commandFindNext.isEnabled());
+ Command commandFindPrevious = commandService.getCommand(IWorkbenchActionDefinitionIds.FIND_PREVIOUS);
+ assertTrue("expected FindPrevious command to be enabled after opening console", commandFindPrevious.isEnabled());
} finally {
consoleManager.removeConsoles(consoles);
activePage.hideView(consoleView);
@@ -193,6 +201,7 @@ public class ConsoleTests extends AbstractDebugTest {
*
* @throws Exception if test fails
*/
+ @Test
public void testIOConsoleAvailable() throws Exception {
IOConsole console = new IOConsole("", null);
try (InputStream consoleInput = console.getInputStream()) {
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/FileLinkTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/FileLinkTests.java
new file mode 100644
index 000000000..9042f27b3
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/FileLinkTests.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.console;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.UUID;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.eclipse.debug.ui.console.FileLink;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
+
+/**
+ * Tests for {@link FileLink}.
+ */
+public class FileLinkTests extends AbstractDebugTest {
+
+ private IProject testProject;
+ private IFile testFile;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ testProject = workspace.getRoot().getProject("FileLinkTest-" + UUID.randomUUID());
+ testProject.create(null);
+ testProject.open(null);
+ testFile = testProject.getFile("filelinktest.txt");
+ setTestContent("Test file\nSecond line");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ if (testProject.exists()) {
+ testProject.delete(true, true, null);
+ }
+
+ super.tearDown();
+ }
+
+ private void setTestContent(String fileContent) throws UnsupportedEncodingException, CoreException {
+ ByteArrayInputStream data = new ByteArrayInputStream(fileContent.getBytes(testFile.getCharset()));
+ if (testFile.exists()) {
+ testFile.setContents(data, IResource.FORCE, null);
+ } else {
+ testFile.create(data, IResource.FORCE, null);
+ }
+ }
+
+ @Test
+ public void testFileLink() throws Exception {
+ FileLink link = new FileLink(testFile, null, -1, -1, -1);
+ link.linkActivated();
+ assertEquals(testFile.getName(), getActiveEditorFilename());
+ }
+
+ @Test
+ public void testFileLinkWithOffset() throws Exception {
+ FileLink link = new FileLink(testFile, null, 4, 0, -1);
+ link.linkActivated();
+ assertEquals(testFile.getName(), getActiveEditorFilename());
+ ITextSelection selection = getCurrentTextSelection();
+ assertNotNull("No selection.", selection);
+ assertEquals(4, selection.getOffset());
+ assertEquals(0, selection.getLength());
+ assertEquals(0, selection.getStartLine());
+ assertEquals(0, selection.getEndLine());
+ }
+
+ @Test
+ public void testFileLinkWithSelection() throws Exception {
+ FileLink link = new FileLink(testFile, null, 7, 5, -1);
+ link.linkActivated();
+ assertEquals(testFile.getName(), getActiveEditorFilename());
+ ITextSelection selection = getCurrentTextSelection();
+ assertNotNull("No selection.", selection);
+ assertEquals(7, selection.getOffset());
+ assertEquals(5, selection.getLength());
+ assertEquals(0, selection.getStartLine());
+ assertEquals(1, selection.getEndLine());
+
+ // if offset + length and line is specified the line should be ignored
+ link = new FileLink(testFile, null, 7, 5, 1);
+ link.linkActivated();
+ assertEquals(testFile.getName(), getActiveEditorFilename());
+ selection = getCurrentTextSelection();
+ assertNotNull("No selection.", selection);
+ assertEquals(7, selection.getOffset());
+ assertEquals(5, selection.getLength());
+ assertEquals(0, selection.getStartLine());
+ assertEquals(1, selection.getEndLine());
+ }
+
+ @Test
+ public void testFileLinkWithLine() throws Exception {
+ FileLink link = new FileLink(testFile, null, -1, -1, 2);
+ link.linkActivated();
+ assertEquals(testFile.getName(), getActiveEditorFilename());
+ ITextSelection selection = getCurrentTextSelection();
+ assertNotNull("No selection.", selection);
+ assertEquals(10, selection.getOffset());
+ assertEquals(11, selection.getLength());
+ assertEquals(1, selection.getStartLine());
+ assertEquals(1, selection.getEndLine());
+ }
+
+ private String getActiveEditorFilename() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IEditorPart editor = window.getActivePage().getActiveEditor();
+ return editor != null ? editor.getEditorInput().getName() : null;
+ }
+
+ private ITextSelection getCurrentTextSelection() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ ISelection selection = window.getSelectionService().getSelection();
+ if (selection instanceof ITextSelection) {
+ return (ITextSelection) selection;
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleFixedWidthTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleFixedWidthTests.java
new file mode 100644
index 000000000..d0c2b5f72
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleFixedWidthTests.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.console;
+
+import org.eclipse.debug.tests.TestUtil;
+
+/**
+ * Same as {@link IOConsoleTests} but with fixed width console enabled.
+ */
+public class IOConsoleFixedWidthTests extends IOConsoleTests {
+
+ @Override
+ protected IOConsoleTestUtil getTestUtil(String title) {
+ final IOConsoleTestUtil c = super.getTestUtil(title);
+ // Varying the width may reveal new bugs. There is no width value
+ // which is invalid. (but remember most test output is quite short)
+ // And try the most beautiful width of 1 aka the vertical console.
+ c.getConsole().setConsoleWidth(3);
+ c.setIgnoreFixedConsole(true);
+ // console width is applied asynchronous
+ TestUtil.waitForJobs(name.getMethodName(), 50, 1000);
+ return c;
+ }
+
+ // the actual tests are inherited from IOConsoleTests
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java
index ee08f8105..056e8402a 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTestUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 Paul Pazderski and others.
+ * Copyright (c) 2019, 2020 Paul Pazderski and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,10 +13,18 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.tests.TestUtil;
import org.eclipse.jface.text.BadLocationException;
@@ -24,16 +32,16 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.Region;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.console.IConsoleDocumentPartitioner;
import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IOConsoleOutputStream;
-import junit.framework.TestCase;
-
/**
* Utility to help testing input and output in {@link IOConsole}.
*/
@@ -55,6 +63,24 @@ public final class IOConsoleTestUtil {
* initialized.
*/
private IOConsoleOutputStream defaultOut = null;
+ /**
+ * This utility was initial written to be used with disabled fixed width
+ * console. If fixed width is enabled some methods like 'set caret to line
+ * end' may behave unexpected if a test case was written with non fixed
+ * width console in mind.
+ * <p>
+ * If this field is set to <code>true</code> all methods which may behave
+ * problematic in fixed width are executed in a way so that there result is
+ * the same as if the console has no fixed width enabled. E.g. 'set caret to
+ * line end' ignores virtual line wraps and jumps to the next real line
+ * delimiter.
+ * </p>
+ * <p>
+ * If this field is set to <code>true</code> any test written for non fixed
+ * width mode should succeed regardless of the fixed width setting.
+ * </p>
+ */
+ private boolean ignoreFixedConsole = false;
/**
* Create a new testing helper.
@@ -68,11 +94,11 @@ public final class IOConsoleTestUtil {
*/
public IOConsoleTestUtil(IOConsole console, StyledText textPanel, String name) {
this.console = console;
- TestCase.assertNotNull(this.console);
+ assertNotNull(this.console);
this.doc = console.getDocument();
- TestCase.assertNotNull(this.doc);
+ assertNotNull(this.doc);
final Class<?> expectedInterface = IConsoleDocumentPartitioner.class;
- TestCase.assertTrue("Expected partitioner implements " + expectedInterface.getName() + //
+ assertTrue("Expected partitioner implements " + expectedInterface.getName() + //
". Found: " + this.doc.getDocumentPartitioner().getClass(), //
expectedInterface.isAssignableFrom(this.doc.getDocumentPartitioner().getClass()));
this.partitioner = (IConsoleDocumentPartitioner) this.doc.getDocumentPartitioner();
@@ -88,8 +114,8 @@ public final class IOConsoleTestUtil {
*/
public IOConsoleTestUtil clear() throws Exception {
console.clearConsole();
- waitForScheduledJobs();
- TestCase.assertEquals("Console is not cleared.", 0, doc.getLength());
+ flush();
+ assertEquals("Console is not cleared.", 0, doc.getLength());
return this;
}
@@ -100,7 +126,9 @@ public final class IOConsoleTestUtil {
* @param s content to write in output stream
* @return this {@link IOConsoleTestUtil} to chain methods
* @see #write(String)
+ * @see #flush()
*/
+ @SuppressWarnings("resource")
public IOConsoleTestUtil writeFast(final String s) throws IOException {
return writeFast(s, getDefaultOutputStream());
}
@@ -113,6 +141,7 @@ public final class IOConsoleTestUtil {
* @return this {@link IOConsoleTestUtil} to chain methods
* @see #writeFast(String)
*/
+ @SuppressWarnings("resource")
public IOConsoleTestUtil write(final String s) throws Exception {
return write(s, getDefaultOutputStream());
}
@@ -128,6 +157,7 @@ public final class IOConsoleTestUtil {
* @param s content to write in output stream
* @return this {@link IOConsoleTestUtil} to chain methods
*/
+ @SuppressWarnings("resource")
public IOConsoleTestUtil writeAndVerify(final String s) throws Exception {
return writeAndVerify(s, getDefaultOutputStream());
}
@@ -140,6 +170,7 @@ public final class IOConsoleTestUtil {
* @param out use this output stream instead of default one
* @return this {@link IOConsoleTestUtil} to chain methods
* @see #write(String, IOConsoleOutputStream)
+ * @see #flush()
*/
public IOConsoleTestUtil writeFast(final String s, IOConsoleOutputStream out) throws IOException {
out.write(s);
@@ -157,7 +188,7 @@ public final class IOConsoleTestUtil {
*/
public IOConsoleTestUtil write(final String s, IOConsoleOutputStream out) throws Exception {
writeFast(s, out);
- waitForScheduledJobs();
+ flush();
return this;
}
@@ -176,7 +207,7 @@ public final class IOConsoleTestUtil {
public IOConsoleTestUtil writeAndVerify(final String s, IOConsoleOutputStream out) throws Exception {
final int oldLength = doc.getLength();
write(s, out);
- TestCase.assertEquals("Console content length not as expected.", oldLength + s.length(), doc.getLength());
+ assertEquals("Console content length not as expected.", oldLength + s.length(), doc.getLength());
verifyContentByOffset(s, oldLength);
verifyOutputPartitions(oldLength, s.length());
return this;
@@ -230,8 +261,8 @@ public final class IOConsoleTestUtil {
final int oldSelectionLength = textPanel.getSelectionCount();
final int oldOffset = getCaretOffset() - oldSelectionLength;
insert(content);
- TestCase.assertEquals("Console content length not as expected.", oldLength + content.length() - oldSelectionLength, doc.getLength());
- TestCase.assertEquals("Caret not at expected position.", oldOffset + content.length(), getCaretOffset());
+ assertEquals("Console content length not as expected.", oldLength + content.length() - oldSelectionLength, doc.getLength());
+ assertEquals("Caret not at expected position.", oldOffset + content.length(), getCaretOffset());
verifyContentByOffset(content, oldOffset);
verifyInputPartitions(oldOffset, content.length());
return this;
@@ -280,8 +311,8 @@ public final class IOConsoleTestUtil {
final int oldSelectionLength = textPanel.getSelectionCount();
final int oldOffset = getCaretOffset() - oldSelectionLength;
insertTyping(content);
- TestCase.assertEquals("Console content length not as expected.", oldLength + content.length() - oldSelectionLength, doc.getLength());
- TestCase.assertEquals("Caret not at expected position.", oldOffset + content.length(), getCaretOffset());
+ assertEquals("Console content length not as expected.", oldLength + content.length() - oldSelectionLength, doc.getLength());
+ assertEquals("Caret not at expected position.", oldOffset + content.length(), getCaretOffset());
verifyContentByOffset(content, oldOffset);
verifyInputPartitions(oldOffset, content.length());
return this;
@@ -304,7 +335,34 @@ public final class IOConsoleTestUtil {
*/
public IOConsoleTestUtil backspace(int repeat) {
for (int i = 0; i < repeat; i++) {
- textPanel.invokeAction(ST.DELETE_PREVIOUS);
+ if (ignoreFixedConsole) {
+ // Note: this backspace simulation can not handle multibyte line
+ // delimiter. It would only delete one byte with one backspace.
+ final Event e = new Event();
+ e.doit = true;
+ e.text = "";
+ final IRegion selection = getSelection();
+ if (selection.getLength() == 0) {
+ final int caretOffset = getCaretOffset();
+ e.start = caretOffset - 1;
+ e.end = caretOffset;
+ if (caretOffset <= 0) {
+ e.doit = false;
+ }
+ } else {
+ e.start = selection.getOffset();
+ e.end = selection.getOffset() + selection.getLength();
+ }
+ if (e.doit) {
+ textPanel.notifyListeners(SWT.Verify, e);
+ }
+ if (e.doit) {
+ textPanel.replaceTextRange(e.start, e.end - e.start, e.text);
+ setCaretOffset(e.start);
+ }
+ } else {
+ textPanel.invokeAction(ST.DELETE_PREVIOUS);
+ }
}
return this;
}
@@ -316,7 +374,7 @@ public final class IOConsoleTestUtil {
*/
public IOConsoleTestUtil enter() {
// Note: newline will be replaced by
- // System.getProperty("line.separator") so do not assume document length
+ // System.lineSeparator() so do not assume document length
// will increase by 1
insertTyping("\n");
return this;
@@ -393,7 +451,17 @@ public final class IOConsoleTestUtil {
* @return this {@link IOConsoleTestUtil} to chain methods
*/
public IOConsoleTestUtil moveCaretToLineStart() {
- textPanel.invokeAction(ST.LINE_START);
+ if (ignoreFixedConsole) {
+ try {
+ final int currentOffset = getCaretOffset();
+ final int docLineStart = getDocument().getLineInformationOfOffset(currentOffset).getOffset();
+ setCaretOffset(docLineStart);
+ } catch (BadLocationException e) {
+ TestUtil.log(IStatus.ERROR, name, "Failed to set caret to line start in wrapped line mode.", e);
+ }
+ } else {
+ textPanel.invokeAction(ST.LINE_START);
+ }
return this;
}
@@ -403,11 +471,31 @@ public final class IOConsoleTestUtil {
* @return this {@link IOConsoleTestUtil} to chain methods
*/
public IOConsoleTestUtil moveCaretToLineEnd() {
- textPanel.invokeAction(ST.LINE_END);
+ if (ignoreFixedConsole) {
+ try {
+ final int currentOffset = getCaretOffset();
+ final IRegion docLine = getDocument().getLineInformationOfOffset(currentOffset);
+ setCaretOffset(docLine.getOffset() + docLine.getLength());
+ } catch (BadLocationException e) {
+ TestUtil.log(IStatus.ERROR, name, "Failed to set caret to line end in wrapped line mode.", e);
+ }
+ } else {
+ textPanel.invokeAction(ST.LINE_END);
+ }
return this;
}
/**
+ * Get the selected text region in console.
+ *
+ * @return the selected region
+ */
+ public IRegion getSelection() {
+ final Point selection = textPanel.getSelection();
+ return new Region(selection.x, selection.y - selection.x);
+ }
+
+ /**
* Select text in console.
*
* @param offset selection start position. May be negative to select
@@ -424,6 +512,17 @@ public final class IOConsoleTestUtil {
}
/**
+ * Select all content in console.
+ *
+ * @return this {@link IOConsoleTestUtil} to chain methods
+ * @see StyledText#setSelection(int, int)
+ */
+ public IOConsoleTestUtil selectAll() {
+ textPanel.selectAll();
+ return this;
+ }
+
+ /**
* Check if console content equals the expected content.
*
* @param expectedContent content expect in console
@@ -431,7 +530,7 @@ public final class IOConsoleTestUtil {
*/
public IOConsoleTestUtil verifyContent(String expectedContent) {
verifyContentByOffset(expectedContent, 0);
- TestCase.assertEquals("More or less content in console as expected.", expectedContent.length(), doc.getLength());
+ assertEquals("More or less content in console as expected.", expectedContent.length(), doc.getLength());
return this;
}
@@ -449,9 +548,9 @@ public final class IOConsoleTestUtil {
try {
final IRegion line = doc.getLineInformation(l);
verifyContentByOffset(expectedContent, line.getOffset());
- TestCase.assertEquals("Line " + l + " has wrong length.", expectedContent.length(), line.getLength());
+ assertEquals("Line " + l + " has wrong length.", expectedContent.length(), line.getLength());
} catch (BadLocationException e) {
- TestCase.fail("Expected line not found in console document. Bad location!");
+ fail("Expected line " + lineNum + " not found in console document. Bad location!");
}
return this;
}
@@ -468,9 +567,9 @@ public final class IOConsoleTestUtil {
try {
final int o = offset < 0 ? doc.getLength() + offset : offset;
final int len = Math.min(doc.getLength() - o, expectedContent.length());
- TestCase.assertEquals("Expected string not found in console document.", expectedContent, doc.get(o, len));
+ assertEquals("Expected string not found in console document.", expectedContent, doc.get(o, len));
} catch (BadLocationException ex) {
- TestCase.fail("Expected string not found in console document. Bad location!");
+ fail("Expected string '" + expectedContent + "' not found in console document. Bad location!");
}
return this;
}
@@ -536,8 +635,8 @@ public final class IOConsoleTestUtil {
public IOConsoleTestUtil verifyPartitions(final int offset, final int length, final String expectedType, final boolean allowMixedTypes, final boolean allowGaps, int minPartitionNumber) {
{
final ITypedRegion[] partitions = getPartitioner().computePartitioning(offset, length);
- TestCase.assertNotNull("Got no partitions.", partitions);
- TestCase.assertTrue("Got less partitions than expected.", partitions.length >= minPartitionNumber);
+ assertNotNull("Got no partitions.", partitions);
+ assertTrue("Got less partitions than expected.", partitions.length >= minPartitionNumber);
// points to offset after last partition range aka. expected start
// of next partition
@@ -545,13 +644,13 @@ public final class IOConsoleTestUtil {
ITypedRegion lastPartition = null;
String partitionType = expectedType;
for (ITypedRegion partition : partitions) {
- TestCase.assertNotSame("Got same partition twice.", lastPartition, partition);
- TestCase.assertTrue("Partition overlapping. (or not sorted as expected)", partition.getOffset() >= lastEnd);
+ assertNotSame("Got same partition twice.", lastPartition, partition);
+ assertTrue("Partition overlapping. (or not sorted as expected)", partition.getOffset() >= lastEnd);
if (!allowGaps && lastEnd != -1) {
- TestCase.assertTrue("Partitioning gap.", partition.getOffset() == lastEnd);
+ assertTrue("Partitioning gap.", partition.getOffset() == lastEnd);
}
- TestCase.assertTrue("Not a valid partition type.", validPartionTypes.contains(partition.getType()));
- TestCase.assertTrue("Wrong partition type.", partitionType == null || partitionType.equals(partition.getType()) || allowMixedTypes);
+ assertTrue("Not a valid partition type.", validPartionTypes.contains(partition.getType()));
+ assertTrue("Wrong partition type.", partitionType == null || partitionType.equals(partition.getType()) || allowMixedTypes);
if (partitionType == null && !allowMixedTypes) {
partitionType = partition.getType();
}
@@ -566,17 +665,17 @@ public final class IOConsoleTestUtil {
while (pos < end) {
final ITypedRegion partition = getPartitioner().getPartition(pos);
if (partition == null) {
- TestCase.assertTrue("Did not expect 'null' partition.", allowGaps);
+ assertTrue("Did not expect 'null' partition.", allowGaps);
pos++;
continue;
}
- TestCase.assertNotSame("Got same partition again.", lastPartition, partition);
- TestCase.assertFalse("Did not expected and cannot handle empty partition.", partition.getLength() == 0);
- TestCase.assertTrue("Got not the requested partition.", partition.getOffset() <= pos && partition.getOffset() + partition.getLength() > pos);
- TestCase.assertTrue("Not a valid partition type.", validPartionTypes.contains(partition.getType()));
+ assertNotSame("Got same partition again.", lastPartition, partition);
+ assertFalse("Did not expected and cannot handle empty partition.", partition.getLength() == 0);
+ assertTrue("Got not the requested partition.", partition.getOffset() <= pos && partition.getOffset() + partition.getLength() > pos);
+ assertTrue("Not a valid partition type.", validPartionTypes.contains(partition.getType()));
lastPartition = partition;
if (partitionType != null && !partitionType.equals(partition.getType())) {
- TestCase.assertTrue("Wrong partition type.", allowMixedTypes);
+ assertTrue("Wrong partition type.", allowMixedTypes);
pos += partition.getLength();
end += partition.getLength();
continue;
@@ -612,6 +711,18 @@ public final class IOConsoleTestUtil {
}
/**
+ * Ensure all pending write operations are fully applied on the console view
+ * before returning.
+ *
+ * @return this {@link IOConsoleTestUtil} to chain methods
+ */
+ public IOConsoleTestUtil flush() {
+ // overall this method is just a better name for waitForScheduledJobs
+ waitForScheduledJobs();
+ return this;
+ }
+
+ /**
* Close the default output stream if it was used.
*/
public void closeOutputStream() {
@@ -619,7 +730,7 @@ public final class IOConsoleTestUtil {
try {
defaultOut.close();
} catch (IOException e) {
- TestCase.fail("Failed to close output stream.");
+ fail("Failed to close output stream.");
}
}
}
@@ -653,6 +764,33 @@ public final class IOConsoleTestUtil {
}
/**
+ * If <code>true</code> the util will work as if console is not in fixed
+ * width mode. E.g. {@link #moveCaretToLineStart()} will move caret to
+ * document line start not to widget line start or
+ * {@link #verifyContentByLine(String, int)} would check the line as seen
+ * without fixed width.
+ *
+ * @see #ignoreFixedConsole
+ */
+ public boolean isIgnoreFixedConsole() {
+ return ignoreFixedConsole;
+ }
+
+ /**
+ * Enable compatibility mode. If set to <code>true</code> tests written for
+ * console without fixed width should work with any fixed width. Commands
+ * like {@link #moveCaretToLineStart()} are modified to not move to begin of
+ * widget line (maybe wrapped line) but to start it would have without fixed
+ * width or {@link #verifyContentByLine(String, int)} would check the line
+ * as seen without fixed width.
+ *
+ * @see #ignoreFixedConsole
+ */
+ public void setIgnoreFixedConsole(boolean ignoreWrappeding) {
+ this.ignoreFixedConsole = ignoreWrappeding;
+ }
+
+ /**
* Get identifier for output {@link IOConsolePartition}s.
*
* @return output partition identifier
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java
index 031f3c473..bc1157c29 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/IOConsoleTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 Paul Pazderski and others.
+ * Copyright (c) 2019, 2020 Paul Pazderski and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,24 +13,36 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Queue;
import java.util.Random;
+import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.tests.TestUtil;
import org.eclipse.debug.tests.TestsPlugin;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
@@ -39,9 +51,14 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleDocumentPartitioner;
+import org.eclipse.ui.console.IConsoleDocumentPartitionerExtension;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IOConsoleOutputStream;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests the {@link IOConsole}. Especially the partitioner and viewer parts.
@@ -61,25 +78,18 @@ public class IOConsoleTests extends AbstractDebugTest {
* Number of received log messages with severity error while running a
* single test method.
*/
- private final AtomicInteger loggedErrors = new AtomicInteger();
+ private final Queue<IStatus> loggedErrors = new ConcurrentLinkedQueue<>();
/** Listener to count error messages while testing. */
private final ILogListener errorLogListener = (IStatus status, String plugin) -> {
if (status.matches(IStatus.ERROR)) {
- loggedErrors.incrementAndGet();
+ loggedErrors.add(status);
}
};
- public IOConsoleTests() {
- super(IOConsoleTests.class.getSimpleName());
- }
-
- public IOConsoleTests(String name) {
- super(name);
- }
-
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// create or activate console view
@@ -97,15 +107,26 @@ public class IOConsoleTests extends AbstractDebugTest {
activePage.activate(consoleView);
// add error listener
- loggedErrors.set(0);
+ loggedErrors.clear();
Platform.addLogListener(errorLogListener);
}
@Override
- protected void tearDown() throws Exception {
- assertEquals("Test triggered errors in IOConsole.", 0, loggedErrors.get());
+ @After
+ public void tearDown() throws Exception {
Platform.removeLogListener(errorLogListener);
super.tearDown();
+
+ assertNoError();
+ }
+
+ private void assertNoError() {
+ loggedErrors.forEach(status -> {
+ if (status.getException() != null) {
+ throw new AssertionError("Test triggered errors in IOConsole", status.getException());
+ }
+ });
+ assertTrue("Test triggered errors in IOConsole: " + loggedErrors.stream().toString(), loggedErrors.isEmpty());
}
/**
@@ -114,7 +135,7 @@ public class IOConsoleTests extends AbstractDebugTest {
* @param title console title
* @return util to help testing console functions
*/
- private IOConsoleTestUtil getTestUtil(String title) {
+ protected IOConsoleTestUtil getTestUtil(String title) {
final IOConsole console = new IOConsole(title, "", null, StandardCharsets.UTF_8.name(), true);
consoleFinished.set(false);
console.addPropertyChangeListener((PropertyChangeEvent event) -> {
@@ -124,12 +145,12 @@ public class IOConsoleTests extends AbstractDebugTest {
});
final IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
consoleManager.addConsoles(new IConsole[] { console });
- TestUtil.waitForJobs(getName(), 25, 10000);
+ TestUtil.waitForJobs(name.getMethodName(), 25, 10000);
consoleManager.showConsoleView(console);
@SuppressWarnings("restriction")
final org.eclipse.ui.internal.console.IOConsolePage page = (org.eclipse.ui.internal.console.IOConsolePage) consoleView.getCurrentPage();
final StyledText textPanel = (StyledText) page.getControl();
- return new IOConsoleTestUtil(console, textPanel, getName());
+ return new IOConsoleTestUtil(console, textPanel, name.getMethodName());
}
/**
@@ -143,7 +164,7 @@ public class IOConsoleTests extends AbstractDebugTest {
* @param c the test util containing the console to close
* @param expected content this {@link IOConsole} input stream has received
*/
- private void closeConsole(IOConsoleTestUtil c, String... expectedInputLines) throws IOException {
+ protected void closeConsole(IOConsoleTestUtil c, String... expectedInputLines) throws IOException {
if (consoleFinished.get()) {
// This should only happen if no output streams where used and the
// user input stream was explicit closed before
@@ -151,24 +172,23 @@ public class IOConsoleTests extends AbstractDebugTest {
}
c.closeOutputStream();
- if (c.getConsole().getInputStream() != null) {
- c.getConsole().getInputStream().close();
- }
- if (expectedInputLines.length > 0) {
- assertNotNull(c.getConsole().getInputStream());
- assertTrue("InputStream is empty.", c.getConsole().getInputStream().available() > 0);
+ try (InputStream consoleIn = c.getConsole().getInputStream()) {
+ if (expectedInputLines.length > 0) {
+ assertNotNull(consoleIn);
+ assertTrue("InputStream is empty.", consoleIn.available() > 0);
- final List<String> inputLines = new ArrayList<>();
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(c.getConsole().getInputStream(), c.getConsole().getCharset()))) {
- String line;
- while (reader.ready() && (line = reader.readLine()) != null) {
- inputLines.add(line);
+ final List<String> inputLines = new ArrayList<>();
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(consoleIn, c.getConsole().getCharset()))) {
+ String line;
+ while (reader.ready() && (line = reader.readLine()) != null) {
+ inputLines.add(line);
+ }
+ }
+ assertEquals("Input contains to many/few lines.", expectedInputLines.length, inputLines.size());
+ for (int i = 0; i < expectedInputLines.length; i++) {
+ assertEquals("Content of input line " + i + " not as expected.", expectedInputLines[i], inputLines.get(i));
}
- }
- assertEquals("Input contains to many/few lines.", expectedInputLines.length, inputLines.size());
- for (int i = 0; i < expectedInputLines.length; i++) {
- assertEquals("Content of input line " + i + " not as expected.", expectedInputLines[i], inputLines.get(i));
}
}
c.waitForScheduledJobs();
@@ -181,12 +201,13 @@ public class IOConsoleTests extends AbstractDebugTest {
/**
* Test console clear.
*/
+ @Test
public void testConsoleClear() throws Exception {
final IOConsoleTestUtil c = getTestUtil("Test clear");
c.writeAndVerify("Hello World!");
c.getDocument().replace(0, c.getContentLength(), "");
- c.waitForScheduledJobs();
+ c.flush();
c.verifyContent("").verifyPartitions();
c.writeAndVerify("New console content.");
@@ -197,13 +218,35 @@ public class IOConsoleTests extends AbstractDebugTest {
c.clear().insertTypingAndVerify("i").write("ooo").verifyContent("iooo").verifyPartitions();
c.enter().clear();
- closeConsole(c, "i");
+ c.insertAndVerify("gnorw").write("tuo").verifyContent("gnorwtuo").verifyPartitions(2);
+ c.clear().insertTypingAndVerify("I").write("O").verifyContent("IO").verifyPartitions();
+ c.insert("\r\n").clear();
+
+ c.insertTypingAndVerify("some user input").selectAll().backspace();
+ c.verifyContent("").verifyPartitions();
+
+ // test (almost) simultaneous write and clear
+ c.writeFast("to be removed").clear().verifyPartitions();
+ // Do not use clear() from test util here. Test requires an immediate
+ // write after clear. The util's clear() method blocks until console is
+ // actually cleared.
+ c.getConsole().clearConsole();
+ c.writeAndVerify("do not remove this").verifyPartitions().clear();
+ final String longString = String.join("", Collections.nCopies(1000, "012345678\n"));
+ c.getConsole().clearConsole();
+ c.writeAndVerify(longString).verifyPartitions().clear();
+ final String veryLongString = String.join("", Collections.nCopies(20000, "abcdefghi\n"));
+ c.getConsole().clearConsole();
+ c.writeAndVerify(veryLongString).verifyPartitions().clear();
+
+ closeConsole(c, "i", "I");
}
/**
* Test multiple writes, i.e. {@link IOConsole} receives content from
* connected {@link IOConsoleOutputStream}.
*/
+ @Test
public void testWrites() throws Exception {
final IOConsoleTestUtil c = getTestUtil("Test writes");
final String[] strings = new String[] {
@@ -224,6 +267,7 @@ public class IOConsoleTests extends AbstractDebugTest {
* Test {@link IOConsole} input stream, i.e. simulate user typing or pasting
* input in console.
*/
+ @Test
public void testUserInput() throws Exception {
final IOConsoleTestUtil c = getTestUtil("Test input");
final List<String> expectedInput = new ArrayList<>();
@@ -241,15 +285,46 @@ public class IOConsoleTests extends AbstractDebugTest {
assertEquals("Expected newline entered inside line does not break this line.", c.getContentLength(), c.getCaretOffset());
c.verifyPartitions().verifyContentByOffset("NewLine", pos);
c.backspace().insertAndVerify("--").select(0, c.getContentLength()).insertTyping("<~>");
- c.verifyContentByLine("--<~>", 2).verifyPartitions();
- c.select(-2, 1).insertAndVerify("-=-").verifyContentByLine("--<-=->", 2).verifyPartitions();
+ c.verifyContentByLine("<~>", 2).verifyPartitions();
+ c.select(-2, 1).insertAndVerify("-=-").verifyContentByLine("<-=->", 2).verifyPartitions();
+
+ // multiline input
+ c.clear().insertTyping("=").insert("foo\n><");
+ expectedInput.add("=foo");
+ c.moveCaretToEnd().moveCaret(-1);
+ c.insert("abc\r\n123\n456");
+ expectedInput.add(">abc<");
+ expectedInput.add("123");
+ c.enter().clear();
+ expectedInput.add("456");
closeConsole(c, expectedInput.toArray(new String[0]));
}
/**
+ * Test {@link IOConsole} with file as input source.
+ */
+ @Test
+ public void testInputFile() throws Exception {
+ final IOConsoleTestUtil c = getTestUtil("Test input file");
+ // open default output stream to match usual behavior where two output
+ // streams are open and to prevent premature console closing
+ try (IOConsoleOutputStream defaultOutputStream = c.getDefaultOutputStream()) {
+ try (InputStream in = new ByteArrayInputStream(new byte[0])) {
+ try (InputStream defaultIn = c.getConsole().getInputStream()) {
+ // just close input stream
+ }
+ c.getConsole().setInputStream(in);
+ }
+ closeConsole(c);
+ }
+ assertNoError();
+ }
+
+ /**
* Test mixes of outputs and user inputs in various variants.
*/
+ @Test
public void testMixedWriteAndInput() throws Exception {
final IOConsoleTestUtil c = getTestUtil("Test input output mix");
final List<String> expectedInput = new ArrayList<>();
@@ -259,7 +334,7 @@ public class IOConsoleTests extends AbstractDebugTest {
c.insertTyping("~~~");
c.writeAndVerify("bar");
c.insertTyping("input.");
- c.verifyContent("foo~~~barinput.").verifyPartitions(3);
+ c.verifyContent("foo~~~input.bar").verifyPartitions(3);
c.enter().clear();
expectedInput.add("~~~input.");
@@ -275,7 +350,7 @@ public class IOConsoleTests extends AbstractDebugTest {
c.insert("~~p#t").select(c.getContentLength() - 5, 2).insert("in");
c.select(c.getContentLength() - 2, 1).insertTyping("u");
c.enter().clear();
- expectedInput.add("+more inputinput");
+ expectedInput.add("input");
// inserted input is shorter than existing input partition
c.writeAndVerify("foo");
@@ -324,12 +399,251 @@ public class IOConsoleTests extends AbstractDebugTest {
c.enter().clear();
expectedInput.add("ABCabc123");
+ // insert at partition borders
+ c.writeAndVerify("###").insertTyping("def").writeAndVerify("###");
+ c.setCaretOffset(6).insertAndVerify("ghi");
+ c.setCaretOffset(3).insertTypingAndVerify("abc");
+ c.moveCaretToLineStart().insertTyping(":");
+ c.enter().clear();
+ expectedInput.add(":abcdefghi");
+
+ // try to overwrite read-only content
+ c.writeAndVerify("o\u00F6O").insertTyping("\u00EFiI").writeAndVerify("\u00D6\u00D8\u00F8");
+ // line content: oöOiïIÖØø
+ c.verifyContent("o\u00F6O" + "\u00EFiI" + "\u00D6\u00D8\u00F8").verifyPartitions(2);
+ c.select(4, 4).backspace();
+ c.verifyContent("o\u00F6O" + "\u00EF" + "\u00D6\u00D8\u00F8").verifyPartitions(2);
+ c.enter().clear();
+ expectedInput.add("\u00EF");
+
closeConsole(c, expectedInput.toArray(new String[0]));
}
/**
+ * Test enabling/disabling control character interpretation.
+ */
+ @Test
+ public void testControlCharacterSettings() throws Exception {
+ final IOConsoleTestUtil c = getTestUtil("Test options");
+
+ c.getConsole().setHandleControlCharacters(false);
+ c.getConsole().setCarriageReturnAsControlCharacter(false);
+ c.write("\r..");
+ assertEquals("Wrong number of lines.", 2, c.getDocument().getNumberOfLines());
+
+ c.getConsole().setCarriageReturnAsControlCharacter(true);
+ c.write("\r..");
+ assertEquals("Wrong number of lines.", 3, c.getDocument().getNumberOfLines());
+
+ c.getConsole().setHandleControlCharacters(true);
+ c.getConsole().setCarriageReturnAsControlCharacter(false);
+ c.write("\r..");
+ assertEquals("Wrong number of lines.", 4, c.getDocument().getNumberOfLines());
+
+ c.getConsole().setCarriageReturnAsControlCharacter(true);
+ c.write("\r..");
+ assertEquals("Wrong number of lines.", 4, c.getDocument().getNumberOfLines());
+
+ closeConsole(c);
+ assertNoError();
+ }
+
+ /**
+ * Test handling of <code>\b</code>.
+ */
+ @Test
+ public void testBackspaceControlCharacter() throws Exception {
+ final IOConsoleTestUtil c = getTestUtil("Test \\b");
+ c.getConsole().setCarriageReturnAsControlCharacter(false);
+ c.getConsole().setHandleControlCharacters(true);
+ try (IOConsoleOutputStream err = c.getConsole().newOutputStream()) {
+ // test simple backspace cases
+ c.write("\b").write("|").verifyContent("|").verifyPartitions();
+ c.writeFast("\b").write("/").verifyContent("/").verifyPartitions();
+ c.writeFast("\b\b\b").write("-\b").verifyContent("-").verifyPartitions();
+ c.writeFast("\b1\b2\b3\b").write("\\").verifyContent("\\").verifyPartitions();
+
+ // test existing output is overwritten independent from stream
+ c.clear();
+ c.writeFast("out").write("err", err).verifyContent("outerr").verifyPartitions(2);
+ c.writeFast("\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ c.writeFast("err", err).write("out").verifyContent("errout").verifyPartitions(2);
+ c.writeFast("\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ c.writeFast("12", err).writeFast("345").write("6789", err).verifyContent("123456789").verifyPartitions(3);
+
+ // test backspace stops at line start
+ c.clear();
+ c.writeFast("First line\n").writeFast("\b\b", err).writeFast("Zecond line");
+ c.writeFast("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ c.write("S", err).verifyContentByLine("First line", 0).verifyContentByLine("Second line", 1).verifyPartitions(2);
+
+ // test in combination with input partitions
+ c.clear();
+ c.writeAndVerify("out").insertTyping("input").writeAndVerify("err", err).verifyContent("outinputerr").verifyPartitions(3);
+ c.setCaretOffset(6).backspace().backspace().writeAndVerify("~~~").verifyContentByOffset("~~~", -3).verifyPartitions(3);
+ c.verifyContent("outiuterr~~~");
+ c.writeFast("\b\b\b\b\b\b\b\b\b\b\b\b\b");
+ c.write("output").verifyContent("outiutput~~~").verifyPartitions(3);
+ c.setCaretOffset(4).insertTyping("np").verifyContent("outinputput~~~").verifyPartitions(3);
+ c.write("+++++", err).verifyContent("outinputput+++++").verifyPartitions(3);
+ c.writeFast(String.join("", Collections.nCopies(11, "\b")));
+ c.write("err", err).verifyContent("errinputput+++++").verifyPartitions(3);
+
+ c.clear();
+ c.writeAndVerify("ooooo").insertTyping("iii").write("eeee", err).moveCaretToEnd().insertTyping("i").write("oo");
+ c.verifyContent("oooooiiieeeeioo").verifyPartitions(3);
+ c.writeFast(String.join("", Collections.nCopies(7, "\b")));
+ c.write("xx").verifyContent("ooooxiiixeeeioo").verifyPartitions(3);
+
+ c.clear();
+ c.insert("iiii").writeFast("\b").write("o").verifyContent("iiiio").verifyPartitions(2);
+ c.write("\b\bee", err).verifyContentByOffset("iiiiee", 0).verifyPartitions(2);
+ c.writeFast("\b\b\b\b\b\b\b\b", err).write("o").verifyContent("iiiioe").verifyPartitions(3);
+
+ // test if backspace overruns line breaks introduced by input
+ // (at the moment it should overrun those line breaks)
+ c.clear();
+ c.writeAndVerify("1", err).insertTyping("input").enter().write("2");
+ c.verifyContentByLine("1input", 0).verifyContentByLine("2", 1).verifyPartitions(3);
+ c.writeFast("\b\b\b\b\b\b\b\b\b\b\b\b\b", err);
+ c.write("???").verifyContentByLine("?input", 0).verifyContentByLine("??", 1).verifyPartitions(3);
+ c.writeFast("\b\b").writeFast("\b", err).write("><~");
+ c.verifyContentByLine(">input", 0).verifyContentByLine("<~", 1).verifyPartitions(3);
+
+ // test output cursor moves according to changed input
+ c.clear();
+ c.writeAndVerify("abc", err).insert("<>").write("def").verifyContent("abc<>def").verifyPartitions(3);
+ c.write("\b\b").setCaretOffset(4).insertTypingAndVerify("-=-").verifyContent("abc<-=->def").verifyPartitions(3);
+ c.moveCaret(-1).backspace().verifyContent("abc<-->def").verifyPartitions(3);
+ c.write("e\b\b\b\b", err).insertTyping("++").verifyContent("abc<-++->def").verifyPartitions(3);
+ c.select(0, c.getDocument().getLength()).backspace().write("b").verifyContent("abcdef").verifyPartitions(3);
+
+ // break output line
+ // NOTE: this may not be the desired behavior
+ c.clear();
+ c.writeFast("1.2.").writeFast("\b\b").write("\n");
+ c.verifyContentByLine("1.", 0).verifyContentByLine(".", 1).verifyPartitions();
+ c.writeFast("\b\b\b\b").write("2.");
+ c.verifyContentByLine("1.", 0).verifyContentByLine("2.", 1).verifyPartitions();
+ }
+ closeConsole(c);
+ assertNoError();
+ }
+
+ /**
+ * Test handling of <code>\r</code>.
+ */
+ @Test
+ public void testCarriageReturnControlCharacter() throws Exception {
+ final IOConsoleTestUtil c = getTestUtil("Test \\r");
+ c.getConsole().setCarriageReturnAsControlCharacter(true);
+ c.getConsole().setHandleControlCharacters(true);
+ try (IOConsoleOutputStream err = c.getConsole().newOutputStream()) {
+ // test simple carriage return cases
+ c.write("\r");
+ assertEquals("Wrong number of lines.", 1, c.getDocument().getNumberOfLines());
+ c.writeFast("bad", err).write("\rgood").verifyContent("good").verifyPartitions(1);
+ assertEquals("Wrong number of lines.", 1, c.getDocument().getNumberOfLines());
+
+ // test carriage return stops at line start
+ c.clear();
+ c.writeFast("First line\r\n").write("Zecond line", err);
+ c.verifyContentByLine("First line", 0).verifyContentByLine("Zecond line", 1).verifyPartitions(2);
+ assertEquals("Wrong number of lines.", 2, c.getDocument().getNumberOfLines());
+ c.writeFast("\r").write("3. ").verifyContentByLine("3. line", 1).verifyPartitions(2);
+ assertEquals("Wrong number of lines.", 2, c.getDocument().getNumberOfLines());
+ c.writeFast("\r\r\r", err).write("Second").verifyContentByLine("Second line", 1).verifyPartitions(2);
+ assertEquals("Wrong number of lines.", 2, c.getDocument().getNumberOfLines());
+
+ // test carriage return with input partitions
+ c.clear();
+ c.insertTypingAndVerify("input").writeFast("out\r").write("err", err);
+ c.verifyContent("inputerr").verifyPartitions(2);
+ c.enter().write("\rout").verifyContentByLine("inputout", 0).verifyPartitions(2);
+ c.write("err", err).verifyContentByLine("err", 1).verifyPartitions(3);
+ c.write("\roooooo").verifyContentByLine("inputooo", 0).verifyContentByLine("ooo", 1).verifyPartitions(2);
+
+ // test in combination with \r\n
+ c.clear();
+ c.write("\r\n");
+ assertEquals("Wrong number of lines.", 2, c.getDocument().getNumberOfLines());
+ c.writeFast("err", err).writeFast("\r\r\r\r\r\r\r\r\n\n").write("out");
+ assertEquals("Wrong number of lines.", 4, c.getDocument().getNumberOfLines());
+ c.verifyContentByLine("out", -1).verifyPartitions();
+ assertTrue("Line breaks did not overwrite text.", !c.getDocument().get().contains("err"));
+ }
+ closeConsole(c);
+ assertNoError();
+ }
+
+ /**
+ * Test handling of <code>\f</code>.
+ */
+ @Test
+ public void testFormFeedControlCharacter() throws Exception {
+ final IOConsoleTestUtil c = getTestUtil("Test \\f");
+ c.getConsole().setHandleControlCharacters(true);
+ try (IOConsoleOutputStream err = c.getConsole().newOutputStream()) {
+ c.write("\f");
+ assertEquals("Wrong number of lines.", 2, c.getDocument().getNumberOfLines());
+ c.verifyContentByLine("", 0).verifyContentByLine("", 1);
+ c.writeAndVerify("output").writeFast("\f").write("more");
+ c.verifyContentByLine("output", 1);
+ c.verifyContentByLine(" more", 2);
+ c.clear();
+ c.writeFast("\f\f").writeFast("\f", err).write("\fend").verifyPartitions(2);
+ assertEquals("Wrong number of lines.", 5, c.getDocument().getNumberOfLines());
+ c.verifyContentByLine("end", 4);
+ c.clear();
+ c.write("1st\f2nd\f3rd").verifyPartitions();
+ c.verifyContentByLine("1st", 0);
+ c.verifyContentByLine(" 2nd", 1);
+ c.verifyContentByLine(" 3rd", 2);
+
+ // test form feed mixed with backspaces
+ c.clear();
+ c.write("first\f\b\bsecond");
+ c.verifyContentByLine("first", 0);
+ c.verifyContentByLine(" second", 1);
+ c.clear();
+ c.writeFast("><\b").writeFast("\f", err).write("abc").verifyPartitions(2);
+ c.verifyContentByLine("><", 0);
+ c.verifyContentByLine(" abc", 1);
+
+ // test with input partitions. At the moment input is
+ // considered for the indentation
+ c.clear();
+ c.writeAndVerify("foo").insertTyping("input").writeFast("bar").write("\f.", err).verifyPartitions(2);
+ c.verifyContentByLine("fooinputbar", 0);
+ c.verifyContentByLine(" .", 1);
+ }
+ closeConsole(c);
+ }
+
+ /**
+ * Test handling of <code>\0</code>.
+ */
+ @Test
+ public void testNullByte() throws Exception {
+ final IOConsoleTestUtil c = getTestUtil("Test \\0");
+ c.getConsole().setHandleControlCharacters(true);
+ try (IOConsoleOutputStream err = c.getConsole().newOutputStream()) {
+ c.write("\u0000").verifyContent("");
+ c.write("abc\u0000123").verifyContent("abc123");
+ c.writeFast("\u0000", err).writeAndVerify("output");
+ c.write("\n\u0000x\u0000y\u0000z\u0000\u0000\u0000987", err).verifyContentByLine("xyz987", 1).verifyPartitions();
+ assertFalse(c.getDocument().get().contains("\u0000"));
+
+ c.clear();
+ c.writeFast("123").writeFast("\b\b\b").write("+\u0000+").verifyContent("++3").verifyPartitions();
+ }
+ closeConsole(c);
+ }
+
+ /**
* Test larger number of partitions with pseudo random console content.
*/
+ @Test
public void testManyPartitions() throws IOException {
final IOConsoleTestUtil c = getTestUtil("Test many partitions");
final List<String> expectedInput = new ArrayList<>();
@@ -371,28 +685,32 @@ public class IOConsoleTests extends AbstractDebugTest {
/**
* Test console trimming.
*/
+ @Test
public void testTrim() throws Exception {
final IOConsoleTestUtil c = getTestUtil("Test trim");
- try (IOConsoleOutputStream otherOut = c.getConsole().newOutputStream()) {
- c.writeFast("first\n");
- for (int i = 0; i < 20; i++) {
- c.writeFast("0123456789\n", (i & 1) == 0 ? c.getDefaultOutputStream() : otherOut);
+ try (IOConsoleOutputStream defaultOut = c.getDefaultOutputStream()) {
+ try (IOConsoleOutputStream otherOut = c.getConsole().newOutputStream()) {
+ c.writeFast("first\n");
+ for (int i = 0; i < 20; i++) {
+ c.writeFast("0123456789\n", (i & 1) == 0 ? defaultOut : otherOut);
+ }
+ c.write("last\n");
+ c.verifyContentByLine("first", 0).verifyContentByLine("last", -2);
+ assertTrue("Document not filled.", c.getDocument().getNumberOfLines() > 15);
+
+ c.getConsole().setWaterMarks(50, 100);
+ c.waitForScheduledJobs();
+ c.verifyContentByOffset("0123456789", 0);
+ assertTrue("Document not trimmed.", c.getDocument().getNumberOfLines() < 15);
}
- c.write("last\n");
- c.verifyContentByLine("first", 0).verifyContentByLine("last", -2);
- assertTrue("Document not filled.", c.getDocument().getNumberOfLines() > 15);
-
- c.getConsole().setWaterMarks(50, 100);
- c.waitForScheduledJobs();
- c.verifyContentByOffset("0123456789", 0);
- assertTrue("Document not trimmed.", c.getDocument().getNumberOfLines() < 15);
+ closeConsole(c);
}
- closeConsole(c);
}
/**
* Some extra tests for IOConsolePartitioner.
*/
+ @Test
public void testIOPartitioner() throws Exception {
final IOConsoleTestUtil c = getTestUtil("Test partitioner");
@@ -413,6 +731,207 @@ public class IOConsoleTests extends AbstractDebugTest {
c.verifyContent("()").verifyPartitions();
closeConsole(c);
- assertEquals("Test triggered errors in IOConsole.", 0, loggedErrors.get());
+ assertNoError();
+ }
+
+ /**
+ * Tests for the {@link IConsoleDocumentPartitioner} interface.
+ */
+ @Test
+ public void testIConsoleDocumentPartitioner() throws Exception {
+ final IOConsoleTestUtil c = getTestUtil("Test IConsoleDocumentPartitioner");
+ try (IOConsoleOutputStream otherOut = c.getConsole().newOutputStream()) {
+ StyleRange[] styles = c.getPartitioner().getStyleRanges(0, 1);
+ assertEquals("Got fake styles.", 0, (styles == null ? 0 : styles.length));
+
+ c.insertAndVerify("#\n");
+ c.insertTyping("L");
+ c.writeFast("orem ipsum dolor sit amet, consetetur sadipscing elitr,\n");
+ c.writeFast("sed diam nonumy eirmod tempor invidunt ut labore et dolore\n", otherOut);
+ c.writeFast("magna aliquyam erat, sed diam voluptua. At vero eos et accusam\n");
+ c.writeFast("et justo duo dolores et ea rebum. Stet clita kasd gubergren,\n", otherOut);
+ c.write("no sea takimata sanctus est Lorem ipsum dolor sit amet.\n");
+ final int loremEnd = c.getContentLength();
+ c.moveCaretToEnd().insertTypingAndVerify("--").writeAndVerify("ooo");
+ c.setCaretLineRelative(1).insertTypingAndVerify("-");
+ c.verifyContentByLine("---ooo", -1);
+
+
+ styles = c.getPartitioner().getStyleRanges(0, c.getContentLength());
+ checkOverlapping(styles);
+ assertNotNull("Partitioner provided no styles.", styles);
+ assertTrue("Expected more styles.", styles.length >= 3);
+
+ styles = c.getPartitioner().getStyleRanges(5, 20);
+ checkOverlapping(styles);
+ assertNotNull("Partitioner provided no styles.", styles);
+ assertEquals("Number of styles:", 1, styles.length);
+
+ styles = c.getPartitioner().getStyleRanges(loremEnd + 1, 1);
+ checkOverlapping(styles);
+ assertNotNull("Partitioner provided no styles.", styles);
+ assertEquals("Number of styles:", 1, styles.length);
+
+ styles = c.getPartitioner().getStyleRanges(loremEnd, c.getContentLength() - loremEnd);
+ checkOverlapping(styles);
+ assertNotNull("Partitioner provided no styles.", styles);
+ assertEquals("Number of styles:", 2, styles.length);
+
+ styles = c.getPartitioner().getStyleRanges(loremEnd - 3, 5);
+ checkOverlapping(styles);
+ assertNotNull("Partitioner provided no styles.", styles);
+ assertEquals("Number of styles:", 2, styles.length);
+
+ styles = c.getPartitioner().getStyleRanges(loremEnd - 3, 8);
+ checkOverlapping(styles);
+ assertNotNull("Partitioner provided no styles.", styles);
+ assertEquals("Number of styles:", 3, styles.length);
+
+
+ assertTrue("Offset should be read-only.", c.getPartitioner().isReadOnly(0));
+ assertTrue("Offset should be read-only.", c.getPartitioner().isReadOnly(1));
+ assertFalse("Offset should be writable.", c.getPartitioner().isReadOnly(2));
+ for (int i = 3; i < loremEnd; i++) {
+ assertTrue("Offset should be read-only.", c.getPartitioner().isReadOnly(i));
+ }
+ assertFalse("Offset should be writable.", c.getPartitioner().isReadOnly(loremEnd + 0));
+ assertFalse("Offset should be writable.", c.getPartitioner().isReadOnly(loremEnd + 1));
+ assertFalse("Offset should be writable.", c.getPartitioner().isReadOnly(loremEnd + 2));
+ assertTrue("Offset should be read-only.", c.getPartitioner().isReadOnly(loremEnd + 3));
+ assertTrue("Offset should be read-only.", c.getPartitioner().isReadOnly(loremEnd + 4));
+ assertTrue("Offset should be read-only.", c.getPartitioner().isReadOnly(loremEnd + 5));
+
+ if (c.getPartitioner() instanceof IConsoleDocumentPartitionerExtension) {
+ final IConsoleDocumentPartitionerExtension extension = (IConsoleDocumentPartitionerExtension) c.getPartitioner();
+ assertFalse("Writable parts not recognized.", extension.isReadOnly(0, c.getContentLength()));
+ assertTrue("Read-only parts not recognized.", extension.containsReadOnly(0, c.getContentLength()));
+ assertFalse("Writable parts not recognized.", extension.isReadOnly(0, 3));
+ assertTrue("Read-only parts not recognized.", extension.containsReadOnly(0, 3));
+ assertFalse("Area should be writable.", extension.isReadOnly(loremEnd, 3));
+ assertFalse("Area should be writable.", extension.containsReadOnly(loremEnd, 3));
+ assertTrue("Area should be read-only.", extension.isReadOnly(6, 105));
+ assertTrue("Area should be read-only.", extension.containsReadOnly(8, 111));
+
+ assertTrue("Read-only parts not found.", extension.computeReadOnlyPartitions().length > 0);
+ assertTrue("Writable parts not found.", extension.computeWritablePartitions().length > 0);
+ assertTrue("Read-only parts not found.", extension.computeReadOnlyPartitions(loremEnd - 5, 7).length > 0);
+ assertTrue("Writable parts not found.", extension.computeWritablePartitions(loremEnd - 5, 7).length > 0);
+ assertTrue("Area should be read-only.", extension.computeReadOnlyPartitions(5, 100).length > 0);
+ assertEquals("Area should be read-only.", 0, extension.computeWritablePartitions(5, 100).length);
+ assertEquals("Area should be writable.", 0, extension.computeReadOnlyPartitions(loremEnd, 2).length);
+ assertTrue("Area should be writable.", extension.computeWritablePartitions(loremEnd, 2).length > 0);
+
+ assertEquals("Got wrong offset.", 0, extension.getNextOffsetByState(0, false));
+ assertEquals("Got wrong offset.", 2, extension.getNextOffsetByState(0, true));
+ assertEquals("Got wrong offset.", 0, extension.getPreviousOffsetByState(0, false));
+ assertEquals("Got wrong offset.", -1, extension.getPreviousOffsetByState(0, true));
+ assertEquals("Got wrong offset.", 1, extension.getNextOffsetByState(1, false));
+ assertEquals("Got wrong offset.", 2, extension.getNextOffsetByState(1, true));
+ assertEquals("Got wrong offset.", 1, extension.getPreviousOffsetByState(1, false));
+ assertEquals("Got wrong offset.", -1, extension.getPreviousOffsetByState(1, true));
+ assertEquals("Got wrong offset.", 3, extension.getNextOffsetByState(2, false));
+ assertEquals("Got wrong offset.", 2, extension.getNextOffsetByState(2, true));
+ assertEquals("Got wrong offset.", 1, extension.getPreviousOffsetByState(2, false));
+ assertEquals("Got wrong offset.", 2, extension.getPreviousOffsetByState(2, true));
+ for (int i = 3; i < loremEnd; i++) {
+ assertEquals("Got wrong offset.", i, extension.getNextOffsetByState(i, false));
+ assertEquals("Got wrong offset.", loremEnd, extension.getNextOffsetByState(i, true));
+ assertEquals("Got wrong offset.", i, extension.getPreviousOffsetByState(i, false));
+ assertEquals("Got wrong offset.", 2, extension.getPreviousOffsetByState(i, true));
+ }
+ assertEquals("Got wrong offset.", loremEnd + 3, extension.getNextOffsetByState(loremEnd, false));
+ assertEquals("Got wrong offset.", loremEnd, extension.getNextOffsetByState(loremEnd, true));
+ assertEquals("Got wrong offset.", loremEnd - 1, extension.getPreviousOffsetByState(loremEnd, false));
+ assertEquals("Got wrong offset.", loremEnd, extension.getPreviousOffsetByState(loremEnd, true));
+ assertEquals("Got wrong offset.", loremEnd + 3, extension.getNextOffsetByState(loremEnd + 2, false));
+ assertEquals("Got wrong offset.", loremEnd + 2, extension.getNextOffsetByState(loremEnd + 2, true));
+ assertEquals("Got wrong offset.", loremEnd - 1, extension.getPreviousOffsetByState(loremEnd + 2, false));
+ assertEquals("Got wrong offset.", loremEnd + 2, extension.getPreviousOffsetByState(loremEnd + 2, true));
+ } else {
+ TestUtil.log(IStatus.INFO, TestsPlugin.PLUGIN_ID, "IOConsole partitioner does not implement " + IConsoleDocumentPartitionerExtension.class.getName() + ". Skip those tests.");
+ }
+ }
+ c.verifyPartitions();
+ closeConsole(c, "#");
+ assertNoError();
+ }
+
+ /**
+ * Regression test for deadlock in stream processing.
+ */
+ @Test
+ public void testBug421303_StreamProcessingDeadlock() throws Exception {
+ // Test situation is that UI thread and another thread both write a
+ // large amount of output into same IOConsoleOutputStream at same time
+ // where the non-UI thread is writing first.
+ // Test includes a watchdog thread which will break the deadlock (if
+ // happened) so the test can end in a reasonable amount of time.
+ final IOConsoleTestUtil c = getTestUtil("Test Bug 421303 Stream processing deadlock");
+ final String veryLongString = String.join("", Collections.nCopies(20000, "0123456789"));
+ final Exception[] jobException = new Exception[1];
+ final AtomicBoolean deadlocked = new AtomicBoolean(false);
+ Job job = new Job("Async out") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ synchronized (c) {
+ c.notifyAll();
+ }
+ try {
+ c.writeFast(veryLongString);
+ } catch (IOException e) {
+ jobException[0] = e;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ Thread watchdog = new Thread(() -> {
+ try {
+ Thread.sleep(testTimeout);
+ synchronized (c) {
+ c.notifyAll();
+ }
+ if (job.getThread() != null && job.getThread().isAlive()) {
+ deadlocked.set(true);
+ job.getThread().interrupt();
+ }
+ } catch (InterruptedException e) {
+ }
+ }, "Watchdog");
+ watchdog.setDaemon(true);
+ watchdog.start();
+
+ synchronized (c) {
+ job.schedule();
+ c.wait();
+ }
+ // ensure other thread is writing first
+ Thread.yield();
+ Thread.sleep(50);
+ c.writeFast(veryLongString);
+
+ watchdog.interrupt();
+ watchdog.join(1000);
+ if (jobException[0] != null) {
+ throw jobException[0];
+ }
+ assertFalse("Deadlock in stream processing.", deadlocked.get());
+ closeConsole(c);
+ }
+
+ /**
+ * Check if there is any offset which received two styles.
+ *
+ * @param styles the styles to check
+ */
+ private void checkOverlapping(StyleRange[] styles) {
+ if (styles == null || styles.length <= 1) {
+ return;
+ }
+ Arrays.sort(styles, (a, b) -> Integer.compare(a.start, b.start));
+ int lastEnd = Integer.MIN_VALUE;
+ for (StyleRange s : styles) {
+ assertTrue("Styles overlap.", lastEnd <= s.start);
+ lastEnd = s.start + s.length;
+ }
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java
new file mode 100644
index 000000000..45f77569d
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/InputStreamMonitorTests.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.console;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.nio.charset.Charset;
+import java.util.Set;
+import java.util.function.Supplier;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.internal.core.InputStreamMonitor;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.eclipse.debug.tests.TestUtil;
+import org.eclipse.debug.tests.TestsPlugin;
+import org.junit.Test;
+
+/**
+ * Tests the {@link InputStreamMonitor}.
+ */
+public class InputStreamMonitorTests extends AbstractDebugTest {
+
+ /**
+ * Simple test for input stream monitor. Write some bytes before starting
+ * the monitor, some after and check if they are correctly transfered.
+ */
+ @Test
+ @SuppressWarnings("resource")
+ public void testInputStreamMonitor() throws Exception {
+ PipedInputStream sysin = new PipedInputStream();
+ InputStreamMonitor monitor = new InputStreamMonitor(new PipedOutputStream(sysin));
+
+ byte[] content = new byte[100];
+ for (int i = 0; i < content.length; i++) {
+ content[i] = (byte) (i % 255);
+ }
+ try {
+ int half = content.length / 2;
+ monitor.write(content, 0, half);
+ monitor.startMonitoring();
+ monitor.write(content, half, content.length - half);
+ Thread.sleep(30);
+
+ byte[] readBack = new byte[content.length];
+ int read = sysin.read(readBack);
+ assertEquals("Monitor wrote to few bytes.", read, content.length);
+ assertEquals("Monitor wrote to much bytes.", 0, sysin.available());
+ assertArrayEquals("Monitor wrote wrong content.", content, readBack);
+ } finally {
+ monitor.close();
+ }
+ }
+
+ /**
+ * Test that passing <code>null</code> as charset does not raise exceptions.
+ */
+ @Test
+ @SuppressWarnings("resource")
+ public void testNullCharset() throws Exception {
+ PipedInputStream sysin = new PipedInputStream();
+ InputStreamMonitor monitor = new InputStreamMonitor(new PipedOutputStream(sysin), (Charset) null);
+ String text = "o\u00F6O\u00EFiI\u00D6\u00D8\u00F8";
+ try {
+ monitor.startMonitoring();
+ monitor.write(text);
+ Thread.sleep(30);
+
+ byte[] readBack = new byte[1000];
+ int len = sysin.read(readBack);
+ assertEquals("Monitor wrote wrong content.", text, new String(readBack, 0, len));
+ } finally {
+ monitor.close();
+ }
+ }
+
+ /**
+ * Test different combinations of stream closing.
+ */
+ @Test
+ @SuppressWarnings("resource")
+ public void testClose() throws Exception {
+ String threadName = "MAGICtestClose";
+ Supplier<Long> getInputStreamMonitorThreads = () -> {
+ Set<Thread> allThreads = Thread.getAllStackTraces().keySet();
+ long numMonitorThreads = allThreads.stream().filter(t -> t.getName().contains(threadName)).count();
+ return numMonitorThreads;
+ };
+ long alreadyLeakedThreads = getInputStreamMonitorThreads.get();
+ if (alreadyLeakedThreads > 0) {
+ Platform.getLog(TestsPlugin.class).warn("Test started with " + alreadyLeakedThreads + " leaked monitor threads.");
+ }
+
+ {
+ ClosableTestOutputStream testStream = new ClosableTestOutputStream();
+ InputStreamMonitor monitor = new InputStreamMonitor(testStream);
+ assertEquals("Stream closed to early.", 0, testStream.numClosed);
+ monitor.closeInputStream();
+ TestUtil.waitWhile(() -> testStream.numClosed == 0, 100);
+ assertEquals("Stream not closed.", 1, testStream.numClosed);
+ }
+ {
+ ClosableTestOutputStream testStream = new ClosableTestOutputStream();
+ InputStreamMonitor monitor = new InputStreamMonitor(testStream);
+ monitor.startMonitoring(threadName);
+ assertEquals("Stream closed to early.", 0, testStream.numClosed);
+ monitor.close();
+ TestUtil.waitWhile(() -> testStream.numClosed == 0, 200);
+ assertEquals("Stream not closed.", 1, testStream.numClosed);
+ }
+ {
+ ClosableTestOutputStream testStream = new ClosableTestOutputStream();
+ InputStreamMonitor monitor = new InputStreamMonitor(testStream);
+ monitor.startMonitoring(threadName);
+ assertEquals("Stream closed to early.", 0, testStream.numClosed);
+ monitor.closeInputStream();
+ monitor.close();
+ monitor.close();
+ TestUtil.waitWhile(() -> testStream.numClosed == 0, 100);
+ assertEquals("Stream not closed or to often.", 1, testStream.numClosed);
+ }
+
+ TestUtil.waitWhile(() -> getInputStreamMonitorThreads.get() > 0, 500);
+ assertEquals("Leaked monitor threads.", 0, (long) getInputStreamMonitorThreads.get());
+ }
+
+ /**
+ * Extension of output stream to log calls to {@link #close()}.
+ */
+ public static class ClosableTestOutputStream extends OutputStream {
+ public volatile int numClosed = 0;
+
+ @Override
+ public void close() throws IOException {
+ numClosed++;
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ }
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java
index 7bd305e18..c615cb40b 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcess.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 Paul Pazderski and others.
+ * Copyright (c) 2019, 2020 Paul Pazderski and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,14 +15,21 @@ package org.eclipse.debug.tests.console;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.RuntimeProcess;
+import org.eclipse.debug.tests.launching.LaunchConfigurationTests;
/**
* A mockup process which can either simulate generation of output or wait for
@@ -57,6 +64,39 @@ public class MockProcess extends Process {
* </p>
*/
private long endTime;
+ /** The simulated exit code. */
+ private int exitCode = 0;
+
+ /** The child/sub mock-processes of this mock-process. */
+ private Optional<MockProcessHandle> handle = Optional.of(new MockProcessHandle(this));
+
+ /** The delay after a call to destroy() until actual termination. */
+ private int terminationDelay = 0;
+
+ /**
+ * For mode used by constructor {@link MockProcess#MockProcess()} this
+ * indicates via stdout what the state of the process is.
+ */
+ public static enum ProcessState {
+ RUNNING('R'), DESTROYING('D'),
+ /**
+ * Last read is special as it should only be returned once to ensure
+ * that we get the last character on the stream.
+ */
+ LASTREAD('L'), TERMINATED(-1);
+
+ private int code;
+
+ ProcessState(int c) {
+ this.code = c;
+ }
+
+ public int getCode() {
+ return code;
+ }
+ }
+
+ private volatile ProcessState processState = ProcessState.RUNNING;
/**
* Create new silent mockup process which runs for a given amount of time.
@@ -127,6 +167,39 @@ public class MockProcess extends Process {
}
/**
+ * Create a new mock process that the stdout stream will indicate status of
+ * the process. The codes are defined by {@link ProcessState#getCode()}
+ */
+ public MockProcess() {
+ super();
+ this.stderr = new ByteArrayInputStream(new byte[0]);
+ this.endTime = RUN_FOREVER;
+ this.stdout = new InputStream() {
+ @Override
+ public int read() throws IOException {
+ if (processState == ProcessState.LASTREAD) {
+ /*
+ * This sleep makes
+ * RuntimeProcessTests.testOutputAfterDestroy() fail because
+ * RuntimeProcess.terminate does not wait until the monitor
+ * threads completes. The sleep here just helps amplify a
+ * the thread scheduling decision that otherwise makes
+ * testOutputAfterDestroy unstable (as reported in Bug
+ * 577185)
+ */
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ }
+ processState = ProcessState.TERMINATED;
+ return ProcessState.LASTREAD.getCode();
+ }
+ return processState.getCode();
+ }
+ };
+ }
+
+ /**
* Get bytes received through stdin since last invocation of this method.
* <p>
* Not thread safe. It may miss some input if new content is written while
@@ -158,6 +231,15 @@ public class MockProcess extends Process {
}
@Override
+ public ProcessHandle toHandle() {
+ if (handle.isPresent()) {
+ return handle.get();
+ }
+ // let super implementation throw the UnsupportedOperationException
+ return super.toHandle();
+ }
+
+ @Override
public int waitFor() throws InterruptedException {
synchronized (waitForTerminationLock) {
while (!isTerminated()) {
@@ -171,7 +253,28 @@ public class MockProcess extends Process {
}
}
}
- return 0;
+ setTerminated();
+ return exitCode;
+ }
+
+ @Override
+ public boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException {
+ long remainingMs = unit.toMillis(timeout);
+ final long timeoutMs = System.currentTimeMillis() + remainingMs;
+ synchronized (waitForTerminationLock) {
+ while (!isTerminated() && remainingMs > 0) {
+ long waitTime = endTime == RUN_FOREVER ? Long.MAX_VALUE : endTime - System.currentTimeMillis();
+ waitTime = Math.min(waitTime, remainingMs);
+ if (waitTime > 0) {
+ waitForTerminationLock.wait(waitTime);
+ }
+ remainingMs = timeoutMs - System.currentTimeMillis();
+ }
+ }
+ if (isTerminated()) {
+ setTerminated();
+ }
+ return isTerminated();
}
@Override
@@ -180,14 +283,28 @@ public class MockProcess extends Process {
final String end = (endTime == RUN_FOREVER ? "never." : "in " + (endTime - System.currentTimeMillis()) + " ms.");
throw new IllegalThreadStateException("Mockup process terminates " + end);
}
- return 0;
+ return exitCode;
}
@Override
public void destroy() {
+ destroy(terminationDelay);
+ }
+
+ /**
+ * Simulate a delay for the mockup process shutdown.
+ *
+ * @param delay amount of milliseconds must pass after destroy was called
+ * and before the mockup process goes in terminated state
+ */
+ public void destroy(int delay) {
+ processState = ProcessState.DESTROYING;
synchronized (waitForTerminationLock) {
- endTime = System.currentTimeMillis();
+ endTime = System.currentTimeMillis() + delay;
waitForTerminationLock.notifyAll();
+ if (delay <= 0) {
+ setTerminated();
+ }
}
}
@@ -197,7 +314,36 @@ public class MockProcess extends Process {
* @return <code>true</code> if process is terminated
*/
private boolean isTerminated() {
- return endTime != RUN_FOREVER && System.currentTimeMillis() > endTime;
+ return endTime != RUN_FOREVER && System.currentTimeMillis() >= endTime;
+ }
+
+ /**
+ * Set the exit code returned once the process is finished.
+ *
+ * @param exitCode new exit code
+ */
+ public void setExitValue(int exitCode) {
+ this.exitCode = exitCode;
+ }
+
+ /**
+ * Set the {@link ProcessHandle} of the process. A null value indices that
+ * this process does not support {@link Process#toHandle()}.
+ *
+ * @param handle new process handle
+ */
+ public void setHandle(MockProcessHandle handle) {
+ this.handle = Optional.ofNullable(handle);
+ }
+
+ /**
+ * Set the delay between a call to destroy and the termination of this
+ * process.
+ *
+ * @param delay the delay after a call to destroy() until actual termination
+ */
+ public void setTerminationDelay(int delay) {
+ this.terminationDelay = delay;
}
/**
@@ -226,4 +372,37 @@ public class MockProcess extends Process {
public RuntimeProcess toRuntimeProcess(String name) {
return (RuntimeProcess) DebugPlugin.newProcess(new Launch(null, ILaunchManager.RUN_MODE, null), this, name);
}
+
+ /**
+ * Create a {@link RuntimeProcess} which wraps this {@link MockProcess}.
+ * <p>
+ * This method also attaches a
+ * {@link LaunchConfigurationTests#ID_TEST_LAUNCH_TYPE} launch configuration
+ * to the {@link RuntimeProcess}.
+ * </p>
+ *
+ * @param name name for the process and launch configuration
+ * @return the created {@link RuntimeProcess}
+ */
+ public RuntimeProcess toRuntimeProcess(String name, Map<String, Object> launchConfigAttributes) throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchType = launchManager.getLaunchConfigurationType(LaunchConfigurationTests.ID_TEST_LAUNCH_TYPE);
+ ILaunchConfigurationWorkingCopy launchConfiguration = launchType.newInstance(null, name);
+ if (launchConfigAttributes != null) {
+ launchConfiguration.setAttributes(launchConfigAttributes);
+ }
+ return (RuntimeProcess) DebugPlugin.newProcess(new Launch(launchConfiguration, ILaunchManager.RUN_MODE, null), this, name);
+ }
+
+ /**
+ * Move state machines to terminated.
+ */
+ private void setTerminated() {
+ synchronized (this) {
+ if (processState != ProcessState.TERMINATED) {
+ processState = ProcessState.LASTREAD;
+ }
+ }
+ handle.ifPresent(MockProcessHandle::setTerminated);
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcessHandle.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcessHandle.java
new file mode 100644
index 000000000..a9f0b5609
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/MockProcessHandle.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Hannes Wellmann and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Hannes Wellmann - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.tests.console;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * A mockup ProcessHandle which works in conjunction with {@link MockProcess}.
+ */
+public class MockProcessHandle implements ProcessHandle {
+
+ private final MockProcess process;
+ private final Collection<ProcessHandle> children;
+ private final CompletableFuture<ProcessHandle> onExit = new CompletableFuture<>();
+
+ /**
+ * Create new mockup process handle for a process without children.
+ *
+ * @param process the process of this handle
+ */
+ public MockProcessHandle(MockProcess process) {
+ this(process, Collections.emptyList());
+ }
+
+ /**
+ * Create new mockup process handle for a process with the given children.
+ *
+ * @param process the process of this handle
+ * @param children the child-processes of the given process
+ */
+ public MockProcessHandle(MockProcess process, Collection<Process> children) {
+ this.process = process;
+ this.children = children.stream().map(Process::toHandle).collect(Collectors.toUnmodifiableList());
+ }
+
+ @Override
+ public Stream<ProcessHandle> children() {
+ return this.children.stream();
+ }
+
+ @Override
+ public Stream<ProcessHandle> descendants() {
+ return Stream.concat(children(), children().flatMap(ProcessHandle::descendants));
+ }
+
+ @Override
+ public CompletableFuture<ProcessHandle> onExit() {
+ return onExit; // onExit must be completed by process
+ }
+
+ @Override
+ public boolean supportsNormalTermination() {
+ return true;
+ }
+
+ @Override
+ public boolean destroy() {
+ process.destroy();
+ return true;
+ }
+
+ @Override
+ public boolean destroyForcibly() {
+ return destroy();
+ }
+
+ @Override
+ public boolean isAlive() {
+ return process.isAlive();
+ }
+
+ @Override
+ public int compareTo(ProcessHandle other) {
+ return Long.compare(pid(), ((MockProcessHandle) other).pid());
+ }
+
+ /**
+ * Notify this handle that this mock-process has terminated. If this is not
+ * called handles of descendant processes do not know about the termination
+ * (and for descendants only the handle is queried, not the process itself).
+ */
+ void setTerminated() {
+ onExit.complete(this);
+ }
+
+ // not yet implemented methods
+
+ @Override
+ public long pid() {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public Optional<ProcessHandle> parent() {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ @Override
+ public Info info() {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java
new file mode 100644
index 000000000..523192ae2
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/OutputStreamMonitorTests.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.console;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.PrintStream;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+import org.eclipse.debug.core.IBinaryStreamListener;
+import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IBinaryStreamMonitor;
+import org.eclipse.debug.core.model.IStreamMonitor;
+import org.eclipse.debug.internal.core.OutputStreamMonitor;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.eclipse.debug.tests.TestUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the {@link OutputStreamMonitor}.
+ */
+public class OutputStreamMonitorTests extends AbstractDebugTest {
+
+ /** Stream to simulate an application writing to system out. */
+ PipedOutputStream sysout = new PipedOutputStream();
+ /** The {@link OutputStreamMonitor} used for the test runs. */
+ TestOutputStreamMonitor monitor;
+ /** The bytes received through listener. */
+ ByteArrayOutputStream notifiedBytes = new ByteArrayOutputStream();
+ /** The strings received through listener. */
+ StringBuilder notifiedChars = new StringBuilder();
+
+ IBinaryStreamListener fBinaryListener = new IBinaryStreamListener() {
+ @Override
+ public void streamAppended(byte[] data, IBinaryStreamMonitor mon) {
+ if (monitor == mon) {
+ try {
+ notifiedBytes.write(data);
+ } catch (IOException e) {
+ }
+ }
+ }
+ };
+ IStreamListener fStreamListener = new IStreamListener() {
+ @Override
+ public void streamAppended(String text, IStreamMonitor mon) {
+ if (monitor == mon) {
+ notifiedChars.append(text);
+ }
+ }
+ };
+
+ @Override
+ @Before
+ @SuppressWarnings("resource")
+ public void setUp() throws IOException {
+ monitor = new TestOutputStreamMonitor(new PipedInputStream(sysout), StandardCharsets.UTF_8);
+ }
+
+ /**
+ * Simple test for output stream monitor. Test buffering and listeners.
+ */
+ @Test
+ public void testBufferedOutputStreamMonitor() throws Exception {
+ String input = "o\u00F6O";
+ byte[] byteInput = input.getBytes(StandardCharsets.UTF_8);
+ try {
+ monitor.addBinaryListener(fBinaryListener);
+ monitor.addListener(fStreamListener);
+
+ sysout.write(byteInput, 0, 2);
+ sysout.flush();
+ monitor.startMonitoring();
+ TestUtil.waitWhile(() -> notifiedBytes.size() < 2, 1000);
+ String contents = monitor.getContents();
+ assertEquals("Monitor read wrong content.", input.substring(0, 1), contents);
+ assertEquals("Notified and buffered content differ.", contents, notifiedChars.toString());
+ assertEquals("Failed to access buffered content twice.", contents, monitor.getContents());
+ byte[] data = monitor.getData();
+ byte[] expected = new byte[2];
+ System.arraycopy(byteInput, 0, expected, 0, 2);
+ assertArrayEquals("Monitor read wrong binary content.", expected, data);
+ assertArrayEquals("Notified and buffered binary content differ.", data, notifiedBytes.toByteArray());
+ assertArrayEquals("Failed to access buffered binary content twice.", data, monitor.getData());
+
+ monitor.flushContents();
+ sysout.write(byteInput, 2, byteInput.length - 2);
+ sysout.flush();
+ TestUtil.waitWhile(() -> notifiedBytes.size() < byteInput.length, 1000);
+ contents = monitor.getContents();
+ assertEquals("Monitor buffered wrong content.", input.substring(1), contents);
+ assertEquals("Failed to access buffered content twice.", contents, monitor.getContents());
+ assertEquals("Wrong content through listener.", input, notifiedChars.toString());
+ data = monitor.getData();
+ expected = new byte[byteInput.length - 2];
+ System.arraycopy(byteInput, 2, expected, 0, expected.length);
+ assertArrayEquals("Monitor read wrong binary content.", expected, data);
+ assertArrayEquals("Failed to access buffered binary content twice.", data, monitor.getData());
+ assertArrayEquals("Wrong binary content through listener.", byteInput, notifiedBytes.toByteArray());
+ } finally {
+ sysout.close();
+ monitor.close();
+ }
+ }
+
+ /**
+ * Simple test for output stream monitor. Test listeners without buffering.
+ */
+ @Test
+ public void testUnbufferedOutputStreamMonitor() throws Exception {
+ String input = "o\u00F6O";
+ byte[] byteInput = input.getBytes(StandardCharsets.UTF_8);
+ try {
+ monitor.addBinaryListener(fBinaryListener);
+ monitor.addListener(fStreamListener);
+
+ sysout.write(byteInput, 0, 2);
+ sysout.flush();
+ monitor.setBuffered(false);
+ monitor.startMonitoring();
+ TestUtil.waitWhile(() -> notifiedBytes.size() < 2, 1000);
+ assertEquals("Monitor read wrong content.", input.substring(0, 1), notifiedChars.toString());
+ byte[] expected = new byte[2];
+ System.arraycopy(byteInput, 0, expected, 0, 2);
+ assertArrayEquals("Monitor read wrong binary content.", expected, notifiedBytes.toByteArray());
+
+ monitor.flushContents();
+ sysout.write(byteInput, 2, byteInput.length - 2);
+ sysout.flush();
+ TestUtil.waitWhile(() -> notifiedBytes.size() < byteInput.length, 1000);
+ assertEquals("Wrong content through listener.", input, notifiedChars.toString());
+ expected = new byte[byteInput.length - 2];
+ System.arraycopy(byteInput, 2, expected, 0, expected.length);
+ assertArrayEquals("Wrong binary content through listener.", byteInput, notifiedBytes.toByteArray());
+ } finally {
+ sysout.close();
+ monitor.close();
+ }
+ }
+
+ /**
+ * Test that passing <code>null</code> as charset does not raise exceptions.
+ */
+ @Test
+ @SuppressWarnings("resource")
+ public void testNullCharset() throws Exception {
+ String input = "o\u00F6O\u00EFiI\u00D6\u00D8\u00F8";
+
+ sysout.close();
+ sysout = new PipedOutputStream();
+ monitor.close();
+ monitor = new TestOutputStreamMonitor(new PipedInputStream(sysout), null);
+ try {
+ monitor.addListener(fStreamListener);
+ monitor.startMonitoring();
+ try (PrintStream out = new PrintStream(sysout)) {
+ out.print(input);
+ }
+ sysout.flush();
+
+ TestUtil.waitWhile(() -> notifiedChars.length() < input.length(), 500);
+ assertEquals("Monitor read wrong content.", input, notifiedChars.toString());
+ } finally {
+ sysout.close();
+ monitor.close();
+ }
+ }
+
+ /**
+ * {@link OutputStreamMonitor} with public {@link #startMonitoring()} for
+ * testing.
+ */
+ private static class TestOutputStreamMonitor extends OutputStreamMonitor {
+
+ public TestOutputStreamMonitor(InputStream stream, Charset charset) {
+ super(stream, charset);
+ }
+
+ public void startMonitoring() {
+ super.startMonitoring("");
+ }
+
+ @Override
+ public void close() {
+ super.close();
+ }
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleManagerTests.java
index 93eb5b362..7b9b878eb 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleManagerTests.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
@@ -30,6 +34,7 @@ import org.eclipse.debug.tests.TestUtil;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsoleManager;
+import org.junit.Test;
/**
* Tests the ProcessConsoleManager.
@@ -37,19 +42,12 @@ import org.eclipse.ui.console.IConsoleManager;
@SuppressWarnings("restriction")
public class ProcessConsoleManagerTests extends AbstractDebugTest {
- public ProcessConsoleManagerTests() {
- super(ProcessConsoleManagerTests.class.getSimpleName());
- }
-
- public ProcessConsoleManagerTests(String name) {
- super(name);
- }
-
/**
* Test addition and removal of a ProcessConsole. It also kind of tests
* {@link LaunchManager} because the ProcessConsoleManager primary works
* through an {@link ILaunchListener} which is honored by this test.
*/
+ @Test
public void testProcessConsoleLifecycle() throws Exception {
// ensure debug UI plugin is started before adding first launch
DebugUIPlugin.getDefault();
@@ -59,7 +57,7 @@ public class ProcessConsoleManagerTests extends AbstractDebugTest {
if (existingNumConsoles > 0) {
// existing consoles must not harm this test but it may be
// interesting in case the test fails
- TestUtil.log(IStatus.INFO, getName(), "Found " + existingNumConsoles + " existing consoles on test start.");
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "Found " + existingNumConsoles + " existing consoles on test start.");
}
ILaunch launch = null;
@@ -69,7 +67,7 @@ public class ProcessConsoleManagerTests extends AbstractDebugTest {
launch = process.getLaunch();
launchManager.addLaunch(launch);
// do not wait on input read job
- TestUtil.waitForJobs(getName(), 0, 10000, ProcessConsole.class);
+ TestUtil.waitForJobs(name.getMethodName(), 0, 10000, ProcessConsole.class);
assertEquals("No console was added.", 1, consoleManager.getConsoles().length);
} finally {
mockProcess.destroy();
@@ -77,7 +75,7 @@ public class ProcessConsoleManagerTests extends AbstractDebugTest {
if (launch != null) {
launchManager.removeLaunch(launch);
- TestUtil.waitForJobs(getName(), 0, 10000);
+ TestUtil.waitForJobs(name.getMethodName(), 0, 10000);
assertEquals("Console is not removed.", 0, consoleManager.getConsoles().length);
}
}
@@ -86,6 +84,7 @@ public class ProcessConsoleManagerTests extends AbstractDebugTest {
* Test problematic scenario where launch is already removed before console
* is created. see https://bugs.eclipse.org/bugs/show_bug.cgi?id=546710#c13
*/
+ @Test
public void testBug546710_ConsoleCreationRaceCondition() throws Exception {
final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
for (ILaunch existingLaunch : launchManager.getLaunches()) {
@@ -97,9 +96,8 @@ public class ProcessConsoleManagerTests extends AbstractDebugTest {
final IProcess process1 = mockProcess1.toRuntimeProcess("FirstMockProcess");
final MockProcess mockProcess2 = new MockProcess(0);
final IProcess process2 = mockProcess2.toRuntimeProcess("SecondMockProcess");
- final boolean prefRemoveOldLaunches = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES);
try {
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES, true);
+ setPreference(DebugUIPlugin.getDefault().getPreferenceStore(), IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES, true);
// Stop the JobManager to reliable trigger the tested race
// condition.
Job.getJobManager().suspend();
@@ -107,11 +105,10 @@ public class ProcessConsoleManagerTests extends AbstractDebugTest {
launchManager.addLaunch(process2.getLaunch());
} finally {
Job.getJobManager().resume();
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES, prefRemoveOldLaunches);
}
ProcessConsoleManager processConsoleManager = DebugUIPlugin.getDefault().getProcessConsoleManager();
- TestUtil.waitForJobs(getName(), 0, 10000);
+ TestUtil.waitForJobs(name.getMethodName(), 0, 10000);
int openConsoles = 0;
if (processConsoleManager.getConsole(process1) != null) {
openConsoles++;
@@ -124,7 +121,7 @@ public class ProcessConsoleManagerTests extends AbstractDebugTest {
final ConsoleRemoveAllTerminatedAction removeAction = new ConsoleRemoveAllTerminatedAction();
assertTrue("Remove terminated action should be enabled.", removeAction.isEnabled() || launchManager.getLaunches().length == 0);
removeAction.run();
- TestUtil.waitForJobs(getName(), 0, 10000);
+ TestUtil.waitForJobs(name.getMethodName(), 0, 10000);
assertNull("First console not removed.", processConsoleManager.getConsole(process1));
assertNull("Second console not removed.", processConsoleManager.getConsole(process1));
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java
index ff66ca134..a1c6beb2c 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 Paul Pazderski and others.
+ * Copyright (c) 2019, 2020 Paul Pazderski and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,9 +13,25 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.core.runtime.ILogListener;
@@ -24,13 +40,30 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.tests.TestUtil;
+import org.eclipse.debug.tests.launching.LaunchConfigurationTests;
+import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.console.ConsoleColorProvider;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IOConsole;
+import org.eclipse.ui.console.IOConsoleInputStream;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests the ProcessConsole.
@@ -43,35 +76,52 @@ public class ProcessConsoleTests extends AbstractDebugTest {
private final AtomicInteger loggedErrors = new AtomicInteger(0);
/** Listener to count error messages in {@link ConsolePlugin} log. */
- private final ILogListener errorLogListener = new ILogListener() {
- @Override
- public void logging(IStatus status, String plugin) {
+ private final ILogListener errorLogListener = (status, plugin) -> {
if (status.matches(IStatus.ERROR)) {
loggedErrors.incrementAndGet();
}
- }
};
- public ProcessConsoleTests() {
- super(ProcessConsoleTests.class.getSimpleName());
- }
-
- public ProcessConsoleTests(String name) {
- super(name);
- }
+ /** Temporary test files created by a test. Will be deleted on teardown. */
+ private final ArrayList<File> tmpFiles = new ArrayList<>();
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
loggedErrors.set(0);
Platform.addLogListener(errorLogListener);
}
@Override
- protected void tearDown() throws Exception {
- assertEquals("Test triggered errors.", 0, loggedErrors.get());
+ @After
+ public void tearDown() throws Exception {
Platform.removeLogListener(errorLogListener);
+ for (File tmpFile : tmpFiles) {
+ tmpFile.delete();
+ }
+ tmpFiles.clear();
+
super.tearDown();
+
+ assertEquals("Test triggered errors.", 0, loggedErrors.get());
+ }
+
+ /**
+ * Create a new temporary file for testing. File will be deleted when test
+ * finishes.
+ *
+ * @param filename name of the temporary file
+ * @return the created temporary file
+ * @throws IOException if creating the file failed. Includes file already
+ * exists.
+ */
+ private File createTmpFile(String filename) throws IOException {
+ File file = DebugUIPlugin.getDefault().getStateLocation().addTrailingSeparator().append(filename).toFile();
+ boolean fileCreated = file.createNewFile();
+ assertTrue("Failed to prepare temporary test file.", fileCreated);
+ tmpFiles.add(file);
+ return file;
}
/**
@@ -81,6 +131,7 @@ public class ProcessConsoleTests extends AbstractDebugTest {
* This test starts every two byte character on an even byte offset.
* </p>
*/
+ @Test
public void testUTF8InputEven() throws Exception {
// 5000 characters result in 10000 bytes which should be more than most
// common buffer sizes.
@@ -94,6 +145,7 @@ public class ProcessConsoleTests extends AbstractDebugTest {
* This test starts every two byte character on an odd byte offset.
* </p>
*/
+ @Test
public void testUTF8InputOdd() throws Exception {
// 5000 characters result in 10000 bytes which should be more than most
// common buffer sizes.
@@ -125,7 +177,9 @@ public class ProcessConsoleTests extends AbstractDebugTest {
final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), StandardCharsets.UTF_8.toString());
try {
console.initialize();
- console.getInputStream().appendData(input);
+ @SuppressWarnings("resource")
+ IOConsoleInputStream consoleIn = console.getInputStream();
+ consoleIn.appendData(input);
mockProcess.waitFor(testTimeout, TimeUnit.MILLISECONDS);
} finally {
console.destroy();
@@ -145,6 +199,7 @@ public class ProcessConsoleTests extends AbstractDebugTest {
* <code>ProcessConsole.class</code> family.
* </p>
*/
+ @Test
public void testInputReadJobCancel() throws Exception {
final MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
try {
@@ -157,7 +212,7 @@ public class ProcessConsoleTests extends AbstractDebugTest {
final Class<?> jobFamily = org.eclipse.debug.internal.ui.views.console.ProcessConsole.class;
assertTrue("Input read job not started.", Job.getJobManager().find(jobFamily).length > 0);
Job.getJobManager().cancel(jobFamily);
- TestUtil.waitForJobs(getName(), 0, 1000);
+ TestUtil.waitForJobs(name.getMethodName(), 0, 1000);
assertEquals("Input read job not canceled.", 0, Job.getJobManager().find(jobFamily).length);
} finally {
console.destroy();
@@ -166,4 +221,309 @@ public class ProcessConsoleTests extends AbstractDebugTest {
mockProcess.destroy();
}
}
+
+ /**
+ * Test console finished notification with standard process console.
+ */
+ @Test
+ public void testProcessTerminationNotification() throws Exception {
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "Process terminates after Console is initialized.");
+ processTerminationTest(null, false);
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "Process terminates before Console is initialized.");
+ processTerminationTest(null, true);
+ }
+
+ /**
+ * Test console finished notification if process standard input is feed from
+ * file.
+ */
+ @Test
+ public void testProcessTerminationNotificationWithInputFile() throws Exception {
+ File inFile = DebugUIPlugin.getDefault().getStateLocation().addTrailingSeparator().append("testStdin.txt").toFile();
+ boolean fileCreated = inFile.createNewFile();
+ assertTrue("Failed to prepare input file.", fileCreated);
+ try {
+ ILaunchConfigurationType launchType = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(LaunchConfigurationTests.ID_TEST_LAUNCH_TYPE);
+ ILaunchConfigurationWorkingCopy launchConfiguration = launchType.newInstance(null, "testProcessTerminationNotificationWithInputFromFile");
+ launchConfiguration.setAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, inFile.getAbsolutePath());
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "Process terminates after Console is initialized.");
+ processTerminationTest(launchConfiguration, false);
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "Process terminates before Console is initialized.");
+ processTerminationTest(launchConfiguration, true);
+ } finally {
+ inFile.delete();
+ }
+ }
+
+ /**
+ * The shared code to test console finished notification.
+ *
+ * @param launchConfig <code>null</code> or configured with stdin file.
+ * @param terminateBeforeConsoleInitialization if <code>true</code> the
+ * tested process is terminated before the ProcessConsole can
+ * perform its initialization. If <code>false</code> the process
+ * is guaranteed to run until the ProcessConsole was initialized.
+ */
+ public void processTerminationTest(ILaunchConfiguration launchConfig, boolean terminateBeforeConsoleInitialization) throws Exception {
+ final AtomicBoolean terminationSignaled = new AtomicBoolean(false);
+ final Process mockProcess = new MockProcess(null, null, terminateBeforeConsoleInitialization ? 0 : -1);
+ final IProcess process = DebugPlugin.newProcess(new Launch(launchConfig, ILaunchManager.RUN_MODE, null), mockProcess, "testProcessTerminationNotification");
+ @SuppressWarnings("restriction")
+ final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider());
+ console.addPropertyChangeListener(event -> {
+ if (event.getSource() == console && IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE.equals(event.getProperty())) {
+ terminationSignaled.set(true);
+ }
+ });
+ final IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ try {
+ consoleManager.addConsoles(new IConsole[] { console });
+ if (mockProcess.isAlive()) {
+ mockProcess.destroy();
+ }
+ TestUtil.waitForJobs(name.getMethodName(), 50, 10000);
+ assertTrue("No console complete notification received.", terminationSignaled.get());
+ } finally {
+ consoleManager.removeConsoles(new IConsole[] { console });
+ TestUtil.waitForJobs(name.getMethodName(), 0, 10000);
+ }
+ }
+
+ /**
+ * Test simple redirect of console output into file.
+ */
+ @Test
+ public void testRedirectOutputToFile() throws Exception {
+ final String testContent = "Hello World!";
+ final File outFile = createTmpFile("test.out");
+ Map<String, Object> launchConfigAttributes = new HashMap<>();
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, outFile.getCanonicalPath());
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
+ doConsoleOutputTest(testContent.getBytes(), launchConfigAttributes);
+ assertArrayEquals("Wrong content redirected to file.", testContent.getBytes(), Files.readAllBytes(outFile.toPath()));
+ }
+
+ /**
+ * Test appending of console output into existing file.
+ */
+ @Test
+ public void testAppendOutputToFile() throws Exception {
+ final String testContent = "Hello World!";
+ final File outFile = createTmpFile("test-append.out");
+ Map<String, Object> launchConfigAttributes = new HashMap<>();
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, outFile.getCanonicalPath());
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_APPEND_TO_FILE, true);
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
+ doConsoleOutputTest(testContent.getBytes(), launchConfigAttributes);
+ assertArrayEquals("Wrong content redirected to file.", testContent.getBytes(), Files.readAllBytes(outFile.toPath()));
+
+ String appendedContent = "append";
+ doConsoleOutputTest(appendedContent.getBytes(), launchConfigAttributes);
+ assertArrayEquals("Wrong content redirected to file.", (testContent + appendedContent).getBytes(), Files.readAllBytes(outFile.toPath()));
+ }
+
+ /**
+ * Test output redirect with a filename containing regular expression
+ * specific special characters.
+ * <p>
+ * Test a filename with special characters which is still a valid regular
+ * expression and a filename whose name is an invalid regular expression.
+ */
+ @Test
+ public void testBug333239_regexSpecialCharactersInOutputFilename() throws Exception {
+ final String testContent = "1.\n2.\n3.\n";
+ File outFile = createTmpFile("test.[out]");
+ Map<String, Object> launchConfigAttributes = new HashMap<>();
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, outFile.getCanonicalPath());
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
+ IOConsole console = doConsoleOutputTest(testContent.getBytes(), launchConfigAttributes);
+ assertArrayEquals("Wrong content redirected to file.", testContent.getBytes(), Files.readAllBytes(outFile.toPath()));
+ assertEquals("Output in console.", 2, console.getDocument().getNumberOfLines());
+
+ outFile = createTmpFile("exhaustive[128-32].out");
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, outFile.getCanonicalPath());
+ console = doConsoleOutputTest(testContent.getBytes(), launchConfigAttributes);
+ assertArrayEquals("Wrong content redirected to file.", testContent.getBytes(), Files.readAllBytes(outFile.toPath()));
+ assertEquals("Output in console.", 2, console.getDocument().getNumberOfLines());
+
+ outFile = createTmpFile("ug(ly.out");
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, outFile.getCanonicalPath());
+ console = doConsoleOutputTest(testContent.getBytes(), launchConfigAttributes);
+ assertArrayEquals("Wrong content redirected to file.", testContent.getBytes(), Files.readAllBytes(outFile.toPath()));
+ assertEquals("Output in console.", 2, console.getDocument().getNumberOfLines());
+ }
+
+ /**
+ * Shared test code for tests who want to write and verify content to
+ * console. Method will open a console for a mockup process, output the
+ * given content, terminate the process and close the console. If content is
+ * expected to be found in console it will be verified. If output is
+ * redirected to file the file path which should be printed to console is
+ * checked.
+ *
+ * @param testContent content to output in console
+ * @param launchConfigAttributes optional launch configuration attributes to
+ * specify behavior
+ * @return the console object after it has finished
+ */
+ private IOConsole doConsoleOutputTest(byte[] testContent, Map<String, Object> launchConfigAttributes) throws Exception {
+ final MockProcess mockProcess = new MockProcess(new ByteArrayInputStream(testContent), null, MockProcess.RUN_FOREVER);
+ final IProcess process = mockProcess.toRuntimeProcess("Output Redirect", launchConfigAttributes);
+ final String encoding = launchConfigAttributes != null ? (String) launchConfigAttributes.get(DebugPlugin.ATTR_CONSOLE_ENCODING) : null;
+ final AtomicBoolean consoleFinished = new AtomicBoolean(false);
+ @SuppressWarnings("restriction")
+ final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), encoding);
+ console.addPropertyChangeListener((PropertyChangeEvent event) -> {
+ if (event.getSource() == console && IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE.equals(event.getProperty())) {
+ consoleFinished.set(true);
+ }
+ });
+ final IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ try {
+ consoleManager.addConsoles(new IConsole[] { console });
+ mockProcess.destroy();
+ waitWhile(c -> !consoleFinished.get(), testTimeout, c -> "Console did not finished.");
+
+ Object value = launchConfigAttributes != null ? launchConfigAttributes.get(IDebugUIConstants.ATTR_CAPTURE_IN_FILE) : null;
+ final File outFile = value != null ? new File((String) value) : null;
+ value = launchConfigAttributes != null ? launchConfigAttributes.get(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE) : null;
+ final boolean checkOutput = value != null ? (boolean) value : true;
+ final IDocument doc = console.getDocument();
+
+ if (outFile != null) {
+ @SuppressWarnings("restriction")
+ String expectedPathMsg = MessageFormat.format(org.eclipse.debug.internal.ui.views.console.ConsoleMessages.ProcessConsole_1, new Object[] {
+ outFile.getAbsolutePath() });
+ assertEquals("No or wrong output of redirect file path in console.", expectedPathMsg, doc.get(doc.getLineOffset(0), doc.getLineLength(0)));
+ assertEquals("Expected redirect file path to be linked.", 1, console.getHyperlinks().length);
+ }
+ if (checkOutput) {
+ assertEquals("Output not found in console.", new String(testContent), doc.get(doc.getLineOffset(1), doc.getLineLength(1)));
+ }
+ return console;
+ } finally {
+ if (!process.isTerminated()) {
+ process.terminate();
+ }
+ consoleManager.removeConsoles(new IConsole[] { console });
+ TestUtil.waitForJobs(name.getMethodName(), 0, 1000);
+ }
+ }
+
+ /**
+ * Simulate the common case of a process which constantly produce output.
+ * This should cover the situation that a process produce output before
+ * ProcessConsole is initialized and more output after console is ready.
+ */
+ @Test
+ public void testOutput() throws Exception {
+ String[] lines = new String[] {
+ "'Native' process started.",
+ "'Eclipse' process started. Stream proxying started.",
+ "Console created.", "Console initialized.",
+ "Stopping mock process.", };
+ String consoleEncoding = StandardCharsets.UTF_8.name();
+ try (PipedOutputStream procOut = new PipedOutputStream(); PrintStream sysout = new PrintStream(procOut, true, consoleEncoding)) {
+ @SuppressWarnings("resource")
+ final MockProcess mockProcess = new MockProcess(new PipedInputStream(procOut), null, MockProcess.RUN_FOREVER);
+ sysout.println(lines[0]);
+ try {
+ Map<String, Object> launchConfigAttributes = new HashMap<>();
+ launchConfigAttributes.put(DebugPlugin.ATTR_CONSOLE_ENCODING, consoleEncoding);
+ final IProcess process = mockProcess.toRuntimeProcess("simpleOutput", launchConfigAttributes);
+ sysout.println(lines[1]);
+ @SuppressWarnings("restriction")
+ final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
+ sysout.println(lines[2]);
+ try {
+ console.initialize();
+ sysout.println(lines[3]);
+ sysout.println(lines[4]);
+ mockProcess.destroy();
+ sysout.close();
+ TestUtil.processUIEvents(200);
+
+ for (int i = 0; i < lines.length; i++) {
+ IRegion lineInfo = console.getDocument().getLineInformation(i);
+ String line = console.getDocument().get(lineInfo.getOffset(), lineInfo.getLength());
+ assertEquals("Wrong content in line " + i, lines[i], line);
+ }
+ } finally {
+ console.destroy();
+ }
+ } finally {
+ mockProcess.destroy();
+ }
+ }
+ }
+
+ /**
+ * Test a process which produces binary output and a launch which redirects
+ * output to file. The process output must not be changed in any way due to
+ * the redirection. See bug 558463.
+ */
+ @Test
+ public void testBinaryOutputToFile() throws Exception {
+ byte[] output = new byte[] { (byte) 0xac };
+ String consoleEncoding = StandardCharsets.UTF_8.name();
+
+ final File outFile = createTmpFile("testoutput.bin");
+ final MockProcess mockProcess = new MockProcess(new ByteArrayInputStream(output), null, MockProcess.RUN_FOREVER);
+ try {
+ Map<String, Object> launchConfigAttributes = new HashMap<>();
+ launchConfigAttributes.put(DebugPlugin.ATTR_CONSOLE_ENCODING, consoleEncoding);
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, outFile.getCanonicalPath());
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
+ final IProcess process = mockProcess.toRuntimeProcess("redirectBinaryOutput", launchConfigAttributes);
+ @SuppressWarnings("restriction")
+ final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
+ try {
+ console.initialize();
+ mockProcess.waitFor(100, TimeUnit.MILLISECONDS);
+ mockProcess.destroy();
+ } finally {
+ console.destroy();
+ }
+ } finally {
+ mockProcess.destroy();
+ }
+
+ byte[] receivedOutput = Files.readAllBytes(outFile.toPath());
+ assertArrayEquals(output, receivedOutput);
+ }
+
+ /**
+ * Test a process which reads binary input from a file through Eclipse
+ * console. The input must not be changed in any way due to the redirection.
+ * See bug 558463.
+ */
+ @Test
+ public void testBinaryInputFromFile() throws Exception {
+ byte[] input = new byte[] { (byte) 0xac };
+ String consoleEncoding = StandardCharsets.UTF_8.name();
+
+ final File inFile = createTmpFile("testinput.bin");
+ Files.write(inFile.toPath(), input);
+ final MockProcess mockProcess = new MockProcess(input.length, testTimeout);
+ try {
+ Map<String, Object> launchConfigAttributes = new HashMap<>();
+ launchConfigAttributes.put(DebugPlugin.ATTR_CONSOLE_ENCODING, consoleEncoding);
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, inFile.getCanonicalPath());
+ launchConfigAttributes.put(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, false);
+ final IProcess process = mockProcess.toRuntimeProcess("redirectBinaryInput", launchConfigAttributes);
+ @SuppressWarnings("restriction")
+ final org.eclipse.debug.internal.ui.views.console.ProcessConsole console = new org.eclipse.debug.internal.ui.views.console.ProcessConsole(process, new ConsoleColorProvider(), consoleEncoding);
+ try {
+ console.initialize();
+ mockProcess.waitFor(testTimeout, TimeUnit.MILLISECONDS);
+ } finally {
+ console.destroy();
+ }
+ } finally {
+ mockProcess.destroy();
+ }
+
+ byte[] receivedInput = mockProcess.getReceivedInput();
+ assertArrayEquals(input, receivedInput);
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java
new file mode 100644
index 000000000..df9807334
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/RuntimeProcessTests.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2020, 2021 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ * Hannes Wellmann - add tests regarding termination of descendants and timeout
+ *******************************************************************************/
+package org.eclipse.debug.tests.console;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.RuntimeProcess;
+import org.eclipse.debug.internal.core.DebugCoreMessages;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.eclipse.debug.tests.TestUtil;
+import org.eclipse.debug.tests.sourcelookup.TestLaunch;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class RuntimeProcessTests extends AbstractDebugTest {
+
+ /**
+ * Test behavior of {@link RuntimeProcess} if the wrapped process
+ * terminates.
+ */
+ @Test
+ public void testProcessTerminated() throws Exception {
+ AtomicInteger processTerminateEvents = new AtomicInteger();
+ DebugPlugin.getDefault().addDebugEventListener(events -> {
+ for (DebugEvent event : events) {
+ if (event.getKind() == DebugEvent.TERMINATE) {
+ processTerminateEvents.incrementAndGet();
+ }
+ }
+ });
+
+ MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess();
+
+ assertFalse("RuntimeProcess already terminated.", runtimeProcess.isTerminated());
+ assertTrue(runtimeProcess.canTerminate());
+
+ mockProcess.setExitValue(1);
+ mockProcess.destroy();
+
+ TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
+ TestUtil.waitForJobs(name.getMethodName(), 25, 500);
+ assertEquals("Wrong number of terminate events.", 1, processTerminateEvents.get());
+ assertEquals("RuntimeProcess reported wrong exit code.", 1, runtimeProcess.getExitValue());
+ }
+
+ /** Test {@link RuntimeProcess} terminating the wrapped process. */
+ @Test
+ public void testTerminateProcess() throws Exception {
+ AtomicInteger processTerminateEvents = new AtomicInteger();
+ DebugPlugin.getDefault().addDebugEventListener(events -> {
+ for (DebugEvent event : events) {
+ if (event.getKind() == DebugEvent.TERMINATE) {
+ processTerminateEvents.incrementAndGet();
+ }
+ }
+ });
+
+ MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess();
+
+ assertFalse("RuntimeProcess already terminated.", runtimeProcess.isTerminated());
+ assertTrue(runtimeProcess.canTerminate());
+
+ mockProcess.setExitValue(1);
+ runtimeProcess.terminate();
+ assertFalse("RuntimeProcess failed to terminate wrapped process.", mockProcess.isAlive());
+
+ TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
+ TestUtil.waitForJobs(name.getMethodName(), 25, 500);
+ assertEquals("Wrong number of terminate events.", 1, processTerminateEvents.get());
+ assertEquals("RuntimeProcess reported wrong exit code.", 1, runtimeProcess.getExitValue());
+ }
+
+ /**
+ * Test {@link RuntimeProcess} terminating the wrapped process and its
+ * descendants.
+ */
+ @Test
+ public void testTerminateProcessWithSubProcesses() throws Exception {
+
+ MockProcess grandChildProcess = new MockProcess(MockProcess.RUN_FOREVER);
+
+ MockProcess childProcess1 = new MockProcess(MockProcess.RUN_FOREVER);
+ childProcess1.setHandle(new MockProcessHandle(childProcess1, List.of(grandChildProcess)));
+
+ MockProcess childProcess2 = new MockProcess(MockProcess.RUN_FOREVER);
+
+ MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ mockProcess.setHandle(new MockProcessHandle(childProcess1, List.of(childProcess1, childProcess2)));
+
+ RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess();
+
+ assertTrue("RuntimeProcess already terminated.", grandChildProcess.isAlive());
+ assertTrue("RuntimeProcess already terminated.", childProcess1.isAlive());
+ assertTrue("RuntimeProcess already terminated.", childProcess2.isAlive());
+ assertFalse("RuntimeProcess already terminated.", runtimeProcess.isTerminated());
+
+ runtimeProcess.terminate();
+
+ assertFalse("RuntimeProcess failed to terminate wrapped process.", mockProcess.isAlive());
+ assertFalse("RuntimeProcess failed to terminate child of wrapped process.", childProcess1.isAlive());
+ assertFalse("RuntimeProcess failed to terminate child of wrapped process.", childProcess2.isAlive());
+ assertFalse("RuntimeProcess failed to terminate descendant of wrapped process.", grandChildProcess.isAlive());
+
+ TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
+ }
+
+ /**
+ * Test {@link RuntimeProcess} terminating the wrapped process while not
+ * terminating its descendants.
+ */
+ @Test
+ public void testTerminateProcessWithoutTerminatingDescendents() throws Exception {
+
+ MockProcess childProcess = new MockProcess(MockProcess.RUN_FOREVER);
+
+ MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ mockProcess.setHandle(new MockProcessHandle(mockProcess, List.of(childProcess)));
+
+ RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess("MockProcess", Map.of(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, false));
+
+ assertTrue("RuntimeProcess already terminated.", childProcess.isAlive());
+ assertFalse("RuntimeProcess already terminated.", runtimeProcess.isTerminated());
+
+ runtimeProcess.terminate();
+
+ assertFalse("RuntimeProcess failed to terminate wrapped process.", mockProcess.isAlive());
+ assertTrue("RuntimeProcess terminated child of wrapped process, unlike configured.", childProcess.isAlive());
+
+ TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
+ }
+
+ /**
+ * Test {@link RuntimeProcess} terminating the wrapped process which does
+ * not support {@link Process#toHandle()}.
+ */
+ @Test
+ public void testTerminateProcessNotSupportingProcessToHandle() throws Exception {
+
+ MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ // set handle to null, so the standard java.lang.Process.toHandle()
+ // implementation is called which throws an
+ // UnsupportedOperationException
+ mockProcess.setHandle(null);
+ assertThrows(UnsupportedOperationException.class, mockProcess::toHandle);
+ RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess();
+ runtimeProcess.terminate(); // must not throw, even toHandle() does
+
+ TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
+ }
+
+ /**
+ * Test {@link RuntimeProcess} terminating the wrapped process which does
+ * only terminate with a delay.
+ */
+ @Test
+ public void testTerminateProcessWithTimeoutExeedingTermination() {
+
+ MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ mockProcess.setTerminationDelay(6000);
+
+ RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess();
+
+ DebugException timeoutException = assertThrows(DebugException.class, runtimeProcess::terminate);
+ assertThat(timeoutException.getMessage(), is(DebugCoreMessages.RuntimeProcess_terminate_failed));
+ }
+
+ /**
+ * Test {@link RuntimeProcess} terminating the wrapped process which does
+ * only terminate with a delay.
+ */
+ @Test
+ public void testTerminateProcessWithDescendentExceedingTimeoutForTermination() {
+
+ MockProcess childProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ childProcess.setTerminationDelay(6000);
+
+ MockProcess mockProcess = new MockProcess(MockProcess.RUN_FOREVER);
+ mockProcess.setHandle(new MockProcessHandle(mockProcess, List.of(childProcess)));
+
+ RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess();
+
+ DebugException timeoutException = assertThrows(DebugException.class, runtimeProcess::terminate);
+ assertThat(timeoutException.getMessage(), is(DebugCoreMessages.RuntimeProcess_terminate_failed));
+ }
+
+ /**
+ * See comment in MockProcess.MockProcess().new InputStream() {...}.read()
+ * for why this test fails
+ */
+ @Test
+ @Ignore("See https://bugs.eclipse.org/bugs/show_bug.cgi?id=577189")
+ public void testOutputAfterDestroy() throws Exception {
+ MockProcess proc = new MockProcess();
+
+ IProcess iProc = new RuntimeProcess(new TestLaunch(), proc, "foo", Collections.emptyMap());
+ iProc.terminate();
+
+ String str = iProc.getStreamsProxy().getOutputStreamMonitor().getContents();
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "Stream result: ");
+ for (int i = 0; i < str.length(); i += 100) {
+ TestUtil.log(IStatus.INFO, name.getMethodName(), str.substring(i, Math.min(i + 100, str.length())));
+ }
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "Stream done.");
+ // Make sure that the inputstream (process's stdout) has been fully read
+ // and is at EOF
+ @SuppressWarnings("resource")
+ InputStream inputStream = proc.getInputStream();
+ assertEquals(-1, inputStream.read());
+ // Make sure that the last character in the stream makes it through to
+ // the monitor
+ assertTrue(str.endsWith(String.valueOf((char) MockProcess.ProcessState.LASTREAD.getCode())));
+ }
+
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java
index b4ffdb4a4..571da15c6 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/StreamsProxyTests.java
@@ -13,30 +13,26 @@
*******************************************************************************/
package org.eclipse.debug.tests.console;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import org.eclipse.debug.internal.core.StreamsProxy;
import org.eclipse.debug.tests.AbstractDebugTest;
+import org.junit.Test;
/**
* Tests the {@link StreamsProxy}.
*/
public class StreamsProxyTests extends AbstractDebugTest {
- public StreamsProxyTests() {
- super(StreamsProxyTests.class.getSimpleName());
- }
-
- public StreamsProxyTests(String name) {
- super(name);
- }
-
/**
* Test console receiving UTF-8 output from process where two-byte UTF-8
* characters start at even offsets.
*/
+ @Test
public void testReceiveUTF8Even() throws Exception {
// 4500 characters results in 9000 byte of output which should be more
// than most common buffer sizes.
@@ -47,6 +43,7 @@ public class StreamsProxyTests extends AbstractDebugTest {
* Test console receiving UTF-8 output from process where two-byte UTF-8
* characters start at odd offsets.
*/
+ @Test
public void testReceiveUTF8Odd() throws Exception {
// 4500 characters results in 9000 byte of output which should be more
// than most common buffer sizes.
@@ -69,7 +66,7 @@ public class StreamsProxyTests extends AbstractDebugTest {
final String s = prefix + String.join("", Collections.nCopies(numTwoByteCharacters, "\u00F8"));
final ByteArrayInputStream stdout = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
final Process mockProcess = new MockProcess(stdout, null, 0);
- final StreamsProxy streamProxy = new StreamsProxy(mockProcess, StandardCharsets.UTF_8.name());
+ final StreamsProxy streamProxy = new StreamsProxy(mockProcess, StandardCharsets.UTF_8, "");
streamProxy.close();
final String readContent = streamProxy.getOutputStreamMonitor().getContents();
assertEquals("Process output got corrupted.", s, readContent);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/TextConsoleViewerTest.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/TextConsoleViewerTest.java
new file mode 100644
index 000000000..696bc6357
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/TextConsoleViewerTest.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.console;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.console.TextConsoleViewer;
+import org.junit.Test;
+
+/**
+ * Not really a test for {@link TextConsoleViewer} yet since it only test one
+ * private method of it.
+ */
+public class TextConsoleViewerTest extends AbstractDebugTest {
+
+ /**
+ * Test override of existing styles with a new style. Typically used to
+ * apply link styling on already styled console document.
+ */
+ @Test
+ public void testStyleOverride() throws Throwable {
+ Color colorR = null;
+ Color colorG = null;
+ Color colorB = null;
+ Color colorK = null;
+ Color colorW = null;
+ try {
+ final Method method = TextConsoleViewer.class.getDeclaredMethod("overrideStyleRange", List.class, StyleRange.class);
+ method.setAccessible(true);
+ assertTrue("Required method <" + method + "> is not static.", Modifier.isStatic(method.getModifiers()));
+
+ final List<StyleRange> styles = new ArrayList<>();
+ colorR = new Color(null, 255, 0, 0);
+ colorG = new Color(null, 0, 255, 0);
+ colorB = new Color(null, 0, 0, 255);
+ colorK = new Color(null, 0, 0, 0);
+ colorW = new Color(null, 255, 255, 255);
+
+ // overwrite in empty list
+ method.invoke(null, styles, new StyleRange(5, 5, colorR, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 2, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 13, null);
+
+ // overwrite unstyled part before
+ method.invoke(null, styles, new StyleRange(0, 3, colorG, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 3, colorG);
+ assertStyle(styles, 3, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 13, null);
+
+ // overwrite unstyled part after
+ method.invoke(null, styles, new StyleRange(15, 5, colorB, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 3, colorG);
+ assertStyle(styles, 3, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 15, null);
+ assertStyle(styles, 15, 20, colorB);
+ assertStyle(styles, 20, 23, null);
+
+ // overwrite existing: start exact, end exact
+ method.invoke(null, styles, new StyleRange(0, 3, colorK, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 3, colorK);
+ assertStyle(styles, 3, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 15, null);
+ assertStyle(styles, 15, 20, colorB);
+ assertStyle(styles, 20, 23, null);
+
+ // overwrite existing: start exact, end after
+ method.invoke(null, styles, new StyleRange(0, 4, colorW, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 4, colorW);
+ assertStyle(styles, 4, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 15, null);
+ assertStyle(styles, 15, 20, colorB);
+ assertStyle(styles, 20, 23, null);
+
+ // overwrite existing: start exact, end inside
+ method.invoke(null, styles, new StyleRange(0, 2, colorK, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 2, colorK);
+ assertStyle(styles, 2, 4, colorW);
+ assertStyle(styles, 4, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 15, null);
+ assertStyle(styles, 15, 20, colorB);
+ assertStyle(styles, 20, 23, null);
+
+ // overwrite existing: start before, end exact
+ method.invoke(null, styles, new StyleRange(13, 7, colorW, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 2, colorK);
+ assertStyle(styles, 2, 4, colorW);
+ assertStyle(styles, 4, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 13, null);
+ assertStyle(styles, 13, 20, colorW);
+ assertStyle(styles, 20, 23, null);
+
+ // overwrite existing: start inside, end exact
+ method.invoke(null, styles, new StyleRange(15, 5, colorK, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 2, colorK);
+ assertStyle(styles, 2, 4, colorW);
+ assertStyle(styles, 4, 5, null);
+ assertStyle(styles, 5, 10, colorR);
+ assertStyle(styles, 10, 13, null);
+ assertStyle(styles, 13, 15, colorW);
+ assertStyle(styles, 15, 20, colorK);
+ assertStyle(styles, 20, 23, null);
+
+ // prepare new existing style
+ styles.clear();
+ method.invoke(null, styles, new StyleRange(10, 10, colorW, null));
+ assertStyle(styles, 10, 20, colorW);
+ method.invoke(null, styles, new StyleRange(10, 10, colorK, null));
+ assertStyle(styles, 10, 20, colorK);
+ assertEquals("Wrong number of styles.", 1, styles.size());
+
+ // overwrite existing: start before, end after
+ method.invoke(null, styles, new StyleRange(5, 15, colorR, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 5, 20, colorR);
+
+ // overwrite existing: start before, end inside
+ method.invoke(null, styles, new StyleRange(0, 10, colorG, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 10, colorG);
+ assertStyle(styles, 10, 20, colorR);
+
+ // overwrite existing: start inside, end after
+ method.invoke(null, styles, new StyleRange(15, 10, colorB, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 10, colorG);
+ assertStyle(styles, 10, 15, colorR);
+ assertStyle(styles, 15, 20, colorB);
+
+ // overwrite existing: start inside, end inside
+ method.invoke(null, styles, new StyleRange(6, 1, colorW, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 6, colorG);
+ assertStyle(styles, 6, 7, colorW);
+ assertStyle(styles, 7, 10, colorG);
+ assertStyle(styles, 10, 15, colorR);
+ assertStyle(styles, 15, 20, colorB);
+
+ // overwrite many styles
+ method.invoke(null, styles, new StyleRange(0, 25, colorK, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 25, colorK);
+ assertStyle(styles, 25, 30, null);
+
+ // prepare new existing style
+ styles.clear();
+ styles.add(new StyleRange(0, 10, colorR, null));
+ styles.add(new StyleRange(15, 5, colorG, null));
+
+ // overwrite: start in one style, end in other
+ method.invoke(null, styles, new StyleRange(7, 11, colorB, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 7, colorR);
+ assertStyle(styles, 7, 18, colorB);
+ assertStyle(styles, 18, 20, colorG);
+ assertStyle(styles, 20, 25, null);
+
+ // prepare new existing style
+ styles.clear();
+ styles.add(new StyleRange(0, 10, colorR, null));
+ styles.add(new StyleRange(15, 5, colorG, null));
+
+ // overwrite: start in one style, end after other
+ method.invoke(null, styles, new StyleRange(7, 15, colorB, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 7, colorR);
+ assertStyle(styles, 7, 22, colorB);
+ assertStyle(styles, 22, 25, null);
+
+ // prepare new existing style
+ styles.clear();
+ styles.add(new StyleRange(5, 5, colorR, null));
+ styles.add(new StyleRange(15, 5, colorG, null));
+
+ // overwrite: start before one style, end in other
+ method.invoke(null, styles, new StyleRange(2, 15, colorB, null));
+ checkOverlapping(styles);
+ assertStyle(styles, 0, 2, null);
+ assertStyle(styles, 2, 17, colorB);
+ assertStyle(styles, 17, 20, colorG);
+ assertStyle(styles, 20, 25, null);
+
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() != null) {
+ throw e.getTargetException();
+ }
+ throw e;
+ } catch (Exception e) {
+ // if this happened the method may have be renamed or moved
+ throw e;
+ }
+ }
+
+ /**
+ * Assert any offset in given range is styled with given foreground color.
+ * <p>
+ * Note: this test class only uses foreground color and assumes all other
+ * style attributes are set to there default values.
+ * </p>
+ *
+ * @param styles list of known style ranges
+ * @param offset inclusive start offset of range to check
+ * @param end exclusive end offset of range to check
+ * @param foregroundColor the expected foreground color for styles in given
+ * range. May be <code>null</code> to check for unstyled ranges.
+ */
+ private static void assertStyle(List<StyleRange> styles, int offset, int end, Color foregroundColor) {
+ int o = offset;
+ while (o < end) {
+ final StyleRange expected = foregroundColor != null ? new StyleRange(0, 0, foregroundColor, null) : null;
+ final StyleRange actual = getStyleAtOffset(styles, o);
+ assertEquals("Got wrong style at offset " + o, generalizeStyle(expected), generalizeStyle(actual));
+ final int step = actual != null ? actual.length : 1;
+ o += Math.min(step, 1);
+ }
+ }
+
+ /**
+ * Get style from list at given offset or <code>null</code>. If offset has
+ * more then one style it is undefined which one is returned. Does not
+ * return zero-length styles.
+ *
+ * @param styles list of styles
+ * @param offset offset of interest
+ * @return style at given offset or <code>null</code> if offset is not
+ * styled
+ */
+ private static StyleRange getStyleAtOffset(List<StyleRange> styles, int offset) {
+ if (styles != null) {
+ for (StyleRange style : styles) {
+ if (style.start <= offset && style.start + style.length >= offset + 1) {
+ return style;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Set styles start and length to <code>0</code> to compare only the styling
+ * parts using <code>equals</code>.
+ *
+ * @param style the original style. Not modified by this method.
+ * @return the style without position information.
+ */
+ private static StyleRange generalizeStyle(StyleRange style) {
+ if (style == null) {
+ return new StyleRange();
+ }
+ final StyleRange copy = (StyleRange) style.clone();
+ copy.start = copy.length = 0;
+ return copy;
+ }
+
+ /**
+ * Check if styles are disjoint and sorted ascending by offset.
+ *
+ * @param styles the styles to check
+ */
+ private static void checkOverlapping(List<StyleRange> styles) {
+ if (styles == null || styles.size() <= 1) {
+ return;
+ }
+ int lastEnd = Integer.MIN_VALUE;
+ for (StyleRange s : styles) {
+ assertTrue("Styles overlap or not sorted.", lastEnd <= s.start);
+ assertTrue("Empty style.", s.length > 0);
+ lastEnd = s.start + s.length;
+ }
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
index 24434287e..64eb0fe5b 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.debug.tests.expressions;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -26,13 +29,15 @@ import org.eclipse.debug.core.model.IWatchExpression;
import org.eclipse.debug.internal.core.ExpressionManager;
import org.eclipse.debug.internal.core.IExpressionsListener2;
import org.eclipse.debug.tests.AbstractDebugTest;
+import org.junit.After;
+import org.junit.Test;
/**
* Tests expression manager and listener call backs
*/
public class ExpressionManagerTests extends AbstractDebugTest {
- class SinlgeListener implements IExpressionListener {
+ static class SinlgeListener implements IExpressionListener {
List<IExpression> added = new ArrayList<>();
List<IExpression> removed = new ArrayList<>();
@@ -61,7 +66,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
}
- class MultiListener implements IExpressionsListener {
+ static class MultiListener implements IExpressionsListener {
List<IExpression> added = new ArrayList<>();
List<IExpression> removed = new ArrayList<>();
@@ -90,7 +95,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
}
- class InsertMoveListener extends MultiListener implements IExpressionsListener2 {
+ static class InsertMoveListener extends MultiListener implements IExpressionsListener2 {
List<IExpression> moved = new ArrayList<>();
List<IExpression> inserted = new ArrayList<>();
@@ -124,7 +129,8 @@ public class ExpressionManagerTests extends AbstractDebugTest {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
// remove all expressions from the manager
getManager().removeExpressions(getManager().getExpressions());
super.tearDown();
@@ -149,6 +155,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Add expressions and ensure proper call backs are received.
*/
+ @Test
public void testAddExpressions() {
IExpressionManager manager = getManager();
SinlgeListener single = new SinlgeListener();
@@ -184,6 +191,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Remove expressions and ensure proper call backs are received.
*/
+ @Test
public void testRemoveExpressions() {
IExpressionManager manager = getManager();
SinlgeListener single = new SinlgeListener();
@@ -224,6 +232,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Change expressions and ensure proper call backs are received.
*/
+ @Test
public void testChangeExpressions() {
IExpressionManager manager = getManager();
SinlgeListener single = new SinlgeListener();
@@ -265,6 +274,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Insert expressions and ensure proper call backs are received.
*/
+ @Test
public void testInsertBeforeExpressions() {
ExpressionManager manager = (ExpressionManager) getManager();
SinlgeListener single = new SinlgeListener();
@@ -322,6 +332,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Insert expressions and ensure proper call backs are received.
*/
+ @Test
public void testInsertAfterExpressions() {
ExpressionManager manager = (ExpressionManager) getManager();
SinlgeListener single = new SinlgeListener();
@@ -379,6 +390,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Move expressions and ensure proper call backs are received.
*/
+ @Test
public void testMoveBeforeExpressions() {
ExpressionManager manager = (ExpressionManager) getManager();
SinlgeListener single = new SinlgeListener();
@@ -429,6 +441,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Move expressions and ensure proper call backs are received.
*/
+ @Test
public void testMoveAfterExpressions() {
ExpressionManager manager = (ExpressionManager) getManager();
SinlgeListener single = new SinlgeListener();
@@ -479,6 +492,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
/**
* Test persist and restore of expressions
*/
+ @Test
public void testPersistExpressions() {
ExpressionManager manager = (ExpressionManager) getManager();
IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
@@ -505,6 +519,7 @@ public class ExpressionManagerTests extends AbstractDebugTest {
*
* @throws InterruptedException
*/
+ @Test
public void testConcurrentAccess() throws InterruptedException {
final boolean[] done = new boolean[]{false};
final Exception[] ex = new Exception[]{null};
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AbstractLaunchTest.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AbstractLaunchTest.java
index a2513b107..5b11e558c 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AbstractLaunchTest.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AbstractLaunchTest.java
@@ -29,15 +29,6 @@ import org.eclipse.debug.tests.AbstractDebugTest;
public abstract class AbstractLaunchTest extends AbstractDebugTest {
/**
- * Constructs a test with the given name.
- *
- * @param name
- */
- public AbstractLaunchTest(String name) {
- super(name);
- }
-
- /**
* Returns the launch manager.
*
* @return launch manager
@@ -65,8 +56,7 @@ public abstract class AbstractLaunchTest extends AbstractDebugTest {
protected ILaunchConfiguration getLaunchConfiguration(String name) throws CoreException {
ILaunchManager manager = getLaunchManager();
ILaunchConfiguration[] configurations = manager.getLaunchConfigurations();
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration config = configurations[i];
+ for (ILaunchConfiguration config : configurations) {
if (config.getName().equals(name)) {
return config;
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AcceleratorSubstitutionTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AcceleratorSubstitutionTests.java
index 2df5a7ee9..04f1c9459 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AcceleratorSubstitutionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/AcceleratorSubstitutionTests.java
@@ -13,8 +13,11 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.tests.AbstractDebugTest;
+import org.junit.Test;
/**
* Tests accelerator adjustments for DBCS languages.
@@ -24,17 +27,11 @@ import org.eclipse.debug.tests.AbstractDebugTest;
*/
public class AcceleratorSubstitutionTests extends AbstractDebugTest {
- /**
- * Constructor
- * @param name the name of the test
- */
- public AcceleratorSubstitutionTests(String name) {
- super(name);
- }
/**
* tests a string with "..."
*/
+ @Test
public void testWithEllipses() {
assertEquals("incorrect DBCS accelerator substitution", //$NON-NLS-1$
"Open Run Dialog(&R)...", //$NON-NLS-1$
@@ -44,6 +41,7 @@ public class AcceleratorSubstitutionTests extends AbstractDebugTest {
/**
* tests a string without "..."
*/
+ @Test
public void testWithoutEllipses() {
assertEquals("incorrect DBCS accelerator substitution", //$NON-NLS-1$
"Open Run Dialog(&R)", //$NON-NLS-1$
@@ -53,6 +51,7 @@ public class AcceleratorSubstitutionTests extends AbstractDebugTest {
/**
* tests a string that should not change (no DBCS style accelerator).
*/
+ @Test
public void testWithoutDBCSAcclerator() {
assertEquals("incorrect DBCS accelerator substitution", //$NON-NLS-1$
"Open &Run Dialog...", //$NON-NLS-1$
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java
index e9cbbeccb..e9e6e1de1 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentParsingTests.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -30,6 +32,7 @@ import org.eclipse.core.runtime.URIUtil;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.osgi.service.environment.Constants;
+import org.junit.Test;
/**
* Tests {@link org.eclipse.debug.core.DebugPlugin#parseArguments(String)} and
@@ -73,14 +76,8 @@ public class ArgumentParsingTests extends AbstractDebugTest {
String[] splitArguments = DebugPlugin.splitArguments(commandLine);
assertEquals(expectedArgs.length, splitArguments.length);
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < splitArguments.length; i++) {
- if (i > 0) {
- sb.append(" "); //$NON-NLS-1$
- }
- sb.append(splitArguments[i]);
- }
- assertEquals(commandLine, sb.toString());
+ String sb = String.join(" ", splitArguments); //$NON-NLS-1$
+ assertEquals(commandLine, sb);
}
private static void runCommandLine(String commandLine, String[] arguments) throws IOException,
@@ -164,19 +161,22 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
// -- tests:
-
+ @Test
public void testEmpty() throws Exception {
execute("", new String[0]); //$NON-NLS-1$
}
+ @Test
public void test1arg() throws Exception {
execute("a", new String[] { "a" }); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void test2arg() throws Exception {
execute("a b", new String[] { "a", "b" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ @Test
public void test100arg() throws Exception {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < 100; i++) {
@@ -188,6 +188,7 @@ public class ArgumentParsingTests extends AbstractDebugTest {
execute(buf.toString(), args, buf.toString().trim());
}
+ @Test
public void testEscape() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute1Arg("\\1"); //$NON-NLS-1$
@@ -196,22 +197,40 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
+ public void testRenderWindowsBackslash() throws Exception {
+ String[] arguments = {
+ "-Dfoo=\"abc\\def\\ghi\""
+ };
+ String rendered = DebugPlugin.renderArguments(arguments, null);
+ if (Platform.getOS().equals(Constants.OS_WIN32)) {
+ assertEquals("unexpected renderArguments result;", "-Dfoo=\\\"abc\\def\\ghi\\\"", rendered); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ assertEquals("unexpected renderArguments result;", "-Dfoo=\\\"abc\\\\def\\\\ghi\\\"", rendered); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ @Test
public void testEscapeDoubleQuote1() throws Exception {
execute1Arg("\\\"", "\"", "\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ @Test
public void testEscapeDoubleQuote2() throws Exception {
execute1Arg("arg=\\\"bla\\\"", "arg=\"bla\"", "arg=\\\"bla\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ @Test
public void testDoubleQuoted1() throws Exception {
execute1Arg("\"1 2\"", "1 2"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testDoubleQuoted2() throws Exception {
execute1Arg("\"1\"", "1", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ @Test
public void testDoubleQuoted3() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
// execute1Arg("\"\"", "", "\"\""); // would be correct, but ProcessImpl is buggy on Windows JDKs
@@ -221,6 +240,7 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testDoubleQuoted4() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute1Arg("\"\"\"\"", "\"", "\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -229,10 +249,12 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testDoubleQuoted5() throws Exception {
execute1Arg("ab\"cd\"ef\"gh\"", "abcdefgh", "abcdefgh"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
+ @Test
public void testDoubleQuotedWithSpace1() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute1Arg("\"\"\"1\"\" 2\"", "\"1\" 2", "\"\\\"1\\\" 2\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -241,10 +263,12 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testDoubleQuotedWithSpace2() throws Exception {
execute1Arg("\"\\\"1\\\" 2\"", "\"1\" 2"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testSingleQuoted1() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute("'1 2'", new String[] { "'1", "2'" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -253,6 +277,7 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testSingleQuoted2() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute1Arg("'1'", "'1'", "'1'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -261,10 +286,12 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testWindows1() throws Exception {
execute("\"a b c\" d e", new String[] { "a b c", "d", "e" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
+ @Test
public void testWindows2() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute("\"ab\\\"c\" \"\\\\\" d", new String[] { "ab\"c", "\\", "d" }, "ab\\\"c \\ d"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
@@ -273,6 +300,7 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testWindows3() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute("a\\\\\\b d\"e f\"g h", new String[] { "a\\\\\\b", "de fg", "h" }, "a\\\\\\b \"de fg\" h"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
@@ -281,10 +309,12 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testWindows4() throws Exception {
execute("a\\\\\\\"b c d", new String[] { "a\\\"b", "c", "d" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
+ @Test
public void testWindows5() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute("a\\\\\\\\\"b c\" d e", new String[] { "a\\\\b c", "d", "e" }, "\"a\\\\b c\" d e"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
@@ -293,6 +323,7 @@ public class ArgumentParsingTests extends AbstractDebugTest {
}
}
+ @Test
public void testAllInOne() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
execute("1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 \"ab\"cd 7 ef\"gh\" 8 i\"\"j 9 \"x\\\"y\\\\\" 10 z\\\\z 11 \"two-quotes:\"\"\"\"\" 12 \"g\"\"h\" 13 \"\"\"a\"\" b\"", //$NON-NLS-1$
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentsPrinter.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentsPrinter.java
index b3c21e9b7..d97e4d811 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentsPrinter.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ArgumentsPrinter.java
@@ -18,8 +18,7 @@ package org.eclipse.debug.tests.launching;
*/
public class ArgumentsPrinter {
public static void main(String[] args) {
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
+ for (String arg : args) {
System.out.println(arg);
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java
index 47fd1d7fa..63a630b1c 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/DebugFileStore.java
@@ -64,8 +64,7 @@ public class DebugFileStore extends FileStore {
URI[] uris = DebugFileSystem.getDefault().getFileURIs();
List<String> children = new ArrayList<>();
IPath me = getPath();
- for (int i = 0; i < uris.length; i++) {
- URI id = uris[i];
+ for (URI id : uris) {
Path path = new Path(id.getPath());
if (path.segmentCount() > 0) {
if (path.removeLastSegments(1).equals(me)) {
@@ -159,13 +158,11 @@ public class DebugFileStore extends FileStore {
IFileStore parent = getParent();
if (parent.fetchInfo().exists()) {
DebugFileSystem.getDefault().setContents(toURI(), DebugFileSystem.DIRECTORY_BYTES);
+ } else if ((options & EFS.SHALLOW) > 0) {
+ throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests", //$NON-NLS-1$
+ "mkdir failed - parent does not exist: " + toURI())); //$NON-NLS-1$
} else {
- if ((options & EFS.SHALLOW) > 0) {
- throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests", //$NON-NLS-1$
- "mkdir failed - parent does not exist: " + toURI())); //$NON-NLS-1$
- } else {
- parent.mkdir(EFS.NONE, null);
- }
+ parent.mkdir(EFS.NONE, null);
}
}
return this;
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 a702ff4dc..26e101ca5 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,13 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
@@ -33,6 +40,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileSystem;
@@ -54,14 +62,18 @@ import org.eclipse.debug.core.ILaunchConfigurationListener;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
import org.eclipse.debug.core.Launch;
+import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.internal.core.LaunchConfiguration;
import org.eclipse.debug.internal.core.LaunchManager;
import org.eclipse.debug.tests.TestsPlugin;
+import org.eclipse.debug.tests.console.MockProcess;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
import org.osgi.framework.Bundle;
/**
@@ -89,7 +101,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* Class to hold resource description infos
* @since 3.9.0
*/
- class ResourceItem {
+ static class ResourceItem {
public ResourceItem(String path, Integer type) {
this.path = path;
this.type = type;
@@ -98,7 +110,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
Integer type;
}
- class Listener implements ILaunchConfigurationListener {
+ static class Listener implements ILaunchConfigurationListener {
private final List<ILaunchConfiguration> addedList = new ArrayList<>();
private final List<ILaunchConfiguration> removedList = new ArrayList<>();
@@ -203,14 +215,6 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Constructor
- * @param name
- */
- public LaunchConfigurationTests(String name) {
- super(name);
- }
-
- /**
* Returns a scratch project for launch configurations
*
* @return
@@ -288,8 +292,8 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* array of handles.
*/
protected boolean existsIn(ILaunchConfiguration[] configs, ILaunchConfiguration config) {
- for (int i = 0; i < configs.length; i++) {
- if (configs[i].equals(config)) {
+ for (ILaunchConfiguration c : configs) {
+ if (c.equals(config)) {
return true;
}
}
@@ -297,11 +301,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a local working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes.
+ * Creates a local working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes.
*
* @throws CoreException
*/
+ @Test
public void testCreateLocalConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -329,6 +334,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testLocalName() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "localName"); //$NON-NLS-1$
ILaunchConfiguration handle = wc.doSave();
@@ -345,6 +351,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Creates a shared working copy configuration and tests is name.
*/
+ @Test
public void testSharedName() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "sharedName"); //$NON-NLS-1$
ILaunchConfiguration handle = wc.doSave();
@@ -360,8 +367,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Ensures that a launch configuration returns a complete attribute map
+ *
* @throws CoreException
*/
+ @Test
public void testGetAttributes() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -383,8 +392,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Ensures that set attributes works
+ *
* @throws CoreException
*/
+ @Test
public void testSetAttributes() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
Map<String, Object> map = new HashMap<>();
@@ -409,8 +420,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Ensures that set attributes to <code>null</code> works
+ *
* @throws CoreException
*/
+ @Test
public void testSetNullAttributes() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
wc.setAttributes(null);
@@ -427,11 +440,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a local working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes.
- * Copy the configuration and ensure the original still exists.
+ * Creates a local working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes. Copy the
+ * configuration and ensure the original still exists.
+ *
* @throws CoreException
*/
+ @Test
public void testLocalCopy() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configToCopy"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -469,10 +484,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Create a config and save it twice, ensuring it only
- * ends up in the index once.
+ * Create a config and save it twice, ensuring it only ends up in the index
+ * once.
+ *
* @throws CoreException
*/
+ @Test
public void testDoubleSave() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configDoubleSave"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -506,11 +523,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a local working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes. Deletes
- * the configuration and ensures it no longer exists.
+ * Creates a local working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes. Deletes the
+ * configuration and ensures it no longer exists.
+ *
* @throws CoreException
*/
+ @Test
public void testDeleteLocalConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2delete"); //$NON-NLS-1$
ILaunchConfiguration handle = wc.doSave();
@@ -533,12 +552,14 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a local working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes. Renames
- * the configuration and ensures it's old config no longer exists,
- * and that attributes are retrievable from the new (renamed) config.
+ * Creates a local working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes. Renames the
+ * configuration and ensures it's old config no longer exists, and that
+ * attributes are retrievable from the new (renamed) config.
+ *
* @throws CoreException
*/
+ @Test
public void testRenameLocalConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2rename"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -580,8 +601,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Moves a local configuration to a shared location
+ *
* @throws CoreException
*/
+ @Test
public void testMoveLocalToSharedConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2share"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -623,8 +646,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Moves a local configuration to a shared location
+ *
* @throws CoreException
*/
+ @Test
public void testMoveSharedToLocalConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2local"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -665,10 +690,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a shared working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes.
+ * Creates a shared working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes.
+ *
* @throws CoreException
*/
+ @Test
public void testCreateSharedConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2"); //$NON-NLS-1$
ILaunchConfiguration handle = wc.doSave();
@@ -690,11 +717,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a shared working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes.
- * Copies the configuration and ensures the original still exists.
+ * Creates a shared working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes. Copies the
+ * configuration and ensures the original still exists.
+ *
* @throws CoreException
*/
+ @Test
public void testSharedCopy() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2Copy"); //$NON-NLS-1$
ILaunchConfiguration handle = wc.doSave();
@@ -731,11 +760,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
- * Creates a shared working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes. Deletes
- * the configuration and ensures it no longer exists.
+ * Creates a shared working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes. Deletes the
+ * configuration and ensures it no longer exists.
+ *
* @throws CoreException
*/
+ @Test
public void testDeleteSharedConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2delete"); //$NON-NLS-1$
ILaunchConfiguration handle = wc.doSave();
@@ -757,12 +788,14 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a shared working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes. Renames
- * the configuration and ensures it's old config no longer exists,
- * and that attributes are retrievable from the new (renamed) config.
+ * Creates a shared working copy configuration, sets some attributes, and
+ * saves the working copy, and retrieves the attributes. Renames the
+ * configuration and ensures it's old config no longer exists, and that
+ * attributes are retrievable from the new (renamed) config.
+ *
* @throws CoreException
*/
+ @Test
public void testRenameSharedConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2rename"); //$NON-NLS-1$
ILaunchConfiguration handle = wc.doSave();
@@ -809,10 +842,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a few configs, closes the project and re-opens the
- * project to ensure the config index is persisted properly
+ * Creates a few configs, closes the project and re-opens the project to
+ * ensure the config index is persisted properly
+ *
* @throws CoreException
*/
+ @Test
public void testPersistIndex() throws CoreException {
// close all editors before closing project: @see bug 204023
closeAllEditors();
@@ -830,16 +865,16 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
project.close(null);
ILaunchConfiguration[] during = getLaunchManager().getLaunchConfigurations();
boolean local = true;
- for (int i = 0; i < during.length; i++) {
+ for (ILaunchConfiguration d : during) {
// must be local, or not from the closed project
- local = local && (during[i].isLocal() || !during[i].getFile().getProject().equals(project));
+ local = local && (d.isLocal() || !d.getFile().getProject().equals(project));
}
project.open(null);
assertTrue("Should only be local configs when closed", local); //$NON-NLS-1$
ILaunchConfiguration[] after = getLaunchManager().getLaunchConfigurations();
assertTrue("Should be same number of configs after openning", after.length == before.length); //$NON-NLS-1$
- for (int i = 0; i < before.length; i++) {
- assertTrue("Config should exist after openning", existsIn(after, before[i])); //$NON-NLS-1$
+ for (ILaunchConfiguration b : before) {
+ assertTrue("Config should exist after openning", existsIn(after, b)); //$NON-NLS-1$
}
// cleanup
@@ -892,11 +927,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Ensures that a removal notification is sent for a shared config in a project
- * that is deleted.
+ * Ensures that a removal notification is sent for a shared config in a
+ * project that is deleted.
*
* @throws Exception
*/
+ @Test
public void testDeleteProjectWithSharedConfig() throws Exception {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("DeleteSharedConfig"); //$NON-NLS-1$
try {
@@ -932,6 +968,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testNestedWorkingCopyLocalConfiguration() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config123"); //$NON-NLS-1$
IPath location = wc.getLocation();
@@ -983,11 +1020,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a configuration in an EFS linked folder. Deletes configuration directly.
+ * Creates a configuration in an EFS linked folder. Deletes configuration
+ * directly.
*
* @throws CoreException
* @throws URISyntaxException
*/
+ @Test
public void testCreateDeleteEFS() throws CoreException, URISyntaxException {
IFileSystem fileSystem = EFS.getFileSystem("debug"); //$NON-NLS-1$
assertNotNull("Missing debug EFS", fileSystem); //$NON-NLS-1$
@@ -1016,12 +1055,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Creates a configuration in an EFS linked folder. Deletes the folder to ensure the
- * configuration is also deleted.
+ * Creates a configuration in an EFS linked folder. Deletes the folder to
+ * ensure the configuration is also deleted.
*
* @throws CoreException
* @throws URISyntaxException
*/
+ @Test
public void testCreateDeleteEFSLink() throws CoreException, URISyntaxException {
IFileSystem fileSystem = EFS.getFileSystem("debug"); //$NON-NLS-1$
assertNotNull("Missing debug EFS", fileSystem); //$NON-NLS-1$
@@ -1052,6 +1092,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws Exception
*/
+ @Test
public void testEFSProjectRename() throws Exception {
// create test project
IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("RenameEFS"); //$NON-NLS-1$
@@ -1115,6 +1156,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws Exception
*/
+ @Test
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$
@@ -1130,14 +1172,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
getLaunchManager().addLaunchConfigurationListener(listener);
// import
manager.importConfigurations(dir.listFiles(
- new FileFilter() {
- @Override
- public boolean accept(File file) {
- return file.isFile() &&
- file.getName().endsWith(
- ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
- }
- }),
+ (FileFilter) file -> file.isFile() && file.getName().endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION)),
null);
// should be one removed
@@ -1175,6 +1210,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testWorkingCopyGetLocation() throws CoreException {
ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-get-location"); //$NON-NLS-1$
IPath location = workingCopy.getLocation();
@@ -1182,27 +1218,82 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Tests that the framework adds time stamps to launch objects.
+ * Tests that the framework adds launch time stamps to launch objects.
*/
+ @Test
public void testLaunchTimeStamp() throws CoreException {
ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-time-stamp"); //$NON-NLS-1$
ILaunch launch = workingCopy.launch(ILaunchManager.DEBUG_MODE, null);
try {
String stamp = launch.getAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP);
assertNotNull("missing time stamp", stamp); //$NON-NLS-1$
- Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not
+ long lstamp = Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not
+ assertTrue("Time travel launch", lstamp <= System.currentTimeMillis());
+ } finally {
+ if (launch != null) {
+ getLaunchManager().removeLaunch(launch);
+ }
+ }
+ }
+
+ /**
+ * Tests that the framework adds terminate time stamps to launch and process
+ * objects.
+ */
+ @Test
+ public void testTerminateTimeStamp() throws Exception {
+ ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-time-stamp"); //$NON-NLS-1$
+ ILaunch launch = workingCopy.launch(ILaunchManager.DEBUG_MODE, null);
+ AtomicBoolean launchTerminated = new AtomicBoolean();
+ ILaunchesListener2 listener = new ILaunchesListener2() {
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ for (ILaunch l : launches) {
+ if (l == launch) {
+ launchTerminated.set(true);
+ }
+ }
+ }
+ };
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(listener);
+ IProcess process = null;
+ try {
+ process = DebugPlugin.newProcess(launch, new MockProcess(0), "test-terminate-timestamp");
+ waitWhile(c -> !launchTerminated.get(), testTimeout, c -> "Launch did not finished");
+ String stamp = launch.getAttribute(DebugPlugin.ATTR_TERMINATE_TIMESTAMP);
+ assertNotNull("missing time stamp", stamp); //$NON-NLS-1$
+ long lstamp = Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not
+ assertTrue("Time travel launch", lstamp <= System.currentTimeMillis());
} finally {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(listener);
if (launch != null) {
getLaunchManager().removeLaunch(launch);
}
+ if (process != null) {
+ process.terminate();
+ }
}
}
/**
- * Tests that attributes in a nested map are persisted in alphabetical order.
+ * Tests that attributes in a nested map are persisted in alphabetical
+ * order.
*
* @throws CoreException
*/
+ @Test
public void testMapAttributePersistence() throws CoreException, IOException {
ILaunchConfigurationWorkingCopy c1 = newEmptyConfiguration(getProject(), "testMapAttributes1"); //$NON-NLS-1$
HashMap<String, String> map = new HashMap<>();
@@ -1267,8 +1358,11 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
c2.doSave();
// file contents should be the same
- char[] chars1 = getInputStreamAsCharArray(c1.getFile().getContents());
- char[] chars2 = getInputStreamAsCharArray(c2.getFile().getContents());
+ char[] chars1, chars2;
+ try (InputStream in1 = c1.getFile().getContents(); InputStream in2 = c2.getFile().getContents()) {
+ chars1 = getInputStreamAsCharArray(in1);
+ chars2 = getInputStreamAsCharArray(in2);
+ }
assertEquals("Should be the same characters", chars1.length, chars2.length); //$NON-NLS-1$
for (int i = 0; i < chars2.length; i++) {
assertEquals("Should be the same character", chars1[i], chars2[i]); //$NON-NLS-1$
@@ -1277,10 +1371,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Tests that attributes in a nested set are persisted in alphabetical order.
+ * Tests that attributes in a nested set are persisted in alphabetical
+ * order.
*
* @throws CoreException
*/
+ @Test
public void testSetAttributePersistence() throws CoreException, IOException {
ILaunchConfigurationWorkingCopy c1 = newEmptyConfiguration(getProject(), "testSetAttributes1"); //$NON-NLS-1$
Set<String> set = new HashSet<>();
@@ -1345,8 +1441,11 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
c2.doSave();
// file contents should be the same
- char[] chars1 = getInputStreamAsCharArray(c1.getFile().getContents());
- char[] chars2 = getInputStreamAsCharArray(c2.getFile().getContents());
+ char[] chars1, chars2;
+ try (InputStream in1 = c1.getFile().getContents(); InputStream in2 = c2.getFile().getContents()) {
+ chars1 = getInputStreamAsCharArray(in1);
+ chars2 = getInputStreamAsCharArray(in2);
+ }
assertEquals("Should be the same characters", chars1.length, chars2.length); //$NON-NLS-1$
for (int i = 0; i < chars2.length; i++) {
assertEquals("Should be the same character", chars1[i], chars2[i]); //$NON-NLS-1$
@@ -1355,11 +1454,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Ensures that client does not attempt to nest configurations in a sub directory when
- * using local metadata location. See bug 275741.
+ * Ensures that client does not attempt to nest configurations in a sub
+ * directory when using local metadata location. See bug 275741.
*
* @throws CoreException
*/
+ @Test
public void testIllegalFileSepCharName() {
try {
newConfiguration(null, new Path("some").append("nested").append("config").toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -1371,12 +1471,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Ensures that client can nest configurations in a sub directory when
- * using a workspace location. See bug 275741. For behavior compatibility
- * a client should be able to use a slash in the configuration name.
+ * Ensures that client can nest configurations in a sub directory when using
+ * a workspace location. See bug 275741. For behavior compatibility a client
+ * should be able to use a slash in the configuration name.
*
* @throws CoreException
*/
+ @Test
public void testLegalFileSepCharName() {
try {
newConfiguration(getProject(), new Path("some").append("nested").append("config").toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -1390,6 +1491,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testIllegalCharName() {
try {
newConfiguration(getProject(), "<config>"); //$NON-NLS-1$
@@ -1401,10 +1503,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Test that moving and renaming a shared configuration at the same time works.
+ * Test that moving and renaming a shared configuration at the same time
+ * works.
*
* @throws CoreException
*/
+ @Test
public void testRenameAndMoveShared() throws CoreException {
IProject project = getProject();
IFolder f1 = project.getFolder("f1"); //$NON-NLS-1$
@@ -1425,11 +1529,15 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Test support for a URL in the 'icon' part of the launchConfigurationTypeImages extension point
+ * Test support for a URL in the 'icon' part of the
+ * launchConfigurationTypeImages extension point
+ *
+ * Bug 381175 - [patch] launchConfigurationTypeImage to support platform:
+ * style icons
*
- * Bug 381175 - [patch] launchConfigurationTypeImage to support platform: style icons
* @throws Exception
*/
+ @Test
public void testGetTypeImageFromURI() throws Exception {
ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type1"); //$NON-NLS-1$
assertNotNull("The image descriptior type.image.1 must exist", descriptor); //$NON-NLS-1$
@@ -1438,8 +1546,10 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Test support for a declared launch configuration type image
+ *
* @throws Exception
*/
+ @Test
public void testGetTyeImage() throws Exception {
ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type"); //$NON-NLS-1$
assertNotNull("The image descriptior type.image.2 must exist", descriptor); //$NON-NLS-1$
@@ -1453,6 +1563,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
* @since 3.9.0
*/
+ @Test
public void testGetProjectMappedResource1() throws Exception {
ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
@@ -1475,6 +1586,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
* @since 3.9.0
*/
+ @Test
public void testGetProjectMappedResource2() throws Exception {
ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
@@ -1496,6 +1608,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
* @since 3.9.0
*/
+ @Test
public void testGetProjectMappedResource3() throws Exception {
ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
@@ -1522,6 +1635,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
* @since 3.9.0
*/
+ @Test
public void testGetProjectMappedResource4() throws Exception {
ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
@@ -1544,6 +1658,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
* @since 3.9.0
*/
+ @Test
public void testNullLaunchConfigurationInLaunch() throws Exception {
Launch l = new Launch(null, ILaunchManager.RUN_MODE, null);
LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager();
@@ -1584,6 +1699,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testCopyAttributes() throws CoreException {
ILaunchConfigurationWorkingCopy source = newPrototype(null, "test-copy-attributes-source"); //$NON-NLS-1$
ILaunchConfigurationWorkingCopy dest = newEmptyConfiguration(null, "test-copy-attributes-dest"); //$NON-NLS-1$
@@ -1599,6 +1715,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testCreationFromPrototype() throws CoreException {
ILaunchConfigurationWorkingCopy temp = newPrototype(null, "test-creation-from-prototype"); //$NON-NLS-1$
temp.setAttribute("TEMPLATE", "TEMPLATE"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1616,6 +1733,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testIsPrototype() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newPrototype(null, "test-is-prototype"); //$NON-NLS-1$
ILaunchConfiguration prototype = wc.doSave();
@@ -1632,6 +1750,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testPrototypeChildren() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newPrototype(null, "test-references"); //$NON-NLS-1$
ILaunchConfiguration prototype = wc.doSave();
@@ -1661,6 +1780,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testPrototypeRemoveBehavior() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "test-remove"); //$NON-NLS-1$
ILaunchConfigurationWorkingCopy t1 = newEmptyPrototype(null, "prototype-1"); //$NON-NLS-1$
@@ -1680,11 +1800,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
}
/**
- * Tests that setting a configuration's prototype to null cleans its prototype
- * association.
+ * Tests that setting a configuration's prototype to null cleans its
+ * prototype association.
*
* @throws CoreException
*/
+ @Test
public void testUnPrototype() throws CoreException {
ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "test-un-prototype"); //$NON-NLS-1$
ILaunchConfigurationWorkingCopy t1 = newEmptyPrototype(null, "prototype-un"); //$NON-NLS-1$
@@ -1708,6 +1829,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testNestedPrototypes() throws CoreException {
ILaunchConfigurationWorkingCopy t1 = newPrototype(null, "test-nest-root"); //$NON-NLS-1$
ILaunchConfigurationWorkingCopy t2 = newPrototype(null, "prototype-nested"); //$NON-NLS-1$
@@ -1725,6 +1847,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testIllegalPrototype() throws CoreException {
ILaunchConfigurationWorkingCopy c1 = newConfiguration(null, "test-config"); //$NON-NLS-1$
ILaunchConfigurationWorkingCopy t1 = newConfiguration(null, "test-not-a-prototype"); //$NON-NLS-1$
@@ -1743,10 +1866,43 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*
* @throws CoreException
*/
+ @Test
public void testCopyPrototype() throws CoreException {
ILaunchConfigurationWorkingCopy t1 = newEmptyPrototype(null, "prototype-to-duplicate"); //$NON-NLS-1$
ILaunchConfigurationWorkingCopy t2 = t1.copy("duplicate-prototype"); //$NON-NLS-1$
assertTrue(t2.isPrototype());
}
+ @Test
+ public void testNewInstanceNotifiesListener() throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ final ArrayList<String> added = new ArrayList<>();
+ ILaunchConfigurationListener listener = new ILaunchConfigurationListener() {
+
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+
+ }
+
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+
+ }
+
+ @Override
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ added.add("Launch Configuration added");
+
+ }
+ };
+ launchManager.addLaunchConfigurationListener(listener);
+ String typeId = "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType";
+
+ ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(typeId);
+ type.newInstance(null, "new-lc").doSave();
+ assertEquals(1, added.size());
+ assertEquals("Launch Configuration added", added.get(0));
+
+ }
+
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchFavoriteTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchFavoriteTests.java
index 27a4edf1a..a33fbbea8 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchFavoriteTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchFavoriteTests.java
@@ -13,6 +13,11 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
@@ -21,6 +26,9 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* Test the launch history favorites get updated properly as configurations as
@@ -37,15 +45,8 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
private ILaunchConfiguration fConfig;
/**
- * Constructor
- * @param name
- */
- public LaunchFavoriteTests(String name) {
- super(name);
- }
-
- /**
* Returns the run launch history
+ *
* @return
*/
private LaunchHistory getRunLaunchHistory() {
@@ -61,16 +62,18 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
}
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// clear the favorites
getRunLaunchHistory().setFavorites(new ILaunchConfiguration[0]);
getDebugLaunchHistory().setFavorites(new ILaunchConfiguration[0]);
- fConfig = getLaunchConfiguration(getName());
+ fConfig = getLaunchConfiguration(name.getMethodName());
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
// delete the configuration used during this test
ILaunchConfiguration configuration = getLaunchConfiguration();
if (configuration.exists()) {
@@ -157,8 +160,8 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
if (size != -1) {
assertEquals("Favorites wrong size", size, favorites.length); //$NON-NLS-1$
}
- for (int i = 0; i < favorites.length; i++) {
- if (configuration.equals(favorites[i])) {
+ for (ILaunchConfiguration favorite : favorites) {
+ if (configuration.equals(favorite)) {
return true;
}
}
@@ -170,6 +173,7 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
*
* @throws CoreException
*/
+ @Test
public void testBecomeFavorite() throws CoreException {
ILaunchConfigurationWorkingCopy wc = addFavorite(getLaunchConfiguration(), IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
addFavorite(wc, IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
@@ -179,10 +183,12 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
}
/**
- * Tests that a when a favorite is no longer a favorite, it gets removed from the favorites.
+ * Tests that a when a favorite is no longer a favorite, it gets removed
+ * from the favorites.
*
* @throws CoreException
*/
+ @Test
public void testUnFavorite() throws CoreException {
testBecomeFavorite(); // create favorite in two histories
ILaunchConfigurationWorkingCopy wc = removeFavorite(getLaunchConfiguration(), IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
@@ -197,6 +203,7 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
*
* @throws CoreException
*/
+ @Test
public void testDeleteConfiguration() throws CoreException {
testBecomeFavorite(); // create a favorite in two histories
ILaunchConfiguration configuration = getLaunchConfiguration();
@@ -206,10 +213,12 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
}
/**
- * When a favorite is renamed, it should still be in the list, with the new name.
+ * When a favorite is renamed, it should still be in the list, with the new
+ * name.
*
* @throws CoreException
*/
+ @Test
public void testRenameFavorite() throws CoreException {
testBecomeFavorite();
ILaunchConfiguration original = getLaunchConfiguration();
@@ -222,10 +231,12 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
}
/**
- * Renaming a configuration and making it a favorite at the same time - should appear in the list.
+ * Renaming a configuration and making it a favorite at the same time -
+ * should appear in the list.
*
* @throws CoreException
*/
+ @Test
public void testRenameBecomeFavorite() throws CoreException {
ILaunchConfiguration original = getLaunchConfiguration();
ILaunchConfigurationWorkingCopy copy = original.getWorkingCopy();
@@ -239,10 +250,12 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
}
/**
- * Renaming a configuration and removing its favorite status should remove it from the list.
+ * Renaming a configuration and removing its favorite status should remove
+ * it from the list.
*
* @throws CoreException
*/
+ @Test
public void testRenameUnFavorite() throws CoreException {
testBecomeFavorite();
ILaunchConfiguration original = getLaunchConfiguration();
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java
index 0b64fda8b..74ed4a95f 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchGroupTests.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
@@ -48,6 +51,9 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory;
import org.eclipse.debug.tests.TestUtil;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
public class LaunchGroupTests extends AbstractLaunchTest {
@@ -73,12 +79,9 @@ public class LaunchGroupTests extends AbstractLaunchTest {
}
};
- public LaunchGroupTests() {
- super("Launch Groups Test"); //$NON-NLS-1$
- }
-
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// reset count
@@ -86,7 +89,8 @@ public class LaunchGroupTests extends AbstractLaunchTest {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
// make sure listener is removed
getLaunchManager().removeLaunchListener(lcListener);
ILaunch[] launches = getLaunchManager().getLaunches();
@@ -100,7 +104,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
launch.terminate();
}
} catch (Exception e) {
- TestUtil.log(IStatus.ERROR, getName(), "Error terminating launch: " + launch, e);
+ TestUtil.log(IStatus.ERROR, name.getMethodName(), "Error terminating launch: " + launch, e);
}
}
super.tearDown();
@@ -137,6 +141,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
return h;
}
+ @Test
public void testNone() throws Exception {
ILaunchConfiguration t1 = getLaunchConfiguration("Test1"); //$NON-NLS-1$
ILaunchConfiguration t2 = getLaunchConfiguration("Test2"); //$NON-NLS-1$
@@ -153,6 +158,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
assertTrue("history[2] should be Test1", history[2].contentsEqual(t1)); //$NON-NLS-1$
}
+ @Test
public void testDelay() throws Exception {
ILaunchConfiguration t1 = getLaunchConfiguration("Test1"); //$NON-NLS-1$
ILaunchConfiguration t2 = getLaunchConfiguration("Test2"); //$NON-NLS-1$
@@ -172,6 +178,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
assertTrue("history[2] should be Test1", history[2].contentsEqual(t1)); //$NON-NLS-1$
}
+ @Test
public void testTerminated() throws Exception {
final ILaunchConfiguration t1 = getLaunchConfiguration("Test1"); //$NON-NLS-1$
final ILaunchConfiguration t2 = getLaunchConfiguration("Test2"); //$NON-NLS-1$
@@ -217,6 +224,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
assertTrue("history[2] should be Test1", history[2].contentsEqual(t1)); //$NON-NLS-1$
}
+ @Test
public void testAdopt() throws Exception {
final ILaunchConfiguration t1 = getLaunchConfiguration("Test1"); //$NON-NLS-1$
final ILaunchConfiguration grp = createLaunchGroup(DEF_GRP_NAME, createLaunchGroupElement(t1, GroupElementPostLaunchAction.NONE, null, false), createLaunchGroupElement(t1, GroupElementPostLaunchAction.NONE, null, true));
@@ -235,6 +243,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
assertEquals("Test1 should be launched only once", 1, launchCount.get()); //$NON-NLS-1$
}
+ @Test
public void testAdoptComplex() throws Exception {
final ILaunchConfiguration t1 = getLaunchConfiguration("Test1"); //$NON-NLS-1$
@@ -265,6 +274,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
assertEquals("Test1 should be launched only once", 1, launchCount.get()); //$NON-NLS-1$
}
+ @Test
public void testWaitForOutput() throws Exception {
String testOutput = "TestOutput"; //$NON-NLS-1$
@@ -318,6 +328,7 @@ public class LaunchGroupTests extends AbstractLaunchTest {
assertTrue("history[2] should be Test1", history[2].contentsEqual(t1)); //$NON-NLS-1$
}
+ @Test
public void testRename() throws Exception {
ILaunchConfiguration t1 = getLaunchConfiguration("Test1"); //$NON-NLS-1$
ILaunchConfiguration t2 = getLaunchConfiguration("Test2"); //$NON-NLS-1$
@@ -337,8 +348,10 @@ public class LaunchGroupTests extends AbstractLaunchTest {
}
/**
- * Test for Bug 529651. Build before launch was not invoked for launches started as part of group launch.
+ * Test for Bug 529651. Build before launch was not invoked for launches
+ * started as part of group launch.
*/
+ @Test
public void testBuildBeforeLaunch() throws CoreException {
final AtomicInteger launched = new AtomicInteger(0);
final AtomicInteger buildRequested = new AtomicInteger(0);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchHistoryTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchHistoryTests.java
index 923d76604..7e3321e84 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchHistoryTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchHistoryTests.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -21,6 +25,7 @@ import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.junit.Test;
/**
* Test the utilization of launch histories: sizing, ordering, completeness and correctness
@@ -35,14 +40,6 @@ import org.eclipse.debug.ui.IDebugUIConstants;
public class LaunchHistoryTests extends AbstractLaunchTest {
/**
- * Constructor
- * @param name
- */
- public LaunchHistoryTests(String name) {
- super(name);
- }
-
- /**
* Returns the run launch history
* @return
*/
@@ -63,7 +60,7 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
* @param value the new maximum size for launch histories
*/
private void setMaxHistorySize(int value) {
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_HISTORY_SIZE, value);
+ setPreference(DebugUIPlugin.getDefault().getPreferenceStore(), IDebugUIConstants.PREF_MAX_HISTORY_SIZE, value);
}
/**
@@ -75,9 +72,10 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
}
/**
- * This method tests that an item added to the history is added to the head of
- * history.
+ * This method tests that an item added to the history is added to the head
+ * of history.
*/
+ @Test
public void testHistoryAddition() throws CoreException {
LaunchHistory runhistory = getRunLaunchHistory();
assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
@@ -89,10 +87,11 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
}
/**
- * As both the run and the debug launch histories will accept a java application
- * launch config, both launch histories should contain the test launch configuration
- * and it should be the recent launch for both of them
+ * As both the run and the debug launch histories will accept a java
+ * application launch config, both launch histories should contain the test
+ * launch configuration and it should be the recent launch for both of them
*/
+ @Test
public void testHistoriesInSync() throws CoreException {
LaunchHistory runhistory = getRunLaunchHistory();
assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
@@ -108,8 +107,10 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
}
/**
- * If we launch config A, then config B, and then config A again, A should be the most recent launch
+ * If we launch config A, then config B, and then config A again, A should
+ * be the most recent launch
*/
+ @Test
public void testHistoryReodering() throws CoreException {
LaunchHistory runhistory = getRunLaunchHistory();
assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
@@ -131,9 +132,10 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
}
/**
- * If we rename a launch configuration it should not effect the launch history if the renamed configuration
- * is present in the history.
+ * If we rename a launch configuration it should not effect the launch
+ * history if the renamed configuration is present in the history.
*/
+ @Test
public void testRenameConfigHistoryUpdate() throws CoreException {
LaunchHistory runhistory = getRunLaunchHistory();
assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
@@ -154,9 +156,11 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
}
/**
- * If we delete a launch configuration and the configuration is present in the launch history, it should be removed
- * from the history and the history should be shifted up one place.
+ * If we delete a launch configuration and the configuration is present in
+ * the launch history, it should be removed from the history and the history
+ * should be shifted up one place.
*/
+ @Test
public void testDeleteLaunchConfigurationHistoryUpdate() throws CoreException {
LaunchHistory runhistory = getRunLaunchHistory();
assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
@@ -176,13 +180,13 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
}
/**
- * Tests that setting the size of the launch history appropriately changes what will be returned
- * when the history is queried for it contents
+ * Tests that setting the size of the launch history appropriately changes
+ * what will be returned when the history is queried for it contents
*/
+ @Test
public void testLaunchHistorySize() throws CoreException {
LaunchHistory runhistory = getRunLaunchHistory();
assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
- int oldsize = getMaxHistorySize();
setMaxHistorySize(2);
assertTrue("the maximum history size should be 2", getMaxHistorySize() == 2); //$NON-NLS-1$
ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
@@ -193,8 +197,5 @@ public class LaunchHistoryTests extends AbstractLaunchTest {
config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
assertTrue("there should only be two items in the history", runhistory.getHistory().length == getMaxHistorySize()); //$NON-NLS-1$
assertTrue("the complete launch history should be greater than or equal to the history size", runhistory.getCompleteLaunchHistory().length >= runhistory.getHistory().length); //$NON-NLS-1$
-
- //reset the history size
- setMaxHistorySize(oldsize);
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchManagerTests.java
index 9d026000d..0b2bc0045 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchManagerTests.java
@@ -13,6 +13,13 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
@@ -23,6 +30,9 @@ import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.core.LaunchManager;
import org.eclipse.debug.tests.launching.CancellingLaunchDelegate.CancellingLaunch;
+import org.eclipse.debug.tests.launching.ThrowingLaunchDelegate.ThrowingEnum;
+import org.eclipse.debug.tests.launching.ThrowingLaunchDelegate.ThrowingLaunch;
+import org.junit.Test;
/**
*
@@ -33,17 +43,11 @@ import org.eclipse.debug.tests.launching.CancellingLaunchDelegate.CancellingLaun
@SuppressWarnings("deprecation")
public class LaunchManagerTests extends AbstractLaunchTest {
- /**
- * Constructor
- * @param name
- */
- public LaunchManagerTests(String name) {
- super(name);
- }
/**
* Tests generating a valid launch configuration name
*/
+ @Test
public void testGenereateConfigName() {
String configname = "launch_configuration"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
@@ -51,9 +55,10 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests generating a launch configuration name with an unsupported char using
- * the deprecated method
+ * Tests generating a launch configuration name with an unsupported char
+ * using the deprecated method
*/
+ @Test
public void testGenereateConfigNameBadChar() {
String configname = "config:name"; //$NON-NLS-1$
String name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configname);
@@ -63,6 +68,7 @@ public class LaunchManagerTests extends AbstractLaunchTest {
/**
* Tests that a valid name is accepted as is.
*/
+ @Test
public void testGenerateValidName() {
String configname = "thisisavalidname"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
@@ -70,9 +76,10 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests generating a launch configuration name using a name that is an OS reserved
- * name. Win 32 test only.
+ * Tests generating a launch configuration name using a name that is an OS
+ * reserved name. Win 32 test only.
*/
+ @Test
public void testGenerateConfigNameReservedName() {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
String configname = "aux"; //$NON-NLS-1$
@@ -84,6 +91,7 @@ public class LaunchManagerTests extends AbstractLaunchTest {
/**
* Tests generating a configuration name that contains an invalid character
*/
+ @Test
public void testGenerateBadConfigName() {
String configname = "config:name"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
@@ -91,9 +99,10 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests generating a name that conflicts with an OS reserved name. This test is for windows only as there
- * are no reserved names on other OS's.
+ * Tests generating a name that conflicts with an OS reserved name. This
+ * test is for windows only as there are no reserved names on other OS's.
*/
+ @Test
public void testGenerateConflictingName() {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
String configname = "aux"; //$NON-NLS-1$
@@ -103,9 +112,10 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests generating a configuration name that contains an invalid character and where there
- * is another config with the replaced name already
+ * Tests generating a configuration name that contains an invalid character
+ * and where there is another config with the replaced name already
*/
+ @Test
public void testGenerateBadCharConflict() throws Exception {
String configname = "config:name"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
@@ -119,9 +129,10 @@ public class LaunchManagerTests extends AbstractLaunchTest {
/**
* Tests generating a name that conflicts with an OS reserved name and that
- * there is a config with the replaced name already. This test is for windows only as there
- * are no reserved names on other OS's.
+ * there is a config with the replaced name already. This test is for
+ * windows only as there are no reserved names on other OS's.
*/
+ @Test
public void testGenerateBadNameConflict() throws Exception {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
String configname = "com2"; //$NON-NLS-1$
@@ -136,8 +147,11 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
+ * Tests the
+ * {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)}
+ * method for correctness
*/
+ @Test
public void testValidateConfigGoodName() {
String configname = "configname"; //$NON-NLS-1$
try {
@@ -149,8 +163,11 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
+ * Tests the
+ * {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)}
+ * method for correctness
*/
+ @Test
public void testValidateConfigBadCharName() {
String configname = "config:name"; //$NON-NLS-1$
try {
@@ -163,8 +180,11 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
+ * Tests the
+ * {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)}
+ * method for correctness
*/
+ @Test
public void testValidateConfigBadName() {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
String configname = "com1"; //$NON-NLS-1$
@@ -179,9 +199,11 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Tests that generating a configuration name when there exists a configuration with that name
- * already properly updates a '(N)' counter at the end
+ * Tests that generating a configuration name when there exists a
+ * configuration with that name already properly updates a '(N)' counter at
+ * the end
*/
+ @Test
public void testGenerateNameExistingConfig() throws Exception {
String configname = "x.y.z.configname"; //$NON-NLS-1$
getLaunchConfiguration(configname);
@@ -203,6 +225,7 @@ public class LaunchManagerTests extends AbstractLaunchTest {
/**
* Tests that removing an accelerator properly removes it without affecting the base string (readable) value
*/
+ @Test
public void testRemoveAcc() {
String text = "&Remove"; //$NON-NLS-1$
String label = LaunchManager.removeAccelerators(text);
@@ -235,16 +258,17 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
- * Checks if the expected number of cancelled launches appear in the manager
+ * Checks if the expected number of <i>type</i> launches appear in the
+ * manager
*
* @param count the expected count
- * @since 3.9.100
+ * @param type the type of launches to count
*/
- void hasCancellingLaunches(int count) {
+ private void hasLaunches(Class<?> type, int count) {
ILaunch[] launches = getLaunchManager().getLaunches();
int num = 0;
- for (int i = 0; i < launches.length; i++) {
- if (launches[i] instanceof CancellingLaunch) {
+ for (ILaunch launche : launches) {
+ if (type.isInstance(launche)) {
num++;
}
}
@@ -252,6 +276,16 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
/**
+ * Checks if the expected number of cancelled launches appear in the manager
+ *
+ * @param count the expected count
+ * @since 3.9.100
+ */
+ void hasCancellingLaunches(int count) {
+ hasLaunches(CancellingLaunch.class, count);
+ }
+
+ /**
* Tests if a launch is properly removed from the launch manager when
* #preLaunchCheck is cancelled
*
@@ -259,6 +293,7 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=437122
* @since 3.9.100
*/
+ @Test
public void testCancelledPreLaunchCheck() throws Exception {
ILaunchConfiguration config = getCancellingConfiguration(true, false, false);
assertNotNull("The cancelling config should have been created", config); //$NON-NLS-1$
@@ -268,8 +303,8 @@ public class LaunchManagerTests extends AbstractLaunchTest {
hasCancellingLaunches(0);
} finally {
ILaunch[] launches = getLaunchManager().getLaunches();
- for (int i = 0; i < launches.length; i++) {
- getLaunchManager().removeLaunch(launches[i]);
+ for (ILaunch launche : launches) {
+ getLaunchManager().removeLaunch(launche);
}
config.delete();
}
@@ -283,6 +318,7 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=437122
* @since 3.9.100
*/
+ @Test
public void testCancelledFinalLaunchCheck() throws Exception {
ILaunchConfiguration config = getCancellingConfiguration(false, true, false);
assertNotNull("The cancelling config should have been created", config); //$NON-NLS-1$
@@ -292,8 +328,8 @@ public class LaunchManagerTests extends AbstractLaunchTest {
hasCancellingLaunches(0);
} finally {
ILaunch[] launches = getLaunchManager().getLaunches();
- for (int i = 0; i < launches.length; i++) {
- getLaunchManager().removeLaunch(launches[i]);
+ for (ILaunch launche : launches) {
+ getLaunchManager().removeLaunch(launche);
}
config.delete();
}
@@ -307,6 +343,7 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=437122
* @since 3.9.100
*/
+ @Test
public void testCancelledBuildForLaunch() throws Exception {
ILaunchConfiguration config = getCancellingConfiguration(false, false, true);
assertNotNull("The cancelling config should have been created", config); //$NON-NLS-1$
@@ -317,8 +354,8 @@ public class LaunchManagerTests extends AbstractLaunchTest {
// launch
} finally {
ILaunch[] launches = getLaunchManager().getLaunches();
- for (int i = 0; i < launches.length; i++) {
- getLaunchManager().removeLaunch(launches[i]);
+ for (ILaunch launche : launches) {
+ getLaunchManager().removeLaunch(launche);
}
config.delete();
}
@@ -333,6 +370,7 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* the NPE in the unpatched code, increase the size of config. However,
* increasing the number increases the runtime of the test substantially.
*/
+ @Test
public void testNPE_Bug484882() throws Exception {
// In this thread continuously creates configs so that
// org.eclipse.debug.internal.core.LaunchManager.clearConfigNameCache()
@@ -350,9 +388,9 @@ public class LaunchManagerTests extends AbstractLaunchTest {
for (int i = 0; i < config.length && !stop[0]; i++) {
config[i] = getLaunchConfiguration("Name" + i); //$NON-NLS-1$
}
- for (int i = 0; i < config.length; i++) {
- if (config[i] != null) {
- config[i].delete();
+ for (ILaunchConfiguration c : config) {
+ if (c != null) {
+ c.delete();
}
}
} catch (CoreException e) {
@@ -376,4 +414,96 @@ public class LaunchManagerTests extends AbstractLaunchTest {
}
}
}
+
+ /**
+ * Create a new configuration that will throw exception in one of the four
+ * launch delegate methods
+ *
+ * @param throwingEnum the method that should throw exception
+ * @return the new {@link ILaunchConfiguration}
+ */
+ private ILaunchConfiguration getThrowingConfiguration(ThrowingEnum throwingEnum) throws Exception {
+ ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType("throwing.type"); //$NON-NLS-1$
+ if (type != null) {
+ ILaunchConfigurationWorkingCopy copy = type.newInstance(null, getLaunchManager().generateLaunchConfigurationName("throwing " + throwingEnum)); //$NON-NLS-1$
+ copy.setAttribute("throw.preLaunchCheck", ThrowingEnum.preLaunchCheck.equals(throwingEnum)); //$NON-NLS-1$
+ copy.setAttribute("throw.finalLaunchCheck", ThrowingEnum.finalLaunchCheck.equals(throwingEnum)); //$NON-NLS-1$
+ copy.setAttribute("throw.buildForLaunch", ThrowingEnum.buildForLaunch.equals(throwingEnum)); //$NON-NLS-1$
+ copy.setAttribute("throw.launch", ThrowingEnum.launch.equals(throwingEnum)); //$NON-NLS-1$
+ return copy.doSave();
+ }
+ return null;
+ }
+
+ /**
+ * Tests if a launch is properly removed from the launch manager when
+ * <i>throwingEnum</i> method throws exception
+ *
+ * @throws Exception
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=578302
+ */
+ private void testThrowingLaunchDelegateMethod(ThrowingEnum throwingEnum) throws Exception {
+ ILaunchConfiguration config = getThrowingConfiguration(throwingEnum);
+ assertNotNull("The throwing config should have been created", config); //$NON-NLS-1$
+ try {
+ hasLaunches(ThrowingLaunch.class, 0);
+ CoreException exception = assertThrows(CoreException.class, () -> config.launch("run", new NullProgressMonitor(), true, true)); //$NON-NLS-1$
+ assertEquals("Wrong method throwed exception", exception.getMessage(), throwingEnum.toString());
+ hasLaunches(ThrowingLaunch.class, 0);
+ } finally {
+ ILaunch[] launches = getLaunchManager().getLaunches();
+ for (ILaunch launche : launches) {
+ getLaunchManager().removeLaunch(launche);
+ }
+ config.delete();
+ }
+ }
+
+ /**
+ * Tests if a launch is properly removed from the launch manager when
+ * #preLaunchCheck throws exception
+ *
+ * @throws Exception
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=578302
+ */
+ @Test
+ public void testThrowingPreLaunchCheck() throws Exception {
+ testThrowingLaunchDelegateMethod(ThrowingEnum.preLaunchCheck);
+ }
+
+ /**
+ * Tests if a launch is properly removed from the launch manager when
+ * #finalLaunchCheck throws exception
+ *
+ * @throws Exception
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=578302
+ */
+ @Test
+ public void testThrowingFinalLaunchCheck() throws Exception {
+ testThrowingLaunchDelegateMethod(ThrowingEnum.finalLaunchCheck);
+ }
+
+ /**
+ * Tests if a launch is properly removed from the launch manager when
+ * #buildFoLaunch throws exception
+ *
+ * @throws Exception
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=578302
+ */
+ @Test
+ public void testThrowingBuildForLaunch() throws Exception {
+ testThrowingLaunchDelegateMethod(ThrowingEnum.buildForLaunch);
+ }
+
+ /**
+ * Tests if a launch is properly removed from the launch manager when
+ * #buildFoLaunch throws exception
+ *
+ * @throws Exception
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=578302
+ */
+ @Test
+ public void testThrowingLaunch() throws Exception {
+ testThrowingLaunchDelegateMethod(ThrowingEnum.launch);
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java
index dde7976cc..415344383 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/LaunchTests.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.ConcurrentModificationException;
@@ -28,6 +31,8 @@ import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IDisconnect;
import org.eclipse.debug.core.model.IProcess;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests for the {@link Launch} class
@@ -42,16 +47,9 @@ public class LaunchTests extends AbstractLaunchTest {
private Runnable writeProcessesTask;
private Runnable writeDebugTargetsTask;
- /**
- * Constructor
- * @param name
- */
- public LaunchTests(String name) {
- super(name);
- }
-
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
final Launch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
@@ -94,19 +92,16 @@ public class LaunchTests extends AbstractLaunchTest {
};
}
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
/**
* Modifies debug targets and checks if this causes
* {@link ConcurrentModificationException} in the another thread
*/
+ @Test
public void testTerminatedAndWriteTargets() throws Exception {
assertTrue(testExecution(readIsTerminatedTask, writeDebugTargetsTask));
}
+ @Test
public void testDisconnectedAndWriteTargets() throws Exception {
assertTrue(testExecution(readIsDisconnectedTask, writeDebugTargetsTask));
}
@@ -115,6 +110,7 @@ public class LaunchTests extends AbstractLaunchTest {
* Modifies processes and checks if this causes
* {@link ConcurrentModificationException} in the another thread
*/
+ @Test
public void testTerminatedAndWriteProcesses() throws Exception {
assertTrue(testExecution(readIsTerminatedTask, writeProcessesTask));
}
@@ -123,6 +119,7 @@ public class LaunchTests extends AbstractLaunchTest {
* Modifies processes and checks if this causes
* {@link ConcurrentModificationException} in the another thread
*/
+ @Test
public void testDisconnectedAndWriteProcesses() throws Exception {
assertTrue(testExecution(readIsDisconnectedTask, writeProcessesTask));
}
@@ -175,7 +172,7 @@ public class LaunchTests extends AbstractLaunchTest {
}
}
} finally {
- System.out.println(getName() + " runs: " + runs); //$NON-NLS-1$
+ System.out.println(name.getMethodName() + " runs: " + runs); //$NON-NLS-1$
job.cancel();
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/RefreshTabTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/RefreshTabTests.java
index 05fd4b2d8..669bd0aae 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/RefreshTabTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/RefreshTabTests.java
@@ -13,6 +13,9 @@
*******************************************************************************/
package org.eclipse.debug.tests.launching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.io.ByteArrayInputStream;
import org.eclipse.core.resources.IFile;
@@ -24,6 +27,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.RefreshUtil;
import org.eclipse.debug.internal.core.RefreshScopeComparator;
+import org.eclipse.debug.internal.core.sourcelookup.SourceLocatorMementoComparator;
import org.eclipse.debug.tests.TestsPlugin;
import org.eclipse.debug.ui.RefreshTab;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -33,6 +37,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
/**
* Tests the refresh tab.
@@ -40,14 +45,6 @@ import org.eclipse.ui.PlatformUI;
public class RefreshTabTests extends AbstractLaunchTest {
/**
- * Constructor
- * @param name
- */
- public RefreshTabTests(String name) {
- super(name);
- }
-
- /**
* Sets the selected resource in the navigator view.
*
* @param resource resource to select
@@ -70,8 +67,10 @@ public class RefreshTabTests extends AbstractLaunchTest {
/**
* Tests a refresh scope of the selected resource
+ *
* @throws CoreException
*/
+ @Test
public void testSelectedResource() throws CoreException {
String scope = "${resource}"; //$NON-NLS-1$
IResource resource = getProject().getFolder("src"); //$NON-NLS-1$
@@ -84,8 +83,10 @@ public class RefreshTabTests extends AbstractLaunchTest {
/**
* Tests a refresh scope of the selected resource's container
+ *
* @throws CoreException
*/
+ @Test
public void testSelectionsFolder() throws CoreException {
String scope = "${container}"; //$NON-NLS-1$
IResource resource = getProject().getFolder("src"); //$NON-NLS-1$
@@ -98,8 +99,10 @@ public class RefreshTabTests extends AbstractLaunchTest {
/**
* Tests a refresh scope of the selected resource's project
+ *
* @throws CoreException
*/
+ @Test
public void testSelectionsProject() throws CoreException {
String scope = "${project}"; //$NON-NLS-1$
IResource resource = getProject().getFolder("src"); //$NON-NLS-1$
@@ -112,8 +115,10 @@ public class RefreshTabTests extends AbstractLaunchTest {
/**
* Tests a refresh scope of the selected resource's project
+ *
* @throws CoreException
*/
+ @Test
public void testWorkspaceScope() throws CoreException {
String scope = "${workspace}"; //$NON-NLS-1$
IResource[] result = RefreshTab.getRefreshResources(scope);
@@ -124,8 +129,10 @@ public class RefreshTabTests extends AbstractLaunchTest {
/**
* Tests a refresh scope for a specific resource (old format)
+ *
* @throws CoreException
*/
+ @Test
public void testSpecificResource() throws CoreException {
String scope = "${resource:/RefreshTabTests/some.file}"; //$NON-NLS-1$
IResource resource = getProject().getFile("some.file"); //$NON-NLS-1$
@@ -137,8 +144,10 @@ public class RefreshTabTests extends AbstractLaunchTest {
/**
* Tests a refresh scope for a working set
+ *
* @throws CoreException
*/
+ @Test
public void testWorkingSet() throws CoreException {
String scope= "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<launchConfigurationWorkingSet factoryID=\"org.eclipse.ui.internal.WorkingSetFactory\" name=\"workingSet\" editPageId=\"org.eclipse.ui.resourceWorkingSetPage\">\n<item factoryID=\"org.eclipse.ui.internal.model.ResourceFactory\" path=\"/RefreshTabTests/some.file\" type=\"1\"/>\n</launchConfigurationWorkingSet>}"; //$NON-NLS-1$
IResource resource = getProject().getFile("some.file"); //$NON-NLS-1$
@@ -167,15 +176,35 @@ public class RefreshTabTests extends AbstractLaunchTest {
}
/**
- * Tests the launch configuration attribute comparator extension for comparing
- * old/new attribute styles.
+ * Tests the launch configuration attribute comparator extension for
+ * comparing old/new attribute styles.
*
* @throws CoreException
*/
+ @SuppressWarnings("restriction")
+ @Test
public void testRefreshScopeComparator() throws CoreException {
String oldStyle = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<launchConfigurationWorkingSet factoryID=\"org.eclipse.ui.internal.WorkingSetFactory\" name=\"workingSet\" editPageId=\"org.eclipse.ui.resourceWorkingSetPage\">\n<item factoryID=\"org.eclipse.ui.internal.model.ResourceFactory\" path=\"/RefreshTabTests/some.file\" type=\"1\"/>\n</launchConfigurationWorkingSet>}"; //$NON-NLS-1$
String newStyle = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<resources>\n<item path=\"/RefreshTabTests/some.file\" type=\"1\"/>\n</resources>}"; //$NON-NLS-1$
assertEquals("Comparator should return 0", 0, new RefreshScopeComparator().compare(oldStyle, newStyle)); //$NON-NLS-1$
+ String s1 = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<resources>\n<item path=\"/RefreshTabTests/some.file1\" type=\"1\"/>\n</resources>}"; //$NON-NLS-1$
+ String s2 = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<resources>\n<item path=\"/RefreshTabTests/some.file2\" type=\"1\"/>\n</resources>}"; //$NON-NLS-1$
+ assertEquals("Comparator should return 0", 0, new RefreshScopeComparator().compare(s1, s1)); //$NON-NLS-1$
+ assertEquals("Comparator should return 0", 0, new RefreshScopeComparator().compare(s2, s2)); //$NON-NLS-1$
+ assertEquals("Comparator should return -1", -1, new RefreshScopeComparator().compare(s1, s2)); //$NON-NLS-1$
+ assertEquals("Comparator should return 1", 1, new RefreshScopeComparator().compare(s2, s1)); //$NON-NLS-1$
+ assertEquals("Comparator should return 1", 1, new RefreshScopeComparator().compare(s1, null)); //$NON-NLS-1$
+ assertEquals("Comparator should return -1", -1, new RefreshScopeComparator().compare(null, s1)); //$NON-NLS-1$
+ assertEquals("Comparator should return 0", 0, new RefreshScopeComparator().compare(null, null)); //$NON-NLS-1$
+ String o1 = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<launchConfigurationWorkingSet factoryID=\"org.eclipse.ui.internal.WorkingSetFactory\" name=\"workingSet\" editPageId=\"org.eclipse.ui.resourceWorkingSetPage\">\n<item factoryID=\"org.eclipse.ui.internal.model.ResourceFactory\" path=\"/RefreshTabTests/some.file1\" type=\"1\"/>\n</launchConfigurationWorkingSet>}"; //$NON-NLS-1$
+ String o2 = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<launchConfigurationWorkingSet factoryID=\"org.eclipse.ui.internal.WorkingSetFactory\" name=\"workingSet\" editPageId=\"org.eclipse.ui.resourceWorkingSetPage\">\n<item factoryID=\"org.eclipse.ui.internal.model.ResourceFactory\" path=\"/RefreshTabTests/some.file2\" type=\"1\"/>\n</launchConfigurationWorkingSet>}"; //$NON-NLS-1$
+ assertEquals("Comparator should return 0", 0, new SourceLocatorMementoComparator().compare(o1, o1)); //$NON-NLS-1$
+ assertEquals("Comparator should return 0", 0, new SourceLocatorMementoComparator().compare(o2, o2)); //$NON-NLS-1$
+ assertEquals("Comparator should return -1", -1, new SourceLocatorMementoComparator().compare(o1, o2)); //$NON-NLS-1$
+ assertEquals("Comparator should return 1", 1, new SourceLocatorMementoComparator().compare(o2, o1)); //$NON-NLS-1$
+ assertEquals("Comparator should return 1", 1, new SourceLocatorMementoComparator().compare(o1, null)); //$NON-NLS-1$
+ assertEquals("Comparator should return -1", -1, new SourceLocatorMementoComparator().compare(null, o1)); //$NON-NLS-1$
+ assertEquals("Comparator should return 0", 0, new SourceLocatorMementoComparator().compare(null, null)); //$NON-NLS-1$
}
/**
@@ -183,10 +212,12 @@ public class RefreshTabTests extends AbstractLaunchTest {
*
* @throws CoreException
*/
+ @Test
public void testResourceMemento() throws CoreException {
IResource[] resources = new IResource[] { getProject(), getProject().getFile("not.exist"), getProject().getFile("some.file") }; //$NON-NLS-1$ //$NON-NLS-2$
String memento = RefreshUtil.toMemento(resources);
IResource[] restore = RefreshUtil.toResources(memento);
+ assertNotNull(resources);
assertEquals(resources.length, restore.length);
assertEquals(resources[0], restore[0]);
assertEquals(resources[1], restore[1]);
@@ -198,6 +229,7 @@ public class RefreshTabTests extends AbstractLaunchTest {
*
* @throws CoreException
*/
+ @Test
public void testEmptyResourceSet() throws CoreException {
String memento = RefreshUtil.toMemento(new IResource[]{});
IResource[] resources = RefreshUtil.toResources(memento);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ThrowingLaunchDelegate.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ThrowingLaunchDelegate.java
new file mode 100644
index 000000000..98cfd14c1
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/launching/ThrowingLaunchDelegate.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.launching;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.Launch;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
+import org.eclipse.debug.core.model.ISourceLocator;
+
+public class ThrowingLaunchDelegate implements ILaunchConfigurationDelegate2 {
+
+ class ThrowingLaunch extends Launch {
+ public ThrowingLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
+ super(launchConfiguration, mode, locator);
+ }
+ }
+
+ enum ThrowingEnum {
+ launch, buildForLaunch, finalLaunchCheck, preLaunchCheck;
+ }
+
+ @Override
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ if (configuration.getAttribute("throw.launch", true)) { //$NON-NLS-1$
+ throw new CoreException(Status.error(ThrowingEnum.launch.toString()));
+ }
+ }
+
+ @Override
+ public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
+ return new ThrowingLaunch(configuration, "run", null); //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
+ if (configuration.getAttribute("throw.buildForLaunch", true)) { //$NON-NLS-1$
+ throw new CoreException(Status.error(ThrowingEnum.buildForLaunch.toString()));
+ }
+ return true;
+ }
+
+ @Override
+ public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
+ if (configuration.getAttribute("throw.finalLaunchCheck", true)) { //$NON-NLS-1$
+ throw new CoreException(Status.error(ThrowingEnum.finalLaunchCheck.toString()));
+ }
+ return true;
+ }
+
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
+ if (configuration.getAttribute("throw.preLaunchCheck", true)) { //$NON-NLS-1$
+ throw new CoreException(Status.error(ThrowingEnum.preLaunchCheck.toString()));
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/LogicalStructureCacheTest.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/LogicalStructureCacheTest.java
new file mode 100644
index 000000000..ed58260c8
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/LogicalStructureCacheTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Julian Honnen
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Julian Honnen <julian.honnen@vector.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.logicalstructure;
+
+import static org.junit.Assert.*;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILogicalStructureType;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.internal.ui.views.variables.LogicalStructureCache;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.junit.Test;
+
+public class LogicalStructureCacheTest extends AbstractDebugTest {
+
+ @Test
+ public void testReleaseValuesOnClear() throws Exception {
+ TestValue rawValue = new TestValue("raw");
+ ILogicalStructureType[] logicalStructureTypes = DebugPlugin.getLogicalStructureTypes(rawValue);
+
+ LogicalStructureCache cache = new LogicalStructureCache();
+ IValue logicalStructure = cache.getLogicalStructure(logicalStructureTypes[0], rawValue);
+
+ assertTrue(logicalStructure.isAllocated());
+
+ cache.clear();
+
+ assertFalse(logicalStructure.isAllocated());
+ }
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestLogicalStructureTypeDelegate.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestLogicalStructureTypeDelegate.java
new file mode 100644
index 000000000..13576c139
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestLogicalStructureTypeDelegate.java
@@ -0,0 +1,29 @@
+package org.eclipse.debug.tests.logicalstructure;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate;
+import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate3;
+import org.eclipse.debug.core.model.IValue;
+
+public class TestLogicalStructureTypeDelegate implements ILogicalStructureTypeDelegate, ILogicalStructureTypeDelegate3 {
+
+ @Override
+ public boolean providesLogicalStructure(IValue value) {
+ if (value instanceof TestValue) {
+ TestValue testValue = (TestValue) value;
+ return "raw".equals(testValue.getValueString());
+ }
+ return false;
+ }
+
+ @Override
+ public IValue getLogicalStructure(IValue value) throws CoreException {
+ return new TestValue("logical structure");
+ }
+
+ @Override
+ public void releaseValue(IValue logicalStructure) {
+ ((TestValue) logicalStructure).release();
+ }
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestValue.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestValue.java
new file mode 100644
index 000000000..742f34853
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/logicalstructure/TestValue.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Julian Honnen
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Julian Honnen <julian.honnen@vector.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.logicalstructure;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.tests.TestsPlugin;
+
+class TestValue implements IValue {
+
+ private final String value;
+
+ private boolean allocated = true;
+
+ public TestValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String getModelIdentifier() {
+ return TestsPlugin.PLUGIN_ID;
+ }
+
+ @Override
+ public IDebugTarget getDebugTarget() {
+ return null;
+ }
+
+ @Override
+ public ILaunch getLaunch() {
+ return null;
+ }
+
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ return null;
+ }
+
+ @Override
+ public String getReferenceTypeName() throws DebugException {
+ return null;
+ }
+
+ @Override
+ public String getValueString() {
+ return value;
+ }
+
+ @Override
+ public boolean isAllocated() {
+ return allocated;
+ }
+
+ @Override
+ public IVariable[] getVariables() throws DebugException {
+ return new IVariable[0];
+ }
+
+ @Override
+ public boolean hasVariables() throws DebugException {
+ return false;
+ }
+
+ public void release() {
+ allocated = false;
+ }
+
+ @Override
+ public String toString() {
+ return getValueString();
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/sourcelookup/SourceLookupFacilityTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/sourcelookup/SourceLookupFacilityTests.java
index ca6b50c4e..8535bd4fa 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/sourcelookup/SourceLookupFacilityTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/sourcelookup/SourceLookupFacilityTests.java
@@ -13,15 +13,24 @@
*******************************************************************************/
package org.eclipse.debug.tests.sourcelookup;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.Field;
-import java.util.HashMap;
+import java.util.IdentityHashMap;
import java.util.LinkedHashMap;
+import java.util.Map;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupResult;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult;
+import org.junit.Test;
/**
* Tests {@link SourceLookupFacility}
@@ -44,19 +53,13 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
TestSourceLocator fTestLocator = new TestSourceLocator();
/**
- * @param name
- */
- public SourceLookupFacilityTests(String name) {
- super(name);
- }
-
- /**
* Tests calling
* {@link SourceLookupFacility#lookup(Object, org.eclipse.debug.core.model.ISourceLocator, boolean)}
* with simple type, no locator and no forcing
*
* @throws Exception
*/
+ @Test
public void testLookupStringNoLocatorNoForce() throws Exception {
try {
String artifact = "Empty"; //$NON-NLS-1$
@@ -75,6 +78,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStringNoForce() throws Exception {
try {
String artifact = "One"; //$NON-NLS-1$
@@ -100,6 +104,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStringForce() throws Exception {
try {
String artifact = "Two"; //$NON-NLS-1$
@@ -125,6 +130,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStringLocatorNoForce() throws Exception {
try {
String artifact = "Three"; //$NON-NLS-1$
@@ -143,6 +149,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStackframeNoForce() throws Exception {
try {
ISourceLookupResult result = SourceLookupFacility.getDefault().lookup(fReusableFrame, fTestDirector, false);
@@ -167,6 +174,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStackframeForce() throws Exception {
try {
ISourceLookupResult result = SourceLookupFacility.getDefault().lookup(fReusableFrame, fTestDirector, true);
@@ -191,6 +199,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStackframeWithDebugElement1() throws Exception {
try {
ISourceLookupResult result = SourceLookupFacility.getDefault().lookup(new TestStackFrame(null), null, false);
@@ -208,6 +217,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStackframeWithDebugElement2() throws Exception {
try {
ISourceLookupResult result = SourceLookupFacility.getDefault().lookup(fReusableFrame, null, false);
@@ -232,6 +242,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStackframeWithDebugElement3() throws Exception {
try {
ISourceLookupResult result = SourceLookupFacility.getDefault().lookup(fReusableFrame, null, true);
@@ -256,6 +267,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStackframeWithDebugElement4() throws Exception {
try {
ISourceLookupResult result = SourceLookupFacility.getDefault().lookup(fReusableFrame, fTestLocator, false);
@@ -280,6 +292,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
*
* @throws Exception
*/
+ @Test
public void testLookupStackframeWithDebugElement5() throws Exception {
try {
ISourceLookupResult result = SourceLookupFacility.getDefault().lookup(fReusableFrame, fTestLocator, true);
@@ -297,6 +310,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
}
}
+ @Test
public void testLRU() throws Exception {
try {
final int MAX_LRU_SIZE = 10;
@@ -304,7 +318,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
// Get the original map
Field field = SourceLookupFacility.class.getDeclaredField("fLookupResults"); //$NON-NLS-1$
field.setAccessible(true);
- HashMap<?, ?> map = (HashMap<?, ?>) field.get(null);
+ Map<?, ?> map = (Map<?, ?>) field.get(SourceLookupFacility.getDefault());
LinkedHashMap<String, ISourceLookupResult> cached = new LinkedHashMap<>();
// fill the LRU with one element overflow
@@ -330,7 +344,7 @@ public class SourceLookupFacilityTests extends AbstractDebugTest {
String artifact = "" + 0; //$NON-NLS-1$
SourceLookupResult result = SourceLookupFacility.getDefault().lookup(artifact, fTestLocator, false);
assertNotNull("There should be a result", result); //$NON-NLS-1$
- assertFalse(cached.containsValue(result));
+ assertFalse(new IdentityHashMap<>(cached).containsValue(result));
// Check: the LRU map size should not grow
assertEquals(MAX_LRU_SIZE, map.size());
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java
index b1411fe90..9e138b5f8 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.debug.tests.statushandlers;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -22,6 +26,7 @@ import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.core.Preferences;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.tests.TestsPlugin;
+import org.junit.Test;
/**
* Tests status handlers
@@ -36,6 +41,7 @@ public class StatusHandlerTests extends AbstractDebugTest {
/**
* Tests that a status handler extension exists
*/
+ @Test
public void testStatusHandlerExtension() {
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(STATUS);
assertNotNull("missing status handler extension", handler); //$NON-NLS-1$
@@ -45,6 +51,7 @@ public class StatusHandlerTests extends AbstractDebugTest {
/**
* Tests that status handlers are not returned when preference is disabled
*/
+ @Test
public void testDisableStatusHandlers() {
try {
Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false, InstanceScope.INSTANCE);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/stepfilters/StepFiltersTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/stepfilters/StepFiltersTests.java
index 768fbe55e..2ae5002b0 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/stepfilters/StepFiltersTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/stepfilters/StepFiltersTests.java
@@ -10,21 +10,28 @@
*******************************************************************************/
package org.eclipse.debug.tests.stepfilters;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IStepFilter;
import org.eclipse.debug.tests.AbstractDebugTest;
+import org.junit.Test;
/**
* Tests step filters
*/
public class StepFiltersTests extends AbstractDebugTest {
-
+ @Test
public void testStepFitlersExtension_01() {
IStepFilter[] stepFilters = DebugPlugin.getStepFilters("com.example.lalala.model"); //$NON-NLS-1$
assertNotNull(stepFilters);
assertEquals(0, stepFilters.length);
}
+ @Test
public void testStepFitlersExtension_02() {
IStepFilter[] stepFilters = DebugPlugin.getStepFilters("com.example.debug.model"); //$NON-NLS-1$
assertNotNull(stepFilters);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor1.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor1.java
new file mode 100644
index 000000000..eb2a93f82
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor1.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Andrey Loskutov and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Andrey Loskutov (loskutov@gmx.de) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.ui;
+
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.ui.actions.IVariableValueEditor;
+import org.eclipse.swt.widgets.Shell;
+
+public class TestVariableValueEditor1 implements IVariableValueEditor {
+
+ @Override
+ public boolean editVariable(IVariable variable, Shell shell) {
+ return false;
+ }
+
+ @Override
+ public boolean saveVariable(IVariable variable, String expression, Shell shell) {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor2.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor2.java
new file mode 100644
index 000000000..658968f53
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor2.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Andrey Loskutov and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Andrey Loskutov (loskutov@gmx.de) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.ui;
+
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.ui.actions.IVariableValueEditor;
+import org.eclipse.swt.widgets.Shell;
+
+public class TestVariableValueEditor2 implements IVariableValueEditor {
+
+ @Override
+ public boolean editVariable(IVariable variable, Shell shell) {
+ return false;
+ }
+
+ @Override
+ public boolean saveVariable(IVariable variable, String expression, Shell shell) {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor3.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor3.java
new file mode 100644
index 000000000..09c9cfac6
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/TestVariableValueEditor3.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Andrey Loskutov and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Andrey Loskutov (loskutov@gmx.de) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.ui;
+
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.ui.actions.IVariableValueEditor;
+import org.eclipse.swt.widgets.Shell;
+
+public class TestVariableValueEditor3 implements IVariableValueEditor {
+
+ @Override
+ public boolean editVariable(IVariable variable, Shell shell) {
+ return false;
+ }
+
+ @Override
+ public boolean saveVariable(IVariable variable, String expression, Shell shell) {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/VariableValueEditorManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/VariableValueEditorManagerTests.java
new file mode 100644
index 000000000..bbb07de01
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/ui/VariableValueEditorManagerTests.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Andrey Loskutov and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Andrey Loskutov (loskutov@gmx.de) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.ui;
+
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.debug.internal.ui.VariableValueEditorManager;
+import org.eclipse.debug.tests.AbstractDebugTest;
+import org.eclipse.debug.ui.actions.IVariableValueEditor;
+import org.junit.Test;
+
+/**
+ * Tests status handlers
+ */
+public class VariableValueEditorManagerTests extends AbstractDebugTest {
+
+ @Test
+ public void testHighestPriorityEditorUsed() {
+ IVariableValueEditor editor = VariableValueEditorManager.getDefault().getVariableValueEditor("testModel");
+ assertEquals("Not the editor with highest priority used by VariableValueEditorManager", TestVariableValueEditor2.class, editor.getClass());
+ }
+
+
+
+}
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 0fe5c99f6..7fcdeebad 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
@@ -13,22 +13,25 @@
*******************************************************************************/
package org.eclipse.debug.tests.view.memory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.debug.core.model.IMemoryBlock;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener;
import org.eclipse.debug.ui.memory.IMemoryRenderingManager;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
+import org.junit.Test;
/**
* Tests memory rendering manager
*/
public class MemoryRenderingTests extends AbstractDebugTest {
- public MemoryRenderingTests(String name) {
- super(name);
- }
-
+ @Test
public void testRenderingTypes() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryRenderingType[] types = manager.getRenderingTypes();
@@ -42,6 +45,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.unsignedint"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testRenderingTypeNames() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryRenderingType type = manager.getRenderingType("rendering_type_1"); //$NON-NLS-1$
@@ -50,6 +54,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertEquals("Wrong name", "Rendering Two", type.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testSingleBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockOne();
@@ -58,6 +63,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testDoubleBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockTwo();
@@ -67,6 +73,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testDefaultBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockOne();
@@ -75,6 +82,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testNoDefaultBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockTwo();
@@ -82,6 +90,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertEquals("Wrong number of bindings", 0, types.length); //$NON-NLS-1$
}
+ @Test
public void testPrimaryBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockOne();
@@ -89,6 +98,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertEquals("Wrong binding", "rendering_type_1", type.getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testNoPrimaryBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockTwo();
@@ -96,6 +106,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertNull("Wrong binding", type); //$NON-NLS-1$
}
+ @Test
public void testDefaultWithoutPrimaryBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockThree();
@@ -104,6 +115,7 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertEquals("Wrong binding", "rendering_type_3", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testDynamicBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockDynamic();
@@ -117,14 +129,10 @@ public class MemoryRenderingTests extends AbstractDebugTest {
assertEquals("Wrong bindings", manager.getRenderingType("rendering_type_1"), type); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testBindingChangeNotification() {
final boolean[] changed = new boolean[1];
- IMemoryRenderingBindingsListener listener = new IMemoryRenderingBindingsListener() {
- @Override
- public void memoryRenderingBindingsChanged() {
- changed[0] = true;
- }
- };
+ IMemoryRenderingBindingsListener listener = () -> changed[0] = true;
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
// bug 374447 - Need to make sure that DynamicRenderingBindings singleton
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTests.java
new file mode 100644
index 000000000..ce9c2b0db
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTests.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2021 John Dallaway and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * John Dallaway - initial implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.view.memory;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.math.BigInteger;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IMemoryBlockExtension;
+import org.eclipse.debug.core.model.MemoryByte;
+import org.eclipse.debug.internal.ui.views.memory.renderings.AbstractIntegerRendering;
+import org.eclipse.debug.internal.ui.views.memory.renderings.HexIntegerRendering;
+import org.eclipse.debug.internal.ui.views.memory.renderings.RenderingsUtil;
+import org.eclipse.debug.internal.ui.views.memory.renderings.SignedIntegerRendering;
+import org.eclipse.debug.internal.ui.views.memory.renderings.UnsignedIntegerRendering;
+import org.junit.Test;
+
+/**
+ * Tests for translation of memory bytes between in-memory representation and UI
+ * presentation
+ */
+@SuppressWarnings("restriction")
+public class TableRenderingTests {
+
+ private static final byte[] BYTES_1 = new byte[] { (byte) 0x87 };
+ private static final byte[] BYTES_2 = new byte[] { (byte) 0x98, (byte) 0x76 };
+ private static final byte[] BYTES_4 = new byte[] { (byte) 0xba, (byte) 0x98, (byte) 0x76, (byte) 0x54 };
+ private static final byte[] BYTES_8 = new byte[] {
+ (byte) 0xfe, (byte) 0xdc, (byte) 0xba, (byte) 0x98,
+ (byte) 0x76, (byte) 0x54, (byte) 0x32, (byte) 0x10 };
+ private static final byte[] BYTES_16 = new byte[16];
+ private static final byte[] BYTES_24 = new byte[24];
+
+ static {
+ BYTES_16[0] = (byte) 0x80; // 2 ^ 127
+ BYTES_24[0] = (byte) 0x80; // 2 ^ 191
+ }
+
+ @Test
+ public void testHexIntegerRendering() throws DebugException {
+ testIntegerRendering(createHexIntegerRendering(1), BYTES_1, "87", "87"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(1), BYTES_2, "9876", "7698"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(2), BYTES_2, "9876", "9876"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(1), BYTES_4, "BA987654", "547698BA"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(2), BYTES_4, "BA987654", "7654BA98"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(4), BYTES_4, "BA987654", "BA987654"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(1), BYTES_8, "FEDCBA9876543210", "1032547698BADCFE"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(4), BYTES_8, "FEDCBA9876543210", "76543210FEDCBA98"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(4), BYTES_16, "80000000000000000000000000000000", "00000000000000000000000080000000"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createHexIntegerRendering(4), BYTES_24, "800000000000000000000000000000000000000000000000", "000000000000000000000000000000000000000080000000"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test
+ public void testSignedIntegerRendering() throws DebugException {
+ testIntegerRendering(createSignedIntegerRendering(1, BYTES_1.length), BYTES_1, "-121", "-121"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(1, BYTES_2.length), BYTES_2, "-26506", "30360"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(2, BYTES_2.length), BYTES_2, "-26506", "-26506"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(1, BYTES_4.length), BYTES_4, "-1164413356", "1417058490"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(2, BYTES_4.length), BYTES_4, "-1164413356", "1985264280"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(4, BYTES_4.length), BYTES_4, "-1164413356", "-1164413356"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(1, BYTES_8.length), BYTES_8, "-81985529216486896", "1167088121787636990"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(4, BYTES_8.length), BYTES_8, "-81985529216486896", "8526495043095935640"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(8, BYTES_8.length), BYTES_8, "-81985529216486896", "-81985529216486896"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createSignedIntegerRendering(2, BYTES_16.length), BYTES_16, BigInteger.valueOf(2).pow(127).negate().toString(), "32768"); //$NON-NLS-1$
+ testIntegerRendering(createSignedIntegerRendering(2, BYTES_24.length), BYTES_24, BigInteger.valueOf(2).pow(191).negate().toString(), "32768"); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testUnsignedIntegerRendering() throws DebugException {
+ testIntegerRendering(createUnsignedIntegerRendering(1, BYTES_1.length), BYTES_1, "135", "135"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(1, BYTES_2.length), BYTES_2, "39030", "30360"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(2, BYTES_2.length), BYTES_2, "39030", "39030"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(1, BYTES_4.length), BYTES_4, "3130553940", "1417058490"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(2, BYTES_4.length), BYTES_4, "3130553940", "1985264280"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(4, BYTES_4.length), BYTES_4, "3130553940", "3130553940"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(1, BYTES_8.length), BYTES_8, "18364758544493064720", "1167088121787636990"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(4, BYTES_8.length), BYTES_8, "18364758544493064720", "8526495043095935640"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(8, BYTES_8.length), BYTES_8, "18364758544493064720", "18364758544493064720"); //$NON-NLS-1$ //$NON-NLS-2$
+ testIntegerRendering(createUnsignedIntegerRendering(2, BYTES_16.length), BYTES_16, BigInteger.valueOf(2).pow(127).toString(), "32768"); //$NON-NLS-1$
+ testIntegerRendering(createUnsignedIntegerRendering(2, BYTES_24.length), BYTES_24, BigInteger.valueOf(2).pow(191).toString(), "32768"); //$NON-NLS-1$
+ }
+
+ private void testIntegerRendering(AbstractIntegerRendering rendering, byte[] bytes, String bigEndianString, String littleEndianString) throws DebugException {
+ final IMemoryBlockExtension block = new TableRenderingTestsMemoryBlock(bytes, rendering.getAddressableSize());
+ rendering.init(null, block);
+ final MemoryByte[] memoryBytes = block.getBytesFromOffset(BigInteger.ZERO, bytes.length / rendering.getAddressableSize());
+
+ rendering.setDisplayEndianess(RenderingsUtil.BIG_ENDIAN);
+ assertEquals(bigEndianString, rendering.getString(null, null, memoryBytes));
+ assertArrayEquals(bytes, rendering.getBytes(null, null, memoryBytes, bigEndianString));
+
+ rendering.setDisplayEndianess(RenderingsUtil.LITTLE_ENDIAN);
+ assertEquals(littleEndianString, rendering.getString(null, null, memoryBytes));
+ assertArrayEquals(bytes, rendering.getBytes(null, null, memoryBytes, littleEndianString));
+ }
+
+ private HexIntegerRendering createHexIntegerRendering(int addressableSize) {
+ return new HexIntegerRendering(null) {
+ @Override
+ public int getAddressableSize() {
+ return addressableSize;
+ }
+ };
+ }
+
+ private SignedIntegerRendering createSignedIntegerRendering(int addressableSize, int bytesPerColumn) {
+ return new SignedIntegerRendering(null) {
+ @Override
+ public int getAddressableSize() {
+ return addressableSize;
+ }
+
+ @Override
+ public int getBytesPerColumn() {
+ return bytesPerColumn;
+ }
+ };
+ }
+
+ private UnsignedIntegerRendering createUnsignedIntegerRendering(int addressableSize, int bytesPerColumn) {
+ return new UnsignedIntegerRendering(null) {
+ @Override
+ public int getAddressableSize() {
+ return addressableSize;
+ }
+
+ @Override
+ public int getBytesPerColumn() {
+ return bytesPerColumn;
+ }
+ };
+ }
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTestsMemoryBlock.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTestsMemoryBlock.java
new file mode 100644
index 000000000..28b125be5
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/view/memory/TableRenderingTestsMemoryBlock.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2021 John Dallaway and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * John Dallaway - initial implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.view.memory;
+
+import java.math.BigInteger;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IMemoryBlockExtension;
+import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
+import org.eclipse.debug.core.model.MemoryByte;
+
+/**
+ * Minimal memory block implementation for use with
+ * {@link org.eclipse.debug.tests.view.memory.TableRenderingTests} only
+ */
+public class TableRenderingTestsMemoryBlock implements IMemoryBlockExtension {
+
+ private int fAddressableSize;
+ private byte[] fBytes;
+
+ public TableRenderingTestsMemoryBlock(byte[] bytes, int addressableSize) {
+ fBytes = bytes;
+ fAddressableSize = addressableSize;
+ }
+
+ @Override
+ public long getStartAddress() {
+ return 0;
+ }
+
+ @Override
+ public long getLength() {
+ return fBytes.length;
+ }
+
+ @Override
+ public byte[] getBytes() throws DebugException {
+ return fBytes;
+ }
+
+ @Override
+ public boolean supportsValueModification() {
+ return false;
+ }
+
+ @Override
+ public void setValue(long offset, byte[] bytes) throws DebugException {
+ }
+
+ @Override
+ public String getModelIdentifier() {
+ return null;
+ }
+
+ @Override
+ public IDebugTarget getDebugTarget() {
+ return null;
+ }
+
+ @Override
+ public ILaunch getLaunch() {
+ return null;
+ }
+
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ return null;
+ }
+
+ @Override
+ public String getExpression() {
+ return null;
+ }
+
+ @Override
+ public BigInteger getBigBaseAddress() throws DebugException {
+ return null;
+ }
+
+ @Override
+ public BigInteger getMemoryBlockStartAddress() throws DebugException {
+ return null;
+ }
+
+ @Override
+ public BigInteger getMemoryBlockEndAddress() throws DebugException {
+ return null;
+ }
+
+ @Override
+ public BigInteger getBigLength() throws DebugException {
+ return null;
+ }
+
+ @Override
+ public int getAddressSize() throws DebugException {
+ return 0;
+ }
+
+ @Override
+ public boolean supportBaseAddressModification() throws DebugException {
+ return false;
+ }
+
+ @Override
+ public boolean supportsChangeManagement() {
+ return false;
+ }
+
+ @Override
+ public void setBaseAddress(BigInteger address) throws DebugException {
+ }
+
+ @Override
+ public MemoryByte[] getBytesFromOffset(BigInteger unitOffset, long addressableUnits) throws DebugException {
+ assert BigInteger.ZERO.equals(unitOffset);
+ final MemoryByte[] memoryBytes = new MemoryByte[(int) (addressableUnits * getAddressableSize())];
+ for (int n = 0; n < memoryBytes.length; n++) {
+ memoryBytes[n] = new MemoryByte(fBytes[n]);
+ }
+ return memoryBytes;
+ }
+
+ @Override
+ public MemoryByte[] getBytesFromAddress(BigInteger address, long units) throws DebugException {
+ return null;
+ }
+
+ @Override
+ public void setValue(BigInteger offset, byte[] bytes) throws DebugException {
+ }
+
+ @Override
+ public void connect(Object client) {
+ }
+
+ @Override
+ public void disconnect(Object client) {
+ }
+
+ @Override
+ public Object[] getConnections() {
+ return null;
+ }
+
+ @Override
+ public void dispose() throws DebugException {
+ }
+
+ @Override
+ public IMemoryBlockRetrieval getMemoryBlockRetrieval() {
+ return null;
+ }
+
+ @Override
+ public int getAddressableSize() throws DebugException {
+ return fAddressableSize;
+ }
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/AbstractViewerModelTest.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/AbstractViewerModelTest.java
index 62c5693ad..74545efbb 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/AbstractViewerModelTest.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/AbstractViewerModelTest.java
@@ -15,7 +15,6 @@ package org.eclipse.debug.tests.viewer.model;
import java.util.function.Function;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.tests.TestUtil;
@@ -23,6 +22,8 @@ import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import org.junit.After;
+import org.junit.Before;
public abstract class AbstractViewerModelTest extends AbstractDebugTest {
@@ -31,12 +32,9 @@ public abstract class AbstractViewerModelTest extends AbstractDebugTest {
IInternalTreeModelViewer fViewer;
TestModelUpdatesListener fListener;
- public AbstractViewerModelTest(String name) {
- super(name);
- }
-
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
fDisplay = PlatformUI.getWorkbench().getDisplay();
fShell = new Shell(fDisplay);
@@ -49,7 +47,8 @@ public abstract class AbstractViewerModelTest extends AbstractDebugTest {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
@@ -59,15 +58,6 @@ public abstract class AbstractViewerModelTest extends AbstractDebugTest {
super.tearDown();
}
- @Override
- protected void runTest() throws Throwable {
- try {
- super.runTest();
- } catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener, t); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
abstract protected IInternalTreeModelViewer createViewer(Display display, Shell shell);
abstract protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer);
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 287a72393..bcffbb942 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
@@ -18,6 +18,7 @@ import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
import org.eclipse.debug.tests.viewer.model.TestModel.TestElement;
import org.eclipse.jface.viewers.TreePath;
+import org.junit.Test;
/**
* Tests which verify the check box support. This test is very similar to the
@@ -29,15 +30,12 @@ import org.eclipse.jface.viewers.TreePath;
*/
abstract public class CheckTests extends AbstractViewerModelTest {
- public CheckTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
}
+ @Test
public void testSimpleSingleLevel() throws Exception {
// Create the model with test data
TestModel model = TestModel.simpleSingleLevel();
@@ -60,6 +58,7 @@ abstract public class CheckTests extends AbstractViewerModelTest {
model.validateData(fViewer, TreePath.EMPTY);
}
+ @Test
public void testSimpleMultiLevel() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -104,7 +103,7 @@ abstract public class CheckTests extends AbstractViewerModelTest {
//
// Assert.assertTrue(element.getChecked() != initialCheckState);
// }
-
+ @Test
public void testUpdateCheck() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
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 fb293ebfa..a39ceebe2 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
@@ -13,6 +13,10 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.viewers.model.ChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
@@ -34,6 +38,7 @@ import org.eclipse.jface.viewers.ViewerLabel;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
+import org.junit.Test;
/**
* Tests coalescing of children update requests.
@@ -229,13 +234,6 @@ public class ChildrenUpdateTests extends AbstractDebugTest {
}
}
- /**
- * @param name
- */
- public ChildrenUpdateTests(String name) {
- super(name);
- }
-
protected TreeModelContentProvider getContentProvider() {
return new BogusModelContentProvider();
}
@@ -243,6 +241,7 @@ public class ChildrenUpdateTests extends AbstractDebugTest {
/**
* Tests coalescing of requests
*/
+ @Test
public void testCoalesce () {
Object element = new Object();
TreeModelContentProvider cp = getContentProvider();
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 92d3c131b..1ac5939dc 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
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertEquals;
+
import java.util.Arrays;
import java.util.function.Function;
@@ -38,6 +40,9 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.XMLMemento;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests to verify that the viewer properly handles initial columns width.
@@ -49,18 +54,16 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
private TestModelUpdatesListener fListener;
private boolean fResized = false;
- public ColumnPresentationTests(String name) {
- super(name);
- }
-
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
createViewer();
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
destroyViewer();
super.tearDown();
}
@@ -210,7 +213,7 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
}
}
- class MyModel extends TestModel implements IColumnPresentationFactory {
+ static class MyModel extends TestModel implements IColumnPresentationFactory {
MyColumnPresentation colPresenation;
MyModel(MyColumnPresentation cp1) {
@@ -258,9 +261,10 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
* implementation without requiring the presentation being
* IColumnPresentation2 (i.e. ensure we do not break backward compatibility
* of interface). Also, we verify that the initial columns width is the
- * average of tree width / number of visible columns, which is the logic
- * in InternalTreeModelViewer.
+ * average of tree width / number of visible columns, which is the logic in
+ * InternalTreeModelViewer.
*/
+ @Test
public void testInitialColumnAverageWidth() throws Exception {
fResized = false;
@@ -290,6 +294,7 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
* Also, we verify that the initial columns width is the width computed by
* the IColumnPresentation2 implementation.
*/
+ @Test
public void testInitialColumnWidth() throws Exception {
fResized = false;
@@ -317,6 +322,7 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
* is not used when there are user settings inside the viewer which are
* created from user resizing columns.
*/
+ @Test
public void testRespectUserSettings() throws Exception {
MyColumnPresentation2 colPre = new MyColumnPresentation2();
makeModel(colPre, "m2"); //$NON-NLS-1$
@@ -361,6 +367,7 @@ public class ColumnPresentationTests extends AbstractDebugTest implements ITestM
* is not used when there are user settings inside the viewer which are
* restored from memento, e.g., restoring workspace, etc.
*/
+ @Test
public void testRespectMemento() throws Exception {
MyColumnPresentation2 colPre = new MyColumnPresentation2();
makeModel(colPre, "m2"); //$NON-NLS-1$
@@ -392,9 +399,10 @@ 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).
*/
+ @Test
public void testChangedColumnIds() throws Exception {
MyColumnPresentation colPre = new MyColumnPresentation();
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 64a38b7fa..0bd96f04f 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
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -31,6 +33,7 @@ import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.debug.tests.TestUtil;
import org.eclipse.debug.tests.viewer.model.TestModel.TestElement;
import org.eclipse.jface.viewers.TreePath;
+import org.junit.Test;
/**
* Tests that verify that the viewer property retrieves all the content
@@ -40,15 +43,12 @@ import org.eclipse.jface.viewers.TreePath;
*/
abstract public class ContentTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public ContentTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, true, true);
}
+ @Test
public void testSimpleSingleLevel() throws Exception {
// Create the model with test data
TestModel model = TestModel.simpleSingleLevel();
@@ -73,6 +73,7 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
}
+ @Test
public void testSimpleMultiLevel() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -94,7 +95,7 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
* Modified test model that optionally captures (i.e. doesn't compete)
* udpates after filling in their data.
*/
- class TestModelWithCapturedUpdates extends TestModel {
+ static class TestModelWithCapturedUpdates extends TestModel {
boolean fCaptureLabelUpdates = false;
boolean fCaptureChildrenUpdates = false;
@@ -143,6 +144,7 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
* use data from stale updates to populate the viewer.<br>
* See bug 210027
*/
+ @Test
public void testLabelUpdatesCompletedOutOfSequence1() throws Exception {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
@@ -155,7 +157,7 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
// 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);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> model.fCapturedUpdates.size() < model.getRootElement().fChildren.length, createModelErrorMessage(model));
List<IViewerUpdate> firstUpdates = model.fCapturedUpdates;
@@ -194,10 +196,11 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
* 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
+ * the elements' labels. In this case, the view should still cancel stale
* updates.<br>
* See bug 210027
*/
+ @Test
public void testLabelUpdatesCompletedOutOfSequence2() throws Exception {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
@@ -210,7 +213,7 @@ abstract public class ContentTests extends AbstractViewerModelTest implements IT
// 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);
+ TestUtil.waitForJobs(name.getMethodName(), 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));
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DebugTestModelPresentation.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DebugTestModelPresentation.java
new file mode 100644
index 000000000..110af5f13
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/DebugTestModelPresentation.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.tests.viewer.model;
+
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.tests.breakpoint.TestBreakpoint;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.ui.IEditorInput;
+
+/**
+ * Model presentation to show the text attribute of {@link TestBreakpoint}s in
+ * Breakpoint View.
+ */
+public class DebugTestModelPresentation extends LabelProvider implements IDebugModelPresentation {
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof TestBreakpoint) {
+ return "TestBreakpoint: " + ((TestBreakpoint) element).getText();
+ }
+ return super.getText(element);
+ }
+
+ @Override
+ public IEditorInput getEditorInput(Object element) {
+ return null;
+ }
+
+ @Override
+ public String getEditorId(IEditorInput input, Object element) {
+ return null;
+ }
+
+ @Override
+ public void setAttribute(String attribute, Object value) {
+ }
+
+ @Override
+ public void computeDetail(IValue value, IValueDetailListener listener) {
+ listener.detailComputed(value, null);
+ }
+
+} \ No newline at end of file
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 e6c25d01e..49c67557c 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
@@ -14,6 +14,10 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.Arrays;
import java.util.List;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
@@ -24,6 +28,7 @@ import org.eclipse.debug.tests.viewer.model.TestModel.TestElement;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreePath;
+import org.junit.Test;
/**
* Tests to verify that the viewer property retrieves and processes the
@@ -31,15 +36,12 @@ import org.eclipse.jface.viewers.TreePath;
*/
abstract public class DeltaTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public DeltaTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
}
+ @Test
public void testUpdateLabel() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -65,6 +67,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, TreePath.EMPTY);
}
+ @Test
public void testRefreshStruct() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -95,6 +98,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, TreePath.EMPTY);
}
+ @Test
public void testRefreshStruct2() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -144,6 +148,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, TreePath.EMPTY);
}
+ @Test
public void testRefreshCoalesceStruct() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -174,7 +179,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
}
-
+ @Test
public void testInsert() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -210,9 +215,10 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
}
/**
- * 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.
*/
+ @Test
public void testInsertAndSelect() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -258,9 +264,10 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
}
/**
- * 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.
*/
+ @Test
public void testInsertAndRemove() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -301,7 +308,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, TreePath.EMPTY);
}
-
+ @Test
public void testAddElement() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -425,7 +432,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, parentPath, true);
}
-
+ @Test
public void testRemove() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -451,6 +458,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, TreePath.EMPTY);
}
+ @Test
public void testExpandAndSelect() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
@@ -533,6 +541,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
/**
* This test verifies that expand and select updates are being ignored.
*/
+ @Test
public void testExpandAndSelect_simple() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
@@ -581,6 +590,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
}
}
+ @Test
public void testCompositeModelRefreshStruct() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -614,6 +624,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, TreePath.EMPTY);
}
+ @Test
public void testCompositeModelAddElement() throws Exception {
TestModel model = TestModel.compositeMultiLevel();
fViewer.setAutoExpandLevel(-1);
@@ -644,6 +655,7 @@ abstract public class DeltaTests extends AbstractViewerModelTest implements ITes
model.validateData(fViewer, TreePath.EMPTY);
}
+ @Test
public void testBug292322() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
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 fb958178a..d4347804f 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
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertTrue;
+
import java.util.regex.Pattern;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
@@ -28,6 +30,7 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.junit.Test;
/**
* Tests that verify that the viewer property retrieves all the content
@@ -37,10 +40,6 @@ import org.eclipse.jface.viewers.ViewerFilter;
*/
abstract public class FilterTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public FilterTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, true, true);
@@ -50,7 +49,7 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
return fViewer;
}
- class TestViewerFilter extends ViewerFilter {
+ static class TestViewerFilter extends ViewerFilter {
Pattern fPattern;
TestViewerFilter(String pattern) {
@@ -69,7 +68,7 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
}
}
- class TestTMVFilter extends TreeModelViewerFilter {
+ static class TestTMVFilter extends TreeModelViewerFilter {
Pattern fPattern;
Object fParentElement;
TestTMVFilter(String pattern, Object parentElement) {
@@ -97,31 +96,37 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
}
}
+ @Test
public void testSimpleSingleLevel() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
}
+ @Test
public void testSimpleSingleLevelWithTMVFilter() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()) }); //$NON-NLS-1$
}
+ @Test
public void testSimpleSingleLevelWithMixedFilters() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()), new TestViewerFilter("1") }); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testSimpleMultiLevel() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") }); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testSimpleMultiLevelWithTMVFilter() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testSimpleMultiLevelWithMixedFilters() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
@@ -147,10 +152,12 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
model.validateData(fViewer, TreePath.EMPTY, false, filters);
}
+ @Test
public void testLargeSingleLevel() throws Exception {
doTestLargeSingleLevel(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
}
+ @Test
public void testLargeSingleLevelWithTMVFilter() throws Exception {
doTestLargeSingleLevel(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
}
@@ -174,18 +181,20 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
/**
- * 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.
*/
+ @Test
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.
*/
+ @Test
public void testReplacedUnrealizedFilteredElementWithTMVFilter() throws Exception {
doTestReplacedUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
}
@@ -204,7 +213,7 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
// Populate the view (all elements containing a "2" will be filtered out.
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
@@ -226,11 +235,12 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
assertTrue(replacedElementPaths.length != 0);
}
-
+ @Test
public void testRefreshUnrealizedFilteredElement() throws Exception {
doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
}
+ @Test
public void testRefreshUnrealizedFilteredElementWithTMVFilter() throws Exception {
doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
}
@@ -252,7 +262,7 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
// Populate the view (all elements containing a "2" will be filtered out.
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
@@ -274,14 +284,17 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
assertTrue(replacedElementPaths.length != 0);
}
+ @Test
public void testRefreshToUnfilterElements() throws Exception {
doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") }); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testRefreshToUnfilterElementsWithTMVFilter() throws Exception {
doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Test
public void testRefreshToUnfilterElementsWithMixedFilters() throws Exception {
doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -305,7 +318,7 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
// Populate the view (all elements containing a "2" will be filtered out.
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE), createListenerErrorMessage());
@@ -320,6 +333,7 @@ abstract public class FilterTests extends AbstractViewerModelTest implements ITe
model.validateData(fViewer, TreePath.EMPTY, false, filters1);
}
+ @Test
public void testPreserveExpandedOnMultLevelContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = StateTests.alternatingSubsreesModel(6);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTransformTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTransformTests.java
index 6a4db089d..96357fdea 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTransformTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/FilterTransformTests.java
@@ -13,9 +13,17 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.eclipse.debug.internal.ui.viewers.model.FilterTransform;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.jface.viewers.TreePath;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests the virtual viewer's filter transform
@@ -36,19 +44,13 @@ public class FilterTransformTests extends AbstractDebugTest {
public FilterTransform transform;
/**
- * @param name
- */
- public FilterTransformTests(String name) {
- super(name);
- }
-
- /**
* Builds a filter transform. Model has 8 elements,
* and elements 0, 2, 3, 6, 7 are filtered. Elements
* 1, 4, 5 are visible.
*/
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
transform = new FilterTransform();
root = new Object();
@@ -67,70 +69,73 @@ public class FilterTransformTests extends AbstractDebugTest {
assertTrue(transform.addFilteredIndex(TreePath.EMPTY, 7, element7));
}
- protected boolean equals(int[] a, int[] b) {
- if (a.length == b.length) {
- for (int i = 0; i < b.length; i++) {
- if (a[i] != b[i]) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
+ @Test
public void testRemoveMiddleElementFromFilters() {
assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
transform.removeElementFromFilters(TreePath.EMPTY, element3);
assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 5, 6 })); //$NON-NLS-1$
+ assertArrayEquals("Wrong filter state", transform.getFilteredChildren(TreePath.EMPTY), new int[] { //$NON-NLS-1$
+ 0, 2, 5, 6 });
}
+ @Test
public void testRemoveFirstElementFromFilters() {
assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
transform.removeElementFromFilters(TreePath.EMPTY, element0);
assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 1, 2, 5, 6 })); //$NON-NLS-1$
+ assertArrayEquals("Wrong filter state", transform.getFilteredChildren(TreePath.EMPTY), new int[] { //$NON-NLS-1$
+ 1, 2, 5, 6 });
}
+ @Test
public void testRemoveLastFromFilters() {
assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
transform.removeElementFromFilters(TreePath.EMPTY, element7);
assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 3, 6 })); //$NON-NLS-1$
+ assertArrayEquals("Wrong filter state", transform.getFilteredChildren(TreePath.EMPTY), new int[] { //$NON-NLS-1$
+ 0, 2, 3, 6 });
}
+ @Test
public void testClearMiddleElementFromFilters() {
assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
transform.clear(TreePath.EMPTY, 3);
assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 6, 7 })); //$NON-NLS-1$
+ assertArrayEquals("Wrong filter state", transform.getFilteredChildren(TreePath.EMPTY), new int[] { //$NON-NLS-1$
+ 0, 2, 6, 7 });
}
+ @Test
public void testClearFirstElementFromFilters() {
assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
transform.clear(TreePath.EMPTY, 0);
assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 2, 3, 6, 7 })); //$NON-NLS-1$
+ assertArrayEquals("Wrong filter state", transform.getFilteredChildren(TreePath.EMPTY), new int[] { //$NON-NLS-1$
+ 2, 3, 6, 7 });
}
+ @Test
public void testClearLastFromFilters() {
assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
transform.clear(TreePath.EMPTY, 7);
assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 3, 6 })); //$NON-NLS-1$
+ assertArrayEquals("Wrong filter state", transform.getFilteredChildren(TreePath.EMPTY), new int[] { //$NON-NLS-1$
+ 0, 2, 3, 6 });
}
+ @Test
public void testViewToModelCount() {
assertEquals("Wrong model count", 8, transform.viewToModelCount(TreePath.EMPTY, 3)); //$NON-NLS-1$
}
+ @Test
public void testViewToModelIndex() {
assertEquals("Wrong model index", 1, transform.viewToModelIndex(TreePath.EMPTY, 0)); //$NON-NLS-1$
assertEquals("Wrong model index", 4, transform.viewToModelIndex(TreePath.EMPTY, 1)); //$NON-NLS-1$
assertEquals("Wrong model index", 5, transform.viewToModelIndex(TreePath.EMPTY, 2)); //$NON-NLS-1$
}
+ @Test
public void testAddAlreadyFiltered() {
assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
boolean added = transform.addFilteredIndex(TreePath.EMPTY, 0, element0);
@@ -139,9 +144,10 @@ public class FilterTransformTests extends AbstractDebugTest {
/**
- * Test to make sure that setModelChildCount() updates internal arrays appropriately.
- * See bug 200325.
+ * Test to make sure that setModelChildCount() updates internal arrays
+ * appropriately. See bug 200325.
*/
+ @Test
public void testRegression200325() {
transform.setModelChildCount(TreePath.EMPTY, 2);
try {
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 21e849d19..f62128a5b 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerCheckTests extends CheckTests {
- public JFaceViewerCheckTests(String name) {
- super(name);
- }
-
@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 53feebda2..abc288c77 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerContentTests extends ContentTests {
- public JFaceViewerContentTests(String name) {
- super(name);
- }
-
@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 5bfa72a37..6e131c8ae 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
@@ -20,16 +20,13 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.junit.Test;
/**
* @since 3.6
*/
public class JFaceViewerDeltaTests extends DeltaTests {
- public JFaceViewerDeltaTests(String name) {
- super(name);
- }
-
@Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
@@ -39,6 +36,7 @@ public class JFaceViewerDeltaTests extends DeltaTests {
* TODO: remove this method when bug 292322 gets fixed in TreeViewer
*/
@Override
+ @Test
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 e120aa4c9..2b8010e86 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerFilterTests extends FilterTests {
- public JFaceViewerFilterTests(String name) {
- super(name);
- }
-
@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 9d042f74b..a2883d7f7 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerLazyTests extends LazyTests {
- public JFaceViewerLazyTests(String name) {
- super(name);
- }
-
@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 ed4b6815f..70cd1425d 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerPerformanceTests extends PerformanceTests {
- public JFaceViewerPerformanceTests(String name) {
- super(name);
- }
-
@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/JFaceViewerPopupTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/JFaceViewerPopupTests.java
index eda0e22a3..657efe5e0 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerPopupTests extends PopupTests {
- public JFaceViewerPopupTests(String name) {
- super(name);
- }
-
@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 b520b9b31..38da36ece 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerSelectionTests extends SelectionTests {
- public JFaceViewerSelectionTests(String name) {
- super(name);
- }
-
@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 ef8b08746..96ab6ee18 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerStateTests extends StateTests {
- public JFaceViewerStateTests(String name) {
- super(name);
- }
-
@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 d0ffc8645..171e8198c 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
@@ -16,10 +16,12 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDeltaVisitor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
@@ -29,16 +31,13 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.junit.Test;
/**
* @since 3.6
*/
public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public JFaceViewerTopIndexTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
@@ -62,6 +61,7 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
* Restore REVEAL on simple model with elements without children.
*
*/
+ @Test
public void testRestoreTopIndex() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
@@ -122,11 +122,12 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
}
/**
- * Restore REVEAL when having also to restore an expanded element
- * that is just above the REVEAL element.
+ * Restore REVEAL when having also to restore an expanded element that is
+ * just above the REVEAL element.
*
* See bug 324100
*/
+ @Test
public void testRestoreTopAndExpand() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
@@ -219,6 +220,7 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
*
* See bug 324100
*/
+ @Test
public void testRestoreTopTriggersExpand() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
@@ -299,6 +301,7 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
* This test verifies that canceling a reveal pending state delta is
* properly handled when a new reveal delta is received from the model.
*/
+ @Test
public void testRestoreRevealAfterRevealCancel() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
TestModel model = TestModel.simpleMultiLevel();
@@ -362,6 +365,7 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
* This test verifies that canceling a reveal pending state delta is
* properly handled when a new reveal delta is received from the model.
*/
+ @Test
public void testRestoreRevealAfterRevealCancel2() throws Exception {
if (Platform.getOS().equals(Platform.OS_MACOSX)) {
// skip this test on Mac - see bug 327557
@@ -409,13 +413,9 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
// 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() {
-
- @Override
- public boolean visit(IModelDelta delta, int depth) {
- ((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.EXPAND);
- return true;
- }
+ revealDelta.accept((delta, depth) -> {
+ ((ModelDelta) delta).setFlags(delta.getFlags() | IModelDelta.EXPAND);
+ return true;
});
// Wait for the second model delta to process
@@ -432,11 +432,12 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
/**
- * Restore REVEAL when having also to restore an expanded element
- * that is just above the REVEAL element.
+ * Restore REVEAL when having also to restore an expanded element that is
+ * just above the REVEAL element.
*
* See bug 324100
*/
+ @Test
public void testRestoreDeepTreeAndReveal() throws Exception {
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
@@ -490,6 +491,7 @@ public class JFaceViewerTopIndexTests extends AbstractViewerModelTest implements
* This test verifies that a revealed node does not get scrolled away due to
* structural updates.
*/
+ @Test
public void testRevealWithContentChanges() throws Exception {
@SuppressWarnings("unused")
TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(getCTargetViewer());
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 4a1d39f9e..ba25f064f 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class JFaceViewerUpdateTests extends UpdateTests {
- public JFaceViewerUpdateTests(String name) {
- super(name);
- }
-
@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 2819182c2..2ed7193b8 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
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
@@ -21,6 +23,7 @@ import org.eclipse.debug.tests.viewer.model.TestModel.TestElement;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
+import org.junit.Test;
/**
* Tests that verify that the viewer property retrieves all the content
@@ -30,10 +33,6 @@ import org.eclipse.jface.viewers.TreeSelection;
*/
abstract public class LazyTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public LazyTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, true, true);
@@ -63,10 +62,10 @@ abstract public class LazyTests extends AbstractViewerModelTest implements ITest
}
/**
- * 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)
*/
+ @Test
public void testExpandLargeSubTree() throws Exception {
// Create test model with lots of children.
TestModel model = largeSubtreeModel(1000);
@@ -103,10 +102,11 @@ abstract public class LazyTests extends AbstractViewerModelTest implements ITest
}
/**
- * 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).
*/
+ @Test
public void testReplaceAndSelectInSubTreeTree() throws Exception {
// Create test model with lots of children.
TestModel model = largeSubtreeModel(1000);
@@ -154,8 +154,7 @@ abstract public class LazyTests extends AbstractViewerModelTest implements ITest
assertEquals(((IStructuredSelection)fViewer.getSelection()).getFirstElement(), _1_0_newElement);
}
- /**
- */
+ @Test
public void testContentRefresh() throws Exception {
// Create test model with lots of children.
TestModel model = largeSubtreeModel(1000);
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 148291e7e..0d1a91255 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
@@ -24,6 +24,8 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.test.performance.Performance;
import org.eclipse.test.performance.PerformanceMeter;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests to measure the performance of the viewer updates.
@@ -32,8 +34,8 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
protected VisibleVirtualItemValidator fVirtualItemValidator;
- public PerformanceTests(String name) {
- super(name);
+ public String getDefaultScenarioId() {
+ return this.getClass().getName() + '#' + name.getMethodName() + "()"; //$NON-NLS-1$
}
@Override
@@ -42,7 +44,8 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
}
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
fVirtualItemValidator = new VisibleVirtualItemValidator(0, Integer.MAX_VALUE);
}
@@ -54,7 +57,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
*/
abstract protected int getTestModelDepth();
-
+ @Test
public void testRefreshStruct() throws Exception {
TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
@@ -71,7 +74,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ PerformanceMeter meter = perf.createPerformanceMeter(getDefaultScenarioId());
try {
for (int i = 0; i < 10; i++) {
// Update the model
@@ -94,6 +97,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
}
}
+ @Test
public void testRefreshStruct2() throws Exception {
TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
@@ -111,7 +115,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
fVirtualItemValidator.setVisibleRange(0, 50);
Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ PerformanceMeter meter = perf.createPerformanceMeter(getDefaultScenarioId());
try {
for (int i = 0; i < 100; i++) {
// Update the model
@@ -137,7 +141,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
}
}
-
+ @Test
public void testRefreshStructReplaceElements() throws Exception {
TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
@@ -154,7 +158,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ PerformanceMeter meter = perf.createPerformanceMeter(getDefaultScenarioId());
try {
for (int i = 0; i < 100; i++) {
// Update the model
@@ -177,7 +181,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
}
}
-
+ @Test
public void testRefreshList() throws Exception {
TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
@@ -195,7 +199,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ PerformanceMeter meter = perf.createPerformanceMeter(getDefaultScenarioId());
try {
for (int i = 0; i < 100; i++) {
// Update the model
@@ -218,6 +222,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
}
}
+ @Test
public void testSaveAndRestore() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -240,7 +245,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
fViewer.setAutoExpandLevel(-1);
Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ PerformanceMeter meter = perf.createPerformanceMeter(getDefaultScenarioId());
try {
for (int i = 0; i < 100; i++) {
// Update the model
@@ -272,6 +277,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
}
+ @Test
public void testRefreshListFiltered() throws Exception {
TestModel model = new TestModel();
model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
@@ -305,7 +311,7 @@ abstract public class PerformanceTests extends AbstractViewerModelTest implement
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
+ PerformanceMeter meter = perf.createPerformanceMeter(getDefaultScenarioId());
try {
for (int i = 0; i < 100; i++) {
// Update the model
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 d37b2f8b3..7c59c6e17 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
@@ -14,6 +14,10 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -31,6 +35,7 @@ import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.junit.Test;
/**
* Tests to verify that the viewer property updates when created
@@ -40,10 +45,6 @@ import org.eclipse.swt.widgets.Shell;
*/
abstract public class PopupTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public PopupTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
@@ -63,6 +64,7 @@ abstract public class PopupTests extends AbstractViewerModelTest implements ITes
/**
* This test verifies that content updates are still being performed.
*/
+ @Test
public void testRefreshStruct() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -96,6 +98,7 @@ abstract public class PopupTests extends AbstractViewerModelTest implements ITes
/**
* This test verifies that expand and select updates are being ignored.
*/
+ @Test
public void testExpandAndSelect() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
@@ -147,6 +150,7 @@ abstract public class PopupTests extends AbstractViewerModelTest implements ITes
}
}
+ @Test
public void testPreserveExpandedOnSubTreeContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
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 901d62105..13c3a04c7 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
@@ -14,11 +14,14 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
import org.eclipse.debug.tests.AbstractDebugTest;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.XMLMemento;
+import org.junit.Test;
/**
* Test the serialization of presentation context properties.
@@ -27,13 +30,10 @@ import org.eclipse.ui.XMLMemento;
*/
public class PresentationContextTests extends AbstractDebugTest {
- public PresentationContextTests(String name) {
- super(name);
- }
-
/**
* Tests saving and restoring presentation context properties.
*/
+ @Test
public void testSaveRestore () {
PresentationContext context = new PresentationContext("test"); //$NON-NLS-1$
context.setProperty("string", "string"); //$NON-NLS-1$ //$NON-NLS-2$
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 e73e9c96f..0a2de1761 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
@@ -14,6 +14,9 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
@@ -27,16 +30,13 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
+import org.junit.Test;
/**
* Tests to verify that the viewer properly handles selection changes.
*/
abstract public class SelectionTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public SelectionTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
@@ -62,11 +62,11 @@ abstract public class SelectionTests extends AbstractViewerModelTest implements
}
/**
- * 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
+ * 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
*/
+ @Test
public void testSimpleSetSelection() throws Exception {
// Create the model and populate the view.
TestModel model = makeMultiLevelModel();
@@ -86,10 +86,10 @@ abstract public class SelectionTests extends AbstractViewerModelTest implements
}
/**
- * In this test verify that selection policy can prevent selection
- * from being set and verify that a FORCE flag can override the selection
- * policy.
+ * In this test verify that selection policy can prevent selection from
+ * being set and verify that a FORCE flag can override the selection policy.
*/
+ @Test
public void testSelectionPolicy() throws Exception {
// Create the model and populate the view.
final TestModel model = makeMultiLevelModel();
@@ -151,12 +151,11 @@ abstract public class SelectionTests extends AbstractViewerModelTest implements
/**
- * 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.
*/
+ @Test
public void testSelectRemove() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -196,12 +195,10 @@ abstract public class SelectionTests extends AbstractViewerModelTest implements
/**
- * 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.
*/
+ @Test
public void testSelectRemoveRefreshStruct() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
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 312e928bc..b1db2a55a 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
@@ -14,9 +14,14 @@
*******************************************************************************/
package org.eclipse.debug.tests.viewer.model;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+import java.util.function.Supplier;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
@@ -26,6 +31,7 @@ import org.eclipse.debug.tests.viewer.model.TestModel.TestElement;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
+import org.junit.Test;
/**
* Tests to verify that the viewer can save and restore correctly the expansion
@@ -35,10 +41,6 @@ import org.eclipse.jface.viewers.TreeSelection;
*/
abstract public class StateTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- public StateTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
@@ -48,6 +50,7 @@ abstract public class StateTests extends AbstractViewerModelTest implements ITes
return fViewer;
}
+ @Test
public void testUpdateViewer() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -164,6 +167,68 @@ abstract public class StateTests extends AbstractViewerModelTest implements ITes
return model;
}
+ /**
+ * Creates a model in the pattern of:
+ *
+ * <pre>
+ * root
+ * 1
+ * 1.1
+ * 1.2
+ * ...
+ * 1.childrenCount
+ * 2
+ * 2.1
+ * 2.2
+ * ...
+ * 2.childrenCount
+ * 3
+ * 3.1
+ * 3.2
+ * ...
+ * 3.childrenCount
+ * ...
+ * (size)
+ * (size).1
+ * (size).2
+ * ...
+ * (size).childrenCount
+ * </pre>
+ *
+ * @param size The number of elements in the tree
+ * @param childrenCount Number of children of each element
+ * @param shouldReturnChildren The supplier dictates whether children should
+ * be reported when fetched
+ * @return The model
+ */
+ static TestModel alternatingSubtreesModelWithChildren(int size, int childrenCount, Supplier<Boolean> shouldReturnChildren) {
+ TestModel model = new TestModel();
+ TestElement[] elements = new TestElement[size];
+ for (int i = 0; i < size; i++) {
+ String text = Integer.toString(i + 1);
+
+ TestElement[] children = new TestElement[childrenCount];
+ for (int x = 0; x < childrenCount; x++) {
+ children[x] = new TestElement(model, text + "." + (x + 1), new TestElement[0]);
+ }
+
+ elements[i] = new TestElement(model, text, children) {
+ @Override
+ public TestElement[] getChildren() {
+ if (shouldReturnChildren.get()) {
+ return super.getChildren();
+ }
+
+ return new TestElement[0];
+ }
+ };
+ }
+
+ model.setRoot(new TestElement(model, "root", elements));
+
+ return model;
+ }
+
static boolean areTreeSelectionsEqual(ITreeSelection sel1, ITreeSelection sel2) {
Set<TreePath> sel1Set = new HashSet<>();
sel1Set.addAll( Arrays.asList(sel1.getPaths()) );
@@ -207,6 +272,7 @@ abstract public class StateTests extends AbstractViewerModelTest implements ITes
TestUtil.waitWhile(t -> !listener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE), null, 30000, t -> "Listener not finished: " + listener);
}
+ @Test
public void testPreserveExpandedOnRemove() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -247,6 +313,7 @@ abstract public class StateTests extends AbstractViewerModelTest implements ITes
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
+ @Test
public void testPreserveExpandedOnInsert() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -292,6 +359,7 @@ abstract public class StateTests extends AbstractViewerModelTest implements ITes
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
+ @Test
public void testPreserveExpandedOnMultLevelContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -347,7 +415,133 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 5) );
}
+ @Test
+ public void testKeepCollapsedAfterRemovingAndReaddingChildrenInExpandedTree() throws Exception {
+ boolean showChildren[] = new boolean[] { true };
+ int size = 3;
+ Supplier<Boolean> shouldShowChildren = () -> showChildren[0];
+
+ TestModel model = alternatingSubtreesModelWithChildren(size, 10, shouldShowChildren);
+
+ // 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());
+ waitWhile(t -> !fListener.isFinished(), createListenerErrorMessage());
+ model.validateData(fViewer, TreePath.EMPTY, true);
+
+ /*
+ * 1. Trigger model update with expansion of all elements
+ */
+ {
+ fListener.reset();
+ fListener.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++) {
+ TestElement element = children[i];
+ ModelDelta delta = expandDelta;
+ int index = i;
+ while (element.getChildren().length != 0) {
+ TreePath elementPath = model.findElement(element.getLabel());
+ fListener.addUpdates(elementPath, element, 1, CHILD_COUNT_UPDATES | CHILDREN_UPDATES);
+ delta = delta.addNode(element, index, IModelDelta.EXPAND | IModelDelta.CONTENT, element.getChildren().length);
+ element = element.getChildren()[0];
+ index = 0;
+ }
+ }
+
+ model.postDelta(rootDelta);
+
+ TestUtil.waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), null, 300000, t -> "Listener not finished: " + fListener);
+ }
+
+ /*
+ * 2. Trigger model change with no children
+ */
+ {
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+
+ showChildren[0] = false;
+
+ TestElement rootElement = model.getRootElement();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.CONTENT);
+ model.getBaseDelta(rootDelta);
+
+ TreePath elementPath = TreePath.EMPTY;
+ fListener.addUpdates(elementPath, rootElement, 2, CHILD_COUNT_UPDATES | CHILDREN_UPDATES);
+
+ model.postDelta(rootDelta);
+
+ TestUtil.waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), null, 60000, t -> "Listener not finished: " + fListener);
+ }
+
+ /*
+ * 3. Trigger model change with expansion for first element and its
+ * first child selected
+ */
+ {
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+
+ showChildren[0] = true;
+
+ TestElement rootElement = model.getRootElement();
+ TestElement[] children = rootElement.getChildren();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
+ ModelDelta delta = model.getBaseDelta(rootDelta);
+
+ // Expand the element and select first child
+ TestElement element = children[0];
+ delta = delta.addNode(element, 0, IModelDelta.EXPAND, element.getChildren().length);
+
+ TreePath elementPath = model.findElement(element.getLabel());
+ fListener.addUpdates(elementPath, element, 2, CHILDREN_UPDATES);
+
+ element = element.getChildren()[0];
+ delta = delta.addNode(element, 0, IModelDelta.SELECT, -1);
+
+ model.postDelta(rootDelta);
+
+ TestUtil.waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), null, 60000, t -> "Listener not finished: " + fListener);
+ }
+
+ /*
+ * 4. Trigger model change to update all elements and their plus state
+ */
+ {
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+
+ showChildren[0] = true;
+
+ TestElement rootElement = model.getRootElement();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.CONTENT);
+ model.getBaseDelta(rootDelta);
+
+ TestElement element = rootElement.getChildren()[0];
+ TreePath elementPath = model.findElement(element.getLabel());
+ fListener.addUpdates(elementPath, element, 1, CHILDREN_UPDATES);
+
+ model.postDelta(rootDelta);
+
+ TestUtil.waitWhile(t -> !fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE), null, 6000000, t -> "Listener not finished: " + fListener);
+ }
+
+ /*
+ * Only first element should be expanded, all other should be collapsed
+ */
+ for (int i = 1; i <= size; i++) {
+ assertTrue(getInternalViewer().getExpandedState(model.findElement(Integer.toString(i))) == (i == 1));
+ }
+ }
+
+ @Test
public void testPreserveExpandedOnSubTreeContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -398,6 +592,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
+ @Test
public void testPreserveExpandedOnContentStress() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -466,6 +661,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
+ @Test
public void testPreserveLargeModelOnContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
@@ -477,7 +673,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
expandAlternateElements(fListener, model, false);
@@ -525,10 +721,11 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
/**
- * 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.
+ * 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.
*/
+ @Test
public void testPreserveSelectionDeltaAfterContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -571,6 +768,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertEquals(new TreeSelection(model.findElement("2.1")), fViewer.getSelection()); //$NON-NLS-1$
}
+ @Test
public void testPreserveCollapseDeltaAfterContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -626,6 +824,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == false); //$NON-NLS-1$
}
+ @Test
public void testPreserveExpandDeltaAfterContent() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -664,7 +863,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
}
-
+ @Test
public void testSaveAndRestore1() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -712,6 +911,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
+ @Test
public void testSaveAndRestore2() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -762,6 +962,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
+ @Test
public void testSaveAndRestoreInputInstance() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -804,6 +1005,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
+ @Test
public void testSaveAndRestoreInputInstanceEquals() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
@@ -849,7 +1051,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
-
+ @Test
public void testSaveAndRestoreLarge() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
@@ -861,7 +1063,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
expandAlternateElements(fListener, model, false);
@@ -880,7 +1082,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 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
@@ -888,7 +1090,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset();
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
// Validate data (only select visible elements).
@@ -905,10 +1107,11 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
/**
- * 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.
+ * 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.
*/
+ @Test
public void testSaveAndRestorePartialStateLarge() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
@@ -920,7 +1123,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE), createListenerErrorMessage());
expandAlternateElements(fListener, model, false);
@@ -939,7 +1142,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
waitWhile(t -> !fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES), createListenerErrorMessage());
@@ -953,7 +1156,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset();
fViewer.setInput(model.getRootElement());
- TestUtil.waitForJobs(getName(), 300, 5000);
+ TestUtil.waitForJobs(name.getMethodName(), 300, 5000);
// MONITOR FOR THE STATE RESTORE TO COMPLETE
waitWhile(t -> !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | STATE_RESTORE_COMPLETE), createListenerErrorMessage());
@@ -971,6 +1174,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
+ @Test
public void testPreserveCollapseAndSelectDeltaAfterSaveAndRestore() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -1036,8 +1240,10 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
/**
* Test for bug 359859.<br>
- * This test verifies that RESTORE state is handled after SAVE previous state was completed
+ * This test verifies that RESTORE state is handled after SAVE previous
+ * state was completed
*/
+ @Test
public void testSaveRestoreOrder() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
@@ -1066,9 +1272,10 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
/**
- * 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
*/
+ @Test
public void testUpdateWithNullInput() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
fViewer.setAutoExpandLevel(-1);
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModelUpdatesListener.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModelUpdatesListener.java
index 25bf98439..1f5fa2c73 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModelUpdatesListener.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/TestModelUpdatesListener.java
@@ -305,8 +305,8 @@ public class TestModelUpdatesListener implements IViewerUpdateListener, ILabelUp
addUpdates(viewer, treePath, (TestElement) treePath.getLastSegment(), 0, STATE_UPDATES);
}
IModelDelta[] childDeltas = pendingDelta.getChildDeltas();
- for (int i = 0; i < childDeltas.length; i++) {
- addStateUpdates(viewer, childDeltas[i], deltaFlags);
+ for (IModelDelta childDelta : childDeltas) {
+ addStateUpdates(viewer, childDelta, deltaFlags);
}
}
@@ -374,8 +374,8 @@ public class TestModelUpdatesListener implements IViewerUpdateListener, ILabelUp
}
public static boolean isFiltered(Object element, ViewerFilter[] filters) {
- for (int i = 0; i < filters.length; i++) {
- if (!filters[i].select(null, null, element)) {
+ for (ViewerFilter filter : filters) {
+ if (!filter.select(null, null, element)) {
return true;
}
}
@@ -416,8 +416,8 @@ public class TestModelUpdatesListener implements IViewerUpdateListener, ILabelUp
fChildrenUpdatesScheduled.put(path, childrenIndexes);
}
- for (int i = 0; i < children.length; i++) {
- addUpdates(viewer, path.createChildPath(children[i]), children[i], filters, levels, flags);
+ for (TestElement child : children) {
+ addUpdates(viewer, path.createChildPath(child), child, filters, levels, flags);
}
}
@@ -430,8 +430,8 @@ public class TestModelUpdatesListener implements IViewerUpdateListener, ILabelUp
fProxyModels.add(element.getModel());
}
TestElement[] children = element.getChildren();
- for (int i = 0; i < children.length; i++) {
- addProxies(children[i]);
+ for (TestElement child : children) {
+ addProxies(child);
}
}
@@ -779,9 +779,9 @@ public class TestModelUpdatesListener implements IViewerUpdateListener, ILabelUp
buf.append("fJobError = " + fJobError); //$NON-NLS-1$
if (fJobError.getException() != null) {
StackTraceElement[] trace = fJobError.getException().getStackTrace();
- for (int i = 0; i < trace.length; i++) {
+ for (StackTraceElement t : trace) {
buf.append("\n\t\t"); //$NON-NLS-1$
- buf.append(trace[i]);
+ buf.append(t);
}
}
}
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 bba5dec82..38c01584d 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
@@ -23,13 +23,13 @@ import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDeltaVisitor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
import org.eclipse.debug.tests.TestUtil;
import org.eclipse.debug.tests.viewer.model.TestModel.TestElement;
import org.eclipse.jface.viewers.TreePath;
import org.junit.Assert;
+import org.junit.Test;
/**
* Tests to verify that the viewer property updates following changes in the
@@ -39,21 +39,16 @@ import org.junit.Assert;
*/
abstract public class UpdateTests extends AbstractViewerModelTest implements ITestModelUpdatesListenerConstants {
- 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
*/
+ @Test
public void testRemoveElements() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -88,11 +83,10 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
}
/**
- * This test:
- * - creates a simple model
- * - sets a list of children to one of the elements
- * - refreshes the viewer
+ * This test: - creates a simple model - sets a list of children to one of
+ * the elements - refreshes the viewer
*/
+ @Test
public void testAddNewChildren() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -175,6 +169,7 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
}
}
+ @Test
public void testRepeatedAddRemoveElement() throws Exception {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -201,10 +196,11 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
}
/**
- * 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.
*/
+ @Test
public void testNotifyUpdatesTartedOnModelChanged() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -229,11 +225,12 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
/**
- * 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>
*/
+ @Test
public void testContentPlusAddRemoveUpdateRaceConditionsElement() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -287,11 +284,12 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
/**
- * 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>
*/
+ @Test
public void testInsertAtInvalidIndex() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -308,16 +306,12 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
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() {
-
- @Override
- public boolean visit(IModelDelta visitorDelta, int depth) {
- if ((visitorDelta.getFlags() & IModelDelta.INSERTED) != 0) {
- ((ModelDelta)visitorDelta).setIndex(insertIndex + 1);
- return false;
- }
- return true;
+ delta.accept((visitorDelta, depth) -> {
+ if ((visitorDelta.getFlags() & IModelDelta.INSERTED) != 0) {
+ ((ModelDelta) visitorDelta).setIndex(insertIndex + 1);
+ return false;
}
+ return true;
});
// Remove delta should generate no new updates, but we still need to wait for the event to
@@ -330,10 +324,12 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
}
/**
- * This test forces the viewer to reschedule pending content updates
- * due to a remove event from the model.
+ * 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
*/
+ @Test
public void testRescheduleUpdates() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -369,6 +365,7 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
* - Process queued updates in order.<br>
* </p>
*/
+ @Test
public void testCanceledUpdates1() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -406,6 +403,7 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
* - Process queued updates in REVERSE order.<br>
* </p>
*/
+ @Test
public void testCanceledUpdates2() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -448,6 +446,7 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
* - Process queued updates in order.<br>
* </p>
*/
+ @Test
public void testCanceledUpdates3() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -490,6 +489,7 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
* - Process queued updates in REVERSE order.<br>
* </p>
*/
+ @Test
public void testCanceledUpdates4() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -533,12 +533,14 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
/**
* This test removes an element while there are updates running on its
- * sub-tree. With a precise timing this operation caused Bug 373790.
+ * 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
*/
+ @Test
public void testCancelUpdatesOnRemoveElementWhileUpdatingSubTree() throws Exception {
TestModel model = TestModel.simpleMultiLevel();
fViewer.setAutoExpandLevel(-1);
@@ -575,6 +577,7 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
* - Process queued updates in order.<br>
* </p>
*/
+ @Test
public void testCanceledUpdatesOnSetInput() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -612,6 +615,7 @@ abstract public class UpdateTests extends AbstractViewerModelTest implements ITe
* - Process queued updates in order.<br>
* </p>
*/
+ @Test
public void testCanceledUpdatesOnSetNullInput() throws Exception {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
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 af1434896..396eaa0ae 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerContentTests extends ContentTests {
- public VirtualViewerContentTests(String name) {
- super(name);
- }
-
@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 2c68368f0..4b50bffec 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerDeltaTests extends DeltaTests {
- public VirtualViewerDeltaTests(String name) {
- super(name);
- }
-
@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 f0aff25a4..4c7d9c2de 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerFilterTests extends FilterTests {
- public VirtualViewerFilterTests(String name) {
- super(name);
- }
-
@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 8c95b7fba..fdc8acbaa 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
@@ -20,6 +20,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelV
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.junit.Test;
/**
* Tests which verify the operation of the virtual viewer in the lazy mode.
@@ -30,10 +31,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerLazyModeTests extends AbstractViewerModelTest {
- public VirtualViewerLazyModeTests(String name) {
- super(name);
- }
-
@Override
protected TestModelUpdatesListener createListener(IInternalTreeModelViewer viewer) {
return new TestModelUpdatesListener(viewer, false, false);
@@ -44,6 +41,7 @@ public class VirtualViewerLazyModeTests extends AbstractViewerModelTest {
return new VirtualTreeModelViewer(display, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
+ @Test
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 6143a3184..ba308d9f4 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,10 +26,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerPerformanceTests extends PerformanceTests {
- public VirtualViewerPerformanceTests(String name) {
- super(name);
- }
-
@Override
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), fVirtualItemValidator); //$NON-NLS-1$
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 fd07796f4..3834c93d4 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerPopupTests extends PopupTests {
- public VirtualViewerPopupTests(String name) {
- super(name);
- }
-
@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 68100fab3..21cabcd27 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerSelectionTests extends SelectionTests {
- public VirtualViewerSelectionTests(String name) {
- super(name);
- }
-
@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 1c39f0bb1..4aca898d5 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerStateTests extends StateTests {
- public VirtualViewerStateTests(String name) {
- super(name);
- }
-
@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 42a69e80c..3450569fa 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,10 +25,6 @@ import org.eclipse.swt.widgets.Shell;
*/
public class VirtualViewerUpdateTests extends UpdateTests {
- public VirtualViewerUpdateTests(String name) {
- super(name);
- }
-
@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.ui.launchview.tests/.classpath b/org.eclipse.debug.ui.launchview.tests/.classpath
new file mode 100644
index 000000000..4a00becd8
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.debug.ui.launchview.tests/.project b/org.eclipse.debug.ui.launchview.tests/.project
new file mode 100644
index 000000000..fe1510248
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.debug.ui.launchview.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.resources.prefs b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..5a0ad22d2
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..c15cc50fd
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,421 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=11
+org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
+org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
+org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=0
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..4a66042a4
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,115 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_Platform Debug Cleanups
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Platform Debug Formatting
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
diff --git a/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.pde.prefs
new file mode 100644
index 000000000..d06e3abc7
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,39 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.exec-env-too-low=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.no.automatic.module=1
+compilers.p.not-externalized-att=0
+compilers.p.service.component.without.lazyactivation=1
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.ui.launchview.tests/META-INF/MANIFEST.MF b/org.eclipse.debug.ui.launchview.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..8f8d22a55
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.debug.ui.launchview.tests;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.debug.ui.launchview.tests.TestsPlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.10.0,4.0.0)",
+ org.eclipse.debug.ui.launchview;bundle-version="[1.0.2,2.0.0)",
+ org.junit,
+ org.eclipse.test.performance;bundle-version="3.6.0",
+ org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-11
+Bundle-Vendor: %providerName
+Eclipse-BundleShape: dir
+Automatic-Module-Name: org.eclipse.debug.ui.launchview.tests
diff --git a/org.eclipse.debug.ui.launchview.tests/Platform Debug UI LaunchView Test Suite.launch b/org.eclipse.debug.ui.launchview.tests/Platform Debug UI LaunchView Test Suite.launch
new file mode 100644
index 000000000..c972093c2
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/Platform Debug UI LaunchView Test Suite.launch
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+ <booleanAttribute key="append.args" value="true"/>
+ <booleanAttribute key="askclear" value="false"/>
+ <booleanAttribute key="automaticAdd" value="true"/>
+ <booleanAttribute key="automaticValidate" value="false"/>
+ <stringAttribute key="bootstrap" value=""/>
+ <stringAttribute key="checked" value="[NONE]"/>
+ <booleanAttribute key="clearConfig" value="true"/>
+ <booleanAttribute key="clearws" value="true"/>
+ <booleanAttribute key="clearwslog" value="false"/>
+ <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+ <booleanAttribute key="default" value="true"/>
+ <booleanAttribute key="includeOptional" value="true"/>
+ <stringAttribute key="location" value="${workspace_loc}/../debug-junit-workspace"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AutomatedSuite.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+ <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+ <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+ <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.debug.ui.launchview.tests.AutomatedSuite"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.debug.ui.launchview.tests"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+ <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx384m"/>
+ <stringAttribute key="pde.version" value="3.3"/>
+ <stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+ <booleanAttribute key="run_in_ui_thread" value="true"/>
+ <booleanAttribute key="show_selected_only" value="false"/>
+ <booleanAttribute key="tracing" value="false"/>
+ <booleanAttribute key="useCustomFeatures" value="false"/>
+ <booleanAttribute key="useDefaultConfig" value="true"/>
+ <booleanAttribute key="useDefaultConfigArea" value="false"/>
+ <booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/org.eclipse.debug.ui.launchview.tests/about.html b/org.eclipse.debug.ui.launchview.tests/about.html
new file mode 100644
index 000000000..164f781a8
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/about.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>About</title>
+</head>
+<body lang="EN-US">
+ <h2>About This Content</h2>
+
+ <p>November 30, 2017</p>
+ <h3>License</h3>
+
+ <p>
+ The Eclipse Foundation makes available all content in this plug-in
+ (&quot;Content&quot;). Unless otherwise indicated below, the Content
+ is provided to you under the terms and conditions of the Eclipse
+ Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
+ available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.
+ </p>
+
+ <p>
+ If you did not receive this Content directly from the Eclipse
+ Foundation, the Content is being redistributed by another party
+ (&quot;Redistributor&quot;) and different terms and conditions may
+ apply to your use of any object code in the Content. Check the
+ Redistributor's license that was provided with the Content. If no such
+ license exists, contact the Redistributor. Unless otherwise indicated
+ below, the terms and conditions of the EPL still apply to any source
+ code in the Content and such source code may be obtained at <a
+ href="http://www.eclipse.org/">http://www.eclipse.org</a>.
+ </p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.debug.ui.launchview.tests/build.properties b/org.eclipse.debug.ui.launchview.tests/build.properties
new file mode 100644
index 000000000..0cd83c4b0
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/build.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2009, 2012 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ test.xml,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml
+
diff --git a/org.eclipse.debug.ui.launchview.tests/forceQualifierUpdate.txt b/org.eclipse.debug.ui.launchview.tests/forceQualifierUpdate.txt
new file mode 100644
index 000000000..350632caa
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/forceQualifierUpdate.txt
@@ -0,0 +1 @@
+# To force a version qualifier update, add the bug here
diff --git a/org.eclipse.debug.ui.launchview.tests/plugin.properties b/org.eclipse.debug.ui.launchview.tests/plugin.properties
new file mode 100755
index 000000000..454cf7829
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/plugin.properties
@@ -0,0 +1,17 @@
+###############################################################################
+# Copyright (c) 2009, 2012 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - Initial implementation
+###############################################################################
+
+pluginName=Debug UI (LaunchView) Test Plugin
+providerName=Eclipse.org
+
diff --git a/org.eclipse.debug.ui.launchview.tests/plugin.xml b/org.eclipse.debug.ui.launchview.tests/plugin.xml
new file mode 100644
index 000000000..0e25070a3
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/plugin.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2009, 2020 IBM Corporation and others.
+
+ This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License 2.0
+ which accompanies this distribution, and is available at
+ https://www.eclipse.org/legal/epl-2.0/
+
+ SPDX-License-Identifier: EPL-2.0
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+ -->
+
+<plugin>
+
+</plugin>
diff --git a/org.eclipse.debug.ui.launchview.tests/pom.xml b/org.eclipse.debug.ui.launchview.tests/pom.xml
new file mode 100644
index 000000000..cb9b8da66
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2012, 2021 Eclipse Foundation and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Distribution License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/org/documents/edl-v10.php
+
+ Contributors:
+ Igor Fedorenko - initial implementation
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>eclipse.platform.debug</artifactId>
+ <groupId>eclipse.platform.debug</groupId>
+ <version>4.24.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.eclipse.debug</groupId>
+ <artifactId>org.eclipse.debug.ui.launchview.tests</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+ <properties>
+ <skipAPIAnalysis>true</skipAPIAnalysis>
+ <code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>
+ <testSuite>${project.artifactId}</testSuite>
+ <testClass>org.eclipse.debug.ui.launchview.tests.AutomatedSuite</testClass>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <useUIHarness>true</useUIHarness>
+ <useUIThread>true</useUIThread>
+ <dependencies>
+ <dependency>
+ <!-- workaround for missing dependency in org.eclipse.e4.ui.services: https://bugs.eclipse.org/462862 -->
+ <type>eclipse-plugin</type>
+ <artifactId>org.eclipse.equinox.event</artifactId>
+ <version>0.0.0</version>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AbstractLaunchViewTest.java b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AbstractLaunchViewTest.java
new file mode 100644
index 000000000..ac89b3e5e
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AbstractLaunchViewTest.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Andrey Loskutov and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Andrey Loskutov <loskutov@gmx.de> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.tests;
+
+import java.util.function.Function;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceMemento;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.intro.IIntroManager;
+import org.eclipse.ui.intro.IIntroPart;
+import org.eclipse.ui.progress.UIJob;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+public class AbstractLaunchViewTest {
+
+ private static boolean welcomeClosed;
+
+ /**
+ * Default timeout in milliseconds to wait on some events
+ */
+ protected long testTimeout = 30000;
+
+ /**
+ * Preference helper to restore changed preference values after test run.
+ */
+ private final PreferenceMemento prefMemento = new PreferenceMemento();
+
+ @Rule
+ public TestName name = new TestName();
+
+
+ @Before
+ public void setUp() throws Exception {
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "setUp");
+ assertWelcomeScreenClosed();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ TestUtil.log(IStatus.INFO, name.getMethodName(), "tearDown");
+ TestUtil.cleanUp(name.getMethodName());
+ prefMemento.resetPreferences();
+ }
+
+ /**
+ * Ensure the welcome screen is closed because in 4.x the debug perspective
+ * opens a giant fast-view causing issues
+ *
+ * @throws Exception
+ */
+ protected final void assertWelcomeScreenClosed() throws Exception {
+ if (!welcomeClosed && PlatformUI.isWorkbenchRunning()) {
+ final IWorkbench wb = PlatformUI.getWorkbench();
+ if (wb == null) {
+ return;
+ }
+ // In UI thread we don't need to run a job
+ if (Display.getCurrent() != null) {
+ closeIntro(wb);
+ return;
+ }
+
+ UIJob job = new UIJob("close welcome screen for debug test suite") {
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ closeIntro(wb);
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.setPriority(Job.INTERACTIVE);
+ job.setSystem(true);
+ job.schedule();
+ }
+ }
+
+ /**
+ * Waits while given condition is {@code true} for a given amount of
+ * milliseconds. If the actual wait time exceeds given timeout and condition
+ * will be still {@code true}, throws {@link AssertionFailedError} with
+ * given message.
+ * <p>
+ * Will process UI events while waiting in UI thread, if called from
+ * background thread, just waits.
+ *
+ * @param condition function which will be evaluated while waiting
+ * @param timeout max wait time in milliseconds to wait on given condition
+ * @param errorMessage message which will be used to construct the failure
+ * exception in case the condition will still return {@code true}
+ * after given timeout
+ */
+ public void waitWhile(Function<AbstractLaunchViewTest, Boolean> condition, long timeout, Function<AbstractLaunchViewTest, String> errorMessage) throws Exception {
+ TestUtil.waitWhile(condition, this, timeout, errorMessage);
+ }
+
+ /**
+ * Waits while given condition is {@code true} for some time. If the actual
+ * wait time exceeds {@link #testTimeout} and condition will be still
+ * {@code true}, throws {@link AssertionFailedError} with given message.
+ * <p>
+ * Will process UI events while waiting in UI thread, if called from
+ * background thread, just waits.
+ *
+ * @param condition function which will be evaluated while waiting
+ * @param errorMessage message which will be used to construct the failure
+ * exception in case the condition will still return {@code true}
+ * after given timeout
+ */
+ public void waitWhile(Function<AbstractLaunchViewTest, Boolean> condition, Function<AbstractLaunchViewTest, String> errorMessage) throws Exception {
+ TestUtil.waitWhile(condition, this, testTimeout, errorMessage);
+ }
+
+ private static void closeIntro(final IWorkbench wb) {
+ IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
+ if (window != null) {
+ IIntroManager im = wb.getIntroManager();
+ IIntroPart intro = im.getIntro();
+ if (intro != null) {
+ welcomeClosed = im.closeIntro(intro);
+ }
+ }
+ }
+
+ /**
+ * Change a preference value for this test run. The preference will be reset
+ * to its value before test started automatically on {@link #tearDown()}.
+ *
+ * @param <T> preference value type. The type must have a corresponding
+ * {@link IPreferenceStore} setter.
+ * @param store preference store to manipulate (must not be
+ * <code>null</code>)
+ * @param name preference to change
+ * @param value new preference value
+ * @throws IllegalArgumentException when setting a type which is not
+ * supported by {@link IPreferenceStore}
+ *
+ * @see IPreferenceStore#setValue(String, double)
+ * @see IPreferenceStore#setValue(String, float)
+ * @see IPreferenceStore#setValue(String, int)
+ * @see IPreferenceStore#setValue(String, long)
+ * @see IPreferenceStore#setValue(String, boolean)
+ * @see IPreferenceStore#setValue(String, String)
+ */
+ protected <T> void setPreference(IPreferenceStore store, String name, T value) {
+ prefMemento.setValue(store, name, value);
+ }
+}
diff --git a/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AutomatedSuite.java b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AutomatedSuite.java
new file mode 100644
index 000000000..b381ac8fe
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/AutomatedSuite.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Freescale Semiconductor - Bug 293618, Breakpoints view sorts up to first colon only
+ * Anton Kosyakov (Itemis AG) - Bug 438621 - [step filtering] Provide an extension point to enhance methods step filtering.
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.tests;
+
+import org.eclipse.debug.ui.launchview.tests.launchview.LaunchViewSmokeTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Tests for integration and nightly builds.
+ *
+ * @since 1.0
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ // Launch Configuration View
+ LaunchViewSmokeTest.class,
+})
+public class AutomatedSuite {
+}
diff --git a/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestUtil.java b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestUtil.java
new file mode 100644
index 000000000..8251f1767
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestUtil.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Google, Inc and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Stefan Xenos (Google) - Initial implementation
+ * Andrey Loskutov (loskutov@gmx.de) - many different extensions
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.tests;
+
+import static org.junit.Assert.fail;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.junit.Assert;
+
+
+public class TestUtil {
+
+ /**
+ * Call this in the tearDown method of every test to clean up state that can
+ * otherwise leak through SWT between tests.
+ */
+ public static void cleanUp(String owner) {
+ // Ensure that the Thread.interrupted() flag didn't leak.
+ Assert.assertFalse("The main thread should not be interrupted at the end of a test", Thread.interrupted());
+
+ // Wait for any outstanding jobs to finish. Protect against deadlock by
+ // terminating the wait after a timeout.
+ boolean timedOut = waitForJobs(owner, 5, 5000);
+ if (timedOut) {
+ // We don't expect any extra jobs run during the test: try to cancel them
+ log(IStatus.INFO, owner, "Trying to cancel running jobs: " + getRunningOrWaitingJobs(null));
+ getRunningOrWaitingJobs(null).forEach(Job::cancel);
+ waitForJobs(owner, 5, 1000);
+ }
+
+ // Ensure that the Thread.interrupted() flag didn't leak.
+ Assert.assertFalse("The main thread should not be interrupted at the end of a test", Thread.interrupted());
+ }
+
+ public static void log(int severity, String owner, String message, Throwable... optionalError) {
+ message = "[" + owner + "] " + message;
+ Throwable error = null;
+ if (optionalError != null && optionalError.length > 0) {
+ error = optionalError[0];
+ }
+ Status status = new Status(severity, TestsPlugin.getDefault().getBundle().getSymbolicName(), message, error);
+ TestsPlugin.getDefault().getLog().log(status);
+ }
+
+ /**
+ * Process all queued UI events. If called from background thread, does
+ * nothing.
+ */
+ public static void processUIEvents() {
+ Display display = Display.getCurrent();
+ if (display != null && !display.isDisposed()) {
+ while (display.readAndDispatch()) {
+ // Keep pumping events until the queue is empty
+ }
+ }
+ }
+
+ /**
+ * Process all queued UI events. If called from background thread, just
+ * waits
+ *
+ * @param millis max wait time to process events
+ */
+ public static void processUIEvents(final long millis) throws Exception {
+ long start = System.currentTimeMillis();
+ while (System.currentTimeMillis() - start < millis) {
+ Display display = Display.getCurrent();
+ if (display != null && !display.isDisposed()) {
+ while (display.readAndDispatch()) {
+ // loop until the queue is empty
+ }
+ } else {
+ Thread.sleep(10);
+ }
+ }
+ }
+
+ /**
+ * Waits while given condition is {@code true} for a given amount of
+ * milliseconds. If the actual wait time exceeds given timeout and condition
+ * will be still {@code true}, throws {@link AssertionFailedError} with
+ * given message.
+ * <p>
+ * Will process UI events while waiting in UI thread, if called from
+ * background thread, just waits.
+ *
+ * @param <T> type of the context
+ * @param condition function which will be evaluated while waiting
+ * @param context test context
+ * @param timeout max wait time in milliseconds to wait on given condition
+ * @param errorMessage message which will be used to construct the failure
+ * exception in case the condition will still return {@code true}
+ * after given timeout
+ */
+ public static <T> void waitWhile(Function<T, Boolean> condition, T context, long timeout, Function<T, String> errorMessage) throws Exception {
+ long start = System.currentTimeMillis();
+ Display display = Display.getCurrent();
+ while (System.currentTimeMillis() - start < timeout && condition.apply(context)) {
+ if (display != null && !display.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ Thread.sleep(0);
+ }
+ } else {
+ Thread.sleep(5);
+ }
+ }
+ Boolean stillTrue = condition.apply(context);
+ if (stillTrue) {
+ fail(errorMessage.apply(context));
+ }
+ }
+
+ /**
+ * A simplified variant of
+ * {@link #waitWhile(Function, Object, long, Function)}.
+ * <p>
+ * Waits while given condition is {@code true} for a given amount of
+ * milliseconds.
+ * <p>
+ * Will process UI events while waiting in UI thread, if called from
+ * background thread, just waits.
+ *
+ * @param condition function which will be evaluated while waiting
+ * @param timeout max wait time in milliseconds to wait on given condition
+ * @return value of condition when method returned
+ */
+ public static boolean waitWhile(Supplier<Boolean> condition, long timeout) throws Exception {
+ if (condition == null) {
+ condition = () -> true;
+ }
+ long start = System.currentTimeMillis();
+ Display display = Display.getCurrent();
+ while (System.currentTimeMillis() - start < timeout && condition.get()) {
+ Thread.yield();
+ if (display != null && !display.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ Thread.sleep(1);
+ }
+ } else {
+ Thread.sleep(5);
+ }
+ }
+ return condition.get();
+ }
+
+ /**
+ * Utility for waiting until the execution of jobs of any family has
+ * finished or timeout is reached. If no jobs are running, the method waits
+ * given minimum wait time. While this method is waiting for jobs, UI events
+ * are processed.
+ *
+ * @param owner name of the caller which will be logged as prefix if the
+ * wait times out
+ * @param minTimeMs minimum wait time in milliseconds
+ * @param maxTimeMs maximum wait time in milliseconds
+ * @return true if the method timed out, false if all the jobs terminated
+ * before the timeout
+ */
+ public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs) {
+ return waitForJobs(owner, minTimeMs, maxTimeMs, (Object[]) null);
+ }
+
+ /**
+ * Utility for waiting until the execution of jobs of any family has finished or timeout is reached. If no jobs are running, the method waits
+ * given minimum wait time. While this method is waiting for jobs, UI events are processed.
+ *
+ * @param owner
+ * name of the caller which will be logged as prefix if the wait times out
+ * @param minTimeMs
+ * minimum wait time in milliseconds
+ * @param maxTimeMs
+ * maximum wait time in milliseconds
+ * @param excludedFamilies
+ * optional list of job families to NOT wait for
+ *
+ * @return true if the method timed out, false if all the jobs terminated before the timeout
+ */
+ public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs, Object... excludedFamilies) {
+ if (maxTimeMs < minTimeMs) {
+ throw new IllegalArgumentException("Max time is smaller as min time!");
+ }
+ final long start = System.currentTimeMillis();
+ while (System.currentTimeMillis() - start < minTimeMs) {
+ processUIEvents();
+ try {
+ Thread.sleep(Math.min(10, minTimeMs));
+ } catch (InterruptedException e) {
+ // Uninterruptable
+ }
+ }
+ while (!Job.getJobManager().isIdle()) {
+ List<Job> jobs = getRunningOrWaitingJobs(null, excludedFamilies);
+ if (jobs.isEmpty()) {
+ // only uninteresting jobs running
+ break;
+ }
+
+ if (!Collections.disjoint(runningJobs, jobs)) {
+ // There is a job which runs already quite some time, don't wait for it to avoid test timeouts
+ dumpRunningOrWaitingJobs(owner, jobs);
+ return true;
+ }
+
+ if (System.currentTimeMillis() - start >= maxTimeMs) {
+ dumpRunningOrWaitingJobs(owner, jobs);
+ return true;
+ }
+ processUIEvents();
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ // Uninterruptable
+ }
+ }
+ runningJobs.clear();
+ return false;
+ }
+
+ static Set<Job> runningJobs = new LinkedHashSet<>();
+
+ private static void dumpRunningOrWaitingJobs(String owner, List<Job> jobs) {
+ String message = "Some job is still running or waiting to run: " + dumpRunningOrWaitingJobs(jobs);
+ log(IStatus.ERROR, owner, message);
+ }
+
+ private static String dumpRunningOrWaitingJobs(List<Job> jobs) {
+ if (jobs.isEmpty()) {
+ return "";
+ }
+ // clear "old" running jobs, we only remember most recent
+ runningJobs.clear();
+ StringBuilder sb = new StringBuilder();
+ for (Job job : jobs) {
+ runningJobs.add(job);
+ sb.append("\n'").append(job.toString()).append("'/");
+ sb.append(job.getClass().getName());
+ Thread thread = job.getThread();
+ if (thread != null) {
+ ThreadInfo[] threadInfos = ManagementFactory.getThreadMXBean().getThreadInfo(new long[] { thread.getId() }, true, true);
+ if (threadInfos[0] != null) {
+ sb.append("\nthread info: ").append(threadInfos[0]);
+ }
+ }
+ sb.append(", ");
+ }
+ sb.setLength(sb.length() - 2);
+ return sb.toString();
+ }
+
+ public static List<Job> getRunningOrWaitingJobs(Object jobFamily, Object... excludedFamilies) {
+ List<Job> running = new ArrayList<>();
+ Job[] jobs = Job.getJobManager().find(jobFamily);
+ for (Job job : jobs) {
+ if (isRunningOrWaitingJob(job) && !belongsToFamilies(job, excludedFamilies)) {
+ running.add(job);
+ }
+ }
+ return running;
+ }
+
+ private static boolean isRunningOrWaitingJob(Job job) {
+ int state = job.getState();
+ return (state == Job.RUNNING || state == Job.WAITING);
+ }
+
+ private static boolean belongsToFamilies(Job job, Object... excludedFamilies) {
+ if (excludedFamilies == null || excludedFamilies.length == 0) {
+ return false;
+ }
+ for (Object family : excludedFamilies) {
+ if (job.belongsTo(family)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestsPlugin.java b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestsPlugin.java
new file mode 100644
index 000000000..2fdc87d80
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/TestsPlugin.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2013 Wind River Systems and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ * IBM - ongoing enhancements
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @since 1.0
+ */
+public class TestsPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.debug.ui.launchview.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static TestsPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public TestsPlugin() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestsPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the file corresponding to the specified path from within this bundle
+ * @param path
+ * @return the file corresponding to the specified path from within this bundle, or
+ * <code>null</code> if not found
+ */
+ public File getFileInPlugin(IPath path) {
+ try {
+ Bundle bundle = getDefault().getBundle();
+ URL installURL = new URL(bundle.getEntry("/"), path.toString()); //$NON-NLS-1$
+ URL localURL= FileLocator.toFileURL(installURL);//Platform.asLocalURL(installURL);
+ return new File(localURL.getFile());
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Creates a new project with the specified name
+ * @param projectName
+ * @return a new project with the specified name
+ * @throws CoreException
+ */
+ public static IProject createProject(String projectName) throws CoreException {
+ IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
+ IProject project= root.getProject(projectName);
+ if (!project.exists()) {
+ project.create(null);
+ } else {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+
+ if (!project.isOpen()) {
+ project.open(null);
+ }
+ return project;
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/launchview/LaunchViewSmokeTest.java b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/launchview/LaunchViewSmokeTest.java
new file mode 100644
index 000000000..28d532c97
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/src/org/eclipse/debug/ui/launchview/tests/launchview/LaunchViewSmokeTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2021 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.tests.launchview;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.debug.ui.launchview.tests.AbstractLaunchViewTest;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
+
+public class LaunchViewSmokeTest extends AbstractLaunchViewTest {
+
+ @Test
+ public void testOpenView() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ assertNotNull("The active workbench page should not be null", page); //$NON-NLS-1$
+ try {
+ page.showView("org.eclipse.debug.ui.launchView"); //$NON-NLS-1$
+ } catch (PartInitException e) {
+ assertNotNull("Failed to open launch configuration view", null); //$NON-NLS-1$
+ }
+
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview.tests/test.xml b/org.eclipse.debug.ui.launchview.tests/test.xml
new file mode 100644
index 000000000..04badcb24
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview.tests/test.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2009, 2011 IBM Corporation and others.
+
+ This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License 2.0
+ which accompanies this distribution, and is available at
+ https://www.eclipse.org/legal/epl-2.0/
+
+ SPDX-License-Identifier: EPL-2.0
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+ -->
+
+<project name="testsuite" default="run" basedir=".">
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}\..\.."/>
+
+ <!-- sets the properties eclipse-home, and library-file -->
+ <property name="plugin-name" value="org.eclipse.debug.ui.launchview.tests"/>
+ <property name="library-file"
+ value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org*.xml"/>
+ </delete>
+ </target>
+
+ <!-- This target defines the regression tests that need to be run. -->
+ <target name="suite">
+ <property name="platform-debug-folder"
+ value="${eclipse-home}/platform_debug_folder"/>
+ <delete dir="${platform-debug-folder}" quiet="true"/>
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${platform-debug-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname"
+ value="org.eclipse.debug.ui.launchview.tests.AutomatedSuite"/>
+ </ant>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org*.xml"/>
+ <property name="output-file" value="${plugin-name}.xml"/>
+ </ant>
+ </target>
+
+</project>
diff --git a/org.eclipse.debug.ui.launchview/.classpath b/org.eclipse.debug.ui.launchview/.classpath
new file mode 100644
index 000000000..e801ebfb4
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.debug.ui.launchview/.project b/org.eclipse.debug.ui.launchview/.project
new file mode 100644
index 000000000..e0baa5074
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.debug.ui.launchview</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.resources.prefs b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..b7aa6e61b
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//ui/org/eclipse/debug/internal/ui/elements/adapters/Messages.properties=8859_1
+encoding//ui/org/eclipse/debug/internal/ui/importexport/breakpoints/BreakpointImportExport.properties=8859_1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..5a0ad22d2
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..2d85a380f
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,439 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
+org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
+org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
+org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=0
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..c0ff1c129
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,114 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_Platform Debug Cleanups
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Platform Debug Formatting
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644
index 000000000..3cf0ccb6b
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.api.tools.prefs
@@ -0,0 +1,97 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Warning
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.ds.annotations.prefs b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.ds.annotations.prefs
new file mode 100644
index 000000000..960a807c0
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.ds.annotations.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+enabled=true
+generateBundleActivationPolicyLazy=true
+path=OSGI-INF
+validationErrorLevel=error
+validationErrorLevel.missingImplicitUnbindMethod=error
diff --git a/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.prefs
new file mode 100644
index 000000000..56e42fa48
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,36 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF b/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..1afe723f9
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.debug.ui.launchview;singleton:=true
+Bundle-Version: 1.0.200.qualifier
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.e4.ui.model.workbench,
+ org.eclipse.debug.core,
+ org.eclipse.debug.ui,
+ org.eclipse.osgi.services,
+ org.eclipse.e4.core.di.annotations,
+ org.eclipse.e4.ui.di,
+ org.eclipse.e4.ui.services
+Bundle-RequiredExecutionEnvironment: JavaSE-11
+Import-Package: javax.annotation;version="1.0.0";resolution:=optional,
+ javax.inject;version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel.xml,
+ OSGI-INF/org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider.xml
+Export-Package: org.eclipse.debug.ui.launchview;x-internal:=true,
+ org.eclipse.debug.ui.launchview.services;x-internal:=true
+Automatic-Module-Name: org.eclipse.debug.ui.launchview
diff --git a/org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider.xml b/org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider.xml
new file mode 100644
index 000000000..cf17032a3
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="createService" deactivate="destroyService" name="org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider">
+ <service>
+ <provide interface="org.eclipse.debug.ui.launchview.services.ILaunchObjectProvider"/>
+ </service>
+ <implementation class="org.eclipse.debug.ui.launchview.internal.impl.DebugCoreProvider"/>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel.xml b/org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel.xml
new file mode 100644
index 000000000..0eb619af3
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/OSGI-INF/org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0" activate="activate" deactivate="deactivate" immediate="true" name="org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel">
+ <service>
+ <provide interface="org.eclipse.debug.ui.launchview.internal.model.ILaunchModel"/>
+ </service>
+ <reference bind="addLaunchObjectProvider" cardinality="0..n" interface="org.eclipse.debug.ui.launchview.services.ILaunchObjectProvider" name="LaunchObjectProvider" policy="dynamic" policy-option="greedy" unbind="removeLaunchObjectProvider"/>
+ <reference bind="setWorkbench" cardinality="1..1" interface="org.eclipse.ui.IWorkbench" name="Workbench" policy="static" unbind="unsetWorkbench"/>
+ <implementation class="org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel"/>
+</scr:component> \ No newline at end of file
diff --git a/org.eclipse.debug.ui.launchview/about.html b/org.eclipse.debug.ui.launchview/about.html
new file mode 100644
index 000000000..164f781a8
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/about.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>About</title>
+</head>
+<body lang="EN-US">
+ <h2>About This Content</h2>
+
+ <p>November 30, 2017</p>
+ <h3>License</h3>
+
+ <p>
+ The Eclipse Foundation makes available all content in this plug-in
+ (&quot;Content&quot;). Unless otherwise indicated below, the Content
+ is provided to you under the terms and conditions of the Eclipse
+ Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
+ available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.
+ </p>
+
+ <p>
+ If you did not receive this Content directly from the Eclipse
+ Foundation, the Content is being redistributed by another party
+ (&quot;Redistributor&quot;) and different terms and conditions may
+ apply to your use of any object code in the Content. Check the
+ Redistributor's license that was provided with the Content. If no such
+ license exists, contact the Redistributor. Unless otherwise indicated
+ below, the terms and conditions of the EPL still apply to any source
+ code in the Content and such source code may be obtained at <a
+ href="http://www.eclipse.org/">http://www.eclipse.org</a>.
+ </p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.debug.ui.launchview/build.properties b/org.eclipse.debug.ui.launchview/build.properties
new file mode 100644
index 000000000..1c7a06420
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/build.properties
@@ -0,0 +1,10 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ OSGI-INF/,\
+ icons/,\
+ plugin.properties,\
+ about.html
+source.. = src/
+src.includes = about.html
diff --git a/org.eclipse.debug.ui.launchview/icons/coverage.png b/org.eclipse.debug.ui.launchview/icons/coverage.png
new file mode 100644
index 000000000..503c96ab8
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/coverage.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/debug_exc.png b/org.eclipse.debug.ui.launchview/icons/debug_exc.png
new file mode 100644
index 000000000..6bd3c425f
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/debug_exc.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/debug_exc@2x.png b/org.eclipse.debug.ui.launchview/icons/debug_exc@2x.png
new file mode 100644
index 000000000..2a3ccdca5
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/debug_exc@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/delete_exc.png b/org.eclipse.debug.ui.launchview/icons/delete_exc.png
new file mode 100644
index 000000000..5f0038585
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/delete_exc.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/delete_exc@2x.png b/org.eclipse.debug.ui.launchview/icons/delete_exc@2x.png
new file mode 100644
index 000000000..eb2fc720b
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/delete_exc@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/edit_template.png b/org.eclipse.debug.ui.launchview/icons/edit_template.png
new file mode 100644
index 000000000..d87238840
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/edit_template.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/edit_template@2x.png b/org.eclipse.debug.ui.launchview/icons/edit_template@2x.png
new file mode 100644
index 000000000..b1c1d8501
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/edit_template@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/favorite_star.png b/org.eclipse.debug.ui.launchview/icons/favorite_star.png
new file mode 100644
index 000000000..75c9d4a1b
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/favorite_star.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/profile_exc.png b/org.eclipse.debug.ui.launchview/icons/profile_exc.png
new file mode 100644
index 000000000..d2971fac4
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/profile_exc.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/profile_exc@2x.png b/org.eclipse.debug.ui.launchview/icons/profile_exc@2x.png
new file mode 100644
index 000000000..8a6257ced
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/profile_exc@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/refresh.png b/org.eclipse.debug.ui.launchview/icons/refresh.png
new file mode 100644
index 000000000..d608a5587
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/refresh.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/refresh@2x.png b/org.eclipse.debug.ui.launchview/icons/refresh@2x.png
new file mode 100644
index 000000000..e81514787
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/refresh@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/run_co.png b/org.eclipse.debug.ui.launchview/icons/run_co.png
new file mode 100644
index 000000000..18fdb33bd
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/run_co.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/run_co@2x.png b/org.eclipse.debug.ui.launchview/icons/run_co@2x.png
new file mode 100644
index 000000000..2caa8c083
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/run_co@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/run_exc.png b/org.eclipse.debug.ui.launchview/icons/run_exc.png
new file mode 100644
index 000000000..08571c1f2
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/run_exc.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/run_exc@2x.png b/org.eclipse.debug.ui.launchview/icons/run_exc@2x.png
new file mode 100644
index 000000000..156df21c3
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/run_exc@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/term_restart.png b/org.eclipse.debug.ui.launchview/icons/term_restart.png
new file mode 100644
index 000000000..08917c61a
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/term_restart.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/term_restart@2x.png b/org.eclipse.debug.ui.launchview/icons/term_restart@2x.png
new file mode 100644
index 000000000..ae6f399d7
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/term_restart@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/terminate_all_co.png b/org.eclipse.debug.ui.launchview/icons/terminate_all_co.png
new file mode 100644
index 000000000..6e8acdcb0
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/terminate_all_co.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/terminate_all_co@2x.png b/org.eclipse.debug.ui.launchview/icons/terminate_all_co@2x.png
new file mode 100644
index 000000000..ee6373a66
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/terminate_all_co@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/terminate_co.png b/org.eclipse.debug.ui.launchview/icons/terminate_co.png
new file mode 100644
index 000000000..3544673b6
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/terminate_co.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/icons/terminate_co@2x.png b/org.eclipse.debug.ui.launchview/icons/terminate_co@2x.png
new file mode 100644
index 000000000..b605e00f4
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/icons/terminate_co@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui.launchview/plugin.properties b/org.eclipse.debug.ui.launchview/plugin.properties
new file mode 100644
index 000000000..33d856aac
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/plugin.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2000, 2019 SSI Schaefer IT Solutions GmbH and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# SSI Schaefer IT Solutions GmbH - initial API and implementation
+###############################################################################
+
+
+pluginName=Debug UI Launch Configuration View
+providerName=Eclipse.org
+
+LaunchView.name=Launch Configurations
diff --git a/org.eclipse.debug.ui.launchview/plugin.xml b/org.eclipse.debug.ui.launchview/plugin.xml
new file mode 100644
index 000000000..4ea04991b
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <e4view
+ category="org.eclipse.debug.ui"
+ class="org.eclipse.debug.ui.launchview.internal.view.LaunchViewImpl"
+ icon="$nl$/icons/run_exc.png"
+ id="org.eclipse.debug.ui.launchView"
+ name="%LaunchView.name"
+ restorable="true">
+ </e4view>
+ </extension>
+</plugin>
diff --git a/org.eclipse.debug.core/pom.xml b/org.eclipse.debug.ui.launchview/pom.xml
index bc7fdee0e..b46647c5e 100644
--- a/org.eclipse.debug.core/pom.xml
+++ b/org.eclipse.debug.ui.launchview/pom.xml
@@ -1,23 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2018 Eclipse Foundation and others.
+ Copyright (c) 2012, 2022 SSI Schaefer IT Solutions GmbH and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/org/documents/edl-v10.php
Contributors:
- Igor Fedorenko - initial implementation
+ Markus Duft - initial implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>eclipse.platform.debug</artifactId>
<groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
+
+ <properties>
+ <code.ignoredWarnings>-warn:+resource,-deprecation,unavoidableGenericProblems</code.ignoredWarnings>
+ </properties>
+
<groupId>org.eclipse.debug</groupId>
- <artifactId>org.eclipse.debug.core</artifactId>
- <version>3.14.0-SNAPSHOT</version>
+ <artifactId>org.eclipse.debug.ui.launchview</artifactId>
+ <version>1.0.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/IBackgroundLaunchExecutor.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/IBackgroundLaunchExecutor.java
new file mode 100644
index 000000000..f08d92540
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/IBackgroundLaunchExecutor.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2021 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview;
+
+import java.io.File;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * Allows to execute a specified launch configuration in the background, i.e.
+ * non-blocking.
+ * <p>
+ * The launch configuration is started as a background job.
+ *
+ * @since 1.0.2
+ */
+public interface IBackgroundLaunchExecutor {
+
+ /**
+ * Starts a launch configuration. The return value is only valid if wait is
+ * <code>true</code>. Otherwise the launch is not awaited and the method
+ * returns immediately.
+ *
+ * @param launchConf the launch configuration
+ * @param mode the launch mode to use.
+ * @param build whether to perform a build before launch
+ * @param wait whether to wait for completion
+ * @param logFile an optional {@link File} to write console output to. May
+ * be <code>null</code>.
+ * @return process exit value if wait is <code>true</code>, always 0 if wait
+ * is <code>false</code>. -1 in case waiting was interrupted.
+ */
+ int launchProcess(ILaunchConfiguration launchConf, String mode, boolean build, boolean wait, File logFile);
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/LaunchConfigurationViewPlugin.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/LaunchConfigurationViewPlugin.java
new file mode 100644
index 000000000..3af0316c1
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/LaunchConfigurationViewPlugin.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2021 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview;
+
+import org.eclipse.debug.ui.launchview.internal.launcher.StandaloneLaunchConfigExecutor;
+
+/**
+ * Static Helper which provides access to internal implementations of externally
+ * available API.
+ *
+ * @since 1.0.2
+ */
+public class LaunchConfigurationViewPlugin {
+
+ /**
+ * @return an {@link IBackgroundLaunchExecutor} which can be used to launch
+ * launch configurations as background jobs.
+ */
+ public static IBackgroundLaunchExecutor getExecutor() {
+ return new StandaloneLaunchConfigExecutor();
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/AbstractLaunchObjectProvider.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/AbstractLaunchObjectProvider.java
new file mode 100644
index 000000000..0311fbd85
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/AbstractLaunchObjectProvider.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.debug.ui.launchview.services.ILaunchObjectProvider;
+
+/**
+ * Base class for {@link ILaunchObjectProvider} implementations which require
+ * listeners to be notified on updates.
+ */
+public abstract class AbstractLaunchObjectProvider implements ILaunchObjectProvider {
+
+ private final List<Runnable> updateListeners = new ArrayList<>();
+
+ @Override
+ public void addUpdateListener(Runnable r) {
+ updateListeners.add(r);
+ }
+
+ @Override
+ public void removeUpdateListener(Runnable r) {
+ updateListeners.remove(r);
+ }
+
+ protected void fireUpdate() {
+ // prevent multiple updates in short row somehow?
+ updateListeners.forEach(Runnable::run);
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/FileLogger.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/FileLogger.java
new file mode 100644
index 000000000..36ae0c538
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/FileLogger.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal;
+
+import java.io.BufferedWriter;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStreamMonitor;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Logger that can be attached to a {@linkplain IProcess} and that writes the
+ * output to a file.
+ * <p>
+ * Please note that it is the responsibility of the caller to close the logger
+ * if it is not used any more.
+ * </p>
+ */
+public class FileLogger implements IStreamListener, Closeable {
+
+ private final BufferedWriter writer;
+
+ /** Creates a new logger that writes to the given file */
+ public FileLogger(File file) throws IOException {
+ writer = new BufferedWriter(new FileWriter(file));
+ }
+
+ @Override
+ public void streamAppended(String text, IStreamMonitor monitor) {
+ try {
+ writer.write(text);
+ writer.flush();
+ } catch (Exception ex) {
+ Platform.getLog(this.getClass()).warn(NLS.bind(LaunchViewMessages.FileLogger_FailedAppend, text), ex);
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ writer.close();
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewBundleInfo.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewBundleInfo.java
new file mode 100644
index 000000000..c12a4c421
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewBundleInfo.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal;
+
+public interface LaunchViewBundleInfo {
+
+ // The plug-in ID
+ static final String PLUGIN_ID = "org.eclipse.debug.ui.launchview"; //$NON-NLS-1$
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewMessages.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewMessages.java
new file mode 100644
index 000000000..60c0a3637
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/LaunchViewMessages.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class LaunchViewMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.debug.ui.launchview.internal.messages"; //$NON-NLS-1$
+
+ public static String DebugCoreLaunchObject_CannotGetType;
+ public static String DebugCoreLaunchObject_CannotRelaunch;
+ public static String DebugCoreLaunchObject_CannotTerminate;
+ public static String DebugCoreLaunchObject_Terminate;
+ public static String DebugCoreProvider_cannotFetchError;
+ public static String DebugCoreProvider_delete;
+ public static String DebugCoreProvider_deleteHint;
+ public static String DebugCoreProvider_FailedLookup;
+ public static String EditAction_Edit;
+ public static String FileLogger_FailedAppend;
+ public static String LaunchAction_FailedFetchLaunchDelegates;
+ public static String LaunchObject_ErrorNoId;
+ public static String LaunchObjectFavoriteContainerModel_Favorites;
+ public static String LaunchView_Refresh;
+ public static String LaunchView_Reset;
+ public static String LaunchView_TerminateAll;
+ public static String RelaunchAction_TerminateRelaunch;
+ public static String StandaloneLaunchConfigExecutor_FailedLaunching;
+ public static String StandaloneLaunchConfigExecutor_Launch;
+ public static String StandaloneLaunchConfigExecutor_Launching;
+ public static String StandaloneLaunchConfigExecutor_Timeout;
+ public static String StandaloneLaunchConfigExecutor_Waiting;
+ public static String TerminateAction_Terminate;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, LaunchViewMessages.class);
+ }
+
+ private LaunchViewMessages() {
+ }
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/SpecificLaunchListener.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/SpecificLaunchListener.java
new file mode 100644
index 000000000..20d9cf695
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/SpecificLaunchListener.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal;
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.core.model.IProcess;
+
+/**
+ * Wrapper around {@link ILaunchesListener2} which unwraps to a single specific
+ * {@link ILaunch} matching the given {@link ILaunchConfiguration}
+ */
+public abstract class SpecificLaunchListener implements ILaunchesListener2 {
+
+ private interface ILaunchMethod {
+
+ public void theMethod(ILaunch launch);
+ }
+
+ private final ILaunchConfiguration config;
+
+ public SpecificLaunchListener(ILaunchConfiguration config) {
+ this.config = config;
+ }
+
+ private boolean matches(ILaunch launch) {
+ // this can happen if re-generating a running launch configuration
+ if (launch == null || launch.getLaunchConfiguration() == null) {
+ return false;
+ }
+
+ return launch.getLaunchConfiguration().contentsEqual(this.config);
+ }
+
+ private void runIfMatches(ILaunch[] launches, ILaunchMethod handle) {
+ for (ILaunch l : launches) {
+ if (matches(l)) {
+ handle.theMethod(l);
+ }
+ }
+ }
+
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ runIfMatches(launches, this::launchRemoved);
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ runIfMatches(launches, this::launchAdded);
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ runIfMatches(launches, this::launchChanged);
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ runIfMatches(launches, this::launchTerminated);
+ }
+
+ public void launchRemoved(@SuppressWarnings("unused") ILaunch launch) {
+ // default: nothing
+ }
+
+ public void launchAdded(@SuppressWarnings("unused") ILaunch launch) {
+ // default: nothing
+ }
+
+ /**
+ * Called whenever a launch changes. Adding an {@link IProcess} to the
+ * {@link ILaunch} is a change.
+ */
+ public void launchChanged(@SuppressWarnings("unused") ILaunch launch) {
+ // default: nothing
+ }
+
+ /**
+ * Called whenever the launch is terminated.
+ */
+ public void launchTerminated(@SuppressWarnings("unused") ILaunch launch) {
+ // default: nothing
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/StreamHelper.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/StreamHelper.java
new file mode 100644
index 000000000..8adc1749b
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/StreamHelper.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal;
+
+import java.io.Closeable;
+
+/**
+ * Provides static helpers to work with streams
+ */
+public class StreamHelper {
+
+ /**
+ * Unconditionally close a <code>Closeable</code> without throwing any
+ * exception.
+ *
+ * @param closeable the object to close, may be null or already closed
+ */
+ public static void closeQuietly(Closeable closeable) {
+ if (closeable == null) {
+ return;
+ }
+ try {
+ closeable.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java
new file mode 100644
index 000000000..5c02a2523
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreLaunchObject.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2021 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ * IBM Corporation - Bug fixes
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.ILaunchGroup;
+import org.eclipse.debug.ui.launchview.LaunchConfigurationViewPlugin;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.debug.ui.launchview.services.ILaunchObject;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.PlatformUI;
+
+public class DebugCoreLaunchObject implements ILaunchObject, Comparable<ILaunchObject> {
+
+ private final ILaunchConfiguration config;
+
+ public DebugCoreLaunchObject(ILaunchConfiguration config) {
+ this.config = config;
+ }
+
+ @Override
+ public String getId() {
+ return config.getName();
+ }
+
+ @Override
+ public StyledString getLabel() {
+ return new StyledString(config.getName());
+ }
+
+ @Override
+ public ILaunchConfigurationType getType() {
+ try {
+ return config.getType();
+ } catch (CoreException e) {
+ Platform.getLog(this.getClass()).error(NLS.bind(LaunchViewMessages.DebugCoreLaunchObject_CannotGetType, config.getName()), e);
+ }
+ return null;
+ }
+
+ @Override
+ public void launch(ILaunchMode mode) {
+ LaunchConfigurationViewPlugin.getExecutor().launchProcess(config, mode.getIdentifier(), true, false, null);
+ }
+
+ @Override
+ public boolean canTerminate() {
+ return !findTerminateableLaunches(config.getName()).isEmpty();
+ }
+
+ @Override
+ public void terminate() {
+ // DON'T use Eclipse' mechanism - it's a little broken if shutdown of
+ // the processes takes longer than a few seconds.
+ // Instead we start a job that tries to terminate processes. If the job
+ // itself is stopped, we give up like Eclipse does.
+ Collection<ILaunch> launches = findTerminateableLaunches(config.getName());
+ for (ILaunch launch: launches) {
+ Job terminateJob = new Job(NLS.bind(LaunchViewMessages.DebugCoreLaunchObject_Terminate, config.getName())) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (!launch.isTerminated()) {
+ try {
+ launch.terminate();
+ } catch (DebugException e) {
+ // could not terminate - but we cannot do anything
+ // anyway... :(
+ return new Status(IStatus.WARNING, LaunchViewBundleInfo.PLUGIN_ID, NLS.bind(LaunchViewMessages.DebugCoreLaunchObject_CannotTerminate, config.getName()));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ terminateJob.setUser(true);
+ terminateJob.schedule();
+ }
+ }
+
+ @Override
+ public void relaunch() {
+ ILaunch launch = findLaunch(getId());
+ String launchMode = launch.getLaunchMode();
+ try {
+ launch.terminate();
+ LaunchConfigurationViewPlugin.getExecutor().launchProcess(config, launchMode, true, false, null);
+ } catch (Exception e) {
+ throw new RuntimeException(NLS.bind(LaunchViewMessages.DebugCoreLaunchObject_CannotRelaunch, config.getName()), e);
+ }
+ }
+
+ private static ILaunch findLaunch(String name) {
+ for (ILaunch l : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
+ if (l.getLaunchConfiguration() == null || l.isTerminated()) {
+ continue;
+ }
+ if (l.getLaunchConfiguration().getName().equals(name)) {
+ return l;
+ }
+ }
+ return null;
+ }
+
+ private static Collection<ILaunch> findTerminateableLaunches(String name) {
+ Collection<ILaunch> result = new ArrayList<>();
+ for (ILaunch l : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
+ if (l.getLaunchConfiguration() == null || l.isTerminated()) {
+ continue;
+ }
+ if (l.getLaunchConfiguration().getName().equals(name) && l.canTerminate()) {
+ result.add(l);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public void edit() {
+ // This prefers "debug" mode as the Eclipse infrastructure
+ // requires a group to be given. This covers most launch configurations
+ // as most of them support debug, whereas e.g. "Remote Java Application"
+ // does not support "run". Ant launch configurations in turn do not
+ // support debug...
+ ILaunchGroup group = DebugUITools.getLaunchGroup(config, "debug"); //$NON-NLS-1$
+ if (group == null) {
+ group = DebugUITools.getLaunchGroup(config, "run"); //$NON-NLS-1$
+ }
+ if (group != null) { // Id Debug & run both not supported and only
+ // profile is supported
+ DebugUITools.openLaunchConfigurationDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), config, group.getIdentifier(), null);
+ }
+ }
+
+ @Override
+ public boolean isFavorite() {
+ try {
+ return !config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, Collections.emptyList()).isEmpty();
+ } catch (CoreException e) {
+ return false; // oups
+ }
+ }
+
+ @Override
+ public int compareTo(ILaunchObject o) {
+ if (getId() == null) {
+ Platform.getLog(this.getClass()).warn(NLS.bind(LaunchViewMessages.LaunchObject_ErrorNoId, this), null);
+ if (o.getId() == null) {
+ return 0;
+ }
+ return 1;
+ }
+
+ return getId().compareTo(o.getId());
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreProvider.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreProvider.java
new file mode 100644
index 000000000..67123d023
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/impl/DebugCoreProvider.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.impl;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.ui.launchview.internal.AbstractLaunchObjectProvider;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.debug.ui.launchview.services.ILaunchObject;
+import org.eclipse.debug.ui.launchview.services.ILaunchObjectProvider;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Component(service = ILaunchObjectProvider.class)
+public class DebugCoreProvider extends AbstractLaunchObjectProvider implements ILaunchObjectProvider, ILaunchConfigurationListener, ILaunchesListener2 {
+
+ private final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+
+ @Activate
+ public void createService() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this);
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ }
+
+ @Deactivate
+ public void destroyService() {
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this);
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
+ }
+
+ @Override
+ public Set<ILaunchObject> getLaunchObjects() {
+ try {
+ return Arrays.stream(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations()).map(DebugCoreLaunchObject::new).collect(Collectors.toCollection(TreeSet::new));
+ } catch (CoreException e) {
+ org.eclipse.core.runtime.Platform.getLog(this.getClass()).error(LaunchViewMessages.DebugCoreProvider_FailedLookup, e);
+ return Collections.emptySet();
+ }
+ }
+
+ @Override
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ fireUpdate();
+ }
+
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ fireUpdate();
+ }
+
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ fireUpdate();
+ }
+
+ @Override
+ public int getPriority() {
+ return 0;
+ }
+
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ fireUpdate(); // process added, thus can terminate
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ fireUpdate();
+ }
+
+ @Override
+ public void contributeViewMenu(Supplier<Set<ILaunchObject>> selected, MMenu menu) {
+ // nothing to contribute for now...
+ }
+
+ @Override
+ public void contributeContextMenu(Supplier<Set<ILaunchObject>> selected, MMenu menu) {
+ MDirectMenuItem delete = MMenuFactory.INSTANCE.createDirectMenuItem();
+ delete.setLabel(LaunchViewMessages.DebugCoreProvider_delete);
+ delete.setTooltip(LaunchViewMessages.DebugCoreProvider_deleteHint);
+ delete.setIconURI("platform:/plugin/" + LaunchViewBundleInfo.PLUGIN_ID + "/icons/delete_exc.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ delete.setObject(new Object() {
+
+ @Execute
+ public void delete() throws CoreException {
+ for (ILaunchObject e : selected.get()) {
+ findLaunchConfiguration(e.getType(), e.getId()).delete();
+ }
+
+ fireUpdate();
+ }
+
+ @CanExecute
+ public boolean isEnabled() {
+ Set<ILaunchObject> elements = selected.get();
+ return !elements.isEmpty() && elements.stream().allMatch(e -> e instanceof DebugCoreLaunchObject && findLaunchConfiguration(e.getType(), e.getId()) != null);
+ }
+ });
+
+ menu.getChildren().add(MMenuFactory.INSTANCE.createMenuSeparator());
+ menu.getChildren().add(delete);
+ }
+
+ ILaunchConfiguration findLaunchConfiguration(ILaunchConfigurationType type, String name) {
+ try {
+ for (ILaunchConfiguration config : manager.getLaunchConfigurations(type)) {
+ if (config.getName().equals(name)) {
+ return config;
+ }
+ }
+ return null;
+ } catch (Exception e) {
+ throw new RuntimeException(LaunchViewMessages.DebugCoreProvider_cannotFetchError, e);
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/launcher/StandaloneLaunchConfigExecutor.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/launcher/StandaloneLaunchConfigExecutor.java
new file mode 100644
index 000000000..4f76c74f0
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/launcher/StandaloneLaunchConfigExecutor.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.launcher;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.ui.launchview.IBackgroundLaunchExecutor;
+import org.eclipse.debug.ui.launchview.internal.FileLogger;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.debug.ui.launchview.internal.SpecificLaunchListener;
+import org.eclipse.debug.ui.launchview.internal.StreamHelper;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Wraps launching a certain ILaunchConfiguration into a job
+ */
+public class StandaloneLaunchConfigExecutor implements IBackgroundLaunchExecutor {
+
+ /**
+ * Starts a launch configuration. The return value is only valid if wait is
+ * <code>true</code>
+ *
+ * @param launchConf the launch configuration
+ * @param mode the launch mode to use.
+ * @param build whether to perform a build before launch
+ * @param wait whether to wait for completion
+ * @param logFile an optional {@link File} to write console output to. May
+ * be <code>null</code>.
+ * @return process exit value if wait is <code>true</code>, always 0 if wait
+ * is <code>false</code>. -1 in case waiting was interrupted.
+ */
+ @Override
+ public int launchProcess(ILaunchConfiguration launchConf, String mode, boolean build, boolean wait, File logFile) {
+ StandaloneLauncherJob launch = new StandaloneLauncherJob(launchConf, mode, build, wait, logFile);
+
+ launch.setPriority(Job.SHORT);
+ launch.schedule();
+ if (wait) {
+ try {
+ launch.join();
+ } catch (InterruptedException e) {
+ return -1;
+ }
+ }
+
+ // when waiting this is the real result, when not it's initialized to 0
+ return launch.getProcessResult();
+ }
+
+ /**
+ * Launches the specified configuration and optionally waits until the end
+ * of execution.
+ *
+ * @param launchConfig launch configuration
+ * @param mode the mode in which to launch
+ * @param monitor progress monitor (only for cancellation)
+ * @param timeout timeout in milliseconds (optional; {@code <=0} means no
+ * timeout)
+ * @param logFile log file where console output is redirected (optional;
+ * {@code null} means no log file)
+ * @return the resulting launch
+ */
+ @SuppressWarnings("resource")
+ private static ILaunch launch(final ILaunchConfiguration launchConfig, final String mode, final IProgressMonitor monitor, final long timeout, final File logFile, boolean build, boolean wait) throws Exception {
+ final FileLogger logger;
+ if (logFile != null) {
+ logger = new FileLogger(logFile);
+ } else {
+ logger = null;
+ }
+
+ Object lock = new Object();
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ launchManager.addLaunchListener(new SpecificLaunchListener(launchConfig) {
+
+ private final Set<IProcess> attached = new HashSet<>();
+
+ @Override
+ public void launchChanged(ILaunch launch) {
+ if (logger == null) {
+ return;
+ }
+
+ for (IProcess p : launch.getProcesses()) {
+ if (!attached.contains(p)) {
+ p.getStreamsProxy().getOutputStreamMonitor().addListener(logger);
+ p.getStreamsProxy().getErrorStreamMonitor().addListener(logger);
+
+ attached.add(p);
+ }
+ }
+ }
+
+ @Override
+ public void launchTerminated(ILaunch l) {
+ // found it. make sure that the streams are closed.
+ StreamHelper.closeQuietly(logger);
+ launchManager.removeLaunchListener(this);
+
+ synchronized (lock) {
+ lock.notifyAll();
+ }
+ }
+ });
+
+ final ILaunch launch = launchConfig.launch(mode, monitor, build, true);
+ monitor.subTask(LaunchViewMessages.StandaloneLaunchConfigExecutor_Waiting);
+
+ if (wait) {
+ long timeRunning = 0;
+ while (launch.hasChildren() && !launch.isTerminated()) {
+ if (monitor.isCanceled()) {
+ launch.terminate();
+ }
+ if (timeout > 0 && timeRunning > timeout) {
+ launch.terminate();
+ StreamHelper.closeQuietly(logger);
+ throw new InterruptedException(NLS.bind(LaunchViewMessages.StandaloneLaunchConfigExecutor_Timeout, timeout));
+ }
+ synchronized (lock) {
+ lock.wait(500);
+ }
+ timeRunning += 500;
+ }
+ }
+ return launch;
+ }
+
+ /**
+ * Job that launches a {@link LaunchConfig} in the background.
+ */
+ private static class StandaloneLauncherJob extends Job {
+
+ private final ILaunchConfiguration config;
+
+ private int result = 0;
+ private final String mode;
+ private final boolean build;
+ private final boolean wait;
+
+ private final File logFile;
+
+ /**
+ * Creates a new {@link StandaloneLauncherJob} to monitor an await
+ * launching of {@link ILaunchConfiguration}s
+ *
+ * @param config the {@link ILaunchConfiguration} to start
+ * @param mode the mode in which to launch
+ * @param build whether to build before launch
+ * @param wait whether to keep the job alive until the associated
+ * {@link ILaunch} terminates.
+ * @param logFile an optional {@link File} to write console output to.
+ * May be <code>null</code>.
+ */
+ StandaloneLauncherJob(ILaunchConfiguration config, String mode, boolean build, boolean wait, File logFile) {
+ super(NLS.bind(LaunchViewMessages.StandaloneLaunchConfigExecutor_Launch, config.getName()));
+ this.config = config;
+ this.build = build;
+ this.wait = wait;
+ this.logFile = logFile;
+ this.mode = mode;
+ }
+
+ int getProcessResult() {
+ return result;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ monitor.beginTask(NLS.bind(LaunchViewMessages.StandaloneLaunchConfigExecutor_Launching, config.getName()), IProgressMonitor.UNKNOWN);
+
+ ILaunch launch = launch(config, mode, monitor, 0, logFile, build, wait);
+
+ if (wait) {
+ IProcess[] ps = launch.getProcesses();
+
+ // in our scenarios it NEVER happens that there is more than
+ // one process
+ for (IProcess p : ps) {
+ if (p.getExitValue() != 0) {
+ result = p.getExitValue();
+ }
+ }
+ }
+ } catch (Exception e) {
+ Platform.getLog(this.getClass()).error(NLS.bind(LaunchViewMessages.StandaloneLaunchConfigExecutor_FailedLaunching, config.getName()), e);
+ } finally {
+ monitor.done();
+ }
+
+ // always return OK, to avoid error messages
+ return Status.OK_STATUS;
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/messages.properties b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/messages.properties
new file mode 100644
index 000000000..e2112f50a
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/messages.properties
@@ -0,0 +1,37 @@
+###############################################################################
+# Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# SSI Schaefer IT Solutions GmbH
+###############################################################################
+
+DebugCoreLaunchObject_CannotGetType=Cannot get type of {0}
+DebugCoreLaunchObject_CannotRelaunch=Cannot relaunch {0}
+DebugCoreLaunchObject_CannotTerminate=Cannot terminate {0}
+DebugCoreLaunchObject_Terminate=Terminate {0}
+DebugCoreProvider_cannotFetchError=Cannot fetch existing launch configurations
+DebugCoreProvider_delete=De&lete
+DebugCoreProvider_deleteHint=Deletes the selected launch configuration
+DebugCoreProvider_FailedLookup=Cannot fetch launch configurations from Eclipse.
+EditAction_Edit=&Edit...
+FileLogger_FailedAppend=Failed to append '{0}' to log file.
+LaunchAction_FailedFetchLaunchDelegates=Problem retreiving launch delegates
+LaunchObject_ErrorNoId=LaunchObject with null id: {0}
+LaunchObjectFavoriteContainerModel_Favorites=Favorites
+LaunchView_Refresh=Refresh
+LaunchView_Reset=Reset
+LaunchView_TerminateAll=Terminate All
+RelaunchAction_TerminateRelaunch=Terminate && Relaun&ch
+StandaloneLaunchConfigExecutor_FailedLaunching=Failed launching {0}
+StandaloneLaunchConfigExecutor_Launch=Launch {0}
+StandaloneLaunchConfigExecutor_Launching=Launching {0}
+StandaloneLaunchConfigExecutor_Timeout=execution exceeded maximum time of {0} ms
+StandaloneLaunchConfigExecutor_Waiting=waiting for processes...
+TerminateAction_Terminate=&Terminate
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/ILaunchModel.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/ILaunchModel.java
new file mode 100644
index 000000000..3acfa28c9
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/ILaunchModel.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.model;
+
+/**
+ * Service which controls the lifecycle of the model which the view is based on.
+ */
+public interface ILaunchModel {
+
+ /**
+ * @return the current model. Never <code>null</code>. Always created from
+ * the current state.
+ */
+ public LaunchObjectContainerModel getModel();
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectContainerModel.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectContainerModel.java
new file mode 100644
index 000000000..ce419c510
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectContainerModel.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.model;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.swt.graphics.Image;
+
+public class LaunchObjectContainerModel extends LaunchObjectModel {
+
+ private final Set<LaunchObjectModel> children = new TreeSet<>((a, b) -> {
+ if (a instanceof LaunchObjectFavoriteContainerModel) {
+ return -1;
+ } else if (b instanceof LaunchObjectFavoriteContainerModel) {
+ return 1;
+ }
+
+ return a.getLabel().getString().compareTo(b.getLabel().getString());
+ });
+ private final ILaunchConfigurationType type;
+
+ LaunchObjectContainerModel() {
+ this(null, null);
+ }
+
+ LaunchObjectContainerModel(ILaunchConfigurationType type) {
+ super(type.getName(), type.getIdentifier(), DebugPluginImages.getImage(type.getIdentifier()));
+ this.type = type;
+ }
+
+ protected LaunchObjectContainerModel(String id, Image image) {
+ super(id, null, image);
+ this.type = null;
+ }
+
+ public void addChild(LaunchObjectModel model) {
+ children.add(model);
+ }
+
+ public Set<LaunchObjectModel> getChildren() {
+ return children;
+ }
+
+ public LaunchObjectContainerModel getContainerFor(LaunchObjectModel m) {
+ for (LaunchObjectModel child : children) {
+ if (child instanceof LaunchObjectContainerModel) {
+ if (m.getObject().getType().equals(((LaunchObjectContainerModel) child).type)) {
+ return (LaunchObjectContainerModel) child;
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectFavoriteContainerModel.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectFavoriteContainerModel.java
new file mode 100644
index 000000000..a62cb06b1
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectFavoriteContainerModel.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.model;
+
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class LaunchObjectFavoriteContainerModel extends LaunchObjectContainerModel {
+
+ private static final Image FAV_ICON = AbstractUIPlugin.imageDescriptorFromPlugin(LaunchViewBundleInfo.PLUGIN_ID, "icons/favorite_star.png") //$NON-NLS-1$
+ .createImage();
+
+ public LaunchObjectFavoriteContainerModel() {
+ super(LaunchViewMessages.LaunchObjectFavoriteContainerModel_Favorites, FAV_ICON);
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectModel.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectModel.java
new file mode 100644
index 000000000..298f5c361
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchObjectModel.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.model;
+
+import org.eclipse.debug.ui.launchview.services.ILaunchObject;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.swt.graphics.Image;
+
+public class LaunchObjectModel implements Comparable<LaunchObjectModel> {
+
+ private final String id;
+ private final Image image;
+
+ private final ILaunchObject object;
+ private final String internalId;
+
+ LaunchObjectModel(ILaunchObject obj) {
+ this.id = obj.getId();
+ this.internalId = obj.getId();
+ this.image = obj.getImage();
+ this.object = obj;
+ }
+
+ LaunchObjectModel(String id, String internalId, Image image) {
+ this.id = id;
+ this.internalId = internalId;
+ this.image = image;
+ this.object = null;
+ }
+
+ public StyledString getLabel() {
+ if (object == null) {
+ return new StyledString(id);
+ }
+ return object.getLabel();
+ }
+
+ public Image getImage() {
+ return image;
+ }
+
+ public ILaunchObject getObject() {
+ return object;
+ }
+
+ @Override
+ public String toString() {
+ return uniqueId() + "(" + getObject() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ public int compareTo(LaunchObjectModel o) {
+ return uniqueId().compareTo(o.uniqueId());
+ }
+
+ public String uniqueId() {
+ if (id == null && internalId == null) {
+ return "root"; //$NON-NLS-1$
+ } else if (internalId != null) {
+ return internalId;
+ } else if (object == null || object.getType() == null) {
+ return id;
+ }
+ return object.getType().getIdentifier() + "." + id; //$NON-NLS-1$
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (uniqueId().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ LaunchObjectModel other = (LaunchObjectModel) obj;
+ return uniqueId().equals(other.uniqueId());
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchViewModel.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchViewModel.java
new file mode 100644
index 000000000..a017d99c1
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/model/LaunchViewModel.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
+
+import org.eclipse.debug.ui.launchview.services.ILaunchObjectProvider;
+import org.eclipse.ui.IWorkbench;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
+
+@Component(immediate = true)
+public class LaunchViewModel implements ILaunchModel {
+
+ public Set<ILaunchObjectProvider> providers = new TreeSet<>((a, b) -> {
+ int x = Integer.compare(b.getPriority(), a.getPriority());
+ if (x == 0) {
+ x = a.getClass().getName().compareTo(b.getClass().getName());
+ }
+ return x;
+ });
+ private static LaunchViewModel service;
+
+ private final List<Runnable> updateListeners = new ArrayList<>();
+ private final Runnable providerUpdateListener = () -> fireUpdate();
+
+ public Set<ILaunchObjectProvider> getProviders() {
+ return providers;
+ }
+
+ @Override
+ public LaunchObjectContainerModel getModel() {
+ LaunchObjectContainerModel root = new LaunchObjectContainerModel();
+
+ // find all objects from services, sorted by prio (highest prio first).
+ Set<LaunchObjectModel> allObjects = providers.stream().map(p -> p.getLaunchObjects()).flatMap(o -> o.stream().map(LaunchObjectModel::new)).collect(Collectors.toCollection(TreeSet::new));
+
+ // create favorite container
+ LaunchObjectFavoriteContainerModel favorites = new LaunchObjectFavoriteContainerModel();
+ root.addChild(favorites);
+
+ // create all required type containers
+ allObjects.stream().map(o -> o.getObject().getType()).distinct().map(LaunchObjectContainerModel::new).forEach(root::addChild);
+
+ // create all nodes
+ allObjects.stream().forEach(m -> {
+ LaunchObjectContainerModel container = root.getContainerFor(m);
+ if (container == null) {
+ return;
+ }
+ container.addChild(m);
+ if (m.getObject() != null && m.getObject().isFavorite()) {
+ favorites.addChild(m);
+ }
+ });
+
+ // this is the root :)
+ return root;
+ }
+
+ @Reference(service = ILaunchObjectProvider.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
+ public void addLaunchObjectProvider(ILaunchObjectProvider svc) {
+ providers.add(svc);
+ svc.addUpdateListener(providerUpdateListener);
+
+ fireUpdate();
+ }
+
+ public void removeLaunchObjectProvider(ILaunchObjectProvider svc) {
+ providers.remove(svc);
+ svc.removeUpdateListener(providerUpdateListener);
+
+ fireUpdate();
+ }
+
+ @Reference(service = IWorkbench.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.STATIC, unbind = "unsetWorkbench")
+ public void setWorkbench(@SuppressWarnings("unused") IWorkbench svc) {
+ // this reference is just a marker to control startup order.
+ // this is required, otherwise this service activates so early, that the
+ // prompt for the workspace location is no longer shown (as the location
+ // is accessed indirectly before the prompt, which initializes it to a
+ // default).
+ }
+
+ public void unsetWorkbench(@SuppressWarnings("unused") IWorkbench svc) {
+ }
+
+ @Activate
+ public void activate() {
+ service = this;
+ }
+
+ @Deactivate
+ public void deactivate() {
+ service = null;
+ }
+
+ public void addUpdateListener(Runnable r) {
+ updateListeners.add(r);
+ }
+
+ public void removeUpdateListener(Runnable r) {
+ updateListeners.remove(r);
+ }
+
+ private void fireUpdate() {
+ updateListeners.forEach(Runnable::run);
+ }
+
+ public static LaunchViewModel getService() {
+ return service;
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/EditAction.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/EditAction.java
new file mode 100644
index 000000000..3b08bd01a
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/EditAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.view;
+
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+
+public class EditAction {
+
+ private LaunchViewImpl view;
+
+ public EditAction(LaunchViewImpl view) {
+ this.view = view;
+ }
+
+ public MMenuItem asMMenuItem() {
+ MDirectMenuItem item = MMenuFactory.INSTANCE.createDirectMenuItem();
+ item.setLabel(LaunchViewMessages.EditAction_Edit);
+ item.setObject(this);
+ item.setIconURI("platform:/plugin/" + LaunchViewBundleInfo.PLUGIN_ID + "/icons/edit_template.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ return item;
+ }
+
+ @CanExecute
+ public boolean isEnabled() {
+ return view.get().size() == 1;
+ }
+
+ @Execute
+ public void run() {
+ view.get().iterator().next().edit();
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchAction.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchAction.java
new file mode 100644
index 000000000..df92b38b6
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchAction.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.view;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.debug.ui.launchview.services.ILaunchObject;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+
+public class LaunchAction {
+
+ private static final Map<String, String> COMMON_MODE_ICONS;
+
+ static {
+ COMMON_MODE_ICONS = new TreeMap<>();
+ COMMON_MODE_ICONS.put("run", "icons/run_exc.png"); //$NON-NLS-1$//$NON-NLS-2$
+ COMMON_MODE_ICONS.put("debug", "icons/debug_exc.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ COMMON_MODE_ICONS.put("profile", "icons/profile_exc.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ COMMON_MODE_ICONS.put("coverage", "icons/coverage.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private final ILaunchMode mode;
+ private LaunchViewImpl view;
+
+ public LaunchAction(ILaunchMode mode, LaunchViewImpl view) {
+ this.mode = mode;
+ this.view = view;
+ }
+
+ public MMenuItem asMMenuItem() {
+ MDirectMenuItem item = MMenuFactory.INSTANCE.createDirectMenuItem();
+ item.setLabel(mode.getLabel());
+ item.setObject(this);
+
+ if (COMMON_MODE_ICONS.containsKey(mode.getIdentifier())) {
+ item.setIconURI("platform:/plugin/" + LaunchViewBundleInfo.PLUGIN_ID + "/" + COMMON_MODE_ICONS.get(mode.getIdentifier())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ return item;
+ }
+
+ @CanExecute
+ public boolean isEnabled() {
+ Set<ILaunchObject> elements = view.get();
+ return !elements.isEmpty() && elements.stream().allMatch((m) -> {
+ try {
+ return m.getType().getDelegates(Collections.singleton(mode.getIdentifier())).length > 0;
+ } catch (CoreException e) {
+ Platform.getLog(this.getClass()).warn(LaunchViewMessages.LaunchAction_FailedFetchLaunchDelegates, e);
+ return false;
+ }
+ });
+ }
+
+ @Execute
+ public void run() {
+ Set<ILaunchObject> objects = view.get();
+ for (ILaunchObject m : objects) {
+ m.launch(mode);
+
+ if (objects.size() > 1) {
+ // PDE has a nasty bug. If launching too fast, it tries to
+ // overwrite the last configurations platform.xml
+ try {
+ Thread.sleep(2_000);
+ } catch (InterruptedException ie) {
+ // ignored
+ }
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewContentProvider.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewContentProvider.java
new file mode 100644
index 000000000..d426a71ae
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewContentProvider.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.view;
+
+import org.eclipse.debug.ui.launchview.internal.model.LaunchObjectContainerModel;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+public class LaunchViewContentProvider implements ITreeContentProvider {
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof LaunchObjectContainerModel) {
+ return ((LaunchObjectContainerModel) parentElement).getChildren().toArray();
+ }
+
+ return null;
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return (element instanceof LaunchObjectContainerModel && !((LaunchObjectContainerModel) element).getChildren().isEmpty());
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java
new file mode 100644
index 000000000..e50e3d356
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewImpl.java
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2022 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ * IBM Corporation - bug fixes
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.view;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.debug.ui.launchview.internal.model.LaunchObjectContainerModel;
+import org.eclipse.debug.ui.launchview.internal.model.LaunchObjectFavoriteContainerModel;
+import org.eclipse.debug.ui.launchview.internal.model.LaunchObjectModel;
+import org.eclipse.debug.ui.launchview.internal.model.LaunchViewModel;
+import org.eclipse.debug.ui.launchview.services.ILaunchObject;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MPopupMenu;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
+
+public class LaunchViewImpl implements Supplier<Set<ILaunchObject>> {
+
+ private static final String CONTEXT_MENU_ID = "LaunchViewContextMenu"; //$NON-NLS-1$
+
+ private LaunchViewModel model;
+ private final Runnable reset = () -> queueReset();
+ private final Job resetJob;
+ private FilteredTree tree;
+
+ @Inject
+ EMenuService menuService;
+
+ public LaunchViewImpl() {
+ resetJob = new Job(LaunchViewMessages.LaunchView_Reset) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ reset();
+ return Status.OK_STATUS;
+ }
+ };
+
+ resetJob.setSystem(true);
+ }
+
+ @PostConstruct
+ public void createView(Composite parent, MPart part) {
+ model = LaunchViewModel.getService();
+ model.addUpdateListener(reset);
+
+ tree = new FilteredTree(parent, SWT.BORDER | SWT.MULTI, new PatternFilter() {
+
+ @Override
+ public void setPattern(String pattern) {
+ if (pattern != null && !pattern.isEmpty() && pattern.indexOf("*") != 0 && pattern.indexOf("?") != 0 //$NON-NLS-1$ //$NON-NLS-2$
+ && pattern.indexOf(".") != 0) { //$NON-NLS-1$
+ super.setPattern("*" + pattern); //$NON-NLS-1$
+ } else {
+ super.setPattern(pattern);
+ }
+ }
+
+ @Override
+ protected boolean isLeafMatch(Viewer viewer, Object element) {
+ if (!(element instanceof LaunchObjectModel) || element instanceof LaunchObjectContainerModel) {
+ return false;
+ }
+ String txt = ((LaunchObjectModel) element).getLabel().toString();
+ return wordMatches(txt);
+ }
+ }, true, true);
+ tree.getViewer().setContentProvider(new LaunchViewContentProvider());
+ tree.getViewer().setLabelProvider(new DelegatingStyledCellLabelProvider(new LaunchViewLabelProvider()));
+ tree.getViewer().getTree().setLayout(new GridLayout());
+ tree.getViewer().getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ createMenus(part);
+
+ tree.getViewer().addDoubleClickListener((e) -> {
+ ITreeSelection selection = tree.getViewer().getStructuredSelection();
+ if (selection.isEmpty()) {
+ return;
+ }
+
+ for (Object selected : selection.toList()) {
+ if (selected instanceof LaunchObjectContainerModel) {
+ tree.getViewer().setExpandedState(selected, !tree.getViewer().getExpandedState(selected));
+ return; // only supported for single element double-click
+ }
+ }
+
+ new LaunchAction(DebugPlugin.getDefault().getLaunchManager().getLaunchMode("run"), LaunchViewImpl.this).run(); //$NON-NLS-1$
+ });
+ tree.getViewer().setComparator(new ViewerComparator(String.CASE_INSENSITIVE_ORDER));
+
+ reset();
+ }
+
+ @Focus
+ public void onFocus() {
+ tree.getViewer().getControl().setFocus();
+ }
+
+ private void createMenus(MPart part) {
+ part.getMenus().clear(); // clear persisted state
+
+ // View menu
+ MMenu viewMenu = MMenuFactory.INSTANCE.createMenu();
+ viewMenu.setElementId("menu:" + part.getElementId()); //$NON-NLS-1$
+ viewMenu.getTags().add("ViewMenu"); //$NON-NLS-1$
+
+ MDirectMenuItem refresh = MMenuFactory.INSTANCE.createDirectMenuItem();
+ refresh.setLabel(LaunchViewMessages.LaunchView_Refresh);
+ refresh.setIconURI("platform:/plugin/" + LaunchViewBundleInfo.PLUGIN_ID + "/icons/refresh.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ refresh.setObject(new RefreshHandler());
+
+ MDirectMenuItem terminateAll = MMenuFactory.INSTANCE.createDirectMenuItem();
+ terminateAll.setLabel(LaunchViewMessages.LaunchView_TerminateAll);
+ terminateAll.setIconURI("platform:/plugin/" + LaunchViewBundleInfo.PLUGIN_ID + "/icons/terminate_all_co.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ terminateAll.setObject(new TerminateAllHandler());
+
+ viewMenu.getChildren().add(refresh);
+ viewMenu.getChildren().add(MMenuFactory.INSTANCE.createMenuSeparator());
+ viewMenu.getChildren().add(terminateAll);
+
+ // contributions from providers
+ model.getProviders().forEach(p -> p.contributeViewMenu(this, viewMenu));
+
+ part.getMenus().add(viewMenu);
+
+ // Context menu
+ MPopupMenu ctxMenu = MMenuFactory.INSTANCE.createPopupMenu();
+ ctxMenu.setElementId(CONTEXT_MENU_ID);
+
+ // one menu item for each mode that launches all selected
+ for (ILaunchMode mode : getPreSortedLaunchModes()) {
+ ctxMenu.getChildren().add(new LaunchAction(mode, this).asMMenuItem());
+ }
+
+ ctxMenu.getChildren().add(MMenuFactory.INSTANCE.createMenuSeparator());
+ ctxMenu.getChildren().add(new RelaunchAction(this).asMMenuItem());
+ ctxMenu.getChildren().add(new TerminateAction(this).asMMenuItem());
+ ctxMenu.getChildren().add(MMenuFactory.INSTANCE.createMenuSeparator());
+ ctxMenu.getChildren().add(new EditAction(this).asMMenuItem());
+
+ // contributions from providers
+ model.getProviders().forEach(p -> p.contributeContextMenu(this, ctxMenu));
+
+ part.getMenus().add(ctxMenu);
+
+ menuService.registerContextMenu(tree.getViewer().getControl(), CONTEXT_MENU_ID);
+ }
+
+ private List<ILaunchMode> getPreSortedLaunchModes() {
+ List<ILaunchMode> modes = new ArrayList<>();
+
+ ILaunchMode run = null;
+ ILaunchMode debug = null;
+ ILaunchMode profile = null;
+ ILaunchMode coverage = null;
+
+ ILaunchMode[] launchModes = DebugPlugin.getDefault().getLaunchManager().getLaunchModes();
+ List<ILaunchMode> others = new ArrayList<>();
+
+ for (ILaunchMode m : launchModes) {
+ switch (m.getIdentifier()) {
+ case "run": //$NON-NLS-1$
+ run = m;
+ break;
+ case "debug": //$NON-NLS-1$
+ debug = m;
+ break;
+ case "profile": //$NON-NLS-1$
+ profile = m;
+ break;
+ case "coverage": //$NON-NLS-1$
+ coverage = m;
+ break;
+ default:
+ others.add(m);
+ }
+ }
+
+ if (run != null) {
+ modes.add(run);
+ }
+ if (debug != null) {
+ modes.add(debug);
+ }
+ if (coverage != null) {
+ modes.add(coverage);
+ }
+ if (profile != null) {
+ modes.add(profile);
+ }
+ modes.addAll(others);
+ return modes;
+ }
+
+ private void queueReset() {
+ resetJob.cancel();
+ resetJob.schedule(100);
+ }
+
+ @Override
+ public Set<ILaunchObject> get() {
+ ISelection selection = tree.getViewer().getSelection();
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.isEmpty()) {
+ return Collections.emptySet();
+ }
+
+ Set<LaunchObjectModel> elements = new TreeSet<>();
+ // expand selection if containers are selected
+ for (Object selected : structuredSelection.toList()) {
+ if (selected instanceof LaunchObjectContainerModel) {
+ // skip container nodes (Bug 577581)
+ } else if (selected instanceof LaunchObjectModel) {
+ elements.add((LaunchObjectModel) selected);
+ }
+ }
+
+ return elements.stream().map(m -> m.getObject()).filter(Objects::nonNull).collect(Collectors.toCollection(TreeSet::new));
+ }
+
+ private synchronized void reset() {
+ if (tree == null || tree.isDisposed()) {
+ return;
+ }
+ tree.getDisplay().syncExec(() -> {
+ tree.getViewer().getTree().setRedraw(false);
+ try {
+ TreePath[] exp = tree.getViewer().getExpandedTreePaths();
+ tree.getViewer().setInput(model.getModel());
+ tree.getViewer().setExpandedTreePaths(exp);
+ } finally {
+ tree.getViewer().getTree().setRedraw(true);
+ }
+ });
+ }
+
+ @PreDestroy
+ public void destroy() {
+ model.removeUpdateListener(reset);
+ }
+
+ private final class RefreshHandler {
+
+ @Execute
+ public void handle() {
+ reset();
+ }
+ }
+
+ private final class TerminateAllHandler {
+
+ @Execute
+ public void handle() {
+ LaunchObjectContainerModel root = (LaunchObjectContainerModel) tree.getViewer().getInput();
+ if (root == null) {
+ return;
+ }
+
+ for (LaunchObjectModel container : root.getChildren()) {
+ if (container instanceof LaunchObjectFavoriteContainerModel) {
+ continue;
+ }
+
+ if (container instanceof LaunchObjectContainerModel) {
+ for (LaunchObjectModel m : ((LaunchObjectContainerModel) container).getChildren()) {
+ if (m.getObject() == null) {
+ continue;
+ }
+
+ if (m.getObject().canTerminate()) {
+ m.getObject().terminate();
+ }
+ }
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewLabelProvider.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewLabelProvider.java
new file mode 100644
index 000000000..4d8b1759e
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/LaunchViewLabelProvider.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.view;
+
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.model.LaunchObjectModel;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class LaunchViewLabelProvider extends BaseLabelProvider implements IStyledLabelProvider {
+
+ private static final ImageDescriptor ICON_RUNNING = AbstractUIPlugin.imageDescriptorFromPlugin(LaunchViewBundleInfo.PLUGIN_ID, "icons/run_co.png"); //$NON-NLS-1$
+
+ private final ImageRegistry perConfig = new ImageRegistry();
+
+ @Override
+ public StyledString getStyledText(Object element) {
+ if (element instanceof LaunchObjectModel) {
+ return ((LaunchObjectModel) element).getLabel();
+ }
+
+ return null;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof LaunchObjectModel) {
+ LaunchObjectModel obj = (LaunchObjectModel) element;
+ if (obj.getObject() != null && obj.getObject().canTerminate()) {
+ return getCachedRunningImage(obj);
+ }
+
+ return obj.getImage();
+ }
+
+ return null;
+ }
+
+ private Image getCachedRunningImage(LaunchObjectModel obj) {
+ Image img = perConfig.get(obj.getObject().getId());
+ if (img == null) {
+ img = new DecorationOverlayIcon(obj.getImage(), ICON_RUNNING, IDecoration.TOP_LEFT).createImage();
+ perConfig.put(obj.getObject().getId(), img);
+ }
+ return img;
+ }
+
+ @Override
+ public void dispose() {
+ perConfig.dispose();
+ super.dispose();
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/RelaunchAction.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/RelaunchAction.java
new file mode 100644
index 000000000..210397aad
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/RelaunchAction.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.view;
+
+import java.util.Set;
+
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.debug.ui.launchview.services.ILaunchObject;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+
+public class RelaunchAction {
+
+ private LaunchViewImpl view;
+
+ public RelaunchAction(LaunchViewImpl view) {
+ this.view = view;
+ }
+
+ public MMenuItem asMMenuItem() {
+ MDirectMenuItem item = MMenuFactory.INSTANCE.createDirectMenuItem();
+ item.setLabel(LaunchViewMessages.RelaunchAction_TerminateRelaunch);
+ item.setEnabled(isEnabled());
+ item.setObject(this);
+
+ item.setIconURI("platform:/plugin/" + LaunchViewBundleInfo.PLUGIN_ID + "/icons/term_restart.png"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return item;
+ }
+
+ @CanExecute
+ public boolean isEnabled() {
+ Set<ILaunchObject> elements = view.get();
+ return !elements.isEmpty() && elements.stream().allMatch(m -> m.canTerminate());
+ }
+
+ @Execute
+ public void run() {
+ view.get().stream().forEach(m -> m.relaunch());
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/TerminateAction.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/TerminateAction.java
new file mode 100644
index 000000000..5544e2754
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/internal/view/TerminateAction.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.internal.view;
+
+import java.util.Set;
+
+import org.eclipse.debug.ui.launchview.internal.LaunchViewBundleInfo;
+import org.eclipse.debug.ui.launchview.internal.LaunchViewMessages;
+import org.eclipse.debug.ui.launchview.services.ILaunchObject;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+
+public class TerminateAction {
+
+ private LaunchViewImpl view;
+
+ public TerminateAction(LaunchViewImpl view) {
+ this.view = view;
+ }
+
+ public MMenuItem asMMenuItem() {
+ MDirectMenuItem item = MMenuFactory.INSTANCE.createDirectMenuItem();
+ item.setLabel(LaunchViewMessages.TerminateAction_Terminate);
+ item.setEnabled(isEnabled());
+ item.setObject(this);
+
+ item.setIconURI("platform:/plugin/" + LaunchViewBundleInfo.PLUGIN_ID + "/icons/terminate_co.png"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return item;
+ }
+
+ @CanExecute
+ public boolean isEnabled() {
+ Set<ILaunchObject> elements = view.get();
+ return !elements.isEmpty() && elements.stream().allMatch(m -> m.canTerminate());
+ }
+
+ @Execute
+ public void run() {
+ view.get().forEach(e -> e.terminate());
+ }
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java
new file mode 100644
index 000000000..9bfc2f9c9
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObject.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.services;
+
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * A {@link ILaunchObject} describes a single launch-able "thing".
+ * <p>
+ * Instances of this interface are provided by extensions by a custom
+ * {@link ILaunchObjectProvider} implementation in the extension.
+ *
+ * @since 1.0.2
+ */
+public interface ILaunchObject extends Comparable<ILaunchObject> {
+
+ /**
+ * @return the unique ID of the {@link ILaunchObject}.
+ */
+ public String getId();
+
+ /**
+ * @return a label for display purposes.
+ */
+ public StyledString getLabel();
+
+ /**
+ * @return an image, usually derived from the type of the launch
+ */
+ default public Image getImage() {
+ if (getType() == null) {
+ return null;
+ }
+ return DebugPluginImages.getImage(getType().getIdentifier());
+ }
+
+ /**
+ * @return the underlying {@link ILaunchConfigurationType} of the launch
+ */
+ public ILaunchConfigurationType getType();
+
+ /**
+ * Launch the {@link ILaunchObject} in the specified mode.
+ *
+ * @param mode in which mode to launch
+ */
+ public void launch(ILaunchMode mode);
+
+ /**
+ * @return whether this {@link ILaunchObject} supports termination by the
+ * user.
+ */
+ public boolean canTerminate();
+
+ /**
+ * Terminates all running instances of this {@link ILaunchObject}.
+ */
+ public void terminate();
+
+ /**
+ * First terminates and then launches this {@link ILaunchObject} if it is
+ * running already.
+ */
+ public void relaunch();
+
+ /**
+ * Triggers custom editing UI logic for the {@link ILaunchObject}. Might open
+ * an editor, or a dialog, or do something completely different depending on
+ * the implementation.
+ */
+ public void edit();
+
+ /**
+ * @return whether this {@link ILaunchObject} should be displayed in the
+ * favorite container of the view.
+ */
+ public boolean isFavorite();
+
+}
diff --git a/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObjectProvider.java b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObjectProvider.java
new file mode 100644
index 000000000..653f42449
--- /dev/null
+++ b/org.eclipse.debug.ui.launchview/src/org/eclipse/debug/ui/launchview/services/ILaunchObjectProvider.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2019 SSI Schaefer IT Solutions GmbH and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SSI Schaefer IT Solutions GmbH
+ *******************************************************************************/
+package org.eclipse.debug.ui.launchview.services;
+
+import java.util.Set;
+import java.util.function.Supplier;
+
+import org.eclipse.debug.ui.launchview.internal.view.LaunchViewImpl;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+
+/**
+ * Provides different {@link ILaunchObject} instances to the view for display.
+ * Also allows some interaction with the view by means of an update listener and
+ * menu contributions.
+ * <p>
+ * Contribute extensions to the view by implementing this interface and
+ * registering it as a {@literal @Component} (declarative service).
+ *
+ * @since 1.0.2
+ */
+public interface ILaunchObjectProvider {
+
+ /**
+ * @return all {@link ILaunchObject}s that this provider contributes to the
+ * view
+ */
+ public Set<? extends ILaunchObject> getLaunchObjects();
+
+ /**
+ * @param r register a {@link Runnable} that should be notified whenever the
+ * provider's state changed. The view will react with refreshing
+ * it's in-memory models.
+ */
+ public void addUpdateListener(Runnable r);
+
+ /**
+ * @param r a previously registered update listener {@link Runnable}.
+ */
+ public void removeUpdateListener(Runnable r);
+
+ /**
+ * @return the priority of the provider. The default (debug.core) provider
+ * has priority 0. A higher priority means that
+ * {@link ILaunchObject}s with the same type and id will take
+ * precedence. This allows to provide {@link ILaunchObject}s that
+ * will generate {@link ILaunchObject}s in lower priority providers.
+ */
+ public int getPriority();
+
+ /**
+ * @param selected supplier for selected elements in the view.
+ * @param menu the view's menu where items can be contributed.
+ */
+ public void contributeViewMenu(Supplier<Set<ILaunchObject>> selected, MMenu menu);
+
+ /**
+ * Contribute per-item context menu items here. Use
+ * {@link LaunchViewImpl#getSelectedElements()} to retrieve selected
+ * elements during CanExecute and Execute methods of menu items.
+ *
+ * @param selected supplier for selected elements in the view.
+ * @param menu the context menu applied to items in the tree.
+ */
+ public void contributeContextMenu(Supplier<Set<ILaunchObject>> selected, MMenu menu);
+
+}
diff --git a/org.eclipse.debug.ui/.classpath b/org.eclipse.debug.ui/.classpath
index 2ddccc40c..623144a15 100644
--- a/org.eclipse.debug.ui/.classpath
+++ b/org.eclipse.debug.ui/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="ui"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.debug.ui/.options b/org.eclipse.debug.ui/.options
index 1b586a599..24f7c7e4c 100644
--- a/org.eclipse.debug.ui/.options
+++ b/org.eclipse.debug.ui/.options
@@ -11,3 +11,4 @@ org.eclipse.debug.ui/debug/viewers/stateSaveRestore = false
org.eclipse.debug.ui/debug/viewers/presentationId =
org.eclipse.debug.ui/debug/breadcrumb = false
org.eclipse.debug.ui/debug/memory/dynamicLoading = false
+org.eclipse.debug.ui/debug/commandservice = false
diff --git a/org.eclipse.debug.ui/.settings/.api_filters b/org.eclipse.debug.ui/.settings/.api_filters
index a3537eec0..fa022b300 100644
--- a/org.eclipse.debug.ui/.settings/.api_filters
+++ b/org.eclipse.debug.ui/.settings/.api_filters
@@ -1,5 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.debug.ui" version="2">
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.debug.internal.core.groups.GroupLaunch">
+ <filter comment="Bug 548841 - Mark internal package as x-internal in manifest" id="305426566">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.internal.core.groups.GroupLaunch"/>
+ <message_argument value="org.eclipse.debug.ui_3.14.200"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.debug.internal.core.groups.GroupLaunchConfigurationDelegate">
+ <filter comment="Bug 548841 - Mark internal package as x-internal in manifest" id="305426566">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.internal.core.groups.GroupLaunchConfigurationDelegate"/>
+ <message_argument value="org.eclipse.debug.ui_3.14.200"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.debug.internal.core.groups.GroupLaunchElement">
+ <filter comment="Bug 548841 - Mark internal package as x-internal in manifest" id="305426566">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.internal.core.groups.GroupLaunchElement"/>
+ <message_argument value="org.eclipse.debug.ui_3.14.200"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="META-INF/MANIFEST.MF" type="org.eclipse.debug.internal.core.groups.GroupMemberChangeListener">
+ <filter comment="Bug 548841 - Mark internal package as x-internal in manifest" id="305426566">
+ <message_arguments>
+ <message_argument value="org.eclipse.debug.internal.core.groups.GroupMemberChangeListener"/>
+ <message_argument value="org.eclipse.debug.ui_3.14.200"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java" type="org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationViewer">
<filter comment="Known illegal extension" id="571473929">
<message_arguments>
diff --git a/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs
index 05d8e79da..1aa186aa3 100644
--- a/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.debug.ui/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -37,6 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -95,6 +96,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=erro
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -131,12 +133,14 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -144,20 +148,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
@@ -249,11 +256,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -284,6 +292,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -308,13 +318,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -362,6 +376,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -398,9 +414,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -436,10 +455,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.ui/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.ui/.settings/org.eclipse.pde.prefs
index 469adc912..45e162048 100644
--- a/org.eclipse.debug.ui/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.debug.ui/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=1
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=1
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index 17c582b9e..b5596c3ce 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true
-Bundle-Version: 3.14.200.qualifier
+Bundle-Version: 3.16.100.qualifier
Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -12,7 +12,8 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.jdt.debug.tests,
org.eclipse.debug.tests,
org.eclipse.debug.examples.ui,
- org.eclipse.debug.examples.mixedmode",
+ org.eclipse.debug.examples.mixedmode,
+ org.eclipse.debug.ui.launchview",
org.eclipse.debug.internal.ui.actions;x-internal:=true,
org.eclipse.debug.internal.ui.actions.breakpointGroups;x-internal:=true,
org.eclipse.debug.internal.ui.actions.breakpointSortBy;x-internal:=true,
@@ -40,7 +41,7 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.internal.ui.model.elements;x-friends:="org.eclipse.debug.examples.ui,org.eclipse.jdt.debug.ui,org.eclipse.wst.jsdt.debug.ui",
org.eclipse.debug.internal.ui.preferences;x-internal:=true,
org.eclipse.debug.internal.ui.quickaccess;x-internal:=true,
- org.eclipse.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.debug.tests",
+ org.eclipse.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.debug.tests,org.eclipse.jdt.debug.ui",
org.eclipse.debug.internal.ui.sourcelookup.browsers;x-internal:=true,
org.eclipse.debug.internal.ui.stringsubstitution;x-friends:="org.eclipse.jdt.debug.ui",
org.eclipse.debug.internal.ui.viewers;x-friends:="org.eclipse.debug.examples.ui",
@@ -48,6 +49,7 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.internal.ui.viewers.model;x-friends:="org.eclipse.debug.tests,org.eclipse.jdt.debug.tests,org.eclipse.debug.examples.ui",
org.eclipse.debug.internal.ui.viewers.model.provisional;
x-friends:="org.eclipse.cdt.dsf.gdb.ui,
+ org.eclipse.debug.internal.ui.views.memory.renderings;x-internal:=true,
org.eclipse.cdt.dsf.ui,
org.eclipse.debug.examples.ui,
org.eclipse.debug.tests,
@@ -68,7 +70,7 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.internal.ui.views.memory.renderings;x-internal:=true,
org.eclipse.debug.internal.ui.views.modules;x-internal:=true,
org.eclipse.debug.internal.ui.views.registers;x-internal:=true,
- org.eclipse.debug.internal.ui.views.variables;x-friends:="org.eclipse.jdt.debug.ui,org.eclipse.debug.examples.ui",
+ org.eclipse.debug.internal.ui.views.variables;x-friends:="org.eclipse.jdt.debug.ui,org.eclipse.debug.examples.ui,org.eclipse.debug.tests",
org.eclipse.debug.internal.ui.views.variables.details;x-friends:="org.eclipse.jdt.debug.ui,org.eclipse.wst.jsdt.debug.ui",
org.eclipse.debug.ui,
org.eclipse.debug.ui.actions,
@@ -79,22 +81,23 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.ui.stringsubstitution
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
- org.eclipse.ui;bundle-version="[3.113.0,4.0.0)",
- org.eclipse.ui.console;bundle-version="[3.5.300,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.115.0,4.0.0)",
+ org.eclipse.ui.console;bundle-version="[3.10.0,4.0.0)",
org.eclipse.help;bundle-version="[3.4.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)";visibility:=reexport,
+ org.eclipse.jface;bundle-version="[3.21.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.ui.workbench;bundle-version="[3.115.0,4.0.0)",
+ org.eclipse.ui.workbench;bundle-version="[3.117.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.ui.genericeditor;bundle-version="1.1.0";resolution:=optional
+ org.eclipse.ui.genericeditor;bundle-version="1.1.0";resolution:=optional,
+ org.eclipse.e4.ui.services;bundle-version="[1.3.700,2.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
-Import-Package: com.ibm.icu.text,
- org.eclipse.ui.forms.widgets
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: org.eclipse.ui.forms.widgets
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.eclipse.debug.ui
diff --git a/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css b/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css
index 248b776f1..86735f611 100644
--- a/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css
+++ b/org.eclipse.debug.ui/css/e4-dark_debug_prefstyle.css
@@ -45,4 +45,8 @@ IEclipsePreferences#org-eclipse-debug-ui {
*/
background-color:#515658;
color: white;
-} \ No newline at end of file
+}
+
+#VariablesViewer {
+ font-family: '#org-eclipse-debug-ui-VariableTextFont';
+}
diff --git a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css
index b0df8dd4f..52da14fb3 100644
--- a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css
+++ b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle.css
@@ -20,4 +20,8 @@
#DebugBreadcrumbItemDropDownToolBar
{
background-color:COLOR-WIDGET-LIGHT-SHADOW;
-} \ No newline at end of file
+}
+
+#VariablesViewer {
+ font-family: '#org-eclipse-debug-ui-VariableTextFont';
+}
diff --git a/org.eclipse.debug.ui/css/e4-light_debug_prefstyle_system.css b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle_system.css
new file mode 100644
index 000000000..83cced5af
--- /dev/null
+++ b/org.eclipse.debug.ui/css/e4-light_debug_prefstyle_system.css
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2018 SAP SE and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+#VariablesViewer {
+ font-family: '#org-eclipse-debug-ui-VariableTextFont';
+}
diff --git a/org.eclipse.debug.ui/forceQualifierUpdate.txt b/org.eclipse.debug.ui/forceQualifierUpdate.txt
index bdcfb9f5f..0ba44bccc 100644
--- a/org.eclipse.debug.ui/forceQualifierUpdate.txt
+++ b/org.eclipse.debug.ui/forceQualifierUpdate.txt
@@ -1,3 +1,4 @@
# To force a version qualifier update add the bug here
Bug 509973 - Comparator errors in I20170105-0320
-Bug 534597 - Unanticipated comparator errors in I20180511-2000 \ No newline at end of file
+Bug 534597 - Unanticipated comparator errors in I20180511-2000
+Bug 566471 - I20200828-0150 - Comparator Errors Found \ No newline at end of file
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co.png b/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co.png
index 40397c9a2..f74cc9ba4 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co@2x.png b/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co@2x.png
index c09265576..b2385551b 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/debuglast_co@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts.png b/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts.png
index 9cb342ad2..115ac183c 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts@2x.png b/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts@2x.png
index 46d651363..f7047ee44 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/export_brkpts@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps.png b/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps.png
index 3c39527ab..d48339527 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps@2x.png b/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps@2x.png
index 9d482043c..6dbbb4c38 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/filter_ps@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts.png b/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts.png
index 13e5061af..2b3ebdd43 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts@2x.png b/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts@2x.png
index 96badf538..0c35784b3 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/import_brkpts@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp.png b/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp.png
index 3a8417430..a10d45b07 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp@2x.png b/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp@2x.png
index 26c49c510..a30a7f6a0 100644
--- a/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dlcl16/skip_brkp@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dtool16/debug_exc.png b/org.eclipse.debug.ui/icons/full/dtool16/debug_exc.png
index 9d50176c6..b352e5518 100644
--- a/org.eclipse.debug.ui/icons/full/dtool16/debug_exc.png
+++ b/org.eclipse.debug.ui/icons/full/dtool16/debug_exc.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dtool16/debug_exc@2x.png b/org.eclipse.debug.ui/icons/full/dtool16/debug_exc@2x.png
index 45639ee01..789210574 100644
--- a/org.eclipse.debug.ui/icons/full/dtool16/debug_exc@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dtool16/debug_exc@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view.png b/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view.png
index 36177a05f..5da0b5f27 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view@2x.png b/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view@2x.png
index 39697c885..a0663e4f6 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/breakpoint_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/debug_persp.png b/org.eclipse.debug.ui/icons/full/dview16/debug_persp.png
index 9d50176c6..b352e5518 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/debug_persp.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/debug_persp.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/debug_persp@2x.png b/org.eclipse.debug.ui/icons/full/dview16/debug_persp@2x.png
index 45639ee01..789210574 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/debug_persp@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/debug_persp@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/debug_view.png b/org.eclipse.debug.ui/icons/full/dview16/debug_view.png
index e6686a9cb..b352e5518 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/debug_view.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/debug_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/debug_view@2x.png b/org.eclipse.debug.ui/icons/full/dview16/debug_view@2x.png
index 45639ee01..789210574 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/debug_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/debug_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/register_view.png b/org.eclipse.debug.ui/icons/full/dview16/register_view.png
index 3aa7f2336..0e8187db0 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/register_view.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/register_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/register_view@2x.png b/org.eclipse.debug.ui/icons/full/dview16/register_view@2x.png
index 90bb320e5..29264b200 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/register_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/register_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/variable_view.png b/org.eclipse.debug.ui/icons/full/dview16/variable_view.png
index 684fc598b..3e41778c9 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/variable_view.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/variable_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/variable_view@2x.png b/org.eclipse.debug.ui/icons/full/dview16/variable_view@2x.png
index a1fb7b8c9..538fa7d1e 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/variable_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/variable_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/watchlist_view.png b/org.eclipse.debug.ui/icons/full/dview16/watchlist_view.png
index 76fc4c87d..bbd2c11fa 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/watchlist_view.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/watchlist_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/dview16/watchlist_view@2x.png b/org.eclipse.debug.ui/icons/full/dview16/watchlist_view@2x.png
index 808fb6256..6d88d322b 100644
--- a/org.eclipse.debug.ui/icons/full/dview16/watchlist_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/dview16/watchlist_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co.png b/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co.png
index 2da6fd53b..13ff8ea2b 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co@2x.png b/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co@2x.png
index dd1c93e67..c1a4c5637 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co@2x.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/debuglast_co@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts.png b/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts.png
index fed2c5524..edf8ec729 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts@2x.png b/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts@2x.png
index 6029d694b..0faf5a0bd 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts@2x.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/export_brkpts@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/filter_ps.png b/org.eclipse.debug.ui/icons/full/elcl16/filter_ps.png
index 27c8738a7..58faf49c8 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/filter_ps.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/filter_ps.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/filter_ps@2x.png b/org.eclipse.debug.ui/icons/full/elcl16/filter_ps@2x.png
index 779bc07b1..062359255 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/filter_ps@2x.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/filter_ps@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts.png b/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts.png
index 7c4ae88fa..a5e16ab3c 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts@2x.png b/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts@2x.png
index 86d9cb177..f46f882ef 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts@2x.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/import_brkpts@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp.png b/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp.png
index 8327b3b72..bc4a48cc8 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp@2x.png b/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp@2x.png
index 220847758..860da524b 100644
--- a/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp@2x.png
+++ b/org.eclipse.debug.ui/icons/full/elcl16/skip_brkp@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/etool16/debug_exc.png b/org.eclipse.debug.ui/icons/full/etool16/debug_exc.png
index 6bd3c425f..59875d1b3 100644
--- a/org.eclipse.debug.ui/icons/full/etool16/debug_exc.png
+++ b/org.eclipse.debug.ui/icons/full/etool16/debug_exc.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/etool16/debug_exc@2x.png b/org.eclipse.debug.ui/icons/full/etool16/debug_exc@2x.png
index 2a3ccdca5..f082faad1 100644
--- a/org.eclipse.debug.ui/icons/full/etool16/debug_exc@2x.png
+++ b/org.eclipse.debug.ui/icons/full/etool16/debug_exc@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/etool16/watch_exp.png b/org.eclipse.debug.ui/icons/full/etool16/watch_exp.png
index a9327beaa..21db2ad25 100644
--- a/org.eclipse.debug.ui/icons/full/etool16/watch_exp.png
+++ b/org.eclipse.debug.ui/icons/full/etool16/watch_exp.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/etool16/watch_exp@2x.png b/org.eclipse.debug.ui/icons/full/etool16/watch_exp@2x.png
index 657d22850..326323785 100644
--- a/org.eclipse.debug.ui/icons/full/etool16/watch_exp@2x.png
+++ b/org.eclipse.debug.ui/icons/full/etool16/watch_exp@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.gif b/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.gif
deleted file mode 100644
index f529c5a42..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.png b/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.png
index 6b1744255..cf00ff8e1 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view@2x.png b/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view@2x.png
index ad447ce21..324cd9f25 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/breakpoint_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/debug_persp.gif b/org.eclipse.debug.ui/icons/full/eview16/debug_persp.gif
deleted file mode 100644
index ac5431fa3..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/debug_persp.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/debug_persp.png b/org.eclipse.debug.ui/icons/full/eview16/debug_persp.png
index 6bd3c425f..59875d1b3 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/debug_persp.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/debug_persp.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/debug_persp@2x.png b/org.eclipse.debug.ui/icons/full/eview16/debug_persp@2x.png
index 2a3ccdca5..f082faad1 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/debug_persp@2x.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/debug_persp@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/debug_view.gif b/org.eclipse.debug.ui/icons/full/eview16/debug_view.gif
deleted file mode 100644
index ac5431fa3..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/debug_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/debug_view.png b/org.eclipse.debug.ui/icons/full/eview16/debug_view.png
index 97d5e2d7a..59875d1b3 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/debug_view.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/debug_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/debug_view@2x.png b/org.eclipse.debug.ui/icons/full/eview16/debug_view@2x.png
index 2a3ccdca5..f082faad1 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/debug_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/debug_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/details_view.gif b/org.eclipse.debug.ui/icons/full/eview16/details_view.gif
deleted file mode 100644
index c81630a08..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/details_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/memory_view.gif b/org.eclipse.debug.ui/icons/full/eview16/memory_view.gif
deleted file mode 100644
index 7ce111283..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/memory_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/module_view.gif b/org.eclipse.debug.ui/icons/full/eview16/module_view.gif
deleted file mode 100644
index cb55e33b5..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/module_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/register_view.gif b/org.eclipse.debug.ui/icons/full/eview16/register_view.gif
deleted file mode 100644
index 7134210d0..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/register_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/register_view.png b/org.eclipse.debug.ui/icons/full/eview16/register_view.png
index 604009c9c..6f5440674 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/register_view.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/register_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/register_view@2x.png b/org.eclipse.debug.ui/icons/full/eview16/register_view@2x.png
index a25de72b9..8f75c76be 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/register_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/register_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/variable_view.gif b/org.eclipse.debug.ui/icons/full/eview16/variable_view.gif
deleted file mode 100644
index e35f594d8..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/variable_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/variable_view.png b/org.eclipse.debug.ui/icons/full/eview16/variable_view.png
index d4d5774c5..dd38fefd5 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/variable_view.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/variable_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/variable_view@2x.png b/org.eclipse.debug.ui/icons/full/eview16/variable_view@2x.png
index 8bd414c00..cf0a7ff8b 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/variable_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/variable_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/watchlist_view.gif b/org.eclipse.debug.ui/icons/full/eview16/watchlist_view.gif
deleted file mode 100644
index c55cb5842..000000000
--- a/org.eclipse.debug.ui/icons/full/eview16/watchlist_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/watchlist_view.png b/org.eclipse.debug.ui/icons/full/eview16/watchlist_view.png
index de5bfa168..bb84c9d32 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/watchlist_view.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/watchlist_view.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/eview16/watchlist_view@2x.png b/org.eclipse.debug.ui/icons/full/eview16/watchlist_view@2x.png
index 360aeef5c..55b78ddc5 100644
--- a/org.eclipse.debug.ui/icons/full/eview16/watchlist_view@2x.png
+++ b/org.eclipse.debug.ui/icons/full/eview16/watchlist_view@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/obj16/launchConfiguration.png b/org.eclipse.debug.ui/icons/full/obj16/launchConfiguration.png
new file mode 100644
index 000000000..27b2f80e4
--- /dev/null
+++ b/org.eclipse.debug.ui/icons/full/obj16/launchConfiguration.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/obj16/launchConfiguration@2x.png b/org.eclipse.debug.ui/icons/full/obj16/launchConfiguration@2x.png
new file mode 100644
index 000000000..8e6529b14
--- /dev/null
+++ b/org.eclipse.debug.ui/icons/full/obj16/launchConfiguration@2x.png
Binary files differ
diff --git a/org.eclipse.debug.ui/icons/full/obj16/stckframe_obj.gif b/org.eclipse.debug.ui/icons/full/obj16/stckframe_obj.gif
deleted file mode 100644
index f1e585bdf..000000000
--- a/org.eclipse.debug.ui/icons/full/obj16/stckframe_obj.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties
index 8c23489a4..0789bdb08 100644
--- a/org.eclipse.debug.ui/plugin.properties
+++ b/org.eclipse.debug.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2017 IBM Corporation and others.
+# Copyright (c) 2000, 2020 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -60,6 +60,7 @@ DebugToolbarActionSet.label=Debug Toolbar
debugCurrentInstructionPointer=Debug Current Instruction Pointer
debugCallStack=Debug Call Stack
DebugDropDownAction.label=Debug
+DebugQuickAccess.label=Debug
DebugHistoryMenuAction.label=Debug &History
DebugLastAction.label=&Debug Last Launched
DebugLaunchGroup.label=De&bug
@@ -69,7 +70,7 @@ DebugModelPresentationExtensionName=Debug Model Presentation
LaunchConfigurationTabsExtension.name=Launch Configuration Tabs
DebugPerspective.name=Debug
-DebugPerspective.description=This Debug perspective is designed to support application debugging. It incorporates views for displaying the debug stack, variables and breakpoint management.
+DebugPerspective.description=This Debug perspective supports application debugging by providing views for displaying the debug stack, variables and breakpoints.
command.openDebugPerspective.description = Open the debug perspective
DebugPreferencePage.name=Run/Debug
@@ -80,6 +81,7 @@ DetailPaneFontDefinition.label=Detail pane text font
DetailPaneFontDefinition.description=The detail pane text font is used in the detail panes of debug views.
DetailPaneFactoriesExtension.name=Detail Pane Factories
DisableBreakpointsAction.label=&Disable
+DisableAllBreakpointsAction.label=Disa&ble All
EnableBreakpointsAction.label=&Enable
ExpandAll.label=Expand All
ExpandAll.tooltip=Expand All
@@ -116,10 +118,13 @@ RemoveAllBreakpointsAction.tooltip=Remove All Breakpoints
RemoveAllExpressionsAction.tooltip=Remove All Expressions
RemoveAllTerminatedAction.label=Remove &All Terminated
RemoveAllTerminatedAction.tooltip=Remove All Terminated Launches
+CollapseAllAction.label=Collapse All
+CollapseAllAction.tooltip=Collapse All
RemoveBreakpointAction.tooltip=Remove Selected Breakpoints
RemoveExpressionAction.tooltip=Remove Selected Expressions
ResumeAction.label=Resu&me
RunDropDownAction.label=Run
+RunQuickAccess.label=Run
RunMenu.label=&Run
RunLastAction.label=&Run Last Launched
RunLaunchGroup.label=Ru&n
@@ -196,6 +201,9 @@ ActionContext.breakpointsview.description=The breakpoints view context
ActionDefinition.eof.name= EOF
ActionDefinition.eof.description= Send end of file
+ActionDefinition.clear.name=Clear Console
+ActionDefinition.clear.description=Clear Console
+
ActionDefinition.addMemoryBlock.name= Add Memory Block
ActionDefinition.addMemoryBlock.description=Add memory block
@@ -226,6 +234,9 @@ ActionDefinition.terminate.description=Terminate
ActionDefinition.terminateAndRelaunch.name=Terminate and Relaunch
ActionDefinition.terminateAndRelaunch.description=Terminate and Relaunch
+ActionDefinition.terminateAll.name=Terminate/Disconnect All
+ActionDefinition.terminateAll.description=Terminate/Disconnect All
+
ActionDefinition.toggleBreakpoint.name=Toggle Breakpoint
ActionDefinition.toggleBreakpoint.description=Creates or removes a breakpoint
ActionDefinition.toggleLineBreakpoint.name=Toggle Line Breakpoint
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index 980f9bca9..fc82676be 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
- Copyright (c) 2005, 2018 IBM Corporation and others.
+ Copyright (c) 2005, 2021 IBM Corporation and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
@@ -316,7 +316,8 @@
menubarPath="org.eclipse.ui.run/emptyStepGroup"
toolbarPath="org.eclipse.debug.ui.main.toolbar/renderGroup"
style="toggle"
- state="false">
+ state="false"
+ initialEnabled="true">
</action>
<action
id="org.eclipse.debug.ui.actions.DropToFrame"
@@ -325,7 +326,8 @@
icon="$nl$/icons/full/elcl16/drop_to_frame.png"
helpContextId="org.eclipse.debug.ui.drop_to_frame_action_context"
label="%DropToFrame.label"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/renderGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/renderGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.RunToLine"
@@ -336,7 +338,8 @@
icon="$nl$/icons/full/elcl16/runtoline_co.png"
label="%RunToLine.label"
menubarPath="org.eclipse.ui.run/emptyStepGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/emptyStepGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/emptyStepGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.StepReturn"
@@ -348,7 +351,8 @@
helpContextId="step_return_action_context"
label="%StepReturnAction.label"
menubarPath="org.eclipse.ui.run/stepReturnGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/stepReturnGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/stepReturnGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.StepOver"
@@ -360,7 +364,8 @@
helpContextId="step_over_action_context"
label="%StepOverAction.label"
menubarPath="org.eclipse.ui.run/stepOverGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/stepOverGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/stepOverGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.StepInto"
@@ -372,7 +377,8 @@
helpContextId="step_into_action_context"
label="%StepIntoAction.label"
menubarPath="org.eclipse.ui.run/stepIntoGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/stepIntoGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/stepIntoGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.toolbar.Disconnect"
@@ -384,7 +390,8 @@
helpContextId="disconnect_action_context"
label="%Disconnect.label"
menubarPath="org.eclipse.ui.run/stepGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.Terminate"
@@ -396,7 +403,8 @@
helpContextId="terminate_action_context"
label="%TerminateAction.label"
menubarPath="org.eclipse.ui.run/stepGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.Suspend"
@@ -408,7 +416,8 @@
helpContextId="suspend_action_context"
label="%SuspendAction.label"
menubarPath="org.eclipse.ui.run/stepGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"
+ initialEnabled="false">
</action>
<action
id="org.eclipse.debug.ui.actions.Resume"
@@ -420,7 +429,8 @@
helpContextId="resume_action_context"
label="%ResumeAction.label"
menubarPath="org.eclipse.ui.run/stepGroup"
- toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup">
+ toolbarPath="org.eclipse.debug.ui.main.toolbar/threadGroup"
+ initialEnabled="false">
</action>
</actionSet>
<actionSet
@@ -776,6 +786,17 @@
label="%RemoveAllTerminatedAction.label"
tooltip="%RemoveAllTerminatedAction.tooltip">
</action>
+ <action
+ id="org.eclipse.debug.ui.debugview.toolbar.collapseAll"
+ toolbarPath="threadGroup"
+ hoverIcon="$nl$/icons/full/elcl16/collapseall.png"
+ class="org.eclipse.debug.internal.ui.actions.LaunchCollapseAllAction"
+ disabledIcon="$nl$/icons/full/dlcl16/collapseall.png"
+ icon="$nl$/icons/full/elcl16/collapseall.png"
+ helpContextId="collapse_all_action_context"
+ label="%CollapseAllAction.label"
+ tooltip="%CollapseAllAction.tooltip">
+ </action>
</viewContribution>
<!-- Contributions to Breakpoints View Toolbar -->
@@ -1497,6 +1518,14 @@
id="org.eclipse.debug.ui.breakpointsView.toolbar.remove">
</action>
<action
+ label="%DisableAllBreakpointsAction.label"
+ icon="$nl$/icons/full/elcl16/disabled_co.png"
+ helpContextId="disable_breakpoint_action_context"
+ class="org.eclipse.debug.internal.ui.actions.breakpoints.DisableAllBreakpointsAction"
+ menubarPath="breakpointGroup"
+ id="org.eclipse.debug.ui.actions.DisableAllBreakpoint">
+ </action>
+ <action
label="%DisableBreakpointsAction.label"
icon="$nl$/icons/full/elcl16/disabled_co.png"
helpContextId="disable_breakpoint_action_context"
@@ -1889,6 +1918,15 @@ M4 = Platform-specific fourth key
</defaultHandler>
</command>
<command
+ name="%ActionDefinition.terminateAll.name"
+ categoryId="org.eclipse.debug.ui.category.run"
+ description="%ActionDefinition.terminateAll.description"
+ id="org.eclipse.debug.ui.commands.TerminateAll">
+ <defaultHandler
+ class="org.eclipse.debug.internal.ui.commands.actions.TerminateAllHandler">
+ </defaultHandler>
+ </command>
+ <command
name="%ActionDefinition.restart.name"
categoryId="org.eclipse.debug.ui.category.run"
description="%ActionDefinition.restart.description"
@@ -1968,21 +2006,27 @@ M4 = Platform-specific fourth key
categoryId="org.eclipse.debug.ui.category.run"
id="org.eclipse.debug.ui.commands.ToggleMethodBreakpoint">
</command>
-<!-- console -->
+<!-- console -->
<command
name="%ActionDefinition.eof.name"
categoryId="org.eclipse.debug.ui.category.run"
description="%ActionDefinition.eof.description"
id="org.eclipse.debug.ui.commands.eof">
</command>
+ <command
+ name="%ActionDefinition.clear.name"
+ categoryId="org.eclipse.debug.ui.category.run"
+ description="%ActionDefinition.clear.description"
+ id="org.eclipse.debug.ui.commands.console.clear">
+ </command>
<!-- Memory View -->
<command
categoryId="org.eclipse.debug.ui.category.run"
description="%ActionDefinition.addMemoryBlock.description"
id="org.eclipse.debug.ui.commands.addMemoryMonitor"
- name="%ActionDefinition.addMemoryBlock.name"/>
+ name="%ActionDefinition.addMemoryBlock.name"/>
<!-- views -->
-<!-- Perspective -->
+<!-- Perspective -->
<command
name="%DebugPerspective.name"
description="%command.openDebugPerspective.description"
@@ -2299,7 +2343,7 @@ M4 = Platform-specific fourth key
annotationType="org.eclipse.debug.core.breakpoint"
colorPreferenceKey="breakpointIndicationColor"
overviewRulerPreferenceValue="true"
- presentationLayer="3"
+ presentationLayer="7"
label="%BreakpointMarkerPreference.label"
textPreferenceValue="false"
textPreferenceKey="breakpointIndication"
@@ -3282,6 +3326,12 @@ M4 = Platform-specific fourth key
refid="org.eclipse.e4.ui.css.theme.e4_default">
</themeid>
</stylesheet>
+ <stylesheet
+ uri="css/e4-light_debug_prefstyle_system.css">
+ <themeid
+ refid="org.eclipse.e4.ui.css.theme.e4_system">
+ </themeid>
+ </stylesheet>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
@@ -3327,12 +3377,26 @@ M4 = Platform-specific fourth key
point="org.eclipse.ui.quickAccess">
<computer
class="org.eclipse.debug.internal.ui.quickaccess.RunQuickAccessComputer"
- name="%RunDropDownAction.label"/>
+ name="%RunQuickAccess.label"/>
<computer
class="org.eclipse.debug.internal.ui.quickaccess.DebugQuickAccessComputer"
- name="%DebugDropDownAction.label"/>
+ name="%DebugQuickAccess.label"/>
<computer
class="org.eclipse.debug.internal.ui.quickaccess.ProfileQuickAccessComputer"
name="%ProfileDropDownAction.label"/>
</extension>
+ <extension
+ point="org.eclipse.ui.genericeditor.icons">
+ <icon
+ contentType="org.eclipse.debug.core.launch"
+ icon="icons/full/obj16/launchConfiguration.png">
+ </icon>
+ </extension>
+ <extension
+ point="org.eclipse.ui.workbench.texteditor.codeMiningProviders">
+ <codeMiningProvider
+ class="org.eclipse.debug.internal.ui.codemining.DebugValueCodeMiningProvider"
+ id="org.eclipse.debug.ui.codeMiningProvider1">
+ </codeMiningProvider>
+ </extension>
</plugin>
diff --git a/org.eclipse.debug.ui/pom.xml b/org.eclipse.debug.ui/pom.xml
index fb42dfb7b..76c65e5f1 100644
--- a/org.eclipse.debug.ui/pom.xml
+++ b/org.eclipse.debug.ui/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2019 Eclipse Foundation and others.
+ Copyright (c) 2012, 2021 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -15,11 +15,11 @@
<parent>
<artifactId>eclipse.platform.debug</artifactId>
<groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.debug</groupId>
<artifactId>org.eclipse.debug.ui</artifactId>
- <version>3.14.200-SNAPSHOT</version>
+ <version>3.16.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<code.ignoredWarnings>-warn:+resource,-deprecation,unavoidableGenericProblems</code.ignoredWarnings>
diff --git a/org.eclipse.debug.ui/schema/contextViewBindings.exsd b/org.eclipse.debug.ui/schema/contextViewBindings.exsd
index 3b1dbed78..4bddd41ec 100644
--- a/org.eclipse.debug.ui/schema/contextViewBindings.exsd
+++ b/org.eclipse.debug.ui/schema/contextViewBindings.exsd
@@ -1,165 +1,165 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.ui" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.debug.ui" id="contextViewBindings" name="Context View Bindings"/>
- </appInfo>
- <documentation>
- This extension point provides a mechanism for associating a view with a context identifier. When a context is activated by the Debug view, views associated with it (and also views associated with any parent contexts) are opened, closed, or activated. Contributors have the option to override the automatic open and close behavior.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element />
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="contextViewBinding" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="perspective" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="contextViewBinding">
- <complexType>
- <attribute name="contextId" type="string" use="required">
- <annotation>
- <documentation>
- Specifies the context identifier that this binding is for.
- </documentation>
- <appInfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.ui.contexts/context/@id"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="viewId" type="string" use="required">
- <annotation>
- <documentation>
- Specifies the identifier of the view which should be associated with the specified context. When the specified context is enabled, this view will be automatically brought to the front. When elements are selected in the Debug view, contexts associated with those elements (as specified by extensions of the debugModelContextBindings extension point) are automatically enabled.
-Note that this only occurs in perspectives which are specified by the perspective elements, or for which the user has requested &quot;automatic view management&quot; via the preferences.
- </documentation>
- <appInfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.ui.views/view/@id"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="autoOpen" type="boolean">
- <annotation>
- <documentation>
- Specifies whether the view should be automatically opened when the given context is enabled. If unspecified, the value of this attribute is &lt;code&gt;true&lt;/code&gt;. If this attribute is specified &lt;code&gt;false&lt;/code&gt;, the view will not be automatically opened, but it will still be brought to the front if it is open when the given context is enabled. Clients are intended to specify &lt;code&gt;false&lt;/code&gt; to avoid cluttering the perspective with views that are used infrequently.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="autoClose" type="boolean">
- <annotation>
- <documentation>
- Clients are not intended to specify this attribute except in rare cases.
-Specifies whether the view should be automatically closed when the given context is disabled (this occurs when all debug targets that contained the specified context have terminated). When unspecified, the value of this attribute is &lt;code&gt;true&lt;/code&gt;. This attribute should only be specified &lt;code&gt;false&lt;/code&gt; in the unlikely case that a debugging view must remain open even when the user is not debugging.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="perspective">
- <annotation>
- <documentation>
- Specifies a perspective in which the view management will be enabled (since 3.5).
- </documentation>
- </annotation>
- <complexType>
- <attribute name="perspectiveId" type="string">
- <annotation>
- <documentation>
- Identifier of the perspective in which to enable view management.
- </documentation>
- <appInfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.ui.perspectives/perspective/@id"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a context view binding contribution:
-&lt;pre&gt;
-&lt;extension
- point=&quot;org.eclipse.debug.ui.contextViewBindings&quot;&gt;
- &lt;contextViewBinding
- contextId=&quot;com.example.mydebugger.debugging&quot;
- viewId=&quot;com.example.view&quot;
- autoOpen=&quot;true&quot;
- autoClose=&quot;false&quot;&gt;
- &lt;/contextViewBinding&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-In the above example, when a context with the specified identifier is activated by the Debug view, the given view will be automatically opened. When a context which is bound to a different debug model is activated that isn&apos;t associated with the view, the view will not be automatically closed.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiinfo"/>
- </appInfo>
- <documentation>
- Since 3.5 , the &lt;samp&gt;perspective&lt;/samp&gt; element can be used to spectify a perspectives in which to enable view management. A product or the user override this setting, by specifying the &lt;samp&gt;org.eclipse.debug.ui.manage_view_perspectives&lt;/samp&gt; preference with a comma-delimited set of perspective IDs.
- </documentation>
- </annotation>
-
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.ui" id="contextViewBindings" name="Context View Bindings"/>
+ </appInfo>
+ <documentation>
+ This extension point provides a mechanism for associating a view with a context identifier. When a context is activated by the Debug view, views associated with it (and also views associated with any parent contexts) are opened, closed, or activated. Contributors have the option to override the automatic open and close behavior.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="contextViewBinding" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="perspective" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="contextViewBinding">
+ <complexType>
+ <attribute name="contextId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Specifies the context identifier that this binding is for.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.contexts/context/@id"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="viewId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Specifies the identifier of the view which should be associated with the specified context. When the specified context is enabled, this view will be automatically brought to the front. When elements are selected in the Debug view, contexts associated with those elements (as specified by extensions of the debugModelContextBindings extension point) are automatically enabled.
+Note that this only occurs in perspectives which are specified by the perspective elements, or for which the user has requested &quot;automatic view management&quot; via the preferences.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.views/view/@id"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="autoOpen" type="boolean">
+ <annotation>
+ <documentation>
+ Specifies whether the view should be automatically opened when the given context is enabled. If unspecified, the value of this attribute is &lt;code&gt;true&lt;/code&gt;. If this attribute is specified &lt;code&gt;false&lt;/code&gt;, the view will not be automatically opened, but it will still be brought to the front if it is open when the given context is enabled. Clients are intended to specify &lt;code&gt;false&lt;/code&gt; to avoid cluttering the perspective with views that are used infrequently.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="autoClose" type="boolean">
+ <annotation>
+ <documentation>
+ Clients are not intended to specify this attribute except in rare cases.
+Specifies whether the view should be automatically closed when the given context is disabled (this occurs when all debug targets that contained the specified context have terminated). When unspecified, the value of this attribute is &lt;code&gt;true&lt;/code&gt;. This attribute should only be specified &lt;code&gt;false&lt;/code&gt; in the unlikely case that a debugging view must remain open even when the user is not debugging.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="perspective">
+ <annotation>
+ <documentation>
+ Specifies a perspective in which the view management will be enabled (since 3.5).
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="perspectiveId" type="string">
+ <annotation>
+ <documentation>
+ Identifier of the perspective in which to enable view management.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.perspectives/perspective/@id"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a context view binding contribution:
+&lt;pre&gt;
+&lt;extension
+ point=&quot;org.eclipse.debug.ui.contextViewBindings&quot;&gt;
+ &lt;contextViewBinding
+ contextId=&quot;com.example.mydebugger.debugging&quot;
+ viewId=&quot;com.example.view&quot;
+ autoOpen=&quot;true&quot;
+ autoClose=&quot;false&quot;&gt;
+ &lt;/contextViewBinding&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+In the above example, when a context with the specified identifier is activated by the Debug view, the given view will be automatically opened. When a context which is bound to a different debug model is activated that isn&apos;t associated with the view, the view will not be automatically closed.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ Since 3.5 , the &lt;samp&gt;perspective&lt;/samp&gt; element can be used to spectify a perspectives in which to enable view management. A product or the user override this setting, by specifying the &lt;samp&gt;org.eclipse.debug.ui.manage_view_perspectives&lt;/samp&gt; preference with a comma-delimited set of perspective IDs.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.debug.ui/schema/debugModelContextBindings.exsd b/org.eclipse.debug.ui/schema/debugModelContextBindings.exsd
index 553c99a5d..ce51c8b8d 100644
--- a/org.eclipse.debug.ui/schema/debugModelContextBindings.exsd
+++ b/org.eclipse.debug.ui/schema/debugModelContextBindings.exsd
@@ -1,112 +1,112 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.ui" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.debug.ui" id="debugModelContextBindings" name="Debug Model Context Bindings"/>
- </appinfo>
- <documentation>
- This extension point provides a mechanism for specifying a context that should be associated with the given debug model.
-
-The Debug view uses these bindings to automatically enable contexts. When an element in the Debug view which provides an &lt;code&gt;IDebugModelProvider&lt;/code&gt; adapter or a stack frame with the specified debug model identifier is selected, the context with the given identifier will be enabled.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="modelContextBinding" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="modelContextBinding">
- <complexType>
- <attribute name="debugModelId" type="string" use="required">
- <annotation>
- <documentation>
- specifies the debug model identifier this binding is for
- </documentation>
- </annotation>
- </attribute>
- <attribute name="contextId" type="string" use="required">
- <annotation>
- <documentation>
- specifies the context identifier of the context that should be associated with the given debug model
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.ui.contexts/context/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- The following is an example of a debug model context binding contribution:
-&lt;pre&gt;
-&lt;extension
- point=&quot;org.eclipse.debug.ui.debugModelContextBindings&quot;&gt;
- &lt;modelContextBinding
- contextId=&quot;com.example.myLanguage.debugging&quot;
- debugModelId=&quot;com.example.myLanguageDebugModel&quot;&gt;
- &lt;/modelContextBinding&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-In the above example, when a stack frame with the debug model identifier of &quot;com.example.myLanguageDebugModel&quot; is selected, the context with the identifier &quot;com.example.myLanguage.debugging&quot; will be enabled.
- </documentation>
- </annotation>
-
-
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.debug.ui" id="debugModelContextBindings" name="Debug Model Context Bindings"/>
+ </appinfo>
+ <documentation>
+ This extension point provides a mechanism for specifying a context that should be associated with the given debug model.
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+The Debug view uses these bindings to automatically enable contexts. When an element in the Debug view which provides an &lt;code&gt;IDebugModelProvider&lt;/code&gt; adapter or a stack frame with the specified debug model identifier is selected, the context with the given identifier will be enabled.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="modelContextBinding" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="modelContextBinding">
+ <complexType>
+ <attribute name="debugModelId" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the debug model identifier this binding is for
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="contextId" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the context identifier of the context that should be associated with the given debug model
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.contexts/context/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ The following is an example of a debug model context binding contribution:
+&lt;pre&gt;
+&lt;extension
+ point=&quot;org.eclipse.debug.ui.debugModelContextBindings&quot;&gt;
+ &lt;modelContextBinding
+ contextId=&quot;com.example.myLanguage.debugging&quot;
+ debugModelId=&quot;com.example.myLanguageDebugModel&quot;&gt;
+ &lt;/modelContextBinding&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+In the above example, when a stack frame with the debug model identifier of &quot;com.example.myLanguageDebugModel&quot; is selected, the context with the identifier &quot;com.example.myLanguage.debugging&quot; will be enabled.
+ </documentation>
+ </annotation>
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.debug.ui/schema/variableValueEditors.exsd b/org.eclipse.debug.ui/schema/variableValueEditors.exsd
index f6e25e0c2..77d8b014d 100644
--- a/org.eclipse.debug.ui/schema/variableValueEditors.exsd
+++ b/org.eclipse.debug.ui/schema/variableValueEditors.exsd
@@ -1,116 +1,129 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.ui" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.debug.ui" id="variableValueEditors" name="Variable Value Editors"/>
- </appinfo>
- <documentation>
- This extension point provides a mechanism for contributing variable value editors for a particular debug model. Variable value editors are used to edit/save variable values. When the user invokes the &quot;Change Value...&quot; or &quot;Assign Value&quot; (details pane) actions on a variable in the Variables view, the contributed &lt;code&gt;org.eclipse.debug.ui.actions.IVariableValueEditor&lt;/code&gt; will be invoked to change the value.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="variableValueEditor"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="variableValueEditor">
- <complexType>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- Implementation of &lt;code&gt;org.eclipse.debug.ui.actions.IVariableValueEditor&lt;/code&gt;
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.debug.ui.actions.IVariableValueEditor"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="modelId" type="string" use="required">
- <annotation>
- <documentation>
- The debug model identifier for which the given variable value editor is applicable.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 3.1
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- &lt;pre&gt;
- &lt;extension
- point=&quot;org.eclipse.debug.ui.variableValueEditors&quot;&gt;
- &lt;variableEditor
- modelId=&quot;com.examples.myDebugModel&quot;
- class=&quot;com.examples.variables.MyVariableValueEditor&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiInfo"/>
- </appinfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.ui.actions.IVariableValueEditor&lt;/b&gt;.
- </documentation>
- </annotation>
-
-
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.ui" id="variableValueEditors" name="Variable Value Editors"/>
+ </appInfo>
+ <documentation>
+ This extension point provides a mechanism for contributing variable value editors for a particular debug model. Variable value editors are used to edit/save variable values. When the user invokes the &quot;Change Value...&quot; or &quot;Assign Value&quot; (details pane) actions on a variable in the Variables view, the contributed &lt;code&gt;org.eclipse.debug.ui.actions.IVariableValueEditor&lt;/code&gt; will be invoked to change the value.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="variableValueEditor" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="variableValueEditor">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Implementation of &lt;code&gt;org.eclipse.debug.ui.actions.IVariableValueEditor&lt;/code&gt;
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.debug.ui.actions.IVariableValueEditor"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="modelId" type="string" use="required">
+ <annotation>
+ <documentation>
+ The debug model identifier for which the given variable value editor is applicable.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string">
+ <annotation>
+ <documentation>
+ Optional integer number 0 to 10 describing priority of this extension, with 0 being the lowest priority.
+If values outside of [0,10] range are specified, they are replaced with appropriate limits, any non integer values are ignored and zero (lowest priority) is used.
+If multiple contributions have the same priority, an arbitrary contribution among them will be selected.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;pre&gt;
+ &lt;extension
+ point=&quot;org.eclipse.debug.ui.variableValueEditors&quot;&gt;
+ &lt;variableEditor
+ modelId=&quot;com.examples.myDebugModel&quot;
+ class=&quot;com.examples.variables.MyVariableValueEditor&quot;/&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.ui.actions.IVariableValueEditor&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
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 7f234f4e6..084aa4863 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
@@ -14,12 +14,8 @@
package org.eclipse.debug.internal.ui;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
@@ -57,18 +53,10 @@ public abstract class AbstractDebugListSelectionDialog extends AbstractDebugSele
@Override
protected void addViewerListeners(StructuredViewer viewer) {
- viewer.addSelectionChangedListener(new ISelectionChangedListener(){
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- getButton(IDialogConstants.OK_ID).setEnabled(isValid());
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener(){
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (isValid()){
- okPressed();
- }
+ viewer.addSelectionChangedListener(event -> getButton(IDialogConstants.OK_ID).setEnabled(isValid()));
+ viewer.addDoubleClickListener(event -> {
+ if (isValid()){
+ 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 14af78526..d05207114 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
@@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
+import org.osgi.framework.FrameworkUtil;
/**
* This class provides the framework for a general selection dialog class.
@@ -88,7 +89,7 @@ public abstract class AbstractDebugSelectionDialog extends SelectionDialog {
*/
protected IContentProvider getContentProvider() {
//by default return a simple array content provider
- return new ArrayContentProvider();
+ return ArrayContentProvider.getInstance();
}
/**
@@ -202,7 +203,9 @@ public abstract class AbstractDebugSelectionDialog extends SelectionDialog {
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(AbstractDebugSelectionDialog.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(getDialogSettingsId());
if (section == null) {
section = settings.addNewSection(getDialogSettingsId());
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 f8961d034..df143e554 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
@@ -67,9 +67,8 @@ public class DebugModelPropertyTester extends PropertyTester {
getAdapter(receiver, IDebugModelProvider.class);
}
if (modelProvider != null) {
- String[] ids = modelProvider.getModelIdentifiers();
- for (int i = 0; i < ids.length; i++) {
- if (ids[i].equals(expectedValue)) {
+ for (String id : modelProvider.getModelIdentifiers()) {
+ if (id.equals(expectedValue)) {
return true;
}
}
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 15048895a..a7ca3d11f 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
@@ -20,8 +20,6 @@
package org.eclipse.debug.internal.ui;
-import java.net.URL;
-
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -33,6 +31,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
/**
* The images provided by the debug plugin.
@@ -271,8 +270,7 @@ public class DebugPluginImages {
//try to get the images from the config types themselves, cache those that could not be found
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPE_IMAGES);
IConfigurationElement[] configElements= extensionPoint.getConfigurationElements();
- for (int i = 0; i < configElements.length; i++) {
- IConfigurationElement configElement = configElements[i];
+ for (IConfigurationElement configElement : configElements) {
ImageDescriptor descriptor = DebugUIPlugin.getImageDescriptor(configElement, ATTR_LAUNCH_CONFIG_TYPE_ICON);
if (descriptor == null) {
descriptor = ImageDescriptor.getMissingImageDescriptor();
@@ -293,16 +291,13 @@ public class DebugPluginImages {
* this plugin class is found (i.e. typically the packages directory)
*/
private final static void declareRegistryImage(String key, String path) {
- ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
- Bundle bundle = Platform.getBundle(DebugUIPlugin.getUniqueIdentifier());
- URL url = null;
- if (bundle != null){
- url = FileLocator.find(bundle, new Path(path), null);
- if(url != null) {
- desc = ImageDescriptor.createFromURL(url);
- }
+ Bundle bundle = FrameworkUtil.getBundle(DebugPluginImages.class);
+ if (bundle == null) {
+ imageRegistry.put(key, ImageDescriptor.getMissingImageDescriptor());
+ } else {
+ imageRegistry.put(key,
+ ImageDescriptor.createFromURLSupplier(true, () -> FileLocator.find(bundle, new Path(path), null)));
}
- imageRegistry.put(key, desc);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
index d051113f7..8277e8368 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
@@ -168,7 +168,7 @@ CodePagesPrefDialog_0=The codepage is not supported.
##############################################################
MemoryView_Memory_monitors=Monitors
MemoryBlocksTreeViewPane_0=Remove All Memory Monitors
-MemoryBlocksTreeViewPane_1=Are you sure you want to remove all memory monitors?
+MemoryBlocksTreeViewPane_1=Remove all memory monitors?
MemoryBlocksTreeViewPane_2=Remove All
MemoryView_Memory_renderings=Renderings
MemoryViewContentProvider_Unable_to_retrieve_content = Unable to retrieve content.
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 d6910cfa9..d0ea7f219 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
@@ -20,6 +20,7 @@ package org.eclipse.debug.internal.ui;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set;
@@ -116,8 +117,6 @@ import org.osgi.framework.BundleContext;
import org.osgi.service.prefs.BackingStoreException;
import org.w3c.dom.Document;
-import com.ibm.icu.text.MessageFormat;
-
/**
* The Debug UI Plug-in.
*
@@ -143,6 +142,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
public static boolean DEBUG_STATE_SAVE_RESTORE = false;
public static String DEBUG_PRESENTATION_ID = null;
public static boolean DEBUG_DYNAMIC_LOADING = false;
+ public static boolean DEBUG_COMMAND_SERVICE = false;
static final String DEBUG_FLAG = "org.eclipse.debug.ui/debug"; //$NON-NLS-1$
static final String DEBUG_BREAKPOINT_DELTAS_FLAG = "org.eclipse.debug.ui/debug/viewers/breakpointDeltas"; //$NON-NLS-1$
@@ -156,6 +156,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
static final String DEBUG_STATE_SAVE_RESTORE_FLAG = "org.eclipse.debug.ui/debug/viewers/stateSaveRestore"; //$NON-NLS-1$
static final String DEBUG_PRESENTATION_ID_FLAG ="org.eclipse.debug.ui/debug/viewers/presentationId"; //$NON-NLS-1$
static final String DEBUG_DYNAMIC_LOADING_FLAG = "org.eclipse.debug.ui/debug/memory/dynamicLoading"; //$NON-NLS-1$
+ static final String DEBUG_COMMAND_SERVICE_FLAG = "org.eclipse.debug.ui/debug/commandservice"; //$NON-NLS-1$
/**
* The {@link DebugTrace} object to print to OSGi tracing
* @since 3.8
@@ -261,16 +262,18 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
}
/**
- * Prints the given message to System.out and to the OSGi tracing (if started)
- * @param option the option or <code>null</code>
- * @param message the message to print or <code>null</code>
+ * Prints the given message to System.out or to the OSGi tracing (if started)
+ *
+ * @param option the option or <code>null</code>
+ * @param message the message to print or <code>null</code>
* @param throwable the {@link Throwable} or <code>null</code>
* @since 3.8
*/
public static void trace(String option, String message, Throwable throwable) {
- System.out.println(message);
if(fgDebugTrace != null) {
fgDebugTrace.trace(option, message, throwable);
+ } else {
+ System.out.println(message);
}
}
@@ -347,7 +350,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
* @return the currently active workbench window or <code>null</code>
*/
public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
/**
@@ -596,6 +599,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
DEBUG_DELTAS = DEBUG && options.getBooleanOption(DEBUG_DELTAS_FLAG, false);
DEBUG_STATE_SAVE_RESTORE = DEBUG && options.getBooleanOption(DEBUG_STATE_SAVE_RESTORE_FLAG, false);
DEBUG_DYNAMIC_LOADING = DEBUG && options.getBooleanOption(DEBUG_DYNAMIC_LOADING_FLAG, false);
+ DEBUG_COMMAND_SERVICE = DEBUG && options.getBooleanOption(DEBUG_COMMAND_SERVICE_FLAG, false);
if(DEBUG) {
DEBUG_PRESENTATION_ID = options.getOption(DEBUG_PRESENTATION_ID_FLAG, IInternalDebugCoreConstants.EMPTY_STRING);
if(IInternalDebugCoreConstants.EMPTY_STRING.equals(DEBUG_PRESENTATION_ID)) {
@@ -1335,22 +1339,22 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
* @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) {
- URL iconURL = FileLocator.find(bundle , new Path(iconPath), null);
- if (iconURL != null) {
- return ImageDescriptor.createFromURL(iconURL);
- } else { // try to search as a URL in case it is absolute path
- try {
- iconURL = FileLocator.find(new URL(iconPath));
- if (iconURL != null) {
- return ImageDescriptor.createFromURL(iconURL);
+ Bundle bundle = Platform.getBundle(element.getContributor().getName());
+ return ImageDescriptor.createFromURLSupplier(true, () -> {
+ URL iconURL = FileLocator.find(bundle, new Path(iconPath), null);
+ if (iconURL != null) {
+ return iconURL;
+ } else { // try to search as a URL in case it is absolute path
+ try {
+ return FileLocator.find(new URL(iconPath));
+ } catch (MalformedURLException e) {
+ // return null
}
- } catch (MalformedURLException e) {
- // return null
}
- }
+ return null;
+ });
}
return null;
}
@@ -1359,18 +1363,15 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
* 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 bundleName 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);
+ public static ImageDescriptor getImageDescriptor(String bundleName, String path) {
if (path != null) {
- URL iconURL = FileLocator.find(bundle , new Path(path), null);
- if (iconURL != null) {
- return ImageDescriptor.createFromURL(iconURL);
- }
+ Bundle bundle = Platform.getBundle(bundleName);
+ return ImageDescriptor.createFromURLSupplier(true, () -> FileLocator.find(bundle, new Path(path), null));
}
return null;
}
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 955bda6f4..a1aa41a22 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -54,6 +54,7 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS, true);
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, true);
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, true);
+ prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS, true);
/**
* Context launching preferences. Appear on the the Launching preference page
@@ -80,6 +81,8 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
prefs.setDefault(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK, 80000);
prefs.setDefault(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK, 100000);
prefs.setDefault(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH, 8);
+ prefs.setDefault(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS, false);
+ prefs.setDefault(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER, true);
// console colors
setThemeBasedPreferences(prefs, false);
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 9254cd8b2..940782fa5 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
@@ -16,6 +16,7 @@
package org.eclipse.debug.internal.ui;
+import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
@@ -57,8 +58,6 @@ import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.model.IWorkbenchAdapter;
-import com.ibm.icu.text.MessageFormat;
-
public class DefaultLabelProvider implements ILabelProvider {
/**
@@ -259,7 +258,7 @@ public class DefaultLabelProvider implements ILabelProvider {
if (element instanceof IProcess) {
IProcess process = (IProcess)element;
int exit = process.getExitValue();
- terminatedMessage = MessageFormat.format(DebugUIMessages.DefaultLabelProvider_16, new Object[] { Integer.valueOf(exit).toString() });
+ terminatedMessage = MessageFormat.format(DebugUIMessages.DefaultLabelProvider_16, new Object[] { Integer.toString(exit) });
} else {
terminatedMessage= DebugUIMessages.DefaultLabelProvider_1;
}
@@ -366,7 +365,7 @@ public class DefaultLabelProvider implements ILabelProvider {
} else {
snippetBuffer.append(snippet);
}
- snippet = snippetBuffer.toString().replaceAll("[\n\r\t]+", " "); //$NON-NLS-1$//$NON-NLS-2$
+ snippet = snippetBuffer.toString().replace("[\n\r\t]+", " "); //$NON-NLS-1$//$NON-NLS-2$
result.append('"');
result.append(snippet);
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 20694eba4..843e2e0d1 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
@@ -93,11 +93,9 @@ public class DelegatingModelPresentation implements IDebugModelPresentation, IDe
IExtensionPoint point= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.ID_DEBUG_MODEL_PRESENTATION);
if (point != null) {
IExtension[] extensions= point.getExtensions();
- for (int i= 0; i < extensions.length; i++) {
- IExtension extension= extensions[i];
+ for (IExtension extension : extensions) {
IConfigurationElement[] configElements= extension.getConfigurationElements();
- for (int j= 0; j < configElements.length; j++) {
- IConfigurationElement elt= configElements[j];
+ for (IConfigurationElement elt : configElements) {
String id= elt.getAttribute("id"); //$NON-NLS-1$
if (id != null) {
IDebugModelPresentation lp= new LazyModelPresentation(this, elt);
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 d1d2216c4..56b7a8b67 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
@@ -137,6 +137,7 @@ public interface IDebugHelpContextIds {
// Property pages
String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
String PROCESS_PAGE_RUN_AT = PREFIX + "process_page_run_at_time_widget"; //$NON-NLS-1$
+ String PROCESS_PAGE_TERMINATE_AT = PREFIX + "process_page_terminate_at_time_widget"; //$NON-NLS-1$
String RUN_DEBUG_RESOURCE_PROPERTY_PAGE = PREFIX + "run_debug_resource_property_page"; //$NON-NLS-1$
// Launch configuration dialog pages
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 f5d1db073..42b1aab4e 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
@@ -92,8 +92,10 @@ public class InstructionPointerManager{
* specified stack frame.
*/
public void addAnnotation(ITextEditor textEditor, IStackFrame frame, Annotation annotation) {
-
IDocumentProvider docProvider = textEditor.getDocumentProvider();
+ if (docProvider == null) {
+ return;
+ }
IEditorInput editorInput = textEditor.getEditorInput();
// If there is no annotation model, there's nothing more to do
IAnnotationModel annModel = docProvider.getAnnotationModel(editorInput);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java
index 999b26f0e..bd36ba173 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java
@@ -110,8 +110,8 @@ public final class LaunchConfigurationTabExtension {
fDelegates = new HashSet<>();
IConfigurationElement[] children = fElement.getChildren(IConfigurationElementConstants.ASSOCIATED_DELEGATE);
String id = null;
- for(int i = 0; i < children.length; i++) {
- id = children[i].getAttribute(IConfigurationElementConstants.DELEGATE);
+ for (IConfigurationElement child : children) {
+ id = child.getAttribute(IConfigurationElementConstants.DELEGATE);
if(id != null) {
fDelegates.add(id);
}
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 c9e2932f4..e3fd25878 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
@@ -25,12 +25,8 @@ import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -151,12 +147,7 @@ public class MultipleInputDialog extends Dialog {
return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
}
});
- text.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateFields();
- }
- });
+ text.addModifyListener(e -> validateFields());
}
controlList.add(text);
@@ -195,12 +186,7 @@ public class MultipleInputDialog extends Dialog {
}
});
- text.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateFields();
- }
- });
+ text.addModifyListener(e -> validateFields());
}
Button button = createButton(comp, IDialogConstants.IGNORE_ID, DebugUIMessages.MultipleInputDialog_6, false);
@@ -262,12 +248,7 @@ public class MultipleInputDialog extends Dialog {
}
});
- text.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateFields();
- }
- });
+ text.addModifyListener(e -> validateFields());
}
Button button = createButton(comp, IDialogConstants.IGNORE_ID, DebugUIMessages.MultipleInputDialog_8, false);
@@ -304,12 +285,9 @@ public class MultipleInputDialog extends Dialog {
text.setLayoutData(gd);
text.setData(FIELD_NAME, labelText);
- text.addTraverseListener(new TraverseListener () {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if(e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.SHIFT) {
- e.doit = true;
- }
+ text.addTraverseListener(e -> {
+ if(e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.SHIFT) {
+ e.doit = true;
}
});
@@ -328,12 +306,7 @@ public class MultipleInputDialog extends Dialog {
}
});
- text.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateFields();
- }
- });
+ text.addModifyListener(e -> validateFields());
}
Composite comp = SWTFactory.createComposite(panel, panel.getFont(), 1, 2, GridData.HORIZONTAL_ALIGN_END);
GridLayout ld = (GridLayout)comp.getLayout();
@@ -392,7 +365,7 @@ public class MultipleInputDialog extends Dialog {
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
- protected class FieldSummary {
+ protected static class FieldSummary {
int type;
String name;
String initialValue;
@@ -406,7 +379,7 @@ public class MultipleInputDialog extends Dialog {
}
}
- protected class Validator {
+ protected static class Validator {
boolean validate() {
return true;
}
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 4266ff096..80fa4dd19 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,6 +33,14 @@ import org.eclipse.debug.ui.actions.IVariableValueEditor;
*/
public class VariableValueEditorManager {
+ private static final int MAX_PRIORITY = 10;
+
+ private static final int DEFAULT_PRIORITY = 0;
+
+ private static final String MODEL_ID = "modelId"; //$NON-NLS-1$
+
+ private static final String PRIORITY = "priority";//$NON-NLS-1$
+
/**
* Mapping of debug model identifiers to variable value editors.
* The keys in this map are always Strings (model ids).
@@ -100,12 +108,40 @@ public class VariableValueEditorManager {
private void loadVariableEditors() {
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$
+ for (IConfigurationElement element : elements) {
+ String modelId = element.getAttribute(MODEL_ID);
if (modelId != null) {
- fEditorMap.put(modelId, element);
+ Object original = fEditorMap.put(modelId, element);
+ // Check if the original contribution had higher priority
+ if (original instanceof IConfigurationElement) {
+ int newPrio = getPriority(element);
+ int oldPrio = getPriority((IConfigurationElement) original);
+ if (oldPrio > newPrio) {
+ // restore
+ fEditorMap.put(modelId, original);
+ }
+ }
+ }
+ }
+ }
+
+ private static int getPriority(IConfigurationElement element) {
+ String attribute = element.getAttribute(PRIORITY);
+ int priority = DEFAULT_PRIORITY;
+ if (attribute != null) {
+ try {
+ priority = Integer.parseInt(attribute);
+ } catch (Exception e) {
+ String error = "Unexpected value: '" + attribute + //$NON-NLS-1$
+ "' for '" + PRIORITY + "' attribute " //$NON-NLS-1$//$NON-NLS-2$
+ + " in extension point '" + IDebugUIConstants.EXTENSION_POINT_VARIABLE_VALUE_EDITORS //$NON-NLS-1$
+ + "' was specified by " + element.getNamespaceIdentifier(); //$NON-NLS-1$
+ IllegalArgumentException ie = new IllegalArgumentException(error, e);
+ DebugUIPlugin.log(ie);
}
+ priority = Math.max(DEFAULT_PRIORITY, priority);
+ priority = Math.min(MAX_PRIORITY, priority);
}
+ return priority;
}
}
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 59d220b26..2d6a11922 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -113,6 +113,10 @@ public class ActionMessages extends NLS {
public static String RemoveAllTriggerPointsAction_0;
public static String RemoveAllTriggerPointsAction_1;
+ public static String DisableAllBreakPointsAction_0;
+ public static String DisableAllBreakPointsAction_1;
+ public static String DisableAllBreakPointsAction_2;
+
public static String DeleteBreakpointOperationName;
public static String DeleteBreakpointsOperationName;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
index 798fd3ad6..3a8838071 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2017 IBM Corporation and others.
+# Copyright (c) 2000, 2020 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -47,12 +47,12 @@ RelaunchActionDelegate_An_exception_occurred_while_launching_2=An exception occu
RelaunchActionDelegate_Launch_Failed_1=Launch Failed
RemoveAllBreakpointsAction_0=Remove All Breakpoints
-RemoveAllBreakpointsAction_1=Are you sure you want to remove all breakpoints?
+RemoveAllBreakpointsAction_1=Remove all breakpoints?
RemoveAllBreakpointsAction_2=Remove Breakpoints
RemoveAllBreakpointsAction_3=&Do not ask me again.
RemoveAllBreakpointsAction_4=&Remove
RemoveAllExpressionsAction_0=Remove All Expressions
-RemoveAllExpressionsAction_1=Are you sure you want to remove all expressions?
+RemoveAllExpressionsAction_1=Remove all expressions?
RemoveBreakpointAction_0=Delete Breakpoints
RemoveBreakpointAction_1=Delete all breakpoints in the selected group(s)?
@@ -65,7 +65,12 @@ RemoveBreakpointAction_Exceptions_occurred_attempting_to_remove_a_breakpoint__5=
RemoveBreakpointAction_Removing_a_breakpoint_4=Removing a breakpoint
RemoveAllTriggerPointsAction_0=Remove All Triggerpoints
-RemoveAllTriggerPointsAction_1=Are you sure you want to remove all triggerpoints?
+RemoveAllTriggerPointsAction_1=Remove all triggerpoints?
+
+DisableAllBreakPointsAction_0=Disable All Breakpoints
+DisableAllBreakPointsAction_1=Disable All Breakpoints?
+DisableAllBreakPointsAction_2=&Do not ask me again.
+
DeleteBreakpointOperationName=Delete Breakpoint
DeleteBreakpointsOperationName=Delete Breakpoints
@@ -189,7 +194,7 @@ StepIntoAction_3=Step Into
StepOverAction_0=Step &Over
StepOverAction_3=Step Over
LaunchAction_0=Remove Configuration
-LaunchAction_1=Are you sure you want to remove {0} from the launch history?
+LaunchAction_1=Remove {0} from the launch history?
LaunchAction_2=&Do not ask me again.
RestartCommandAction__text=Rest&art
RestartCommandAction_tooltip=Restart
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 74483bf22..48afd124c 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
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.actions;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -36,8 +37,6 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.SelectionListenerAction;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Adds the selected launch configuration to the launch favorites.
*/
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java
index c2c58f5f0..5157a0079 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ConfigureColumnsAction.java
@@ -43,7 +43,7 @@ public class ConfigureColumnsAction extends Action implements IUpdate {
private TreeModelViewer fViewer;
- class ColumnContentProvider implements IStructuredContentProvider {
+ static class ColumnContentProvider implements IStructuredContentProvider {
@Override
public Object[] getElements(Object inputElement) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java
index a1888b286..52f26e44b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.internal.ui.actions;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugPlugin;
@@ -32,8 +34,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.SelectionListenerAction;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Opens the launch configuration dialog on a single launch configuration, based
* on the the launch associated with the selected element.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java
new file mode 100644
index 000000000..fcd2067a4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchCollapseAllAction.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2019 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
+import org.eclipse.debug.internal.ui.views.launch.LaunchView;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.handlers.CollapseAllHandler;
+
+/**
+ * CollapseAllAction for Debug Launch view
+ */
+public class LaunchCollapseAllAction extends AbstractRemoveAllActionDelegate implements ILaunchesListener2 {
+
+ private IViewPart fView;
+ private TreeModelViewer fViewer;
+
+ @Override
+ public void init(IViewPart view) {
+ fView = view;
+ LaunchView debugView = getView().getAdapter(LaunchView.class);
+ if (debugView != null) {
+ debugView.setAction(getActionId(), getAction());
+ }
+ Viewer viewer = ((LaunchView) getView()).getViewer();
+ if (viewer instanceof TreeModelViewer) {
+ fViewer = (TreeModelViewer) viewer;
+ }
+ super.init(view);
+ }
+
+ private IViewPart getView() {
+ return fView;
+ }
+
+ private String getActionId() {
+ return CollapseAllHandler.COMMAND_ID;
+ }
+
+
+ @Override
+ public void run(IAction action) {
+ if (!(getView() instanceof LaunchView)) {
+ return;
+ }
+ if (fViewer != null) {
+ try {
+ fViewer.getControl().setRedraw(false);
+ fViewer.collapseAll();
+ } finally {
+ fViewer.getControl().setRedraw(true);
+ }
+ }
+ }
+
+ @Override
+ protected void initialize() {
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
+ }
+
+ @Override
+ protected boolean isEnabled() {
+ if (!(getView() instanceof LaunchView)) {
+ return false;
+ }
+ if (fViewer != null && fViewer.getInput() != null) {
+ ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
+ if (launches != null && launches.length > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ update();
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ update();
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ // nothing to do
+ }
+
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ // nothing to do
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
index 5148aa442..e070a9f3d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
@@ -24,8 +26,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
-import com.ibm.icu.text.MessageFormat;
-
/**
* This class provides an action wrapper for adding launch configuration actions to the context menu
* of the Run->... menu item
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java
index 474ee7b18..6f0b8fc3b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/RemoveAllTerminatedAction.java
@@ -33,8 +33,8 @@ public class RemoveAllTerminatedAction extends AbstractRemoveAllActionDelegate i
protected boolean isEnabled() {
ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
if (launches != null) {
- for (int i= 0; i < launches.length; i++) {
- if (launches[i].isTerminated()) {
+ for (ILaunch launch : launches) {
+ if (launch.isTerminated()) {
return true;
}
}
@@ -44,8 +44,7 @@ public class RemoveAllTerminatedAction extends AbstractRemoveAllActionDelegate i
public static void removeTerminatedLaunches(ILaunch[] elements) {
List<ILaunch> removed = new ArrayList<>();
- for (int i = 0; i < elements.length; i++) {
- ILaunch launch = elements[i];
+ for (ILaunch launch : elements) {
if (launch.isTerminated()) {
removed.add(launch);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java
index 7fa406c38..75b3ccf3c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/SelectAllAction.java
@@ -46,8 +46,7 @@ public abstract class SelectAllAction extends AbstractRemoveAllActionDelegate {
protected abstract String getActionId();
private void collectExpandedAndVisible(TreeItem[] items, List<TreeItem> result) {
- for (int i= 0; i < items.length; i++) {
- TreeItem item= items[i];
+ for (TreeItem item : items) {
result.add(item);
if (item.getExpanded()) {
collectExpandedAndVisible(item.getItems(), result);
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 6c9509d95..d316c5382 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
@@ -459,14 +459,13 @@ public class ToggleBreakpointsTargetManager implements IToggleBreakpointsTargetM
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);
+ for (IConfigurationElement element : ep.getConfigurationElements()) {
+ String id = element.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]));
+ fKnownFactories.put(id, new ToggleTargetFactory(element));
}
} 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$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java
index e4e33b59b..1049fedb9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ToggleFilterAction.java
@@ -52,8 +52,7 @@ public abstract class ToggleFilterAction extends Action {
ViewerFilter filter = getViewerFilter();
ViewerFilter[] filters = getViewer().getFilters();
boolean alreadyAdded = false;
- for (int i = 0; i < filters.length; i++) {
- ViewerFilter addedFilter = filters[i];
+ for (ViewerFilter addedFilter : filters) {
if (addedFilter.equals(filter)) {
alreadyAdded = true;
break;
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 cf304ff3a..1d1b1d1fe 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
@@ -61,9 +61,8 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
@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();
+ for (MenuItem item : m.getItems()) {
+ item.dispose();
}
fillMenu(m);
}
@@ -121,9 +120,7 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
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];
+ for (IBreakpointOrganizer organizer : BreakpointOrganizerManager.getDefault().getOrganizers()) {
IAction action = new GroupBreakpointsAction(organizer, fView);
addAccel(accel, action, organizer.getLabel());
accel++;
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 5635b98fe..49df424dc 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
@@ -27,15 +27,11 @@ import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -148,13 +144,13 @@ public class GroupBreakpointsByDialog extends TrayDialog {
*/
private void initializeContent() {
IBreakpointOrganizer[] organizers= BreakpointOrganizerManager.getDefault().getOrganizers();
- for (int i = 0; i < organizers.length; i++) {
- fAvailableOrganizersProvider.addAvailable(organizers[i]);
+ for (IBreakpointOrganizer organizer : organizers) {
+ fAvailableOrganizersProvider.addAvailable(organizer);
}
organizers = fView.getBreakpointOrganizers();
if (organizers != null) {
- for (int i = 0; i < organizers.length; i++) {
- fSelectedOrganizersProvider.addSelected(organizers[i]);
+ for (IBreakpointOrganizer organizer : organizers) {
+ fSelectedOrganizersProvider.addSelected(organizer);
}
}
}
@@ -186,18 +182,8 @@ public class GroupBreakpointsByDialog extends TrayDialog {
Table table = fAvailableViewer.getTable();
table.setLayoutData(new GridData(GridData.FILL_BOTH));
table.setFont(parent.getFont());
- fAvailableViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- handleAddPressed();
- }
- });
- fAvailableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateAddButton();
- }
- });
+ fAvailableViewer.addDoubleClickListener(event -> handleAddPressed());
+ fAvailableViewer.addSelectionChangedListener(event -> updateAddButton());
}
/**
@@ -229,18 +215,8 @@ public class GroupBreakpointsByDialog extends TrayDialog {
Tree tree = fSelectedViewer.getTree();
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
tree.setFont(parent.getFont());
- fSelectedViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- handleRemovePressed();
- }
- });
- fSelectedViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateSelectedButtons();
- }
- });
+ fSelectedViewer.addDoubleClickListener(event -> handleRemovePressed());
+ fSelectedViewer.addSelectionChangedListener(event -> updateSelectedButtons());
}
public void createButtons(Composite parent) {
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 8f39efebf..93c99f7b5 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
@@ -47,8 +47,8 @@ public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
@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());
+ for (BreakpointSetElement breakpoint : fBreakpoints) {
+ breakpoint.container.getOrganizer().removeBreakpoint(breakpoint.breakpoint, breakpoint.container.getCategory());
}
}
}
@@ -73,10 +73,7 @@ public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
if (selection instanceof ITreeSelection) {
ITreeSelection tSel = (ITreeSelection)selection;
- TreePath[] paths = tSel.getPaths();
- for (int i = 0; i < paths.length; i++) {
- TreePath path = paths[i];
-
+ for (TreePath path : tSel.getPaths()) {
// 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) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java
index ebd28f5e3..a573edaf4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java
@@ -20,9 +20,7 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkingSet;
@@ -52,12 +50,9 @@ public class SelectBreakpointWorkingsetDialog extends AbstractDebugCheckboxSelec
protected void addViewerListeners(StructuredViewer viewer) {
CheckboxTableViewer checkViewer = getCheckBoxTableViewer();
if (checkViewer != null){
- checkViewer.addCheckStateListener(new ICheckStateListener(){
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- getCheckBoxTableViewer().setCheckedElements(new Object[] {event.getElement()});
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
+ checkViewer.addCheckStateListener(event -> {
+ getCheckBoxTableViewer().setCheckedElements(new Object[] {event.getElement()});
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
});
}
}
@@ -69,9 +64,9 @@ public class SelectBreakpointWorkingsetDialog extends AbstractDebugCheckboxSelec
private IWorkingSet[] getBreakpointWorkingSets() {
IWorkingSet[] ws = PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets();
ArrayList<IWorkingSet> list = new ArrayList<>();
- for(int i = 0; i < ws.length; i++) {
- if(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(ws[i].getId())) {
- list.add(ws[i]);
+ for (IWorkingSet w : ws) {
+ if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(w.getId())) {
+ list.add(w);
}
}
return list.toArray(new IWorkingSet[list.size()]);
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 c1c8d1965..c57d4df81 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
@@ -58,8 +58,8 @@ public class SortBreakpointsByAction extends AbstractBreakpointsViewAction imple
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();
+ for (MenuItem item : items) {
+ item.dispose();
}
fillMenu(m);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DeleteWorkingsetsMessageDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DeleteWorkingsetsMessageDialog.java
index 1a98aab32..70321109f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DeleteWorkingsetsMessageDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DeleteWorkingsetsMessageDialog.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpoints;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -27,6 +26,8 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* Allows the user to specify if they want to delete the working set, all the breakpoints in the working
@@ -130,8 +131,9 @@ public class DeleteWorkingsetsMessageDialog extends MessageDialog {
* @return dialog settings
*/
protected IDialogSettings getDialogSettings() {
- DebugUIPlugin plugin = DebugUIPlugin.getDefault();
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(DeleteWorkingsetsMessageDialog.class))
+ .getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(DIALOG_SETTINGS);
if (section == null) {
section = workbenchSettings.addNewSection(DIALOG_SETTINGS);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DisableAllBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DisableAllBreakpointsAction.java
new file mode 100644
index 000000000..775fb1187
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/DisableAllBreakpointsAction.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.IBreakpointsListener;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.actions.AbstractRemoveAllActionDelegate;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.IWorkbenchWindow;
+
+public class DisableAllBreakpointsAction extends AbstractRemoveAllActionDelegate implements IBreakpointsListener {
+
+ @Override
+ protected boolean isEnabled() {
+ return DebugPlugin.getDefault().getBreakpointManager().getBreakpoints().length > 0;
+ }
+
+ @Override
+ public void breakpointsAdded(IBreakpoint[] breakpoints) {
+ update();
+ }
+
+ @Override
+ public void breakpointsChanged(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
+ update();
+ }
+
+ @Override
+ public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
+ if (getAction() != null) {
+ update();
+ }
+ }
+
+ @Override
+ protected void initialize() {
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
+ }
+
+ @Override
+ public void dispose() {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
+ super.dispose();
+ }
+
+
+ @Override
+ public void run(IAction action) {
+ final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
+ final IBreakpoint[] breakpoints = breakpointManager.getBreakpoints();
+ if (breakpoints.length < 1) {
+ return;
+ }
+ IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
+ if (window == null) {
+ return;
+ }
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ boolean prompt = store.getBoolean(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS);
+ boolean proceed = true;
+ if (prompt) {
+ MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(window.getShell(),
+ ActionMessages.DisableAllBreakPointsAction_0, ActionMessages.DisableAllBreakPointsAction_1,
+ ActionMessages.DisableAllBreakPointsAction_2, !prompt, null, null);
+ if (mdwt.getReturnCode() != IDialogConstants.YES_ID) {
+ proceed = false;
+ } else {
+ store.setValue(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS,
+ !mdwt.getToggleState());
+ }
+ }
+ if (proceed) {
+ new Job(ActionMessages.DisableAllBreakPointsAction_1) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ for (IBreakpoint breakpoint : breakpoints) {
+ breakpoint.setEnabled(false);
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ }
+}
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 1d7fbfe49..b3d9094ea 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
@@ -111,8 +111,8 @@ public class EnableBreakpointsAction implements IViewActionDelegate, IPartListen
}
public void setEnabled(IBreakpoint[] breakpoints) throws CoreException {
boolean enable= isEnableAction();
- for (int i = 0; i < breakpoints.length; i++) {
- breakpoints[i].setEnabled(enable);
+ for (IBreakpoint breakpoint : breakpoints) {
+ breakpoint.setEnabled(enable);
}
}
};
@@ -165,9 +165,9 @@ public class EnableBreakpointsAction implements IViewActionDelegate, IPartListen
}
else if (selected instanceof IBreakpointContainer) {
IBreakpoint[] breakpoints = ((IBreakpointContainer) selected).getBreakpoints();
- for (int i = 0; i < breakpoints.length; i++) {
+ for (IBreakpoint breakpoint : breakpoints) {
try {
- if (breakpoints[i].isEnabled()) {
+ if (breakpoint.isEnabled()) {
allDisabled= false;
} else {
allEnabled= false;
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 ab90d0230..08ba613b2 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
@@ -43,9 +43,9 @@ public class OpenBreakpointMarkerAction extends SelectionProviderAction {
super(selectionProvider, ActionMessages.OpenBreakpointMarkerAction__Go_to_File_1);
setToolTipText(ActionMessages.OpenBreakpointMarkerAction_Go_to_File_for_Breakpoint_2);
ResourceLocator.imageDescriptorFromBundle("org.eclipse.ui.ide", "icons/full/elcl16/gotoobj_tsk.png") //$NON-NLS-1$ //$NON-NLS-2$
- .ifPresent(d -> setImageDescriptor(d));
+ .ifPresent(this::setImageDescriptor);
ResourceLocator.imageDescriptorFromBundle("org.eclipse.ui.ide", "icons/full/dlcl16/gotoobj_tsk.png") //$NON-NLS-1$ //$NON-NLS-2$
- .ifPresent(d -> setDisabledImageDescriptor(d));
+ .ifPresent(this::setDisabledImageDescriptor);
PlatformUI.getWorkbench().getHelpSystem().setHelp(
this,
IDebugHelpContextIds.OPEN_BREAKPOINT_ACTION);
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 a4acc0685..f75ee9379 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
@@ -60,92 +60,89 @@ public class RemoveBreakpointAction extends AbstractSelectionActionDelegate {
}
final Iterator<?> itr = selection.iterator();
final CoreException[] exception= new CoreException[1];
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- Set<IBreakpoint> breakpointsToDelete = new LinkedHashSet<>();
- ArrayList<IWorkingSet> groupsToDelete = new ArrayList<>();
- boolean deleteAll = false;
- boolean deleteContainer = false;
- boolean prompted = false;
- while (itr.hasNext()) {
- Object next= itr.next();
- IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(next, IBreakpoint.class);
- if (breakpoint != null) {
- breakpointsToDelete.add(breakpoint);
- } else if (next instanceof IBreakpointContainer) {
- //the the container is a workingset, ask if they want to delete it as well
- IBreakpointContainer bpc = (IBreakpointContainer) next;
- if(bpc.getCategory() instanceof WorkingSetCategory) {
- IWorkingSet set = ((WorkingSetCategory)bpc.getCategory()).getWorkingSet();
- if(!prompted) {
- prompted = true;
- DeleteWorkingsetsMessageDialog dialog = new DeleteWorkingsetsMessageDialog(getView().getSite().getShell(),
- ActionMessages.RemoveBreakpointAction_3,
- null,
- ActionMessages.RemoveBreakpointAction_4,
- MessageDialog.QUESTION,
- new String[] {ActionMessages.RemoveBreakpointAction_5, ActionMessages.RemoveBreakpointAction_6},
- 0);
- if (dialog.open() == Window.CANCEL) {
- return;
- }
- deleteAll = dialog.deleteAllBreakpoints();
- deleteContainer = dialog.deleteWorkingset();
- }
- if(deleteContainer) {
- groupsToDelete.add(set);
+ IWorkspaceRunnable runnable= monitor -> {
+ Set<IBreakpoint> breakpointsToDelete = new LinkedHashSet<>();
+ ArrayList<IWorkingSet> groupsToDelete = new ArrayList<>();
+ boolean deleteAll = false;
+ boolean deleteContainer = false;
+ boolean prompted = false;
+ while (itr.hasNext()) {
+ Object next= itr.next();
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(next, IBreakpoint.class);
+ if (breakpoint != null) {
+ breakpointsToDelete.add(breakpoint);
+ } else if (next instanceof IBreakpointContainer) {
+ //the the container is a workingset, ask if they want to delete it as well
+ IBreakpointContainer bpc = (IBreakpointContainer) next;
+ if(bpc.getCategory() instanceof WorkingSetCategory) {
+ IWorkingSet set = ((WorkingSetCategory)bpc.getCategory()).getWorkingSet();
+ if(!prompted) {
+ prompted = true;
+ DeleteWorkingsetsMessageDialog dialog = new DeleteWorkingsetsMessageDialog(getView().getSite().getShell(),
+ ActionMessages.RemoveBreakpointAction_3,
+ null,
+ ActionMessages.RemoveBreakpointAction_4,
+ MessageDialog.QUESTION,
+ new String[] {ActionMessages.RemoveBreakpointAction_5, ActionMessages.RemoveBreakpointAction_6},
+ 0);
+ if (dialog.open() == Window.CANCEL) {
+ return;
}
+ deleteAll = dialog.deleteAllBreakpoints();
+ deleteContainer = dialog.deleteWorkingset();
}
- else {
- if(!prompted) {
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- prompted = store.getBoolean(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER);
- if(prompted) {
- MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(getView().getSite().getShell(), ActionMessages.RemoveBreakpointAction_0,
- ActionMessages.RemoveBreakpointAction_1, ActionMessages.RemoveAllBreakpointsAction_3, !prompted, null, null);
- if(mdwt.getReturnCode() == IDialogConstants.NO_ID) {
- deleteAll = false;
- }
- else {
- store.setValue(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, !mdwt.getToggleState());
- deleteAll = true;
- }
+ if(deleteContainer) {
+ groupsToDelete.add(set);
+ }
+ }
+ else {
+ if(!prompted) {
+ IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
+ prompted = store.getBoolean(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER);
+ if(prompted) {
+ MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(getView().getSite().getShell(), ActionMessages.RemoveBreakpointAction_0,
+ ActionMessages.RemoveBreakpointAction_1, ActionMessages.RemoveAllBreakpointsAction_3, !prompted, null, null);
+ if(mdwt.getReturnCode() == IDialogConstants.NO_ID) {
+ deleteAll = false;
}
else {
- deleteAll = !prompted;
+ store.setValue(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, !mdwt.getToggleState());
+ deleteAll = true;
}
}
- }
- if(deleteAll) {
- IBreakpoint[] breakpoints = bpc.getBreakpoints();
- Collections.addAll(breakpointsToDelete, breakpoints);
+ else {
+ deleteAll = !prompted;
+ }
}
}
+ if(deleteAll) {
+ IBreakpoint[] breakpoints1 = bpc.getBreakpoints();
+ Collections.addAll(breakpointsToDelete, breakpoints1);
+ }
}
- final IBreakpoint[] breakpoints = breakpointsToDelete.toArray(new IBreakpoint[0]);
- final IWorkingSet[] sets = groupsToDelete.toArray(new IWorkingSet[groupsToDelete.size()]);
- if(breakpoints.length > 0) {
- ((BreakpointsView)getView()).preserveSelection(getSelection());
- }
- new Job(ActionMessages.RemoveBreakpointAction_2) {
- @Override
- protected IStatus run(IProgressMonitor pmonitor) {
- try {
- Shell shell= getView() != null ? getView().getSite().getShell() : null;
- DebugUITools.deleteBreakpoints(breakpoints, shell, pmonitor);
+ }
+ final IBreakpoint[] breakpoints2 = breakpointsToDelete.toArray(new IBreakpoint[0]);
+ final IWorkingSet[] sets = groupsToDelete.toArray(new IWorkingSet[groupsToDelete.size()]);
+ if(breakpoints2.length > 0) {
+ ((BreakpointsView)getView()).preserveSelection(getSelection());
+ }
+ new Job(ActionMessages.RemoveBreakpointAction_2) {
+ @Override
+ protected IStatus run(IProgressMonitor pmonitor) {
+ try {
+ Shell shell= getView() != null ? getView().getSite().getShell() : null;
+ DebugUITools.deleteBreakpoints(breakpoints2, shell, pmonitor);
- for (int i = 0; i < sets.length; i++) {
- PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(sets[i]);
- }
- return Status.OK_STATUS;
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
+ for (IWorkingSet set : sets) {
+ PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(set);
}
- return Status.CANCEL_STATUS;
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
}
- }.schedule();
- }
+ return Status.CANCEL_STATUS;
+ }
+ }.schedule();
};
try {
ResourcesPlugin.getWorkspace().run(runnable, null, 0, null);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
index 9bafdd7f4..d2c0da2cb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
@@ -78,8 +78,8 @@ public class ShowSupportedBreakpointsAction extends ToggleFilterAction implement
if (element instanceof IBreakpointContainer) {
// Breakpoint containers are visible if any of their children are visible.
IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints();
- for (int i = 0; i < breakpoints.length; i++) {
- if (select(viewer, element, breakpoints[i])) {
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (select(viewer, element, breakpoint)) {
return true;
}
}
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 06365e72b..c2f9290cf 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
@@ -117,8 +117,7 @@ public class EnableWatchExpressionAction implements IViewActionDelegate, IAction
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getSource() instanceof IWatchExpression) {
if (event.getKind() == DebugEvent.CHANGE) {
selectionChanged(fAction, fSelection);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionDialog.java
index 34519b36b..548245b87 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/WatchExpressionDialog.java
@@ -15,12 +15,12 @@
package org.eclipse.debug.internal.ui.actions.expressions;
+import java.text.MessageFormat;
+
import org.eclipse.debug.core.model.IWatchExpression;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.internal.ui.actions.StatusInfo;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.bindings.keys.IKeyLookup;
import org.eclipse.jface.bindings.keys.KeyLookupFactory;
@@ -50,8 +50,6 @@ import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.actions.TextViewerAction;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Dialog for edit watch expression.
*/
@@ -149,13 +147,10 @@ public class WatchExpressionDialog extends StatusDialog {
menuManager.add(cutAction);
menuManager.add(copyAction);
menuManager.add(pasteAction);
- menuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- cutAction.update();
- copyAction.update();
- pasteAction.update();
- }
+ menuManager.addMenuListener(manager -> {
+ cutAction.update();
+ copyAction.update();
+ pasteAction.update();
});
Menu menu = menuManager.createContextMenu(fSnippetViewer.getTextWidget());
fSnippetViewer.getTextWidget().setMenu(menu);
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 f2793f51d..4aa3b7e61 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
@@ -15,6 +15,7 @@
package org.eclipse.debug.internal.ui.actions.variables;
+import java.text.MessageFormat;
import java.util.Iterator;
import org.eclipse.debug.core.DebugException;
@@ -30,15 +31,12 @@ import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.internal.ui.views.variables.VariablesView;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IVariableValueEditor;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.SelectionProviderAction;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Action for changing the value of primitives and <code>String</code> variables.
* This action will attempt to delegate the editing operation to a registered
@@ -127,21 +125,15 @@ public class ChangeVariableValueAction extends SelectionProviderAction {
DebugUIPlugin.errorDialog(shell, ActionMessages.ChangeVariableValue_errorDialogTitle,ActionMessages.ChangeVariableValue_errorDialogMessage, exception); //
return;
}
- ChangeVariableValueInputDialog inputDialog = new ChangeVariableValueInputDialog(shell, ActionMessages.ChangeVariableValue_1, MessageFormat.format(ActionMessages.ChangeVariableValue_2, new Object[] { name }), value, new IInputValidator() { //
- /**
- * Returns an error string if the input is invalid
- */
- @Override
- public String isValid(String input) {
- try {
- if (fVariable.verifyValue(input)) {
- return null; // null means valid
- }
- } catch (DebugException exception) {
- return ActionMessages.ChangeVariableValue_3;
+ ChangeVariableValueInputDialog inputDialog = new ChangeVariableValueInputDialog(shell, ActionMessages.ChangeVariableValue_1, MessageFormat.format(ActionMessages.ChangeVariableValue_2, new Object[] { name }), value, input -> {
+ try {
+ if (fVariable.verifyValue(input)) {
+ return null; // null means valid
}
- return ActionMessages.ChangeVariableValue_4;
+ } catch (DebugException exception) {
+ return ActionMessages.ChangeVariableValue_3;
}
+ return ActionMessages.ChangeVariableValue_4;
});
inputDialog.open();
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 081a4a43a..b8895c503 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
@@ -14,15 +14,12 @@
package org.eclipse.debug.internal.ui.actions.variables;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
@@ -31,6 +28,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* A simple input dialog for soliciting an input string
@@ -161,16 +160,13 @@ public class ChangeVariableValueInputDialog extends TrayDialog {
text.setLayoutData(gridData);
text.setFont(font);
text.addModifyListener(
- new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (okButton.isEnabled()) {
- return;
- }
- errorMessageLabel.setText(IInternalDebugCoreConstants.EMPTY_STRING);
- errorMessageLabel.getParent().update();
- okButton.setEnabled(true);
+ e -> {
+ if (okButton.isEnabled()) {
+ return;
}
+ errorMessageLabel.setText(IInternalDebugCoreConstants.EMPTY_STRING);
+ errorMessageLabel.getParent().update();
+ okButton.setEnabled(true);
}
);
@@ -265,7 +261,9 @@ public class ChangeVariableValueInputDialog extends TrayDialog {
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ChangeVariableValueInputDialog.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
if (section == null) {
section = settings.addNewSection(getDialogSettingsSectionName());
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 95f1774b8..c1294b9cc 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
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.variables.details;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValueModification;
@@ -38,8 +40,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Action which assigns a value to a variable from the detail pane
* of the variables view.
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 7778425fe..71009e999 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
@@ -23,8 +23,6 @@ import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -32,6 +30,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* Provides a dialog for changing the maximum length allowed in the detail pane
@@ -57,26 +56,24 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
super(parent);
setShellStyle(getShellStyle() | SWT.RESIZE);
fValue = Integer.toString(DebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH));
- fValidator = new IInputValidator() {
- @Override
- public String isValid(String newText) {
- try {
- int num = Integer.parseInt(newText);
- if (num < 0) {
- return VariablesViewMessages.DetailPaneMaxLengthDialog_2;
- }
- } catch (NumberFormatException e) {
- return VariablesViewMessages.DetailPaneMaxLengthDialog_3;
- }
- return null;
- }
-
- };
+ fValidator = newText -> {
+ try {
+ int num = Integer.parseInt(newText);
+ if (num < 0) {
+ return VariablesViewMessages.DetailPaneMaxLengthDialog_2;
+ }
+ } catch (NumberFormatException e) {
+ return VariablesViewMessages.DetailPaneMaxLengthDialog_3;
+ }
+ return null;
+ };
}
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(DetailPaneMaxLengthDialog.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(SETTINGS_ID);
if (section == null) {
section = settings.addNewSection(SETTINGS_ID);
@@ -104,12 +101,9 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
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();
- }
+ fTextWidget.addModifyListener(e -> {
+ validateInput();
+ fValue = fTextWidget.getText();
});
fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMining.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMining.java
new file mode 100644
index 000000000..b53553506
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMining.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Red Hat, Inc. and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.codemining;
+
+import java.util.function.Consumer;
+
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.views.variables.VariablesView;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.codemining.ICodeMiningProvider;
+import org.eclipse.jface.text.codemining.LineEndCodeMining;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+public class DebugValueCodeMining extends LineEndCodeMining {
+
+ private IVariable variable;
+
+ protected DebugValueCodeMining(IDocument document, int line, IVariable variable, ICodeMiningProvider provider)
+ throws BadLocationException {
+ super(document, line, provider);
+ this.variable = variable;
+ setLabel(DebugUIPlugin.getModelPresentation().getText(variable));
+ }
+
+ @Override
+ public Consumer<MouseEvent> getAction() {
+ return e -> openVariableInVariablesView(variable);
+ }
+
+ private static void openVariableInVariablesView(IVariable variable) {
+
+ VariablesView view;
+ try {
+ view = (VariablesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .showView(IDebugUIConstants.ID_VARIABLE_VIEW);
+ view.getViewer().setSelection(new StructuredSelection(variable));
+ } catch (PartInitException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+
+ @Override
+ public boolean isResolved() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMiningProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMiningProvider.java
new file mode 100644
index 000000000..5ddcd2a0f
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/codemining/DebugValueCodeMiningProvider.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Red Hat, Inc. and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.codemining;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+import org.eclipse.core.runtime.Adapters;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IDebugEventSetListener;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.codemining.AbstractCodeMiningProvider;
+import org.eclipse.jface.text.codemining.ICodeMining;
+import org.eclipse.jface.text.source.ISourceViewerExtension5;
+
+public class DebugValueCodeMiningProvider extends AbstractCodeMiningProvider {
+
+ private volatile IDebugEventSetListener listener;
+
+ @Override
+ public CompletableFuture<List<? extends ICodeMining>> provideCodeMinings(ITextViewer viewer,
+ IProgressMonitor monitor) {
+ if (!isEnabled()) {
+ return CompletableFuture.completedFuture(List.of());
+ }
+ final IDocument document = viewer.getDocument();
+ if (viewer instanceof ISourceViewerExtension5 && listener == null) {
+ synchronized (this) {
+ if (listener == null) {
+ IDebugEventSetListener debugListener = e -> ((ISourceViewerExtension5) viewer).updateCodeMinings();
+ DebugPlugin.getDefault().addDebugEventListener(debugListener);
+ listener = debugListener;
+ }
+ }
+ }
+ if (!hasDebugRunning()) {
+ return CompletableFuture.completedFuture(List.of());
+ }
+ return CompletableFuture.supplyAsync(() -> {
+ List<DebugValueCodeMining> res = new ArrayList<>();
+ for (int line = 0; line < document.getNumberOfLines(); line++) {
+ LinkedHashMap<String, IVariable> variablesOnLine = new LinkedHashMap<>();
+ try {
+ IRegion lineInfo = document.getLineInformation(line);
+ for (int offsetInLine = 0; offsetInLine < lineInfo.getLength(); offsetInLine++) {
+ IVariable variableAtOffset = Adapters.adapt(
+ new TextSelection(document, lineInfo.getOffset() + offsetInLine, 0), IVariable.class);
+ if (variableAtOffset != null) {
+ try {
+ variablesOnLine.putIfAbsent(variableAtOffset.getName(), variableAtOffset);
+ offsetInLine += variableAtOffset.getName().length();
+ } catch (DebugException ex) {
+ DebugUIPlugin.log(ex);
+ }
+ }
+ }
+ for (IVariable variableOnLine : variablesOnLine.values()) {
+ res.add(new DebugValueCodeMining(document, line, variableOnLine, this));
+ }
+ } catch (BadLocationException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ return res;
+ });
+ }
+
+ private boolean hasDebugRunning() {
+ return Stream.of(DebugPlugin.getDefault().getLaunchManager().getLaunches()) //
+ .filter(Predicate.not(ILaunch::isTerminated)) //
+ .anyMatch(launch -> ILaunchManager.DEBUG_MODE.equals(launch.getLaunchMode()));
+ }
+
+ private boolean isEnabled() {
+ return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SHOW_VARIABLES_INLINE);
+ }
+
+ @Override
+ public void dispose() {
+ IDebugEventSetListener debugListener = listener;
+ if (debugListener != null) {
+ DebugPlugin.getDefault().removeDebugEventListener(debugListener);
+ listener = null;
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionsUpdater.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionsUpdater.java
index 8ebe00010..d8245e063 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionsUpdater.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/ActionsUpdater.java
@@ -45,8 +45,8 @@ public class ActionsUpdater {
if (!fDone) {
if (!fEnabled || fNumOfVotes == fNumVoters) {
fDone = true;
- for (int i = 0; i < fActions.length; i++) {
- fActions[i].setEnabled(fEnabled);
+ for (IEnabledTarget fAction : fActions) {
+ fAction.setEnabled(fEnabled);
}
}
}
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 817aa1906..96afac9b8 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
@@ -22,6 +22,8 @@ import java.util.Map.Entry;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.commands.IDebugCommandHandler;
+import org.eclipse.debug.core.commands.IDebugCommandRequest;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
@@ -47,12 +49,12 @@ public class DebugCommandService implements IDebugContextListener {
/**
* Window this service is for.
*/
- private IWorkbenchWindow fWindow = null;
+ private IWorkbenchWindow fWindow;
/**
* The context service for this command service.
*/
- private IDebugContextService fContextService = null;
+ private IDebugContextService fContextService;
/**
* Service per window
@@ -109,7 +111,9 @@ public class DebugCommandService implements IDebugContextListener {
private void dispose() {
fContextService.removeDebugContextListener(this);
- fgServices.remove(fWindow);
+ synchronized (fgServices) {
+ fgServices.remove(fWindow);
+ }
fCommandUpdates.clear();
fWindow = null;
}
@@ -122,7 +126,6 @@ public class DebugCommandService implements IDebugContextListener {
*/
public void postUpdateCommand(Class<?> commandType, IEnabledTarget action) {
synchronized (fCommandUpdates) {
- Job.getJobManager().cancel(commandType);
List<IEnabledTarget> actions = fCommandUpdates.get(commandType);
if (actions == null) {
actions = new ArrayList<>();
@@ -177,12 +180,16 @@ public class DebugCommandService implements IDebugContextListener {
* @param actions the actions to update
*/
private void updateCommand(Class<?> handlerType, Object[] elements, IEnabledTarget[] actions) {
+ cancelHandlerEnablementUpdateJobs(handlerType);
if (elements.length == 1) {
// usual case - one element
Object element = elements[0];
IDebugCommandHandler handler = getHandler(element, handlerType);
if (handler != null) {
UpdateActionsRequest request = new UpdateActionsRequest(elements, actions);
+ if (DebugUIPlugin.DEBUG_COMMAND_SERVICE) {
+ DebugUIPlugin.trace(request + " to " + handler); //$NON-NLS-1$
+ }
handler.canExecute(request);
return;
}
@@ -192,14 +199,17 @@ public class DebugCommandService implements IDebugContextListener {
ActionsUpdater updater = new ActionsUpdater(actions, map.size());
for (Entry<IDebugCommandHandler, List<Object>> entry : map.entrySet()) {
UpdateHandlerRequest request = new UpdateHandlerRequest(entry.getValue().toArray(), updater);
+ if (DebugUIPlugin.DEBUG_COMMAND_SERVICE) {
+ DebugUIPlugin.trace(request + " to " + entry.getKey()); //$NON-NLS-1$
+ }
entry.getKey().canExecute(request);
}
return;
}
}
// ABORT - no command processors
- for (int i = 0; i < actions.length; i++) {
- actions[i].setEnabled(false);
+ for (IEnabledTarget action : actions) {
+ action.setEnabled(false);
}
}
@@ -252,8 +262,7 @@ 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];
+ for (Object element : elements) {
IDebugCommandHandler handler = getHandler(element, handlerType);
if (handler == null) {
return null;
@@ -273,4 +282,36 @@ public class DebugCommandService implements IDebugContextListener {
return (IDebugCommandHandler)DebugPlugin.getAdapter(element, handlerType);
}
+ /**
+ * Cancel handler enablement update jobs created in
+ * {@link org.eclipse.debug.core.commands.AbstractDebugCommand#canExecute(org.eclipse.debug.core.commands.IEnabledStateRequest)}.
+ * for the specified handler type. The debug command handler defines its type in
+ * {@link org.eclipse.debug.core.commands.AbstractDebugCommand#getEnabledStateJobFamily(IDebugCommandRequest)}.
+ *
+ * Does not cancel jobs if there are more than 2 workbench windows, since 1
+ * window could cancel updates from another window, breaking some updates. See
+ * bug 560348.
+ *
+ * @param handlerType cancels enablement update jobs for this type of handler.
+ */
+ private void cancelHandlerEnablementUpdateJobs(Class<?> handlerType) {
+ if (handlerType != null) {
+ boolean hasMultipleWindowServices = hasMultipleWindowServices();
+ if (!hasMultipleWindowServices) {
+ if (DebugUIPlugin.DEBUG_COMMAND_SERVICE) {
+ Job[] jobs = Job.getJobManager().find(handlerType);
+ for (Job job : jobs) {
+ DebugUIPlugin.trace("WOULD cancel " + job); //$NON-NLS-1$
+ }
+ }
+ Job.getJobManager().cancel(handlerType);
+ }
+ }
+ }
+
+ private static boolean hasMultipleWindowServices() {
+ synchronized (fgServices) {
+ return fgServices.size() > 1;
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllHandler.java
new file mode 100644
index 000000000..ff14fbb5a
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/TerminateAllHandler.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2021 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.commands.actions;
+
+import org.eclipse.debug.internal.ui.views.launch.LaunchView;
+
+
+/**
+ * Default handler for terminate and re-launch. See bug 300810.
+ */
+public class TerminateAllHandler extends DebugActionHandler {
+
+ public TerminateAllHandler() {
+ super(LaunchView.TERMINATE_ALL);
+ }
+
+
+}
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 31a513e95..99016622e 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
@@ -45,8 +45,8 @@ public class TerminateAndRelaunchAction extends DebugCommandAction {
DebugUIPlugin.getStandardDisplay().asyncExec(() -> {
// Must be run in the UI thread since the launch can require
// prompting to proceed
- for (int i = 0; i < targets.length; i++) {
- ILaunch launch = DebugUIPlugin.getLaunch(targets[i]);
+ for (Object target : targets) {
+ ILaunch launch = DebugUIPlugin.getLaunch(target);
if (launch != null) {
RelaunchActionDelegate.relaunch(launch.getLaunchConfiguration(), launch.getLaunchMode());
}
@@ -84,8 +84,8 @@ public class TerminateAndRelaunchAction extends DebugCommandAction {
ISelection context = event.getContext();
if (context instanceof IStructuredSelection) {
Object[] elements = ((IStructuredSelection)context).toArray();
- for (int i = 0; i < elements.length; i++) {
- if (!canRelaunch(elements[i])) {
+ for (Object element : elements) {
+ if (!canRelaunch(element)) {
setEnabled(false);
return;
}
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 40ad431b6..cf62aaf60 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
@@ -98,9 +98,8 @@ public class TerminateAndRemoveAction extends DebugCommandAction {
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])) {
+ for (Object element : ((IStructuredSelection)context)) {
+ if (!isTerminated(element)) {
isAllTerminated = false;
break;
}
@@ -129,8 +128,8 @@ public class TerminateAndRemoveAction extends DebugCommandAction {
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]);
+ for (Object target : targets) {
+ ILaunch launch = DebugUIPlugin.getLaunch(target);
if (launch != null) {
DebugPlugin.getDefault().getLaunchManager().removeLaunch(launch);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java
index f3a75aa56..701099563 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/commands/actions/UpdateActionsRequest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.commands.actions;
+import java.util.Arrays;
+
import org.eclipse.debug.core.commands.IEnabledStateRequest;
import org.eclipse.debug.internal.core.commands.DebugCommandRequest;
@@ -41,10 +43,17 @@ public class UpdateActionsRequest extends DebugCommandRequest implements IEnable
@Override
public synchronized void done() {
if (!isCanceled()) {
- for (int i = 0; i < fActions.length; i++) {
- fActions[i].setEnabled(fEnabled);
+ for (IEnabledTarget action : fActions) {
+ action.setEnabled(fEnabled);
}
}
}
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " on " + fActions.length //$NON-NLS-1$
+ + " actions from " //$NON-NLS-1$
+ + Arrays.toString(getElements());
+ }
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
index f8526cb78..8e9ab0457 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.contextlaunching;
+import java.text.MessageFormat;
import java.util.List;
import org.eclipse.core.resources.IProject;
@@ -39,8 +40,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.IEditorPart;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Static runner for context launching to provide the base capability of context
* launching to more than one form of action (drop down, toolbar, view, etc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
index 6587d6230..2b1d97b90 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/LaunchingResourceManager.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.contextlaunching;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -69,8 +70,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
import org.eclipse.ui.internal.WorkbenchWindow;
-import com.ibm.icu.text.MessageFormat;
-
/**
* This manager is used to calculate the labels for the current resource or for the current
* state of the launch history, depending on the enabled status of contextual launching. More specifically
@@ -85,7 +84,6 @@ import com.ibm.icu.text.MessageFormat;
*
* @since 3.3
*/
-@SuppressWarnings("restriction")
public class LaunchingResourceManager implements IPropertyChangeListener, IWindowListener, ISelectionListener, ILaunchHistoryChangedListener, ILaunchesListener2 {
/**
@@ -279,10 +277,10 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo
ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
boolean launched = false;
ILaunchConfiguration tmp = null;
- for(int i = 0; i < launches.length; i++) {
- tmp = launches[i].getLaunchConfiguration();
- if(tmp != null) {
- if(!launches[i].isTerminated() && tmp.equals(config)) {
+ for (ILaunch launch : launches) {
+ tmp = launch.getLaunchConfiguration();
+ if (tmp != null) {
+ if (!launch.isTerminated() && tmp.equals(config)) {
launched = true;
break;
}
@@ -485,8 +483,8 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo
Object o = selection.getFirstElement();
LaunchShortcutExtension ext = null;
ILaunchConfiguration[] cfgs = null;
- for(int i = 0; i < shortcuts.size(); i++) {
- ext = shortcuts.get(i);
+ for (LaunchShortcutExtension shortcut : shortcuts) {
+ ext = shortcut;
if(o instanceof IEditorPart) {
cfgs = ext.getLaunchConfigurations((IEditorPart)o);
}
@@ -533,9 +531,9 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo
if (list == null || configs == null) {
return;
}
- for (int i = 0; i < configs.length; i++) {
- if (!list.contains(configs[i])) {
- list.add(configs[i]);
+ for (ILaunchConfiguration config : configs) {
+ if (!list.contains(config)) {
+ list.add(config);
}
}
}
@@ -549,9 +547,9 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo
workbench.addWindowListener(this);
// initialize for already open windows
IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- if (workbenchWindows[i].getSelectionService() != null) {
- windowOpened(workbenchWindows[i]);
+ for (IWorkbenchWindow workbenchWindow : workbenchWindows) {
+ if (workbenchWindow.getSelectionService() != null) {
+ windowOpened(workbenchWindow);
}
}
}
@@ -697,8 +695,8 @@ public class LaunchingResourceManager implements IPropertyChangeListener, IWindo
//we want to ensure that even if a launch is removed from the debug view
//when it is not terminated we update the label just in case.
//bug 195232
- for(int i = 0; i < launches.length; i++) {
- if(!launches[i].isTerminated()) {
+ for (ILaunch launch : launches) {
+ if (!launch.isTerminated()) {
fUpdateLabel = true;
return;
}
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 2accbd644..e24431296 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
@@ -146,6 +146,10 @@ public class DebugContextManager implements IDebugContextManager {
protected IDebugContextService createService(IWorkbenchWindow window) {
DebugWindowContextService service = fServices.get(window);
if (service == null) {
+ if (window == null) {
+ // the window has been closed - return a dummy service
+ return NULL_SERVICE;
+ }
IEvaluationService evaluationService = window.getService(IEvaluationService.class);
if (window.getShell() == null || evaluationService == null) {
// the window has been closed - return a dummy service
@@ -170,8 +174,7 @@ public class DebugContextManager implements IDebugContextManager {
public void addDebugContextListener(IDebugContextListener listener) {
fGlobalListeners.add(listener);
DebugWindowContextService[] services = getServices();
- for (int i = 0; i < services.length; i++) {
- DebugWindowContextService service = services[i];
+ for (DebugWindowContextService service : services) {
service.addDebugContextListener(listener);
}
}
@@ -180,8 +183,7 @@ public class DebugContextManager implements IDebugContextManager {
public void removeDebugContextListener(IDebugContextListener listener) {
fGlobalListeners.remove(listener);
DebugWindowContextService[] services = getServices();
- for (int i = 0; i < services.length; i++) {
- DebugWindowContextService service = services[i];
+ for (DebugWindowContextService service : services) {
service.removeDebugContextListener(listener);
}
}
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 73e9c12d1..b81101eed 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
@@ -139,9 +139,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
*/
private void loadDebugModelContextBindings() {
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_DEBUG_MODEL_CONTEXT_BINDINGS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
String modelIdentifier = element.getAttribute(ATTR_DEBUG_MODEL_ID);
String contextId = element.getAttribute(ATTR_CONTEXT_ID);
synchronized (this) {
@@ -215,16 +213,15 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
alreadyEnabled = new HashSet<>();
fLaunchToModelIds.put(launch, alreadyEnabled);
}
- for (int i = 0; i < modelIds.length; i++) {
- String id = modelIds[i];
+ for (String id : modelIds) {
if (!alreadyEnabled.contains(id)) {
alreadyEnabled.add(id);
toEnable.add(id);
}
}
}
- for (int i = 0; i < toEnable.size(); i++) {
- activateModel(toEnable.get(i), launch);
+ for (String element : toEnable) {
+ activateModel(element, launch);
}
enableActivitiesFor(modelIds);
@@ -338,8 +335,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
@Override
public void launchesTerminated(ILaunch[] launches) {
// disable activated contexts
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
+ for (ILaunch launch : launches) {
List<IContextActivation> activations;
synchronized(this) {
activations = fLanuchToContextActivations.remove(launch);
@@ -385,8 +381,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
List<String> workbenchContexts = new ArrayList<>();
String[] modelIds = getDebugModelIds(target);
if (modelIds != null) {
- for (int i = 0; i < modelIds.length; i++) {
- String modelId = modelIds[i];
+ for (String modelId : modelIds) {
synchronized (this) {
List<String> contextIds = fModelToContextIds.get(modelId);
if (contextIds != null) {
@@ -410,8 +405,7 @@ public class DebugModelContextBindingManager implements IDebugContextListener, I
*/
private void enableActivitiesFor(String[] modelIds) {
Set<String> activities = null;
- for (int i = 0; i < modelIds.length; i++) {
- String id = modelIds[i];
+ for (String id : modelIds) {
if (!fModelsEnabledForActivities.contains(id)) {
Set<String> ids = fModelToActivities.get(id);
if (ids == null) {
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 2252c2baa..780901061 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
@@ -18,7 +18,6 @@ package org.eclipse.debug.internal.ui.contexts;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -251,17 +250,17 @@ 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());
+ outer: for (Map.Entry<String, ListenerList<IDebugContextListener>> entry : fListenersByPartId.entrySet()) {
+ String listenerPartId = entry.getKey();
+ for (IDebugContextProvider provider : fProviders) {
+ String providerPartId = getCombinedPartId(provider.getPart());
if ((listenerPartId == null && providerPartId == null) ||
(listenerPartId != null && listenerPartId.equals(providerPartId)))
{
continue outer;
}
}
- ListenerList<IDebugContextListener> listenersForPart = fListenersByPartId.get(listenerPartId);
+ ListenerList<IDebugContextListener> listenersForPart = entry.getValue();
if (listenersForPart != null) {
for (IDebugContextListener iDebugContextListener : listenersForPart) {
// no effect if listener already present
@@ -285,15 +284,15 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
retVal = new ListenerList<>();
}
- outer: for (Iterator<String> itr = fPostListenersByPartId.keySet().iterator(); itr.hasNext();) {
- String listenerPartId = itr.next();
- for (int i = 0; i < fProviders.size(); i++) {
- String providerPartId = getCombinedPartId(fProviders.get(i).getPart());
+ outer: for (Map.Entry<String, ListenerList<IDebugContextListener>> entry : fPostListenersByPartId.entrySet()) {
+ String listenerPartId = entry.getKey();
+ for (IDebugContextProvider provider : fProviders) {
+ String providerPartId = getCombinedPartId(provider.getPart());
if ((listenerPartId == null && providerPartId == null) || (listenerPartId != null && listenerPartId.equals(providerPartId))) {
continue outer;
}
}
- ListenerList<IDebugContextListener> listenersForPart = fPostListenersByPartId.get(listenerPartId);
+ ListenerList<IDebugContextListener> listenersForPart = entry.getValue();
if (listenersForPart != null) {
for (IDebugContextListener iDebugContextListener : listenersForPart) {
// no effect if listener already present
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 33531919e..8a3c3d3d9 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
@@ -75,10 +75,9 @@ public class LaunchSuspendTrigger implements ISuspendTrigger, IDebugEventSetList
public void handleDebugEvents(DebugEvent[] events) {
// open the debugger if this is a suspend event and the debug view is not yet open
// and the preferences are set to switch
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getKind() == DebugEvent.SUSPEND && !event.isEvaluation() && event.getDetail() != DebugEvent.STEP_END) {
-// Don't switch perspective for evaluations or stepping
+ // Don't switch perspective for evaluations or stepping
Object source = event.getSource();
if (source instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) source;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
index a1bd7991f..448cbb060 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemoryBlockContentAdapter.java
@@ -19,7 +19,6 @@ package org.eclipse.debug.internal.ui.elements.adapters;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Vector;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
@@ -323,9 +322,9 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
// fill buffer with memory returned by debug adapter
int j = prefillNumBytes; // counter for memoryBuffer
- for (int i = 0; i < memory.length; i++) {
+ for (byte element : memory) {
MemoryByte tmp = new MemoryByte();
- tmp.setValue(memory[i]);
+ tmp.setValue(element);
tmp.setReadable(true);
tmp.setWritable(true);
tmp.setEndianessKnown(false);
@@ -393,7 +392,7 @@ public class MemoryBlockContentAdapter extends AsynchronousContentAdapter {
}
private Object[] organizeLines(long numberOfLines, MemoryByte[] memoryBuffer, BigInteger address, boolean manageDelta, MemoryViewPresentationContext context) {
- Vector<MemorySegment> lineCache = new Vector<>();
+ ArrayList<MemorySegment> lineCache = new ArrayList<>();
IMemoryRendering rendering = context.getRendering();
if (!(rendering instanceof AbstractAsyncTableRendering)) {
return lineCache.toArray();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java
index 3430b43ec..91d9c2bbc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/MemorySegmentLabelAdapter.java
@@ -194,13 +194,13 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
MemoryByte[] bytes = ((MemorySegment)element).getBytes(start, tableRendering.getBytesPerColumn());
boolean allKnown = true;
boolean unchanged = true;
- for (int i=0; i<bytes.length; i++)
- {
- if (!bytes[i].isHistoryKnown())
+ for (MemoryByte b : bytes) {
+ if (!b.isHistoryKnown()) {
allKnown = false;
-
- if (bytes[i].isChanged())
+ }
+ if (b.isChanged()) {
unchanged = false;
+ }
}
if (allKnown)
@@ -339,13 +339,13 @@ public class MemorySegmentLabelAdapter extends AsynchronousLabelAdapter {
MemoryByte[] bytes = segment.getBytes(start, tableRendering.getBytesPerColumn());
boolean allKnown = true;
boolean unchanged = true;
- for (int i=0; i<bytes.length; i++)
- {
- if (!bytes[i].isHistoryKnown())
+ for (MemoryByte b : bytes) {
+ if (!b.isHistoryKnown()) {
allKnown = false;
-
- if (bytes[i].isChanged())
+ }
+ if (b.isChanged()) {
unchanged = false;
+ }
}
if (allKnown)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/RegisterGroupProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/RegisterGroupProxy.java
index 621f03580..0ea4beaa7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/RegisterGroupProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/RegisterGroupProxy.java
@@ -236,8 +236,8 @@ public class RegisterGroupProxy implements IModelProxyFactory, IColumnPresentati
@Override
public int hashCode() {
int code = getClass().hashCode();
- for (int i = 0; i < fGroups.length; i++) {
- code+=fGroups[i].hashCode();
+ for (IRegisterGroup fGroup : fGroups) {
+ code += fGroup.hashCode();
}
return code;
}
@@ -336,9 +336,9 @@ public class RegisterGroupProxy implements IModelProxyFactory, IColumnPresentati
* @param updates updates to cancel
*/
private void cancelUpdates(IViewerUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- updates[i].setStatus(Status.CANCEL_STATUS);
- updates[i].done();
+ for (IViewerUpdate update : updates) {
+ update.setStatus(Status.CANCEL_STATUS);
+ update.done();
}
}
@@ -347,8 +347,7 @@ public class RegisterGroupProxy implements IModelProxyFactory, IColumnPresentati
IElementMementoProvider provider = ViewerAdapterService.getMementoProvider(fFrame);
if (provider != null) {
List<IElementCompareRequest> others = new ArrayList<>(requests.length);
- for (int i = 0; i < requests.length; i++) {
- IElementCompareRequest request = requests[i];
+ for (IElementCompareRequest request : requests) {
if (request.getElement().equals(this)) {
Integer integer = request.getMemento().getInteger(HASH_CODE);
if (integer != null) {
@@ -374,8 +373,7 @@ public class RegisterGroupProxy implements IModelProxyFactory, IColumnPresentati
IElementMementoProvider provider = ViewerAdapterService.getMementoProvider(fFrame);
if (provider != null) {
List<IElementMementoRequest> others = new ArrayList<>(requests.length);
- for (int i = 0; i < requests.length; i++) {
- IElementMementoRequest request = requests[i];
+ for (IElementMementoRequest request : requests) {
if (request.getElement().equals(this)) {
request.getMemento().putInteger(HASH_CODE, this.hashCode());
request.done();
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 6edb7a674..fdcfb1dc7 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
@@ -48,9 +48,7 @@ import org.eclipse.debug.ui.ILaunchGroup;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -58,7 +56,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -72,6 +69,7 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+import org.osgi.framework.FrameworkUtil;
/**
* This class was taken from org.eclipse.debug.ui. We expose a Common tab for
@@ -111,12 +109,7 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
/**
* Modify listener that simply updates the owning launch configuration dialog.
*/
- private ModifyListener fBasicModifyListener = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- };
+ private ModifyListener fBasicModifyListener = evt -> updateLaunchConfigurationDialog();
@Override
public void createControl(Composite parent) {
@@ -144,12 +137,7 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
table.setFont(parent.getFont());
fFavoritesTable.setContentProvider(new FavoritesContentProvider());
fFavoritesTable.setLabelProvider(new FavoritesLabelProvider());
- fFavoritesTable.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateLaunchConfigurationDialog();
- }
- });
+ fFavoritesTable.addCheckStateListener(event -> updateLaunchConfigurationDialog());
}
/**
@@ -211,11 +199,11 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
private String getDefaultSharedConfigLocation(ILaunchConfiguration config) {
String path = IInternalDebugCoreConstants.EMPTY_STRING;
try {
- IResource[] res = config.getMappedResources();
- if(res != null) {
+ IResource[] resources = config.getMappedResources();
+ if(resources != null) {
IProject proj;
- for (int i = 0; i < res.length; i++) {
- proj = res[i].getProject();
+ for (IResource res : resources) {
+ proj = res.getProject();
if(proj != null && proj.isAccessible()) {
return proj.getFullPath().toOSString();
}
@@ -256,7 +244,8 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
}
private IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(CommonTabLite.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(SETTINGS_ID);
if (section == null) {
section = settings.addNewSection(SETTINGS_ID);
@@ -304,7 +293,7 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
fFavoritesTable.setInput(config);
fFavoritesTable.setCheckedElements(new Object[]{});
try {
- List<String> groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<String>());
+ List<String> groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<>());
if (groups.isEmpty()) {
// check old attributes for backwards compatible
if (config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) {
@@ -385,8 +374,8 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
// see if there are any changes
if (num == checked.length) {
boolean different = false;
- for (int i = 0; i < checked.length; i++) {
- if (!groups.contains(checked[i])) {
+ for (Object c : checked) {
+ if (!groups.contains(c)) {
different = true;
break;
}
@@ -399,8 +388,8 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
config.setAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, (String)null);
config.setAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, (String)null);
List<String> groups = null;
- for (int i = 0; i < checked.length; i++) {
- LaunchGroupExtension group = (LaunchGroupExtension)checked[i];
+ for (Object c : checked) {
+ LaunchGroupExtension group = (LaunchGroupExtension) c;
if (groups == null) {
groups = new ArrayList<>();
}
@@ -499,8 +488,7 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
ILaunchGroup[] groups = DebugUITools.getLaunchGroups();
List<ILaunchGroup> possibleGroups = new ArrayList<>();
ILaunchConfiguration configuration = (ILaunchConfiguration)inputElement;
- for (int i = 0; i < groups.length; i++) {
- ILaunchGroup extension = groups[i];
+ for (ILaunchGroup extension : groups) {
LaunchHistory history = getLaunchConfigurationManager().getLaunchHistory(extension.getIdentifier());
if (history != null && history.accepts(configuration)) {
possibleGroups.add(extension);
@@ -521,7 +509,7 @@ class CommonTabLite extends AbstractLaunchConfigurationTab {
* Provides the labels for the favorites table
*
*/
- class FavoritesLabelProvider implements ITableLabelProvider {
+ static class FavoritesLabelProvider implements ITableLabelProvider {
private Map<Object, Image> fImages = new HashMap<>();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java
index 4a55978f0..0ff1d19cf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/groups/GroupLaunchConfigurationSelectionDialog.java
@@ -50,8 +50,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -257,21 +255,18 @@ class GroupLaunchConfigurationSelectionDialog extends TitleAreaDialog implements
fActionParamLabel = new Label(comp, SWT.NONE);
fActionParamWidget = new Text(comp, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().applyTo(fActionParamWidget);
- fActionParamWidget.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- String text = ((Text) e.widget).getText();
- if (action == GroupElementPostLaunchAction.DELAY) {
- try {
- actionParam = Integer.valueOf(text);
- } catch (NumberFormatException exc) {
- actionParam = null;
- }
- } else if (action == GroupElementPostLaunchAction.OUTPUT_REGEXP) {
- actionParam = text;
+ fActionParamWidget.addModifyListener(e -> {
+ String text = ((Text) e.widget).getText();
+ if (action == GroupElementPostLaunchAction.DELAY) {
+ try {
+ actionParam = Integer.valueOf(text);
+ } catch (NumberFormatException exc) {
+ actionParam = null;
}
- validate();
+ } else if (action == GroupElementPostLaunchAction.OUTPUT_REGEXP) {
+ actionParam = text;
}
+ validate();
});
if (actionParam instanceof Integer) {
fActionParamWidget.setText(((Integer) actionParam).toString());
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 9f0710e08..f670a4e67 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
@@ -50,15 +50,11 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchGroup;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ICheckStateProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
@@ -466,12 +462,7 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
updateLaunchConfigurationDialog();
}
};
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- buts.updateWidgetEnablement();
- }
- });
+ treeViewer.addSelectionChangedListener(event -> buts.updateWidgetEnablement());
treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
@Override
@@ -480,12 +471,9 @@ public class GroupLaunchConfigurationTabGroup extends AbstractLaunchConfiguratio
}
});
- treeViewer.addCheckStateListener(new ICheckStateListener(){
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- ((GroupLaunchElement)event.getElement()).enabled = event.getChecked();
- updateLaunchConfigurationDialog();
- }
+ treeViewer.addCheckStateListener(event -> {
+ ((GroupLaunchElement)event.getElement()).enabled = event.getChecked();
+ updateLaunchConfigurationDialog();
});
buts.updateWidgetEnablement();
GridData layoutData = new GridData(GridData.GRAB_VERTICAL);
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 9ca00b61c..fae00ba3d 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
@@ -85,9 +85,7 @@ public class DebugTextHover implements ITextHover, ITextHoverExtension, ITextHov
*/
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];
+ for (char character : variableText.toCharArray()) {
switch (character) {
case '<':
buffer.append("&lt;"); //$NON-NLS-1$
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 dc4f6f322..f1a0d6aa9 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
@@ -15,7 +15,6 @@ package org.eclipse.debug.internal.ui.hover;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
@@ -54,6 +53,7 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* Creates an information control to display an expression in a hover control.
@@ -193,9 +193,11 @@ public class ExpressionInformationControlCreator implements IInformationControlC
* @param create whether to create the settings
*/
private IDialogSettings getDialogSettings(boolean create) {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ExpressionInformationControlCreator.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(this.getClass().getName());
- if (section == null & create) {
+ if (section == null && create) {
section = settings.addNewSection(this.getClass().getName());
}
return section;
@@ -262,9 +264,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
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];
+ for (String key : copy.getProperties()) {
fContext.setProperty(key, copy.getProperty(key));
}
}
@@ -276,9 +276,8 @@ public class ExpressionInformationControlCreator implements IInformationControlC
// 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]);
+ for (ViewerFilter filter : structuredViewer.getFilters()) {
+ fViewer.addFilter(filter);
}
}
}
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 ea34ebbf3..137c02397 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
@@ -16,7 +16,6 @@ package org.eclipse.debug.internal.ui.importexport.breakpoints;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
@@ -36,7 +35,6 @@ import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -63,12 +61,7 @@ public class EmbeddedBreakpointsViewer {
private BreakpointsContentProvider fProvider = null;
private Tree fTree = null;
private BreakpointsViewer fViewer = null;
- private ICheckStateListener fCheckListener = new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateCheckedState(event.getElement(), event.getChecked());
- }
- };
+ private ICheckStateListener fCheckListener = event -> updateCheckedState(event.getElement(), event.getChecked());
/**
* This constructor allows a specific selection to be used in stead of the default
@@ -122,11 +115,10 @@ public class EmbeddedBreakpointsViewer {
map = ((DelegatingModelPresentation) current).getAttributes();
}
if(map != null) {
- Object key = null;
IDebugModelPresentation newpres = labelprovider.getPresentation();
- for (Iterator<String> iter = map.keySet().iterator(); iter.hasNext();) {
- key = iter.next();
- newpres.setAttribute((String) key, map.get(key));
+ for (Map.Entry<String, Object> entry : map.entrySet()) {
+ String key = entry.getKey();
+ newpres.setAttribute(key, entry.getValue());
}
}
}
@@ -147,12 +139,10 @@ public class EmbeddedBreakpointsViewer {
* Performs the initialization of the viewer from a selection
*/
private void initViewerState() {
- Object[] items = fSelection.toArray();
fViewer.setGrayedElements(new Object[] {});
fViewer.setCheckedElements(new Object[] {});
ArrayList<IBreakpoint> list = new ArrayList<>();
- for(int i = 0; i < items.length; i++) {
- Object item = items[i];
+ for (Object item : fSelection.toArray()) {
IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(item, IBreakpoint.class);
if(breakpoint != null) {
list.add(breakpoint);
@@ -161,8 +151,8 @@ public class EmbeddedBreakpointsViewer {
getBreakpointsFromContainers((IBreakpointContainer)item, list);
}
}
- for(int i = 0; i < list.size(); i++) {
- updateCheckedState(list.get(i), true);
+ for (IBreakpoint element : list) {
+ updateCheckedState(element, true);
}
}
@@ -182,11 +172,10 @@ public class EmbeddedBreakpointsViewer {
* @return the selection from the viewer with no duplicates
*/
public IStructuredSelection getCheckedElements() {
- Object[] list = fViewer.getCheckedElements();
Vector<Object> selected = new Vector<>();
- for(int i = 0; i < list.length; i++) {
- if(!selected.contains(list[i])) {
- selected.addElement(list[i]);
+ for (Object element : fViewer.getCheckedElements()) {
+ if(!selected.contains(element)) {
+ selected.addElement(element);
}
}
return new StructuredSelection(selected);
@@ -207,9 +196,8 @@ public class EmbeddedBreakpointsViewer {
*/
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);
+ for (TreeItem item : fTree.getItems()) {
+ findAllOccurrences(item, element, list);
}
return list.toArray(new Widget[0]);
}
@@ -224,9 +212,8 @@ public class EmbeddedBreakpointsViewer {
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);
+ for (TreeItem childItem : item.getItems()) {
+ findAllOccurrences(childItem, element, list);
}
}
@@ -239,10 +226,9 @@ public class EmbeddedBreakpointsViewer {
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];
+ for (Widget element : searchItems(obj)) {
+ item = (TreeItem)element;
item.setChecked(enable);
refreshParents(item);
}
@@ -250,8 +236,8 @@ public class EmbeddedBreakpointsViewer {
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);
+ for (IBreakpoint bp : bps) {
+ updateCheckedState(bp, enable);
}
}
}
@@ -291,10 +277,9 @@ public class EmbeddedBreakpointsViewer {
* @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()) {
+ for (TreeItem element : parent.getItems()) {
+ if(element.getGrayed()) {
count++;
}
}
@@ -307,10 +292,9 @@ public class EmbeddedBreakpointsViewer {
* @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()) {
+ for (TreeItem element : parent.getItems()) {
+ if(element.getChecked()) {
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 1c31ff369..62c134127 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
@@ -14,12 +14,13 @@
package org.eclipse.debug.internal.ui.importexport.breakpoints;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* <p>
@@ -64,8 +65,8 @@ public class WizardExportBreakpoints extends Wizard implements IExportWizard {
*/
public WizardExportBreakpoints() {
super();
- DebugUIPlugin plugin = DebugUIPlugin.getDefault();
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(WizardExportBreakpoints.class)).getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(EXPORT_DIALOG_SETTINGS);
if (section == null) {
section = workbenchSettings.addNewSection(EXPORT_DIALOG_SETTINGS);
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 958de66e4..eb91c4887 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
@@ -16,6 +16,7 @@
package org.eclipse.debug.internal.ui.importexport.breakpoints;
import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -33,8 +34,6 @@ import org.eclipse.debug.ui.actions.ExportBreakpointsOperation;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -49,8 +48,6 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.PlatformUI;
-import com.ibm.icu.text.MessageFormat;
-
/**
* <p>
* This class provides an internal implementation of a WizardPage, which is used
@@ -174,12 +171,7 @@ public class WizardExportBreakpointsPage extends WizardPage implements Listener
Composite composite = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH);
SWTFactory.createLabel(composite, ImportExportMessages.WizardExportBreakpointsPage_2, 1);
fTView = new EmbeddedBreakpointsViewer(composite, DebugPlugin.getDefault().getBreakpointManager(), fSelection);
- fTView.getViewer().addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- setPageComplete(detectPageComplete());
- }
- });
+ fTView.getViewer().addCheckStateListener(event -> setPageComplete(detectPageComplete()));
fTView.getViewer().setSelection(fSelection);
//ensure we can see the beginning check-boxes etc. (bug 180971)
//this will not work in Windows Vista as there is no way to over-ride the default viewer item showing policy
@@ -277,7 +269,7 @@ public class WizardExportBreakpointsPage extends WizardPage implements Listener
private void restoreWidgetState() {
IDialogSettings settings = getDialogSettings();
if(settings != null) {
- fOverwriteExistingFilesCheckbox.setSelection(Boolean.valueOf(settings.get(OVERWRITE_ALL_STATE)).booleanValue());
+ fOverwriteExistingFilesCheckbox.setSelection(Boolean.parseBoolean(settings.get(OVERWRITE_ALL_STATE)));
String filename = settings.get(DESTINATION_FILE_NAME);
if (filename != null) {
fDestinationNameField.setText(filename);
@@ -310,8 +302,7 @@ public class WizardExportBreakpointsPage extends WizardPage implements Listener
// collect breakpoints
Object[] elements = fTView.getCheckedElements().toArray();
List<IBreakpoint> breakpoints = new ArrayList<>();
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
+ for (Object object : elements) {
if (object instanceof IBreakpoint) {
breakpoints.add((IBreakpoint) object);
}
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 a13af565b..e05e7b985 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
@@ -18,12 +18,13 @@ package org.eclipse.debug.internal.ui.importexport.breakpoints;
import java.util.List;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* <p>
@@ -66,8 +67,8 @@ public class WizardImportBreakpoints extends Wizard implements IImportWizard {
*/
public WizardImportBreakpoints() {
super();
- DebugUIPlugin plugin = DebugUIPlugin.getDefault();
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(WizardImportBreakpoints.class)).getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(IMPORT_DIALOG_SETTINGS);
if (section == null) {
section = workbenchSettings.addNewSection(IMPORT_DIALOG_SETTINGS);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java
index 318f98c7b..873e6a7cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsPage.java
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui.importexport.breakpoints;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
@@ -46,8 +47,6 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.PlatformUI;
-import com.ibm.icu.text.MessageFormat;
-
/**
* The import breakpoints wizard page.
*
@@ -184,8 +183,8 @@ public class WizardImportBreakpointsPage extends WizardPage implements Listener
private void restoreWidgetState() {
IDialogSettings settings = getDialogSettings();
if(settings != null) {
- fAutoRemoveDuplicates.setSelection(Boolean.valueOf(settings.get(REMOVE_DUPS)).booleanValue());
- fAutoCreateWorkingSets.setSelection(Boolean.valueOf(settings.get(CREATE_WORKING_SETS)).booleanValue());
+ fAutoRemoveDuplicates.setSelection(Boolean.parseBoolean(settings.get(REMOVE_DUPS)));
+ fAutoCreateWorkingSets.setSelection(Boolean.parseBoolean(settings.get(CREATE_WORKING_SETS)));
String fileName = settings.get(SOURCE_FILE_NAME);
if (fileName != null) {
fFileNameField.setText(fileName);
@@ -224,24 +223,24 @@ public class WizardImportBreakpointsPage extends WizardPage implements Listener
private void removeUncheckedBreakpoints(IBreakpoint[] importedBreakpoints) {
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- for(int i = 0; i < importedBreakpoints.length; i++) {
+ for (IBreakpoint importedBreakpoint : importedBreakpoints) {
boolean selected = false;
- for(int j = 0; j < selectedMarkers.size(); j++) {
+ for (IMarker selectedMarker : selectedMarkers) {
try {
- Map<String, Object> importedMarkerAttributes = importedBreakpoints[i].getMarker().getAttributes();
- Map<String, Object> selectedMarkerAttributes = selectedMarkers.get(j).getAttributes();
+ Map<String, Object> importedMarkerAttributes = importedBreakpoint.getMarker().getAttributes();
+ Map<String, Object> selectedMarkerAttributes = selectedMarker.getAttributes();
if(importedMarkerAttributes.equals(selectedMarkerAttributes)) {
selected = true;
break;
}
- } catch (CoreException e) {
+ }catch (CoreException e) {
DebugPlugin.log(e);
}
}
- if(!selected) {
+ if (!selected) {
try {
- manager.removeBreakpoint(importedBreakpoints[i], true);
- } catch (CoreException e) {
+ manager.removeBreakpoint(importedBreakpoint, true);
+ }catch (CoreException e) {
DebugPlugin.log(e);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
index d9a02aa16..b63dd4248 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/WizardImportBreakpointsSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Sebastian Schmidt and others.
+ * Copyright (c) 2012, 2020 Sebastian Schmidt and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -30,21 +30,30 @@ import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.actions.ImportBreakpointsOperation;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Widget;
/**
* @since 3.8
* @noextend This class is not intended to be subclassed by clients.
*/
-public class WizardImportBreakpointsSelectionPage extends WizardPage {
+public class WizardImportBreakpointsSelectionPage extends WizardPage implements Listener {
private EmbeddedBreakpointsViewer fTView;
private boolean fIsVisible;
+ private Button fSelectAll = null;
+ private Button fDeselectAll = null;
+ private ICheckStateListener fImportCheckListener = event -> updateCheckedState(event.getChecked());
protected WizardImportBreakpointsSelectionPage(String pageName) {
super(pageName, ImportExportMessages.WizardImportBreakpointsSelectionPage_2, null);
}
@@ -56,19 +65,35 @@ public class WizardImportBreakpointsSelectionPage extends WizardPage {
SWTFactory.createLabel(composite, ImportExportMessages.WizardExportBreakpointsPage_2, 1);
BreakpointManager breakpointManager = new BreakpointManager();
fTView = new EmbeddedBreakpointsViewer(composite, breakpointManager, null);
+ createButtonsGroup(composite);
BreakpointsViewer viewer = fTView.getViewer();
viewer.setLabelProvider(new DecoratingLabelProvider((ILabelProvider) viewer.getLabelProvider(), new BreakpointsPathDecorator()));
+ viewer.addCheckStateListener(fImportCheckListener);
setControl(composite);
}
+ /**
+ * 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);
+ }
+
public List<IMarker> getSelectedMarkers() {
if(!fIsVisible) {
return null;
}
List<IMarker> markers = new ArrayList<>();
List<IBreakpoint> breakpoints = fTView.getCheckedElements().toList();
- for(int i = 0; i < breakpoints.size(); i++) {
- markers.add(breakpoints.get(i).getMarker());
+ for (IBreakpoint breakpoint : breakpoints) {
+ markers.add(breakpoint.getMarker());
}
return markers;
}
@@ -98,8 +123,8 @@ public class WizardImportBreakpointsSelectionPage extends WizardPage {
operation.run(monitor);
BreakpointContainer breakpointManager = new BreakpointContainer(null, null);
IBreakpoint[] importedBreakpoints = operation.getImportedBreakpoints();
- for (int i = 0; i < importedBreakpoints.length; i++) {
- breakpointManager.addBreakpoint(importedBreakpoints[i], new ModelDelta(null, IModelDelta.ADDED));
+ for (IBreakpoint importedBreakpoint : importedBreakpoints) {
+ breakpointManager.addBreakpoint(importedBreakpoint, new ModelDelta(null, IModelDelta.ADDED));
}
currentTView.getViewer().setInput(breakpointManager);
currentTView.getViewer().refresh();
@@ -110,4 +135,63 @@ public class WizardImportBreakpointsSelectionPage extends WizardPage {
public Image getImage() {
return DebugUITools.getImage(IInternalDebugUIConstants.IMG_WIZBAN_IMPORT_BREAKPOINTS);
}
+
+ @Override
+ public void handleEvent(Event event) {
+ Widget source = event.widget;
+ if (source == fSelectAll) {
+ handleSelectAllPressed();
+ } else if (source == fDeselectAll) {
+ handleDeselectAllPressed();
+ }
+
+ }
+
+ /**
+ * Handles the select all button pressed
+ *
+ */
+ private void handleSelectAllPressed() {
+ BreakpointsViewer viewer = fTView.getViewer();
+ viewer.getTree().selectAll();
+ viewer.setCheckedElements(viewer.getStructuredSelection().toArray());
+ viewer.setGrayedElements(new Object[] {});
+ viewer.getTree().deselectAll();
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ /**
+ * Handles the de-select all button pressed
+ *
+ */
+ private void handleDeselectAllPressed() {
+ BreakpointsViewer viewer = fTView.getViewer();
+ viewer.setCheckedElements(new Object[] {});
+ viewer.setGrayedElements(new Object[] {});
+ setErrorMessage(ImportExportMessages.WizardImportBreakpointsSelectionPage_1);
+ setPageComplete(false);
+ }
+
+ /**
+ * Update the checked state of the given element and all of its children.
+ *
+ * @param enable the checked status of the obj
+ */
+ private void updateCheckedState(boolean enable) {
+ if (!enable) {
+ int size = fTView.getCheckedElements().size();
+ if (size == 0) {
+ setErrorMessage(ImportExportMessages.WizardImportBreakpointsSelectionPage_1);
+ setPageComplete(false);
+ } else {
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+ } else {
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizard.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizard.java
index 0572de072..37141526c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizard.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ExportLaunchConfigurationsWizard.java
@@ -14,13 +14,14 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.importexport.launchconfigurations;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* This class provides a wizard for exporting launch configurations to the local
@@ -38,8 +39,9 @@ public class ExportLaunchConfigurationsWizard extends Wizard implements IExportW
*/
public ExportLaunchConfigurationsWizard() {
super();
- DebugUIPlugin plugin = DebugUIPlugin.getDefault();
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ExportLaunchConfigurationsWizard.class))
+ .getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(EXPORT_DIALOG_SETTINGS);
if (section == null) {
section = workbenchSettings.addNewSection(EXPORT_DIALOG_SETTINGS);
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 e5cd4bfcf..7465864ee 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
@@ -21,6 +21,7 @@ import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -49,15 +50,11 @@ import org.eclipse.debug.internal.ui.launchConfigurations.LaunchCategoryFilter;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
@@ -71,8 +68,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchViewerComparator;
import org.eclipse.ui.progress.UIJob;
-import com.ibm.icu.text.MessageFormat;
-
/**
* This calls provides the one and only wizard page to the
* export launch configurations wizard.
@@ -185,12 +180,9 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
updateCheckedState(element);
}
}
- fViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateCheckedState(event.getElement());
- setPageComplete(isComplete());
- }
+ fViewer.addCheckStateListener(event -> {
+ updateCheckedState(event.getElement());
+ setPageComplete(isComplete());
});
Composite buttoncomp = SWTFactory.createComposite(parent, parent.getFont(), 2, 2, GridData.FILL_HORIZONTAL, 0, 0);
Button button = SWTFactory.createPushButton(buttoncomp, WizardMessages.ExportLaunchConfigurationsWizardPage_8, null);
@@ -198,8 +190,8 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
@Override
public void widgetSelected(SelectionEvent e) {
Object[] items = fContentProvider.getElements(fViewer.getInput());
- for (int i = 0; i < items.length; i++) {
- fViewer.setSubtreeChecked(items[i], true);
+ for (Object item : items) {
+ fViewer.setSubtreeChecked(item, true);
}
setPageComplete(isComplete());
}
@@ -209,8 +201,8 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
@Override
public void widgetSelected(SelectionEvent e) {
Object[] items = fContentProvider.getElements(fViewer.getInput());
- for (int i = 0; i < items.length; i++) {
- fViewer.setSubtreeChecked(items[i], false);
+ for (Object item : items) {
+ fViewer.setSubtreeChecked(item, false);
}
setPageComplete(isComplete());
}
@@ -244,8 +236,8 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
boolean state = fViewer.getChecked(element);
if(element instanceof ILaunchConfigurationType) {
Object[] items = ((ConfigContentProvider)fViewer.getContentProvider()).getChildren(element);
- for(int i = 0; i < items.length; i++) {
- fViewer.setChecked(items[i], state);
+ for (Object item : items) {
+ fViewer.setChecked(item, state);
}
fViewer.setGrayed(element, false);
}
@@ -255,15 +247,15 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
Object[] items = ccp.getChildren(parent);
boolean checked = true;
boolean onechecked = false;
- for(int i = 0; i < items.length; i++) {
- state = fViewer.getChecked(items[i]);
+ for (Object item : items) {
+ state = fViewer.getChecked(item);
checked &= state;
if(state) {
onechecked = true;
}
}
- fViewer.setGrayed(parent, onechecked & !checked);
- fViewer.setChecked(parent, checked | onechecked);
+ fViewer.setGrayed(parent, onechecked && !checked);
+ fViewer.setChecked(parent, checked || onechecked);
}
}
@@ -277,12 +269,7 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
fFilePath = SWTFactory.createText(comp, SWT.SINGLE | SWT.BORDER, 1);
String opath = getDialogSettings().get(OLD_PATH);
fFilePath.setText((opath == null ? IInternalDebugCoreConstants.EMPTY_STRING : opath));
- fFilePath.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setPageComplete(isComplete());
- }
- });
+ fFilePath.addModifyListener(e -> setPageComplete(isComplete()));
Button button = SWTFactory.createPushButton(comp, WizardMessages.ExportLaunchConfigurationsWizardPage_0, null, GridData.END);
button.addSelectionListener(new SelectionAdapter() {
@Override
@@ -308,8 +295,8 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
protected boolean isComplete() {
Object[] elements = fViewer.getCheckedElements();
boolean oneconfig = false;
- for(int i = 0; i < elements.length; i++) {
- if(elements[i] instanceof ILaunchConfiguration) {
+ for (Object element : elements) {
+ if (element instanceof ILaunchConfiguration) {
oneconfig = true;
break;
}
@@ -364,13 +351,13 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
File newfile = null;
boolean owall = false, nowall = false;
MessageDialog dialog = null;
- for(int i = 0; i < configs.length; i++) {
+ for (Object config : configs) {
if (progressMonitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- if(configs[i] instanceof ILaunchConfiguration) {
+ if (config instanceof ILaunchConfiguration) {
try {
- LaunchConfiguration launchConfig = (LaunchConfiguration) configs[i];
+ LaunchConfiguration launchConfig = (LaunchConfiguration) config;
file = launchConfig.getFileStore();
if (file == null) {
if (errors == null) {
@@ -379,16 +366,16 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
errors.add(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), MessageFormat.format(WizardMessages.ExportLaunchConfigurationsWizardPage_19, new Object[] { launchConfig.getName() }), null));
} else {
newfile = new File(destpath.append(file.getName()).toOSString());
- if(newfile.exists() & !overwrite) {
+ if(newfile.exists() && !overwrite) {
if(nowall) {
continue;
}
dialog = new MessageDialog(DebugUIPlugin.getShell(), WizardMessages.ExportLaunchConfigurationsWizardPage_11, null, MessageFormat.format(WizardMessages.ExportLaunchConfigurationsWizardPage_12, new Object[] { file.getName() }), MessageDialog.QUESTION, new String[] {
- WizardMessages.ExportLaunchConfigurationsWizardPage_13,
- WizardMessages.ExportLaunchConfigurationsWizardPage_14,
- WizardMessages.ExportLaunchConfigurationsWizardPage_15,
- WizardMessages.ExportLaunchConfigurationsWizardPage_16,
- WizardMessages.ExportLaunchConfigurationsWizardPage_17 }, 0);
+ WizardMessages.ExportLaunchConfigurationsWizardPage_13,
+ WizardMessages.ExportLaunchConfigurationsWizardPage_14,
+ WizardMessages.ExportLaunchConfigurationsWizardPage_15,
+ WizardMessages.ExportLaunchConfigurationsWizardPage_16,
+ WizardMessages.ExportLaunchConfigurationsWizardPage_17 }, 0);
if(!owall) {
int ret = dialog.open();
switch(ret) {
@@ -421,15 +408,13 @@ public class ExportLaunchConfigurationsWizardPage extends WizardPage {
copyFile(file, newfile);
}
}
- }
- catch (IOException e ) {
+ } catch (IOException e) {
if (errors == null) {
errors = new ArrayList<>(configs.length);
}
errors.add(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(),
e.getMessage(), e));
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
if (errors == null) {
errors = new ArrayList<>(configs.length);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizard.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizard.java
index 932e01fd6..499359618 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizard.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/launchconfigurations/ImportLaunchConfigurationsWizard.java
@@ -13,12 +13,13 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.importexport.launchconfigurations;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* This class provides a wizard for importing launch configurations from the local
@@ -38,8 +39,9 @@ public class ImportLaunchConfigurationsWizard extends Wizard implements IImportW
*/
public ImportLaunchConfigurationsWizard() {
super();
- DebugUIPlugin plugin = DebugUIPlugin.getDefault();
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
+ IDialogSettings workbenchSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ImportLaunchConfigurationsWizard.class))
+ .getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(EXPORT_DIALOG_SETTINGS);
if (section == null) {
section = workbenchSettings.addNewSection(EXPORT_DIALOG_SETTINGS);
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 67bad5c5f..aa77749bf 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
@@ -15,8 +15,8 @@
package org.eclipse.debug.internal.ui.importexport.launchconfigurations;
import java.io.File;
+import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -56,8 +56,6 @@ import org.eclipse.ui.model.AdaptableList;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
-import com.ibm.icu.text.MessageFormat;
-
/**
* This class providers the one and only page for the import launch configurations wizard
* @since 3.4.0
@@ -169,15 +167,14 @@ public class ImportLaunchConfigurationsWizardPage extends WizardResourceImportPa
settings.put(OVERWRITE, fOverwrite.getSelection());
settings.put(OLD_PATH, fFromDirectory.getText().trim());
boolean overwrite = fOverwrite.getSelection();
- List<?> items = getSelectedResources();
File config, newconfig = null;
boolean owall = false, nowall = false;
MessageDialog dialog = null;
final List<File> filesToImport = new ArrayList<>();
- for (Iterator<?> iter = items.iterator(); iter.hasNext();) {
- config = (File) ((DebugFileSystemElement) iter.next()).getFileSystemObject();
+ for (Object resource : getSelectedResources()) {
+ config = (File) ((DebugFileSystemElement) resource).getFileSystemObject();
newconfig = new File(new Path(LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.toOSString()).append(config.getName()).toOSString());
- if(newconfig.exists() & !overwrite) {
+ if(newconfig.exists() && !overwrite) {
if(nowall) {
continue;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ClosedProjectFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ClosedProjectFilter.java
index 8e662cd58..b24b4a7b3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ClosedProjectFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ClosedProjectFilter.java
@@ -53,8 +53,8 @@ public class ClosedProjectFilter extends ViewerFilter {
if(resources == null) {
return true;
}
- for(int i = 0; i < resources.length; i++) {
- IProject project= resources[i].getProject();
+ for (IResource resource : resources) {
+ IProject project = resource.getProject();
//we don't want overlap with the deleted projects filter, so we need to allow projects that don't exist through
if(project != null && (project.isOpen() || !project.exists())) {
return true;
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 5f2d1a69b..cd67998f5 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
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -31,9 +32,6 @@ import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Shell;
-import com.ibm.icu.text.MessageFormat;
-
-
public class CompileErrorProjectPromptStatusHandler implements IStatusHandler {
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java
index 335839714..773612fc0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationAction.java
@@ -77,8 +77,8 @@ public class CreateLaunchConfigurationAction extends AbstractLaunchConfiguration
ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
tabGroup.createTabs(dialog, dialog.getMode());
ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].setLaunchConfigurationDialog(dialog);
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.setLaunchConfigurationDialog(dialog);
}
tabGroup.setDefaults(wc);
tabGroup.dispose();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java
index 64270d5ef..75b35c68e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CreateLaunchConfigurationPrototypeAction.java
@@ -80,8 +80,8 @@ public class CreateLaunchConfigurationPrototypeAction extends AbstractLaunchConf
ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
tabGroup.createTabs(dialog, dialog.getMode());
ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].setLaunchConfigurationDialog(dialog);
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.setLaunchConfigurationDialog(dialog);
}
tabGroup.setDefaults(wc);
tabGroup.dispose();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeletedProjectFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeletedProjectFilter.java
index 1eaf76cee..03d8ce712 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeletedProjectFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/DeletedProjectFilter.java
@@ -51,8 +51,8 @@ public class DeletedProjectFilter extends ViewerFilter {
if(resources == null) {
return true;
}
- for(int i = 0; i < resources.length; i++) {
- IProject project= resources[i].getProject();
+ for (IResource resource : resources) {
+ IProject project = resource.getProject();
if(project != null && project.exists()) {
return true;
}
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 75f5914c4..acdacf53b 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
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -36,7 +37,6 @@ import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
@@ -52,8 +52,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-
-import com.ibm.icu.text.MessageFormat;
+import org.osgi.framework.FrameworkUtil;
/**
* Dialog for organizing favorite launch configurations
@@ -100,12 +99,7 @@ public class FavoritesDialog extends TrayDialog {
/**
* Listener that delegates when the selection changes in a table
*/
- private ISelectionChangedListener fSelectionChangedListener= new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleFavoriteSelectionChanged();
- }
- };
+ private ISelectionChangedListener fSelectionChangedListener= event -> handleFavoriteSelectionChanged();
/**
* Listener that delegates when a key is pressed in a table
@@ -154,8 +148,8 @@ public class FavoritesDialog extends TrayDialog {
sfd.open();
Object[] selection = sfd.getResult();
if (selection != null) {
- for (int i = 0; i < selection.length; i++) {
- getFavorites().add((ILaunchConfiguration) selection[i]);
+ for (Object s : selection) {
+ getFavorites().add((ILaunchConfiguration) s);
}
updateStatus();
}
@@ -183,7 +177,7 @@ public class FavoritesDialog extends TrayDialog {
@Override
protected Point getInitialSize() {
- return new Point(350, 400);
+ return new Point(450, 500);
}
/**
@@ -202,8 +196,7 @@ public class FavoritesDialog extends TrayDialog {
List<?> selList = sel.toList();
Object[] movedFavs= new Object[getFavorites().size()];
int i;
- for (Iterator<?> favs = selList.iterator(); favs.hasNext();) {
- Object config = favs.next();
+ for (Object config : selList) {
i= getFavorites().indexOf(config);
movedFavs[i + direction]= config;
}
@@ -380,10 +373,8 @@ public class FavoritesDialog extends TrayDialog {
int taskSize = Math.abs(initial.length-current.size());//get task size
monitor.beginTask(LaunchConfigurationsMessages.FavoritesDialog_8, taskSize);//and set it
-
// removed favorites
- for (int i = 0; i < initial.length; i++) {
- ILaunchConfiguration configuration = initial[i];
+ for (ILaunchConfiguration configuration : initial) {
if (!current.contains(configuration)) {
// remove fav attributes
try {
@@ -452,7 +443,8 @@ public class FavoritesDialog extends TrayDialog {
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(FavoritesDialog.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
if (section == null) {
section = settings.addNewSection(getDialogSettingsSectionName());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java
index 3a80b7724..f064ec2af 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java
@@ -15,7 +15,6 @@ package org.eclipse.debug.internal.ui.launchConfigurations;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -66,14 +65,10 @@ public class LaunchConfigurationComparator extends WorkbenchViewerComparator {
if (fgCategories == null) {
fgCategories = new HashMap<>();
List<ILaunchConfigurationType> types = Arrays.asList(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes());
- Collections.sort(types, new Comparator<ILaunchConfigurationType>() {
- @Override
- public int compare(ILaunchConfigurationType o1, ILaunchConfigurationType o2) {
- ILaunchConfigurationType t1 = o1;
- ILaunchConfigurationType t2 = o2;
- return t1.getName().compareTo(t2.getName());
- }
-
+ Collections.sort(types, (o1, o2) -> {
+ ILaunchConfigurationType t1 = o1;
+ ILaunchConfigurationType t2 = o2;
+ return t1.getName().compareTo(t2.getName());
});
Iterator<ILaunchConfigurationType> iterator = types.iterator();
int i = 0;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java
index d28a1b810..be4735795 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationFilteredTree.java
@@ -32,7 +32,6 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.FilteredTree;
@@ -83,16 +82,11 @@ public final class LaunchConfigurationFilteredTree extends FilteredTree {
treeViewer.setUseHashlookup(true);
treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
if(fFilters != null) {
- for (int i = 0; i < fFilters.length; i++) {
- treeViewer.addFilter(fFilters[i]);
+ for (ViewerFilter filter : fFilters) {
+ treeViewer.addFilter(filter);
}
}
- treeViewer.getControl().addHelpListener(new HelpListener() {
- @Override
- public void helpRequested(HelpEvent evt) {
- handleHelpRequest(evt);
- }
- });
+ treeViewer.getControl().addHelpListener(this::handleHelpRequest);
return treeViewer;
}
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 1898e7821..95b9ce0b7 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
@@ -102,7 +102,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
* A comparator for the ordering of launch shortcut extensions
* @since 3.3
*/
- class ShortcutComparator implements Comparator<LaunchShortcutExtension> {
+ static class ShortcutComparator implements Comparator<LaunchShortcutExtension> {
/**
* @see Comparator#compare(Object, Object)
*/
@@ -197,9 +197,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
launchManager.addLaunchListener(this);
DebugUIPlugin.getDefault().addSaveParticipant(this);
//update histories for launches already registered
- ILaunch[] launches = launchManager.getLaunches();
- for (int i = 0; i < launches.length; i++) {
- launchAdded(launches[i]);
+ for (ILaunch launch : launchManager.getLaunches()) {
+ launchAdded(launch);
}
}
@@ -243,14 +242,10 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
return configurations;
}
List<ILaunchConfiguration> filteredConfigs = new ArrayList<>();
- ILaunchConfigurationType type = null;
- LaunchConfigurationTypeContribution contribution = null;
- ILaunchConfiguration configuration = null;
- for (int i = 0; i < configurations.length; i++) {
- configuration = configurations[i];
+ for (ILaunchConfiguration configuration : configurations) {
try {
- type = configuration.getType();
- contribution = new LaunchConfigurationTypeContribution(type);
+ ILaunchConfigurationType type = configuration.getType();
+ LaunchConfigurationTypeContribution contribution = new LaunchConfigurationTypeContribution(type);
if (DebugUIPlugin.doLaunchConfigurationFiltering(configuration) & !WorkbenchActivityHelper.filterItem(contribution)) {
filteredConfigs.add(configuration);
}
@@ -275,10 +270,10 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
return delegates;
}
HashSet<ILaunchDelegate> set = new HashSet<>();
- for(int i = 0; i < delegates.length; i++) {
+ for (ILaunchDelegate delegate : delegates) {
//filter by capabilities
- if(!WorkbenchActivityHelper.filterItem(new LaunchDelegateContribution(delegates[i]))) {
- set.add(delegates[i]);
+ if(!WorkbenchActivityHelper.filterItem(new LaunchDelegateContribution(delegate))) {
+ set.add(delegate);
}
}
return set.toArray(new ILaunchDelegate[set.size()]);
@@ -327,9 +322,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
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];
+ for (ILaunch launch : lManager.getLaunches()) {
if (launch != newLaunch && launch.isTerminated()) {
lManager.removeLaunch(launch);
}
@@ -434,8 +427,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
* @throws CoreException is an exception occurs
*/
protected void createEntry(Document doc, Element historyRootElement, ILaunchConfiguration[] configurations) throws CoreException {
- for (int i = 0; i < configurations.length; i++) {
- ILaunchConfiguration configuration = configurations[i];
+ for (ILaunchConfiguration configuration : configurations) {
if (configuration.exists()) {
Element launch = doc.createElement(IConfigurationElementConstants.LAUNCH);
launch.setAttribute(IConfigurationElementConstants.MEMENTO, configuration.getMemento());
@@ -561,18 +553,16 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element)node;
if (element.getNodeName().equals(IConfigurationElementConstants.MRU_HISTORY)) {
- ILaunchConfiguration[] configs = getLaunchConfigurations(element);
- for (int j = 0; j < configs.length; j++) {
- history.addHistory(configs[j], false);
+ for (ILaunchConfiguration config : getLaunchConfigurations(element)) {
+ history.addHistory(config, false);
}
} else if (element.getNodeName().equals(IConfigurationElementConstants.FAVORITES)) {
ILaunchConfiguration[] favs = getLaunchConfigurations(element);
history.setFavorites(favs);
// add any favorites that have been added to the workspace before this plug-in
// was loaded - @see bug 231600
- ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations();
- for (int j = 0; j < configurations.length; j++) {
- history.checkFavorites(configurations[j]);
+ for (ILaunchConfiguration configuration : getLaunchManager().getLaunchConfigurations()) {
+ history.checkFavorites(configuration);
}
}
}
@@ -627,9 +617,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
//touch the type to see if its type exists
launchConfig.getType();
if (launchConfig.exists()) {
- LaunchHistory history = null;
- for (int i = 0; i < histories.length; i++) {
- history = histories[i];
+ for (LaunchHistory history : histories) {
if (history.accepts(launchConfig) && history.getLaunchGroup().getMode().equals(mode)) {
history.addHistory(launchConfig, prepend);
}
@@ -651,8 +639,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
// Load the configuration elements into a Map
fLaunchShortcuts = new ArrayList<>(infos.length);
- for (int i = 0; i < infos.length; i++) {
- fLaunchShortcuts.add(new LaunchShortcutExtension(infos[i]));
+ for (IConfigurationElement info : infos) {
+ fLaunchShortcuts.add(new LaunchShortcutExtension(info));
}
Collections.sort(fLaunchShortcuts, new ShortcutComparator());
}
@@ -670,8 +658,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
// Load the configuration elements into a Map
fLaunchGroups = new HashMap<>(infos.length);
LaunchGroupExtension ext = null;
- for (int i = 0; i < infos.length; i++) {
- ext = new LaunchGroupExtension(infos[i]);
+ for (IConfigurationElement info : infos) {
+ ext = new LaunchGroupExtension(info);
fLaunchGroups.put(ext.getIdentifier(), ext);
}
}
@@ -779,16 +767,12 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
//copy into collection for hashcode matching
HashSet<String> typeset = new HashSet<>(ctypes.length);
Collections.addAll(typeset, ctypes);
- ILaunchConfiguration[] configurations = filterConfigs(getLaunchManager().getLaunchConfigurations());
- ILaunchConfiguration configuration = null;
- IResource[] resrcs = null;
- for(int i = 0; i < configurations.length; i++) {
- configuration = configurations[i];
+ for (ILaunchConfiguration configuration : filterConfigs(getLaunchManager().getLaunchConfigurations())) {
if(typeset.contains(configuration.getType().getIdentifier()) && acceptConfiguration(configuration)) {
- resrcs = configuration.getMappedResources();
+ IResource[] resrcs = configuration.getMappedResources();
if (resrcs != null) {
- for (int j = 0; j < resrcs.length; j++) {
- if (resource.equals(resrcs[j]) || resource.getFullPath().isPrefixOf(resrcs[j].getFullPath())) {
+ for (IResource res : resrcs) {
+ if (resource.equals(res) || resource.getFullPath().isPrefixOf(res.getFullPath())) {
list.add(configuration);
break;
}
@@ -908,13 +892,13 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
LaunchHistory history = getLaunchHistory(group.getIdentifier());
if(history != null) {
ILaunchConfiguration[] configs = history.getCompleteLaunchHistory();
- for(int i = 0; i < configs.length; i++) {
- if(configurations.contains(configs[i])) {
+ for (ILaunchConfiguration config : configs) {
+ if(configurations.contains(config)) {
if(resource instanceof IContainer) {
- return configs[i];
+ return config;
}
else {
- candidates.add(configs[i]);
+ candidates.add(config);
}
}
}
@@ -925,8 +909,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
try {
res = config.getMappedResources();
if(res != null) {
- for(int i = 0; i < res.length; i++) {
- if(res[i].equals(resource)) {
+ for (IResource re : res) {
+ if(re.equals(resource)) {
return config;
}
}
@@ -935,9 +919,9 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
catch(CoreException ce) {}
}
}
- for(int i = 0; i < configs.length; i++) {
- if(candidates.contains(configs[i])) {
- return configs[i];
+ for (ILaunchConfiguration config : configs) {
+ if(candidates.contains(config)) {
+ return config;
}
}
}
@@ -999,6 +983,9 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
base = DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT);
}
base = new Image(Display.getCurrent(), base, SWT.IMAGE_COPY);
+ // register the base image, to avoid nondisposed resource error
+ fErrorImages.put(key + "-baseImage", base); //$NON-NLS-1$
+
LaunchConfigurationTabImageDescriptor desc = new LaunchConfigurationTabImageDescriptor(base, LaunchConfigurationTabImageDescriptor.ERROR);
image = desc.createImage();
fErrorImages.put(key, image);
@@ -1059,8 +1046,8 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
ILaunchGroup[] groups = getLaunchGroups();
fLaunchHistories = new HashMap<>(groups.length);
ILaunchGroup extension = null;
- for (int i = 0; i < groups.length; i++) {
- extension = groups[i];
+ for (ILaunchGroup group : groups) {
+ extension = group;
if (extension.isPublic()) {
fLaunchHistories.put(extension.getIdentifier(), new LaunchHistory(extension));
}
@@ -1097,10 +1084,9 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
return null;
}
String category = type.getCategory();
- ILaunchGroup[] groups = getLaunchGroups();
ILaunchGroup extension = null;
- for (int i = 0; i < groups.length; i++) {
- extension = groups[i];
+ for (ILaunchGroup group : getLaunchGroups()) {
+ extension = group;
if (category == null) {
if (extension.getCategory() == null && extension.getMode().equals(mode)) {
return extension;
@@ -1147,10 +1133,7 @@ public class LaunchConfigurationManager implements ILaunchListener, ISavePartici
String id = type.getIdentifier();
String name = id + ".SHARED_INFO"; //$NON-NLS-1$
ILaunchConfiguration shared = null;
- ILaunchConfiguration[] configurations = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(type);
- ILaunchConfiguration configuration = null;
- for (int i = 0; i < configurations.length; i++) {
- configuration = configurations[i];
+ for (ILaunchConfiguration configuration : DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(type)) {
if (configuration.getName().equals(name)) {
shared = configuration;
break;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java
index d560fae23..5e0719fc4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java
@@ -115,8 +115,8 @@ public class LaunchConfigurationPresentationManager {
String typeId = null;
Map<Set<String>, LaunchConfigurationTabGroupExtension> map = null;
List<Set<String>> modes = null;
- for (int i = 0; i < groups.length; i++) {
- group = new LaunchConfigurationTabGroupExtension(groups[i]);
+ for (IConfigurationElement g : groups) {
+ group = new LaunchConfigurationTabGroupExtension(g);
typeId = group.getTypeIdentifier();
map = fTabGroupExtensions.get(typeId);
if (map == null) {
@@ -164,8 +164,8 @@ public class LaunchConfigurationPresentationManager {
IConfigurationElement[] elements = epoint.getConfigurationElements();
LaunchConfigurationTabExtension tab = null;
Hashtable<String, LaunchConfigurationTabExtension> element = null;
- for(int i = 0; i < elements.length; i++) {
- tab = new LaunchConfigurationTabExtension(elements[i]);
+ for (IConfigurationElement e : elements) {
+ tab = new LaunchConfigurationTabExtension(e);
element = fContributedTabs.get(tab.getTabGroupId());
if(element == null) {
element = new Hashtable<>();
@@ -254,29 +254,28 @@ public class LaunchConfigurationPresentationManager {
return tabs;
}
HashSet<LaunchConfigurationTabExtension> set = new HashSet<>();
- for(int i = 0; i < tabs.length; i ++) {
- //filter capabilities
- if(!WorkbenchActivityHelper.filterItem(new LaunchTabContribution(tabs[i]))) {
- //filter to preferred delegate (if there is one)
+ for (LaunchConfigurationTabExtension tab : tabs) {
+ //filter capabilities
+ if (!WorkbenchActivityHelper.filterItem(new LaunchTabContribution(tab))) {
+ //filter to preferred delegate (if there is one)
Set<String> modes = config.getModes();
modes.add(mode);
ILaunchDelegate delegate = config.getPreferredDelegate(modes);
if(delegate == null) {
delegate = config.getType().getPreferredDelegate(modes);
}
- Set<String> delegateSet = tabs[i].getDelegateSet();
- if(delegate != null) {
- if(delegateSet.isEmpty() || delegateSet.contains(delegate.getId())) {
- set.add(tabs[i]);
+ Set<String> delegateSet = tab.getDelegateSet();
+ if (delegate != null) {
+ if (delegateSet.isEmpty() || delegateSet.contains(delegate.getId())) {
+ set.add(tab);
}
- }
- else {
+ } else {
//otherwise filter based on the collection of delegates for the modes
ILaunchDelegate[] delegates = config.getType().getDelegates(modes);
- for(int j = 0; j < delegates.length; j++) {
- if(delegateSet.isEmpty() || delegateSet.contains(delegates[j].getId())) {
+ for (ILaunchDelegate d : delegates) {
+ if (delegateSet.isEmpty() || delegateSet.contains(d.getId())) {
//associated with all modes and tab groups or only specific ones if indicated
- set.add(tabs[i]);
+ set.add(tab);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java
index dcebb0f8d..aa71b9862 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java
@@ -105,8 +105,8 @@ public class LaunchConfigurationTabGroupExtension {
IConfigurationElement element = null;
String perspective = null, mode = null;
Set<String> mset = null;
- for (int i = 0; i < modes.length; i++) {
- element = modes[i];
+ for (IConfigurationElement m : modes) {
+ element = m;
mode = element.getAttribute(IConfigurationElementConstants.MODE);
mset = new HashSet<>();
mset.add(mode);
@@ -192,8 +192,8 @@ public class LaunchConfigurationTabGroupExtension {
IConfigurationElement child = null;
String mode = null;
HashSet<String> set = null;
- for (int i = 0; i < children.length; i++) {
- child = children[i];
+ for (IConfigurationElement c : children) {
+ child = c;
mode = child.getAttribute(IConfigurationElementConstants.MODE);
if(mode != null) {
set = new HashSet<>();
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 b09e8fddd..f274d52a9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -19,6 +19,7 @@ package org.eclipse.debug.internal.ui.launchConfigurations;
import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -79,12 +80,8 @@ import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.WorkbenchJob;
-import com.ibm.icu.text.MessageFormat;
-
/**
* A viewer that displays tabs for a launch configuration, with apply and revert
* buttons.
@@ -366,10 +363,11 @@ public class LaunchConfigurationTabGroupViewer {
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), 1, width);
- SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_10, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_LINK_PROTO), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_11, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_UNLINK_PROTO), 1, width);
SWTFactory.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_12, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_RESET_PROTO), 1, width);
+ SWTFactory.createHorizontalSpacer(parent, 2);
+ SWTFactory.createLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3, width);
SWTFactory.createHorizontalSpacer(parent, 2);
Link link = new Link(parent, SWT.LEFT | SWT.WRAP);
@@ -398,7 +396,6 @@ public class LaunchConfigurationTabGroupViewer {
fTabFolder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.FLAT);
fTabFolder.setSelectionBackground(new Color[] {c1, c2}, new int[] {100}, true);
fTabFolder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$
- fTabFolder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
fTabFolder.setBorderVisible(true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
@@ -587,7 +584,8 @@ public class LaunchConfigurationTabGroupViewer {
} else {
fOptionsErrorLabel.setImage(null);
}
- fViewform.layout(true, true);
+ fOptionsLink.requestLayout();
+ fOptionsErrorLabel.requestLayout();
}
/**
@@ -806,13 +804,14 @@ public class LaunchConfigurationTabGroupViewer {
fApplyButton.setVisible(visible);
fRevertButton.setVisible(visible);
fOptionsLink.setVisible(visible);
+ StackLayout layout = (StackLayout)fTabPlaceHolder.getLayout();
if(visible) {
- ((StackLayout)fTabPlaceHolder.getLayout()).topControl = fGroupComposite;
+ layout.topControl = fGroupComposite;
}
else {
- ((StackLayout)fTabPlaceHolder.getLayout()).topControl = fGettingStarted;
+ layout.topControl = fGettingStarted;
}
- fTabPlaceHolder.layout(true, true);
+ layout.topControl.requestLayout();
}
private void updateShowCommandLineVisibility(boolean visible) {
@@ -906,21 +905,21 @@ public class LaunchConfigurationTabGroupViewer {
CTabItem tab = null;
String name = IInternalDebugCoreConstants.EMPTY_STRING;
Control control = null;
- for (int i = 0; i < tabs.length; i++) {
+ for (ILaunchConfigurationTab t : tabs) {
tab = new CTabItem(fTabFolder, SWT.BORDER);
- name = tabs[i].getName();
+ name = t.getName();
if (name == null) {
name = LaunchConfigurationsMessages.LaunchConfigurationDialog_unspecified_28;
}
tab.setText(name);
- tab.setImage(tabs[i].getImage());
+ tab.setImage(t.getImage());
ScrolledComposite sc = new ScrolledComposite(tab.getParent(), SWT.V_SCROLL | SWT.H_SCROLL);
sc.setFont(tab.getParent().getFont());
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
sc.setShowFocusedControl(true);
- tabs[i].createControl(sc);
- control = tabs[i].getControl();
+ t.createControl(sc);
+ control = t.getControl();
if (control != null) {
sc.setContent(control);
sc.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT));
@@ -932,9 +931,9 @@ public class LaunchConfigurationTabGroupViewer {
setActiveTab(tabs[0]);
}
// select same tab as before, if possible
- for (int i = 0; i < tabs.length; i++) {
- if (tabs[i].getClass().equals(tabKind)) {
- setActiveTab(tabs[i]);
+ for (ILaunchConfigurationTab t : tabs) {
+ if (t.getClass().equals(tabKind)) {
+ setActiveTab(t);
break;
}
}
@@ -983,8 +982,8 @@ public class LaunchConfigurationTabGroupViewer {
}
tabGroup.createTabs(getLaunchConfigurationDialog(), getLaunchConfigurationDialog().getMode());
ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].setLaunchConfigurationDialog(getLaunchConfigurationDialog());
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
}
};
@@ -1174,8 +1173,8 @@ public class LaunchConfigurationTabGroupViewer {
if (tabs == null) {
return false;
}
- for (int i = 0; i < tabs.length; i++) {
- if (!tabs[i].canSave()) {
+ for (ILaunchConfigurationTab tab : tabs) {
+ if (!tab.canSave()) {
return false;
}
}
@@ -1202,8 +1201,8 @@ public class LaunchConfigurationTabGroupViewer {
if (tabs == null) {
return false;
}
- for (int i = 0; i < tabs.length; i++) {
- if (!tabs[i].isValid(getWorkingCopy())) {
+ for (ILaunchConfigurationTab tab : tabs) {
+ if (!tab.isValid(getWorkingCopy())) {
return false;
}
}
@@ -1306,8 +1305,7 @@ public class LaunchConfigurationTabGroupViewer {
}
ILaunchConfigurationTab[] allTabs = getTabs();
- for (int i = 0; i < allTabs.length; i++) {
- ILaunchConfigurationTab tab = allTabs[i];
+ for (ILaunchConfigurationTab tab : allTabs) {
if (tab == activeTab) {
continue;
}
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 f45c6287d..f2f9e11f0 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
@@ -45,7 +45,7 @@ public class LaunchConfigurationTabGroupWrapper implements ILaunchConfigurationT
*
* @since 3.5
*/
- class TabCollector implements Iterator<ILaunchConfigurationTab> {
+ static class TabCollector implements Iterator<ILaunchConfigurationTab> {
private HashSet<String> idSet = null;
private ArrayList<ILaunchConfigurationTab> tabList = null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
index 556fb9ef2..d8fe82eda 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java
@@ -93,6 +93,7 @@ public class LaunchConfigurationTreeContentProvider implements ITreeContentProvi
configs.add(launchConfig);
}
}
+
ILaunchConfiguration[] prototypes = getLaunchManager().getLaunchConfigurations(type, ILaunchConfiguration.PROTOTYPE);
Collections.addAll(configs, prototypes);
return configs.toArray(new ILaunchConfiguration[0]);
@@ -166,8 +167,7 @@ public class LaunchConfigurationTreeContentProvider implements ITreeContentProvi
List<ILaunchConfigurationType> filteredTypes = new ArrayList<>();
String mode = getMode();
LaunchConfigurationTypeContribution contribution;
- for (int i = 0; i < allTypes.length; i++) {
- ILaunchConfigurationType type = allTypes[i];
+ for (ILaunchConfigurationType type : allTypes) {
contribution= new LaunchConfigurationTypeContribution(type);
if (isVisible(type, mode) && !WorkbenchActivityHelper.filterItem(contribution)) {
filteredTypes.add(type);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTypeFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTypeFilter.java
index 90446202c..24508bd84 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTypeFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTypeFilter.java
@@ -45,8 +45,8 @@ public class LaunchConfigurationTypeFilter extends ViewerFilter {
if(element instanceof ILaunchConfigurationType) {
IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
String[] types = store.getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,"); //$NON-NLS-1$
- for(int i = 0; i < types.length; i++) {
- if(types[i].equals(((ILaunchConfigurationType)element).getIdentifier())) {
+ for (String type : types) {
+ if (type.equals(((ILaunchConfigurationType)element).getIdentifier())) {
return false;
}
}
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 39537b252..415a6f781 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
@@ -16,6 +16,8 @@
package org.eclipse.debug.internal.ui.launchConfigurations;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -50,8 +52,6 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PatternFilter;
-import com.ibm.icu.text.MessageFormat;
-
/**
* A tree view of launch configurations
*/
@@ -319,11 +319,11 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
if (viewer != null) {
try {
viewer.getControl().setRedraw(false);
- if (configuration.getPrototype() != null) {
- viewer.add(configuration.getPrototype(), configuration);
- } else {
- viewer.add(configuration.getType(), configuration);
+ Object parentElement = configuration.getPrototype();
+ if (parentElement == null) {
+ parentElement = configuration.getType();
}
+ viewer.add(parentElement, configuration);
// if moved, remove original now
if (from != null) {
viewer.remove(from);
@@ -332,6 +332,10 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
viewer.setSelection(new StructuredSelection(configuration), true);
}
updateFilterLabel();
+ // Need to refresh here, bug 559758
+ if (!configuration.isLocal()) {
+ viewer.refresh(parentElement);
+ }
}
catch (CoreException e) {}
finally {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java
index c82e26bd7..54943724c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java
@@ -173,12 +173,12 @@ public class LaunchConfigurationViewer extends TreeViewer {
Object[] types = cp.getElements(null);
LaunchGroupFilter filter = new LaunchGroupFilter(((LaunchConfigurationsDialog)LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog()).getLaunchGroup());
ILaunchConfiguration[] configs = null;
- for(int i = 0; i < types.length; i++) {
- if(filter.select(this, types[i], null)) {
+ for (Object type : types) {
+ if (filter.select(this, type, null)) {
fTotalCount++;
- configs = (ILaunchConfiguration[]) cp.getChildren(types[i]);
- for(int j = 0; j < configs.length; j++) {
- if(LaunchConfigurationManager.isVisible(configs[j])) {
+ configs = (ILaunchConfiguration[]) cp.getChildren(type);
+ for (ILaunchConfiguration config : configs) {
+ if (LaunchConfigurationManager.isVisible(config)) {
fTotalCount++;
}
}
@@ -199,9 +199,7 @@ public class LaunchConfigurationViewer extends TreeViewer {
TreeItem[] items = getTree().getItems();
count += items.length;
boolean expanded = false;
- TreeItem item = null;
- for(int i = 0; i < items.length; i++) {
- item = items[i];
+ for (TreeItem item : items) {
expanded = item.getExpanded();
setExpandedState(item.getData(), true);
count += item.getItems().length;
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 e40a5d078..f06c5fed5 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
@@ -17,10 +17,10 @@
package org.eclipse.debug.internal.ui.launchConfigurations;
import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
@@ -61,7 +61,6 @@ import org.eclipse.jface.operation.ModalContext;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -93,8 +92,7 @@ import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.WorkbenchJob;
-
-import com.ibm.icu.text.MessageFormat;
+import org.osgi.framework.FrameworkUtil;
/**
* The dialog used to edit and launch launch configurations.
@@ -235,6 +233,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
private DeletedProjectFilter fDeletedProjectFilter;
private LaunchConfigurationTypeFilter fLCTFilter;
private WorkingSetsFilter fWorkingSetsFilter;
+ private UniqueLaunchConfigurationFileFilter fUniqueLaunchConfugurationFileFilter;
/**
* set of reserved names that should not be considered when generating a new name for a launch configuration
@@ -590,20 +589,17 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
GridData gd = new GridData(GridData.FILL_BOTH);
control.setLayoutData(gd);
viewForm.setContent(viewFormContents);
- AbstractLaunchConfigurationAction.IConfirmationRequestor requestor = new AbstractLaunchConfigurationAction.IConfirmationRequestor() {
- @Override
- public boolean getConfirmation() {
- int status = shouldSaveCurrentConfig();
- if(status == IDialogConstants.YES_ID) {
- fTabViewer.handleApplyPressed();
- return true;
- }
- else if(status == IDialogConstants.NO_ID) {
- fTabViewer.handleRevertPressed();
- return true;
- }
- return false;
+ AbstractLaunchConfigurationAction.IConfirmationRequestor requestor = () -> {
+ int status = shouldSaveCurrentConfig();
+ if(status == IDialogConstants.YES_ID) {
+ fTabViewer.handleApplyPressed();
+ return true;
}
+ else if(status == IDialogConstants.NO_ID) {
+ fTabViewer.handleRevertPressed();
+ return true;
+ }
+ return false;
};
getDuplicateAction().setConfirmationRequestor(requestor);
getExportAction().setConfirmationRequestor(requestor);
@@ -612,19 +608,16 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
getLinkPrototypeAction().setConfirmationRequestor(requestor);
getUnlinkPrototypeAction().setConfirmationRequestor(requestor);
getResetWithPrototypeValuesAction().setConfirmationRequestor(requestor);
- ((StructuredViewer) viewer).addPostSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleLaunchConfigurationSelectionChanged(event);
- getNewAction().setEnabled(getNewAction().isEnabled());
- getNewPrototypeAction().setEnabled(getNewPrototypeAction().isEnabled());
- getDeleteAction().setEnabled(getDeleteAction().isEnabled());
- getExportAction().setEnabled(getExportAction().isEnabled());
- getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
- getLinkPrototypeAction().setEnabled(getLinkPrototypeAction().isEnabled());
- getUnlinkPrototypeAction().setEnabled(getUnlinkPrototypeAction().isEnabled());
- getResetWithPrototypeValuesAction().setEnabled(getResetWithPrototypeValuesAction().isEnabled());
- }
+ ((StructuredViewer) viewer).addPostSelectionChangedListener(event -> {
+ handleLaunchConfigurationSelectionChanged(event);
+ getNewAction().setEnabled(getNewAction().isEnabled());
+ getNewPrototypeAction().setEnabled(getNewPrototypeAction().isEnabled());
+ getDeleteAction().setEnabled(getDeleteAction().isEnabled());
+ getExportAction().setEnabled(getExportAction().isEnabled());
+ getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
+ getLinkPrototypeAction().setEnabled(getLinkPrototypeAction().isEnabled());
+ getUnlinkPrototypeAction().setEnabled(getUnlinkPrototypeAction().isEnabled());
+ getResetWithPrototypeValuesAction().setEnabled(getResetWithPrototypeValuesAction().isEnabled());
});
return comp;
}
@@ -653,6 +646,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_FILTER_WORKING_SETS)) {
filters.add(fWorkingSetsFilter);
}
+ fUniqueLaunchConfugurationFileFilter = new UniqueLaunchConfigurationFileFilter();
+ filters.add(fUniqueLaunchConfugurationFileFilter);
return filters.toArray(new ViewerFilter[filters.size()]);
}
@@ -755,7 +750,9 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @return IDialogSettings
*/
protected IDialogSettings getDialogSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(LaunchConfigurationDialog.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
if (section == null) {
section = settings.addNewSection(getDialogSettingsSectionName());
@@ -1159,8 +1156,8 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog();
tabGroup.createTabs(dialog, dialog.getMode());
ILaunchConfigurationTab[] tabs = tabGroup.getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].setLaunchConfigurationDialog(dialog);
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.setLaunchConfigurationDialog(dialog);
}
tabGroup.setDefaults(wc);
tabGroup.dispose();
@@ -1259,19 +1256,18 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
String type = IInternalDebugCoreConstants.EMPTY_STRING;
//if the item is not in the list and is expanded add it, otherwise if it
//is not expanded do a remove...either way for the else we query the list
- for(int i = 0; i < items.length; i++) {
- type = ((ILaunchConfigurationType)items[i].getData()).getIdentifier();
- if(!list.contains(type) & items[i].getExpanded()) {
+ for (TreeItem item : items) {
+ type = ((ILaunchConfigurationType) item.getData()).getIdentifier();
+ if (!list.contains(type) & item.getExpanded()) {
list.add(type);
- }
- else if(!items[i].getExpanded()) {
+ } else if (!item.getExpanded()) {
list.remove(type);
}
}
value = IInternalDebugCoreConstants.EMPTY_STRING;
//build the preference string
- for (Iterator<String> iter = list.iterator(); iter.hasNext();) {
- value += iter.next() + DELIMITER;
+ for (String segment : list) {
+ value += segment + DELIMITER;
}
settings.put(DIALOG_EXPANDED_NODES, value);
}
@@ -1302,10 +1298,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
catch (CoreException e) {DebugUIPlugin.log(e);}
}
}
- for(int i = 0; i < nodes.length; i++) {
- for(int k = 0; k < items.length; k++) {
- ILaunchConfigurationType type = (ILaunchConfigurationType)items[k].getData();
- if(type.getIdentifier().equals(nodes[i])) {
+ for (String node : nodes) {
+ for (TreeItem item : items) {
+ ILaunchConfigurationType type = (ILaunchConfigurationType) item.getData();
+ if (type.getIdentifier().equals(node)) {
toexpand.add(type);
}
}
@@ -1341,7 +1337,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* @since 3.13
*/
public void refreshLaunchConfigurationView() {
- fLaunchConfigurationView.getTreeViewer().refresh();
+ LaunchConfigurationView view = fLaunchConfigurationView;
+ if (view != null) {
+ view.getTreeViewer().refresh();
+ }
}
/**
@@ -1659,7 +1658,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
TreeViewer viewer = fLaunchConfigurationView.getTreeViewer();
- boolean newvalue = Boolean.valueOf(event.getNewValue().toString()).booleanValue();
+ boolean newvalue = Boolean.parseBoolean(event.getNewValue().toString());
if(event.getProperty().equals(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_CLOSED)) {
updateFilter(newvalue, fClosedProjectFilter);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
index d2ed415e3..84a080257 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java
@@ -63,6 +63,7 @@ public class LaunchConfigurationsMessages extends NLS {
public static String CommonTab_AttributeLabel_AppendToFile;
public static String CommonTab_AttributeLabel_LaunchInBackground;
public static String CommonTab_AttributeLabel_FavoriteGroups;
+ public static String CommonTab_AttributeLabel_TerminateDescendants;
public static String CompileErrorProjectPromptStatusHandler_0;
public static String CompileErrorProjectPromptStatusHandler_1;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
index f042a9e5c..96ac5b2da 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2019 IBM Corporation and others.
+# Copyright (c) 2000, 2022 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -16,7 +16,7 @@
###############################################################################
CommonTab__Browse_6=&Browse...
-CommonTab__Common_15=&Common
+CommonTab__Common_15=Common
CommonTab_Display_in_favorites_menu__10=Display in favo&rites menu
CommonTab_Invalid_shared_configuration_location_14=Invalid shared configuration location
CommonTab_Invalid_stdin_file_location_15=No file specified for process input
@@ -55,6 +55,7 @@ CommonTab_AttributeLabel_CaptureInFile=Capture in file
CommonTab_AttributeLabel_AppendToFile=Append to file
CommonTab_AttributeLabel_LaunchInBackground=Launch in background
CommonTab_AttributeLabel_FavoriteGroups=Favorite groups
+CommonTab_AttributeLabel_TerminateDescendants=&Terminate child-processes if terminating the launched process
CompileErrorPromptStatusHandler_0=Errors in Workspace
CompileErrorPromptStatusHandler_1=Errors exist in a required project. Continue launch?
@@ -71,7 +72,7 @@ LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configur
LaunchConfigurationTabGroupViewer_1=Configure launch settings from this dialog:
LaunchConfigurationTabGroupViewer_2=- Press the 'New Configuration' button to create a configuration of the selected type.
-LaunchConfigurationTabGroupViewer_3=- Edit or view an existing configuration by selecting it.
+LaunchConfigurationTabGroupViewer_3=Edit or view an existing configuration by selecting it.
LaunchConfigurationTabGroupViewer_4=- Press the 'Delete' button to remove the selected configuration.
LaunchConfigurationTabGroupViewer_6=- Press the 'Duplicate' button to copy the selected configuration.
LaunchConfigurationTabGroupViewer_5=Configure launch perspective settings from the <a>'Perspectives'</a> preference page.
@@ -104,7 +105,7 @@ LaunchConfigurationDialog_Name_required_for_launch_configuration_11=A name is re
LaunchConfigurationEditDialog_0=Modify configuration and continue.
LaunchConfigurationEditDialog_1=Con&tinue
LaunchConfigurationDialog_Ready_to_launch_2=Ready to launch
-LaunchConfigurationDialog_The_configuration___29=The configuration "{0}" has unsaved changes. Do you wish to save them?
+LaunchConfigurationDialog_The_configuration___29=Save the changes in the configuration "{0}"?
LaunchConfigurationDialog_The_configuration___35=The configuration "{0}" has unsaved changes that CANNOT be saved because of the following error:\n\n
LaunchConfigurationFilteredTree_discard_changes=Discard Changes
LaunchConfigurationDialog_unspecified_28=unspecified
@@ -112,8 +113,8 @@ LaunchConfigurationDialog_Save_Button=&Save
LaunchConfigurationDialog_Dont_Save_Button=Do&n't Save
LaunchConfigurationDialog_Discard_Button=&Discard
LaunchConfigurationDialog_Dont_Discard_Button=Do&n't Discard
-LaunchConfigurationDialog_Do_you_wish_to_delete_the_selected_launch_configurations__1=Do you wish to delete the selected launch configurations?
-LaunchConfigurationDialog_Do_you_wish_to_delete_the_selected_launch_configuration__2=Do you wish to delete the selected launch configuration?
+LaunchConfigurationDialog_Do_you_wish_to_delete_the_selected_launch_configurations__1=Delete the selected launch configurations?
+LaunchConfigurationDialog_Do_you_wish_to_delete_the_selected_launch_configuration__2=Delete the selected launch configuration?
LaunchConfigurationDialog_Confirm_Launch_Configuration_Deletion_3=Confirm Launch Configuration Deletion
LaunchConfigurationDialog_Close_1=Close
LaunchConfigurationDialog_Revert_2=Re&vert
@@ -253,7 +254,7 @@ OrganizeFavoritesAction_0=Organize Fa&vorites...
PerspectiveManager_12=Confirm Perspective Switch
PerspectiveManager_13=This kind of launch is configured to open the {0} perspective when it suspends. Do you want to switch to this perspective now?
PerspectiveManager_15=This kind of launch is associated with the {0} perspective. Do you want to switch to this perspective now?
-PerspectiveManager_suspend_description=This kind of launch is configured to open the {0} perspective when it suspends.\n\n{1}\n\nDo you want to switch to this perspective now?
+PerspectiveManager_suspend_description=This kind of launch is configured to open the {0} perspective when it suspends.\n\n{1}\n\nSwitch to this perspective?
PerspectiveManager_launch_description=This kind of launch is associated with the {0} perspective.\n\n{1}\n\nDo you want to switch to this perspective now?
PerspectiveManager_switch=&Switch
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java
index 5443526c7..4c84ff29d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchHistory.java
@@ -51,7 +51,7 @@ public class LaunchHistory implements ILaunchListener, ILaunchConfigurationListe
/**
* Ordered listing of the favorites of this history
*/
- private Vector<ILaunchConfiguration> fFavorites = new Vector<>();
+ private List<ILaunchConfiguration> fFavorites = new ArrayList<>();
/**
* A new saved flag to prevent save participants from serializing unchanged launch histories.
@@ -230,7 +230,7 @@ public class LaunchHistory implements ILaunchListener, ILaunchConfigurationListe
* @since 3.3
*/
public synchronized ILaunchConfiguration[] getCompleteLaunchHistory() {
- Vector<ILaunchConfiguration> history = new Vector<>();
+ ArrayList<ILaunchConfiguration> history = new ArrayList<>();
try {
for (ILaunchConfiguration config : fCompleteHistory) {
if(config.exists() && DebugUIPlugin.doLaunchConfigurationFiltering(config) &&
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 e8b188773..140647c47 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
@@ -67,7 +67,7 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
/**
* Command handler for launch shortcut key binding.
*/
- private class LaunchCommandHandler extends AbstractHandler {
+ private static class LaunchCommandHandler extends AbstractHandler {
// the shortcut to invoke
private LaunchShortcutExtension fShortcut;
private String fMode;
@@ -198,9 +198,8 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
}
IConfigurationElement[] labels = context.getChildren(IConfigurationElementConstants.CONTEXT_LABEL);
fContextLabels = new ArrayList<>(labels.length);
- for (int i = 0; i < labels.length; i++) {
- fContextLabels.add(new Pair(labels[i].getAttribute(IConfigurationElementConstants.MODE),
- labels[i].getAttribute(IConfigurationElementConstants.LABEL)));
+ for (IConfigurationElement label : labels) {
+ fContextLabels.add(new Pair(label.getAttribute(IConfigurationElementConstants.MODE), label.getAttribute(IConfigurationElementConstants.LABEL)));
}
}
// pick out the first occurance of the "name" bound to "mode"
@@ -223,8 +222,8 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
fAssociatedTypes = new HashSet<>();
IConfigurationElement[] children = fConfig.getChildren(IConfigurationElementConstants.CONFIGURATION_TYPES);
String id = null;
- for (int i = 0; i < children.length; i++) {
- id = children[i].getAttribute(IConfigurationElementConstants.ID);
+ for (IConfigurationElement child : children) {
+ id = child.getAttribute(IConfigurationElementConstants.ID);
if(id != null) {
fAssociatedTypes.add(id);
}
@@ -256,9 +255,9 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
}
//load descriptions for child description elements
IConfigurationElement[] children = fConfig.getChildren(IConfigurationElementConstants.DESCRIPTION);
- for(int i = 0; i < children.length; i++) {
- String lmode = children[i].getAttribute(IConfigurationElementConstants.MODE);
- descr = children[i].getAttribute(IConfigurationElementConstants.DESCRIPTION);
+ for (IConfigurationElement child : children) {
+ String lmode = child.getAttribute(IConfigurationElementConstants.MODE);
+ descr = child.getAttribute(IConfigurationElementConstants.DESCRIPTION);
fDescriptions.put(lmode, descr);
}
}
@@ -387,8 +386,8 @@ public class LaunchShortcutExtension implements ILaunchShortcut2, IPluginContrib
if (fPerspectives == null) {
IConfigurationElement[] perspectives = getConfigurationElement().getChildren(IConfigurationElementConstants.PERSPECTIVE);
fPerspectives = new ArrayList<>(perspectives.length);
- for (int i = 0; i < perspectives.length; i++) {
- fPerspectives.add(perspectives[i].getAttribute(IConfigurationElementConstants.ID));
+ for (IConfigurationElement perspective : perspectives) {
+ fPerspectives.add(perspective.getAttribute(IConfigurationElementConstants.ID));
}
}
return fPerspectives;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java
index f4601baf7..8b4e3705e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
+import java.text.MessageFormat;
import java.util.List;
import org.eclipse.core.resources.IResource;
@@ -24,9 +25,7 @@ import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -34,8 +33,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Specialized dialog for showing/selecting a specific launch shortcut extension, and allowing it
* to be marked to be set as the default
@@ -90,15 +87,12 @@ public class LaunchShortcutSelectionDialog extends AbstractDebugListSelectionDia
@Override
protected void addViewerListeners(StructuredViewer viewer) {
super.addViewerListeners(viewer);
- viewer.addSelectionChangedListener(new ISelectionChangedListener(){
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = event.getStructuredSelection();
- if (!selection.isEmpty()) {
- LaunchShortcutExtension shortcutSource = (LaunchShortcutExtension) selection.getFirstElement();
- String description = shortcutSource.getShortcutDescription(fMode);
- fDescriptionText.setText((description == null ? LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_3 : description));
- }
+ viewer.addSelectionChangedListener(event -> {
+ IStructuredSelection selection = event.getStructuredSelection();
+ if (!selection.isEmpty()) {
+ LaunchShortcutExtension shortcutSource = (LaunchShortcutExtension) selection.getFirstElement();
+ String description = shortcutSource.getShortcutDescription(fMode);
+ fDescriptionText.setText((description == null ? LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_3 : description));
}
});
}
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 606540170..7466647b4 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
@@ -16,6 +16,7 @@ package org.eclipse.debug.internal.ui.launchConfigurations;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -70,8 +71,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import com.ibm.icu.text.MessageFormat;
-
/**
* The perspective manager manages the 'perspective' settings
* defined by launch configurations. Specifically it:
@@ -282,9 +281,9 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
* launches to be registered.
*/
public void startup() {
+ initPerspectives();
DebugUIPlugin.getDefault().addSaveParticipant(this);
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
- initPerspectives();
}
/**
@@ -311,8 +310,7 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
Runnable r = () -> {
IContextActivation[] activations = fLaunchToContextActivations.remove(launch);
if (activations != null) {
- for (int i = 0; i < activations.length; i++) {
- IContextActivation activation = activations[i];
+ for (IContextActivation activation : activations) {
activation.getContextService().deactivateContext(activation);
}
}
@@ -539,8 +537,7 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
*/
private Shell getModalDialogOpen(Shell shell) {
Shell[] shells = shell.getShells();
- for (int i = 0; i < shells.length; i++) {
- Shell dialog = shells[i];
+ for (Shell dialog : shells) {
if ((dialog.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0) {
return dialog;
}
@@ -563,8 +560,8 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
return window;
}
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- window = windows[i];
+ for (IWorkbenchWindow w : windows) {
+ window = w;
if (isWindowShowingPerspective(window, perspectiveId)) {
return window;
}
@@ -1034,8 +1031,8 @@ public class PerspectiveManager implements ILaunchListener, ISuspendTriggerListe
private Set<String> parseModes(String modes) {
HashSet<String> modeset = new HashSet<>();
String[] ms = modes.split(","); //$NON-NLS-1$
- for(int i = 0; i < ms.length; i++) {
- modeset.add(ms[i].trim());
+ for (String m : ms) {
+ modeset.add(m.trim());
}
return modeset;
}
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 f8a61893c..4cf54a11e 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -35,6 +35,7 @@ import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -49,7 +50,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.model.AdaptableList;
import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
* Status handler to prompt for saving of resources prior to launching.
@@ -201,15 +201,15 @@ public class SaveScopeResourcesHandler implements IStatusHandler {
protected IResource[] getScopedDirtyResources(IProject[] projects) {
HashSet<IResource> dirtyres = new HashSet<>();
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for(int l = 0; l < windows.length; l++) {
- IWorkbenchPage[] pages = windows[l].getPages();
- for(int i = 0; i < pages.length; i++) {
- IEditorPart[] eparts = pages[i].getDirtyEditors();
- for(int j = 0; j < eparts.length; j++) {
- IResource resource = eparts[j].getEditorInput().getAdapter(IResource.class);
- if(resource != null) {
- for(int k = 0; k < projects.length; k++) {
- if(projects[k].equals(resource.getProject())) {
+ for (IWorkbenchWindow window : windows) {
+ IWorkbenchPage[] pages = window.getPages();
+ for (IWorkbenchPage page : pages) {
+ IEditorPart[] eparts = page.getDirtyEditors();
+ for (IEditorPart epart : eparts) {
+ IResource resource = epart.getEditorInput().getAdapter(IResource.class);
+ if (resource != null) {
+ for (IProject project : projects) {
+ if (project.equals(resource.getProject())) {
dirtyres.add(resource);
}
}
@@ -244,7 +244,7 @@ public class SaveScopeResourcesHandler implements IStatusHandler {
ScopedResourcesSelectionDialog lsd = new ScopedResourcesSelectionDialog(DebugUIPlugin.getShell(),
new AdaptableList(resources),
new WorkbenchContentProvider(),
- new WorkbenchLabelProvider());
+ new SaveResourceDialogWorkbenchLabelProvider());
lsd.setInitialSelections((Object[]) resources);
lsd.setTitle(LaunchConfigurationsMessages.SaveScopeResourcesHandler_3);
if(lsd.open() == IDialogConstants.CANCEL_ID) {
@@ -262,4 +262,17 @@ public class SaveScopeResourcesHandler implements IStatusHandler {
}
return IDialogConstants.OK_ID;
}
+
}
+
+
+class SaveResourceDialogWorkbenchLabelProvider extends LabelProvider {
+ @Override
+ public final String getText(Object element) {
+ if (element instanceof IResource) {
+ return ((IResource)element).getFullPath().toString();
+ }
+ return super.getText(element);
+ }
+
+} \ No newline at end of file
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 eba5ab2f7..c933d828d 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
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -30,8 +31,6 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.model.WorkbenchViewerComparator;
-import com.ibm.icu.text.MessageFormat;
-
/**
* This dialog is used to select one or more launch configurations to add to your favorites
*
@@ -54,9 +53,9 @@ public class SelectFavoritesDialog extends AbstractDebugCheckboxSelectionDialog
}
List<ILaunchConfiguration> list = new ArrayList<>(all.length);
ViewerFilter filter = new LaunchGroupFilter(fHistory.getLaunchGroup());
- for (int i = 0; i < all.length; i++) {
- if (filter.select(null, null, all[i])) {
- list.add(all[i]);
+ for (ILaunchConfiguration config : all) {
+ if (filter.select(null, null, config)) {
+ list.add(config);
}
}
list.removeAll(fCurrentFavoriteSet);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java
index 37b0b4a35..ed6bab9a7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchModesDialog.java
@@ -43,7 +43,7 @@ public class SelectLaunchModesDialog extends AbstractDebugListSelectionDialog{
/**
* Builds labels for list control
*/
- class OptionsLabelProvider implements ILabelProvider {
+ static class OptionsLabelProvider implements ILabelProvider {
@Override
public Image getImage(Object element) {return null;}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java
index eb21df180..66749e8c1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java
@@ -31,9 +31,7 @@ import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -108,7 +106,7 @@ public class SelectLaunchersDialog extends AbstractDebugListSelectionDialog {
try {
int width = settings.getInt("DIALOG_WIDTH"); //$NON-NLS-1$
int height = settings.getInt("DIALOG_HEIGHT"); //$NON-NLS-1$
- if(width > 0 & height > 0) {
+ if(width > 0 && height > 0) {
return new Point(width, height);
}
}
@@ -245,16 +243,13 @@ public class SelectLaunchersDialog extends AbstractDebugListSelectionDialog {
@Override
protected void addViewerListeners(StructuredViewer viewer) {
// Override super to use custom listeners
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection ss = event.getStructuredSelection();
- if(ss != null && !ss.isEmpty()) {
- SelectLaunchersDialog.this.description.setText(((ILaunchDelegate)ss.getFirstElement()).getDescription());
- }
- else {
- SelectLaunchersDialog.this.description.setText(IInternalDebugCoreConstants.EMPTY_STRING);
- }
+ viewer.addSelectionChangedListener(event -> {
+ IStructuredSelection ss = event.getStructuredSelection();
+ if(ss != null && !ss.isEmpty()) {
+ SelectLaunchersDialog.this.description.setText(((ILaunchDelegate)ss.getFirstElement()).getDescription());
+ }
+ else {
+ SelectLaunchersDialog.this.description.setText(IInternalDebugCoreConstants.EMPTY_STRING);
}
});
super.addViewerListeners(viewer);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java
index f87903a1f..053b35bb6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/ShowCommandLineDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2018 IBM Corporation and others.
+ * Copyright (c) 2018, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
+import java.text.MessageFormat;
import java.util.Set;
import org.eclipse.core.runtime.CoreException;
@@ -26,8 +27,8 @@ import org.eclipse.debug.core.Launch;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
import org.eclipse.debug.internal.core.DebugCoreMessages;
+import org.eclipse.debug.internal.core.LaunchConfiguration;
import org.eclipse.debug.internal.core.LaunchManager;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -43,8 +44,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-
-import com.ibm.icu.text.MessageFormat;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* Allows the user to specify to see and copy the command line to be executed
@@ -93,8 +94,8 @@ public class ShowCommandLineDialog extends Dialog {
GridLayout topLayout = new GridLayout();
group.setLayout(topLayout);
GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = convertHeightInCharsToPixels(15);
- gd.widthHint = convertWidthInCharsToPixels(50);
+ gd.heightHint = convertHeightInCharsToPixels(20);
+ gd.widthHint = convertWidthInCharsToPixels(90);
group.setLayoutData(gd);
group.setFont(font);
@@ -109,8 +110,15 @@ public class ShowCommandLineDialog extends Dialog {
Set<String> modes = flaunchConfiguration.getModes();
modes.add(fMode);
ILaunchDelegate[] delegates = flaunchConfiguration.getType().getDelegates(modes);
- if (delegates.length ==1) {
- ILaunchConfigurationDelegate delegate = delegates[0].getDelegate();
+ ILaunchConfigurationDelegate delegate = null;
+ if (delegates.length == 1) {
+ delegate = delegates[0].getDelegate();
+ } else {
+ if (flaunchConfiguration instanceof LaunchConfiguration) {
+ delegate = ((LaunchConfiguration) flaunchConfiguration).getPreferredLaunchDelegate(fMode);
+ }
+ }
+ if (delegate != null) {
ILaunchConfigurationDelegate2 delegate2;
ILaunch launch = null;
if (delegate instanceof ILaunchConfigurationDelegate2) {
@@ -167,7 +175,8 @@ public class ShowCommandLineDialog extends Dialog {
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ShowCommandLineDialog.class)).getDialogSettings();
IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
if (section == null) {
section = settings.addNewSection(getDialogSettingsSectionName());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UniqueLaunchConfigurationFileFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UniqueLaunchConfigurationFileFilter.java
new file mode 100644
index 000000000..9880db0e0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/UniqueLaunchConfigurationFileFilter.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Torbjörn Svensson and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Torbjörn Svensson - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.launchConfigurations;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+/**
+ * Filters out the instance of ILaunchCOnfiguration where the, possibly nested,
+ * launch configuration files are stored. If the launch configuration is local,
+ * it's simply returned.
+ */
+public class UniqueLaunchConfigurationFileFilter extends ViewerFilter {
+ @Override
+ public Object[] filter(Viewer viewer, Object parent, Object[] elements) {
+ int size = elements.length;
+ if (size == 0) {
+ return elements;
+ }
+
+ List<Object> filteredElements = new ArrayList<>(size);
+
+ Map<String, List<ILaunchConfiguration>> configPathMap = new HashMap<>();
+ for (Object element : elements) {
+ if (element instanceof ILaunchConfiguration) {
+ ILaunchConfiguration config = (ILaunchConfiguration) element;
+
+ String path = toLaunchFileLocation(config);
+ if (!configPathMap.containsKey(path)) {
+ configPathMap.put(path, new ArrayList<>());
+ }
+ configPathMap.get(path).add(config);
+ } else {
+ filteredElements.add(element);
+ }
+ }
+
+ for (Entry<String, List<ILaunchConfiguration>> entry : configPathMap.entrySet()) {
+ List<ILaunchConfiguration> configsWithSamePath = entry.getValue();
+ if (entry.getKey() == null) {
+ // Local configurations ends up here, add them without further filter
+ filteredElements.addAll(configsWithSamePath);
+ } else if (configsWithSamePath.size() == 1) {
+ // Only one configuration, add it
+ filteredElements.add(configsWithSamePath.get(0));
+ } else if (configsWithSamePath.size() > 1) {
+ // More than one config with same path.
+ // Order them with the shortest project relative path first
+ configsWithSamePath.sort((o1, o2) -> {
+ IPath path1 = o1.getFile().getProjectRelativePath();
+ IPath path2 = o2.getFile().getProjectRelativePath();
+ return Integer.compare(path1.segmentCount(), path2.segmentCount());
+ });
+ // Use the configuration with the shortest path.
+ // The other configurations in the list are "identical" but with
+ // the container set to one of the parent project(s) in the
+ // workspace hierarchy.
+ filteredElements.add(configsWithSamePath.get(0));
+ }
+ }
+
+ return filteredElements.toArray();
+ }
+
+ private String toLaunchFileLocation(ILaunchConfiguration config) {
+ if (!config.isLocal()) {
+ IFile file = config.getFile();
+ if (file != null) {
+ IPath path = file.getLocation();
+ if (path != null) {
+ return path.toOSString();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return true;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java
index f7325749f..9e2234c09 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/WorkingSetsFilter.java
@@ -62,16 +62,16 @@ public class WorkingSetsFilter extends ViewerFilter {
}
//remove breakpoint working sets
ArrayList<IWorkingSet> ws = new ArrayList<>();
- for (int i = 0; i < wsets.length; i++) {
- if(!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(wsets[i].getId())) {
- ws.add(wsets[i]);
+ for (IWorkingSet wset : wsets) {
+ if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(wset.getId())) {
+ ws.add(wset);
}
}
if(ws.isEmpty()) {
return true;
}
- for (int i = 0; i < resources.length; i++) {
- if(workingSetContains(ws.toArray(new IWorkingSet[ws.size()]), resources[i])) {
+ for (IResource resource : resources) {
+ if (workingSetContains(ws.toArray(new IWorkingSet[ws.size()]), resource)) {
return true;
}
}
@@ -98,10 +98,10 @@ public class WorkingSetsFilter extends ViewerFilter {
}
}
IResource lres = null;
- for(int i = 0; i < wsets.length; i++) {
- IAdaptable[] elements = wsets[i].getElements();
- for(int j = 0; j < elements.length; j++) {
- lres = elements[j].getAdapter(IResource.class);
+ for (IWorkingSet wset : wsets) {
+ IAdaptable[] elements = wset.getElements();
+ for (IAdaptable element : elements) {
+ lres = element.getAdapter(IResource.class);
if(lres != null) {
if(parents.contains(lres)) {
return true;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingManager.java
index 8b1703df1..30e88863b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/MemoryRenderingManager.java
@@ -29,7 +29,6 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractMemoryRenderingBindingsProvider;
import org.eclipse.debug.ui.memory.IMemoryRendering;
-import org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener;
import org.eclipse.debug.ui.memory.IMemoryRenderingManager;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
@@ -100,8 +99,7 @@ public class MemoryRenderingManager extends AbstractMemoryRenderingBindingsProvi
while (iterator.hasNext()) {
RenderingBindings binding = iterator.next();
IMemoryRenderingType[] renderingTypes = binding.getDefaultRenderingTypes(block);
- for (int i = 0; i < renderingTypes.length; i++) {
- IMemoryRenderingType type = renderingTypes[i];
+ for (IMemoryRenderingType type : renderingTypes) {
if (!allTypes.contains(type)) {
allTypes.add(type);
}
@@ -126,8 +124,7 @@ public class MemoryRenderingManager extends AbstractMemoryRenderingBindingsProvi
List<IMemoryRenderingType> allTypes = new ArrayList<>();
for (RenderingBindings binding : fBindings) {
IMemoryRenderingType[] renderingTypes = binding.getRenderingTypes(block);
- for (int i = 0; i < renderingTypes.length; i++) {
- IMemoryRenderingType type = renderingTypes[i];
+ for (IMemoryRenderingType type : renderingTypes) {
if (!allTypes.contains(type)) {
allTypes.add(type);
}
@@ -142,8 +139,7 @@ public class MemoryRenderingManager extends AbstractMemoryRenderingBindingsProvi
private void initializeRenderings() {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_MEMORY_RENDERINGS);
IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
+ for (IConfigurationElement element : configurationElements) {
String name = element.getName();
if (name.equals(ELEMENT_MEMORY_RENDERING_TYPE)) {
MemoryRenderingType type = new MemoryRenderingType(element);
@@ -158,12 +154,7 @@ public class MemoryRenderingManager extends AbstractMemoryRenderingBindingsProvi
try {
bindings.validate();
fBindings.add(bindings);
- bindings.addListener(new IMemoryRenderingBindingsListener() {
- @Override
- public void memoryRenderingBindingsChanged() {
- fireBindingsChanged();
- }
- });
+ bindings.addListener(this::fireBindingsChanged);
} catch (CoreException e) {
DebugUIPlugin.log(e);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/RenderingBindings.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/RenderingBindings.java
index 1e5e9b3db..6aa77b2ea 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/RenderingBindings.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/RenderingBindings.java
@@ -30,7 +30,6 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.memory.AbstractMemoryRenderingBindingsProvider;
-import org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener;
import org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider;
import org.eclipse.debug.ui.memory.IMemoryRenderingManager;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
@@ -86,8 +85,8 @@ class RenderingBindings extends AbstractMemoryRenderingBindingsProvider implemen
IMemoryRenderingManager manager = getManager();
if (ids != null) {
String[] strings = ids.split(","); //$NON-NLS-1$
- for (int i = 0; i < strings.length; i++) {
- String id = strings[i].trim();
+ for (String s : strings) {
+ String id = s.trim();
IMemoryRenderingType type = manager.getRenderingType(id);
if (type != null) {
list.add(type);
@@ -96,8 +95,8 @@ class RenderingBindings extends AbstractMemoryRenderingBindingsProvider implemen
}
// remove any default bindings, in case of duplicate specification
IMemoryRenderingType[] defaultBindings = getDefaultBindings();
- for (int i = 0; i < defaultBindings.length; i++) {
- list.remove(defaultBindings[i]);
+ for (IMemoryRenderingType defaultBinding : defaultBindings) {
+ list.remove(defaultBinding);
}
fRenderingTypes = list.toArray(new IMemoryRenderingType[list.size()]);
}
@@ -116,8 +115,8 @@ class RenderingBindings extends AbstractMemoryRenderingBindingsProvider implemen
IMemoryRenderingManager manager = getManager();
if (ids != null) {
String[] strings = ids.split(","); //$NON-NLS-1$
- for (int i = 0; i < strings.length; i++) {
- String id = strings[i].trim();
+ for (String s : strings) {
+ String id = s.trim();
IMemoryRenderingType type = manager.getRenderingType(id);
if (type != null) {
list.add(type);
@@ -164,12 +163,7 @@ class RenderingBindings extends AbstractMemoryRenderingBindingsProvider implemen
}
if (fProvider != null) {
- fProvider.addListener(new IMemoryRenderingBindingsListener() {
- @Override
- public void memoryRenderingBindingsChanged() {
- fireBindingsChanged();
- }
- });
+ fProvider.addListener(this::fireBindingsChanged);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
index 48db0e51a..f91ff538f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/memory/provisional/AbstractAsyncTableRendering.java
@@ -337,7 +337,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
}
}
- private class SerialByObjectRule implements ISchedulingRule {
+ private static class SerialByObjectRule implements ISchedulingRule {
private Object fObject = null;
public SerialByObjectRule(Object lock) {
@@ -1481,9 +1481,9 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
// check each of the items and find the minimum
TableItem[] items = table.getItems();
int minHeight = table.getItemHeight();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null) {
- minHeight = Math.min(items[i].getBounds(0).height, minHeight);
+ for (TableItem item : items) {
+ if (item.getData() != null) {
+ minHeight = Math.min(item.getBounds(0).height, minHeight);
}
}
@@ -2754,8 +2754,7 @@ public abstract class AbstractAsyncTableRendering extends AbstractBaseTableRende
*/
private TableItem getItem(Point point) {
TableItem[] items = fTableViewer.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
+ for (TableItem item : items) {
if (item.getData() != null) {
Point start = new Point(item.getBounds(0).x, item.getBounds(0).y);
start = fTableViewer.getTable().toDisplay(start);
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 13f305fe1..f3f2530dd 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
@@ -52,9 +52,8 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
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()) {
+ for (IBreakpoint breakpoint : container.getBreakpoints()) {
+ if (breakpoint.isEnabled()) {
return true;
}
}
@@ -70,15 +69,14 @@ public class BreakpointContainerLabelProvider extends DebugElementLabelProvider
Object lastSegment = path.getLastSegment();
if (lastSegment instanceof IBreakpointContainer) {
IBreakpointContainer container = (IBreakpointContainer) lastSegment;
- IBreakpoint[] breakpoints = container.getBreakpoints();
// Return true, gray if some breakpoints are enabled and some are disabled.
// return false if all breakpoints are either disabled or all are enabled.
boolean hasEnabled = false;
boolean hasDisabled = false;
- for (int i = 0; i < breakpoints.length; ++i) {
- if (breakpoints[i].isEnabled()) {
+ for (IBreakpoint breakpoint : container.getBreakpoints()) {
+ if (breakpoint.isEnabled()) {
hasEnabled = true;
} else {
hasDisabled = true;
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 eb106a6d9..92944bf10 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
@@ -26,15 +26,11 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.function.Consumer;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.IBreakpointsListener;
@@ -112,27 +108,11 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
private IStructuredSelection fDebugContext = StructuredSelection.EMPTY;
- private IPropertyChangeListener fOrganizersListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- // For any property changes in breakpoint organizers, refresh the containers.
- updateContainers();
- }
- };
+ private IPropertyChangeListener fOrganizersListener = event -> updateContainers();
- private IPropertyChangeListener fPresentationContextListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- presentationPropertyChanged(event);
- }
- };
+ private IPropertyChangeListener fPresentationContextListener = this::presentationPropertyChanged;
- private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
- @Override
- public void debugContextChanged(DebugContextEvent event) {
- InputData.this.debugContextChanged(event);
- }
- };
+ private IDebugContextListener fDebugContextListener = InputData.this::debugContextChanged;
/**
* Constructor
@@ -236,13 +216,13 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
private void registerOrganizersListener(IBreakpointOrganizer[] oldOrganizers, IBreakpointOrganizer[] newOrganizers) {
if (oldOrganizers != null) {
- for (int i = 0; i < oldOrganizers.length; i++) {
- oldOrganizers[i].removePropertyChangeListener(fOrganizersListener);
+ for (IBreakpointOrganizer oldOrganizer : oldOrganizers) {
+ oldOrganizer.removePropertyChangeListener(fOrganizersListener);
}
}
if (newOrganizers != null) {
- for (int i = 0; i < newOrganizers.length; i++) {
- newOrganizers[i].addPropertyChangeListener(fOrganizersListener);
+ for (IBreakpointOrganizer newOrganizer : newOrganizers) {
+ newOrganizer.addPropertyChangeListener(fOrganizersListener);
}
}
}
@@ -439,9 +419,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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);
+ for (BreakpointManagerProxy proxy : getProxies()) {
+ proxy.postModelChanged(delta, true);
}
}
}
@@ -465,9 +444,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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])) {
+ for (IBreakpoint containerBP : childContainer.getBreakpoints()) {
+ if (breakpoints.contains(containerBP)) {
containsBP = true;
break;
}
@@ -497,14 +475,14 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
if (filteredBreakpoints.length > 0) {
synchronized (this) {
ModelDelta delta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
- for (int i = 0; i < filteredBreakpoints.length; ++i) {
+ for (IBreakpoint filteredBreakpoint : filteredBreakpoints) {
// 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);
+ if (DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(filteredBreakpoint.getMarker()) != null) {
+ fContainer.addBreakpoint(filteredBreakpoint, delta);
}
}
delta.setChildCount(fContainer.getChildren().length);
@@ -531,8 +509,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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;
+ for (IBreakpoint breakpoint : breakpoints) {
+ removed = fContainer.removeBreakpoint(breakpoint, delta) || removed;
}
if (removed) {
@@ -557,8 +535,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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];
+ for (IBreakpoint bp : breakpoints) {
boolean oldContainedBp = fContainer.contains(bp);
boolean newContained = filteredAsList.contains(bp);
if (oldContainedBp && !newContained) {
@@ -573,9 +550,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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
+ for (IBreakpoint filteredBreakpoint : filteredBreakpoints) {
+ appendModelDelta(fContainer, delta, IModelDelta.STATE | IModelDelta.CONTENT, filteredBreakpoint); // content flag triggers detail refresh
}
if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) {
@@ -620,22 +596,20 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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]);
+ for (Object refChildElement : refContainer.getChildren()) {
+ Object element = getElement(children, refChildElement);
// 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 (refChildElement instanceof BreakpointContainer) {
+ BreakpointContainer.addChildContainer(container, (BreakpointContainer) refChildElement, containerDelta);
+ } else if(refChildElement instanceof IBreakpoint) {
+ BreakpointContainer.addBreakpoint(container, (IBreakpoint) refChildElement, containerDelta);
if (newBreakpoint == null) {
- newBreakpoint = (IBreakpoint) refChildren[i];
+ newBreakpoint = (IBreakpoint) refChildElement;
}
}
@@ -643,8 +617,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
// 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);
+ BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildElement);
+ newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildElement, childDelta);
childDelta.setChildCount(((BreakpointContainer) element).getChildren().length);
}
}
@@ -662,38 +636,36 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
* @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]);
+ for (Object childElement : container.getChildren()) {
+ Object element = getElement(refChildren, childElement);
if (element == null) {
- if (children[i] instanceof BreakpointContainer) {
- BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta);
+ if (childElement instanceof BreakpointContainer) {
+ BreakpointContainer.removeAll((BreakpointContainer) childElement, containerDelta);
} else {
- BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta);
+ BreakpointContainer.removeBreakpoint(container, (IBreakpoint) childElement, containerDelta);
}
} else if (element instanceof BreakpointContainer){
- ModelDelta childDelta = containerDelta.addNode(children[i], IModelDelta.STATE);
- deleteRemovedElements((BreakpointContainer) children[i], (BreakpointContainer) element, childDelta);
+ ModelDelta childDelta = containerDelta.addNode(childElement, IModelDelta.STATE);
+ deleteRemovedElements((BreakpointContainer) childElement, (BreakpointContainer) element, childDelta);
}
}
}
private void deleteAllElements(BreakpointContainer container, 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) {
- if (children[i] instanceof BreakpointContainer) {
- BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta);
+ for (Object childElement : container.getChildren()) {
+ if (childElement instanceof BreakpointContainer) {
+ BreakpointContainer.removeAll((BreakpointContainer) childElement, containerDelta);
} else {
- BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta);
+ BreakpointContainer.removeBreakpoint(container, (IBreakpoint) childElement, containerDelta);
}
}
}
@@ -708,14 +680,14 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
* @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)) {
- return collection[i];
+ for (Object element2 : collection) {
+ if (element2 instanceof BreakpointContainer && element instanceof BreakpointContainer) {
+ if (element2.equals(element)) {
+ return element2;
}
} else {
- if (collection[i].equals(element)) {
- return collection[i];
+ if (element2.equals(element)) {
+ return element2;
}
}
}
@@ -739,8 +711,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
BreakpointContainer container = new BreakpointContainer(organizers, fComparator);
container.initDefaultContainers(rootDelta);
- for (int i = 0; i < breakpoints.length; ++i) {
- container.addBreakpoint(breakpoints[i], rootDelta);
+ for (IBreakpoint breakpoint : breakpoints) {
+ container.addBreakpoint(breakpoint, rootDelta);
}
return container;
@@ -780,26 +752,9 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
}
/**
- * 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;
- }
-
- @Override
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
- };
-
- /**
* A map of input to info data cache
*/
- final private Map<DefaultBreakpointsViewInput, InputData> fInputToData = Collections.synchronizedMap(new InputDataMap<DefaultBreakpointsViewInput, InputData>());
+ final private Map<DefaultBreakpointsViewInput, InputData> fInputToData = Collections.synchronizedMap(new InputDataMap<>());
/**
* Flag indicating whether the content provider is currently a breakpoints listener.
@@ -824,9 +779,9 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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])) {
- retVal.add(breakpoints[i]);
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (supportsBreakpoint(targets, breakpoint)) {
+ retVal.add(breakpoint);
}
}
}
@@ -931,8 +886,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
}
// Dispose the removed input data
- for (int i = 0; i < removed.size(); i++) {
- removed.get(i).dispose();
+ for (InputData inputData : removed) {
+ inputData.dispose();
}
}
@@ -1043,61 +998,25 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
return EMPTY;
}
+ final SerialExecutor breakpointUpdater = new SerialExecutor("Breakpoints View Update Job", this); //$NON-NLS-1$
+
+ void updateBreakpointView(Consumer<InputData> action) {
+ breakpointUpdater.schedule(() -> fInputToData.values().forEach(action::accept));
+ }
+
@Override
public void breakpointsAdded(final IBreakpoint[] breakpoints) {
- new Job("Breakpoints View Update Job") { //$NON-NLS-1$
- {
- setSystem(true);
- setRule(fBreakpointsListenerSchedulingRule);
- }
-
- @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();
+ updateBreakpointView(data -> data.breakpointsAdded(breakpoints));
}
@Override
public void breakpointsRemoved(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- new Job("Breakpoints View Update Job") { //$NON-NLS-1$
- {
- setSystem(true);
- setRule(fBreakpointsListenerSchedulingRule);
- }
-
- @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();
+ updateBreakpointView(data -> data.breakpointsRemoved(breakpoints));
}
@Override
public void breakpointsChanged(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- new Job("Breakpoints View Update Job") { //$NON-NLS-1$
- {
- setSystem(true);
- setRule(fBreakpointsListenerSchedulingRule);
- }
-
- @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();
+ updateBreakpointView(data -> data.breakpointsChanged(breakpoints));
}
/**
* Appends the model delta flags to child containers that contains the breakpoint.
@@ -1112,9 +1031,9 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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);
+ for (BreakpointContainer container : containers) {
+ ModelDelta nodeDelta = parentDelta.addNode(container, IModelDelta.STATE);
+ appendModelDelta(container, nodeDelta, flags, breakpoint);
}
} else {
parentDelta.addNode(breakpoint, flags);
@@ -1135,14 +1054,13 @@ public class BreakpointManagerContentProvider extends ElementContentProvider
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);
+ for (IModelDelta childDelta : parentDelta.getChildDeltas()) {
+ if (element.equals(childDelta.getElement())) {
+ ((ModelDelta) childDelta).setFlags(childDelta.getFlags() | flags);
return;
}
- appendModelDeltaToElement(childDeltas[i], element, flags);
+ appendModelDeltaToElement(childDelta, element, flags);
}
}
}
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 22543b77f..9fbb033e3 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
@@ -110,8 +110,8 @@ public class DebugElementLabelProvider extends ElementLabelProvider {
IDebugModelPresentation presentation = debugContext.getModelPresentation();
if (presentation instanceof IDebugModelPresentationExtension) {
IDebugModelPresentationExtension extension = (IDebugModelPresentationExtension) presentation;
- for (int i = 0; i < updates.length; i++) {
- if (extension.requiresUIThread(updates[i].getElement())) {
+ for (ILabelUpdate u : updates) {
+ if (extension.requiresUIThread(u.getElement())) {
return true;
}
}
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 911adc741..a3efe4520 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
@@ -53,8 +53,7 @@ public abstract class ElementContentProvider implements IElementContentProvider
Job job = new ElementContentProviderJob("Debug children update") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- for (int i = 0; i < updates.length; i++) {
- IChildrenUpdate update = updates[i];
+ for (IChildrenUpdate update : updates) {
if (!update.isCanceled()) {
retrieveChildren(update);
}
@@ -72,8 +71,7 @@ public abstract class ElementContentProvider implements IElementContentProvider
Job job = new ElementContentProviderJob("Debug child count update") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- for (int i = 0; i < updates.length; i++) {
- IChildrenCountUpdate update = updates[i];
+ for (IChildrenCountUpdate update : updates) {
if (!update.isCanceled()) {
retrieveChildCount(update);
}
@@ -207,8 +205,7 @@ public abstract class ElementContentProvider implements IElementContentProvider
Job job = new ElementContentProviderJob("Debug has children update") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- for (int i = 0; i < updates.length; i++) {
- IHasChildrenUpdate update = updates[i];
+ for (IHasChildrenUpdate update : updates) {
if (!update.isCanceled()) {
updateHasChildren(update);
}
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 ad2232401..7295f1678 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
@@ -127,8 +127,8 @@ public abstract class ElementLabelProvider implements IElementLabelProvider {
if (fQueue == null) {
return false;
} else {
- for (int i = 0; i < updates.length; i++) {
- fQueue.addLast(updates[i]);
+ for (ILabelUpdate update : updates) {
+ fQueue.addLast(update);
}
return true;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java
index 50f4b5f5d..a8e37965c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementMementoProvider.java
@@ -35,8 +35,7 @@ public abstract class ElementMementoProvider implements IElementMementoProvider
Job job = new Job("compare element") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- for (int i = 0; i < requests.length; i++) {
- IElementCompareRequest request = requests[i];
+ for (IElementCompareRequest request : requests) {
try {
request.setEqual(isEqual(request.getElement(), request.getMemento(), request.getPresentationContext()));
} catch (CoreException e) {
@@ -67,8 +66,7 @@ public abstract class ElementMementoProvider implements IElementMementoProvider
Job job = new Job("encode element") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- for (int i = 0; i < requests.length; i++) {
- IElementMementoRequest request = requests[i];
+ for (IElementMementoRequest request : requests) {
try {
if (!encodeElement(request.getElement(), request.getMemento(), request.getPresentationContext())) {
request.cancel();
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 2d3ea7646..11e379da4 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
@@ -60,21 +60,21 @@ public class ExpressionContentProvider extends VariableContentProvider {
@Override
public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String[] columnIds = updates[i].getColumnIds();
+ for (ILabelUpdate update : updates) {
+ String[] columnIds = update.getColumnIds();
if (columnIds == null) {
- updateLabel(updates[i], 0);
+ updateLabel(update, 0);
} else {
for (int j = 0; j < columnIds.length; j++) {
if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
- updateLabel(updates[i], j);
+ updateLabel(update, j);
} else {
- updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
+ update.setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
}
}
}
- updates[i].done();
+ update.done();
}
}
@@ -94,8 +94,9 @@ public class ExpressionContentProvider extends VariableContentProvider {
findDelegates(delegateMap, notDelegated, updates);
// Batch the updates and send them to the delegates
- for (IElementContentProvider delegate : delegateMap.keySet()) {
- List<IViewerUpdate> updateList = delegateMap.get(delegate);
+ for (Map.Entry<IElementContentProvider, List<IViewerUpdate>> entry : delegateMap.entrySet()) {
+ IElementContentProvider delegate = entry.getKey();
+ List<IViewerUpdate> updateList = entry.getValue();
delegate.update(updateList.toArray(new IChildrenCountUpdate[updateList.size()]));
}
if (notDelegated.size() > 0){
@@ -111,8 +112,9 @@ public class ExpressionContentProvider extends VariableContentProvider {
findDelegates(delegateMap, notDelegated, updates);
// Batch the updates and send them to the delegates
- for (IElementContentProvider delegate : delegateMap.keySet()) {
- List<IViewerUpdate> updateList = delegateMap.get(delegate);
+ for (Map.Entry<IElementContentProvider, List<IViewerUpdate>> entry : delegateMap.entrySet()) {
+ IElementContentProvider delegate = entry.getKey();
+ List<IViewerUpdate> updateList = entry.getValue();
delegate.update(updateList.toArray(new IHasChildrenUpdate[updateList.size()]));
}
if (notDelegated.size() > 0){
@@ -128,8 +130,9 @@ public class ExpressionContentProvider extends VariableContentProvider {
findDelegates(delegateMap, notDelegated, updates);
// Batch the updates and send them to the delegates
- for (IElementContentProvider delegate : delegateMap.keySet()) {
- List<IViewerUpdate> updateList = delegateMap.get(delegate);
+ for (Map.Entry<IElementContentProvider, List<IViewerUpdate>> entry : delegateMap.entrySet()) {
+ IElementContentProvider delegate = entry.getKey();
+ List<IViewerUpdate> updateList = entry.getValue();
delegate.update(updateList.toArray(new IChildrenUpdate[updateList.size()]));
}
if (notDelegated.size() > 0){
@@ -148,21 +151,21 @@ public class ExpressionContentProvider extends VariableContentProvider {
* @since 3.4
*/
private void findDelegates(Map<IElementContentProvider, List<IViewerUpdate>> delegateMap, List<IViewerUpdate> notDelegated, IViewerUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- if (updates[i] instanceof ViewerUpdateMonitor && !((ViewerUpdateMonitor)updates[i]).isDelegated() && updates[i].getElement() instanceof IExpression){
- IElementContentProvider delegate = ViewerAdapterService.getContentProvider(((IExpression)updates[i].getElement()).getValue());
+ for (IViewerUpdate update : updates) {
+ if (update instanceof ViewerUpdateMonitor && !((ViewerUpdateMonitor)update).isDelegated() && update.getElement() instanceof IExpression){
+ IElementContentProvider delegate = ViewerAdapterService.getContentProvider(((IExpression)update.getElement()).getValue());
if (delegate != null){
List<IViewerUpdate> updateList = delegateMap.get(delegate);
if (updateList == null){
updateList = new ArrayList<>();
delegateMap.put(delegate, updateList);
}
- ((ViewerUpdateMonitor)updates[i]).setDelegated(true);
- updateList.add(updates[i]);
+ ((ViewerUpdateMonitor)update).setDelegated(true);
+ updateList.add(update);
continue;
}
}
- notDelegated.add(updates[i]);
+ notDelegated.add(update);
}
}
@@ -174,8 +177,8 @@ public class ExpressionContentProvider extends VariableContentProvider {
if (expression.hasErrors()) {
String[] messages = expression.getErrorMessages();
LinkedHashSet<ErrorMessageElement> set = new LinkedHashSet<>(messages.length);
- for (int i = 0; i < messages.length; i++) {
- set.add(new ErrorMessageElement(messages[i]));
+ for (String message : messages) {
+ set.add(new ErrorMessageElement(message));
}
return set.toArray();
}
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 a6b124150..2f3171d02 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
@@ -55,21 +55,21 @@ public class ExpressionManagerContentProvider extends ElementContentProvider {
@Override
public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String[] columnIds = updates[i].getColumnIds();
+ for (ILabelUpdate update : updates) {
+ String[] columnIds = update.getColumnIds();
if (columnIds == null) {
- updateLabel(updates[i], 0);
+ updateLabel(update, 0);
} else {
for (int j = 0; j < columnIds.length; j++) {
if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(columnIds[j])) {
- updateLabel(updates[i], j);
+ updateLabel(update, j);
} else {
- updates[i].setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
+ update.setLabel(IInternalDebugCoreConstants.EMPTY_STRING, j);
}
}
}
- updates[i].done();
+ update.done();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/SerialExecutor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/SerialExecutor.java
new file mode 100644
index 000000000..6e46b2a9e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/SerialExecutor.java
@@ -0,0 +1,75 @@
+/*****************************************************************
+ * Copyright (c) 2021 Joerg Kubitz and others
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Joerg Kubitz - Initial API and implementation
+ *****************************************************************/
+
+package org.eclipse.debug.internal.ui.model.elements;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+
+/**
+ * A singleton SerialExecutor job instance can be used to execute Runnable
+ * objects offered by {@link #schedule(Runnable)} method in order of they
+ * submission, one after another.
+ */
+public final class SerialExecutor extends Job {
+
+ private final ConcurrentLinkedQueue<Runnable> queue;
+ private final Object myFamily;
+
+ /**
+ * @param jobName descriptive job name
+ * @param family non null object to control this job execution
+ **/
+ public SerialExecutor(String jobName, Object family) {
+ super(jobName);
+ Assert.isNotNull(family);
+ this.myFamily = family;
+ this.queue = new ConcurrentLinkedQueue<>();
+ setSystem(true);
+ }
+
+ @Override
+ public boolean belongsTo(Object family) {
+ return myFamily == family;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ Runnable action = queue.poll();
+ try {
+ if (action != null) {
+ action.run();
+ }
+ } finally {
+ if (!queue.isEmpty()) {
+ // in case actions got faster scheduled then processed reschedule:
+ schedule();
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Enqueue an action asynchronously.
+ **/
+ public void schedule(Runnable action) {
+ queue.offer(action);
+ schedule(); // will reschedule if already running
+ }
+} \ No newline at end of file
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 cf873622b..fbdf847e6 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
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.ILogicalStructureType;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IIndexedValue;
@@ -112,7 +111,7 @@ public class VariableContentProvider extends ElementContentProvider {
* @return logical value for the raw value
*/
protected IValue getLogicalValue(IValue value, IPresentationContext context) throws CoreException {
- return getLogicalValue(value, new ArrayList<String>(), context);
+ return getLogicalValue(value, new ArrayList<>(), context);
}
/**
@@ -233,23 +232,20 @@ public class VariableContentProvider extends ElementContentProvider {
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++) {
- if (events[i].getKind() == DebugEvent.TERMINATE){
- fgLogicalCache.clear();
- break;
- } else if (events[i].getKind() == DebugEvent.RESUME && events[i].getDetail() != DebugEvent.EVALUATION_IMPLICIT){
- fgLogicalCache.clear();
- break;
- } else if (events[i].getKind() == DebugEvent.SUSPEND && events[i].getDetail() != DebugEvent.EVALUATION_IMPLICIT){
- fgLogicalCache.clear();
- break;
- } else if (events[i].getKind() == DebugEvent.CHANGE && events[i].getDetail() == DebugEvent.CONTENT){
- fgLogicalCache.clear();
- break;
- }
+ DebugPlugin.getDefault().addDebugEventListener(events -> {
+ for (DebugEvent event : events) {
+ if (event.getKind() == DebugEvent.TERMINATE) {
+ fgLogicalCache.clear();
+ break;
+ } else if (event.getKind() == DebugEvent.RESUME && event.getDetail() != DebugEvent.EVALUATION_IMPLICIT) {
+ fgLogicalCache.clear();
+ break;
+ } else if (event.getKind() == DebugEvent.SUSPEND && event.getDetail() != DebugEvent.EVALUATION_IMPLICIT) {
+ fgLogicalCache.clear();
+ break;
+ } else if (event.getKind() == DebugEvent.CHANGE && event.getDetail() == DebugEvent.CONTENT) {
+ fgLogicalCache.clear();
+ break;
}
}
});
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
index 7844424a7..9ee4e6119 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,8 @@
package org.eclipse.debug.internal.ui.preferences;
+import java.text.MessageFormat;
+
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.jface.preference.BooleanFieldEditor;
@@ -26,6 +28,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
@@ -34,8 +37,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsoleConstants;
-import com.ibm.icu.text.MessageFormat;
-
/**
* A page to set the preferences for the console
*/
@@ -81,6 +82,11 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
private ConsoleIntegerFieldEditor fTabSizeEditor;
private BooleanFieldEditor autoScrollLockEditor;
+ private BooleanFieldEditor2 fWordWrapEditor;
+
+ private BooleanFieldEditor2 fInterpretControlCharactersEditor;
+ private BooleanFieldEditor2 fInterpretCrAsControlCharacterEditor;
+
/**
* Create the console page.
*/
@@ -145,6 +151,11 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
autoScrollLockEditor = new BooleanFieldEditor(IConsoleConstants.P_CONSOLE_AUTO_SCROLL_LOCK, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_enable_auto_scroll_lock, SWT.NONE, getFieldEditorParent());
addField(autoScrollLockEditor);
+
+ fWordWrapEditor = new BooleanFieldEditor2(IConsoleConstants.P_CONSOLE_WORD_WRAP,
+ DebugPreferencesMessages.ConsolePreferencePage_Enable_Word_Wrap_text, SWT.NONE, getFieldEditorParent());
+ addField(fWordWrapEditor);
+
addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3, SWT.NONE, getFieldEditorParent()));
addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3, SWT.NONE, getFieldEditorParent()));
@@ -157,6 +168,18 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
addField(syserr);
addField(sysin);
addField(background);
+
+ fInterpretControlCharactersEditor = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS, DebugPreferencesMessages.ConsolePreferencePage_Interpret_control_characters, SWT.NONE, getFieldEditorParent());
+ fInterpretCrAsControlCharacterEditor = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER, DebugPreferencesMessages.ConsolePreferencePage_Interpret_cr_as_control_character, SWT.NONE, getFieldEditorParent());
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalIndent = 20;
+ fInterpretCrAsControlCharacterEditor.getChangeControl(getFieldEditorParent()).setLayoutData(gd);
+
+ fInterpretControlCharactersEditor.getChangeControl(getFieldEditorParent()).addListener(SWT.Selection,
+ event -> updateInterpretCrAsControlCharacterEditor());
+
+ addField(fInterpretControlCharactersEditor);
+ addField(fInterpretCrAsControlCharacterEditor);
}
/**
@@ -186,6 +209,8 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
updateWidthEditor();
updateAutoScrollLockEditor();
updateBufferSizeEditor();
+ updateInterpretCrAsControlCharacterEditor();
+ updateWordWrapEditorFromConsolePreferences();
}
/**
@@ -216,6 +241,23 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
}
/**
+ * Update enablement of carriage return interpretation based on general control
+ * character interpretation.
+ */
+ protected void updateInterpretCrAsControlCharacterEditor() {
+ Button b = fInterpretControlCharactersEditor.getChangeControl(getFieldEditorParent());
+ fInterpretCrAsControlCharacterEditor.getChangeControl(getFieldEditorParent()).setEnabled(b.getSelection());
+ }
+
+ /**
+ * Update enablement of word wrapping from Console plugin preference store.
+ */
+ protected void updateWordWrapEditorFromConsolePreferences() {
+ fWordWrapEditor.setPreferenceStore(ConsolePlugin.getDefault().getPreferenceStore());
+ fWordWrapEditor.load();
+ }
+
+ /**
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
@Override
@@ -223,13 +265,11 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
super.performDefaults();
updateWidthEditor();
updateBufferSizeEditor();
+ updateInterpretCrAsControlCharacterEditor();
}
protected boolean canClearErrorMessage() {
- if (fWidthEditor.isValid() && fBufferSizeEditor.isValid()) {
- return true;
- }
- return false;
+ return fWidthEditor.isValid() && fBufferSizeEditor.isValid() && fTabSizeEditor.isValid();
}
/**
@@ -249,6 +289,9 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
if (fBufferSizeEditor != null && event.getSource() != fBufferSizeEditor) {
fBufferSizeEditor.refreshValidState();
}
+ if (fTabSizeEditor != null && event.getSource() != fTabSizeEditor) {
+ fTabSizeEditor.refreshValidState();
+ }
checkState();
} else {
super.propertyChange(event);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java
index 7bfbb794d..2f740d038 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -50,6 +50,8 @@ public class DebugPreferencePage extends FieldEditorPreferencePage implements IW
@Override
protected void createFieldEditors() {
addField(new BooleanFieldEditor(IDebugUIConstants.PREF_REUSE_EDITOR, DebugPreferencesMessages.DebugPreferencePage_2, SWT.NONE, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IDebugUIConstants.PREF_SHOW_VARIABLES_INLINE,
+ DebugPreferencesMessages.DebugPreferencePage_showValuesInline, SWT.NONE, getFieldEditorParent()));
SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2);
@@ -63,6 +65,8 @@ public class DebugPreferencePage extends FieldEditorPreferencePage implements IW
addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, DebugPreferencesMessages.DebugPreferencePage_30, SWT.NONE, getFieldEditorParent()));
addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, DebugPreferencesMessages.DebugPreferencePage_5, SWT.NONE, getFieldEditorParent()));
addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS, DebugPreferencesMessages.DebugPreferencePage_31, SWT.NONE, getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS,
+ DebugPreferencesMessages.DebugPreferencePage_32, SWT.NONE, getFieldEditorParent()));
SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2);
ColorFieldEditor mem= new ColorFieldEditor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, DebugPreferencesMessages.DebugPreferencePage_4, getFieldEditorParent());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
index 41b530612..bc2d6e4ed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -35,6 +35,9 @@ public class DebugPreferencesMessages extends NLS {
public static String ConsolePreferencePage_console_width;
public static String ConsolePreferencePage_12;
public static String ConsolePreferencePage_13;
+ public static String ConsolePreferencePage_Interpret_control_characters;
+ public static String ConsolePreferencePage_Interpret_cr_as_control_character;
+ public static String ConsolePreferencePage_Enable_Word_Wrap_text;
public static String DebugPreferencePage_1;
public static String DebugPreferencePage_2;
@@ -45,6 +48,7 @@ public class DebugPreferencesMessages extends NLS {
public static String DebugPreferencePage_30;
public static String DebugPreferencePage_31;
+ public static String DebugPreferencePage_32;
public static String DebugPreferencePage_4;
public static String DebugPreferencePage_10;
public static String DebugPreferencePage_11;
@@ -55,6 +59,7 @@ public class DebugPreferencesMessages extends NLS {
public static String DebugPreferencePage_25;
public static String DebugPreferencePage_26;
public static String DebugPreferencePage_27;
+ public static String DebugPreferencePage_showValuesInline;
public static String DefaultLaunchConfigurationsPropertiesPage_0;
@@ -183,6 +188,10 @@ public class DebugPreferencesMessages extends NLS {
public static String ProcessPropertyPage_0;
+ public static String ProcessPropertyPage_10;
+
+ public static String ProcessPropertyPage_11;
+
public static String ProcessPropertyPage_1;
public static String ProcessPropertyPage_2;
@@ -207,4 +216,5 @@ public class DebugPreferencesMessages extends NLS {
public static String RunDebugPropertiesPage_0;
+
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
index 36ddf277d..ca6df3223 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2018 IBM Corporation and others.
+# Copyright (c) 2000, 2022 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -28,6 +28,9 @@ ConsolePreferencePage_console_width=Character width must be between 80 and 1000
ConsolePreferencePage_12=Displayed &tab width:
ConsolePreferencePage_13=Tab width must be between 1 and 100 inclusive.
ConsolePreferencePage_11=Back&ground color:
+ConsolePreferencePage_Interpret_control_characters=Interpret ASCII &control characters
+ConsolePreferencePage_Interpret_cr_as_control_character=Interpret Carriage &Return (\\r) as control character
+ConsolePreferencePage_Enable_Word_Wrap_text=E&nable word wrap
DebugPreferencePage_1=General Settings for Running and Debugging.
DebugPreferencePage_2=Re&use editor when displaying source code
@@ -47,7 +50,9 @@ DebugPreferencePage_28=Changed value bac&kground color:
DebugPreferencePage_29=&Prompt for confirmation when deleting all breakpoints
DebugPreferencePage_30=Prompt for confirmation when deleting breakpoint con&tainers
DebugPreferencePage_31=&Prompt for confirmation when removing all triggerpoints
+DebugPreferencePage_32=&Prompt for confirmation when disabling all breakpoints
DebugPreferencePage_5=Prompt for confirmation when deleting all e&xpressions
+DebugPreferencePage_showValuesInline=Show debug values &inline on text editors (Experimental)
LaunchingPreferencePage_1=&Build (if required) before launching
LaunchingPreferencePage_2=Save required dirty editors before launching
@@ -89,10 +94,12 @@ LaunchingPreferencePage_39=Launch the associated pro&ject
LaunchingPreferencePage_40=Launch Operation
LaunchingPreferencePage_41=La&unch the previously launched application
LaunchingPreferencePage_confirm_0=Prompt for confirmation when removin&g a configuration from the launch history
-LaunchingPreferencePage_42=Termin&ate and Relaunch while launching (Press 'Shift' to toggle during launch from menu and toolbar)
+LaunchingPreferencePage_42=Termin&ate and relaunch while launching (Press 'Shift' to toggle during launch from menu and toolbar)
ProcessPropertyPage_Command_Line__1=Co&mmand Line:
ProcessPropertyPage_0=Run-&at time:
+ProcessPropertyPage_10=&Terminated-at time:
+ProcessPropertyPage_11=PID:
ProcessPropertyPage_1=&Path:
ProcessPropertyPage_2=Process properties
ProcessPropertyPage_3=No path information available
@@ -128,7 +135,7 @@ StringVariablePreferencePage_23=Cannot overwrite read-only variable
StringVariablePreferencePage_22=A read-only variable named {0} already exists. Read-only variables can not be overwritten.
StringVariablePreferencePage_21=Problem creating variable
StringVariablePreferencePage_20=Variables cannot have an empty name.
-ViewManagementPreferencePage_0=The Debug View can automatically open and close views based on selection. Choose in which perspectives this feature should be enabled:
+ViewManagementPreferencePage_0=The 'Debug' view can automatically open and close views based on selection. Choose in which perspectives this feature should be enabled:
ViewManagementPreferencePage_1=View Management
ViewManagementPreferencePage_2=&Perspectives:
ViewManagementPreferencePage_3=Do &not automatically open/close views which have been manually closed/opened.
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 93d9c16ac..0dda13b5a 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -91,7 +91,31 @@ public interface IDebugPreferenceConstants {
*/
String CONSOLE_TAB_WIDTH= "Console.console_tab_width"; //$NON-NLS-1$
+ /**
+ * (boolean) If <code>true</code> console will interpret ASCII control
+ * characters like <code>\b</code> received from stdout or stderr (or any other
+ * connected output stream).
+ * <p>
+ * If <code>false</code> control characters are appended to console like any
+ * other character. Since they are usually not printable they may be invisible
+ * or result in some Unicode default representation.
+ * </p>
+ */
+ String CONSOLE_INTERPRET_CONTROL_CHARACTERS = "Console.interpret_control_characters"; //$NON-NLS-1$
+ /**
+ * (boolean) Only used if {@link #CONSOLE_INTERPRET_CONTROL_CHARACTERS} is
+ * <code>true</code>.
+ * <p>
+ * If <code>true</code> carriage returns are handled with there usual control
+ * character interpretation. (move output cursor to begin of line)
+ * </p>
+ * <p>
+ * If <code>false</code> carriage returns are not handled special and may result
+ * in line breaks since they are usually legal line delimiter.
+ * </p>
+ */
+ String CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER = "Console.interpret_cr_as_control_characters"; //$NON-NLS-1$
/**
* The orientation of the detail view in the VariablesView
@@ -158,7 +182,17 @@ public interface IDebugPreferenceConstants {
int PREF_ROW_SIZE_DEFAULT = 16;
/**
- * Stores the boolean preference of whether to prompt when removing all breakpoints.
+ * Stores the boolean preference of whether to prompt when disabling all
+ * breakpoints.
+ *
+ * @since 3.15
+ */
+ String PREF_PROMPT_DISABLE_ALL_BREAKPOINTS = IDebugUIConstants.PLUGIN_ID + ".disable_all_breakpoints_prompt"; //$NON-NLS-1$
+
+ /**
+ * Stores the boolean preference of whether to prompt when removing all
+ * breakpoints.
+ *
* @since 3.3
*/
String PREF_PROMPT_REMOVE_ALL_BREAKPOINTS = IDebugUIConstants.PLUGIN_ID + ".remove_all_breakpoints_prompt"; //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java
index 754c0e220..f01e09229 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java
@@ -37,8 +37,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
@@ -228,22 +226,19 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement
private Composite createTypeFiltering(Composite parent) {
Composite comp = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_HORIZONTAL);
BooleanFieldEditor2 editor = new BooleanFieldEditor2(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES, DebugPreferencesMessages.LaunchConfigurationsPreferencePage_0, SWT.NONE, comp);
- editor.setPropertyChangeListener(new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- boolean newvalue = false;
- if(event.getNewValue() instanceof Boolean) {
- newvalue = ((Boolean)event.getNewValue()).booleanValue();
- }
- else {
- newvalue = Boolean.valueOf(event.getNewValue().toString()).booleanValue();
- }
- if(newvalue) {
- fTable.setEnabled(true);
- }
- else {
- fTable.setEnabled(false);
- }
+ editor.setPropertyChangeListener(event -> {
+ boolean newvalue = false;
+ if(event.getNewValue() instanceof Boolean) {
+ newvalue = ((Boolean)event.getNewValue()).booleanValue();
+ }
+ else {
+ newvalue = Boolean.parseBoolean(event.getNewValue().toString());
+ }
+ if(newvalue) {
+ fTable.setEnabled(true);
+ }
+ else {
+ fTable.setEnabled(false);
}
});
fFieldEditors.add(editor);
@@ -281,13 +276,12 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement
ILaunchConfiguration[] configurations = lmanager.getMigrationCandidates();
//separate the private from the public
List<ILaunchConfiguration> pub = new ArrayList<>();
- for(int i = 0; i < configurations.length; i++) {
- if(DebugUITools.isPrivate(configurations[i])) {
+ for (ILaunchConfiguration configuration : configurations) {
+ if (DebugUITools.isPrivate(configuration)) {
//auto-migrate private ones
- configurations[i].migrate();
- }
- else {
- pub.add(configurations[i]);
+ configuration.migrate();
+ } else {
+ pub.add(configuration);
}
}
if(pub.isEmpty()) {
@@ -301,9 +295,9 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement
fMonitor = new ProgressMonitorPart(fMigrateNow.getParent(), new GridLayout());
Object[] objs = listd.getResult();
fMonitor.beginTask(DebugPreferencesMessages.LaunchingPreferencePage_31, objs.length);
- for(int i = 0; i < objs.length; i++) {
- if(objs[i] instanceof ILaunchConfiguration) {
- ((ILaunchConfiguration)objs[i]).migrate();
+ for (Object obj : objs) {
+ if (obj instanceof ILaunchConfiguration) {
+ ((ILaunchConfiguration) obj).migrate();
}
fMonitor.worked(1);
}
@@ -322,9 +316,7 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement
* @since 3.2
*/
private void initFieldEditors() {
- FieldEditor editor;
- for(int i = 0; i < fFieldEditors.size(); i++) {
- editor = fFieldEditors.get(i);
+ for (FieldEditor editor : fFieldEditors) {
editor.setPreferenceStore(getPreferenceStore());
editor.load();
}
@@ -332,14 +324,13 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement
Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(),
DebugPlugin.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null));
//restore the tables' checked state
- String[] types = getPreferenceStore().getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,"); //$NON-NLS-1$
TableItem[] items = fTable.getItems();
ILaunchConfigurationType type;
- for(int i = 0; i < types.length; i++) {
- for(int j = 0; j < items.length; j++) {
- type = (ILaunchConfigurationType)items[j].getData();
- if(type.getIdentifier().equals(types[i])) {
- items[j].setChecked(true);
+ for (String t : getPreferenceStore().getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,")) { //$NON-NLS-1$
+ for (TableItem item : items) {
+ type = (ILaunchConfigurationType) item.getData();
+ if (type.getIdentifier().equals(t)) {
+ item.setChecked(true);
}
}
}
@@ -348,31 +339,27 @@ public class LaunchConfigurationsPreferencePage extends PreferencePage implement
@Override
protected void performDefaults() {
fDeleteConfigs.setSelection(Preferences.getDefaultBoolean(DebugPlugin.getUniqueIdentifier(), DebugPlugin.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true));
- FieldEditor editor = null;
- for(int i = 0; i < fFieldEditors.size(); i++) {
- editor = fFieldEditors.get(i);
+ for (FieldEditor editor : fFieldEditors) {
editor.loadDefault();
if(editor instanceof BooleanFieldEditor2) {
fTable.setEnabled(((BooleanFieldEditor2)editor).getBooleanValue());
}
}
-
}
@Override
public boolean performOk() {
//save field editors
- for(int i = 0; i < fFieldEditors.size(); i++) {
- fFieldEditors.get(i).store();
+ for (FieldEditor editor : fFieldEditors) {
+ editor.store();
}
Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), DebugPlugin.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, fDeleteConfigs.getSelection(), null);
//save table
String types = IInternalDebugCoreConstants.EMPTY_STRING;
- TableItem[] items = fTable.getItems();
ILaunchConfigurationType type;
- for(int i = 0; i < items.length; i++) {
- if(items[i].getChecked()) {
- type = (ILaunchConfigurationType)items[i].getData();
+ for (TableItem item : fTable.getItems()) {
+ if (item.getChecked()) {
+ type = (ILaunchConfigurationType) item.getData();
types += type.getIdentifier()+","; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java
index 23b970649..2fc1bb843 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java
@@ -42,12 +42,8 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
@@ -131,7 +127,7 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I
/**
* Provides content for the configuration tree viewer
*/
- final class PerspectiveContentProvider implements ITreeContentProvider {
+ static final class PerspectiveContentProvider implements ITreeContentProvider {
@Override
public Object[] getChildren(Object parentElement) {
if(parentElement instanceof ILaunchConfigurationType) {
@@ -328,20 +324,12 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I
gd.heightHint = 250;
fTree.setLayoutData(gd);
fTreeViewer = new PerspectivesTreeViewer(fTree);
- fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- fPerspectivesPanel.refreshPanel(event.getStructuredSelection());
- }
- });
- fTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection ss = (IStructuredSelection) event.getSelection();
- if(!ss.isEmpty()) {
- Object obj = ss.getFirstElement();
- fTreeViewer.setExpandedState(obj, !fTreeViewer.getExpandedState(obj));
- }
+ fTreeViewer.addSelectionChangedListener(event -> fPerspectivesPanel.refreshPanel(event.getStructuredSelection()));
+ fTreeViewer.addDoubleClickListener(event -> {
+ IStructuredSelection ss = (IStructuredSelection) event.getSelection();
+ if(!ss.isEmpty()) {
+ Object obj = ss.getFirstElement();
+ fTreeViewer.setExpandedState(obj, !fTreeViewer.getExpandedState(obj));
}
});
fTreeViewer.setLabelProvider(DebugUITools.newDebugModelPresentation());
@@ -468,27 +456,22 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I
//prep selection context, remove types from the equation
HashSet<ILaunchDelegate> delegates = new HashSet<>();
- Object o = null;
- for(int i = 0; i < selection.length; i++) {
- o = selection[i];
+ for (Object o : selection) {
if(o instanceof ILaunchDelegate) {
delegates.add((ILaunchDelegate) o);
}
else if(o instanceof ILaunchConfigurationType) {
fgCurrentWorkingContext.add(o);
- Object[] kids = fTreeViewer.getFilteredChildren(o);
- for (int j = 0; j < kids.length; j++) {
- delegates.add((ILaunchDelegate) kids[i]);
+ for (Object kid : fTreeViewer.getFilteredChildren(o)) {
+ delegates.add((ILaunchDelegate) kid);
}
}
}
//compare the listing of delegates to find common mode sets
HashSet<Set<String>> common = new HashSet<>();
- List<Set<String>> modes = null;
HashSet<Set<String>> pruned = new HashSet<>();
for (ILaunchDelegate delegate : delegates) {
- modes = delegate.getModes();
- for (Set<String> fmodes : modes) {
+ for (Set<String> fmodes : delegate.getModes()) {
if (isCommonModeset(fmodes, delegates, pruned)) {
common.add(fmodes);
fgCurrentWorkingContext.add(delegate);
@@ -544,21 +527,14 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I
fSwitchSuspend.loadDefault();
PerspectiveManager pm = DebugUIPlugin.getDefault().getPerspectiveManager();
- TreeItem[] items = fTree.getItems();
- ILaunchConfigurationType type = null;
- Set<Set<String>> modes = null;
- Object[] delegates = null;
- for(int i = 0; i < items.length; i++) {
- type = (ILaunchConfigurationType) items[i].getData();
- modes = type.getSupportedModeCombinations();
- delegates = fTreeViewer.getFilteredChildren(type);
- for (Set<String> modeset : modes) {
+ for (TreeItem item : fTree.getItems()) {
+ ILaunchConfigurationType type = (ILaunchConfigurationType) item.getData();
+ for (Set<String> modeset : type.getSupportedModeCombinations()) {
fgChangeSet.add(new PerspectiveChange(type, null, modeset, pm.getDefaultLaunchPerspective(type, null, modeset)));
}
- for(int j = 0; j < delegates.length; j++) {
- ILaunchDelegate delegate = (ILaunchDelegate) delegates[j];
- modes = new HashSet<>(delegate.getModes());
- for (Set<String> modeset : modes) {
+ for (Object child : fTreeViewer.getFilteredChildren(type)) {
+ ILaunchDelegate delegate = (ILaunchDelegate) child;
+ for (Set<String> modeset : new HashSet<>(delegate.getModes())) {
fgChangeSet.add(new PerspectiveChange(type, delegate, modeset, pm.getDefaultLaunchPerspective(type, delegate, modeset)));
}
}
@@ -580,13 +556,12 @@ public class LaunchPerspectivePreferencePage extends PreferencePage implements I
ArrayList<String> labels = new ArrayList<>();
labels.add(DebugPreferencesMessages.PerspectivePreferencePage_4);
IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry();
- IPerspectiveDescriptor[] descriptors = registry.getPerspectives();
String label = null;
- for(int i = 0; i < descriptors.length; i++) {
- if(!WorkbenchActivityHelper.filterItem(descriptors[i])) {
- label = descriptors[i].getLabel();
+ for (IPerspectiveDescriptor descriptor : registry.getPerspectives()) {
+ if(!WorkbenchActivityHelper.filterItem(descriptor)) {
+ label = descriptor.getLabel();
labels.add(label);
- fgPerspectiveIdMap.put(label, descriptors[i].getId());
+ fgPerspectiveIdMap.put(label, descriptor.getId());
}
}
fgPerspectiveLabels = labels.toArray(new String[labels.size()]);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java
index dbacaeeaa..77f4c36c4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java
@@ -33,13 +33,9 @@ import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
@@ -69,7 +65,7 @@ public class LaunchersPreferencePage extends PreferencePage implements IWorkbenc
/**
* Class to collect and persist attributes to sufficiently describe a duplicate launch delegate
*/
- class DuplicateDelegate {
+ static class DuplicateDelegate {
private ILaunchConfigurationType fType = null;
private ILaunchDelegate[] fDelegates = null;
private Set<String> fModes = null;
@@ -190,25 +186,22 @@ public class LaunchersPreferencePage extends PreferencePage implements IWorkbenc
fTreeViewer.setLabelProvider(new LabelProvider());
fTreeViewer.setInput(fDuplicates);
fTreeViewer.expandToLevel(2);
- fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = event.getStructuredSelection().getFirstElement();
- if(obj instanceof DuplicateDelegate) {
- fTableViewer.setAllChecked(false);
- DuplicateDelegate dd = (DuplicateDelegate) obj;
- fTableViewer.setInput(dd.getDelegates());
- fTableViewer.setSelection(null);
- obj = fDupeSelections.get(dd);
- if(obj != null) {
- fTableViewer.setChecked(obj, true);
- fTableViewer.setSelection(new StructuredSelection(obj));
- }
- }
- else {
- fTableViewer.setInput(null);
+ fTreeViewer.addSelectionChangedListener(event -> {
+ Object obj = event.getStructuredSelection().getFirstElement();
+ if(obj instanceof DuplicateDelegate) {
+ fTableViewer.setAllChecked(false);
+ DuplicateDelegate dd = (DuplicateDelegate) obj;
+ fTableViewer.setInput(dd.getDelegates());
+ fTableViewer.setSelection(null);
+ obj = fDupeSelections.get(dd);
+ if(obj != null) {
+ fTableViewer.setChecked(obj, true);
+ fTableViewer.setSelection(new StructuredSelection(obj));
}
}
+ else {
+ fTableViewer.setInput(null);
+ }
});
//table
@@ -221,40 +214,34 @@ public class LaunchersPreferencePage extends PreferencePage implements IWorkbenc
fTableViewer = new CheckboxTableViewer(table);
fTableViewer.setComparator(new WorkbenchViewerComparator());
fTableViewer.setLabelProvider(new LabelProvider());
- fTableViewer.setContentProvider(new ArrayContentProvider());
- fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection ss = event.getStructuredSelection();
- if(ss != null && !ss.isEmpty()) {
- ILaunchDelegate delegate = (ILaunchDelegate)ss.getFirstElement();
- fDescription.setText(delegate.getDescription());
- }
- else {
- fDescription.setText(IInternalDebugCoreConstants.EMPTY_STRING);
- }
+ fTableViewer.setContentProvider(ArrayContentProvider.getInstance());
+ fTableViewer.addSelectionChangedListener(event -> {
+ IStructuredSelection ss = event.getStructuredSelection();
+ if(ss != null && !ss.isEmpty()) {
+ ILaunchDelegate delegate = (ILaunchDelegate)ss.getFirstElement();
+ fDescription.setText(delegate.getDescription());
+ }
+ else {
+ fDescription.setText(IInternalDebugCoreConstants.EMPTY_STRING);
}
});
- fTableViewer.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- fDirty = true;
- Object element = event.getElement();
- boolean checked = event.getChecked();
- //always set checked, this way users cannot 'undo' a change to selecting a preferred delegate
- //The story for this is that on startup if there are dupes, the user is prompted to pick a delegate, after that they cannot
- //return to a state of not being able to launch something, but can pick a different delegate
- fTableViewer.setCheckedElements(new Object[] {element});
- //set the selection to be the checked element
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=233233
- fTableViewer.setSelection(new StructuredSelection(element));
- //persist the selection
- Object obj = fTreeViewer.getStructuredSelection().getFirstElement();
- if(obj instanceof DuplicateDelegate) {
- fDupeSelections.remove(obj);
- if(checked) {
- fDupeSelections.put((DuplicateDelegate) obj, (ILaunchDelegate) element);
- }
+ fTableViewer.addCheckStateListener(event -> {
+ fDirty = true;
+ Object element = event.getElement();
+ boolean checked = event.getChecked();
+ //always set checked, this way users cannot 'undo' a change to selecting a preferred delegate
+ //The story for this is that on startup if there are dupes, the user is prompted to pick a delegate, after that they cannot
+ //return to a state of not being able to launch something, but can pick a different delegate
+ fTableViewer.setCheckedElements(new Object[] {element});
+ //set the selection to be the checked element
+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=233233
+ fTableViewer.setSelection(new StructuredSelection(element));
+ //persist the selection
+ Object obj = fTreeViewer.getStructuredSelection().getFirstElement();
+ if(obj instanceof DuplicateDelegate) {
+ fDupeSelections.remove(obj);
+ if(checked) {
+ fDupeSelections.put((DuplicateDelegate) obj, (ILaunchDelegate) element);
}
}
});
@@ -296,20 +283,20 @@ public class LaunchersPreferencePage extends PreferencePage implements IWorkbenc
Set<DuplicateDelegate> tmp = null;
ILaunchDelegate prefdelegate = null;
DuplicateDelegate dd = null;
- for(int i = 0; i < types.length; i++) {
- modes = types[i].getSupportedModeCombinations();
+ for (ILaunchConfigurationType type : types) {
+ modes = type.getSupportedModeCombinations();
for (Iterator<Set<String>> iter = modes.iterator(); iter.hasNext();) {
modeset = iter.next();
- delegates = types[i].getDelegates(modeset);
- if(delegates.length > 1) {
- tmp = fDuplicates.get(types[i]);
+ delegates = type.getDelegates(modeset);
+ if (delegates.length > 1) {
+ tmp = fDuplicates.get(type);
if(tmp == null) {
tmp = new HashSet<>();
}
- dd = new DuplicateDelegate(types[i], delegates, modeset);
+ dd = new DuplicateDelegate(type, delegates, modeset);
tmp.add(dd);
- fDuplicates.put(types[i], tmp);
- prefdelegate = types[i].getPreferredDelegate(modeset);
+ fDuplicates.put(type, tmp);
+ prefdelegate = type.getPreferredDelegate(modeset);
if(prefdelegate != null) {
fDupeSelections.put(dd, prefdelegate);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java
index 2bdbae4fb..39957a330 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;
+import java.text.MessageFormat;
+
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
@@ -38,8 +40,6 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
-import com.ibm.icu.text.MessageFormat;
-
/**
* A preference page for configuring launching preferences.
*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java
index 2100fdd96..4e086e8ad 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,16 +10,20 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Paul Pazderski - Bug 251642: show process termination time
*******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;
+import java.text.DateFormat;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.core.runtime.Adapters;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IProcess;
@@ -27,8 +31,6 @@ import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BidiSegmentEvent;
-import org.eclipse.swt.custom.BidiSegmentListener;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
@@ -38,8 +40,6 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyPage;
-import com.ibm.icu.text.DateFormat;
-
public class ProcessPropertyPage extends PropertyPage {
private static Font fHeadingFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
@@ -57,13 +57,30 @@ public class ProcessPropertyPage extends PropertyPage {
Composite parent = SWTFactory.createComposite(ancestor, ancestor.getFont(), 1, 1, GridData.FILL_BOTH);
IProcess proc = getProcess();
-
- //create the process time section
+ Text text;
+ if (proc.getAttribute(IProcess.ATTR_PROCESS_ID) != null) {
+ SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_11, fHeadingFont, 1);
+ text = SWTFactory.createText(parent, SWT.READ_ONLY, 1);
+ ((GridData) text.getLayoutData()).horizontalIndent = 10;
+ text.setText(proc.getAttribute(IProcess.ATTR_PROCESS_ID));
+ text.setBackground(parent.getBackground());
+ SWTFactory.createVerticalSpacer(parent, 2);
+ }
+ // create the process launch time section
SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_0, fHeadingFont, 1);
- Text text = SWTFactory.createText(parent, SWT.READ_ONLY, 1);
+ text = SWTFactory.createText(parent, SWT.READ_ONLY, 1);
((GridData)text.getLayoutData()).horizontalIndent = 10;
PlatformUI.getWorkbench().getHelpSystem().setHelp(text, IDebugHelpContextIds.PROCESS_PAGE_RUN_AT);
- text.setText(getTimeText(proc));
+ text.setText(getLaunchTimeText(proc));
+ text.setBackground(parent.getBackground());
+ SWTFactory.createVerticalSpacer(parent, 2);
+
+ // create the process terminate time section
+ SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_10, fHeadingFont, 1);
+ text = SWTFactory.createText(parent, SWT.READ_ONLY, 1);
+ ((GridData) text.getLayoutData()).horizontalIndent = 10;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(text, IDebugHelpContextIds.PROCESS_PAGE_TERMINATE_AT);
+ text.setText(getTerminateTimeText(proc));
text.setBackground(parent.getBackground());
SWTFactory.createVerticalSpacer(parent, 2);
@@ -103,34 +120,31 @@ public class ProcessPropertyPage extends PropertyPage {
final int[] segments = new int[count - 1];
commandLineText = DebugPlugin.renderArguments(arguments, segments);
- styledText.addBidiSegmentListener(new BidiSegmentListener() {
- @Override
- public void lineGetSegments(BidiSegmentEvent event) {
- int offset = event.lineOffset;
- int end = offset + event.lineText.length();
+ styledText.addBidiSegmentListener(event -> {
+ int offset = event.lineOffset;
+ int end = offset + event.lineText.length();
- // extract segments for the current line:
- int iStart = Arrays.binarySearch(segments, offset);
- if (iStart < 0) {
- iStart = -iStart - 1;
- }
- int i = iStart;
- while (i < segments.length && segments[i] < end) {
- i++;
- }
- int n = i - iStart;
- if (n > 0) {
- if (n == segments.length) {
- event.segments = segments;
- } else {
- int[] lineSegments = new int[n];
- System.arraycopy(segments, iStart, lineSegments, 0, n);
- event.segments = lineSegments;
- }
- final char[] chars = new char[n];
- Arrays.fill(chars, '\n');
- event.segmentsChars = chars;
+ // extract segments for the current line:
+ int iStart = Arrays.binarySearch(segments, offset);
+ if (iStart < 0) {
+ iStart = -iStart - 1;
+ }
+ int i = iStart;
+ while (i < segments.length && segments[i] < end) {
+ i++;
+ }
+ int n = i - iStart;
+ if (n > 0) {
+ if (n == segments.length) {
+ event.segments = segments;
+ } else {
+ int[] lineSegments = new int[n];
+ System.arraycopy(segments, iStart, lineSegments, 0, n);
+ event.segments = lineSegments;
}
+ final char[] chars = new char[n];
+ Arrays.fill(chars, '\n');
+ event.segmentsChars = chars;
}
});
}
@@ -157,20 +171,29 @@ public class ProcessPropertyPage extends PropertyPage {
/**
* Gets the process from the selected element
- * @return the process or null if the element is not a process
+ *
+ * @return the process or null if the element does not implement or adapt
+ * IProcess
*
* @since 3.2
*/
private IProcess getProcess() {
- IProcess proc = null;
- Object obj = getElement();
- if (obj instanceof IDebugElement) {
- obj = ((IDebugElement)obj).getDebugTarget().getProcess();
+ IAdaptable element = getElement();
+ if (element instanceof IProcess) {
+ return ((IProcess) element);
+ }
+ if (element instanceof IDebugElement) {
+ return ((IDebugElement)element).getDebugTarget().getProcess();
}
- if (obj instanceof IProcess) {
- proc = ((IProcess)obj);
+ Object adapted = Adapters.adapt(element, IProcess.class, true);
+ if (adapted != null) {
+ return ((IProcess) adapted);
}
- return proc;
+ adapted = Adapters.adapt(element, IDebugElement.class, true);
+ if (adapted != null) {
+ return ((IDebugElement) adapted).getDebugTarget().getProcess();
+ }
+ return null;
}
/**
@@ -189,6 +212,8 @@ public class ProcessPropertyPage extends PropertyPage {
return tmp;
}
tmp = proc.getLabel();
+ // TODO remove this ugly workaround after removing start time from process label
+ // in jdt
int idx = tmp.lastIndexOf('(');
if(idx < 0) {
idx = tmp.length();
@@ -199,44 +224,70 @@ public class ProcessPropertyPage extends PropertyPage {
}
/**
- * gets the pattern of text from the process label specified by RegEx
- * @param proc the process to compile the RegEx against
- * @param deftext the default text to return if the process is null
- * @param regex the RegEx to match in the process label
- * @return the RegEx matched text or the default supplied text if the process is null
+ * Try to get the launch time for the process.
*
- * @see DebugPlugin#ATTR_RUN_AT_TIME
+ * @param proc the process to get launch time for
+ * @return the launch time or default replacement
* @since 3.2
*/
- private String getTimeText(IProcess proc) {
- String text = DebugPreferencesMessages.ProcessPropertyPage_4;
- if(proc != null) {
- String tmp = proc.getAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP);
- if(tmp != null) {
- //check to see if the date/time is just the raw long (as a string)
- try {
- long l = Long.parseLong(tmp);
- return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(new Date(l));
- }
- catch(NumberFormatException nfe) {
- //not a number try to format the string so it always looks the same
- try {
- Date fdate = DateFormat.getInstance().parse(tmp);
- return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(fdate);
- }
- catch(ParseException pe) {
- //couldn't do it, return the raw string
- }
- }
- return tmp;
- }
- Pattern pattern = Pattern.compile("\\(.*\\)"); //$NON-NLS-1$
- Matcher matcher = pattern.matcher(proc.getLabel());
- if(matcher.find()) {
- text = matcher.group(0);
+ private String getLaunchTimeText(IProcess proc) {
+ String text = getTimeFromAttribute(proc, DebugPlugin.ATTR_LAUNCH_TIMESTAMP);
+ if (text != null) {
+ return text;
+ }
+ // TODO remove this parsing when launch time is no fixed part of label anymore
+ Pattern pattern = Pattern.compile("\\(.*\\)"); //$NON-NLS-1$
+ Matcher matcher = pattern.matcher(proc.getLabel());
+ if (matcher.find()) {
+ text = matcher.group(0);
+ }
+ if (text != null) {
+ return text;
+ }
+ return DebugPreferencesMessages.ProcessPropertyPage_4;
+ }
+
+ /**
+ * Try to get the terminate time for the process.
+ *
+ * @param proc the process to get terminate time for
+ * @return the terminate time or default replacement
+ */
+ private String getTerminateTimeText(IProcess proc) {
+ String text = getTimeFromAttribute(proc, DebugPlugin.ATTR_TERMINATE_TIMESTAMP);
+ return text != null ? text : DebugPreferencesMessages.ProcessPropertyPage_4;
+ }
+
+ /**
+ * Try to process launch timestamp attribute.
+ *
+ * @param proc the process to check
+ * @param attr the process attribute to check for timestamp
+ * @return the timestamp string or <code>null</code>
+ * @since 3.2
+ */
+ private String getTimeFromAttribute(IProcess proc, String attr) {
+ if (proc == null || attr == null) {
+ return null;
+ }
+ String time = proc.getAttribute(attr);
+ if (time == null) {
+ return null;
+ }
+ // check to see if the date/time is just the raw long (as a string)
+ try {
+ long l = Long.parseLong(time);
+ return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(new Date(l));
+ } catch (NumberFormatException nfe) {
+ // not a number try to format the string so it always looks the same
+ try {
+ Date fdate = DateFormat.getInstance().parse(time);
+ return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(fdate);
+ } catch (ParseException pe) {
+ // couldn't do it, return the raw string
}
}
- return text;
+ return time;
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
index 1c836f42e..7c7f7aaaa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java
@@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -41,12 +41,8 @@ import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDi
import org.eclipse.debug.ui.ILaunchGroup;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.Window;
@@ -63,8 +59,6 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.ui.dialogs.SelectionDialog;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Displays default launch configuration settings for a selected resource - associated launch configurations.
*
@@ -178,7 +172,7 @@ public class RunDebugPropertiesPage extends PropertyPage {
protected TableViewer createViewer(Composite parent){
TableViewer viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
viewer.setLabelProvider(new DefaultLabelProvider());
- viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setComparator(new LaunchConfigurationComparator());
Table builderTable = viewer.getTable();
GridData tableGridData = new GridData(GridData.FILL_BOTH);
@@ -187,27 +181,19 @@ public class RunDebugPropertiesPage extends PropertyPage {
builderTable.setLayoutData(tableGridData);
IResource resource = getResource();
viewer.setInput(collectConfigCandidates(resource));
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection sel = event.getSelection();
- if(sel instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) sel;
- boolean empty = ss.isEmpty();
- int size = ss.size();
- fEditButton.setEnabled(!empty && size == 1);
- fDuplicateButton.setEnabled(!empty && size == 1);
- fDeleteButton.setEnabled(!empty);
- setErrorMessage(null);
- }
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent arg0) {
- handleEdit();
+ viewer.addSelectionChangedListener(event -> {
+ ISelection sel = event.getSelection();
+ if(sel instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) sel;
+ boolean empty = ss.isEmpty();
+ int size = ss.size();
+ fEditButton.setEnabled(!empty && size == 1);
+ fDuplicateButton.setEnabled(!empty && size == 1);
+ fDeleteButton.setEnabled(!empty);
+ setErrorMessage(null);
}
});
+ viewer.addDoubleClickListener(arg0 -> handleEdit());
return viewer;
}
@@ -251,17 +237,14 @@ public class RunDebugPropertiesPage extends PropertyPage {
if(fTypeCandidates == null) {
String[] types = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource());
fTypeCandidates = new ArrayList<>(types.length);
- for(int i = 0; i < types.length; i++) {
- fTypeCandidates.add(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(types[i]));
+ for (String type : types) {
+ fTypeCandidates.add(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(type));
}
- Collections.sort(fTypeCandidates, new Comparator<ILaunchConfigurationType>() {
- @Override
- public int compare(ILaunchConfigurationType o1, ILaunchConfigurationType o2) {
- ILaunchConfigurationType t1 = o1;
- ILaunchConfigurationType t2 = o2;
- return t1.getName().compareTo(t2.getName());
- }
+ Collections.sort(fTypeCandidates, (o1, o2) -> {
+ ILaunchConfigurationType t1 = o1;
+ ILaunchConfigurationType t2 = o2;
+ return t1.getName().compareTo(t2.getName());
});
}
return fTypeCandidates.toArray(new ILaunchConfigurationType[fTypeCandidates.size()]);
@@ -279,8 +262,8 @@ public class RunDebugPropertiesPage extends PropertyPage {
fOriginalCandidates = new HashSet<>();
try {
ILaunchConfiguration[] configs = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableLaunchConfigurations(null, resource);
- for(int i = 0; i < configs.length; i++) {
- fOriginalCandidates.add(configs[i].getWorkingCopy());
+ for (ILaunchConfiguration config : configs) {
+ fOriginalCandidates.add(config.getWorkingCopy());
}
}
catch(CoreException ce) {DebugUIPlugin.log(ce);}
@@ -394,10 +377,10 @@ public class RunDebugPropertiesPage extends PropertyPage {
int[] indices = table.getSelectionIndices();
Arrays.sort(indices);
ILaunchConfigurationWorkingCopy[] configurations = getSelectedConfigurations();
- for (int i = 0; i < configurations.length; i++) {
- fDeletedConfigurations.add(configurations[i]);
- fChangedConfigurations.remove(configurations[i]);
- fViewer.remove(configurations[i]);
+ for (ILaunchConfigurationWorkingCopy configuration : configurations) {
+ fDeletedConfigurations.add(configuration);
+ fChangedConfigurations.remove(configuration);
+ fViewer.remove(configuration);
}
if (indices[0] < table.getItemCount()) {
fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData()));
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 d0acf296e..b6a8adaac 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
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -31,10 +32,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -66,8 +64,6 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Preference page for creating and configuring simple
* launch variables.
@@ -179,19 +175,11 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
}
});
- variableTable.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleTableSelectionChanged(event);
- }
- });
+ variableTable.addSelectionChangedListener(this::handleTableSelectionChanged);
- variableTable.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (!variableTable.getSelection().isEmpty()) {
- handleEditButtonPressed();
- }
+ variableTable.addDoubleClickListener(event -> {
+ if (!variableTable.getSelection().isEmpty()) {
+ handleEditButtonPressed();
}
});
variableTable.getTable().addKeyListener(new KeyAdapter() {
@@ -388,8 +376,8 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
}
}
VariableWrapper[] variables= variablesToRemove.toArray(new VariableWrapper[0]);
- for (int i = 0; i < variables.length; i++) {
- variables[i].setRemoved(true);
+ for (VariableWrapper variable : variables) {
+ variable.setRemoved(true);
}
variableTable.refresh();
}
@@ -474,8 +462,8 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
private void restoreDefaultColumnWidths(){
TableLayout layout = new TableLayout();
- for (int i = 0; i < variableTableColumnLayouts.length; i++) {
- layout.addColumnData(variableTableColumnLayouts[i]);
+ for (ColumnLayoutData variableTableColumnLayout : variableTableColumnLayouts) {
+ layout.addColumnData(variableTableColumnLayout);
}
variableTable.getTable().setLayout(layout);
}
@@ -560,8 +548,8 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
fWorkingSet.clear();
IStringVariableManager manager = getVariableManager();
IValueVariable[] variables = manager.getValueVariables();
- for (int i = 0; i < variables.length; i++) {
- fWorkingSet.add(new VariableWrapper(variables[i]));
+ for (IValueVariable variable : variables) {
+ fWorkingSet.add(new VariableWrapper(variable));
}
}
@@ -576,7 +564,7 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
}
- class VariableWrapper {
+ static class VariableWrapper {
protected IValueVariable fVariable;
protected String fNewName = null;
@@ -734,7 +722,7 @@ public class StringVariablePreferencePage extends PreferencePage implements IWor
}
}
- class VariableFilter extends ViewerFilter {
+ static class VariableFilter extends ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
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 eba619326..b111152ed 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
@@ -15,7 +15,6 @@
package org.eclipse.debug.internal.ui.preferences;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
@@ -184,18 +183,17 @@ public class ViewManagementPreferencePage extends PreferencePage implements IWor
@Override
public boolean performOk() {
- Object[] descriptors = fPerspectiveViewer.getCheckedElements();
Set<String> perspectives = new HashSet<>();
- for (int i = 0; i < descriptors.length; i++) {
- perspectives.add( ((IPerspectiveDescriptor)descriptors[i]).getId() );
+ for (Object descriptor : fPerspectiveViewer.getCheckedElements()) {
+ perspectives.add( ((IPerspectiveDescriptor)descriptor).getId() );
}
if (perspectives.equals(ViewContextService.getDefaultEnabledPerspectives())) {
getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES,
IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT);
} else {
StringBuilder buffer= new StringBuilder();
- for (Iterator<String> itr = perspectives.iterator(); itr.hasNext();) {
- buffer.append(itr.next()).append(',');
+ for (String id : perspectives) {
+ buffer.append(id).append(',');
}
getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, buffer.toString());
}
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 3cec78f55..59c8333b0 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
@@ -28,11 +28,7 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerComparator;
@@ -92,29 +88,21 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
gd = new GridData(GridData.FILL_BOTH);
table.setLayoutData(gd);
- fViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
+ fViewer.addDoubleClickListener(event -> okPressed());
fViewer.setLabelProvider(new SourceContainerLabelProvider());
- fViewer.setContentProvider(new ArrayContentProvider());
+ fViewer.setContentProvider(ArrayContentProvider.getInstance());
fViewer.setComparator(new ViewerComparator());
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = event.getStructuredSelection();
- if (!selection.isEmpty()) {
- ISourceContainerType type = (ISourceContainerType) selection.getFirstElement();
- setMessage(type.getDescription());
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- else {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- setMessage(SourceLookupUIMessages.AddSourceContainerDialog_select_source_container);
- }
+ fViewer.addSelectionChangedListener(event -> {
+ IStructuredSelection selection = event.getStructuredSelection();
+ if (!selection.isEmpty()) {
+ ISourceContainerType type = (ISourceContainerType) selection.getFirstElement();
+ setMessage(type.getDescription());
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ }
+ else {
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ setMessage(SourceLookupUIMessages.AddSourceContainerDialog_select_source_container);
}
});
if(types.length != 0) {
@@ -160,8 +148,7 @@ public class AddSourceContainerDialog extends TitleAreaDialog {
*/
private ISourceContainerType[] filterTypes(ISourceContainerType[] types){
ArrayList<ISourceContainerType> validTypes = new ArrayList<>();
- for (int i=0; i< types.length; i++) {
- ISourceContainerType type = types[i];
+ for (ISourceContainerType type : types) {
if (fDirector.supportsSourceContainerType(type)) {
ISourceContainerBrowser sourceContainerBrowser = DebugUITools.getSourceContainerBrowser(type.getId());
if(sourceContainerBrowser != null && sourceContainerBrowser.canAddSourceContainers(fDirector)) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/BasicContainerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/BasicContainerContentProvider.java
index 13e202b52..d1ea20c84 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/BasicContainerContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/BasicContainerContentProvider.java
@@ -44,9 +44,9 @@ public class BasicContainerContentProvider implements ITreeContentProvider {
}
ArrayList<IProject> accessibleProjects = new ArrayList<>();
- for (int i = 0; i < allProjects.length; i++) {
- if (allProjects[i].isOpen()) {
- accessibleProjects.add(allProjects[i]);
+ for (IProject p : allProjects) {
+ if (p.isOpen()) {
+ accessibleProjects.add(p);
}
}
return accessibleProjects.toArray();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java
index 7ce9ef61d..aa46ebe65 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceContainerAction.java
@@ -82,8 +82,7 @@ public abstract class SourceContainerAction extends SelectionListenerAction {
List<ISourceContainer> targets = new ArrayList<>();
List<Object> selection = getViewer().getStructuredSelection().toList();
ISourceContainer[] entries = getViewer().getEntries();
- for (int i = 0; i < entries.length; i++) {
- ISourceContainer target = entries[i];
+ for (ISourceContainer target : entries) {
if (selection.contains(target)) {
targets.add(target);
}
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 b69e76c96..55d9c2b03 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
@@ -100,9 +100,9 @@ public class SourceContainerViewer extends TreeViewer {
*/
public void setEntries(ISourceContainer[] entries) {
fEntries.clear();
- for (int i = 0; i < entries.length; i++) {
- if(entries[i] != null) {
- fEntries.add(entries[i]);
+ for (ISourceContainer entry : entries) {
+ if(entry != null) {
+ fEntries.add(entry);
}
}
if (getInput() == null) {
@@ -141,9 +141,9 @@ public class SourceContainerViewer extends TreeViewer {
if (!sel.isEmpty()) {
index = fEntries.indexOf(sel.getFirstElement());
}
- for (int i = 0; i < entries.length; i++) {
- if (!fEntries.contains(entries[i])) {
- fEntries.add(index, entries[i]);
+ for (ISourceContainer entry : entries) {
+ if (!fEntries.contains(entry)) {
+ fEntries.add(index, entry);
index++;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementWorkbenchAdapter.java
index 4c569cfcd..8acda2295 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementWorkbenchAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceElementWorkbenchAdapter.java
@@ -41,6 +41,7 @@ public class SourceElementWorkbenchAdapter implements IWorkbenchAdapter {
}
return null;
}
+ @SuppressWarnings("resource")
@Override
public String getLabel(Object o) {
if (o instanceof LocalFileStorage) {
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 28d0f4558..74e359d73 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
@@ -15,9 +15,13 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.sourcelookup;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Objects;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -69,6 +73,7 @@ import org.eclipse.ui.IReusableEditor;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.progress.UIJob;
@@ -87,10 +92,9 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
*
* @since 3.10
*/
- static class LRU extends HashMap<Object, SourceLookupResult> {
+ static class LRU extends LinkedHashMap<Object, SourceLookupResult> {
private static final long serialVersionUID = 1L;
- ArrayList<Object> fEntryStack = null;
int fSize;
/**
@@ -99,44 +103,14 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
* @param size The desired size
*/
LRU(int size) {
+ // true == use this map like LRU cache
+ super(size, 0.75f, true);
fSize = size;
- fEntryStack = new ArrayList<>();
}
@Override
- public SourceLookupResult put(Object key, SourceLookupResult value) {
- shuffle(key);
- return super.put(key, value);
- }
-
- @Override
- public SourceLookupResult remove(Object key) {
- SourceLookupResult oldResult = super.remove(key);
- fEntryStack.remove(key);
- return oldResult;
- }
-
- /**
- * Shuffles the entry stack and removes mapped results as needed
- *
- * @param key
- */
- void shuffle(Object key) {
- int index = fEntryStack.indexOf(key);
- if (index < 0) {
- if (fEntryStack.size() >= fSize) {
- remove(fEntryStack.get(fEntryStack.size() - 1));
- }
- } else {
- fEntryStack.remove(index);
- }
- fEntryStack.add(0, key);
- }
-
- @Override
- public void clear() {
- fEntryStack.clear();
- super.clear();
+ protected boolean removeEldestEntry(Map.Entry<Object, SourceLookupResult> eldest) {
+ return size() > fSize;
}
}
@@ -157,7 +131,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
*
* @since 3.10
*/
- private static LRU fLookupResults = new LRU(10);
+ private final Map<Object, SourceLookupResult> fLookupResults = Collections.synchronizedMap(new LRU(10));
/**
* Used to generate annotations for stack frames
@@ -169,6 +143,9 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
*/
private boolean fReuseEditor = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_REUSE_EDITOR);
+ /** Singleton job to process source lookup requests */
+ private final SourceLookupJob sourceLookupJob;
+
/**
* Constructs singleton source display adapter for stack frames.
*/
@@ -198,6 +175,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
*/
private SourceLookupFacility() {
fEditorsByPage = new HashMap<>();
+ sourceLookupJob = new SourceLookupJob();
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
DebugPlugin.getDefault().addDebugEventListener(this);
}
@@ -205,8 +183,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
@Override
public void handleDebugEvents(DebugEvent[] events) {
IStackFrame frame = null;
- for (int i = 0; i < events.length; i++) {
- final DebugEvent event = events[i];
+ for (DebugEvent event : events) {
switch (event.getKind()) {
case DebugEvent.TERMINATE:
case DebugEvent.RESUME:
@@ -237,7 +214,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
}
}
- private class ArtifactWithLocator {
+ private static class ArtifactWithLocator {
public final Object artifact;
public final ISourceLocator locator;
public ArtifactWithLocator(Object artifact, ISourceLocator locator) {
@@ -247,12 +224,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + getOuterType().hashCode();
- result = prime * result + ((artifact == null) ? 0 : artifact.hashCode());
- result = prime * result + ((locator == null) ? 0 : locator.hashCode());
- return result;
+ return 31 + Objects.hash(artifact, locator);
}
@Override
@@ -260,36 +232,30 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
if (this == obj) {
return true;
}
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
+ if (!(obj instanceof ArtifactWithLocator)) {
return false;
}
ArtifactWithLocator other = (ArtifactWithLocator) obj;
- if (!getOuterType().equals(other.getOuterType())) {
- return false;
- }
- if (artifact == null) {
- if (other.artifact != null) {
- return false;
- }
- } else if (!artifact.equals(other.artifact)) {
- return false;
+ return Objects.equals(artifact, other.artifact) && Objects.equals(locator, other.locator);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("ArtifactWithLocator ["); //$NON-NLS-1$
+ if (artifact != null) {
+ builder.append("artifact="); //$NON-NLS-1$
+ builder.append(artifact);
+ builder.append(", "); //$NON-NLS-1$
}
- if (locator == null) {
- if (other.locator != null) {
- return false;
- }
- } else if (!locator.equals(other.locator)) {
- return false;
+ if (locator != null) {
+ builder.append("locator="); //$NON-NLS-1$
+ builder.append(locator);
}
- return true;
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
}
- private SourceLookupFacility getOuterType() {
- return SourceLookupFacility.this;
- }
}
/**
@@ -305,74 +271,70 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
*/
public SourceLookupResult lookup(Object artifact, ISourceLocator locator, boolean force) {
SourceLookupResult result = null;
- synchronized (fLookupResults) {
- ArtifactWithLocator key = new ArtifactWithLocator(artifact, locator);
- if (!force) {
- result = fLookupResults.get(key);
- if (result != null) {
- return result;
- }
+ ArtifactWithLocator key = new ArtifactWithLocator(artifact, locator);
+ if (!force) {
+ result = fLookupResults.get(key);
+ if (result != null) {
+ return result;
}
- result = new SourceLookupResult(artifact, null, null, null);
- IDebugElement debugElement = null;
- if (artifact instanceof IDebugElement) {
- debugElement = (IDebugElement) artifact;
+ }
+ IDebugElement debugElement = null;
+ if (artifact instanceof IDebugElement) {
+ debugElement = (IDebugElement) artifact;
+ }
+ ISourceLocator localLocator = locator;
+ if (localLocator == null) {
+ ILaunch launch = null;
+ if (debugElement != null) {
+ launch = debugElement.getLaunch();
}
- ISourceLocator localLocator = locator;
- if (localLocator == null) {
- ILaunch launch = null;
- if (debugElement != null) {
- launch = debugElement.getLaunch();
- }
- if (launch != null) {
- localLocator = launch.getSourceLocator();
- }
+ if (launch != null) {
+ localLocator = launch.getSourceLocator();
}
- if (localLocator != null) {
- String editorId = null;
- IEditorInput editorInput = null;
- Object sourceElement = null;
- if (localLocator instanceof ISourceLookupDirector) {
- ISourceLookupDirector director = (ISourceLookupDirector) localLocator;
- sourceElement = director.getSourceElement(artifact);
- } else {
- if (artifact instanceof IStackFrame) {
- sourceElement = localLocator.getSourceElement((IStackFrame) artifact);
- }
+ }
+ if (localLocator == null) {
+ return new SourceLookupResult(artifact, null, null, null);
+ }
+ String editorId = null;
+ IEditorInput editorInput = null;
+ Object sourceElement = null;
+ if (localLocator instanceof ISourceLookupDirector) {
+ ISourceLookupDirector director = (ISourceLookupDirector) localLocator;
+ sourceElement = director.getSourceElement(artifact);
+ } else {
+ if (artifact instanceof IStackFrame) {
+ sourceElement = localLocator.getSourceElement((IStackFrame) artifact);
+ }
+ }
+ if (sourceElement == null) {
+ if (localLocator instanceof AbstractSourceLookupDirector) {
+ editorInput = new CommonSourceNotFoundEditorInput(artifact);
+ editorId = IDebugUIConstants.ID_COMMON_SOURCE_NOT_FOUND_EDITOR;
+ } else {
+ if (artifact instanceof IStackFrame) {
+ IStackFrame frame = (IStackFrame) artifact;
+ editorInput = new SourceNotFoundEditorInput(frame);
+ editorId = IInternalDebugUIConstants.ID_SOURCE_NOT_FOUND_EDITOR;
}
- if (sourceElement == null) {
- if (localLocator instanceof AbstractSourceLookupDirector) {
- editorInput = new CommonSourceNotFoundEditorInput(artifact);
- editorId = IDebugUIConstants.ID_COMMON_SOURCE_NOT_FOUND_EDITOR;
- } else {
- if (artifact instanceof IStackFrame) {
- IStackFrame frame = (IStackFrame) artifact;
- editorInput = new SourceNotFoundEditorInput(frame);
- editorId = IInternalDebugUIConstants.ID_SOURCE_NOT_FOUND_EDITOR;
- }
- }
- } else {
- ISourcePresentation presentation = null;
- if (localLocator instanceof ISourcePresentation) {
- presentation = (ISourcePresentation) localLocator;
- } else {
- if (debugElement != null) {
- presentation = getPresentation(debugElement.getModelIdentifier());
- }
- }
- if (presentation != null) {
- editorInput = presentation.getEditorInput(sourceElement);
- }
- if (editorInput != null && presentation != null) {
- editorId = presentation.getEditorId(editorInput, sourceElement);
- }
+ }
+ } else {
+ ISourcePresentation presentation = null;
+ if (localLocator instanceof ISourcePresentation) {
+ presentation = (ISourcePresentation) localLocator;
+ } else {
+ if (debugElement != null) {
+ presentation = getPresentation(debugElement.getModelIdentifier());
}
- result.setEditorInput(editorInput);
- result.setEditorId(editorId);
- result.setSourceElement(sourceElement);
- fLookupResults.put(key, result);
+ }
+ if (presentation != null) {
+ editorInput = presentation.getEditorInput(sourceElement);
+ }
+ if (editorInput != null && presentation != null) {
+ editorId = presentation.getEditorId(editorInput, sourceElement);
}
}
+ result = new SourceLookupResult(artifact, sourceElement, editorId, editorInput);
+ fLookupResults.put(key, result);
return result;
}
@@ -468,7 +430,7 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
// open a new editor
editor = openEditor(page, input, id);
editorForPage = editor;
- } else if (editorForPage instanceof IReusableEditor && editorForPage.getSite().getId().equals(id)) {
+ } else if (canReuseEditor(input, id, editorForPage)) {
// re-use editor
page.reuseEditor((IReusableEditor)editorForPage, input);
editor = editorForPage;
@@ -478,8 +440,10 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
} else {
// close editor, open a new one
editor = openEditor(page, input, id);
- page.closeEditor(editorForPage, false);
- editorForPage = editor;
+ if (editor != editorForPage) {
+ page.closeEditor(editorForPage, false);
+ editorForPage = editor;
+ }
}
setEditor(page, editorForPage);
}
@@ -490,6 +454,22 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
return editor;
}
+ private static boolean canReuseEditor(IEditorInput input, String id, IEditorPart editorForPage) {
+ if (!(editorForPage instanceof IReusableEditor)) {
+ return false;
+ }
+ IWorkbenchPartSite site = editorForPage.getSite();
+ if (site == null) {
+ // editor is disposed
+ return false;
+ }
+ if (site.getId().equals(id)) {
+ return true;
+ }
+ IEditorInput editorInput = editorForPage.getEditorInput();
+ return editorInput != null && input.equals(editorInput);
+ }
+
/**
* Positions the text editor for the given stack frame
*/
@@ -511,10 +491,14 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
}
/**
- * Returns the line information for the given line in the given editor
+ * Returns the line information for the given line in the given editor, or
+ * {@code null} if no information could be retrieved or error happens
*/
private IRegion getLineInformation(ITextEditor editor, int lineNumber) {
IDocumentProvider provider= editor.getDocumentProvider();
+ if (provider == null) {
+ return null;
+ }
IEditorInput input= editor.getEditorInput();
try {
provider.connect(input);
@@ -670,110 +654,283 @@ public class SourceLookupFacility implements IPageListener, IPartListener2, IPro
fEditorsByPage.clear();
fPresentation.dispose();
fLookupResults.clear();
+ sourceLookupJob.cancel();
}
/**
- * A job to perform source lookup on the currently selected stack frame.
+ * A singleton job to perform source lookups via given {@link SourceLookupTask}
+ * objects. The tasks are put in the queue to process in the background,
+ * duplicated tasks are ignored. Job re-schedules itself if new task is added to
+ * the queue.
*/
- class SourceLookupJob extends Job {
+ final class SourceLookupJob extends Job {
- private IStackFrame fTarget;
- private ISourceLocator fLocator;
- private IWorkbenchPage fPage;
- private boolean fForce = false;
+ private final LinkedHashSet<SourceLookupTask> queue;
+ private final SourceDisplayJob sourceDisplayJob;
- /**
- * Constructs a new source lookup job.
- */
- public SourceLookupJob(IStackFrame frame, ISourceLocator locator, IWorkbenchPage page, boolean force) {
+ public SourceLookupJob() {
super("Debug Source Lookup"); //$NON-NLS-1$
- setPriority(Job.INTERACTIVE);
+ this.sourceDisplayJob = new SourceDisplayJob();
+ this.queue = new LinkedHashSet<>();
setSystem(true);
- fTarget = frame;
- fLocator = locator;
- fPage = page;
- fForce = force;
+ setPriority(Job.INTERACTIVE);
// Note: Be careful when trying to use scheduling rules with this
// job, in order to avoid blocking nested jobs (bug 339542).
}
@Override
+ public boolean belongsTo(Object family) {
+ return family instanceof SourceLookupFacility;
+ }
+
+ @Override
protected IStatus run(IProgressMonitor monitor) {
+ SourceLookupTask next;
+ while ((next = poll()) != null && !monitor.isCanceled()) {
+ SourceDisplayRequest uiTask = next.run(monitor);
+ if (uiTask != null) {
+ sourceDisplayJob.schedule(uiTask);
+ }
+ }
+
+ synchronized (queue) {
+ if (monitor.isCanceled()) {
+ queue.clear();
+ return Status.CANCEL_STATUS;
+ } else if (!queue.isEmpty()) {
+ schedule(100);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ private SourceLookupTask poll() {
+ SourceLookupTask next = null;
+ synchronized (queue) {
+ if (!queue.isEmpty()) {
+ Iterator<SourceLookupTask> iterator = queue.iterator();
+ next = iterator.next();
+ iterator.remove();
+ }
+ }
+ return next;
+ }
+
+ void schedule(SourceLookupTask task) {
+ synchronized (queue) {
+ boolean added = queue.add(task);
+ if (added) {
+ schedule(100);
+ }
+ }
+ }
+ }
+
+ /**
+ * A task to perform source lookup on the currently selected stack frame.
+ */
+ class SourceLookupTask {
+
+ final IStackFrame fTarget;
+ final ISourceLocator fLocator;
+ final IWorkbenchPage fPage;
+ final boolean fForce;
+
+ /**
+ * Constructs a new source lookup task.
+ */
+ public SourceLookupTask(IStackFrame frame, ISourceLocator locator, IWorkbenchPage page, boolean force) {
+ fTarget = frame;
+ fLocator = locator;
+ fPage = page;
+ fForce = force;
+ }
+
+ protected SourceDisplayRequest run(IProgressMonitor monitor) {
if (!monitor.isCanceled()) {
if (!fTarget.isTerminated()) {
- ISourceLookupResult result = lookup(fTarget, fLocator, fForce);
- if (!monitor.isCanceled() && !fTarget.isTerminated() && fPage != null) {
- new SourceDisplayJob(result, fPage).schedule();
+ SourceLookupResult result = lookup(fTarget, fLocator, fForce);
+ if (!monitor.isCanceled() && !fTarget.isTerminated() && fPage != null && result != null) {
+ return new SourceDisplayRequest(result, fPage);
}
}
}
- return Status.OK_STATUS;
+ return null;
}
@Override
- public boolean belongsTo(Object family) {
- // source lookup jobs are a family per workbench page
- if (family instanceof SourceLookupJob) {
- SourceLookupJob slj = (SourceLookupJob) family;
- return slj.fPage.equals(fPage);
+ public int hashCode() {
+ return 31 + Objects.hash(fForce, fLocator, fPage, fTarget);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
}
- return false;
+ if (!(obj instanceof SourceLookupTask)) {
+ return false;
+ }
+ SourceLookupTask other = (SourceLookupTask) obj;
+ return fForce == other.fForce && Objects.equals(fPage, other.fPage)
+ && Objects.equals(fLocator, other.fLocator) && Objects.equals(fTarget, other.fTarget);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("SourceLookupTask ["); //$NON-NLS-1$
+ if (fTarget != null) {
+ builder.append("target="); //$NON-NLS-1$
+ builder.append(fTarget);
+ builder.append(", "); //$NON-NLS-1$
+ }
+ builder.append("force="); //$NON-NLS-1$
+ builder.append(fForce);
+ builder.append(", "); //$NON-NLS-1$
+ if (fLocator != null) {
+ builder.append("locator="); //$NON-NLS-1$
+ builder.append(fLocator);
+ builder.append(", "); //$NON-NLS-1$
+ }
+ if (fPage != null) {
+ builder.append("page="); //$NON-NLS-1$
+ builder.append(fPage);
+ }
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
+ }
+
+ }
+
+ /**
+ * A request to show the result of the source lookup in the UI
+ */
+ static class SourceDisplayRequest {
+
+ final SourceLookupResult fResult;
+ final IWorkbenchPage fPage;
+
+ public SourceDisplayRequest(SourceLookupResult result, IWorkbenchPage page) {
+ fResult = result;
+ fPage = page;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(fPage, fResult);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof SourceDisplayRequest)) {
+ return false;
+ }
+ SourceDisplayRequest other = (SourceDisplayRequest) obj;
+ return Objects.equals(fPage, other.fPage) && Objects.equals(fResult, other.fResult);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("SourceDisplayRequest ["); //$NON-NLS-1$
+ if (fResult != null) {
+ builder.append("result="); //$NON-NLS-1$
+ builder.append(fResult);
+ builder.append(", "); //$NON-NLS-1$
+ }
+ if (fPage != null) {
+ builder.append("page="); //$NON-NLS-1$
+ builder.append(fPage);
+ }
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
}
}
+ /**
+ * A singleton job to show the result of the source lookup in the UI for given
+ * {@link SourceDisplayRequest} objects. The requests are put in the queue to
+ * process in the background, duplicated requests are ignored. Job re-schedules
+ * itself if new request is added to the queue.
+ */
class SourceDisplayJob extends UIJob {
- private ISourceLookupResult fResult;
- private IWorkbenchPage fPage;
+ private final LinkedHashSet<SourceDisplayRequest> queue;
- public SourceDisplayJob(ISourceLookupResult result, IWorkbenchPage page) {
+ public SourceDisplayJob() {
super("Debug Source Display"); //$NON-NLS-1$
setSystem(true);
setPriority(Job.INTERACTIVE);
- fResult = result;
- fPage = page;
+ this.queue = new LinkedHashSet<>();
}
+
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (!monitor.isCanceled() && fResult != null) {
- display(fResult, fPage);
- // termination may have occurred while displaying source
- if (monitor.isCanceled()) {
- Object artifact = fResult.getArtifact();
+ SourceDisplayRequest next;
+ // Do not break on cancelled monitor, to allow remove debugger
+ // annotations from already opened editors
+ while ((next = poll()) != null) {
+ IWorkbenchPage page = next.fPage;
+ if (page.getWorkbenchWindow() == null) {
+ // don't try to update if page is closed
+ continue;
+ }
+ ISourceLookupResult result = next.fResult;
+ if (!monitor.isCanceled()) {
+ display(result, page);
+ } else {
+ // termination may have occurred while displaying source
+ Object artifact = result.getArtifact();
if (artifact instanceof IStackFrame) {
clearSourceSelection(((IStackFrame) artifact).getThread());
}
}
}
-
return Status.OK_STATUS;
}
+ private SourceDisplayRequest poll() {
+ SourceDisplayRequest next = null;
+ synchronized (queue) {
+ if (!queue.isEmpty()) {
+ Iterator<SourceDisplayRequest> iterator = queue.iterator();
+ next = iterator.next();
+ iterator.remove();
+ }
+ }
+ return next;
+ }
+
+ void schedule(SourceDisplayRequest task) {
+ synchronized (queue) {
+ boolean added = queue.add(task);
+ if (added) {
+ schedule(100);
+ }
+ }
+ }
+
@Override
public boolean belongsTo(Object family) {
- // source display jobs are a family per workbench page
- if (family instanceof SourceDisplayJob) {
- SourceDisplayJob sdj = (SourceDisplayJob) family;
- return sdj.fPage.equals(fPage);
- }
- return false;
+ return family instanceof SourceLookupFacility;
}
}
/*
- * @see
- * org.eclipse.debug.ui.contexts.ISourceDisplayAdapter#displaySource(java
- * .lang.Object, org.eclipse.ui.IWorkbenchPage, boolean)
+ * See org.eclipse.debug.ui.sourcelookup.ISourceDisplay
*/
- public synchronized void displaySource(Object context, IWorkbenchPage page, boolean force) {
+ public void displaySource(Object context, IWorkbenchPage page, boolean force) {
IStackFrame frame = (IStackFrame) context;
- SourceLookupJob slj = new SourceLookupJob(frame, frame.getLaunch().getSourceLocator(), page, force);
- // cancel any existing source lookup jobs for this page
- Job.getJobManager().cancel(slj);
- slj.schedule();
+ SourceLookupTask slj = new SourceLookupTask(frame, frame.getLaunch().getSourceLocator(), page, force);
+ // will drop any existing equal source lookup jobs
+ sourceLookupJob.schedule(slj);
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupManager.java
index 67a48fd0f..792d769bc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupManager.java
@@ -39,8 +39,7 @@ public class SourceLookupManager implements IWindowListener {
private SourceLookupManager() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
+ for (IWorkbenchWindow window : workbenchWindows) {
windowOpened(window);
}
workbench.addWindowListener(this);
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 c524b8cff..55ab38932 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
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.sourcelookup;
+import java.util.Objects;
+
import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult;
import org.eclipse.ui.IEditorInput;
@@ -27,22 +29,22 @@ public class SourceLookupResult implements ISourceLookupResult {
/**
* Element that source was resolved for.
*/
- private Object fArtifact;
+ private final Object fArtifact;
/**
* Corresponding source element, or <code>null</code>
* if unknown.
*/
- private Object fSourceElement;
+ private final Object fSourceElement;
/**
* Associated editor id, used to display the source element,
* or <code>null</code> if unknown.
*/
- private String fEditorId;
+ private final String fEditorId;
/**
* Associated editor input, used to display the source element,
* or <code>null</code> if unknown.
*/
- private IEditorInput fEditorInput;
+ private final IEditorInput fEditorInput;
/**
* Creates a source lookup result on the given artifact, source element,
@@ -50,9 +52,9 @@ public class SourceLookupResult implements ISourceLookupResult {
*/
public SourceLookupResult(Object artifact, Object sourceElement, String editorId, IEditorInput editorInput) {
fArtifact = artifact;
- setSourceElement(sourceElement);
- setEditorId(editorId);
- setEditorInput(editorInput);
+ fSourceElement = sourceElement;
+ fEditorId = editorId;
+ fEditorInput = editorInput;
}
@Override
@@ -65,60 +67,63 @@ public class SourceLookupResult implements ISourceLookupResult {
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;
- }
-
@Override
public String getEditorId() {
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;
- }
-
@Override
public IEditorInput getEditorInput() {
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;
+ @Override
+ public int hashCode() {
+ return Objects.hash(fArtifact, fEditorId, fEditorInput, fSourceElement);
}
- /**
- * Updates the artifact to refer to the given artifact
- * if equal. For example, when a source lookup result is reused
- * for the same stack frame, we still need to update in case
- * the stack frame is not identical.
- *
- * @param artifact new artifact state
- */
- public void updateArtifact(Object artifact) {
- if (fArtifact.equals(artifact)) {
- fArtifact = artifact;
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (!(obj instanceof SourceLookupResult)) {
+ return false;
}
+
+ SourceLookupResult other = (SourceLookupResult) obj;
+ return Objects.equals(fEditorId, other.fEditorId)
+ && Objects.equals(fArtifact, other.fArtifact)
+ && Objects.equals(fEditorInput, other.fEditorInput)
+ && Objects.equals(fSourceElement, other.fSourceElement);
}
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("SourceLookupResult ["); //$NON-NLS-1$
+ if (fEditorId != null) {
+ builder.append("editorId="); //$NON-NLS-1$
+ builder.append(fEditorId);
+ builder.append(", "); //$NON-NLS-1$
+ }
+ if (fEditorInput != null) {
+ builder.append("editorInput="); //$NON-NLS-1$
+ builder.append(fEditorInput);
+ builder.append(", "); //$NON-NLS-1$
+ }
+ if (fArtifact != null) {
+ builder.append("artifact="); //$NON-NLS-1$
+ builder.append(fArtifact);
+ builder.append(", "); //$NON-NLS-1$
+ }
+ if (fSourceElement != null) {
+ builder.append("sourceElement="); //$NON-NLS-1$
+ builder.append(fSourceElement);
+ }
+ builder.append("]"); //$NON-NLS-1$
+ return builder.toString();
+ }
+
}
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 a19871086..222ddcb1d 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
@@ -29,6 +29,7 @@ import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -57,19 +58,27 @@ public class SourceLookupService implements IDebugContextListener, ISourceDispla
@Override
public synchronized void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
- if (isDebugViewActive() || canActivateDebugView()) {
+ if (isDebugViewActive(event) || canActivateDebugView()) {
displaySource(event.getContext(), event.getDebugContextProvider().getPart(), false);
}
}
}
- private boolean isDebugViewActive() {
+ private boolean isDebugViewActive(DebugContextEvent event) {
if (isDisposed()) {
return false;
}
IWorkbenchPage activePage = fWindow.getActivePage();
if (activePage != null) {
- return activePage.findView(IDebugUIConstants.ID_DEBUG_VIEW) != null;
+ IViewPart debugView = null;
+ IWorkbenchPart part = event.getDebugContextProvider().getPart();
+ if (part != null) {
+ debugView = activePage.findView(part.getSite().getId());
+ }
+ if (debugView == null) {
+ debugView = activePage.findView(IDebugUIConstants.ID_DEBUG_VIEW);
+ }
+ return debugView != null;
}
return false;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIUtils.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIUtils.java
index 3406fdef9..75da1a448 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIUtils.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupUIUtils.java
@@ -63,11 +63,9 @@ public class SourceLookupUIUtils {
//read in SourceContainer presentation extensions
IConfigurationElement[] sourceContainerPresentationExtensions =extensionPoint.getConfigurationElements();
fSourceContainerPresentationHashtable = new Hashtable<>();
- for (int i = 0; i < sourceContainerPresentationExtensions.length; i++) {
- fSourceContainerPresentationHashtable.put(
- sourceContainerPresentationExtensions[i].getAttribute(CONTAINER_ID_ATTRIBUTE),
- sourceContainerPresentationExtensions[i]);
- registerContainerImages(sourceContainerPresentationExtensions[i]);
+ for (IConfigurationElement extension : sourceContainerPresentationExtensions) {
+ fSourceContainerPresentationHashtable.put(extension.getAttribute(CONTAINER_ID_ATTRIBUTE), extension);
+ registerContainerImages(extension);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java
index d19e6a439..9a2787ac4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveFilter.java
@@ -80,8 +80,7 @@ public class ArchiveFilter extends ViewerFilter {
boolean added = false;
try {
IResource[] resources = container.members();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource instanceof IFile) {
IFile file = (IFile)resource;
String ext = file.getFileExtension();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveSourceContainerBrowser.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveSourceContainerBrowser.java
index 8a33b0ff2..75d6421f6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveSourceContainerBrowser.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ArchiveSourceContainerBrowser.java
@@ -44,19 +44,16 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
*/
public class ArchiveSourceContainerBrowser extends AbstractSourceContainerBrowser {
- private ISelectionStatusValidator validator= new ISelectionStatusValidator() {
- @Override
- public IStatus validate(Object[] selection) {
- if (selection.length == 0) {
+ private ISelectionStatusValidator validator= selection -> {
+ if (selection.length == 0) {
+ return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
+ }
+ for (Object f : selection) {
+ if (!(f instanceof IFile)) {
return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
}
- for (int i= 0; i < selection.length; i++) {
- if (!(selection[i] instanceof IFile)) {
- return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
- }
- }
- return new Status(IStatus.OK, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
}
+ return new Status(IStatus.OK, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
};
/**
@@ -69,8 +66,7 @@ public class ArchiveSourceContainerBrowser extends AbstractSourceContainerBrowse
protected List<ISourceContainer> getSelectedJars(ISourceLookupDirector director) {
ISourceContainer[] containers = director.getSourceContainers();
List<ISourceContainer> jars = new ArrayList<>();
- for (int i = 0; i < containers.length; i++) {
- ISourceContainer container = containers[i];
+ for (ISourceContainer container : containers) {
if (container.getType().getId().equals(ArchiveSourceContainer.TYPE_ID)) {
jars.add(container);
}
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 24b6e283c..30f44e5ae 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
@@ -18,16 +18,14 @@ import java.io.File;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
@@ -43,6 +41,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* The dialog for selecting the external folder for which a source container will be created.
@@ -68,7 +67,9 @@ public class DirectorySourceContainerDialog extends TitleAreaDialog {
* @param shell shell
*/
public DirectorySourceContainerDialog(Shell shell) {
- this(shell, IInternalDebugCoreConstants.EMPTY_STRING, DebugUIPlugin.getDefault().getDialogSettings().getBoolean(LAST_SUBDIR_SETTING));
+ this(shell, IInternalDebugCoreConstants.EMPTY_STRING,
+ PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(DirectorySourceContainerDialog.class))
+ .getDialogSettings().getBoolean(LAST_SUBDIR_SETTING));
fNewContainer = true;
}
@@ -142,12 +143,7 @@ public class DirectorySourceContainerDialog extends TitleAreaDialog {
data.horizontalSpan = 1;
fDirText.setLayoutData(data);
fDirText.setFont(font);
- fDirText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText( ModifyEvent e ) {
- validate();
- }
- });
+ fDirText.addModifyListener(e -> validate());
Button button = new Button(dirComposite, SWT.PUSH);
button.setText(SourceLookupUIMessages.DirectorySourceContainerDialog_5);
@@ -196,15 +192,21 @@ public class DirectorySourceContainerDialog extends TitleAreaDialog {
protected void okPressed() {
fDirectory = fDirText.getText().trim();
fSearchSubfolders = fSubfoldersButton.getSelection();
- DebugUIPlugin.getDefault().getDialogSettings().put(LAST_PATH_SETTING, fDirectory);
- DebugUIPlugin.getDefault().getDialogSettings().put(LAST_SUBDIR_SETTING, fSearchSubfolders);
+ IDialogSettings dialogSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(DirectorySourceContainerDialog.class))
+ .getDialogSettings();
+ dialogSettings.put(LAST_PATH_SETTING, fDirectory);
+ dialogSettings.put(LAST_SUBDIR_SETTING, fSearchSubfolders);
super.okPressed();
}
private void browse() {
String last = fDirText.getText().trim();
if (last.length() == 0) {
- last = DebugUIPlugin.getDefault().getDialogSettings().get(LAST_PATH_SETTING);
+ IDialogSettings dialogSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(DirectorySourceContainerDialog.class))
+ .getDialogSettings();
+ last = dialogSettings.get(LAST_PATH_SETTING);
}
if (last == null) {
last = IInternalDebugCoreConstants.EMPTY_STRING;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ExternalArchiveSourceContainerBrowser.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ExternalArchiveSourceContainerBrowser.java
index c998d1e37..bdbc9d289 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ExternalArchiveSourceContainerBrowser.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ExternalArchiveSourceContainerBrowser.java
@@ -18,12 +18,14 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.containers.ExternalArchiveSourceContainer;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages;
import org.eclipse.debug.ui.sourcelookup.AbstractSourceContainerBrowser;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* The browser for adding an external archive.
@@ -36,7 +38,10 @@ public class ExternalArchiveSourceContainerBrowser extends AbstractSourceContain
@Override
public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI | SWT.SHEET);
- String rootDir = DebugUIPlugin.getDefault().getDialogSettings().get(ROOT_DIR);
+ IDialogSettings dialogSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(ExternalArchiveSourceContainerBrowser.class))
+ .getDialogSettings();
+ String rootDir = dialogSettings.get(ROOT_DIR);
dialog.setText(SourceLookupUIMessages.ExternalArchiveSourceContainerBrowser_2);
dialog.setFilterExtensions(new String[]{"*.jar;*.zip"}); //$NON-NLS-1$
if (rootDir != null) {
@@ -54,7 +59,7 @@ public class ExternalArchiveSourceContainerBrowser extends AbstractSourceContain
// TODO: configure auto-detect
containers[i]= new ExternalArchiveSourceContainer(path.toOSString(), true);
}
- DebugUIPlugin.getDefault().getDialogSettings().put(ROOT_DIR, rootDir);
+ dialogSettings.put(ROOT_DIR, rootDir);
return containers;
}
return new ISourceContainer[0];
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerBrowser.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerBrowser.java
index bc78d67fe..75603c11b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerBrowser.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/FolderSourceContainerBrowser.java
@@ -40,9 +40,9 @@ public class FolderSourceContainerBrowser extends AbstractSourceContainerBrowser
if (dialog.open() == Window.OK) {
Object[] selection= ((ElementTreeSelectionDialog)dialog).getResult();
ArrayList<ISourceContainer> containers = new ArrayList<>();
- for (int i= 0; i < selection.length; i++) {
- if(selection[i] instanceof IFolder) {
- containers.add(new FolderSourceContainer((IFolder)selection[i], dialog.isSearchSubfolders()));
+ for (Object f : selection) {
+ if (f instanceof IFolder) {
+ containers.add(new FolderSourceContainer((IFolder) f, dialog.isSearchSubfolders()));
}
}
return containers.toArray(new ISourceContainer[containers.size()]);
@@ -65,9 +65,9 @@ public class FolderSourceContainerBrowser extends AbstractSourceContainerBrowser
container.dispose();
Object[] selection= ((ElementTreeSelectionDialog)dialog).getResult();
ArrayList<ISourceContainer> list = new ArrayList<>();
- for (int i= 0; i < selection.length; i++) {
- if(selection[i] instanceof IFolder) {
- list.add(new FolderSourceContainer((IFolder)selection[i], dialog.isSearchSubfolders()));
+ for (Object f : selection) {
+ if (f instanceof IFolder) {
+ list.add(new FolderSourceContainer((IFolder) f, dialog.isSearchSubfolders()));
}
}
return list.toArray(new ISourceContainer[list.size()]);
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 fedf26804..dd32e7040 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
@@ -22,6 +22,7 @@ import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -35,6 +36,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.views.navigator.ResourceComparator;
+import org.osgi.framework.FrameworkUtil;
/**
* The dialog for selecting the folder for which a source container will be created.
@@ -89,23 +91,23 @@ public class FolderSourceContainerDialog extends ElementTreeSelectionDialog {
setTitle(SourceLookupUIMessages.folderSelection_title); //
setInput(ResourcesPlugin.getWorkspace().getRoot());
setComparator(new ResourceComparator(ResourceComparator.NAME));
- ISelectionStatusValidator validator= new ISelectionStatusValidator() {
- @Override
- public IStatus validate(Object[] selection) {
- for (int i= 0; i < selection.length; i++) {
- if (!(selection[i] instanceof IFolder)) {
- return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), -1, SourceLookupUIMessages.sourceSearch_folderSelectionError, null); //
- }
+ ISelectionStatusValidator validator= selection -> {
+ for (Object f : selection) {
+ if (!(f instanceof IFolder)) {
+ return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), -1, SourceLookupUIMessages.sourceSearch_folderSelectionError, null); //
}
- return new Status(IStatus.OK, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
}
+ return new Status(IStatus.OK, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
};
setValidator(validator);
setDoubleClickSelects(true);
setAllowMultiple(true);
setMessage(SourceLookupUIMessages.folderSelection_label);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugHelpContextIds.ADD_FOLDER_CONTAINER_DIALOG);
- setSearchSubfolders(DebugUIPlugin.getDefault().getDialogSettings().getBoolean(LAST_SUBDIR_SETTING));
+ IDialogSettings dialogSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(FolderSourceContainerDialog.class))
+ .getDialogSettings();
+ setSearchSubfolders(dialogSettings.getBoolean(LAST_SUBDIR_SETTING));
addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
@@ -143,7 +145,8 @@ public class FolderSourceContainerDialog extends ElementTreeSelectionDialog {
@Override
protected void okPressed() {
fSearchSubfolders = fSubfoldersButton.getSelection();
- DebugUIPlugin.getDefault().getDialogSettings().put(LAST_SUBDIR_SETTING, fSearchSubfolders);
+ PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(FolderSourceContainerDialog.class))
+ .getDialogSettings().put(LAST_SUBDIR_SETTING, fSearchSubfolders);
super.okPressed();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ProjectSourceContainerBrowser.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ProjectSourceContainerBrowser.java
index 09b5e8788..6e405df76 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ProjectSourceContainerBrowser.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/ProjectSourceContainerBrowser.java
@@ -48,11 +48,11 @@ public class ProjectSourceContainerBrowser extends AbstractSourceContainerBrowse
if(dialog.open() == Window.OK){
Object[] elements= ((ListSelectionDialog)dialog).getResult();
ArrayList<ISourceContainer> res = new ArrayList<>();
- for (int i= 0; i < elements.length; i++) {
- if(!(elements[i] instanceof IProject)) {
+ for (Object element : elements) {
+ if (!(element instanceof IProject)) {
continue;
}
- res.add(new ProjectSourceContainer((IProject)elements[i], ((ProjectSourceContainerDialog)dialog).isAddRequiredProjects()));
+ res.add(new ProjectSourceContainer((IProject) element, ((ProjectSourceContainerDialog)dialog).isAddRequiredProjects()));
}
return res.toArray(new ISourceContainer[res.size()]);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/WorkingSetSourceContainerBrowser.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/WorkingSetSourceContainerBrowser.java
index f59639d2a..cefc0d9ef 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/WorkingSetSourceContainerBrowser.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/sourcelookup/browsers/WorkingSetSourceContainerBrowser.java
@@ -40,8 +40,8 @@ public class WorkingSetSourceContainerBrowser extends AbstractSourceContainerBro
if (dialog.open() == Window.OK) {
IWorkingSet[] selections = dialog.getSelection();
if (selections != null) {
- for (int i = 0; i < selections.length; i++) {
- containers.add(new WorkingSetSourceContainer(selections[i]));
+ for (IWorkingSet selection : selections) {
+ containers.add(new WorkingSetSourceContainer(selection));
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
index 59ead6dfe..0908f3862 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/PromptingResolver.java
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.stringsubstitution;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -23,8 +25,6 @@ import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.swt.widgets.Shell;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Base implementation for variable resolvers that prompt the user
* for their value.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
index 352a8d6cf..124302a28 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceManager.java
@@ -13,9 +13,20 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.stringsubstitution;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
import java.util.Iterator;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.text.ITextSelection;
@@ -23,6 +34,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IWorkbenchPage;
@@ -37,9 +49,16 @@ import org.eclipse.ui.IWorkbenchWindow;
*/
public class SelectedResourceManager {
+ // Limit in seconds to wait on UI for accessing data
+ private static final int MAX_UI_WAIT_TIME = 10;
+
// singleton
private static SelectedResourceManager fgDefault;
+ // Used to avoid deadlocks while accessing UI thread from non UI code
+ private static ExecutorService executor = Executors.newSingleThreadExecutor();
+
+
/**
* Returns the singleton resource selection manager
*
@@ -69,14 +88,11 @@ public class SelectedResourceManager {
* @since 3.3
*/
public IStructuredSelection getCurrentSelection() {
- if(DebugUIPlugin.getStandardDisplay().getThread().equals(Thread.currentThread())) {
- return getCurrentSelection0();
- }
- else {
- final IStructuredSelection[] selection = new IStructuredSelection[1];
- DebugUIPlugin.getStandardDisplay().syncExec(() -> selection[0] = getCurrentSelection0());
- return selection[0];
+ IStructuredSelection selection = getFromUI(this::getCurrentSelection0);
+ if (selection == null) {
+ selection = StructuredSelection.EMPTY;
}
+ return selection;
}
/**
@@ -85,7 +101,7 @@ public class SelectedResourceManager {
*
* @since 3.4
*/
- private IStructuredSelection getCurrentSelection0() {
+ IStructuredSelection getCurrentSelection0() {
IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
if(window != null) {
IWorkbenchPage page = window.getActivePage();
@@ -119,14 +135,8 @@ public class SelectedResourceManager {
* @return selected resource or <code>null</code>
*/
public IResource getSelectedResource() {
- if(DebugUIPlugin.getStandardDisplay().getThread().equals(Thread.currentThread())) {
- return getSelectedResource0();
- }
- else {
- final IResource[] resource = new IResource[1];
- DebugUIPlugin.getStandardDisplay().syncExec(() -> resource[0] = getSelectedResource0());
- return resource[0];
- }
+ IResource resource = getFromUI(this::getSelectedResource0);
+ return resource;
}
/**
@@ -177,14 +187,8 @@ public class SelectedResourceManager {
* @return the current text selection as a <code>String</code> or <code>null</code>
*/
public String getSelectedText() {
- if(DebugUIPlugin.getStandardDisplay().getThread().equals(Thread.currentThread())) {
- return getSelectedText0();
- }
- else {
- final String[] text = new String[1];
- DebugUIPlugin.getStandardDisplay().syncExec(() -> text[0] = getSelectedText0());
- return text[0];
- }
+ String text = getFromUI(this::getSelectedText0);
+ return text;
}
/**
@@ -224,14 +228,87 @@ public class SelectedResourceManager {
* @since 3.2
*/
public IWorkbenchWindow getActiveWindow() {
- if(DebugUIPlugin.getStandardDisplay().getThread().equals(Thread.currentThread())) {
- return DebugUIPlugin.getActiveWorkbenchWindow();
+ IWorkbenchWindow window = getFromUI(DebugUIPlugin::getActiveWorkbenchWindow);
+ return window;
+ }
+
+ private <T> T getFromUI(Callable<T> call) {
+ try {
+ if (Display.getCurrent() != null) {
+ return call.call();
+ } else {
+ return runInUIThreadWithTimeout(call, MAX_UI_WAIT_TIME, TimeUnit.SECONDS);
+ }
+ } catch (TimeoutException e) {
+ reportTimeout();
+ return null;
+ } catch (InterruptedException e) {
+ Thread.interrupted();
+ // Bug 569486: don't care, tha task was cancelled, see for example
+ // org.eclipse.jface.text.TextViewerHoverManager.TextViewerHoverManager()
+ // DebugUIPlugin.log(e);
+ return null;
+ } catch (Exception e) {
+ DebugUIPlugin.log(e);
+ return null;
}
- else {
- final IWorkbenchWindow[] window = new IWorkbenchWindow[1];
- DebugUIPlugin.getStandardDisplay().syncExec(() -> window[0] = DebugUIPlugin.getActiveWorkbenchWindow());
- return window[0];
+ }
+
+ /**
+ * Tries to run the task in the UI thread, and gives up if UI thread does not
+ * answer after given timeout
+ *
+ * @param timeout to wait for the UI lock
+ * @return may return null
+ * @throws Exception
+ */
+ static <V> V runInUIThreadWithTimeout(Callable<V> callable, long timeout, TimeUnit units) throws Exception {
+ FutureTask<V> task = new FutureTask<>(() -> syncExec(callable));
+ executor.execute(task);
+ return task.get(timeout, units);
+ }
+
+ static <V> V syncExec(Callable<V> callable) throws Exception {
+ AtomicReference<V> ref = new AtomicReference<>();
+ AtomicReference<Exception> ex = new AtomicReference<>();
+ DebugUIPlugin.getStandardDisplay().syncExec(() -> {
+ try {
+ ref.set(callable.call());
+ } catch (Exception e) {
+ ex.set(e);
+ }
+ });
+ if (ex.get() != null) {
+ throw ex.get();
}
+ return ref.get();
}
+ /**
+ * Reports an error the log with thread stack information for current and UI threads
+ */
+ private static void reportTimeout() {
+ Thread nonUiThread = Thread.currentThread();
+
+ String msg = "To avoid deadlock while executing Display.syncExec() from a non UI thread '" //$NON-NLS-1$
+ + nonUiThread.getName() + "', operation was cancelled."; //$NON-NLS-1$
+ MultiStatus main = new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, msg, null);
+
+ ThreadInfo[] threads = ManagementFactory.getThreadMXBean().getThreadInfo(
+ new long[] { nonUiThread.getId(), Display.getDefault().getThread().getId() }, true, true);
+
+ for (ThreadInfo info : threads) {
+ String childMsg;
+ if (info.getThreadId() == nonUiThread.getId()) {
+ childMsg = nonUiThread.getName() + " thread probably holding a lock and trying to acquire UI lock"; //$NON-NLS-1$
+ } else {
+ childMsg = "UI thread waiting on a job or lock."; //$NON-NLS-1$
+ }
+ Exception childEx = new IllegalStateException("Call stack for thread " + info.getThreadName()); //$NON-NLS-1$
+ childEx.setStackTrace(info.getStackTrace());
+ main.add(DebugUIPlugin.newErrorStatus(childMsg, childEx));
+ }
+
+ DebugUIPlugin.log(main);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceResolver.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceResolver.java
index 1202ecb71..513696fa9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceResolver.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/SelectedResourceResolver.java
@@ -13,14 +13,14 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.stringsubstitution;
+import java.text.MessageFormat;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.core.variables.IDynamicVariableResolver;
import org.eclipse.debug.internal.core.variables.ResourceResolver;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Resolves the currently selected resource.
*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringVariablePresentationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringVariablePresentationManager.java
index 0709463bf..7a522ba8d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringVariablePresentationManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/stringsubstitution/StringVariablePresentationManager.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.stringsubstitution;
+import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
@@ -24,8 +25,6 @@ import org.eclipse.core.variables.IStringVariable;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.stringsubstitution.IArgumentSelector;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Manages argument selectors (choosers) for string variables.
*
@@ -99,8 +98,7 @@ public class StringVariablePresentationManager {
fConfigurations = new HashMap<>();
IExtensionPoint point= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), EXTENSION_POINT_STRING_VARIABLE_PRESENTATIONS);
IConfigurationElement elements[]= point.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
String name= element.getAttribute(ATTR_NAME);
if (name == null) {
DebugUIPlugin.logErrorMessage(MessageFormat.format("String variable presentation extension missing required 'variableName' attribute: {0}", new Object[] { element.getDeclaringExtension().getLabel() })); //$NON-NLS-1$
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 2c772e184..e09b9bfc7 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
@@ -66,7 +66,7 @@ public abstract class AsynchronousModel {
private AsynchronousViewer fViewer; // viewer this model works for
private boolean fDisposed = false; // whether disposed
- class EmptyContentAdapter extends AsynchronousContentAdapter {
+ static class EmptyContentAdapter extends AsynchronousContentAdapter {
@Override
protected Object[] getChildren(Object parent, IPresentationContext context) throws CoreException {
@@ -269,8 +269,8 @@ public abstract class AsynchronousModel {
if (nodes == null) {
fElementToNodes.put(element, new ModelNode[] { node});
} else {
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i] == node) {
+ for (ModelNode mnode : nodes) {
+ if (mnode == node) {
return;
}
}
@@ -388,16 +388,16 @@ public abstract class AsynchronousModel {
ViewerFilter[] filters = getViewer().getFilters();
if (filters != null) {
ArrayList<Object> filtered = new ArrayList<>(elements.length);
- for (int i = 0; i < elements.length; i++) {
+ for (Object element : elements) {
boolean add = true;
- for (int j = 0; j < filters.length; j++) {
- add = filters[j].select(getViewer(), parent, elements[i]);
+ for (ViewerFilter filter : filters) {
+ add = filter.select(getViewer(), parent, element);
if (!add) {
break;
}
}
if (add) {
- filtered.add(elements[i]);
+ filtered.add(element);
}
}
return filtered.toArray();
@@ -585,8 +585,7 @@ public abstract class AsynchronousModel {
mapElement(child, newChildren[i]);
}
}
- for (int i = 0; i < prevKids.length; i++) {
- ModelNode kid = prevKids[i];
+ for (ModelNode kid : prevKids) {
if (kid != null) {
kid.dispose();
unmapNode(kid);
@@ -604,8 +603,8 @@ public abstract class AsynchronousModel {
final ModelNode[] finalUnmap = unmap;
preservingSelection(() -> {
if (finalUnmap != null) {
- for (int i = 0; i < finalUnmap.length; i++) {
- viewer.unmapNode(finalUnmap[i]);
+ for (ModelNode element : finalUnmap) {
+ viewer.unmapNode(element);
}
}
viewer.nodeChildrenChanged(parentNode);
@@ -633,8 +632,8 @@ public abstract class AsynchronousModel {
buf.append('\n');
ModelNode[] childrenNodes = node.getChildrenNodes();
if (childrenNodes != null) {
- for (int i = 0; i < childrenNodes.length; i++) {
- append(buf, childrenNodes[i], level + 1);
+ for (ModelNode childNode : childrenNodes) {
+ append(buf, childNode, level + 1);
}
}
}
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 a9f1a0c4b..4f05e0bc8 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
@@ -27,7 +27,7 @@ public class AsynchronousSchedulingRuleFactory {
/**
* Rule allows only one job to run at a time
*/
- class SerialRule implements ISchedulingRule {
+ static class SerialRule implements ISchedulingRule {
public SerialRule() {
}
@@ -43,7 +43,7 @@ public class AsynchronousSchedulingRuleFactory {
}
}
- class SerialPerObjectRule implements ISchedulingRule {
+ static class SerialPerObjectRule implements ISchedulingRule {
private Object fObject = null;
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 92247cf22..412b079a4 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
@@ -60,13 +60,13 @@ public class AsynchronousTableModel extends AsynchronousModel {
kids = new ArrayList<>(elements.length);
} else {
kids = new ArrayList<>(elements.length + childrenNodes.length);
- for (int i = 0; i < childrenNodes.length; i++) {
- kids.add(childrenNodes[i].getElement());
+ for (ModelNode childNode : childrenNodes) {
+ kids.add(childNode.getElement());
}
}
- for (int i = 0; i < elements.length; i++) {
- if (!kids.contains(elements[i])) {
- kids.add(elements[i]);
+ for (Object element : elements) {
+ if (!kids.contains(element)) {
+ kids.add(element);
changed = true;
}
}
@@ -103,13 +103,13 @@ public class AsynchronousTableModel extends AsynchronousModel {
kids = new ArrayList<>(elements.length);
} else {
kids = new ArrayList<>(elements.length + childrenNodes.length);
- for (int i = 0; i < childrenNodes.length; i++) {
- kids.add(childrenNodes[i].getElement());
+ for (ModelNode childNode : childrenNodes) {
+ kids.add(childNode.getElement());
}
}
- for (int i = 0; i < elements.length; i++) {
- if (!kids.contains(elements[i])) {
- kids.add(index, elements[i]);
+ for (Object element : elements) {
+ if (!kids.contains(element)) {
+ kids.add(index, element);
index++;
changed = true;
}
@@ -143,11 +143,11 @@ public class AsynchronousTableModel extends AsynchronousModel {
ModelNode[] childrenNodes = getRootNode().getChildrenNodes();
if (childrenNodes != null) {
kids = new ArrayList<>(childrenNodes.length);
- for (int i = 0; i < childrenNodes.length; i++) {
- kids.add(childrenNodes[i].getElement());
+ for (ModelNode childrenNode : childrenNodes) {
+ kids.add(childrenNode.getElement());
}
- for (int i = 0; i < elements.length; i++) {
- if (kids.remove(elements[i])) {
+ for (Object element : elements) {
+ if (kids.remove(element)) {
changed = true;
}
}
@@ -182,9 +182,7 @@ public class AsynchronousTableModel extends AsynchronousModel {
}
List<ModelNode> list = new ArrayList<>();
synchronized (this) {
- ModelNode[] nodes = getNodes(element);
- for (int i = 0; i < nodes.length; i++) {
- ModelNode node = nodes[i];
+ for (ModelNode node : getNodes(element)) {
node.remap(replacement);
list.add(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 a4715aa7f..81c439a02 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
@@ -156,8 +156,8 @@ public class AsynchronousTableViewer extends AsynchronousViewer implements Liste
protected List getSelectionFromWidget() {
TableItem[] selection = fTable.getSelection();
List<Object> datas = new ArrayList<>(selection.length);
- for (int i = 0; i < selection.length; i++) {
- datas.add(selection[i].getData());
+ for (TableItem element : selection) {
+ datas.add(element.getData());
}
return datas;
}
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 54511edf7..b287456c9 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
@@ -190,8 +190,8 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
public void update(Object element) {
ModelNode[] nodes = getModel().getNodes(element);
if (nodes != null) {
- for (int i = 0; i < nodes.length; i++) {
- updateLabel(nodes[i]);
+ for (ModelNode node : nodes) {
+ updateLabel(node);
}
}
}
@@ -421,8 +421,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
if (model != null) {
ModelNode[] nodes = model.getNodes(element);
if (nodes != null) {
- for (int i = 0; i < nodes.length; i++) {
- ModelNode node = nodes[i];
+ for (ModelNode node : nodes) {
// get the widget for the node
Widget item = findItem(node);
if (item != null) {
@@ -644,7 +643,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
/**
* A content provider that does nothing.
*/
- private class NullContentProvider implements IStructuredContentProvider {
+ private static class NullContentProvider implements IStructuredContentProvider {
@Override
public void dispose() {
}
@@ -969,8 +968,8 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
unmapElement(node);
ModelNode[] childrenNodes = node.getChildrenNodes();
if (childrenNodes != null) {
- for (int i = 0; i < childrenNodes.length; i++) {
- unmapNode(childrenNodes[i]);
+ for (ModelNode childNode : childrenNodes) {
+ unmapNode(childNode);
}
}
}
@@ -983,8 +982,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
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];
+ for (ModelNode node : nodes) {
Widget item = findItem(node);
if (widget == item) {
return node;
@@ -1031,8 +1029,7 @@ public abstract class AsynchronousViewer extends StructuredViewer implements Lis
if (parentItem != null) {
ModelNode[] nodes = getModel().getNodes(parentItem.getData());
if (nodes != null) {
- for (int i = 0; i < nodes.length; i++) {
- ModelNode parentNode = nodes[i];
+ for (ModelNode parentNode : nodes) {
Widget parentWidget = findItem(parentNode);
if (parentWidget == parentItem) {
ModelNode[] childrenNodes = parentNode.getChildrenNodes();
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 c0687f085..a28ac491b 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
@@ -15,7 +15,6 @@ package org.eclipse.debug.internal.ui.viewers;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.debug.internal.ui.viewers.provisional.IChildrenRequestMonitor;
@@ -79,8 +78,7 @@ class ChildrenRequestMonitor extends AsynchronousRequestMonitor implements IChil
getModel().setChildren(getNode(), fChildren);
fFirstUpdate = false;
} else {
- for (Iterator<Object> iter = fChildren.iterator(); iter.hasNext();) {
- Object child = iter.next();
+ for (Object child : fChildren) {
getModel().add(getNode(), child);
}
}
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 5888a294b..348e9b7e6 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
@@ -64,8 +64,8 @@ public class ModelNode {
fDisposed = true;
ModelNode[] childrenNodes = getChildrenNodes();
if (childrenNodes != null) {
- for (int i = 0; i < childrenNodes.length; i++) {
- childrenNodes[i].dispose();
+ for (ModelNode node : childrenNodes) {
+ node.dispose();
}
}
}
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 83c471574..9d9c067c5 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
@@ -57,8 +57,7 @@ public class TableUpdatePolicy extends org.eclipse.debug.internal.ui.viewers.Abs
}
protected void updateNodes(IModelDelta[] nodes) {
- for (int i = 0; i < nodes.length; i++) {
- IModelDelta node = nodes[i];
+ for (IModelDelta node : nodes) {
int flags = node.getFlags();
if ((flags & IModelDelta.STATE) != 0) {
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 0a0641f9b..b7fa1d626 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
@@ -15,13 +15,9 @@
package org.eclipse.debug.internal.ui.viewers.breadcrumb;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -169,48 +165,37 @@ public abstract class AbstractBreadcrumb {
gridLayout.horizontalSpacing= 0;
fComposite.setLayout(gridLayout);
- fDisplayFocusListener= new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (fComposite.isDisposed()) return;
+ fDisplayFocusListener= event -> {
+ if (fComposite.isDisposed()) return;
- if (isBreadcrumbEvent(event)) {
- if (fHasFocus)
- return;
+ if (isBreadcrumbEvent(event)) {
+ if (fHasFocus)
+ return;
- focusGained();
- } else {
- if (!fHasFocus)
- return;
+ focusGained();
+ } else {
+ if (!fHasFocus)
+ return;
- focusLost();
- }
+ focusLost();
}
};
Display.getCurrent().addFilter(SWT.FocusIn, fDisplayFocusListener);
fBreadcrumbViewer= createViewer(fComposite);
- fBreadcrumbViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- Object element= ((IStructuredSelection) event.getSelection()).getFirstElement();
- if (element == null)
- return;
+ fBreadcrumbViewer.addDoubleClickListener(event -> {
+ Object element= ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (element == null)
+ return;
- BreadcrumbItem item= (BreadcrumbItem) fBreadcrumbViewer.doFindItem(element);
- if (item == null)
- return;
- item.openDropDownMenu();
- }
+ BreadcrumbItem item= (BreadcrumbItem) fBreadcrumbViewer.doFindItem(element);
+ if (item == null)
+ return;
+ item.openDropDownMenu();
});
- fBreadcrumbViewer.addOpenListener(new IOpenListener() {
- @Override
- public void open(OpenEvent event) {
- doOpen(event.getSelection());
- }
- });
+ fBreadcrumbViewer.addOpenListener(event -> doOpen(event.getSelection()));
return fComposite;
}
@@ -269,15 +254,12 @@ public abstract class AbstractBreadcrumb {
//Sanity check
deinstallDisplayListeners();
- fDisplayKeyListener= new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.keyCode != SWT.ESC)
- return;
+ fDisplayKeyListener= event -> {
+ if (event.keyCode != SWT.ESC)
+ return;
- if (!isBreadcrumbEvent(event))
- return;
- }
+ if (!isBreadcrumbEvent(event))
+ return;
};
Display.getDefault().addFilter(SWT.KeyDown, fDisplayKeyListener);
}
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 aa98d175f..14effd1e5 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
@@ -21,14 +21,8 @@ import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -76,12 +70,9 @@ class BreadcrumbItemDetails {
layout.marginHeight= 1;
layout.marginWidth= 2;
fImageComposite.setLayout(layout);
- fImageComposite.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- if (fHasFocus && !isTextVisible()) {
- e.gc.drawFocus(e.x, e.y, e.width, e.height);
- }
+ fImageComposite.addPaintListener(e -> {
+ if (fHasFocus && !isTextVisible()) {
+ e.gc.drawFocus(e.x, e.y, e.width, e.height);
}
});
installFocusComposite(fImageComposite);
@@ -99,12 +90,9 @@ class BreadcrumbItemDetails {
layout.marginWidth= 2;
fTextComposite.setLayout(layout);
addElementListener(fTextComposite);
- fTextComposite.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- if (fHasFocus && isTextVisible()) {
- e.gc.drawFocus(e.x, e.y, e.width, e.height);
- }
+ fTextComposite.addPaintListener(e -> {
+ if (fHasFocus && isTextVisible()) {
+ e.gc.drawFocus(e.x, e.y, e.width, e.height);
}
});
installFocusComposite(fTextComposite);
@@ -276,23 +264,20 @@ class BreadcrumbItemDetails {
* @param composite the composite which may get focus
*/
private void installFocusComposite(Composite composite) {
- composite.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
- int index= fParent.getViewer().getIndexOfItem(fParent);
- if (e.detail == SWT.TRAVERSE_TAB_NEXT) {
- index++;
- } else {
- index--;
- }
-
- if (index > 0 && index < fParent.getViewer().getItemCount()) {
- fParent.getViewer().selectItem(fParent.getViewer().getItem(index));
- }
-
- e.doit= true;
+ composite.addTraverseListener(e -> {
+ if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
+ int index= fParent.getViewer().getIndexOfItem(fParent);
+ if (e.detail == SWT.TRAVERSE_TAB_NEXT) {
+ index++;
+ } else {
+ index--;
+ }
+
+ if (index > 0 && index < fParent.getViewer().getItemCount()) {
+ fParent.getViewer().selectItem(fParent.getViewer().getItem(index));
}
+
+ e.doit= true;
}
});
composite.addKeyListener(new KeyListener() {
@@ -400,13 +385,10 @@ class BreadcrumbItemDetails {
public void mouseUp(MouseEvent e) {
}
});
- control.addMenuDetectListener(new MenuDetectListener() {
- @Override
- public void menuDetected(MenuDetectEvent e) {
- BreadcrumbViewer viewer= fParent.getViewer();
- viewer.selectItem(fParent);
- fParent.getViewer().fireMenuDetect(e);
- }
+ control.addMenuDetectListener(e -> {
+ BreadcrumbViewer viewer= fParent.getViewer();
+ viewer.selectItem(fParent);
+ fParent.getViewer().fireMenuDetect(e);
});
}
}
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 08739bb78..fda0d7398 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
@@ -29,8 +29,6 @@ import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.ShellEvent;
@@ -48,11 +46,12 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
@@ -103,14 +102,24 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
image.dispose();
int zoomedArrowSize = ARROW_SIZE * zoom / 100;
for (int y1 = 0; y1 < zoomedArrowSize; y1++) {
+ // set opaque pixels for top half of the breadcrumb arrow
for (int x1 = 0; x1 <= y1; x1++) {
imageData.setAlpha(fLTR ? x1 : zoomedArrowSize - x1 - 1, y1, 255);
}
+ // set transparent pixels for top half of the breadcrumbe arrow
+ for (int x1 = y1 + 1; x1 < zoomedArrowSize; x1++) {
+ imageData.setAlpha(fLTR ? x1 : zoomedArrowSize - x1 - 1, y1, 0);
+ }
}
for (int y2 = 0; y2 < zoomedArrowSize; y2++) {
+ // set opaque pixels for bottom half of the breadcrumb arrow
for (int x2 = 0; x2 <= y2; x2++) {
imageData.setAlpha(fLTR ? x2 : zoomedArrowSize - x2 - 1, zoomedArrowSize * 2 - y2 - 1, 255);
}
+ // set transparent pixels for bottom half of the breadcrumbe arrow
+ for (int x2 = y2 + 1; x2 < zoomedArrowSize; x2++) {
+ imageData.setAlpha(fLTR ? x2 : zoomedArrowSize - x2 - 1, zoomedArrowSize * 2 - y2 - 1, 0);
+ }
}
return imageData;
};
@@ -320,42 +329,39 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
* @param shell the shell to install the closer to
*/
private void installCloser(final Shell shell) {
- final Listener focusListener= new Listener() {
- @Override
- public void handleEvent(Event event) {
- Widget focusElement= event.widget;
- boolean isFocusBreadcrumbTreeFocusWidget= focusElement == shell || focusElement instanceof Control && ((Control)focusElement).getShell() == shell;
- boolean isFocusWidgetParentShell= focusElement instanceof Control && ((Control)focusElement).getShell().getParent() == shell;
+ final Listener focusListener= event -> {
+ Widget focusElement= event.widget;
+ boolean isFocusBreadcrumbTreeFocusWidget= focusElement == shell || focusElement instanceof Control && ((Control)focusElement).getShell() == shell;
+ boolean isFocusWidgetParentShell= focusElement instanceof Control && ((Control)focusElement).getShell().getParent() == shell;
+
+ switch (event.type) {
+ case SWT.FocusIn:
+ if (DebugUIPlugin.DEBUG_BREADCRUMB) {
+ DebugUIPlugin.trace("focusIn - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
+ }
- switch (event.type) {
- case SWT.FocusIn:
+ if (!isFocusBreadcrumbTreeFocusWidget && !isFocusWidgetParentShell) {
if (DebugUIPlugin.DEBUG_BREADCRUMB) {
- DebugUIPlugin.trace("focusIn - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
+ DebugUIPlugin.trace("==> closing shell since focus in other widget"); //$NON-NLS-1$
}
+ shell.close();
+ }
+ break;
- if (!isFocusBreadcrumbTreeFocusWidget && !isFocusWidgetParentShell) {
- if (DebugUIPlugin.DEBUG_BREADCRUMB) {
- DebugUIPlugin.trace("==> closing shell since focus in other widget"); //$NON-NLS-1$
- }
- shell.close();
- }
- break;
-
- case SWT.FocusOut:
+ case SWT.FocusOut:
+ if (DebugUIPlugin.DEBUG_BREADCRUMB) {
+ DebugUIPlugin.trace("focusOut - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
+ }
+ if (event.display.getActiveShell() == null) {
if (DebugUIPlugin.DEBUG_BREADCRUMB) {
- DebugUIPlugin.trace("focusOut - is breadcrumb tree: " + isFocusBreadcrumbTreeFocusWidget); //$NON-NLS-1$
+ DebugUIPlugin.trace("==> closing shell since event.display.getActiveShell() != shell"); //$NON-NLS-1$
}
- if (event.display.getActiveShell() == null) {
- if (DebugUIPlugin.DEBUG_BREADCRUMB) {
- DebugUIPlugin.trace("==> closing shell since event.display.getActiveShell() != shell"); //$NON-NLS-1$
- }
- shell.close();
- }
- break;
+ shell.close();
+ }
+ break;
- default:
- Assert.isTrue(false);
- }
+ default:
+ Assert.isTrue(false);
}
};
@@ -380,19 +386,16 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
};
fToolBar.getShell().addControlListener(controlListener);
- shell.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (DebugUIPlugin.DEBUG_BREADCRUMB) {
- DebugUIPlugin.trace("==> shell disposed"); //$NON-NLS-1$
- }
+ shell.addDisposeListener(e -> {
+ if (DebugUIPlugin.DEBUG_BREADCRUMB) {
+ DebugUIPlugin.trace("==> shell disposed"); //$NON-NLS-1$
+ }
- display.removeFilter(SWT.FocusIn, focusListener);
- display.removeFilter(SWT.FocusOut, focusListener);
+ display.removeFilter(SWT.FocusIn, focusListener);
+ display.removeFilter(SWT.FocusOut, focusListener);
- if (!fToolBar.isDisposed()) {
- fToolBar.getShell().removeControlListener(controlListener);
- }
+ if (!fToolBar.isDisposed()) {
+ fToolBar.getShell().removeControlListener(controlListener);
}
});
shell.addShellListener(new ShellListener() {
@@ -427,7 +430,8 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
}
private IDialogSettings getDialogSettings() {
- IDialogSettings javaSettings= DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings javaSettings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(BreadcrumbItemDropDown.class)).getDialogSettings();
IDialogSettings settings= javaSettings.getSection(DIALOG_SETTINGS);
if (settings == null) {
settings= javaSettings.addNewSection(DIALOG_SETTINGS);
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 64d38a7f4..f3b1fd4a3 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
@@ -170,8 +170,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
* @return true if any of the items in the viewer is expanded
*/
public boolean isDropDownOpen() {
- for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
- BreadcrumbItem item= fBreadcrumbItems.get(i);
+ for (BreadcrumbItem item : fBreadcrumbItems) {
if (item.isMenuShown()) {
return true;
}
@@ -187,8 +186,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
* @return the drop downs shell or <code>null</code>
*/
public Shell getDropDownShell() {
- for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
- BreadcrumbItem item= fBreadcrumbItems.get(i);
+ for (BreadcrumbItem item : fBreadcrumbItems) {
if (item.isMenuShown()) {
return item.getDropDownShell();
}
@@ -268,8 +266,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
return null;
}
- for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
- BreadcrumbItem item= fBreadcrumbItems.get(i);
+ for (BreadcrumbItem item : fBreadcrumbItems) {
if (item.getData() == element || element.equals(item.getData())) {
return item;
}
@@ -329,9 +326,9 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
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)) {
+ for (BreadcrumbItem currItem : fBreadcrumbItems) {
+ elements.add( currItem.getData() );
+ if (currItem.equals(item)) {
return new TreePath(elements.toArray());
}
}
@@ -368,9 +365,8 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
BreadcrumbItem item= (BreadcrumbItem) doFindItem(element);
if (item == null || element != null && element.equals(getInput())) {
- for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
- BreadcrumbItem item1= fBreadcrumbItems.get(i);
- layoutChanged = refreshItem(item1) || layoutChanged;
+ for (BreadcrumbItem currItem : fBreadcrumbItems) {
+ layoutChanged = refreshItem(currItem) || layoutChanged;
}
} else {
layoutChanged = refreshItem(item) || layoutChanged;
@@ -393,8 +389,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
BreadcrumbItem focusItem= null;
// Unselect the currently selected items, and remember the focused item.
- for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
- BreadcrumbItem item= fBreadcrumbItems.get(i);
+ for (BreadcrumbItem item : fBreadcrumbItems) {
if (item.hasFocus()) {
focusItem= item;
}
@@ -729,8 +724,7 @@ public abstract class BreadcrumbViewer extends StructuredViewer {
*/
private int getCurrentWidth() {
int result= 0;
- for (int i= 0, size= fBreadcrumbItems.size(); i < size; i++) {
- BreadcrumbItem viewer= fBreadcrumbItems.get(i);
+ for (BreadcrumbItem viewer : fBreadcrumbItems) {
result+= viewer.getWidth();
}
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 3bdec56c0..839493033 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
@@ -23,11 +23,9 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
@@ -86,14 +84,11 @@ public abstract class TreeViewerDropDown {
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());
+ fDropDownViewer.addOpenListener(event -> {
+ if (DebugUIPlugin.DEBUG_TREE_VIEWER_DROPDOWN) {
+ DebugUIPlugin.trace("BreadcrumbItemDropDown.showMenu()$treeViewer>open"); //$NON-NLS-1$
}
+ openElement(event.getSelection());
});
final Tree tree = fDropDownViewer.getTree();
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 b77fcc474..00cbf0dbf 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
@@ -195,8 +195,8 @@ class ChildrenCountUpdate extends ViewerUpdateMonitor implements IChildrenCountU
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)) {
+ for (ViewerUpdateMonitor request : fBatchedRequests) {
+ if (request.getElementPath().equals(path)) {
return true;
}
}
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 60c8125bd..0ae099c40 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
@@ -215,10 +215,10 @@ public class FilterTransform {
return childIndex;
}
int offset = 0;
- for (int i = 0; i < filteredIndexes.length; i++) {
- if (childIndex == filteredIndexes[i] ) {
+ for (int filteredIndex : filteredIndexes) {
+ if (childIndex == filteredIndex ) {
return -1;
- } else if (childIndex > filteredIndexes[i]) {
+ } else if (childIndex > filteredIndex) {
offset++;
} else {
break;
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 b05729bfa..6bce2166f 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
@@ -115,8 +115,8 @@ class HasChildrenUpdate extends ViewerUpdateMonitor implements IHasChildrenUpdat
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)) {
+ for (ViewerUpdateMonitor request : fBatchedRequests) {
+ if (request.getElementPath().equals(path)) {
return true;
}
}
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 b3cca22bc..64215e31c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2016 IBM Corporation and others.
+ * Copyright (c) 2006, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -239,8 +239,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
protected void disposeCellEditors() {
CellEditor[] cellEditors = getCellEditors();
if (cellEditors != null) {
- for (int i = 0; i < cellEditors.length; i++) {
- CellEditor editor = cellEditors[i];
+ for (CellEditor editor : cellEditors) {
if (editor != null) {
editor.dispose();
}
@@ -568,8 +567,8 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
* @param columnIds the identifiers of the columns to reset
*/
public void resetColumnSizes(String[] columnIds) {
- for (int i = 0; i < columnIds.length; i++) {
- fColumnSizes.remove(columnIds[i]);
+ for (String columnId : columnIds) {
+ fColumnSizes.remove(columnId);
}
}
@@ -617,9 +616,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
} 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]));
+ for (Widget item : items) {
+ if (item instanceof TreeItem) {
+ contentProvider.preserveState(getTreePathFromItem((TreeItem)item));
} else {
contentProvider.preserveState(TreePath.EMPTY);
}
@@ -679,11 +678,11 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
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 (TreeColumn column : columns) {
+ column.removeControlListener(fListener);
}
- for (int i = 0; i < columns.length; i++) {
- columns[i].dispose();
+ for (TreeColumn column : columns) {
+ column.dispose();
}
PresentationContext presentationContext = (PresentationContext) getPresentationContext();
if (presentation != null) {
@@ -744,23 +743,21 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
}
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();
+ for (TreeColumn column : getTree().getColumns()) {
+ Object colData = column.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);
+ column.setWidth(widthHint);
} else {
- treeColumn.setWidth(ans);
+ column.setWidth(ans);
}
} else {
- treeColumn.setWidth(width.intValue());
+ column.setWidth(width.intValue());
}
- treeColumn.addControlListener(fListener);
+ column.addControlListener(fListener);
}
}
@@ -790,15 +787,15 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
return presentation.getInitialColumns();
} else {
String[] available = presentation.getAvailableColumns();
- for (int i = 0; i < columns.length; i++) {
+ for (String column : columns) {
boolean columnAvailable = false;
- for (int j = 0; j < available.length; j++) {
- if (columns[i].equals(available[j])) {
+ for (String element : available) {
+ if (column.equals(element)) {
columnAvailable = true;
}
}
- if (!columnAvailable || presentation.getHeader(columns[i]) == null) {
+ if (!columnAvailable || presentation.getHeader(column) == 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.
@@ -839,11 +836,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
*/
protected void persistColumnSizes() {
Tree tree = getTree();
- TreeColumn[] columns = tree.getColumns();
- for (int i = 0; i < columns.length; i++) {
- TreeColumn treeColumn = columns[i];
- Object id = treeColumn.getData();
- fColumnSizes.put(id, Integer.valueOf(treeColumn.getWidth()));
+ for (TreeColumn column : tree.getColumns()) {
+ Object id = column.getData();
+ fColumnSizes.put(id, Integer.valueOf(column.getWidth()));
}
}
@@ -924,27 +919,21 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
* @param memento the {@link IMemento} to read from
*/
public void initState(IMemento memento) {
- IMemento[] mementos = memento.getChildren(COLUMN_SIZES);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(COLUMN_SIZES)) {
String id = child.getID();
Integer size = child.getInteger(SIZE);
if (size != null) {
fColumnSizes.put(id, size);
}
}
- mementos = memento.getChildren(SHOW_COLUMNS);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(SHOW_COLUMNS)) {
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];
+ for (IMemento child : memento.getChildren(VISIBLE_COLUMNS)) {
String id = child.getID();
Integer integer = child.getInteger(SIZE);
if (integer != null) {
@@ -956,9 +945,7 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
fVisibleColumns.put(id, columns);
}
}
- mementos = memento.getChildren(COLUMN_ORDER);
- for (int i = 0; i < mementos.length; i++) {
- IMemento child = mementos[i];
+ for (IMemento child : memento.getChildren(COLUMN_ORDER)) {
String id = child.getID();
Integer integer = child.getInteger(SIZE);
if (integer != null) {
@@ -1133,9 +1120,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
if (items.length == 1) {
return items[0];
}
- for (int i = 0; i < items.length; i++) {
- if (getTreePathFromItem((Item)items[i]).equals(path)) {
- return items[i];
+ for (Widget item : items) {
+ if (getTreePathFromItem((Item)item).equals(path)) {
+ return item;
}
}
return null;
@@ -1354,9 +1341,8 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
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) {
+ for (Item element : getChildren(parentItem)) {
+ if (element.getData() == null) {
return false;
}
}
@@ -1790,6 +1776,9 @@ public class InternalTreeModelViewer extends TreeViewer implements IInternalTree
@Override
protected void handleTreeCollapse(TreeEvent event) {
+ if (event.item.isDisposed()) {
+ return;
+ }
super.handleTreeCollapse(event);
IContentProvider contentProvider = getContentProvider();
if (contentProvider instanceof TreeModelContentProvider && event.item.getData() != null) {
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 351f5d5ed..f11f18c96 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
@@ -250,17 +250,14 @@ public class InternalVirtualTreeModelViewer extends Viewer
itemsToDisassociate = findItems(element);
}
- VirtualItem[] parentItems = findItems(parentElementOrTreePath);
- for (int i = 0; i < parentItems.length; i++) {
- VirtualItem parentItem = parentItems[i];
+ for (VirtualItem parentItem : findItems(parentElementOrTreePath)) {
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) {
+ for (VirtualItem itemToDisassociate : itemsToDisassociate) {
+ if (itemToDisassociate != item && itemToDisassociate.getParent() == parentItem) {
disassociate(itemToDisassociate);
itemToDisassociate.getParent().clear(itemToDisassociate.getIndex());
}
@@ -268,9 +265,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
//Object oldData = item.getData();
associate(element, item);
doUpdate(item);
- VirtualItem[] children = item.getItems();
- for (int j = 0; j < children.length; j++) {
- children[j].setNeedsDataUpdate();
+ for (VirtualItem childitem : item.getItems()) {
+ childitem.setNeedsDataUpdate();
}
}
}
@@ -312,9 +308,7 @@ public class InternalVirtualTreeModelViewer extends Viewer
final List<TreePath> oldSelection = new LinkedList<>(Arrays.asList(((TreeSelection) getSelection()).getPaths()));
preservingSelection(() -> {
TreePath removedPath = null;
- VirtualItem[] parentItems = findItems(parentOrTreePath);
- for (int i = 0; i < parentItems.length; i++) {
- VirtualItem parentItem = parentItems[i];
+ for (VirtualItem parentItem : findItems(parentOrTreePath)) {
if (parentItem.isDisposed()) {
continue;
}
@@ -361,12 +355,9 @@ public class InternalVirtualTreeModelViewer extends Viewer
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());
- }
+ for (VirtualItem item : findItems(elementOrPath)) {
+ disassociate(item);
+ item.getParent().remove(item.getIndex());
}
}
@@ -377,8 +368,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
// 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]) {
+ for (VirtualItem selectedItem : selectedItems) {
+ if (item == selectedItem) {
// 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.
@@ -501,9 +492,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void refresh(Object element) {
- VirtualItem[] items = findItems(element);
- for (int i = 0; i < items.length; i++) {
- refresh(items[i]);
+ for (VirtualItem item : findItems(element)) {
+ refresh(item);
validate();
}
}
@@ -517,9 +507,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
virtualLazyUpdateHasChildren(item);
}
- VirtualItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].setNeedsDataUpdate();
+ for (VirtualItem childItem : item.getItems()) {
+ childItem.setNeedsDataUpdate();
}
}
refreshStruct(item);
@@ -627,16 +616,14 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void setChildCount(final Object elementOrTreePath, final int count) {
preservingSelection(() -> {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- VirtualItem[] children = items[i].getItems();
- for (int j = 0; j < children.length; j++) {
- if (children[j].getData() != null && children[j].getIndex().intValue() >= count) {
- disassociate(children[j]);
+ for (VirtualItem item : findItems(elementOrTreePath)) {
+ for (VirtualItem element : item.getItems()) {
+ if (element.getData() != null && element.getIndex().intValue() >= count) {
+ disassociate(element);
}
}
- items[i].setItemCount(count);
+ item.setItemCount(count);
}
});
validate();
@@ -645,15 +632,11 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void setHasChildren(final Object elementOrTreePath, final boolean hasChildren) {
preservingSelection(() -> {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- VirtualItem item = items[i];
-
+ for (VirtualItem item : findItems(elementOrTreePath)) {
if (!hasChildren) {
- VirtualItem[] children = item.getItems();
- for (int j = 0; j < children.length; j++) {
- if (children[j].getData() != null) {
- disassociate(children[j]);
+ for (VirtualItem element : item.getItems()) {
+ if (element.getData() != null) {
+ disassociate(element);
}
}
}
@@ -826,10 +809,9 @@ public class InternalVirtualTreeModelViewer extends Viewer
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]);
+ for (VirtualItem childItem : item.getItems()) {
+ if (childItem.getData() != null) {
+ disassociate(childItem);
}
}
}
@@ -864,10 +846,10 @@ public class InternalVirtualTreeModelViewer extends Viewer
if (selection instanceof ITreeSelection) {
TreePath[] paths = ((ITreeSelection) selection).getPaths();
List<VirtualItem> newSelection = new ArrayList<>(paths.length);
- for (int i = 0; i < paths.length; ++i) {
+ for (TreePath path : paths) {
// Use internalExpand since item may not yet be created. See
// 1G6B1AR.
- VirtualItem item = findItem(paths[i]);
+ VirtualItem item = findItem(path);
if (item != null) {
newSelection.add(item);
}
@@ -895,9 +877,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void update(Object element) {
- VirtualItem[] items = findItems(element);
- for (int i = 0; i < items.length; i++) {
- doUpdate(items[i]);
+ for (VirtualItem item : findItems(element)) {
+ doUpdate(item);
}
}
@@ -914,13 +895,13 @@ public class InternalVirtualTreeModelViewer extends Viewer
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++) {
+ for (VirtualItem item : items) {
TreePath path = null;
- if (items[i].getData() != null) {
- path = getTreePathFromItem(items[i]);
+ if (item.getData() != null) {
+ path = getTreePathFromItem(item);
list.add(path);
}
- map.put(items[i], path);
+ map.put(item, path);
}
return new TreeSelection(list.toArray(new TreePath[list.size()]));
}
@@ -963,9 +944,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
@Override
public void setExpandedState(Object elementOrTreePath, boolean expanded) {
- VirtualItem[] items = findItems(elementOrTreePath);
- for (int i = 0; i < items.length; i++) {
- items[i].setExpanded(expanded);
+ for (VirtualItem item : findItems(elementOrTreePath)) {
+ item.setExpanded(expanded);
}
validate();
}
@@ -994,11 +974,10 @@ public class InternalVirtualTreeModelViewer extends Viewer
}
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);
+ for (VirtualItem element : item.getItems()) {
+ expandToLevel(element, newLevel);
}
}
}
@@ -1315,18 +1294,14 @@ public class InternalVirtualTreeModelViewer extends Viewer
* @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];
+ for (IMemento child : memento.getChildren(SHOW_COLUMNS)) {
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];
+ for (IMemento child : memento.getChildren(VISIBLE_COLUMNS)) {
String id = child.getID();
Integer integer = child.getInteger(SIZE);
if (integer != null) {
@@ -1451,7 +1426,6 @@ public class InternalVirtualTreeModelViewer extends Viewer
Set<VirtualItem> set = new HashSet<>();
Collections.addAll(set, selection);
- VirtualItem[] items = null;
VirtualItem parent = findItem(path);
if (parent != null) {
@@ -1468,9 +1442,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
delta.setFlags(delta.getFlags() | IModelDelta.SELECT);
}
- items = parent.getItems();
- for (int i = 0; i < items.length; i++) {
- doSaveElementState(path, delta, items[i], set, flagsToSave);
+ for (VirtualItem item : parent.getItems()) {
+ doSaveElementState(path, delta, item, set, flagsToSave);
}
return true;
} else {
@@ -1499,9 +1472,8 @@ public class InternalVirtualTreeModelViewer extends Viewer
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);
+ for (VirtualItem childItem : item.getItems()) {
+ doSaveElementState(elementPath, childDelta, childItem, set, flagsToSave);
}
}
}
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 073898188..c00ae9ffe 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
@@ -401,6 +401,9 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
private class DelayedDoModelChangedJob extends WorkbenchJob {
+ // limit batch size to avoid freezing the UI.
+ private static final int MAX_BATCH_SIZE = 100;
+
// queue of submitted deltas to process
private final List<Object> fQueue = new ArrayList<>();
private boolean shutdown;
@@ -418,8 +421,18 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
if (shutdown || fQueue.isEmpty()) {
return Status.OK_STATUS;
}
- currentBatch = new ArrayList<>(fQueue);
- fQueue.clear();
+ fQueue.removeIf(o -> {
+ if (currentBatch.size() < MAX_BATCH_SIZE) {
+ currentBatch.add(o);
+ return true;
+ }
+ return false;
+ });
+ if (!fQueue.isEmpty()) {
+ // There is work left.
+ // Give other UI tasks chance to work instead of freezing UI
+ schedule();
+ }
}
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER) {
DebugUIPlugin.trace("Delayed batch size: " + currentBatch.size()); //$NON-NLS-1$
@@ -636,9 +649,9 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
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))
+ for (ViewerFilter filter : filters) {
+ if (filter instanceof TreeModelViewerFilter &&
+ ((TreeModelViewerFilter)filter).isApplicable(fViewer, parentElement))
{
return true;
}
@@ -753,8 +766,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
* @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);
+ for (ViewerUpdateMonitor update : updates) {
notifyUpdate(UPDATE_COMPLETE, update);
if (DebugUIPlugin.DEBUG_UPDATE_SEQUENCE && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
DebugUIPlugin.trace("\tEND - " + update); //$NON-NLS-1$
@@ -977,8 +989,8 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
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) {
+ for (ViewerUpdateMonitor request : requests) {
+ if (request instanceof ChildrenUpdate) {
return true;
}
}
@@ -986,8 +998,8 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
requests = fRequestsInProgress.get(path);
if (requests != null) {
int numChildrenUpdateRequests = 0;
- for (int i = 0; i < requests.size(); i++) {
- if (requests.get(i) instanceof ChildrenUpdate) {
+ for (ViewerUpdateMonitor request : requests) {
+ if (request instanceof ChildrenUpdate) {
if (++numChildrenUpdateRequests > 1) {
return true;
}
@@ -1203,8 +1215,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
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);
+ for (ViewerUpdateMonitor update : requests) {
if (update instanceof ChildrenUpdate) {
return true;
}
@@ -1212,8 +1223,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
requests = fWaitingRequests.get(parentPath);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
+ for (ViewerUpdateMonitor update : requests) {
if (update.containsUpdate(path)) {
return true;
}
@@ -1221,8 +1231,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
requests = fRequestsInProgress.get(path);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
+ for (ViewerUpdateMonitor update : requests) {
if (update instanceof ChildrenUpdate) {
return true;
}
@@ -1230,8 +1239,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
requests = fRequestsInProgress.get(parentPath);
if (requests != null) {
- for (int i = 0; i < requests.size(); i++) {
- ViewerUpdateMonitor update = requests.get(i);
+ for (ViewerUpdateMonitor update : requests) {
if (update.getElement().equals(path.getLastSegment())) {
return true;
}
@@ -1261,8 +1269,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
* @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];
+ for (IModelDelta node : nodes) {
int flags = node.getFlags() & mask;
if (flags != 0) {
if ((flags & IModelDelta.ADDED) != 0) {
@@ -1549,7 +1556,14 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
DebugUIPlugin.trace(" - (found) remove(" + parentPath.getLastSegment() + ", viewIndex: " + viewIndex + " modelIndex: " + modelIndex); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
rescheduleUpdates(parentPath, modelIndex);
- getViewer().remove(parentPath, viewIndex);
+ if (viewIndex >= 0) {
+ getViewer().remove(parentPath, viewIndex);
+ } else {
+ if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER && DebugUIPlugin.DEBUG_TEST_PRESENTATION_ID(getPresentationContext())) {
+ DebugUIPlugin.trace(" - (not found in UI) remove(" + parentPath.getLastSegment() + ", viewIndex: " //$NON-NLS-1$ //$NON-NLS-2$
+ + viewIndex + " modelIndex: " + modelIndex); //$NON-NLS-1$
+ }
+ }
removeElementFromFilters(parentPath, modelIndex);
return;
}
@@ -1809,8 +1823,7 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
// necessary to check if viewer is disposed
try {
- for (int i = 0; i < jobCompletedUpdates.size(); i++) {
- ViewerUpdateMonitor completedUpdate = jobCompletedUpdates.get(i);
+ for (ViewerUpdateMonitor completedUpdate : jobCompletedUpdates) {
if (!completedUpdate.isCanceled() && !isDisposed()) {
IStatus status = completedUpdate.getStatus();
if (status == null || status.isOK()) {
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 168ac1b6a..d7d8c5fc9 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
@@ -11,6 +11,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
* IBM Corporation - bug fixing
+ * Umair Sair (Mentor Graphics) - Bug 550220
*******************************************************************************/
package org.eclipse.debug.internal.ui.viewers.model;
@@ -84,13 +85,6 @@ class ViewerStateTracker {
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 {
@@ -1035,7 +1029,7 @@ class ViewerStateTracker {
if (flags != IModelDelta.NO_CHANGE) {
IModelDelta parentDelta = delta.getParentDelta();
- // Remove the delta if :
+ // Do not visit children 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.
@@ -1045,7 +1039,6 @@ class ViewerStateTracker {
if ( !fContentProvider.areElementUpdatesPending(deltaPath) &&
(!(delta.getElement() instanceof IMemento) || !areMementoUpdatesPending(delta)) )
{
- removeDelta(delta);
return false;
}
}
@@ -1070,20 +1063,6 @@ class ViewerStateTracker {
}
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;
- visitorDelta.setElement(ELEMENT_REMOVED);
- visitorDelta.setFlags(IModelDelta.NO_CHANGE);
- return true;
- });
-
- }
}
CheckState state = new CheckState();
@@ -1149,8 +1128,8 @@ class ViewerStateTracker {
} else {
TreePath[] currentPaths = currentSelection.getPaths();
boolean pathInSelection = false;
- for (int i = 0; i < currentPaths.length; i++) {
- if (currentPaths[i].equals(treePath)) {
+ for (TreePath currentPath : currentPaths) {
+ if (currentPath.equals(treePath)) {
pathInSelection = true;
break;
}
@@ -1173,9 +1152,7 @@ class ViewerStateTracker {
// 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];
+ for (IModelDelta childDelta : delta.getChildDeltas()) {
int modelIndex = childDelta.getIndex();
if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
setTopItem = false;
@@ -1198,9 +1175,7 @@ class ViewerStateTracker {
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];
+ for (ModelDelta childDelta : (ModelDelta[])delta.getChildDeltas()) {
int modelIndex = childDelta.getIndex();
if (modelIndex >= 0 && (childDelta.getFlags() & IModelDelta.REVEAL) != 0) {
if (modelIndex < childCount) {
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 b557dc18f..1c46d887f 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
@@ -56,7 +56,6 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
private TreeModelViewer fClientViewer;
private static final String TAB = "\t"; //$NON-NLS-1$
- private static final String SEPARATOR = "line.separator"; //$NON-NLS-1$
/**
* Virtual viewer listener. It tracks progress of copy and increments
@@ -146,13 +145,14 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
}
String[] labels = (String[]) item.getData(VirtualItem.LABEL_KEY);
if(labels != null && labels.length > 0) {
- for (int i = 0; i < labels.length; i++) {
- String text = trimLabel(labels[i]);
+ for (String label : labels) {
+ String text = trimLabel(label);
if (text != null && !text.equals(IInternalDebugCoreConstants.EMPTY_STRING)) {
- buffer.append(text+TAB);
+ buffer.append(text);
}
+ buffer.append(TAB);
}
- buffer.append(System.getProperty(SEPARATOR));
+ buffer.append(System.lineSeparator());
}
}
@@ -171,7 +171,7 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
return label.trim();
}
- private class ItemsToCopyVirtualItemValidator implements IVirtualItemValidator {
+ private static class ItemsToCopyVirtualItemValidator implements IVirtualItemValidator {
Set<VirtualItem> fItemsToCopy = Collections.EMPTY_SET;
Set<VirtualItem> fItemsToValidate = Collections.EMPTY_SET;
@@ -221,18 +221,18 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
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());
+ for (TreeItem element : selection) {
+ TreePath parentPath = fClientViewer.getTreePathFromItem(element.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();
+ TreeItem parentItem = element.getParentItem();
if (parentItem != null) {
- index = parentItem.indexOf(selection[i]);
+ index = parentItem.indexOf(element);
} else {
- Tree parentTree = selection[i].getParent();
- index = parentTree.indexOf(selection[i]);
+ Tree parentTree = element.getParent();
+ index = parentTree.indexOf(element);
}
index = ((ITreeModelContentProvider)clientViewer.getContentProvider()).viewToModelIndex(parentPath, index);
vSelection.add( parentVItem.getItem(new Index(index)) );
@@ -267,20 +267,17 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
final IProgressMonitor monitor = dialog.getProgressMonitor();
dialog.setCancelable(true);
- 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());
- }
+ IRunnableWithProgress runnable = m -> {
+ 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;
- }
+ while (!listener.fItemsToUpdate.isEmpty() && !listener.fProgressMonitor.isCanceled()) {
+ Thread.sleep(1);
+ }
+ synchronized(listener) {
+ listener.fProgressMonitor = null;
}
};
try {
@@ -313,8 +310,8 @@ public class VirtualCopyToClipboardActionDelegate extends AbstractDebugActionDel
}
VirtualItem[] children = item.getItems();
if (children != null) {
- for (int i = 0; i < children.length; i++) {
- writeItemToBuffer(children[i], itemsToCopy, buffer, indent + 1);
+ for (VirtualItem element : children) {
+ writeItemToBuffer(element, itemsToCopy, buffer, indent + 1);
}
}
}
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 8a9d49627..af81638b5 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
@@ -16,6 +16,7 @@
package org.eclipse.debug.internal.ui.viewers.model;
import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -31,7 +32,6 @@ import org.eclipse.debug.internal.ui.viewers.FindElementDialog;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDeltaVisitor;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
@@ -40,7 +40,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualItem;
import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -53,8 +52,6 @@ import org.eclipse.ui.IWorkbenchCommandConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.IUpdate;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Action which prompts user with a filtered list selection dialog to find an element in tree.
*
@@ -64,7 +61,7 @@ public class VirtualFindAction extends Action implements IUpdate {
private TreeModelViewer fClientViewer;
- private class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
+ private static class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
private boolean fViewerUpdatesComplete = false;
private boolean fLabelUpdatesComplete = false;
@@ -134,8 +131,7 @@ public class VirtualFindAction extends Action implements IUpdate {
public FindLabelProvider(VirtualTreeModelViewer viewer, List<VirtualItem> items) {
fVirtualViewer = viewer;
- for (int i = 0; i < items.size(); i++) {
- VirtualItem item = items.get(i);
+ for (VirtualItem item : items) {
fTextCache.put(item, fVirtualViewer.getText(item, 0));
}
}
@@ -195,20 +191,17 @@ public class VirtualFindAction extends Action implements IUpdate {
try {
dialog.run(
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;
- }
+ m -> {
+ 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) {
@@ -236,15 +229,12 @@ public class VirtualFindAction extends Action implements IUpdate {
private int calcUpdatesCount(IModelDelta stateDelta) {
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;
+ stateDelta.accept( (delta, 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.
@@ -254,10 +244,10 @@ public class VirtualFindAction extends Action implements IUpdate {
private void collectAllChildren(VirtualItem element, List<VirtualItem> collect) {
VirtualItem[] children = element.getItems();
if (children != null) {
- for (int i = 0; i < children.length; i++) {
- if (!children[i].needsLabelUpdate()) {
- collect.add(children[i]);
- collectAllChildren(children[i], collect);
+ for (VirtualItem child : children) {
+ if (!child.needsLabelUpdate()) {
+ collect.add(child);
+ collectAllChildren(child, collect);
}
}
}
@@ -284,14 +274,11 @@ public class VirtualFindAction extends Action implements IUpdate {
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;
+ stateDelta.accept((delta, depth) -> {
+ if ((delta.getFlags() & IModelDelta.SELECT) != 0) {
+ ((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.FORCE);
}
+ return true;
});
fClientViewer.updateViewer(stateDelta);
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 be08f7380..451ca18c4 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
@@ -158,10 +158,9 @@ public class ModelDelta implements IModelDelta {
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];
+ for (ModelDelta node : (ModelDelta[])nodeOrNodes) {
+ if (index == node.getIndex()) {
+ return node;
}
}
}
@@ -175,8 +174,8 @@ public class ModelDelta implements IModelDelta {
}
// 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 (ModelDelta node : fNodesList) {
+ mapNode( node );
}
}
@@ -358,9 +357,8 @@ public class ModelDelta implements IModelDelta {
buf.append(" Child Count: "); //$NON-NLS-1$
buf.append(delta.getChildCount());
buf.append('\n');
- IModelDelta[] nodes = delta.getChildDeltas();
- for (int i = 0; i < nodes.length; i++) {
- appendDetail(indent + " ", buf, nodes[i]); //$NON-NLS-1$
+ for (IModelDelta node : delta.getChildDeltas()) {
+ appendDetail(indent + " ", buf, node); //$NON-NLS-1$
}
}
@@ -376,9 +374,8 @@ public class ModelDelta implements IModelDelta {
protected void doAccept(IModelDeltaVisitor visitor, int depth) {
if (visitor.visit(this, depth)) {
- IModelDelta[] childDeltas = getChildDeltas();
- for (int i = 0; i < childDeltas.length; i++) {
- ((ModelDelta)childDeltas[i]).doAccept(visitor, depth+1);
+ for (IModelDelta node : getChildDeltas()) {
+ ((ModelDelta)node).doAccept(visitor, depth+1);
}
}
}
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 7fed0f718..05b3897fc 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
@@ -190,39 +190,34 @@ public class PresentationContext implements IPresentationContext {
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];
+ for (IMemento childMemento : memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES)) {
+ if (getId().equals(childMemento.getID())) {
+ presentationMemento = childMemento;
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));
+ for (IMemento stringProperty : presentationMemento.getChildren(STRING)) {
+ fProperties.put(stringProperty.getID(), stringProperty.getString(STRING));
}
- IMemento[] integerMementos = presentationMemento.getChildren(INTEGER);
- for (int i = 0; i < integerMementos.length; i++) {
- fProperties.put(integerMementos[i].getID(), integerMementos[i].getInteger(INTEGER));
+ for (IMemento integerMemento : presentationMemento.getChildren(INTEGER)) {
+ fProperties.put(integerMemento.getID(), integerMemento.getInteger(INTEGER));
}
- IMemento[] booleanMementos = presentationMemento.getChildren(BOOLEAN);
- for (int i = 0; i < booleanMementos.length; i++) {
- fProperties.put(booleanMementos[i].getID(), booleanMementos[i].getBoolean(BOOLEAN));
+ for (IMemento booleanMemento : presentationMemento.getChildren(BOOLEAN)) {
+ fProperties.put(booleanMemento.getID(), booleanMemento.getBoolean(BOOLEAN));
}
- IMemento[] persistableMementos = presentationMemento.getChildren(PERSISTABLE);
- for (int i = 0; i < persistableMementos.length; i++) {
- String factoryID = persistableMementos[i].getString(PERSISTABLE);
+ for (IMemento persistableMemento : presentationMemento.getChildren(PERSISTABLE)) {
+ String factoryID = persistableMemento.getString(PERSISTABLE);
if (factoryID != null) {
IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID);
if (factory != null) {
- Object element = factory.createElement(persistableMementos[i]);
+ Object element = factory.createElement(persistableMemento);
if (element != null) {
- fProperties.put(persistableMementos[i].getID(), element);
+ fProperties.put(persistableMemento.getID(), element);
}
}
}
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 a52928877..77be30fb8 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
@@ -33,12 +33,9 @@ public class ViewerInputService {
*
* @since 3.6
*/
- public final static Object NULL_INPUT = new IViewerInputProvider() {
- @Override
- public void update(IViewerInputUpdate update) {
- update.setInputElement(null);
- update.done();
- }
+ public final static Object NULL_INPUT = (IViewerInputProvider) update -> {
+ update.setInputElement(null);
+ update.done();
};
// previous update request, cancelled when a new request comes in
@@ -48,16 +45,13 @@ public class ViewerInputService {
private ITreeModelViewer fViewer;
- private IViewerInputRequestor fProxyRequest = new IViewerInputRequestor() {
- @Override
- public void viewerInputComplete(final IViewerInputUpdate update) {
- synchronized (ViewerInputService.this) {
- if (fPendingUpdate == update) {
- fPendingUpdate = null;
- }
+ private IViewerInputRequestor fProxyRequest = update -> {
+ synchronized (ViewerInputService.this) {
+ if (fPendingUpdate == update) {
+ fPendingUpdate = null;
}
- fRequestor.viewerInputComplete(update);
}
+ fRequestor.viewerInputComplete(update);
};
/**
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 3395b071e..88ddb27fe 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
@@ -41,8 +41,7 @@ public class VirtualTree extends VirtualItem {
@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];
+ for (VirtualItem selectionItem : fSelection) {
while (selectionItem != null) {
if (item.equals(selectionItem)) {
return true;
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 6010cacff..e9669a5e8 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
@@ -145,7 +145,7 @@ public abstract class AbstractModelProxy implements IModelProxy2 {
fInstallJob = new Job("Model Proxy installed notification job") {//$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
- synchronized(this) {
+ synchronized(AbstractModelProxy.this) {
fInstallJob = null;
}
if (!monitor.isCanceled()) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java
index ec9e20a17..c54539e26 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java
@@ -45,10 +45,9 @@ public class BreakpointContainerProxy extends AbstractModelProxy implements IChe
@Override
public boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
boolean atLeastOne = false;
- IBreakpoint[] breakpoints = fContainer.getBreakpoints();
- for (int i = 0; i < breakpoints.length; ++i) {
+ for (IBreakpoint breakpoint : fContainer.getBreakpoints()) {
try {
- breakpoints[i].setEnabled(checked);
+ breakpoint.setEnabled(checked);
atLeastOne = true;
} catch (CoreException e) {}
}
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 ffb00b1b4..e7f83d626 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
@@ -168,8 +168,8 @@ public class BreakpointManagerProxy extends AbstractModelProxy {
fPendingDeltas.clear();
fFireModelChangedJob = null;
}
- for (int i = 0; i < deltas.length; i++) {
- fireModelChanged( ((DeltaInfo)deltas[i]).fDelta );
+ for (Object pendingDelta : deltas) {
+ fireModelChanged( ((DeltaInfo)pendingDelta).fDelta );
}
return Status.OK_STATUS;
}
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 ee7f58541..ba0b93b4b 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
@@ -57,9 +57,7 @@ public class DefaultWatchExpressionModelProxy extends DefaultExpressionModelProx
@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];
+ for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
// Virtual viewer may have a null control.
Control control = viewer.getControl();
if (control != null && control.getShell().equals(window.getShell())) {
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 68eec9df9..82407f3cc 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
@@ -94,8 +94,7 @@ public abstract class EventHandlerModelProxy extends AbstractModelProxy implemen
fTimer.cancel();
fTimerTasks.clear();
DebugPlugin.getDefault().removeDebugEventListener(this);
- for (int i = 0; i < fHandlers.length; i++) {
- DebugEventHandler handler = fHandlers[i];
+ for (DebugEventHandler handler : fHandlers) {
handler.dispose();
}
}
@@ -112,11 +111,9 @@ public abstract class EventHandlerModelProxy extends AbstractModelProxy implemen
if (isDisposed()) {
return;
}
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (containsEvent(event)) {
- for (int j = 0; j < fHandlers.length; j++) {
- DebugEventHandler handler = fHandlers[j];
+ for (DebugEventHandler handler : fHandlers) {
if (isDisposed()) {
return;
}
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 b5317ed7a..8c899d4c5 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
@@ -65,8 +65,7 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
public void expressionsMoved(IExpression[] expressions, int index){
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];
+ for (IExpression expression : expressions) {
delta.addNode(expression, IModelDelta.REMOVED);
}
for (int i = 0; i < expressions.length; i++) {
@@ -111,8 +110,7 @@ public class ExpressionManagerModelProxy extends AbstractModelProxy implements I
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];
+ for (IExpression expression : expressions) {
delta.addNode(expression, flags);
}
fireModelChanged(delta);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java
index a694d5c59..6c9ee161d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/LaunchManagerProxy.java
@@ -80,8 +80,8 @@ public class LaunchManagerProxy extends AbstractModelProxy implements ILaunchesL
*/
protected void fireDelta(ILaunch[] launches, int launchFlags) {
ModelDelta delta = new ModelDelta(fLaunchManager, IModelDelta.NO_CHANGE);
- for (int i = 0; i < launches.length; i++) {
- delta.addNode(launches[i], launchFlags);
+ for (ILaunch launch : launches) {
+ delta.addNode(launch, launchFlags);
}
fireModelChanged(delta);
}
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 d7e0e6ae3..3813ce159 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
@@ -75,8 +75,8 @@ public class LaunchProxy extends AbstractModelProxy implements ILaunchesListener
@Override
public void launchesTerminated(ILaunch[] launches) {
- for (int i = 0; i < launches.length; i++) {
- if (launches[i] == fLaunch) {
+ for (ILaunch launch : launches) {
+ if (launch == fLaunch) {
fireDelta(IModelDelta.STATE | IModelDelta.CONTENT | IModelDelta.UNINSTALL);
break;
}
@@ -85,8 +85,8 @@ public class LaunchProxy extends AbstractModelProxy implements ILaunchesListener
@Override
public void launchesRemoved(ILaunch[] launches) {
- for (int i = 0; i < launches.length; i++) {
- if (launches[i] == fLaunch) {
+ for (ILaunch launch : launches) {
+ if (launch == fLaunch) {
fireDelta(IModelDelta.UNINSTALL);
break;
}
@@ -99,8 +99,8 @@ public class LaunchProxy extends AbstractModelProxy implements ILaunchesListener
@Override
public void launchesChanged(ILaunch[] launches) {
- for (int i = 0; i < launches.length; i++) {
- if (launches[i] == fLaunch) {
+ for (ILaunch launch : launches) {
+ if (launch == fLaunch) {
fireDelta(IModelDelta.STATE | IModelDelta.CONTENT);
installModelProxies();
break;
@@ -121,8 +121,7 @@ public class LaunchProxy extends AbstractModelProxy implements ILaunchesListener
synchronized(this) {
Object[] children = fLaunch.getChildren();
ModelDelta launchDelta = root.addNode(fLaunch, indexOf(fLaunch, allLaunches), IModelDelta.EXPAND, children.length);
- for (int j = 0; j < children.length; j++) {
- Object child = children[j];
+ for (Object child : children) {
if (fPrevChildren.add(child)) {
changes = true;
launchDelta.addNode(child, indexOf(child, children), IModelDelta.INSTALL, -1);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java
index 83ce4f705..2b315c68c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/MemoryRetrievalProxy.java
@@ -77,20 +77,18 @@ public class MemoryRetrievalProxy extends AbstractModelProxy implements IMemoryB
ModelDelta delta = new ModelDelta(fRetrieval, IModelDelta.NO_CHANGE);
// find a memory block to select
-
- for (int i = 0; i < memory.length; i++) {
- IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memory[i]);
-
+ for (IMemoryBlock block : memory) {
+ IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(block);
if (retrieval != null) {
if (retrieval == fRetrieval) {
// do not change selection if the memory block
// removed is not
// currently selected
// #getCurrentSelection must be run on the UI thread
- if (isMemoryBlockSelected(getCurrentSelection(), memory[i])) {
+ if (isMemoryBlockSelected(getCurrentSelection(), block)) {
addSelectDeltaNode(delta);
}
- delta.addNode(memory[i], IModelDelta.REMOVED);
+ delta.addNode(block, IModelDelta.REMOVED);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java
index c8669a24c..3a78e8d1e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java
@@ -53,8 +53,7 @@ public class ViewContextManager implements IWindowListener {
private ViewContextManager() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
+ for (IWorkbenchWindow window : workbenchWindows) {
windowOpened(window);
}
workbench.addWindowListener(this);
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 23cbced2d..691b976f1 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
@@ -256,14 +256,13 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
*/
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++) {
- addActivated(contextIds[i]);
+ for (String contextId : contextIds) {
+ addActivated(contextId);
}
// 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];
+ for (String viewId : fAllViewBindingIds) {
ViewBinding binding = fAllViewIdToBindings.get(viewId);
binding.activated(page, perspective);
binding.checkZOrder(page, allViewIds);
@@ -288,8 +287,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
for (DebugContextViewBindings bindings : contexts) {
fAllConetxtIds[pos] = bindings.getId();
pos++;
- for (int i = 0; i < bindings.fViewBindingIds.length; i++) {
- String viewId = bindings.fViewBindingIds[i];
+ for (String viewId : bindings.fViewBindingIds) {
if (bindings == this) {
orderedIds.add(viewId);
}
@@ -314,8 +312,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
if (isActiveContext(getId())) {
setActive(page.getPerspective(), null);
}
- for (int i = 0; i < fViewBindingIds.length; i++) {
- String viewId = fViewBindingIds[i];
+ for (String viewId : fViewBindingIds) {
ViewBinding binding = fAllViewIdToBindings.get(viewId);
binding.deactivated(page, perspective);
}
@@ -355,8 +352,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
* @param alreadyDone views already done
*/
public void saveBindings(Document document, Element root, Set<String> alreadyDone) {
- for (int i = 0; i < fViewBindingIds.length; i++) {
- String viewId = fViewBindingIds[i];
+ for (String viewId : fViewBindingIds) {
if (!alreadyDone.contains(viewId)) {
alreadyDone.add(viewId);
ViewBinding binding = fAllViewIdToBindings.get(viewId);
@@ -581,9 +577,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
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];
+ for (String id : perpectives.toArray(new String[perpectives.size()])) {
Element element = document.createElement(XML_ELEMENT_PERSPECTIVE);
element.setAttribute(XML_ATTR_ID, id);
element.setAttribute(XML_ATTR_USER_ACTION, xmlValue);
@@ -664,9 +658,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
private void loadContextToViewExtensions() {
fContextIdsToBindings = new HashMap<>();
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];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
if ( ELEM_CONTEXT_VIEW_BINDING.equals(element.getName()) ) {
String viewId = element.getAttribute(ATTR_VIEW_ID);
String contextId = element.getAttribute(ATTR_CONTEXT_ID);
@@ -780,9 +772,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
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];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
if ( ELEM_PERSPECTIVE.equals(element.getName()) ) {
String perspectiveId = element.getAttribute(ATTR_PERSPECTIVE_ID);
if (perspectiveId != null) {
@@ -816,8 +806,8 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
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))) {
+ for (String workbenchContext : workbenchContexts) {
+ if (!isActivated(workbenchContext)) {
needToActivate = true;
break;
}
@@ -827,8 +817,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
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);
+ for (String contextId : workbenchContexts) {
if (!isActivated(contextId)) {
activateChain(contextId, getActivePerspective(), allViewIds);
}
@@ -993,17 +982,16 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi
}
}
- private Set<String> getAllContextsViewIDs(List<String> contextsIds) {
+ private Set<String> getAllContextsViewIDs(List<String> contextIds) {
if (fWindow == null) {
return Collections.EMPTY_SET; // disposed
}
TreeSet<String> viewIds = new TreeSet<>();
- for (int i = 0; i < contextsIds.size(); i++) {
- DebugContextViewBindings bindings= fContextIdsToBindings.get(contextsIds.get(i));
+ for (String contextId : contextIds) {
+ DebugContextViewBindings bindings= fContextIdsToBindings.get(contextId);
if (bindings != null) {
- String[] bindingViewIds = bindings.getAllViewBindingsIds();
- Collections.addAll(viewIds, bindingViewIds);
+ Collections.addAll(viewIds, bindings.getAllViewBindingsIds());
}
}
return viewIds;
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 3488c24c9..137a28b14 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
@@ -131,13 +131,12 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap
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);
+ for (IAdaptable category : emptyCategories) {
+ BreakpointContainer container = findExistingContainer(fChildContainers, category);
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);
+ container = new BreakpointContainer(this, category, fNesting[0], fComparator, siblings);
insertChildContainer(container);
container.fDefaultContainer = true;
@@ -276,11 +275,8 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap
IBreakpointOrganizer organizer = fNesting[0];
// get the breakpoint categories from the organizer
- IAdaptable[] categories = getCategories(breakpoint, organizer);
-
- for (int i = 0; i < categories.length; ++i) {
+ for (IAdaptable category : getCategories(breakpoint, organizer)) {
ModelDelta childDelta = null;
- IAdaptable category = categories[i];
BreakpointContainer container = findExistingContainer(fChildContainers, category);
// create a new container if it doesn't exist
@@ -595,8 +591,7 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap
return new BreakpointContainer[]{this};
}
ArrayList<BreakpointContainer> list = new ArrayList<>();
- for (int i = 0; i < containers.length; i++) {
- BreakpointContainer container = containers[i];
+ for (BreakpointContainer container : containers) {
BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
if (subcontainers != null) {
Collections.addAll(list, subcontainers);
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 9c7bf8d82..7f04f4a83 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
@@ -160,8 +160,8 @@ public class BreakpointOrganizerExtension implements IBreakpointOrganizer, IBrea
if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
((IBreakpointOrganizerDelegateExtension)organizer).addBreakpoints(breakpoints, category);
} else {
- for (int i = 0; i < breakpoints.length; i++) {
- addBreakpoint(breakpoints[i], category);
+ for (IBreakpoint breakpoint : breakpoints) {
+ addBreakpoint(breakpoint, category);
}
}
}
@@ -172,8 +172,8 @@ public class BreakpointOrganizerExtension implements IBreakpointOrganizer, IBrea
if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
((IBreakpointOrganizerDelegateExtension)organizer).removeBreakpoints(breakpoints, category);
} else {
- for (int i = 0; i < breakpoints.length; i++) {
- removeBreakpoint(breakpoints[i], category);
+ for (IBreakpoint breakpoint : breakpoints) {
+ removeBreakpoint(breakpoint, 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 49e1ef05f..f02f3569d 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
@@ -28,7 +28,6 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
/**
* Manager which provides access to the breakpoint organizers
@@ -78,10 +77,7 @@ public class BreakpointOrganizerManager {
*/
private void start(String organizerId) {
IBreakpointOrganizer organizer = getOrganizer(organizerId);
- IPropertyChangeListener listener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- }
+ IPropertyChangeListener listener = event -> {
};
organizer.addPropertyChangeListener(listener);
organizer.removePropertyChangeListener(listener);
@@ -92,9 +88,7 @@ public class BreakpointOrganizerManager {
*/
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];
+ for (IConfigurationElement element : extensionPoint.getConfigurationElements()) {
IBreakpointOrganizer organizer = new BreakpointOrganizerExtension(element);
if (validateOrganizer(organizer)) {
fOrganizers.put(organizer.getIdentifier(), organizer);
@@ -124,14 +118,7 @@ public class BreakpointOrganizerManager {
Collection<IBreakpointOrganizer> collection = fOrganizers.values();
fSorted = new ArrayList<>();
fSorted.addAll(collection);
- Collections.sort(fSorted, new Comparator<Object>() {
- @Override
- public int compare(Object o1, Object o2) {
- IBreakpointOrganizer b1 = (IBreakpointOrganizer)o1;
- IBreakpointOrganizer b2 = (IBreakpointOrganizer)o2;
- return b1.getLabel().compareTo(b2.getLabel());
- }
- });
+ Collections.sort(fSorted, Comparator.comparing(IBreakpointOrganizer::getLabel));
}
return fSorted.toArray(new IBreakpointOrganizer[fSorted.size()]);
}
@@ -149,9 +136,7 @@ public class BreakpointOrganizerManager {
* 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];
+ for (IBreakpointOrganizer organizer : getOrganizers()) {
organizer.dispose();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
index 9d8d08d08..a8129c311 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
@@ -82,12 +82,10 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
List<IAdaptable> result = new ArrayList<>();
IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- IWorkingSet set = workingSets[i];
+ for (IWorkingSet set : workingSets) {
if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
IAdaptable[] elements = set.getElements();
- for (int j = 0; j < elements.length; j++) {
- IAdaptable adaptable = elements[j];
+ for (IAdaptable adaptable : elements) {
if (adaptable.equals(breakpoint)) {
result.add(new WorkingSetCategory(set));
break;
@@ -143,9 +141,9 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
}
if(property.equals(IWorkingSetManager.CHANGE_WORKING_SET_ADD)) {
IAdaptable[] breakpoints = set.getElements();
- for (int i = 0; i < breakpoints.length; i++) {
- if (breakpoints[i] instanceof IBreakpoint) {
- IMarker marker = ((IBreakpoint)breakpoints[i]).getMarker();
+ for (IAdaptable breakpoint : breakpoints) {
+ if (breakpoint instanceof IBreakpoint) {
+ IMarker marker = ((IBreakpoint) breakpoint).getMarker();
fCache.addEntry(marker, set.getName());
fCache.flushMarkerCache(marker);
}
@@ -159,12 +157,12 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
@Override
public void breakpointsAdded(IBreakpoint[] breakpoints) {
Map<IWorkingSet, List<IBreakpoint>> setToBreakpoints = new HashMap<>();
- for (int i = 0; i < breakpoints.length; i++) {
- IMarker marker = breakpoints[i].getMarker();
+ for (IBreakpoint breakpoint : breakpoints) {
+ IMarker marker = breakpoint.getMarker();
String[] names = getWorkingsetAttributeFromMarker(marker, IInternalDebugUIConstants.WORKING_SET_NAME);
//add it to the default set if the listing is empty
if (names.length == 0) {
- queueToSet(breakpoints[i], getDefaultWorkingSet(), setToBreakpoints);
+ queueToSet(breakpoint, getDefaultWorkingSet(), setToBreakpoints);
} else {
for (int j = 1; j < names.length; j++) {
IWorkingSet set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(names[j]);
@@ -172,7 +170,7 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
if (set == null) {
set = getDefaultWorkingSet();
}
- queueToSet(breakpoints[i], set, setToBreakpoints);
+ queueToSet(breakpoint, set, setToBreakpoints);
}
}
}
@@ -204,12 +202,11 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
IAdaptable[] elements = set.getElements();
Set<IAdaptable> collection = new HashSet<>(elements.length);
List<IAdaptable> list = new ArrayList<>(elements.length + breakpoints.length);
- for(int i = 0; i < elements.length; i++) {
- collection.add(elements[i]);
- list.add(elements[i]);
+ for (IAdaptable element : elements) {
+ collection.add(element);
+ list.add(element);
}
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
+ for (IBreakpoint breakpoint : breakpoints) {
if (!collection.contains(breakpoint)) {
list.add(breakpoint);
fCache.addEntry(breakpoint.getMarker(), set.getName()); //fix for bug 103731
@@ -225,8 +222,8 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
IMarkerDelta[] deltas) {
IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
IWorkingSet set = null;
- for (int i = 0; i < workingSets.length; i++) {
- set = workingSets[i];
+ for (IWorkingSet workingSet : workingSets) {
+ set = workingSet;
if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
clean(set);
}
@@ -255,8 +252,7 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
}
if (update) {
List<IAdaptable> newElements = new ArrayList<>(elements.length);
- for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
+ for (IAdaptable adaptable : elements) {
if (adaptable != null) {
newElements.add(adaptable);
}
@@ -360,8 +356,7 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
IWorkingSet set = ((WorkingSetCategory) category).getWorkingSet();
IAdaptable[] elements = set.getElements();
List<IAdaptable> list = new ArrayList<>();
- for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
+ for (IAdaptable adaptable : elements) {
if (!adaptable.equals(breakpoint)) {
list.add(adaptable);
}
@@ -376,8 +371,7 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
public IAdaptable[] getCategories() {
IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
List<IAdaptable> all = new ArrayList<>();
- for (int i = 0; i < workingSets.length; i++) {
- IWorkingSet set = workingSets[i];
+ for (IWorkingSet set : workingSets) {
if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set
.getId())) {
all.add(new WorkingSetCategory(set));
@@ -401,8 +395,7 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
IAdaptable[] elements = set.getElements();
List<IAdaptable> list = new ArrayList<>(elements.length);
Collections.addAll(list, elements);
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
+ for (IBreakpoint breakpoint : breakpoints) {
fCache.removeMappedEntry(breakpoint.getMarker(), set.getName());
fCache.flushMarkerCache(breakpoint.getMarker());
list.remove(breakpoint);
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 f35696e10..085f82abc 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
@@ -33,8 +33,8 @@ 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);
+ for (IAdaptable element : elements) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class);
if (breakpoint != null) {
return selectBreakpoints(elements);
}
@@ -44,8 +44,8 @@ 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);
+ for (IAdaptable element : elements) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, 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 47c2e2716..42eb68019 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
@@ -31,8 +31,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@@ -85,14 +83,7 @@ public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetP
label.setLayoutData(gd);
fWorkingSetName= new Text(composite, SWT.SINGLE | SWT.BORDER);
fWorkingSetName.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- fWorkingSetName.addModifyListener(
- new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- }
- );
+ fWorkingSetName.addModifyListener(e -> validateInput());
fWorkingSetName.setFocus();
label= new Label(composite, SWT.WRAP);
label.setText(DebugUIViewsMessages.BreakpointWorkingSetPage_3);
@@ -168,11 +159,10 @@ public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetP
@Override
public void finish() {
String workingSetName = fWorkingSetName.getText();
- Object[] adaptable = fTViewer.getCheckedElements().toArray();
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);
+ for (Object adaptableElement : fTViewer.getCheckedElements()) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(adaptableElement, IBreakpoint.class);
if(breakpoint != null) {
elements.add(breakpoint);
}//end if
@@ -206,9 +196,8 @@ public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetP
}
fFirstCheck= false;
if (errorMessage == null && (fWorkingSet == null || newText.equals(fWorkingSet.getName()) == false)) {
- IWorkingSet[] workingSets= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
- for (int i= 0; i < workingSets.length; i++) {
- if (newText.equals(workingSets[i].getName())) {
+ for (IWorkingSet workingSet : PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets()) {
+ if (newText.equals(workingSet.getName())) {
errorMessage= DebugUIViewsMessages.BreakpointWorkingSetPage_6;
}
}
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 7672e1aed..b5fe15275 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
@@ -90,8 +90,8 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
public void setOrganizers(IBreakpointOrganizer[] organizers) {
// remove previous listeners
if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].removePropertyChangeListener(this);
+ for (IBreakpointOrganizer organizer : fOrganizers) {
+ organizer.removePropertyChangeListener(this);
}
}
fOrganizers = organizers;
@@ -100,8 +100,8 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
}
// add listeners
if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].addPropertyChangeListener(this);
+ for (IBreakpointOrganizer organizer : fOrganizers) {
+ organizer.addPropertyChangeListener(this);
}
}
if (!fDisposed) {
@@ -114,10 +114,10 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
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])) {
+ for (Object element : fElements) {
+ BreakpointContainer container = (BreakpointContainer) element;
+ for (IBreakpoint breakpoint : breakpoints) {
+ if (container.contains(breakpoint)) {
fViewer.expandToLevel(container, AbstractTreeViewer.ALL_LEVELS);
fViewer.updateCheckedState(container);
break;
@@ -140,8 +140,8 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
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];
+ for (Object element : fElements) {
+ BreakpointContainer container = (BreakpointContainer) element;
if (container.contains(breakpoint)) {
list.add(container);
}
@@ -172,14 +172,12 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
} else {
IBreakpointOrganizer organizer = fOrganizers[0];
Map<IAdaptable, BreakpointContainer> categoriesToContainers = new HashMap<>();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
+ for (IBreakpoint breakpoint : breakpoints) {
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];
+ for (IAdaptable category : categories) {
BreakpointContainer container = categoriesToContainers.get(category);
if (container == null) {
IBreakpointOrganizer[] nesting = null;
@@ -196,12 +194,11 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
// 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);
+ for (IAdaptable emptyCategory : emptyCategories) {
+ BreakpointContainer container = categoriesToContainers.get(emptyCategory);
if (container == null) {
- container = new BreakpointContainer(category, organizer, null);
- categoriesToContainers.put(category, container);
+ container = new BreakpointContainer(emptyCategory, organizer, null);
+ categoriesToContainers.put(emptyCategory, container);
}
}
}
@@ -234,10 +231,9 @@ public class BreakpointsContentProvider implements ITreeContentProvider, IProper
}
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];
+ for (Object element : fElements) {
+ BreakpointContainer container = (BreakpointContainer)element;
+ for (IAdaptable category : categories) {
if (container.getCategory().equals(category)) {
containers[index] = container;
index++;
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 fa3719e8e..c767ac88b 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
@@ -1,5 +1,5 @@
/*****************************************************************
- * Copyright (c) 2009, 2018 Texas Instruments and others
+ * Copyright (c) 2009, 2021 Texas Instruments and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -196,8 +196,11 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
menu.add(getAction(ACTION_GOTO_MARKER));
menu.add(new Separator(IDebugUIConstants.EMPTY_BREAKPOINT_GROUP));
menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
- menu.add(getAction(PASTE_ACTION));
- IAction action = getAction(ACTION_REMOVE_FROM_GROUP);
+ IAction action = getAction(PASTE_ACTION);
+ if (action != null) {
+ menu.add(action);
+ }
+ action = getAction(ACTION_REMOVE_FROM_GROUP);
if (action != null && action.isEnabled()) {
menu.add(action);
}
@@ -351,19 +354,18 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
} else {
String value = node.getString(KEY_VALUE);
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]);
+ List<IBreakpointOrganizer> organizers = new ArrayList<>();
+ for (String id : value.split(",")) { //$NON-NLS-1$
+ IBreakpointOrganizer organizer = manager.getOrganizer(id);
if (organizer != null) {
- organziers.add(organizer);
+ organizers.add(organizer);
}
}
- fOrganizers = organziers.toArray(new IBreakpointOrganizer[organziers.size()]);
+ fOrganizers = organizers.toArray(new IBreakpointOrganizer[organizers.size()]);
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].addPropertyChangeListener(this);
+ for (IBreakpointOrganizer organizer : fOrganizers) {
+ organizer.addPropertyChangeListener(this);
}
}
}
@@ -452,7 +454,6 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
// update the presentation context organizer
viewer.getPresentationContext().setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS, fOrganizers);
}
- System.out.println();
}
/**
@@ -567,9 +568,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
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);
+ for (Object object : (IStructuredSelection) selection) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(object, IBreakpoint.class);
if (breakpoint != null) {
container.getOrganizer().addBreakpoint(breakpoint, container.getCategory());
}
@@ -680,8 +680,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
if (items.length == 0) {
return false;
}
- for (int i = 0; i < items.length; i++) {
- if (getRemovableContainer(items[i]) == null) {
+ for (TreePath item : items) {
+ if (getRemovableContainer(item) == null) {
return false;
}
}
@@ -698,10 +698,10 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
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);
+ for (TreePath path : paths) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
if (breakpoint != null) {
- IBreakpointContainer container = getRemovableContainer(paths[i]);
+ IBreakpointContainer container = getRemovableContainer(path);
if(container != null) {
List<IBreakpoint> list = containersToBreakpoints.get(container);
if (list == null) {
@@ -721,8 +721,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
extension.removeBreakpoints(breakpoints, container.getCategory());
} else {
- for (int i = 0; i < breakpoints.length; i++) {
- organizer.removeBreakpoint(breakpoints[i], container.getCategory());
+ for (IBreakpoint breakpoint : breakpoints) {
+ organizer.removeBreakpoint(breakpoint, container.getCategory());
}
}
}
@@ -758,8 +758,8 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager
breakpoints.toArray(new IBreakpoint[breakpoints.size()]),
container.getCategory());
} else {
- for (int i = 0; i < breakpoints.size(); i++) {
- organizer.addBreakpoint(breakpoints.get(i), container.getCategory());
+ for (IBreakpoint breakpoint : breakpoints) {
+ organizer.addBreakpoint(breakpoint, container.getCategory());
}
}
// TODO expandToLevel(target.getData(), ALL_LEVELS);
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 437bfd1dd..bf2e968df 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
@@ -87,10 +87,9 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
*/
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]);
+ for (Object element : ((ITreeContentProvider)getContentProvider()).getElements(manager)) {
+ TreeItem item = (TreeItem) searchItem(element);
if (item != null) {
collectExpandedBreakpoints(item, list);
}
@@ -112,9 +111,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
return;
}
if (item.getExpanded()) {
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- collectExpandedBreakpoints(items[i], list);
+ for (TreeItem childItem : item.getItems()) {
+ collectExpandedBreakpoints(childItem, list);
}
}
}
@@ -199,8 +197,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
if(items.length == 0) {
return false;
}
- for(int i = 0; i < items.length; i++) {
- if(getRemovableContainer(items[i]) == null) {
+ for (Item item : items) {
+ if(getRemovableContainer(item) == null) {
return false;
}
}
@@ -219,10 +217,10 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
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]);
+ for (Item item : items) {
+ if(!item.isDisposed()) {
+ breakpoint = (IBreakpoint)item.getData();
+ container = getRemovableContainer(item);
if(container != null) {
List<IBreakpoint> list = containersToBreakpoints.get(container);
if (list == null) {
@@ -242,8 +240,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
extension.removeBreakpoints(breakpoints, container.getCategory());
} else {
- for (int i = 0; i < breakpoints.length; i++) {
- organizer.removeBreakpoint(breakpoints[i], container.getCategory());
+ for (IBreakpoint bp : breakpoints) {
+ organizer.removeBreakpoint(bp, container.getCategory());
}
}
}
@@ -348,9 +346,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* Sets the initial checked state of the items in the viewer.
*/
private void initializeCheckedState() {
- TreeItem[] items = getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- updateCheckedState(items[i]);
+ for (TreeItem item : getTree().getItems()) {
+ updateCheckedState(item);
}
}
@@ -360,9 +357,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* @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];
+ for (Widget widget : searchItems(element)) {
if (widget != null) {
updateCheckedState((TreeItem)widget);
}
@@ -376,9 +371,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
*/
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);
+ for (TreeItem item : getTree().getItems()) {
+ findAllOccurrences(item, element, list);
}
return list.toArray(new Widget[0]);
}
@@ -393,9 +387,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
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);
+ for (TreeItem childItem : item.getItems()) {
+ findAllOccurrences(childItem, element, list);
}
}
@@ -416,8 +409,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
} 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];
+ for (IBreakpoint breakpoint : breakpoints) {
try {
if (breakpoint.isEnabled()) {
enabledChildren++;
@@ -440,9 +432,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
item.setChecked(true);
}
// Update any children (breakpoints and containers)
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- updateCheckedState(items[i]);
+ for (TreeItem childItem : item.getItems()) {
+ updateCheckedState(childItem);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java
new file mode 100644
index 000000000..1a1b87589
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.views.breakpoints;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.ui.ide.undo.DeleteMarkersOperation;
+
+/**
+ * Extension of the default undoable delete marker operation to additional
+ * update the 'breakpointIsDeleted' attribute.
+ */
+public class DeleteBreakpointMarkersOperation extends DeleteMarkersOperation {
+
+ /**
+ * Create an undoable operation that can delete the specified markers.
+ *
+ * @param markers the markers to be deleted
+ * @param name the name used to describe the operation that deletes the
+ * markers
+ */
+ public DeleteBreakpointMarkersOperation(IMarker[] markers, String name) {
+ super(markers, name);
+ }
+
+ @Override
+ protected void doExecute(IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws CoreException {
+ IMarker[] markers = getMarkers();
+ if (markers != null) {
+ for (IMarker marker : markers) {
+ marker.setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, true);
+ }
+ }
+
+ super.doExecute(monitor, info);
+ }
+
+ // Note: do not update 'breakpointIsDeleted' on doUndo (i.e. don't set
+ // breakpointIsDeleted=false on undo). It is important that the recreated
+ // breakpoint has breakpointIsDeleted=true to recognize the recreation in later
+ // code.
+}
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 2dec7323c..c095aa0ee 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
@@ -56,15 +56,13 @@ public class WorkingSetBreakpointOrganizer extends AbstractBreakpointOrganizerDe
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);
+ for (IWorkingSet workingSet : fWorkingSetManager.getWorkingSets()) {
+ if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(workingSet.getId())) {
+ for (IAdaptable element : workingSet.getElements()) {
+ IResource resource = element.getAdapter(IResource.class);
if (resource != null) {
if (parents.contains(resource)) {
- result.add(new WorkingSetCategory(workingSets[i]));
+ result.add(new WorkingSetCategory(workingSet));
break;
}
}
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 e9961aab6..57a3276f5 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
@@ -51,10 +51,9 @@ public class ConsoleLineNotifier implements IPatternMatchListener, IPropertyChan
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]);
+ for (IConsoleLineTracker lineTracker : DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(fConsole.getProcess())) {
+ lineTracker.init(fConsole);
+ addConsoleListener(lineTracker);
}
fConsole.addPropertyChangeListener(this);
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 b88e18a22..67b75c5d8 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -30,6 +30,10 @@ public class ConsoleMessages extends NLS {
public static String ProcessConsole_2;
public static String ProcessConsole_3;
+ public static String ProcessConsole_commandLabel_withStart;
+ public static String ProcessConsole_commandLabel_withEnd;
+ public static String ProcessConsole_commandLabel_withStartEnd;
+
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties
index d5ad69724..b979431cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2014 IBM Corporation and others.
+# Copyright (c) 2000, 2020 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -25,5 +25,8 @@ ProcessConsole_0=<terminated> {0}
ProcessConsole_1=[Console output redirected to file:{0}]\n
ProcessConsole_2=[Invalid file specified for console output: {0}]\n
ProcessConsole_3=[Invalid file specified for stdin file: {0}]\n
+ProcessConsole_commandLabel_withStart={0} ({1})
+ProcessConsole_commandLabel_withEnd={0} (Terminated {1})
+ProcessConsole_commandLabel_withStartEnd={0} ({1} \u2013 {2})
ShowStandardErrorAction_0=Show Console When Standard Error Changes
ShowStandardOutAction_0=Show Console When Standard Out Changes
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 c0226dcf8..053ac17e4 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
@@ -37,8 +37,7 @@ public class ConsoleRemoveAllTerminatedAction extends Action implements IUpdate,
@Override
public synchronized void update() {
ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
+ for (ILaunch launch : launches) {
if (launch.isTerminated()) {
setEnabled(true);
return;
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 3dd39e4df..abe973266 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
@@ -82,14 +82,10 @@ public class ConsoleTerminateAction extends Action implements IUpdate {
*/
private List<ITerminate> collectTargets(IProcess process) {
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)) {
+ for (ILaunch launch : launchManager.getLaunches()) {
+ for (IProcess proc : launch.getProcesses()) {
+ if (proc.equals(process)) {
IDebugTarget[] debugTargets = launch.getDebugTargets();
Collections.addAll(targets, debugTargets);
return targets; // all possible targets have been terminated for the launch.
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 4c8d38382..2799ab0b5 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,9 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Paul Pazderski - Bug 545769: fixed rare UTF-8 character corruption bug
+ * Paul Pazderski - Bug 552015: console finished signaled to late if input is connected to file
+ * Paul Pazderski - Bug 251642: add termination time in console label
+ * Paul Pazderski - Bug 558463: add handling of raw stream content instead of strings
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.console;
@@ -23,8 +26,16 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.text.ParseException;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
+import java.util.regex.Pattern;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IStorage;
@@ -43,10 +54,13 @@ import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBinaryStreamListener;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IBinaryStreamMonitor;
+import org.eclipse.debug.core.model.IBinaryStreamsProxy;
import org.eclipse.debug.core.model.IFlushableStreamMonitor;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamMonitor;
@@ -88,9 +102,6 @@ import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.progress.UIJob;
-import com.ibm.icu.text.MessageFormat;
-
-
/**
* A console for a system process with standard I/O streams.
*
@@ -104,6 +115,16 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
private IConsoleColorProvider fColorProvider;
+ /**
+ * The input stream which can supply user input in console to the system process
+ * stdin.
+ */
+ private IOConsoleInputStream fUserInput;
+ /**
+ * The stream connected to the system processe's stdin. May be the
+ * <i>fUserInput</i> stream to supply user input or a FileInputStream to supply
+ * input from a file.
+ */
private volatile InputStream fInput;
private FileOutputStream fFileOutputStream;
@@ -111,17 +132,21 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
private boolean fAllocateConsole = true;
private String fStdInFile = null;
- private boolean fStreamsClosed = false;
+ private volatile boolean fStreamsClosed = false;
/**
- * Proxy to a console document
+ * Create process console with default encoding.
+ *
+ * @param process the process to associate with this console
+ * @param colorProvider the colour provider for this console
*/
public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider) {
this(process, colorProvider, null);
}
/**
- * Constructor
+ * Create process console.
+ *
* @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
@@ -129,6 +154,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider, String encoding) {
super(IInternalDebugCoreConstants.EMPTY_STRING, IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE, null, encoding, true);
fProcess = process;
+ fUserInput = getInputStream();
ILaunchConfiguration configuration = process.getLaunch().getLaunchConfiguration();
String file = null;
@@ -285,7 +311,63 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
buffer.append(type);
buffer.append("] "); //$NON-NLS-1$
}
- buffer.append(process.getLabel());
+
+ Date launchTime = parseTimestamp(process.getAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP));
+ Date terminateTime = parseTimestamp(process.getAttribute(DebugPlugin.ATTR_TERMINATE_TIMESTAMP));
+
+ String procLabel = process.getLabel();
+ if (launchTime != null) {
+ // FIXME workaround to remove start time from process label added from jdt for
+ // java launches
+ int idx = procLabel.lastIndexOf('(');
+ if (idx >= 0) {
+ int end = procLabel.lastIndexOf(')');
+ if (end > idx) {
+ String jdtTime = procLabel.substring(idx + 1, end);
+ try {
+ DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).parse(jdtTime);
+ procLabel = procLabel.substring(0, idx);
+ } catch (ParseException pe) {
+ // not a date. Label just contains parentheses
+ }
+ }
+ }
+ }
+
+ DateFormat dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
+ if (launchTime != null && terminateTime != null) {
+ String launchTimeStr = dateTimeFormat.format(launchTime);
+ // Check if process started and terminated at same day. If so only print the
+ // time part of termination time and omit the date part.
+ LocalDateTime launchDate = LocalDateTime.ofInstant(launchTime.toInstant(),
+ ZoneId.systemDefault());
+ LocalDateTime terminateDate = LocalDateTime.ofInstant(terminateTime.toInstant(),
+ ZoneId.systemDefault());
+ LocalDateTime launchDay = launchDate.truncatedTo(ChronoUnit.DAYS);
+ LocalDateTime terminateDay = terminateDate.truncatedTo(ChronoUnit.DAYS);
+ String terminateTimeStr;
+ if (launchDay.equals(terminateDay)) {
+ terminateTimeStr = DateFormat.getTimeInstance(DateFormat.MEDIUM).format(terminateTime);
+ } else {
+ terminateTimeStr = dateTimeFormat.format(terminateTime);
+ }
+
+ buffer.append(MessageFormat.format(ConsoleMessages.ProcessConsole_commandLabel_withStartEnd,
+ procLabel, launchTimeStr, terminateTimeStr));
+ } else if (launchTime != null) {
+ buffer.append(MessageFormat.format(ConsoleMessages.ProcessConsole_commandLabel_withStart,
+ procLabel, dateTimeFormat.format(launchTime)));
+ } else if (terminateTime != null) {
+ buffer.append(MessageFormat.format(ConsoleMessages.ProcessConsole_commandLabel_withEnd,
+ procLabel, dateTimeFormat.format(terminateTime)));
+ }
+
+ String pid = process.getAttribute(IProcess.ATTR_PROCESS_ID);
+ if (pid != null && !pid.isBlank()) {
+ buffer.append(" [pid: "); //$NON-NLS-1$
+ buffer.append(pid);
+ buffer.append("]"); //$NON-NLS-1$
+ }
label = buffer.toString();
}
}
@@ -298,6 +380,26 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
/**
+ * Get Date from (possibly invalid) timestamp.
+ *
+ * @param timestamp a timestamp as returned from
+ * {@link System#currentTimeMillis()} or <code>null</code>
+ * @return Date object for this timestamp or <code>null</code> if timestamp is
+ * invalid
+ */
+ private static Date parseTimestamp(String timestamp) {
+ if (timestamp == null) {
+ return null;
+ }
+ try {
+ long lTimestamp = Long.parseLong(timestamp);
+ return new Date(lTimestamp);
+ } catch (NumberFormatException ex) {
+ return null;
+ }
+ }
+
+ /**
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
@Override
@@ -360,6 +462,10 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
} else if (property.equals(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)) {
setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS)) {
+ setHandleControlCharacters(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS));
+ } else if (property.equals(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER)) {
+ setCarriageReturnAsControlCharacter(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER));
}
}
@@ -421,7 +527,13 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
fInput.close();
} catch (IOException e) {
}
- fStreamsClosed = true;
+ if (fInput != fUserInput) {
+ try {
+ fUserInput.close();
+ } catch (IOException e) {
+ }
+ }
+ fStreamsClosed = true;
}
/**
@@ -434,6 +546,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
fFileOutputStream = null;
fInput = null;
+ fUserInput = null;
}
/**
@@ -462,6 +575,9 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
setWaterMarks(lowWater, highWater);
}
+ setHandleControlCharacters(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS));
+ setCarriageReturnAsControlCharacter(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER));
+
DebugUIPlugin.getStandardDisplay().asyncExec(() -> {
setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
@@ -475,8 +591,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
*/
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getSource().equals(getProcess())) {
if (event.getKind() == DebugEvent.TERMINATE) {
@@ -601,79 +716,109 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
/**
- * This class listens to a specified IO stream
+ * This class listens to a specified stream monitor to get notified on output
+ * from the process connected to console.
+ * <p>
+ * Received output will be redirected to given {@link IOConsoleOutputStream} to
+ * get it shown in console and to {@link #fFileOutputStream} if set.
*/
- private class StreamListener implements IStreamListener {
+ private class StreamListener implements IStreamListener, IBinaryStreamListener {
private IOConsoleOutputStream fStream;
+ /**
+ * The monitors from which this listener class is notified about new content.
+ * Initial and for a long time IO handling in context of Eclipse console was
+ * based on strings and later extended with a variant passing the raw binary
+ * data.
+ * <p>
+ * As a result of this history it is expectable to have a stream monitor passing
+ * the content decoded as string but optional to have access to the
+ * raw/unchanged data.
+ * <p>
+ * Therefore the following two monitor instances either point to the same class
+ * implementing both interfaces or the binary variant is <code>null</code>.
+ */
private IStreamMonitor fStreamMonitor;
+ private IBinaryStreamMonitor fBinaryStreamMonitor;
private String fStreamId;
- private boolean fFlushed = false;
-
- private boolean fListenerRemoved = false;
+ /** Flag to remember if stream was already closed. */
+ private boolean fStreamClosed = false;
public StreamListener(String streamIdentifier, IStreamMonitor monitor, IOConsoleOutputStream stream) {
- this.fStreamId = streamIdentifier;
- this.fStreamMonitor = monitor;
- this.fStream = stream;
+ fStreamId = streamIdentifier;
+ fStreamMonitor = monitor;
+ fStream = stream;
fStreamMonitor.addListener(this);
- //fix to bug 121454. Ensure that output to fast processes is processed.
- streamAppended(null, monitor);
+ if (fStreamMonitor instanceof IBinaryStreamMonitor && fFileOutputStream != null) {
+ fBinaryStreamMonitor = (IBinaryStreamMonitor) monitor;
+ fBinaryStreamMonitor.addBinaryListener(this);
+ }
+ // fix to bug 121454. Ensure that output to fast processes is processed.
+ flushAndDisableBuffer();
}
- @Override
- public void streamAppended(String text, IStreamMonitor monitor) {
- 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) {
- fFileOutputStream.write(text.getBytes());
- } else {
- fFileOutputStream.write(text.getBytes(encoding));
- }
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
+ /**
+ * Process existing content in monitor and flush and disable buffering if it is
+ * a {@link IFlushableStreamMonitor}.
+ *
+ * @param monitor the monitor which might have buffered content
+ */
+ private void flushAndDisableBuffer() {
+ byte[] data = null;
+ String contents;
+ synchronized (fStreamMonitor) {
+ if (fBinaryStreamMonitor != null) {
+ data = fBinaryStreamMonitor.getData();
}
- } else {
- String contents = null;
- synchronized (fStreamMonitor) {
- fFlushed = true;
- contents = fStreamMonitor.getContents();
- if (fStreamMonitor instanceof IFlushableStreamMonitor) {
- IFlushableStreamMonitor m = (IFlushableStreamMonitor) fStreamMonitor;
- m.flushContents();
- m.setBuffered(false);
+ contents = fStreamMonitor.getContents();
+ if (fStreamMonitor instanceof IFlushableStreamMonitor) {
+ IFlushableStreamMonitor m = (IFlushableStreamMonitor) fStreamMonitor;
+ m.flushContents();
+ m.setBuffered(false);
+ }
+ }
+ if (data != null) {
+ streamAppended(data, fBinaryStreamMonitor);
+ }
+ streamAppended(contents, fStreamMonitor);
+ }
+
+ @Override
+ public void streamAppended(byte[] data, IBinaryStreamMonitor monitor) {
+ if (fFileOutputStream != null) {
+ synchronized (fFileOutputStream) {
+ try {
+ fFileOutputStream.write(data);
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
}
}
+ }
+ }
+
+ @Override
+ public void streamAppended(String text, IStreamMonitor monitor) {
+ if (text == null || text.length() == 0) {
+ return;
+ }
+ if (fStream != null) {
try {
- if (contents != null && contents.length() > 0) {
- if (fStream != null) {
- fStream.write(contents);
- }
- if (fFileOutputStream != null) {
- synchronized (fFileOutputStream) {
- fFileOutputStream.write(contents.getBytes());
- }
- }
- }
+ fStream.write(text);
} catch (IOException e) {
DebugUIPlugin.log(e);
}
}
+ // If the monitor does not provide the raw data API and we need to redirect to
+ // a file the second best (and in the past only) option is to write the encoded
+ // text to file.
+ if (fBinaryStreamMonitor == null && fFileOutputStream != null) {
+ Charset charset = getCharset();
+ byte[] data = charset == null ? text.getBytes() : text.getBytes(charset);
+ streamAppended(data, null);
+ }
}
public void closeStream() {
@@ -682,22 +827,23 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
synchronized (fStreamMonitor) {
fStreamMonitor.removeListener(this);
- if (!fFlushed) {
- String contents = fStreamMonitor.getContents();
- streamAppended(contents, fStreamMonitor);
+ if (fBinaryStreamMonitor != null) {
+ fBinaryStreamMonitor.removeBinaryListener(this);
}
- fListenerRemoved = true;
+ fStreamClosed = true;
+
try {
if (fStream != null) {
fStream.close();
}
} catch (IOException e) {
+ DebugUIPlugin.log(e);
}
}
}
public void dispose() {
- if (!fListenerRemoved) {
+ if (!fStreamClosed) {
closeStream();
}
fStream = null;
@@ -743,34 +889,59 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
@Override
protected IStatus run(IProgressMonitor monitor) {
- if (fInput == null) {
+ if (fInput == null || fStreamsClosed) {
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
}
- Charset encoding = getCharset();
- readingStream = fInput;
- InputStreamReader streamReader = (encoding == null ? new InputStreamReader(readingStream)
- : new InputStreamReader(readingStream, encoding));
- try {
- char[] cbuf = new char[1024];
- int charRead = 0;
- while (charRead >= 0 && !monitor.isCanceled()) {
- if (fInput == null) {
- break;
- }
- if (fInput != readingStream) {
- readingStream = fInput;
- streamReader = (encoding == null ? new InputStreamReader(readingStream)
- : new InputStreamReader(readingStream, encoding));
+ if (streamsProxy instanceof IBinaryStreamsProxy) {
+ // Pass data without processing. The preferred variant. There is no need for
+ // this job to know about encodings.
+ try {
+ byte[] buffer = new byte[1024];
+ int bytesRead = 0;
+ while (bytesRead >= 0 && !monitor.isCanceled()) {
+ if (fInput == null || fStreamsClosed) {
+ break;
+ }
+ if (fInput != readingStream) {
+ readingStream = fInput;
+ }
+ bytesRead = readingStream.read(buffer);
+ if (bytesRead > 0) {
+ ((IBinaryStreamsProxy) streamsProxy).write(buffer, 0, bytesRead);
+ }
}
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
+ } else {
+ // Decode data to strings. The legacy variant used if the proxy does not
+ // implement the binary API.
+ Charset encoding = getCharset();
+ readingStream = fInput;
+ InputStreamReader streamReader = (encoding == null ? new InputStreamReader(readingStream)
+ : new InputStreamReader(readingStream, encoding));
+ try {
+ char[] cbuf = new char[1024];
+ int charRead = 0;
+ while (charRead >= 0 && !monitor.isCanceled()) {
+ if (fInput == null || fStreamsClosed) {
+ break;
+ }
+ if (fInput != readingStream) {
+ readingStream = fInput;
+ streamReader = (encoding == null ? new InputStreamReader(readingStream)
+ : new InputStreamReader(readingStream, encoding));
+ }
- charRead = streamReader.read(cbuf);
- if (charRead > 0) {
- String s = new String(cbuf, 0, charRead);
- streamsProxy.write(s);
+ charRead = streamReader.read(cbuf);
+ if (charRead > 0) {
+ String s = new String(cbuf, 0, charRead);
+ streamsProxy.write(s);
+ }
}
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
}
- } catch (IOException e) {
- DebugUIPlugin.log(e);
}
readingStream = null;
return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
@@ -789,22 +960,12 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
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();
+ fFilePath = filePath;
}
@Override
public String getPattern() {
- return fFilePath;
+ return Pattern.quote(fFilePath);
}
@Override
@@ -835,7 +996,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
}
- private class ConsoleLogFileHyperlink implements IHyperlink {
+ private static class ConsoleLogFileHyperlink implements IHyperlink {
String fFilePath;
ConsoleLogFileHyperlink(String filePath) {
fFilePath = filePath;
@@ -870,7 +1031,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe
}
}
- class StorageEditorInput extends PlatformObject implements IStorageEditorInput {
+ static class StorageEditorInput extends PlatformObject implements IStorageEditorInput {
private File fFile;
private IStorage fStorage;
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 3fb4622e7..1ecd915f2 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
@@ -14,6 +14,7 @@
package org.eclipse.debug.internal.ui.views.console;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -42,8 +43,6 @@ import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Creates documents for processes as they are registered with a launch.
* The singleton manager is accessible from the debug UI plugin.
@@ -139,10 +138,8 @@ public class ProcessConsoleManager implements ILaunchListener {
}
protected void removeLaunch(ILaunch launch) {
- IProcess[] processes= launch.getProcesses();
- for (int i= 0; i < processes.length; i++) {
- IProcess iProcess = processes[i];
- removeProcess(iProcess);
+ for (IProcess process : launch.getProcesses()) {
+ removeProcess(process);
}
if (fProcesses != null) {
fProcesses.remove(launch);
@@ -171,9 +168,7 @@ public class ProcessConsoleManager implements ILaunchListener {
*/
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];
+ for (IConsole console : manager.getConsoles()) {
if (console instanceof ProcessConsole) {
ProcessConsole pc = (ProcessConsole)console;
if (pc.getProcess().equals(process)) {
@@ -236,9 +231,8 @@ public class ProcessConsoleManager implements ILaunchListener {
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]);
+ for (ILaunch launch : launchManager.getLaunches()) {
+ launchAdded(launch);
}
}
@@ -250,9 +244,7 @@ public class ProcessConsoleManager implements ILaunchListener {
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];
+ for (ILaunch launch : launchManager.getLaunches()) {
removeLaunch(launch);
}
launchManager.removeLaunchListener(this);
@@ -272,9 +264,7 @@ public class ProcessConsoleManager implements ILaunchListener {
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];
+ for (IConfigurationElement extension : extensionPoint.getConfigurationElements()) {
fColorProviders.put(extension.getAttribute("processType"), extension); //$NON-NLS-1$
}
}
@@ -311,9 +301,7 @@ public class ProcessConsoleManager implements ILaunchListener {
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);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement extension = elements[i];
+ for (IConfigurationElement extension : extensionPoint.getConfigurationElements()) {
String processType = extension.getAttribute("processType"); //$NON-NLS-1$
List<IConfigurationElement> list = fLineTrackers.get(processType);
if (list == null) {
@@ -359,8 +347,7 @@ public class ProcessConsoleManager implements ILaunchListener {
IProcess[] old = fProcesses.get(launch);
IProcess[] curr = launch.getProcesses();
if (old != null) {
- for (int i = 0; i < old.length; i++) {
- IProcess process = old[i];
+ for (IProcess process : old) {
if (!contains(curr, process)) {
if (removed == null) {
removed = new ArrayList<>();
@@ -382,8 +369,7 @@ public class ProcessConsoleManager implements ILaunchListener {
* @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];
+ for (Object object2 : list) {
if (object2.equals(object)) {
return true;
}
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 d524b0381..968aa0271 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -40,6 +40,7 @@ import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsolePageParticipant;
import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.actions.ClearOutputAction;
import org.eclipse.ui.contexts.IContextActivation;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.handlers.IHandlerActivation;
@@ -70,10 +71,13 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
private IConsoleView fView;
+ private static final String fContextId = "org.eclipse.debug.ui.console"; //$NON-NLS-1$;
private EOFHandler fEOFHandler;
- private String fContextId = "org.eclipse.debug.ui.console"; //$NON-NLS-1$;
+ private ClearConsoleHandler fClearConsoleHandler;
+ private ClearOutputAction fClearConsoleAction;
private IContextActivation fActivatedContext;
- private IHandlerActivation fActivatedHandler;
+ private IHandlerActivation fEOFActivatedHandler;
+ private IHandlerActivation fClearConsoleActivatedHandler;
/**
* Handler to send EOF
*/
@@ -90,7 +94,19 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
}
return null;
}
+ }
+ /**
+ * Handler to send clear console
+ */
+ private class ClearConsoleHandler extends AbstractHandler {
+ @Override
+ public Object execute(ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
+ if (fClearConsoleAction != null) {
+ fClearConsoleAction.run();
+ }
+ return null;
+ }
}
@Override
@@ -113,8 +129,10 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
IActionBars actionBars = fPage.getSite().getActionBars();
configureToolBar(actionBars.getToolBarManager());
- // create handler and submissions for EOF
+ // create handler for EOF and clear
fEOFHandler = new EOFHandler();
+ fClearConsoleHandler = new ClearConsoleHandler();
+ fClearConsoleAction = new ClearOutputAction(fConsole);
}
@Override
@@ -204,8 +222,7 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
+ for (DebugEvent event : events) {
if (event.getSource().equals(getProcess())) {
Runnable r = () -> {
if (fTerminate != null) {
@@ -224,26 +241,31 @@ public class ProcessConsolePageParticipant implements IConsolePageParticipant, I
@Override
public void activated() {
- // add EOF submissions
+ // add EOF and clear submissions
IPageSite site = fPage.getSite();
- if(fActivatedContext == null && fActivatedHandler == null) {
+ if (fActivatedContext == 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$
+ fEOFActivatedHandler = handlerService.activateHandler("org.eclipse.debug.ui.commands.eof", fEOFHandler); //$NON-NLS-1$
+ fClearConsoleActivatedHandler = handlerService
+ .activateHandler("org.eclipse.debug.ui.commands.console.clear", fClearConsoleHandler); //$NON-NLS-1$
}
}
@Override
public void deactivated() {
- // remove EOF submissions
+ // remove EOF and clear submissions
IPageSite site = fPage.getSite();
IHandlerService handlerService = site.getService(IHandlerService.class);
IContextService contextService = site.getService(IContextService.class);
- handlerService.deactivateHandler(fActivatedHandler);
+ handlerService.deactivateHandler(fClearConsoleActivatedHandler);
+ handlerService.deactivateHandler(fEOFActivatedHandler);
contextService.deactivateContext(fActivatedContext);
fActivatedContext = null;
- fActivatedHandler = null;
+ fEOFActivatedHandler = null;
+ fClearConsoleActivatedHandler = null;
+ fClearConsoleAction = null;
}
@Override
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 870b46430..af04b5154 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
@@ -85,26 +85,26 @@ public class ExpressionDropAdapter extends ViewerDropAdapter {
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])) {
+ for (TransferData dataType : event.dataTypes) {
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(dataType)) {
if (isExpressionDrop()){
- event.currentDataType = event.dataTypes[i];
+ event.currentDataType = dataType;
event.detail = DND.DROP_MOVE;
fDropType = DROP_TYPE_EXPRESSION;
break;
} else if (isVariableDrop()){
- event.currentDataType = event.dataTypes[i];
+ event.currentDataType = dataType;
event.detail = DND.DROP_COPY;
fDropType = DROP_TYPE_VARIABLE;
break;
} else if (isWatchAdaptableElementDrop()){
- event.currentDataType = event.dataTypes[i];
+ event.currentDataType = dataType;
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];
+ } else if (TextTransfer.getInstance().isSupportedType(dataType)) {
+ event.currentDataType = dataType;
event.detail = DND.DROP_COPY;
fDropType = DROP_TYPE_DEFAULT;
break;
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 562370436..70cadd9ad 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -190,11 +190,8 @@ public class ExpressionView extends VariablesView {
* @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;
+ // Checking the content of Clipboard can freeze the UI Bug 562608
+ return true;
}
/**
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 c94d5ada4..e7fdedc7e 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -24,7 +24,6 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -88,7 +87,6 @@ import org.eclipse.debug.ui.contexts.IDebugContextProvider;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
@@ -165,7 +163,7 @@ public class LaunchView extends AbstractDebugView
public static final String TERMINATE_AND_REMOVE = "terminate_and_remove"; //$NON-NLS-1$
- private static final String TERMINATE_ALL = "terminate_all"; //$NON-NLS-1$
+ public static final String TERMINATE_ALL = "terminate_all"; //$NON-NLS-1$
public static final String TERMINATE_AND_RELAUNCH = "terminate_relaunch"; //$NON-NLS-1$
@@ -385,10 +383,9 @@ public class LaunchView extends AbstractDebugView
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()) {
+ for (TreePath path : ss.getPaths()) {
+ if (path.startsWith(element, null)) {
+ if (path.getSegmentCount() == element.getSegmentCount()) {
event = new DebugContextEvent(this, fContext, type);
} else {
// if parent of the currently selected element
@@ -471,12 +468,7 @@ public class LaunchView extends AbstractDebugView
*/
private PageRec fDefaultPageRec = null;
- private ISelectionChangedListener fTreeViewerSelectionChangedListener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- fTreeViewerDebugContextProvider.activate(event.getSelection());
- }
- };
+ private ISelectionChangedListener fTreeViewerSelectionChangedListener = event -> fTreeViewerDebugContextProvider.activate(event.getSelection());
private class ContextProviderProxy extends AbstractDebugContextProvider implements IDebugContextListener {
private IDebugContextProvider fActiveProvider;
@@ -486,8 +478,8 @@ public class LaunchView extends AbstractDebugView
super(LaunchView.this);
fProviders = providers;
fActiveProvider = providers[0];
- for (int i = 0; i < fProviders.length; i++) {
- fProviders[i].addDebugContextListener(this);
+ for (IDebugContextProvider provider : fProviders) {
+ provider.addDebugContextListener(this);
}
}
@@ -519,8 +511,8 @@ public class LaunchView extends AbstractDebugView
}
void dispose() {
- for (int i = 0; i < fProviders.length; i++) {
- fProviders[i].removeDebugContextListener(this);
+ for (IDebugContextProvider provider : fProviders) {
+ provider.removeDebugContextListener(this);
}
fProviders = null;
fActiveProvider = null;
@@ -558,7 +550,9 @@ public class LaunchView extends AbstractDebugView
addCapabilityAction(action, TERMINATE_AND_RELAUNCH);
setHandler(TERMINATE_AND_RELAUNCH, new ActionHandler(action));
addCapabilityAction(new RestartCommandAction(), RESTART);
- addCapabilityAction(new TerminateAllAction(), TERMINATE_ALL);
+ action = new TerminateAllAction();
+ addCapabilityAction(action, TERMINATE_ALL);
+ setHandler(TERMINATE_ALL, new ActionHandler(action));
addCapabilityAction(new ToggleStepFiltersAction(), TOGGLE_STEP_FILTERS);
}
@@ -637,8 +631,8 @@ public class LaunchView extends AbstractDebugView
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));
+ for (DebugViewModeAction action : fDebugViewModeActions) {
+ action.setChecked(action.getMode().equals(mode));
}
createDebugToolBarInViewActions(parent);
@@ -752,15 +746,12 @@ public class LaunchView extends AbstractDebugView
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);
- }
+ modeSubmenu.addMenuListener(manager -> {
+ modeSubmenu.add(fDebugViewModeActions[0]);
+ modeSubmenu.add(fDebugViewModeActions[1]);
+ modeSubmenu.add(fDebugViewModeActions[2]);
+ modeSubmenu.add(new Separator());
+ modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
});
}
@@ -958,8 +949,8 @@ public class LaunchView extends AbstractDebugView
}
StringBuilder buffer= new StringBuilder();
- for (Iterator<String> itr = fDebugToolbarPerspectives.iterator(); itr.hasNext();) {
- buffer.append(itr.next()).append(',');
+ for (String perspectiveId : fDebugToolbarPerspectives) {
+ buffer.append(perspectiveId).append(',');
}
getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_TOOLBAR_HIDDEN_PERSPECTIVES, buffer.toString());
@@ -1058,7 +1049,13 @@ public class LaunchView extends AbstractDebugView
getViewSite().getActionBars().updateActionBars();
// Update system property used by contributed actions.
- System.setProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE, Boolean.toString(show));
+ if (!Boolean.toString(show).equals(System.getProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE))) {
+ try {
+ System.setProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE, Boolean.toString(show));
+ } catch (SecurityException ex) {
+ // ignore
+ }
+ }
}
@Override
@@ -1376,8 +1373,15 @@ public class LaunchView extends AbstractDebugView
public void partActivated(IWorkbenchPartReference partRef) {
// Ensure that the system property matches the debug toolbar state.
// Bug 385400
- System.setProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE,
- Boolean.toString(isDebugToolbarShownInPerspective(getSite().getPage().getPerspective())) );
+ String debugToolBarShown = Boolean
+ .toString(isDebugToolbarShownInPerspective(getSite().getPage().getPerspective()));
+ if (!(debugToolBarShown.equals(System.getProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE)))) {
+ try {
+ System.setProperty(IDebugUIConstants.DEBUG_VIEW_TOOBAR_VISIBLE, debugToolBarShown);
+ } catch (SecurityException ex) {
+ // ignore
+ }
+ }
}
@Override
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 ccb12f2c1..9df8a069e 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
@@ -35,8 +35,6 @@ import org.eclipse.debug.ui.contexts.AbstractDebugContextProvider;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextProvider;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.BaseLabelProvider;
@@ -53,8 +51,6 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerLabel;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
@@ -282,12 +278,7 @@ public class LaunchViewBreadcrumb extends AbstractBreadcrumb implements IDebugCo
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);
- }
- });
+ menuMgr.addMenuListener(mgr -> fView.fillContextMenu(mgr));
final Menu menu= menuMgr.createContextMenu(fViewer.getControl());
// register the context menu such that other plug-ins may contribute to it
@@ -296,15 +287,12 @@ public class LaunchViewBreadcrumb extends AbstractBreadcrumb implements IDebugCo
}
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.getDisplay().sleep();
- }
+ fViewer.addMenuDetectListener(event -> {
+ menu.setLocation(event.x + 10, event.y + 10);
+ menu.setVisible(true);
+ while (!menu.isDisposed() && menu.isVisible()) {
+ if (!menu.getDisplay().readAndDispatch()) {
+ menu.getDisplay().sleep();
}
}
});
@@ -529,14 +517,11 @@ public class LaunchViewBreadcrumb extends AbstractBreadcrumb implements IDebugCo
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;
+ rootDelta.accept((paramDelta, 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
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 6edd222ea..ff175503e 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
@@ -87,10 +87,10 @@ public class LaunchViewCopyToClipboardActionDelegate extends VirtualCopyToClipbo
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());
+ for (TreeItem item : items) {
+ set.add(item);
+ if (item.getExpanded()) {
+ collectChildItems(set, item.getItems());
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java
index 56ef26f65..84f0f3068 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.internal.ui.views.launch;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IStackFrame;
@@ -24,8 +26,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Editor input for a stack frame for which source could not be located.
*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
index 37a6b44db..37033eabb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
@@ -261,9 +261,9 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- Object source = events[i].getSource();
- if (events[i].getKind() == DebugEvent.TERMINATE && source instanceof IMemoryBlockRetrieval) {
+ for (DebugEvent event : events) {
+ Object source = event.getSource();
+ if (event.getKind() == DebugEvent.TERMINATE && source instanceof IMemoryBlockRetrieval) {
if (isDisposed()) {
return;
}
@@ -333,8 +333,8 @@ public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, IS
// if tab folder is not empty, dipose view tabs
CTabItem[] tabs = tabFolder.getItems();
- for (int i = 0; i < tabs.length; i++) {
- disposeTab(tabs[i]);
+ for (CTabItem tab : tabs) {
+ disposeTab(tab);
}
tabFolder.dispose();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
index 61f3c5c54..844f628e3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
@@ -184,8 +184,8 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
* @return if we should exit
*/
private boolean addMemoryBlocks(boolean exit, Object elem, IMemoryBlockRetrieval standardMemRetrieval, MonitorMemoryBlockDialog dialog, final String[] expressionsArray) {
- for (int i = 0; i < expressionsArray.length; i++) {
- String expression = expressionsArray[i].trim();
+ for (String e : expressionsArray) {
+ String expression = e.trim();
try {
if (standardMemRetrieval instanceof IMemoryBlockRetrievalExtension) {
// if the debug session supports
@@ -276,8 +276,8 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- handleDebugEvent(events[i]);
+ for (DebugEvent event : events) {
+ handleDebugEvent(event);
}
}
@@ -344,18 +344,18 @@ public class AddMemoryBlockAction extends Action implements IDebugContextListene
DebugUIPlugin.log(e1);
}
- for (int i = 0; i < renderingTypes.length; i++) {
+ for (IMemoryRenderingType renderingType : renderingTypes) {
try {
boolean create = true;
if (primaryType != null) {
- if (primaryType.getId().equals(renderingTypes[i].getId())) {
+ if (primaryType.getId().equals(renderingType.getId())) {
create = false;
}
}
if (create) {
- createRenderingInContainer(memoryBlock, renderingTypes[i], IDebugUIConstants.ID_RENDERING_VIEW_PANE_2);
+ createRenderingInContainer(memoryBlock, renderingType, IDebugUIConstants.ID_RENDERING_VIEW_PANE_2);
}
- } catch (CoreException e) {
+ }catch (CoreException e) {
DebugUIPlugin.log(e);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java
index d517e68a9..83d398f54 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java
@@ -56,9 +56,9 @@ public class AddMemoryRenderingContextAction implements IViewActionDelegate {
String actionId = action.getId();
IMemoryRenderingContainer selectedPane = null;
- for (int i = 0; i < viewPanes.length; i++) {
- if (actionId.contains(viewPanes[i].getId())) {
- selectedPane = viewPanes[i];
+ for (IMemoryRenderingContainer viewPane : viewPanes) {
+ if (actionId.contains(viewPane.getId())) {
+ selectedPane = viewPane;
break;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
index add3e0eb9..f7d159b83 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
@@ -36,8 +36,6 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -47,7 +45,6 @@ import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -102,24 +99,20 @@ public class AddMemoryRenderingDialog extends SelectionDialog {
}
};
- private IMemoryRenderingBindingsListener fBindingListener = new IMemoryRenderingBindingsListener() {
- @Override
- public void memoryRenderingBindingsChanged() {
- UIJob job = new UIJob("refresh") { //$NON-NLS-1$
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- fViewer.refresh();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.schedule();
- }
+ private IMemoryRenderingBindingsListener fBindingListener = () -> {
+ UIJob job = new UIJob("refresh") { //$NON-NLS-1$
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ fViewer.refresh();
+ return Status.OK_STATUS;
+ }
+ };
+ job.setSystem(true);
+ job.schedule();
};
- class MemoryRenderingLabelProvider implements ILabelProvider {
+ static class MemoryRenderingLabelProvider implements ILabelProvider {
@Override
public Image getImage(Object element) {
@@ -154,7 +147,7 @@ public class AddMemoryRenderingDialog extends SelectionDialog {
}
- class MemoryRenderingContentProvider implements IStructuredContentProvider {
+ static class MemoryRenderingContentProvider implements IStructuredContentProvider {
@Override
public Object[] getElements(Object inputElement) {
@@ -319,13 +312,7 @@ public class AddMemoryRenderingDialog extends SelectionDialog {
listLayout.heightHint = 140;
fViewer.getControl().setLayoutData(listLayout);
- fViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
+ fViewer.addDoubleClickListener(event -> okPressed());
IMemoryBlock currentBlock = getMemoryBlockToSelect(null);
if (currentBlock == null) {
@@ -334,17 +321,13 @@ public class AddMemoryRenderingDialog extends SelectionDialog {
populateDialog(currentBlock);
}
- fSelectionChangedListener = new ISelectionChangedListener() {
+ fSelectionChangedListener = event -> {
+ ISelection selection = fViewer.getSelection();
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = fViewer.getSelection();
-
- if (selection.isEmpty()) {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- } else {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
+ if (selection.isEmpty()) {
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ } else {
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
}
};
@@ -367,8 +350,8 @@ public class AddMemoryRenderingDialog extends SelectionDialog {
// clean up
combo.removeAll();
- for (int i = 0; i < labels.length; i++) {
- combo.add(labels[i]);
+ for (String label : labels) {
+ combo.add(label);
}
combo.select(selectionIdx);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
index e5478da29..18a72a1b2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
@@ -45,8 +45,6 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -110,9 +108,9 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
if (selected != null && selected instanceof IStructuredSelection) {
Object[] selectedMemBlks = ((IStructuredSelection) selected).toArray();
ArrayList<Object> memoryBlocks = new ArrayList<>();
- for (int i = 0; i < selectedMemBlks.length; i++) {
- if (selectedMemBlks[i] instanceof IMemoryBlock) {
- memoryBlocks.add(selectedMemBlks[i]);
+ for (Object selectedMemBlk : selectedMemBlks) {
+ if (selectedMemBlk instanceof IMemoryBlock) {
+ memoryBlocks.add(selectedMemBlk);
}
}
@@ -224,8 +222,8 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- doHandleDebugEvent(events[i]);
+ for (DebugEvent event : events) {
+ doHandleDebugEvent(event);
}
}
}
@@ -295,13 +293,9 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
fDebugContextListener = new TreeViewPaneContextListener();
DebugUITools.addPartDebugContextListener(fParent.getSite(), fDebugContextListener);
- fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection treeSelected = event.getSelection();
- fSelectionProvider.setSelection(treeSelected);
- }
+ fTreeViewer.addSelectionChangedListener(event -> {
+ ISelection treeSelected = event.getSelection();
+ fSelectionProvider.setSelection(treeSelected);
});
updateRetrieval();
@@ -336,13 +330,10 @@ public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionC
protected MenuManager createContextMenuManager() {
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- manager.add(fAddMemoryBlockAction);
- manager.add(fRemoveMemoryBlockAction);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
+ menuMgr.addMenuListener(manager -> {
+ manager.add(fAddMemoryBlockAction);
+ manager.add(fRemoveMemoryBlockAction);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
});
// register a context menu manager, use its pane id as the menu id
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
index 71b707408..f0c7f7475 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
@@ -124,7 +124,7 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
private String fActivePaneId;
- class MemoryViewSelectionProvider implements ISelectionProvider, ISelectionChangedListener {
+ static class MemoryViewSelectionProvider implements ISelectionProvider, ISelectionChangedListener {
ArrayList<ISelectionChangedListener> fListeners = new ArrayList<>();
IStructuredSelection fSelections = new StructuredSelection();
@@ -170,8 +170,8 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
public void fireChanged() {
SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection());
- for (int i = 0; i < fListeners.size(); i++) {
- fListeners.get(i).selectionChanged(evt);
+ for (ISelectionChangedListener listener : fListeners) {
+ listener.selectionChanged(evt);
}
}
@@ -262,9 +262,9 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
// also try to find other views and register
if (DebugUIPlugin.getActiveWorkbenchWindow() != null && DebugUIPlugin.getActiveWorkbenchWindow().getActivePage() != null) {
IViewReference references[] = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().getViewReferences();
- for (int i = 0; i < references.length; i++) {
- if (references[i].getSecondaryId() != null) {
- MemoryViewIdRegistry.registerView(references[i].getSecondaryId());
+ for (IViewReference reference : references) {
+ if (reference.getSecondaryId() != null) {
+ MemoryViewIdRegistry.registerView(reference.getSecondaryId());
}
}
}
@@ -422,8 +422,8 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
ToolBarManager viewerToolBarMgr = new ToolBarManager(SWT.FLAT);
IAction[] actions = fMemBlkViewer.getActions();
- for (int i = 0; i < actions.length; i++) {
- viewerToolBarMgr.add(actions[i]);
+ for (IAction action : actions) {
+ viewerToolBarMgr.add(action);
}
ToolBar viewerToolbar = viewerToolBarMgr.createControl(viewerViewForm);
viewerViewForm.setTopRight(viewerToolbar);
@@ -547,15 +547,15 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
private void setVisible(boolean visible) {
IMemoryViewPane[] viewPanes = getViewPanes();
- for (int i = 0; i < viewPanes.length; i++) {
+ for (IMemoryViewPane viewPane : viewPanes) {
// if currently visible, take view pane's visibility into account
// else force view pane to be visible if it is listed in
// "visible view panes" array list.
if (fVisible) {
- viewPanes[i].setVisible(visible && viewPanes[i].isVisible());
+ viewPane.setVisible(visible && viewPane.isVisible());
} else {
- if (isViewPaneVisible(viewPanes[i].getId())) {
- viewPanes[i].setVisible(visible);
+ if (isViewPaneVisible(viewPane.getId())) {
+ viewPane.setVisible(visible);
}
}
}
@@ -596,8 +596,8 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
*/
private void restoreView() {
IMemoryViewPane[] viewPanes = getViewPanes();
- for (int i = 0; i < viewPanes.length; i++) {
- viewPanes[i].restoreViewPane();
+ for (IMemoryViewPane viewPane : viewPanes) {
+ viewPane.restoreViewPane();
}
}
@@ -613,9 +613,9 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
if (viewPaneControl != null) {
Control children[] = fSashForm.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] == viewPaneControl) {
- children[i].setVisible(show);
+ for (Control child : children) {
+ if (child == viewPaneControl) {
+ child.setVisible(show);
IMemoryViewPane viewPane = fViewPanes.get(paneId);
if (viewPane != null) {
viewPane.setVisible(show);
@@ -673,8 +673,8 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
fVisibleViewPanes.add(paneId);
}
} else {
- for (int i = 0; i < defaultVisiblePaneIds.length; i++) {
- fVisibleViewPanes.add(defaultVisiblePaneIds[i]);
+ for (String defaultVisiblePaneId : defaultVisiblePaneIds) {
+ fVisibleViewPanes.add(defaultVisiblePaneId);
}
}
@@ -699,9 +699,9 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
private void loadOrientation() {
fViewOrientation = Platform.getPreferencesService().getInt(DebugUIPlugin.getUniqueIdentifier(), getOrientationPrefId(), HORIZONTAL_VIEW_ORIENTATION, null);
- for (int i = 0; i < fOrientationActions.length; i++) {
- if (fOrientationActions[i].getOrientation() == fViewOrientation) {
- fOrientationActions[i].run();
+ for (ViewPaneOrientationAction fOrientationAction : fOrientationActions) {
+ if (fOrientationAction.getOrientation() == fViewOrientation) {
+ fOrientationAction.run();
}
}
updateOrientationActions();
@@ -720,13 +720,12 @@ public class MemoryView extends ViewPart implements IMemoryRenderingSite2 {
}
private void updateOrientationActions() {
- for (int i = 0; i < fOrientationActions.length; i++) {
- if (fOrientationActions[i].getOrientation() == fViewOrientation) {
- fOrientationActions[i].setChecked(true);
+ for (ViewPaneOrientationAction fOrientationAction : fOrientationActions) {
+ if (fOrientationAction.getOrientation() == fViewOrientation) {
+ fOrientationAction.setChecked(true);
} else {
- fOrientationActions[i].setChecked(false);
+ fOrientationAction.setChecked(false);
}
-
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java
index a14fcf7d6..9abc831f2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java
@@ -58,7 +58,7 @@ public class MemoryViewSynchronizationService implements IMemoryRenderingSynchro
* Wrapper for ISynchronizedMemoryBlockView Holds a list of property filters
* for the view.
*/
- class PropertyListener {
+ static class PropertyListener {
IPropertyChangeListener fListener;
String[] fFilters;
@@ -81,8 +81,8 @@ public class MemoryViewSynchronizationService implements IMemoryRenderingSynchro
if (fFilters == null) {
return true;
}
- for (int i = 0; i < fFilters.length; i++) {
- if (fFilters[i].equals(property)) {
+ for (String filter : fFilters) {
+ if (filter.equals(property)) {
return true;
}
}
@@ -134,9 +134,7 @@ public class MemoryViewSynchronizationService implements IMemoryRenderingSynchro
return;
}
- for (int i = 0; i < memoryBlocks.length; i++) {
- IMemoryBlock memory = memoryBlocks[i];
-
+ for (IMemoryBlock memory : memoryBlocks) {
if (fLastChangedRendering != null && fLastChangedRendering.getMemoryBlock() == memory) {
fLastChangedRendering = null;
}
@@ -343,9 +341,8 @@ public class MemoryViewSynchronizationService implements IMemoryRenderingSynchro
// synchronization service is being enabled
// this is to get around problem when the last changed
// rendering is not currently the sync info provider
-
- for (int i = 0; i < ids.length; i++) {
- PropertyChangeEvent evt = new PropertyChangeEvent(fLastChangedRendering, ids[i], null, info.getProperty(ids[i]));
+ for (String id : ids) {
+ PropertyChangeEvent evt = new PropertyChangeEvent(fLastChangedRendering, id, null, info.getProperty(id));
firePropertyChanged(evt);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java
index 999904591..134deea5f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java
@@ -26,7 +26,6 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
@@ -72,13 +71,9 @@ public class MemoryViewTab implements IMemoryViewTab, IPropertyChangeListener, L
fTabItem.setText(getLabel());
fTabItem.setImage(getImage());
- fTabItem.addDisposeListener(fDisposeListener = new DisposeListener() {
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- fTabItem.removeDisposeListener(fDisposeListener);
- dispose();
- }
+ fTabItem.addDisposeListener(fDisposeListener = e -> {
+ fTabItem.removeDisposeListener(fDisposeListener);
+ dispose();
});
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeModelContentProvider.java
index 810e8b39e..14a3f0273 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeModelContentProvider.java
@@ -28,8 +28,7 @@ public class MemoryViewTreeModelContentProvider extends TreeModelContentProvider
protected void updateNodes(IModelDelta[] nodes, int mask) {
if (getViewer() instanceof TreeModelViewer) {
- for (int i = 0; i < nodes.length; i++) {
- IModelDelta node = nodes[i];
+ for (IModelDelta node : nodes) {
int flags = node.getFlags();
if ((mask & ITreeModelContentProvider.CONTROL_MODEL_DELTA_FLAGS) != 0 && (flags & IModelDelta.ADDED) != 0 && (flags & IModelDelta.SELECT) != 0 && node.getElement() instanceof IMemoryBlock) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
index 109b3ea0d..8b728ccb9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java
@@ -59,8 +59,9 @@ public class MemoryViewUtil {
*/
static public boolean isValidSelection(ISelection selection) {
- if (!(selection instanceof IStructuredSelection))
+ if (!(selection instanceof IStructuredSelection)) {
return false;
+ }
// only single selection is allowed for this action
if (selection.isEmpty() || ((IStructuredSelection) selection).size() > 1) {
@@ -78,8 +79,9 @@ public class MemoryViewUtil {
*/
public static boolean isValidContext(Object elem) {
// if not debug element
- if (!(elem instanceof IAdaptable))
+ if (!(elem instanceof IAdaptable)) {
return false;
+ }
IMemoryBlockRetrieval memRetrieval = ((IAdaptable) elem).getAdapter(IMemoryBlockRetrieval.class);
@@ -97,8 +99,9 @@ public class MemoryViewUtil {
}
// not valid if the debug target is already terminated
- if (debugTarget != null && (debugTarget.isTerminated() || debugTarget.isDisconnected()))
+ if (debugTarget != null && (debugTarget.isTerminated() || debugTarget.isDisconnected())) {
return false;
+ }
if (memRetrieval != null && memRetrieval.supportsStorageRetrieval()) {
return true;
@@ -121,8 +124,9 @@ public class MemoryViewUtil {
public IStatus runInUIThread(IProgressMonitor monitor) {
// open error for the exception
String detail = IInternalDebugCoreConstants.EMPTY_STRING;
- if (e != null)
+ if (e != null) {
detail = e.getMessage();
+ }
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
@@ -151,25 +155,27 @@ public class MemoryViewUtil {
* @return true if the edit event is valid for activating the cell editor
*/
public static boolean isValidEditEvent(int event) {
- for (int i = 0; i < MemoryViewUtil.ignoreKeyEvents.length; i++) {
- if (event == MemoryViewUtil.ignoreKeyEvents[i])
+ for (int ignoredKeyKevent : MemoryViewUtil.ignoreKeyEvents) {
+ if (event == ignoredKeyKevent) {
return false;
+ }
}
return true;
}
public static BigInteger alignToBoundary(BigInteger integer, int numberOfUnitsPerLine) {
BigInteger[] result = integer.divideAndRemainder(BigInteger.valueOf(numberOfUnitsPerLine));
- integer = integer.subtract(result[1]);
- return integer;
+ return integer.subtract(result[1]);
}
public static void addHistory(String expression) {
- if (!MEMORY_BLOCKS_HISTORY.contains(expression))
+ if (!MEMORY_BLOCKS_HISTORY.contains(expression)) {
MEMORY_BLOCKS_HISTORY.add(0, expression);
+ }
- if (MEMORY_BLOCKS_HISTORY.size() > 5)
+ if (MEMORY_BLOCKS_HISTORY.size() > 5) {
MEMORY_BLOCKS_HISTORY.remove(MEMORY_BLOCKS_HISTORY.size() - 1);
+ }
}
public static String[] getHistory() {
@@ -194,8 +200,9 @@ public class MemoryViewUtil {
// if memory block extension, retrieval must be queired throught its
// interface
- if (object instanceof IMemoryBlockExtension)
+ if (object instanceof IMemoryBlockExtension) {
return ((IMemoryBlockExtension) object).getMemoryBlockRetrieval();
+ }
// check if the object can adapt to a memory block retrieval
if (object instanceof IAdaptable) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java
index dd09175bc..aec3672ed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java
@@ -88,9 +88,9 @@ public class NewMemoryViewAction implements IViewActionDelegate {
MemoryView newMView = (MemoryView) newView;
IMemoryViewPane[] viewPanes = fView.getViewPanes();
int orientation = fView.getViewPanesOrientation();
- for (int i = 0; i < viewPanes.length; i++) {
+ for (IMemoryViewPane viewPane : viewPanes) {
// copy view pane visibility
- newMView.showViewPane(fView.isViewPaneVisible(viewPanes[i].getId()), viewPanes[i].getId());
+ newMView.showViewPane(fView.isViewPaneVisible(viewPane.getId()), viewPane.getId());
}
// do not want to copy renderings as it could be very expensive
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RemoveRenderingContextAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RemoveRenderingContextAction.java
index d671dc806..2ccb57445 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RemoveRenderingContextAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RemoveRenderingContextAction.java
@@ -69,9 +69,9 @@ public class RemoveRenderingContextAction implements IViewActionDelegate {
String actionId = action.getId();
IMemoryRenderingContainer selectedPane = null;
- for (int i = 0; i < viewPanes.length; i++) {
- if (actionId.contains(viewPanes[i].getId())) {
- selectedPane = viewPanes[i];
+ for (IMemoryRenderingContainer viewPane : viewPanes) {
+ if (actionId.contains(viewPane.getId())) {
+ selectedPane = viewPane;
break;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
index 90ef9daaf..28efdf450 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -61,7 +61,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
@@ -128,9 +127,7 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
return;
}
- for (int i = 0; i < memoryBlocks.length; i++) {
- IMemoryBlock memory = memoryBlocks[i];
-
+ for (IMemoryBlock memory : memoryBlocks) {
if (!fTabFolderForMemoryBlock.containsKey(memory)) {
createFolderForMemoryBlock(memory);
}
@@ -143,27 +140,21 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
@Override
public void memoryBlocksRemoved(final IMemoryBlock[] memoryBlocks) {
Display.getDefault().asyncExec(() -> {
- for (int j = 0; j < memoryBlocks.length; j++) {
- IMemoryBlock mbRemoved = memoryBlocks[j];
+ for (IMemoryBlock mbRemoved : memoryBlocks) {
if (fTabFolderForMemoryBlock == null) {
return;
}
-
// get all renderings from this memory block and remove them
// from the view
IMemoryRendering[] renderings = fRenderingMgr.getRenderingsFromMemoryBlock(mbRemoved);
-
- for (int k = 0; k < renderings.length; k++) {
- removeMemoryRendering(renderings[k]);
+ for (IMemoryRendering rendering : renderings) {
+ removeMemoryRendering(rendering);
}
-
// remove a the tab folder if the memory block is removed
CTabFolder tabFolder = fTabFolderForMemoryBlock.get(mbRemoved);
-
if (tabFolder == null) {
continue;
}
-
fTabFolderForMemoryBlock.remove(mbRemoved);
fMemoryBlockFromTabFolder.remove(tabFolder);
IMemoryBlockRetrieval retrieve = MemoryViewUtil.getMemoryBlockRetrieval(mbRemoved);
@@ -172,18 +163,14 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
fTabFolderForDebugView.remove(MemoryViewUtil.getHashCode(retrieve));
}
}
-
if (!tabFolder.isDisposed()) {
// dispose all view tabs belonging to the tab folder
CTabItem[] items = tabFolder.getItems();
-
- for (int i = 0; i < items.length; i++) {
- disposeTab(items[i]);
+ for (CTabItem item : items) {
+ disposeTab(item);
}
-
// dispose the tab folder
tabFolder.dispose();
-
// if this is the top control
if (tabFolder == fStackLayout.topControl) {
@@ -222,7 +209,6 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
// if not the top control
// no need to do anything
}
-
fAddedMemoryBlocks.remove(mbRemoved);
updateToolBarActionsEnablement();
}
@@ -502,20 +488,17 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
CTabItem[] tabs = tabFolder.getItems();
boolean foundTab = false;
- for (int i1 = 0; i1 < tabs.length; i1++) {
- IMemoryViewTab viewTab1 = (IMemoryViewTab) tabs[i1].getData();
-
- if (tabs[i1].isDisposed()) {
+ for (CTabItem tab : tabs) {
+ IMemoryViewTab viewTab1 = (IMemoryViewTab) tab.getData();
+ if (tab.isDisposed()) {
continue;
}
-
if (viewTab1.getRendering().getMemoryBlock() == memory) {
if (viewTab1.getRendering() == rendering) {
foundTab = true;
- disposeTab(tabs[i1]);
+ disposeTab(tab);
break;
}
-
}
}
@@ -528,12 +511,12 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
CTabFolder otherTabFolder = enumeration.nextElement();
tabs = otherTabFolder.getItems();
IMemoryViewTab viewTab2 = null;
- for (int i2 = 0; i2 < tabs.length; i2++) {
- viewTab2 = (IMemoryViewTab) tabs[i2].getData();
+ for (CTabItem tab : tabs) {
+ viewTab2 = (IMemoryViewTab) tab.getData();
if (viewTab2.getRendering().getMemoryBlock() == memory) {
if (viewTab2.getRendering() == rendering) {
foundTab = true;
- disposeTab(tabs[i2]);
+ disposeTab(tab);
break;
}
}
@@ -563,8 +546,8 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
}
private void restoreViewTabs(IMemoryRendering[] renderings) {
- for (int i = 0; i < renderings.length; i++) {
- memoryBlockRenderingAdded(renderings[i]);
+ for (IMemoryRendering rendering : renderings) {
+ memoryBlockRenderingAdded(rendering);
}
}
@@ -742,7 +725,6 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); //$NON-NLS-1$
folder.setSelectionBackground(new Color[] { c1, c2 }, new int[] { 100 }, true);
folder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); //$NON-NLS-1$
- folder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
folder.setBorderVisible(true);
folder.setFont(fViewPaneCanvas.getFont());
@@ -1050,10 +1032,9 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
originalProvider = service.getSynchronizationProvider();
}
- for (int i = 0; i < renderings.length; i++) {
- if (renderings[i] instanceof IResettableMemoryRendering) {
+ for (IMemoryRendering rendering : renderings) {
+ if (rendering instanceof IResettableMemoryRendering) {
try {
-
// This is done to allow user to select multiple memory
// monitors and
// reset their renderings.
@@ -1075,10 +1056,10 @@ public class RenderingViewPane extends AbstractMemoryViewPane implements IMemory
// though the rendering
// is currently hidden.
if (service != null) {
- service.setSynchronizationProvider(renderings[i]);
+ service.setSynchronizationProvider(rendering);
}
- ((IResettableMemoryRendering) renderings[i]).resetRendering();
- } catch (DebugException e) {
+ ((IResettableMemoryRendering) rendering).resetRendering();
+ }catch (DebugException e) {
// do not pop up error message
// error message is annoying where there are multiple
// rendering
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockAction.java
index a1c8b76ad..1860641da 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockAction.java
@@ -61,9 +61,9 @@ public class ResetMemoryBlockAction implements IViewActionDelegate {
MemoryView memView = (MemoryView) fView;
IMemoryRenderingContainer[] containers = memView.getMemoryRenderingContainers();
- for (int i = 0; i < containers.length; i++) {
- if (containers[i] instanceof RenderingViewPane) {
- ((RenderingViewPane) containers[i]).resetRenderings(mb, resetVisible);
+ for (IMemoryRenderingContainer container : containers) {
+ if (container instanceof RenderingViewPane) {
+ ((RenderingViewPane) container).resetRenderings(mb, resetVisible);
}
}
}
@@ -77,12 +77,12 @@ public class ResetMemoryBlockAction implements IViewActionDelegate {
IStructuredSelection strucSel = (IStructuredSelection) selection;
Object[] objs = strucSel.toArray();
fSelectedMB.clear();
- for (int i = 0; i < objs.length; i++) {
- if (objs[i] instanceof IMemoryBlock) {
- fSelectedMB.add(objs[i]);
+ for (Object obj : objs) {
+ if (obj instanceof IMemoryBlock) {
+ fSelectedMB.add(obj);
}
- if (objs[i] instanceof IMemoryRendering) {
- fSelectedMB.add(((IMemoryRendering) objs[i]).getMemoryBlock());
+ if (obj instanceof IMemoryRendering) {
+ fSelectedMB.add(((IMemoryRendering) obj).getMemoryBlock());
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
index 6292c9be2..1b741465b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java
@@ -31,7 +31,6 @@ import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.memory.IMemoryRendering;
import org.eclipse.jface.action.Action;
@@ -127,12 +126,9 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
/**
* Listens for debug context changes and updates action delegate enablement
*/
- private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
- @Override
- public void debugContextChanged(DebugContextEvent event) {
- if (fAction != null) {
- fUpdateJob.schedule();
- }
+ private IDebugContextListener fDebugContextListener = event -> {
+ if (fAction != null) {
+ fUpdateJob.schedule();
}
};
@@ -237,9 +233,9 @@ public class SwitchMemoryBlockAction extends Action implements IViewActionDelega
allMemoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval);
}
if (allMemoryBlocks != null) {
- for (int i = 0; i < allMemoryBlocks.length; i++) {
- SwitchToAction action = new SwitchToAction(allMemoryBlocks[i], true);
- if (allMemoryBlocks[i] == memoryBlock) {
+ for (IMemoryBlock block : allMemoryBlocks) {
+ SwitchToAction action = new SwitchToAction(block, true);
+ if (block == memoryBlock) {
action.setChecked(true);
}
ActionContributionItem item = new ActionContributionItem(action);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneRenderingMgr.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneRenderingMgr.java
index ff8ec2667..ff4e4277a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneRenderingMgr.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneRenderingMgr.java
@@ -78,9 +78,8 @@ public class ViewPaneRenderingMgr implements IDebugEventSetListener {
IMemoryRendering[] toRemove = getRenderings(mem, renderingId);
- for (int i = 0; i < toRemove.length; i++) {
- fRenderings.remove(toRemove[i]);
-
+ for (IMemoryRendering rendering : toRemove) {
+ fRenderings.remove(rendering);
// remove listener after the last memory block has been removed
if (fRenderings.isEmpty()) {
DebugPlugin.getDefault().removeDebugEventListener(this);
@@ -179,8 +178,8 @@ public class ViewPaneRenderingMgr implements IDebugEventSetListener {
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- handleDebugEvent(events[i]);
+ for (DebugEvent event : events) {
+ handleDebugEvent(event);
}
}
@@ -198,9 +197,9 @@ public class ViewPaneRenderingMgr implements IDebugEventSetListener {
// returns empty array if dt == null
IMemoryRendering[] deletedrendering = getRenderingsFromDebugTarget(dt);
- for (int i = 0; i < deletedrendering.length; i++) {
- removeMemoryBlockRendering(deletedrendering[i].getMemoryBlock(), deletedrendering[i].getRenderingId());
- fViewPane.removeMemoryRendering(deletedrendering[i]);
+ for (IMemoryRendering rendering : deletedrendering) {
+ removeMemoryBlockRendering(rendering.getMemoryBlock(), rendering.getRenderingId());
+ fViewPane.removeMemoryRendering(rendering);
}
}
}
@@ -302,8 +301,7 @@ public class ViewPaneRenderingMgr implements IDebugEventSetListener {
Document document = LaunchManager.getDocument();
Element rootElement = document.createElement(RENDERINGS_TAG);
document.appendChild(rootElement);
- for (int i = 0; i < renderings.length; i++) {
- IMemoryRendering rendering = renderings[i];
+ for (IMemoryRendering rendering : renderings) {
Element element = document.createElement(MEMORY_RENDERING_TAG);
element.setAttribute(MEMORY_BLOCK, Integer.toString(rendering.getMemoryBlock().hashCode()));
element.setAttribute(RENDERING_ID, rendering.getRenderingId());
@@ -347,18 +345,18 @@ public class ViewPaneRenderingMgr implements IDebugEventSetListener {
IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks();
IMemoryBlock memoryBlock = null;
- for (int j = 0; j < memoryBlocks.length; j++) {
- if (Integer.toString(memoryBlocks[j].hashCode()).equals(memoryBlockHashCode)) {
- memoryBlock = memoryBlocks[j];
+ for (IMemoryBlock m : memoryBlocks) {
+ if (Integer.toString(m.hashCode()).equals(memoryBlockHashCode)) {
+ memoryBlock = m;
}
}
if (memoryBlock != null) {
IMemoryRenderingType[] types = DebugUITools.getMemoryRenderingManager().getRenderingTypes(memoryBlock);
IMemoryRenderingType type = null;
- for (int k = 0; k < types.length; k++) {
- if (types[k].getId().equals(renderingId)) {
- type = types[k];
+ for (IMemoryRenderingType t : types) {
+ if (t.getId().equals(renderingId)) {
+ type = t;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java
index 691a0714c..158e5102c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java
@@ -60,8 +60,8 @@ public class ViewPaneSelectionProvider implements ISelectionProvider {
public void fireChanged() {
SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection());
- for (int i = 0; i < fListeners.size(); i++) {
- fListeners.get(i).selectionChanged(evt);
+ for (ISelectionChangedListener listener : fListeners) {
+ listener.selectionChanged(evt);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewTabEnablementManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewTabEnablementManager.java
index 168e44d65..676c53a59 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewTabEnablementManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewTabEnablementManager.java
@@ -62,10 +62,9 @@ public class ViewTabEnablementManager implements SelectionListener {
CTabItem[] allTabs = folder.getItems();
// check all tabs to make sure they are enabled/disabled properly
- for (int i = 0; i < allTabs.length; i++) {
+ for (CTabItem tab : allTabs) {
IMemoryViewTab viewTab;
- Object obj = allTabs[i].getData();
-
+ Object obj = tab.getData();
if (obj instanceof IMemoryViewTab) {
viewTab = (IMemoryViewTab) obj;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractVirtualContentTableModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractVirtualContentTableModel.java
index 4c6633eeb..58a9b18ee 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractVirtualContentTableModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractVirtualContentTableModel.java
@@ -29,11 +29,11 @@ abstract public class AbstractVirtualContentTableModel extends AsynchronousTable
ModelNode[] nodes = getNodes(getRootNode().getElement());
ArrayList<Object> result = new ArrayList<>();
if (nodes != null) {
- for (int i = 0; i < nodes.length; i++) {
- ModelNode[] children = nodes[i].getChildrenNodes();
+ for (ModelNode node : nodes) {
+ ModelNode[] children = node.getChildrenNodes();
if (children != null) {
- for (int j = 0; j < children.length; j++) {
- result.add(children[j].getElement());
+ for (ModelNode child : children) {
+ result.add(child.getElement());
}
}
}
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 9312bf799..c1d6d907d 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
@@ -83,7 +83,7 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
// numberofAddressableUnit * addressableSize
int addressableSize = getAddressableSize();
- int offset = Integer.valueOf(property, 16).intValue() * addressableSize;
+ int offset = Integer.parseInt(property, 16) * addressableSize;
MemoryByte[] bytes = line.getBytes(offset, fRendering.getBytesPerColumn());
@@ -94,8 +94,8 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
return fCustomModifier.canModify(mElement, null);
}
- for (int i = 0; i < bytes.length; i++) {
- if (!bytes[i].isWritable()) {
+ for (MemoryByte b : bytes) {
+ if (!b.isWritable()) {
canModify = false;
}
}
@@ -132,10 +132,10 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
return line.getAddress();
}
- int offsetToLineBuffer = Integer.valueOf(property, 16).intValue() * getAddressableSize();
+ int offsetToLineBuffer = Integer.parseInt(property, 16) * getAddressableSize();
MemoryByte[] memory = line.getBytes(offsetToLineBuffer, fRendering.getBytesPerColumn());
- int offsetFromLineAddress = Integer.valueOf(property, 16).intValue();
+ int offsetFromLineAddress = Integer.parseInt(property, 16);
BigInteger address = line.getAddress().add(BigInteger.valueOf(offsetFromLineAddress));
if (fCustomModifier != null)
@@ -181,7 +181,7 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
final IMemoryBlock memoryBlk = fRendering.getMemoryBlock();
// number of addressable units from the line's start address
- int offsetFromLineAddress = Integer.valueOf(property, 16).intValue();
+ int offsetFromLineAddress = Integer.parseInt(property, 16);
// this offset is number of addressable unit from memory block's base address
final BigInteger offsetFromMBBase = getOffset(memoryBlk, line.getAddress(), offsetFromLineAddress);
@@ -189,7 +189,7 @@ public class AsyncTableRenderingCellModifier implements ICellModifier {
// property is number of addressable unit from line address
// to calculate proper offset in the memoryViewLine's array
// offset = numberOfAddressableUnit * addressableSize
- int offsetToLineBuffer = Integer.valueOf(property, 16).intValue() * getAddressableSize();
+ int offsetToLineBuffer = Integer.parseInt(property, 16) * getAddressableSize();
MemoryByte[] oldArray = line.getBytes(offsetToLineBuffer, fRendering.getBytesPerColumn());
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 0e3ad4d09..d9a9a927c 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
@@ -614,9 +614,7 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
int colNum = -1;
int numCol = getColumnProperties().length;
- for (int j=0; j<tableItems.length; j++)
- {
- TableItem item = tableItems[j];
+ for (TableItem item : tableItems) {
if (item.getData() != null)
{
for (int i=0; i<numCol; i++)
@@ -1029,9 +1027,13 @@ public class AsyncTableRenderingViewer extends AsyncVirtualContentTableViewer {
@Override
protected void updateComplete(IStatusMonitor monitor) {
+ if (fTableCursor.isDisposed()) {
+ return;
+ }
+
super.updateComplete(monitor);
- if (!hasPendingUpdates() && !fTableCursor.isDisposed())
+ if (!hasPendingUpdates())
{
attemptSetKeySelection();
fTableCursor.redraw();
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java
index 8a94cf217..0ec26b16b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java
@@ -87,8 +87,8 @@ abstract public class AsyncVirtualContentTableViewer extends AsynchronousTableVi
// clean up old columns
TableColumn[] oldColumns = getTable().getColumns();
- for (int i = 0; i < oldColumns.length; i++) {
- oldColumns[i].dispose();
+ for (TableColumn oldColumn : oldColumns) {
+ oldColumn.dispose();
}
}
@@ -97,8 +97,8 @@ abstract public class AsyncVirtualContentTableViewer extends AsynchronousTableVi
CellEditor[] oldCellEditors = getCellEditors();
if (oldCellEditors != null) {
- for (int i = 0; i < oldCellEditors.length; i++) {
- oldCellEditors[i].dispose();
+ for (CellEditor oldCellEditor : oldCellEditors) {
+ oldCellEditor.dispose();
}
}
}
@@ -424,9 +424,9 @@ abstract public class AsyncVirtualContentTableViewer extends AsynchronousTableVi
// check each of the items and find the minimum
TableItem[] items = table.getItems();
int minHeight = table.getItemHeight();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null) {
- minHeight = Math.min(items[i].getBounds(0).height, minHeight);
+ for (TableItem item : items) {
+ if (item.getData() != null) {
+ minHeight = Math.min(item.getBounds(0).height, minHeight);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java
index 08fb101ff..48f93c40a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java
@@ -109,8 +109,8 @@ public abstract class BasicDebugViewContentProvider implements IStructuredConten
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i=0; i < events.length; i++) {
- handleDebugEvent(events[i]);
+ for (DebugEvent event : events) {
+ handleDebugEvent(event);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java
index 3decf470e..e500c7ff5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java
@@ -75,7 +75,7 @@ public class CopyTableRenderingToClipboardAction extends Action
// get title of view tab
String label = fRendering.getLabel();
tableContents.append(label);
- tableContents.append(System.getProperty("line.separator")); //$NON-NLS-1$
+ tableContents.append(System.lineSeparator());
tableContents.append(COLUMN_SEPERATOR);
int charsPerByte = fRendering.getNumCharsPerByte();
@@ -135,15 +135,15 @@ public class CopyTableRenderingToClipboardAction extends Action
tableContents.append(COLUMN_SEPERATOR);
}
- tableContents.append(System.getProperty("line.separator")); //$NON-NLS-1$
+ tableContents.append(System.lineSeparator());
StringBuilder temp;
//get the column contents from all the rows
- for (int i=0; i < itemList.length; i++) {
- for (int j=0; j < numColumns; j++) {
+ for (TableItem item : itemList) {
+ for (int j = 0; j < numColumns; j++) {
tableContents.append(COLUMN_SEPERATOR);
- temp = new StringBuilder(labelProvider.getColumnText(itemList[i].getData(), j));
+ temp = new StringBuilder(labelProvider.getColumnText(item.getData(), j));
if (j>0)
{
@@ -157,7 +157,7 @@ public class CopyTableRenderingToClipboardAction extends Action
tableContents.append(temp);
}
- tableContents.append(System.getProperty("line.separator")); //$NON-NLS-1$
+ tableContents.append(System.lineSeparator());
}
return tableContents.toString();
}
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 4db332fb7..a2f01aee3 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
@@ -36,9 +36,7 @@ import org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener;
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
import org.eclipse.debug.ui.memory.IMemoryRenderingType;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
@@ -80,7 +78,7 @@ public class CreateRendering extends AbstractMemoryRendering implements IMemoryR
fContainer = container;
}
- class MemoryRenderingLabelProvider implements ILabelProvider
+ static class MemoryRenderingLabelProvider implements ILabelProvider
{
@Override
@@ -118,7 +116,7 @@ public class CreateRendering extends AbstractMemoryRendering implements IMemoryR
}
- class MemoryRenderingContentProvider implements IStructuredContentProvider
+ static class MemoryRenderingContentProvider implements IStructuredContentProvider
{
@Override
@@ -186,12 +184,7 @@ public class CreateRendering extends AbstractMemoryRendering implements IMemoryR
listLayout.horizontalSpan = 1;
fViewer.getControl().setLayoutData(listLayout);
- fViewer.addDoubleClickListener(new IDoubleClickListener (){
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- addRenderings();
- }});
+ fViewer.addDoubleClickListener(event -> addRenderings());
// listen for enter being pressed
fViewer.getList().addKeyListener(new KeyAdapter() {
@@ -257,12 +250,10 @@ public class CreateRendering extends AbstractMemoryRendering implements IMemoryR
// make a copy of the container, may be diposed when a rendering is added
IMemoryRenderingContainer container = fContainer;
// add memory renderings to Memory Rendering Manager
- for (int i=0; i<renderings.length; i++)
- {
- if (renderings[i] instanceof IMemoryRenderingType)
- {
+ for (Object r : renderings) {
+ if (r instanceof IMemoryRenderingType) {
try {
- IMemoryRendering rendering = ((IMemoryRenderingType)renderings[i]).createRendering();
+ IMemoryRendering rendering = ((IMemoryRenderingType) r).createRendering();
if (rendering != null)
{
rendering.init(container, getMemoryBlock());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
index 7ddfd7f26..b443af00e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java
@@ -108,9 +108,8 @@ public class FormatTableRenderingDialog extends TrayDialog
Label rowLabel = new Label(composite, SWT.NONE);
rowLabel.setText(DebugUIMessages.FormatTableRenderingAction_2);
fRowControl = new Combo(composite, SWT.READ_ONLY);
- for (int i=0; i<fRowSizes.length; i++)
- {
- fRowControl.add(String.valueOf(fRowSizes[i]));
+ for (int size : fRowSizes) {
+ fRowControl.add(String.valueOf(size));
}
fRowControl.addSelectionListener(new SelectionListener() {
@@ -140,9 +139,8 @@ public class FormatTableRenderingDialog extends TrayDialog
Label columnLabel = new Label(composite, SWT.NONE);
columnLabel.setText(DebugUIMessages.FormatTableRenderingAction_4);
fColumnControl = new Combo(composite, SWT.READ_ONLY);
- for (int i=0; i<fColumnSizes.length; i++)
- {
- fColumnControl.add(String.valueOf(fColumnSizes[i]));
+ for (int size : fColumnSizes) {
+ fColumnControl.add(String.valueOf(size));
}
fColumnControl.addSelectionListener(new SelectionListener() {
@@ -353,9 +351,8 @@ public class FormatTableRenderingDialog extends TrayDialog
}
addressCol.pack();
- for (int i=0; i<columns.length; i++)
- {
- columns[i].pack();
+ for (TableColumn column : columns) {
+ column.pack();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressDialog.java
index 0982ff7a1..c82588500 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressDialog.java
@@ -80,8 +80,8 @@ public class GoToAddressDialog extends TrayDialog implements ModifyListener {
// add history
String[] historyExpression = history.toArray(new String[history.size()]);
- for (int i = 0; i < historyExpression.length; i++) {
- expressionInput.add(historyExpression[i]);
+ for (String h : historyExpression) {
+ expressionInput.add(h);
}
expressionInput.addModifyListener(this);
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 53280662e..05b589643 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,6 +11,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* David Pickens - [Memory View] Endian in hex view and ASCII view doesn't work
+ * John Dallaway - Accommodate addressableSize != 1 (bug 575413)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.memory.renderings;
@@ -39,21 +40,18 @@ public class HexIntegerRendering extends AbstractIntegerRendering {
String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
if (endianess == RenderingsUtil.LITTLE_ENDIAN) {
+ int addressableSize = getAddressableSize();
MemoryByte[] swapped = new MemoryByte[data.length];
- for (int i = 0; i < data.length; i++){
- swapped[data.length-i-1] = data[i];
+ for (int i = 0; i < data.length; i += addressableSize) {
+ System.arraycopy(data, i, swapped, data.length - i - addressableSize, addressableSize);
}
data = swapped;
}
- for (int i=0; i<data.length; i++)
- {
- if (data[i].isReadable())
- {
- strBuffer.append(new String(RenderingsUtil.convertByteToCharArray(data[i].getValue())));
- }
- else
- {
+ for (MemoryByte memByte : data) {
+ if (memByte.isReadable()) {
+ strBuffer.append(new String(RenderingsUtil.convertByteToCharArray(memByte.getValue())));
+ } else {
// pad with padded string
strBuffer.append(paddedStr);
}
@@ -86,9 +84,10 @@ public class HexIntegerRendering extends AbstractIntegerRendering {
if (endianess == RenderingsUtil.LITTLE_ENDIAN) {
+ int addressableSize = getAddressableSize();
byte[] swapped = new byte[bytes.length];
- for (int i = 0; i < bytes.length; i++){
- swapped[bytes.length-i-1] = bytes[i];
+ for (int i = 0; i < bytes.length; i += addressableSize) {
+ System.arraycopy(bytes, i, swapped, bytes.length - i - addressableSize, addressableSize);
}
bytes = swapped;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexRendering.java
index 5561c180f..f3544e302 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexRendering.java
@@ -38,14 +38,10 @@ public class HexRendering extends AbstractAsyncTableRendering {
String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
- for (int i=0; i<data.length; i++)
- {
- if (data[i].isReadable())
- {
- strBuffer.append(new String(RenderingsUtil.convertByteToCharArray(data[i].getValue())));
- }
- else
- {
+ for (MemoryByte memByte : data) {
+ if (memByte.isReadable()) {
+ strBuffer.append(new String(RenderingsUtil.convertByteToCharArray(memByte.getValue())));
+ } else {
// pad with padded string
strBuffer.append(paddedStr);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java
index 6068deb0c..9b405f8e9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java
@@ -80,22 +80,20 @@ public class PrintTableRenderingAction extends Action
lineNum = printColumnLabels(printGC, lineNum);
//for all items in the table
- for (int i=0; i < itemList.length; i++) {
+ for (TableItem item : itemList) {
StringBuilder tableContents = new StringBuilder();
//print all columns for this row
- for (int j=0; j < numColumns; j++) {
- String columnText = labelProvider.getColumnText(itemList[i].getData(), j);
-
+ for (int j = 0; j < numColumns; j++) {
+ String columnText = labelProvider.getColumnText(item.getData(), j);
while (columnText.length() < fRendering.getBytesPerColumn() * charsPerByte)
{
- columnText += " "; //$NON-NLS-1$
+ columnText += " "; //$NON-NLS-1$
}
tableContents.append(COLUMN_SEPERATOR);
tableContents.append(columnText);
}
printGC.drawString(tableContents.toString(), 10, 10+(lineNum*printGC.getFontMetrics().getHeight()));
lineNum++;
-
// if we've run over the end of a page, start a new one
if (20+lineNum*printGC.getFontMetrics().getHeight() > printer.getClientArea().height) {
lineNum=1;
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 b39ea5133..e62d485db 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * John Dallaway - Accommodate addressableSize != 1 (bug 577106)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.memory.renderings;
@@ -72,7 +73,7 @@ public class RenderingsUtil {
return array;
}
- static public BigInteger convertByteArrayToUnsignedLong(byte[] array, int endianess)
+ static public BigInteger convertByteArrayToUnsignedLong(byte[] array, int endianess, int addressableSize)
{
if (array.length < 8)
{
@@ -82,14 +83,15 @@ public class RenderingsUtil {
BigInteger value = new BigInteger("0"); //$NON-NLS-1$
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int i=0; i< 8; i++)
- {
- byte[] temp = new byte[1];
- temp[0] = array[i];
- BigInteger b = new BigInteger(temp);
- b = b.and(new BigInteger("ff", 16)); //$NON-NLS-1$
- b = b.shiftLeft(i*8);
- value = value.or(b);
+ for (int i = 0; i < 8; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ byte[] temp = new byte[1];
+ temp[0] = array[i + j];
+ BigInteger b = new BigInteger(temp);
+ b = b.and(new BigInteger("ff", 16)); //$NON-NLS-1$
+ b = b.shiftLeft((i + addressableSize - j - 1) * 8);
+ value = value.or(b);
+ }
}
}
else
@@ -111,9 +113,10 @@ public class RenderingsUtil {
* Convert byte array to long.
* @param array
* @param endianess
+ * @param addressableSize
* @return result of the conversion in long
*/
- static public long convertByteArrayToLong(byte[] array, int endianess)
+ static public long convertByteArrayToLong(byte[] array, int endianess, int addressableSize)
{
if (array.length < 8)
{
@@ -123,10 +126,12 @@ public class RenderingsUtil {
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
long value = 0;
- for (int i = 0; i < 8; i++) {
- long b = array[i];
- b &= 0xff;
- value |= (b << (i * 8));
+ for (int i = 0; i < 8; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ long b = array[i + j];
+ b &= 0xff;
+ value |= (b << ((i + addressableSize - j - 1) * 8));
+ }
}
return value;
}
@@ -141,7 +146,7 @@ public class RenderingsUtil {
return value;
}
- static public BigInteger convertByteArrayToSignedBigInt(byte[] array, int endianess)
+ static public BigInteger convertByteArrayToSignedBigInt(byte[] array, int endianess, int addressableSize)
{
if (array.length < 16)
{
@@ -152,10 +157,10 @@ public class RenderingsUtil {
{
// reverse bytes
byte[] holder = new byte[16];
- int j=15;
- for (int i=0; i<16; i++, j--)
- {
- holder[i] = array[j];
+ for (int i = 0; i < 16; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ holder[i + j] = array[16 + j - i - addressableSize];
+ }
}
// create BigInteger
@@ -166,7 +171,7 @@ public class RenderingsUtil {
return value;
}
- static public BigInteger convertByteArrayToSignedBigInt(byte[] array, int endianess, int arraySize)
+ static public BigInteger convertByteArrayToSignedBigInt(byte[] array, int endianess, int arraySize, int addressableSize)
{
if (array.length < arraySize)
{
@@ -177,10 +182,10 @@ public class RenderingsUtil {
{
// reverse bytes
byte[] holder = new byte[arraySize];
- int j=arraySize-1;
- for (int i=0; i<arraySize; i++, j--)
- {
- holder[i] = array[j];
+ for (int i = 0; i < arraySize; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ holder[i + j] = array[arraySize + j - i - addressableSize];
+ }
}
// create BigInteger
@@ -191,7 +196,7 @@ public class RenderingsUtil {
return value;
}
- static public BigInteger convertByteArrayToUnsignedBigInt(byte[] array, int endianess)
+ static public BigInteger convertByteArrayToUnsignedBigInt(byte[] array, int endianess, int addressableSize)
{
if (array.length < 16)
{
@@ -201,14 +206,15 @@ public class RenderingsUtil {
BigInteger value = new BigInteger("0"); //$NON-NLS-1$
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int i=0; i< 16; i++)
- {
- byte[] temp = new byte[1];
- temp[0] = array[i];
- BigInteger b = new BigInteger(temp);
- b = b.and(new BigInteger("ff", 16)); //$NON-NLS-1$
- b = b.shiftLeft(i*8);
- value = value.or(b);
+ for (int i = 0; i < 16; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ byte[] temp = new byte[1];
+ temp[0] = array[i + j];
+ BigInteger b = new BigInteger(temp);
+ b = b.and(new BigInteger("ff", 16)); //$NON-NLS-1$
+ b = b.shiftLeft((i + addressableSize - j - 1) * 8);
+ value = value.or(b);
+ }
}
}
else
@@ -226,7 +232,7 @@ public class RenderingsUtil {
return value;
}
- static public BigInteger convertByteArrayToUnsignedBigInt(byte[] array, int endianess, int arraySize)
+ static public BigInteger convertByteArrayToUnsignedBigInt(byte[] array, int endianess, int arraySize, int addressableSize)
{
if (array.length < arraySize)
{
@@ -236,14 +242,15 @@ public class RenderingsUtil {
BigInteger value = new BigInteger("0"); //$NON-NLS-1$
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int i=0; i< arraySize; i++)
- {
- byte[] temp = new byte[1];
- temp[0] = array[i];
- BigInteger b = new BigInteger(temp);
- b = b.and(new BigInteger("ff", 16)); //$NON-NLS-1$
- b = b.shiftLeft(i*8);
- value = value.or(b);
+ for (int i = 0; i < arraySize; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ byte[] temp = new byte[1];
+ temp[0] = array[i + j];
+ BigInteger b = new BigInteger(temp);
+ b = b.and(new BigInteger("ff", 16)); //$NON-NLS-1$
+ b = b.shiftLeft((i + addressableSize - j - 1) * 8);
+ value = value.or(b);
+ }
}
}
else
@@ -265,9 +272,10 @@ public class RenderingsUtil {
* Convert byte array to integer.
* @param array
* @param endianess
+ * @param addressableSize
* @return result of the conversion in int
*/
- static public int convertByteArrayToInt(byte[] array, int endianess)
+ static public int convertByteArrayToInt(byte[] array, int endianess, int addressableSize)
{
if (array.length < 4)
{
@@ -277,10 +285,12 @@ public class RenderingsUtil {
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
int value = 0;
- for (int i = 0; i < 4; i++) {
- int b = array[i];
- b &= 0xff;
- value |= (b << (i * 8));
+ for (int i = 0; i < 4; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ int b = array[i + j];
+ b &= 0xff;
+ value |= (b << ((i + addressableSize - j - 1) * 8));
+ }
}
return value;
}
@@ -299,9 +309,10 @@ public class RenderingsUtil {
* Convert byte array to short.
* @param array
* @param endianess
+ * @param addressableSize
* @return result of teh conversion in short
*/
- static public short convertByteArrayToShort(byte[] array, int endianess)
+ static public short convertByteArrayToShort(byte[] array, int endianess, int addressableSize)
{
if (array.length < 2)
{
@@ -311,10 +322,12 @@ public class RenderingsUtil {
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
short value = 0;
- for (int i = 0; i < 2; i++) {
- short b = array[i];
- b &= 0xff;
- value |= (b << (i * 8));
+ for (int i = 0; i < 2; i += addressableSize) {
+ for (int j = 0; j < addressableSize; j++) {
+ short b = array[i + j];
+ b &= 0xff;
+ value |= (b << ((i + addressableSize - j - 1) * 8));
+ }
}
return value;
}
@@ -332,18 +345,20 @@ public class RenderingsUtil {
* Convert big integer to byte array.
* @param i
* @param endianess
+ * @param addressableSize
* @return result of the conversion in raw byte array
*/
- static public byte[] convertBigIntegerToByteArray(BigInteger i, int endianess)
+ static public byte[] convertBigIntegerToByteArray(BigInteger i, int endianess, int addressableSize)
{
byte buf[]=new byte[16];
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int j=0; j<16; j++)
- {
- BigInteger x = i.shiftRight(j*8);
- buf[j] = x.byteValue();
+ for (int j = 0; j < 16; j += addressableSize) {
+ for (int k = 0; k < addressableSize; k++) {
+ BigInteger x = i.shiftRight((j + addressableSize - k - 1) * 8);
+ buf[j + k] = x.byteValue();
+ }
}
return buf;
}
@@ -355,16 +370,17 @@ public class RenderingsUtil {
return buf;
}
- static public byte[] convertSignedBigIntToByteArray(BigInteger i, int endianess, int arraySize)
+ static public byte[] convertSignedBigIntToByteArray(BigInteger i, int endianess, int arraySize, int addressableSize)
{
byte buf[]=new byte[arraySize];
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int j=0; j<arraySize; j++)
- {
- BigInteger x = i.shiftRight(j*8);
- buf[j] = x.byteValue();
+ for (int j = 0; j < arraySize; j += addressableSize) {
+ for (int k = 0; k < addressableSize; k++) {
+ BigInteger x = i.shiftRight((j + addressableSize - k - 1) * 8);
+ buf[j + k] = x.byteValue();
+ }
}
return buf;
}
@@ -380,18 +396,20 @@ public class RenderingsUtil {
* Convert big integer to byte array.
* @param i
* @param endianess
+ * @param addressableSize
* @return result of the conversion in raw byte array
*/
- static public byte[] convertUnsignedBigIntegerToByteArray(BigInteger i, int endianess)
+ static public byte[] convertUnsignedBigIntegerToByteArray(BigInteger i, int endianess, int addressableSize)
{
byte buf[]=new byte[32];
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int j=0; j<32; j++)
- {
- BigInteger x = i.shiftRight(j*8);
- buf[j] = x.byteValue();
+ for (int j = 0; j < 32; j += addressableSize) {
+ for (int k = 0; k < addressableSize; k++) {
+ BigInteger x = i.shiftRight((j + addressableSize - k - 1) * 8);
+ buf[j + k] = x.byteValue();
+ }
}
return buf;
}
@@ -403,16 +421,17 @@ public class RenderingsUtil {
return buf;
}
- static public byte[] convertUnsignedBigIntToByteArray(BigInteger i, int endianess, int arraySize)
+ static public byte[] convertUnsignedBigIntToByteArray(BigInteger i, int endianess, int arraySize, int addressableSize)
{
byte buf[]=new byte[arraySize*2];
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int j=0; j<arraySize*2; j++)
- {
- BigInteger x = i.shiftRight(j*8);
- buf[j] = x.byteValue();
+ for (int j = 0; j < arraySize * 2; j += addressableSize) {
+ for (int k = 0; k < addressableSize; k++) {
+ BigInteger x = i.shiftRight((j + addressableSize - k - 1) * 8);
+ buf[j + k] = x.byteValue();
+ }
}
return buf;
}
@@ -428,17 +447,19 @@ public class RenderingsUtil {
* Convert long to byte array.
* @param i
* @param endianess
+ * @param addressableSize
* @return result of the conversion in raw byte array
*/
- static public byte[] convertLongToByteArray(long i, int endianess)
+ static public byte[] convertLongToByteArray(long i, int endianess, int addressableSize)
{
byte buf[]=new byte[8];
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int j=0; j<8; j++)
- {
- buf[j] = Long.valueOf(i>>j*8).byteValue();
+ for (int j = 0; j < 8; j += addressableSize) {
+ for (int k = 0; k < addressableSize; k++) {
+ buf[j + k] = Long.valueOf(i >> (j + addressableSize - k - 1) * 8).byteValue();
+ }
}
return buf;
}
@@ -453,17 +474,19 @@ public class RenderingsUtil {
* Convert integer to byte array.
* @param i
* @param endianess
+ * @param addressableSize
* @return result of the conversion in raw byte array
*/
- static public byte[] convertIntToByteArray(int i, int endianess)
+ static public byte[] convertIntToByteArray(int i, int endianess, int addressableSize)
{
byte buf[]=new byte[4];
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (int j=0; j<4; j++)
- {
- buf[j] = Integer.valueOf(i>>j*8).byteValue();
+ for (int j = 0; j < 4; j += addressableSize) {
+ for (int k = 0; k < addressableSize; k++) {
+ buf[j + k] = Integer.valueOf(i >> (j + addressableSize - k - 1) * 8).byteValue();
+ }
}
return buf;
}
@@ -478,17 +501,19 @@ public class RenderingsUtil {
* Convert short to byte array.
* @param i
* @param endianess
+ * @param addressableSize
* @return result of the conversion in raw byte array
*/
- static public byte[] convertShortToByteArray(short i, int endianess)
+ static public byte[] convertShortToByteArray(short i, int endianess, int addressableSize)
{
byte buf[]=new byte[2];
if (endianess == RenderingsUtil.LITTLE_ENDIAN)
{
- for (short j=0; j<2; j++)
- {
- buf[j] = Integer.valueOf(i>>j*8).byteValue();
+ for (short j = 0; j < 2; j += addressableSize) {
+ for (int k = 0; k < addressableSize; k++) {
+ buf[j + k] = Integer.valueOf(i >> (j + addressableSize - k - 1) * 8).byteValue();
+ }
}
return buf;
}
@@ -509,9 +534,8 @@ public class RenderingsUtil {
StringBuilder strBuffer = new StringBuilder();
char charArray[];
- for (int i=0; i<byteArray.length;i ++)
- {
- charArray = RenderingsUtil.convertByteToCharArray(byteArray[i]);
+ for (byte element : byteArray) {
+ charArray = RenderingsUtil.convertByteToCharArray(element);
strBuffer.append(charArray);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java
index b808a2c50..30b683183 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * John Dallaway - Accommodate addressableSize != 1 (bug 577106)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.memory.renderings;
@@ -47,22 +48,22 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
result = byteArray[0];
break;
case 2:
- result = RenderingsUtil.convertByteArrayToShort(byteArray, endianess);
+ result = RenderingsUtil.convertByteArrayToShort(byteArray, endianess, getAddressableSize());
break;
case 4:
- result = RenderingsUtil.convertByteArrayToInt(byteArray, endianess);
+ result = RenderingsUtil.convertByteArrayToInt(byteArray, endianess, getAddressableSize());
break;
case 8:
- result = RenderingsUtil.convertByteArrayToLong(byteArray, endianess);
+ result = RenderingsUtil.convertByteArrayToLong(byteArray, endianess, getAddressableSize());
break;
case 16:
{
- BigInteger bigRet = RenderingsUtil.convertByteArrayToSignedBigInt(byteArray, endianess);
+ BigInteger bigRet = RenderingsUtil.convertByteArrayToSignedBigInt(byteArray, endianess, getAddressableSize());
return bigRet.toString();
}
default:
{
- BigInteger bigRet = RenderingsUtil.convertByteArrayToSignedBigInt(byteArray, endianess, columnSize);
+ BigInteger bigRet = RenderingsUtil.convertByteArrayToSignedBigInt(byteArray, endianess, columnSize, getAddressableSize());
return bigRet.toString();
}
}
@@ -85,19 +86,19 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
case 2:
{
short i = Short.parseShort(newValue);
- bytes = RenderingsUtil.convertShortToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertShortToByteArray(i, endianess, getAddressableSize());
break;
}
case 4:
{
int i = Integer.parseInt(newValue);
- bytes = RenderingsUtil.convertIntToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertIntToByteArray(i, endianess, getAddressableSize());
break;
}
case 8:
{
long i = Long.parseLong(newValue);
- bytes = RenderingsUtil.convertLongToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertLongToByteArray(i, endianess, getAddressableSize());
break;
}
case 16:
@@ -105,7 +106,7 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
// special case for colSize == 16
// need to represent number in Big Integer
BigInteger i = new BigInteger(newValue);
- bytes = RenderingsUtil.convertBigIntegerToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertBigIntegerToByteArray(i, endianess, getAddressableSize());
return bytes;
}
@@ -128,7 +129,7 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
throw new NumberFormatException();
}
- bytes = RenderingsUtil.convertSignedBigIntToByteArray(i, endianess, colSize);
+ bytes = RenderingsUtil.convertSignedBigIntToByteArray(i, endianess, colSize, getAddressableSize());
return bytes;
}
}
@@ -144,10 +145,8 @@ public class SignedIntegerRendering extends AbstractIntegerRendering {
boolean invalid = false;
String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
- for (int i=0; i<data.length; i++)
- {
- if (!data[i].isReadable())
- {
+ for (MemoryByte memByte : data) {
+ if (!memByte.isReadable()) {
invalid = true;
break;
}
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 c88de3fff..33d0bef7d 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
@@ -72,7 +72,7 @@ public class TableRenderingCellModifier implements ICellModifier {
// numberofAddressableUnit * addressableSize
int addressableSize = getAddressableSize();
- int offset = Integer.valueOf(property, 16).intValue() * addressableSize;
+ int offset = Integer.parseInt(property, 16) * addressableSize;
int end = offset + fRendering.getBytesPerColumn();
for (int i = offset; i < end; i++) {
@@ -114,7 +114,7 @@ public class TableRenderingCellModifier implements ICellModifier {
return line.getAddress();
}
- int offset = Integer.valueOf(property, 16).intValue() * getAddressableSize();
+ int offset = Integer.parseInt(property, 16) * getAddressableSize();
int end = offset + fRendering.getBytesPerColumn();
// Ask for label provider
@@ -122,7 +122,7 @@ public class TableRenderingCellModifier implements ICellModifier {
if (line.isAvailable(offset, end)) {
// ask the renderer for a string representation of the bytes
- offset = Integer.valueOf(property, 16).intValue();
+ offset = Integer.parseInt(property, 16);
BigInteger address = new BigInteger(((TableRenderingLine) element).getAddress(), 16);
address = address.add(BigInteger.valueOf(offset));
@@ -154,7 +154,7 @@ public class TableRenderingCellModifier implements ICellModifier {
// calculate offset to update
IMemoryBlock memoryBlk = fRendering.getMemoryBlock();
- int lineOffset = Integer.valueOf(property, 16).intValue();
+ int lineOffset = Integer.parseInt(property, 16);
// this offset is number of addressable unit from the line address
BigInteger offset = getOffset(memoryBlk, line.getAddress(), lineOffset);
@@ -168,7 +168,7 @@ public class TableRenderingCellModifier implements ICellModifier {
// 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 offsetToLine = Integer.parseInt(property, 16) * getAddressableSize();
int end = offsetToLine + fRendering.getBytesPerColumn();
MemoryByte[] oldArray = line.getBytes(offsetToLine, end);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
index f8c20fd79..7a3d3b72b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java
@@ -405,10 +405,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
// fill buffer with memory returned by debug adapter
int j = prefillNumBytes; // counter for memoryBuffer
- for (int i=0; i<memory.length; i++)
- {
+ for (byte element : memory) {
MemoryByte tmp = new MemoryByte();
- tmp.setValue(memory[i]);
+ tmp.setValue(element);
tmp.setReadable(true);
tmp.setWritable(true);
tmp.setEndianessKnown(false);
@@ -726,10 +725,9 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
// content.
if (!getTableRendering(fInput).isDisplayingError())
{
- for (int i=0; i<lines.length; i++)
- {
- contentCache.put(lines[i].getAddress(), lines[i]);
- lines[i].isMonitored = true;
+ for (TableRenderingLine line : lines) {
+ contentCache.put(line.getAddress(), line);
+ line.isMonitored = true;
}
}
@@ -933,9 +931,8 @@ public class TableRenderingContentProvider extends BasicDebugViewContentProvider
TableRenderingLine[] convertedLines = convertBytesToLines(bytes, bytesPerLine, new BigInteger(fContentCacheStartAddress, 16));
contentCache.clear();
- for (int i=0; i<convertedLines.length; i++)
- {
- contentCache.put(convertedLines[i].getAddress(), convertedLines[i]);
+ for (TableRenderingLine convertedLine : convertedLines) {
+ contentCache.put(convertedLine.getAddress(), convertedLine);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLine.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLine.java
index 677bf2714..b1165f9cf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLine.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLine.java
@@ -93,11 +93,9 @@ public class TableRenderingLine extends PlatformObject {
// pad unavailable bytes with padded string from memory block
String paddedString = null;
int bufferCounter = 0;
- for (int i=0; i<fBytes.length; i++)
- {
+ for (MemoryByte mb : fBytes) {
// if byte is invalid
- if (!fBytes[i].isReadable())
- {
+ if (!mb.isReadable()) {
if (paddedString == null)
{
paddedString = fPaddedString;
@@ -177,10 +175,9 @@ public class TableRenderingLine extends PlatformObject {
// if the string representation is the same, no need to compare
if (oldData.getRawMemoryString().equals(getRawMemoryString()))
{
- for (int i=0; i<fBytes.length; i++)
- {
+ for (MemoryByte mb : fBytes) {
// set history as known if we have old data for this line
- fBytes[i].setHistoryKnown(true);
+ mb.setHistoryKnown(true);
}
return;
}
@@ -283,11 +280,10 @@ public class TableRenderingLine extends PlatformObject {
public void unmarkDeltas()
{
- for (int i=0; i<fBytes.length; i++)
- {
+ for (MemoryByte mb : fBytes) {
// unset the change bit
- if (fBytes[i].isChanged()) {
- fBytes[i].setChanged(false);
+ if (mb.isChanged()) {
+ mb.setChanged(false);
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
index 859bc9f3f..7937f4576 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java
@@ -166,8 +166,7 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
@Override
public void cache(Object[] elements) {
- for (int i = 0; i < elements.length; i++) {
- Object obj = elements[i];
+ for (Object obj : elements) {
if (obj instanceof MemorySegment) {
cache(((MemorySegment) obj).getAddress(), obj);
}
@@ -187,8 +186,7 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
return newElements;
}
- for (int j = 0; j < newElements.length; j++) {
- Object obj = newElements[j];
+ for (Object obj : newElements) {
if (obj instanceof MemorySegment) {
MemorySegment newSegment = (MemorySegment) obj;
MemorySegment oldSegment = (MemorySegment) fCache.get(newSegment.getAddress());
@@ -275,8 +273,8 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
}
MemorySegment[] newSegments = convertMemoryBytesToSegments(address, bytes, bytesPerLine, numAddressableUnitPerLine, addressableSize, alignAddress);
- for (int i = 0; i < newSegments.length; i++) {
- cache(newSegments[i].getAddress(), newSegments[i]);
+ for (MemorySegment newSegment : newSegments) {
+ cache(newSegment.getAddress(), newSegment);
}
}
@@ -290,8 +288,7 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
ArrayList<Object> segments = new ArrayList<>();
Object[] elements = getElements();
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
+ for (Object element : elements) {
if (element instanceof MemorySegment) {
segments.add(element);
}
@@ -322,8 +319,8 @@ public class TableRenderingModel extends AbstractVirtualContentTableModel implem
private MemoryByte[] convertSegmentsToBytes(MemorySegment[] segments) {
ArrayList<MemoryByte> toReturn = new ArrayList<>();
- for (int i = 0; i < segments.length; i++) {
- MemoryByte[] temp = segments[i].getBytes();
+ for (MemorySegment segment : segments) {
+ MemoryByte[] temp = segment.getBytes();
Collections.addAll(toReturn, temp);
}
return toReturn.toArray(new MemoryByte[0]);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java
index 25b8a8197..b6f9ce73f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * John Dallaway - Accommodate addressableSize != 1 (bug 577106)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.memory.renderings;
@@ -43,22 +44,22 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
result &= 0xff;
break;
case 2:
- result = RenderingsUtil.convertByteArrayToInt(byteArray, endianess);
+ result = RenderingsUtil.convertByteArrayToInt(byteArray, endianess, getAddressableSize());
break;
case 4:
- result = RenderingsUtil.convertByteArrayToLong(byteArray, endianess);
+ result = RenderingsUtil.convertByteArrayToLong(byteArray, endianess, getAddressableSize());
break;
case 8:
- BigInteger value = RenderingsUtil.convertByteArrayToUnsignedLong(byteArray, endianess);
+ BigInteger value = RenderingsUtil.convertByteArrayToUnsignedLong(byteArray, endianess, getAddressableSize());
return value.toString();
case 16:
{
- BigInteger bigRet = RenderingsUtil.convertByteArrayToUnsignedBigInt(byteArray, endianess);
+ BigInteger bigRet = RenderingsUtil.convertByteArrayToUnsignedBigInt(byteArray, endianess, getAddressableSize());
return bigRet.toString();
}
default:
{
- BigInteger bigRet = RenderingsUtil.convertByteArrayToUnsignedBigInt(byteArray, endianess, columnSize);
+ BigInteger bigRet = RenderingsUtil.convertByteArrayToUnsignedBigInt(byteArray, endianess, columnSize, getAddressableSize());
return bigRet.toString();
}
}
@@ -76,7 +77,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
case 1:
{
short i = Short.parseShort(newValue);
- bytes = RenderingsUtil.convertShortToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertShortToByteArray(i, endianess, getAddressableSize());
bytes = extractBytes(bytes, endianess, colSize);
break;
}
@@ -84,28 +85,28 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
case 2:
{
int i = Integer.parseInt(newValue);
- bytes = RenderingsUtil.convertIntToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertIntToByteArray(i, endianess, getAddressableSize());
bytes = extractBytes(bytes, endianess, colSize);
break;
}
case 4:
{
long i = Long.parseLong(newValue);
- bytes = RenderingsUtil.convertLongToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertLongToByteArray(i, endianess, getAddressableSize());
bytes = extractBytes(bytes, endianess, colSize);
break;
}
case 8:
{
BigInteger i = new BigInteger(newValue);
- bytes = RenderingsUtil.convertBigIntegerToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertBigIntegerToByteArray(i, endianess, getAddressableSize());
bytes = extractBytes(bytes, endianess, colSize);
break;
}
case 16:
{
BigInteger i = new BigInteger(newValue);
- bytes = RenderingsUtil.convertUnsignedBigIntegerToByteArray(i, endianess);
+ bytes = RenderingsUtil.convertUnsignedBigIntegerToByteArray(i, endianess, getAddressableSize());
bytes = extractBytes(bytes, endianess, colSize);
return bytes;
@@ -113,7 +114,7 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
default:
{
BigInteger i = new BigInteger(newValue);
- bytes = RenderingsUtil.convertUnsignedBigIntToByteArray(i, endianess, colSize);
+ bytes = RenderingsUtil.convertUnsignedBigIntToByteArray(i, endianess, colSize, getAddressableSize());
bytes = extractBytes(bytes, endianess, colSize);
return bytes;
}
@@ -130,10 +131,8 @@ public class UnsignedIntegerRendering extends AbstractIntegerRendering {
String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR);
boolean invalid = false;
- for (int i=0; i<data.length; i++)
- {
- if (!data[i].isReadable())
- {
+ for (MemoryByte memByte : data) {
+ if (!memByte.isReadable()) {
invalid = true;
break;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/LogicalStructureCache.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/LogicalStructureCache.java
index 2389c3aac..bd4ccc368 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/LogicalStructureCache.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/LogicalStructureCache.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -22,6 +24,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILogicalStructureType;
+import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate3;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
@@ -59,9 +62,13 @@ public class LogicalStructureCache {
* Clears the cache of all evaluated values.
*/
public void clear(){
+ Collection<LogicalStructureTypeCache> caches;
synchronized (fCacheForType) {
+ caches = new ArrayList<>(fCacheForType.values());
fCacheForType.clear();
}
+
+ caches.forEach(LogicalStructureTypeCache::dispose);
}
/**
@@ -147,5 +154,15 @@ public class LogicalStructureCache {
}
}
+ public void dispose() {
+ if (!(fType instanceof ILogicalStructureTypeDelegate3)) {
+ return;
+ }
+ ILogicalStructureTypeDelegate3 typeDelegate = (ILogicalStructureTypeDelegate3) fType;
+ synchronized (fKnownValues) {
+ fKnownValues.values().forEach(typeDelegate::releaseValue);
+ }
+ }
+
}
}
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 b06a47bc3..7e89642b8 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
@@ -76,9 +76,9 @@ import org.eclipse.debug.ui.IDebugView;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextService;
+import org.eclipse.e4.ui.services.IStylingEngine;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -86,6 +86,7 @@ import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.FontDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.LocalSelectionTransfer;
@@ -109,21 +110,21 @@ import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveListener;
-import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.ISaveablePart2;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchActionConstants;
@@ -131,6 +132,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.XMLMemento;
import org.eclipse.ui.handlers.CollapseAllHandler;
@@ -148,20 +150,19 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
IViewerUpdateListener, IDetailPaneContainer2, ISaveablePart2 {
private static final String COLLAPSE_ALL = "CollapseAll"; //$NON-NLS-1$
+ /**
+ * Unique ID of variables view tree viewer used for CSS styling
+ */
+ private static final String CSS_VARIABLES_VIEWER_ID = "VariablesViewer"; //$NON-NLS-1$
/**
- * Selection provider wrapping an exchangeable active selection provider.
- * Sends out a selection changed event when the active selection provider changes.
+ * Selection provider wrapping an exchangeable active selection provider. Sends
+ * out a selection changed event when the active selection provider changes.
* Forwards all selection changed events of the active selection provider.
*/
private static class SelectionProviderWrapper implements ISelectionProvider {
private final ListenerList<ISelectionChangedListener> fListenerList = new ListenerList<>(ListenerList.IDENTITY);
- private final ISelectionChangedListener fListener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- fireSelectionChanged(event);
- }
- };
+ private final ISelectionChangedListener fListener = this::fireSelectionChanged;
private ISelectionProvider fActiveProvider;
private SelectionProviderWrapper(ISelectionProvider provider) {
@@ -293,12 +294,9 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* Viewer input requester used to update the viewer once the viewer input has been
* resolved.
*/
- private IViewerInputRequestor fRequester = new IViewerInputRequestor() {
- @Override
- public void viewerInputComplete(IViewerInputUpdate update) {
- if (!update.isCanceled()) {
- viewerInputUpdateComplete(update);
- }
+ private IViewerInputRequestor fRequester = update -> {
+ if (!update.isCanceled()) {
+ viewerInputUpdateComplete(update);
}
};
@@ -342,7 +340,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
/**
* Visits deltas to determine if details should be displayed
*/
- class Visitor implements IModelDeltaVisitor {
+ static class Visitor implements IModelDeltaVisitor {
/**
* Whether to trigger details display.
*
@@ -397,6 +395,10 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
private IPresentationContext fPresentationContext;
+ private Font variablesTreeFont;
+
+ private TreeModelViewer variablesViewer;
+
/**
* Remove myself as a selection listener
* and preference change listener.
@@ -424,6 +426,9 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
fInputService.dispose();
fSelectionProvider.dispose();
+ if (variablesTreeFont != null) {
+ variablesTreeFont.dispose();
+ }
super.dispose();
}
@@ -470,7 +475,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
if (propertyName.equals(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR) ||
propertyName.equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND) ||
propertyName.equals(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT)) {
- getViewer().refresh();
+ Viewer viewer = getViewer();
+ if (viewer == variablesViewer) {
+ setVariablesViewerTreeFont(variablesViewer);
+ }
+ viewer.refresh();
}
}
@@ -487,10 +496,12 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
JFaceResources.getFontRegistry().addListener(this);
- TreeModelViewer variablesViewer = createTreeViewer(fSashForm);
+ variablesViewer = createTreeViewer(fSashForm);
fInputService = new ViewerInputService(variablesViewer, fRequester);
fSashForm.setMaximizedControl(variablesViewer.getControl());
+ setVariablesViewerTreeFont(variablesViewer);
+
fDetailsAnchor = SWTFactory.createComposite(fSashForm, parent.getFont(), 1, 1, GridData.FILL_BOTH, 0, 0);
fSashForm.setWeights(getLastSashWeights());
@@ -500,17 +511,12 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
createOrientationActions(variablesViewer);
IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore();
String orientation = prefStore.getString(getDetailPanePreferenceKey());
- for (int i = 0; i < fToggleDetailPaneActions.length; i++) {
- fToggleDetailPaneActions[i].setChecked(fToggleDetailPaneActions[i].getOrientation().equals(orientation));
+ for (ToggleDetailPaneAction action : fToggleDetailPaneActions) {
+ action.setChecked(action.getOrientation().equals(orientation));
}
fDetailPane = new DetailPaneProxy(this);
- fDetailPane.addProperyListener(new IPropertyListener() {
- @Override
- public void propertyChanged(Object source, int propId) {
- firePropertyChange(propId);
- }
- });
+ fDetailPane.addProperyListener((source, propId) -> firePropertyChange(propId));
setDetailPaneOrientation(orientation);
IMemento memento = getMemento();
@@ -526,6 +532,21 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
return variablesViewer;
}
+ private void setVariablesViewerTreeFont(TreeModelViewer variablesViewer) {
+ Tree tree = variablesViewer.getTree();
+ FontDescriptor fontDescriptor = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT);
+ Font oldVariablesTreeFont = variablesTreeFont;
+ variablesTreeFont = fontDescriptor.createFont(tree.getDisplay());
+ tree.setFont(variablesTreeFont); // needed when themes are disabled
+ if (oldVariablesTreeFont != null) {
+ oldVariablesTreeFont.dispose();
+ }
+ IStylingEngine engine = PlatformUI.getWorkbench().getService(IStylingEngine.class);
+ if (engine != null) {
+ engine.setId(tree, CSS_VARIABLES_VIEWER_ID);
+ }
+ }
+
/**
* Initializes the drag and/or drop adapters for this view. Called from createViewer().
*
@@ -576,7 +597,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
sw = memento.getInteger(SASH_DETAILS_PART);
if(sw != null) {
int details = sw.intValue();
- if(view > -1 & details > -1) {
+ if(view > -1 && details > -1) {
return new int[] {view, details};
}
}
@@ -632,7 +653,6 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
int style = getViewerStyle();
fPresentationContext = new DebugModelPresentationContext(getPresentationContextId(), this, fModelPresentation);
final TreeModelViewer variablesViewer = new TreeModelViewer(parent, style, fPresentationContext);
-
variablesViewer.getControl().addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
@@ -652,14 +672,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
}
});
variablesViewer.getPresentationContext().addPropertyChangeListener(
- new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (IPresentationContext.PROPERTY_COLUMNS.equals(event.getProperty())) {
- IAction action = getAction("ShowTypeNames"); //$NON-NLS-1$
- if (action != null) {
- action.setEnabled(event.getNewValue() == null);
- }
+ event -> {
+ if (IPresentationContext.PROPERTY_COLUMNS.equals(event.getProperty())) {
+ IAction action = getAction("ShowTypeNames"); //$NON-NLS-1$
+ if (action != null) {
+ action.setEnabled(event.getNewValue() == null);
}
}
});
@@ -1017,23 +1034,20 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
fConfigureColumnsAction = new ConfigureColumnsAction(viewer);
setAction("ToggleColmns", new ToggleShowColumnsAction(viewer)); //$NON-NLS-1$
- layoutSubMenu.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager manager) {
- layoutSubMenu.add(fToggleDetailPaneActions[0]);
- layoutSubMenu.add(fToggleDetailPaneActions[1]);
- layoutSubMenu.add(fToggleDetailPaneActions[2]);
- layoutSubMenu.add(fToggleDetailPaneActions[3]);
- layoutSubMenu.add(new Separator());
- IAction action = getAction("ToggleColmns"); //$NON-NLS-1$
- ((IUpdate)action).update();
- if (action.isEnabled()) {
- layoutSubMenu.add(action);
- }
- fConfigureColumnsAction.update();
- if (fConfigureColumnsAction.isEnabled()) {
- layoutSubMenu.add(fConfigureColumnsAction);
- }
+ layoutSubMenu.addMenuListener(manager -> {
+ layoutSubMenu.add(fToggleDetailPaneActions[0]);
+ layoutSubMenu.add(fToggleDetailPaneActions[1]);
+ layoutSubMenu.add(fToggleDetailPaneActions[2]);
+ layoutSubMenu.add(fToggleDetailPaneActions[3]);
+ layoutSubMenu.add(new Separator());
+ IAction action = getAction("ToggleColmns"); //$NON-NLS-1$
+ ((IUpdate)action).update();
+ if (action.isEnabled()) {
+ layoutSubMenu.add(action);
+ }
+ fConfigureColumnsAction.update();
+ if (fConfigureColumnsAction.isEnabled()) {
+ layoutSubMenu.add(fConfigureColumnsAction);
}
});
}
@@ -1072,7 +1086,13 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
protected void fillContextMenu(IMenuManager menu) {
menu.add(new Separator(IDebugUIConstants.EMPTY_VARIABLE_GROUP));
menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP));
- menu.add(getAction(FIND_ACTION));
+ IAction findAction = getAction(FIND_ACTION);
+ if (findAction != null) {
+ menu.add(findAction);
+ } else {
+ DebugUIPlugin.log(new IllegalStateException("No action found for id: " + FIND_ACTION //$NON-NLS-1$
+ + ", fGlobalActionMap: " + fGlobalActionMap)); //$NON-NLS-1$
+ }
ChangeVariableValueAction changeValueAction = (ChangeVariableValueAction)getAction("ChangeVariableValue"); //$NON-NLS-1$
if (changeValueAction.isApplicable()) {
menu.add(changeValueAction);
@@ -1099,18 +1119,15 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
*/
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);
+ fTreeSelectionChangedListener = 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);
}
};
}
@@ -1173,12 +1190,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
@Override
public void paneChanged(String newPaneID) {
if (fDetailPaneActivatedListener == null){
- fDetailPaneActivatedListener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- fTreeHasFocus = false;
- }
- };
+ fDetailPaneActivatedListener = event -> fTreeHasFocus = false;
}
fDetailPane.getCurrentControl().addListener(SWT.Activate, fDetailPaneActivatedListener);
}
@@ -1440,9 +1452,9 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
protected ToggleDetailPaneAction getToggleDetailPaneAction(String orientation)
{
- for (int i=0; i<fToggleDetailPaneActions.length; i++) {
- if (fToggleDetailPaneActions[i].getOrientation().equals(orientation)) {
- return fToggleDetailPaneActions[i];
+ for (ToggleDetailPaneAction action : fToggleDetailPaneActions) {
+ if (action.getOrientation().equals(orientation)) {
+ return action;
}
}
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 fd18bf7b4..de188b7dc 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
@@ -16,6 +16,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables.details;
+import java.text.MessageFormat;
import java.util.Iterator;
import java.util.ResourceBundle;
@@ -51,7 +52,6 @@ import org.eclipse.debug.ui.IDebugView;
import org.eclipse.debug.ui.IDetailPane2;
import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.MenuManager;
@@ -76,14 +76,10 @@ import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyEvent;
@@ -114,8 +110,6 @@ import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import com.ibm.icu.text.MessageFormat;
-
/**
* This detail pane uses a source viewer to display detailed information about the current
* selection. It incorporates a large number of actions into its context menu. It is the
@@ -236,10 +230,13 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
fModel.computeDetail(val, this);
synchronized (this) {
try {
- // wait for a max of 30 seconds for result, then cancel
- wait(30000);
+ // detail could already computed at this point (see bug 252433)
if (!fComputed) {
- fMonitor.setCanceled(true);
+ // wait for a max of 30 seconds for result, then cancel
+ wait(30000);
+ if (!fComputed) {
+ fMonitor.setCanceled(true);
+ }
}
} catch (InterruptedException e) {
break;
@@ -469,14 +466,10 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
private void installWhitespacePreferenceListener() {
IPreferenceStore store = EditorsUI.getPreferenceStore();
- fPreferenceStorePropertyChangeListener = new IPropertyChangeListener() {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (AbstractTextEditor.PREFERENCE_SHOW_WHITESPACE_CHARACTERS.equals(property)) {
- toggleWhitespaceCharacterPainter();
- }
+ fPreferenceStorePropertyChangeListener = event -> {
+ String property = event.getProperty();
+ if (AbstractTextEditor.PREFERENCE_SHOW_WHITESPACE_CHARACTERS.equals(property)) {
+ toggleWhitespaceCharacterPainter();
}
};
store.addPropertyChangeListener(fPreferenceStorePropertyChangeListener);
@@ -532,12 +525,7 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
});
// Add the selection listener so selection dependent actions get updated.
- fSourceViewer.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateSelectionDependentActions();
- }
- });
+ fSourceViewer.getSelectionProvider().addSelectionChangedListener(event -> updateSelectionDependentActions());
// Add a focus listener to update actions when details area gains focus
fSourceViewer.getControl().addFocusListener(new FocusAdapter() {
@@ -576,20 +564,17 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
// disposed controls don't get a FocusOut event, make sure all actions
// have been deactivated
- fSourceViewer.getControl().addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (fHasFocus) {
- setGlobalAction(IDebugView.SELECT_ALL_ACTION, null);
- setGlobalAction(IDebugView.CUT_ACTION, null);
- setGlobalAction(IDebugView.COPY_ACTION, null);
- setGlobalAction(IDebugView.PASTE_ACTION, null);
- setGlobalAction(IDebugView.FIND_ACTION, null);
- setGlobalAction(getAction(DETAIL_ASSIGN_VALUE_ACTION)
- .getActionDefinitionId(), null);
- setGlobalAction(getAction(DETAIL_CONTENT_ASSIST_ACTION)
- .getActionDefinitionId(), null);
- }
+ fSourceViewer.getControl().addDisposeListener(e -> {
+ if (fHasFocus) {
+ setGlobalAction(IDebugView.SELECT_ALL_ACTION, null);
+ setGlobalAction(IDebugView.CUT_ACTION, null);
+ setGlobalAction(IDebugView.COPY_ACTION, null);
+ setGlobalAction(IDebugView.PASTE_ACTION, null);
+ setGlobalAction(IDebugView.FIND_ACTION, null);
+ setGlobalAction(getAction(DETAIL_ASSIGN_VALUE_ACTION)
+ .getActionDefinitionId(), null);
+ setGlobalAction(getAction(DETAIL_CONTENT_ASSIST_ACTION)
+ .getActionDefinitionId(), null);
}
});
@@ -678,12 +663,7 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
protected void createDetailContextMenu(Control menuControl) {
MenuManager menuMgr= new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager mgr) {
- fillDetailContextMenu(mgr);
- }
- });
+ menuMgr.addMenuListener(this::fillDetailContextMenu);
Menu menu= menuMgr.createContextMenu(menuControl);
menuControl.setMenu(menu);
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 5c41204b1..10cb57b4c 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
@@ -61,7 +61,7 @@ public class DetailPaneManager {
* to the extension point. Only loads information from the plug-in xml and only
* instantiates the specified factory if required (lazy loading).
*/
- private class DetailPaneFactoryExtension implements IDetailPaneFactory{
+ private static class DetailPaneFactoryExtension implements IDetailPaneFactory{
private IConfigurationElement fConfigElement;
private IDetailPaneFactory fFactory;
@@ -445,8 +445,8 @@ public class DetailPaneManager {
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_DETAIL_FACTORIES);
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
DetailPaneFactoryExtension delegate = null;
- for(int i = 0; i < infos.length; i++) {
- delegate = new DetailPaneFactoryExtension(infos[i]);
+ for (IConfigurationElement info : infos) {
+ delegate = new DetailPaneFactoryExtension(info);
fKnownFactories.add(delegate);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
index 1cea2f95d..b5a33a381 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
@@ -14,6 +14,8 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables.details;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -37,8 +39,6 @@ import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.ISaveablePart;
import org.eclipse.ui.IWorkbenchPartSite;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Acts as a proxy between a view and a detail pane. Controls how information is displayed
* in the details pane in a view. Currently used by the variables, registers and expression
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 fe10bfdd5..bd8ffbe65 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
@@ -435,10 +435,9 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
protected void saveAllCheckedActionStates() {
IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
IContributionItem[] items= tbm.getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem iContributionItem = items[i];
- if (iContributionItem instanceof ActionContributionItem) {
- ActionContributionItem item= (ActionContributionItem)iContributionItem;
+ for (IContributionItem contitem : items) {
+ if (contitem instanceof ActionContributionItem) {
+ ActionContributionItem item= (ActionContributionItem)contitem;
IAction action= item.getAction();
if (action.getStyle() == IAction.AS_CHECK_BOX && action.isEnabled()) {
saveCheckedActionState(action);
@@ -627,9 +626,9 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi
}
IContributionItem[] items = tbm.getItems();
if (items != null) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem) items[i]).getAction();
+ for (IContributionItem item : items) {
+ if (item instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem) item).getAction();
if (!SkipAllBreakpointsAction.ACTION_ID.equals(action.getId())) {
if (action.getStyle() == IAction.AS_CHECK_BOX) {
initActionState(action);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java
index f66cffd1f..c3472b7b0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java
@@ -49,7 +49,7 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf
*
* @param tabs the tabs in this group
*/
- protected void setTabs(ILaunchConfigurationTab[] tabs) {
+ protected void setTabs(ILaunchConfigurationTab... tabs) {
fTabs = tabs;
}
@@ -62,8 +62,8 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf
public void dispose() {
ILaunchConfigurationTab[] tabs = getTabs();
if (tabs != null) {
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].dispose();
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.dispose();
}
}
}
@@ -76,8 +76,8 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
ILaunchConfigurationTab[] tabs = getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].setDefaults(configuration);
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.setDefaults(configuration);
}
}
@@ -89,8 +89,8 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
ILaunchConfigurationTab[] tabs = getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].initializeFrom(configuration);
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.initializeFrom(configuration);
}
}
@@ -102,8 +102,8 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
ILaunchConfigurationTab[] tabs = getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].performApply(configuration);
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.performApply(configuration);
}
}
@@ -120,8 +120,8 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf
@Override
public void launched(ILaunch launch) {
ILaunchConfigurationTab[] tabs = getTabs();
- for (int i = 0; i < tabs.length; i++) {
- tabs[i].launched(launch);
+ for (ILaunchConfigurationTab tab : tabs) {
+ tab.launched(launch);
}
}
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 a90806917..405867a5e 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
@@ -15,9 +15,12 @@
*******************************************************************************/
package org.eclipse.debug.ui;
+import static org.eclipse.swt.accessibility.AccessibleListener.getNameAdapter;
+import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -51,22 +54,14 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
@@ -81,13 +76,11 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.ide.IDEEncoding;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
-
-import com.ibm.icu.text.MessageFormat;
+import org.osgi.framework.FrameworkUtil;
/**
* Launch configuration tab used to specify the location a launch configuration
@@ -111,8 +104,10 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
*
* @since 3.6
*/
- private final String SHARED_LAUNCH_CONFIGURATON_DIALOG = IDebugUIConstants.PLUGIN_ID + ".SHARED_LAUNCH_CONFIGURATON_DIALOG"; //$NON-NLS-1$
- private final String WORKSPACE_SELECTION_DIALOG = IDebugUIConstants.PLUGIN_ID + ".WORKSPACE_SELECTION_DIALOG"; //$NON-NLS-1$
+ private static final String SHARED_LAUNCH_CONFIGURATON_DIALOG = IDebugUIConstants.PLUGIN_ID
+ + ".SHARED_LAUNCH_CONFIGURATON_DIALOG"; //$NON-NLS-1$
+ private static final String WORKSPACE_SELECTION_DIALOG = IDebugUIConstants.PLUGIN_ID
+ + ".WORKSPACE_SELECTION_DIALOG"; //$NON-NLS-1$
/**
* This attribute exists solely for the purpose of making sure that invalid shared locations
@@ -129,17 +124,18 @@ 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 fTerminateDescendantsButton;
+ 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 fFileOutput;
+ private Button fFileBrowse;
+ private Text fFileText;
+ private Button fVariables;
+ private Button fAppend;
private Button fMergeOutput;
- private Button fWorkspaceBrowse;
+ private Button fWorkspaceBrowse;
private Button fInputFileCheckButton;
private Text fInputFileLocationText;
@@ -155,14 +151,9 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
/**
* Modify listener that simply updates the owning launch configuration dialog.
*/
- private ModifyListener fBasicModifyListener = new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent evt) {
- scheduleUpdateJob();
- }
- };
+ private ModifyListener fBasicModifyListener = evt -> scheduleUpdateJob();
- /**
+ /**
* Constructs a new tab with default context help.
*/
public CommonTab() {
@@ -183,6 +174,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
createEncodingComponent(comp);
createOutputCaptureComponent(comp);
createLaunchInBackgroundComponent(comp);
+ createTerminateDescendantsButtonComponent(comp);
}
/**
@@ -193,7 +185,8 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
* @since 3.6
*/
IDialogSettings getDialogBoundsSettings(String id) {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(CommonTab.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(id);
if (section == null) {
section = settings.addNewSection(id);
@@ -215,12 +208,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
table.setFont(parent.getFont());
fFavoritesTable.setContentProvider(new FavoritesContentProvider());
fFavoritesTable.setLabelProvider(new FavoritesLabelProvider());
- fFavoritesTable.addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateLaunchConfigurationDialog();
- }
- });
+ fFavoritesTable.addCheckStateListener(event -> updateLaunchConfigurationDialog());
}
/**
@@ -236,131 +224,94 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
gd.horizontalSpan = 3;
fLocalRadioButton.setLayoutData(gd);
fSharedRadioButton = createRadioButton(comp, LaunchConfigurationsMessages.CommonTab_S_hared_4);
- fSharedRadioButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent evt) {
- handleSharedRadioButtonSelected();
- }
- });
+ fSharedRadioButton.addSelectionListener(widgetSelectedAdapter(e -> handleSharedRadioButtonSelected()));
+
fSharedLocationText = SWTFactory.createSingleText(comp, 1);
- fSharedLocationText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = LaunchConfigurationsMessages.CommonTab_S_hared_4;
- }
- });
+ fSharedLocationText.getAccessible().addAccessibleListener(
+ getNameAdapter(e -> e.result = LaunchConfigurationsMessages.CommonTab_S_hared_4));
+
fSharedLocationText.addModifyListener(fBasicModifyListener);
fSharedLocationButton = createPushButton(comp, LaunchConfigurationsMessages.CommonTab__Browse_6, null);
- fSharedLocationButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent evt) {
- handleSharedLocationButtonSelected();
- }
- });
+ fSharedLocationButton.addSelectionListener(widgetSelectedAdapter(e -> handleSharedLocationButtonSelected()));
fLocalRadioButton.setSelection(true);
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);
fIoComposit = comp;
fFileOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_6);
- 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
- public void getName(AccessibleEvent e) {
- e.result = LaunchConfigurationsMessages.CommonTab_6;
- }
- });
- fFileText.addModifyListener(fBasicModifyListener);
-
- Composite bcomp = SWTFactory.createComposite(comp, 3, 5, GridData.HORIZONTAL_ALIGN_END);
+ fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false));
+ fFileOutput.addSelectionListener(widgetSelectedAdapter(e -> {
+ enableOuputCaptureWidgets(fFileOutput.getSelection());
+ updateLaunchConfigurationDialog();
+ }));
+ fFileText = SWTFactory.createSingleText(comp, 4);
+ fFileText.getAccessible()
+ .addAccessibleListener(getNameAdapter(e -> e.result = LaunchConfigurationsMessages.CommonTab_6));
+ fFileText.addModifyListener(fBasicModifyListener);
+
+ 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
- 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
- public void widgetSelected(SelectionEvent e) {
- 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
- public void widgetSelected(SelectionEvent e) {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
- dialog.open();
- String variable = dialog.getVariableExpression();
- if (variable != null) {
- fFileText.insert(variable);
+ ld.marginHeight = 1;
+ ld.marginWidth = 0;
+ fWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_12, null);
+ fWorkspaceBrowse.addSelectionListener(widgetSelectedAdapter(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);
}
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {}
- });
- fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11);
+ }
+ }));
+ fFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_7, null);
+ fFileBrowse.addSelectionListener(widgetSelectedAdapter(e -> {
+ 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(widgetSelectedAdapter(e -> {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ dialog.open();
+ String variable = dialog.getVariableExpression();
+ if (variable != null) {
+ fFileText.insert(variable);
+ }
+ }));
+ fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11);
GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
gd.horizontalSpan = 5;
- fAppend.setLayoutData(gd);
- fAppend.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
- }
+ fAppend.setLayoutData(gd);
+ fAppend.addSelectionListener(widgetSelectedAdapter(e -> 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() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
+ fConsoleOutput.addSelectionListener(widgetSelectedAdapter(e -> updateLaunchConfigurationDialog()));
Composite comp = SWTFactory.createComposite(comp1, comp1.getFont(), 5, 5, GridData.FILL_BOTH, 0, 0);
fInputFileCheckButton = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_17);
@@ -368,115 +319,97 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
gd.horizontalSpan = 3;
fInputFileCheckButton.setLayoutData(gd);
- fInputFileCheckButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent evt) {
- handleInputFileButtonSelected();
- updateLaunchConfigurationDialog();
- }
- });
+ fInputFileCheckButton.addSelectionListener(widgetSelectedAdapter(e -> {
+ handleInputFileButtonSelected();
+ updateLaunchConfigurationDialog();
+ }));
fInputFileLocationText = SWTFactory.createSingleText(comp, 2);
- fInputFileLocationText.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- e.result = LaunchConfigurationsMessages.CommonTab_17;
- }
- });
+ fInputFileLocationText.getAccessible()
+ .addAccessibleListener(getNameAdapter(e -> e.result = LaunchConfigurationsMessages.CommonTab_17));
fInputFileLocationText.addModifyListener(fBasicModifyListener);
Composite bcomp = SWTFactory.createComposite(comp, 3, 5, GridData.HORIZONTAL_ALIGN_END);
GridLayout ld = (GridLayout) bcomp.getLayout();
ld.marginHeight = 1;
ld.marginWidth = 0;
fInputWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_16, null);
- fInputWorkspaceBrowse.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13);
- dialog.setValidator(new ISelectionStatusValidator() {
-
- @Override
- public IStatus validate(Object[] selection) {
- if (selection.length == 0) {
- return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
- }
- for (int i = 0; i < selection.length; i++) {
- if (!(selection[i] instanceof IFile)) {
- return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
- }
- }
- return new Status(IStatus.OK, DebugUIPlugin.getUniqueIdentifier(), 0, IInternalDebugCoreConstants.EMPTY_STRING, null);
- }
- });
- dialog.setMessage(LaunchConfigurationsMessages.CommonTab_18);
- 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$
- fInputFileLocationText.setText(fileLoc);
+ fInputWorkspaceBrowse.addSelectionListener(widgetSelectedAdapter(e -> {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(),
+ new WorkbenchContentProvider());
+ dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13);
+ dialog.setValidator(selection -> {
+ if (selection.length == 0) {
+ return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0,
+ IInternalDebugCoreConstants.EMPTY_STRING, null);
+ }
+ for (Object f : selection) {
+ if (!(f instanceof IFile)) {
+ return new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0,
+ IInternalDebugCoreConstants.EMPTY_STRING, null);
}
}
+ return new Status(IStatus.OK, DebugUIPlugin.getUniqueIdentifier(), 0,
+ IInternalDebugCoreConstants.EMPTY_STRING, null);
+ });
+ dialog.setMessage(LaunchConfigurationsMessages.CommonTab_18);
+ 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$
+ fInputFileLocationText.setText(fileLoc);
+ }
}
- });
+ }));
fInputFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_19, null);
- fInputFileBrowse.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String filePath = fInputFileLocationText.getText();
- FileDialog dialog = new FileDialog(getShell(), SWT.OK | SWT.SHEET);
- filePath = dialog.open();
- if (filePath != null) {
- fInputFileLocationText.setText(filePath);
- }
+ fInputFileBrowse.addSelectionListener(widgetSelectedAdapter(e -> {
+ String filePath = fInputFileLocationText.getText();
+ FileDialog dialog = new FileDialog(getShell(), SWT.OK | SWT.SHEET);
+ filePath = dialog.open();
+ if (filePath != null) {
+ fInputFileLocationText.setText(filePath);
}
- });
+ }));
fInputVariables = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_20, null);
- fInputVariables.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
- dialog.open();
- String variable = dialog.getVariableExpression();
- if (variable != null) {
- fInputFileLocationText.insert(variable);
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
+ fInputVariables.addSelectionListener(widgetSelectedAdapter(e -> {
+ StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
+ dialog.open();
+ String variable = dialog.getVariableExpression();
+ if (variable != null) {
+ fInputFileLocationText.insert(variable);
}
- });
+ }));
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) {
@@ -486,67 +419,55 @@ 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
- public void getName(AccessibleEvent e) {
- 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() {
- @Override
- public void keyReleased(KeyEvent e) {
- scheduleUpdateJob();
+ }
+ 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(getNameAdapter(e -> e.result = LaunchConfigurationsMessages.CommonTab_3));
+
+ SelectionListener listener = widgetSelectedAdapter(e -> {
+ if (e.getSource() instanceof Button) {
+ Button button = (Button) e.getSource();
+ if (button.getSelection()) {
+ updateLaunchConfigurationDialog();
+ fEncodingCombo.setEnabled(fAltEncodingButton.getSelection());
+ }
+ } else {
+ updateLaunchConfigurationDialog();
}
});
+ fAltEncodingButton.addSelectionListener(listener);
+ fDefaultEncodingButton.addSelectionListener(listener);
+ fEncodingCombo.addSelectionListener(listener);
+ fEncodingCombo.addKeyListener(KeyListener.keyReleasedAdapter(e -> scheduleUpdateJob()));
}
/**
@@ -578,12 +499,23 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
data.horizontalSpan = 2;
fLaunchInBackgroundButton.setLayoutData(data);
fLaunchInBackgroundButton.setFont(parent.getFont());
- fLaunchInBackgroundButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
+ fLaunchInBackgroundButton.addSelectionListener(widgetSelectedAdapter(e -> updateLaunchConfigurationDialog()));
+ }
+
+ /**
+ * Creates the controls needed to edit the terminate descendants attribute of an
+ * external tool
+ *
+ * @param parent the composite to create the controls in
+ */
+ private void createTerminateDescendantsButtonComponent(Composite parent) {
+ fTerminateDescendantsButton = createCheckButton(parent,
+ LaunchConfigurationsMessages.CommonTab_AttributeLabel_TerminateDescendants);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ data.horizontalSpan = 2;
+ fTerminateDescendantsButton.setLayoutData(data);
+ fTerminateDescendantsButton.setFont(parent.getFont());
+ fTerminateDescendantsButton.addSelectionListener(widgetSelectedAdapter(e -> updateLaunchConfigurationDialog()));
}
/**
@@ -621,11 +553,11 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
private String getDefaultSharedConfigLocation(ILaunchConfiguration config) {
String path = IInternalDebugCoreConstants.EMPTY_STRING;
try {
- IResource[] res = config.getMappedResources();
- if(res != null) {
+ IResource[] mappedResources = config.getMappedResources();
+ if(mappedResources != null) {
IProject proj;
- for (int i = 0; i < res.length; i++) {
- proj = res[i].getProject();
+ for (IResource resource : mappedResources) {
+ proj = resource.getProject();
if(proj != null && proj.isAccessible()) {
return proj.getFullPath().toOSString();
}
@@ -707,56 +639,47 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
updateLaunchInBackground(configuration);
updateEncoding(configuration);
updateConsoleOutput(configuration);
+
+ boolean terminateDescendants = getAttribute(configuration, DebugPlugin.ATTR_TERMINATE_DESCENDANTS, true);
+ fTerminateDescendantsButton.setSelection(terminateDescendants);
}
- /**
- * 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;
- boolean mergeOutput = false;
+ /**
+ * Updates the console output form the local configuration
+ * @param configuration the local configuration
+ */
+ private void updateConsoleOutput(ILaunchConfiguration configuration) {
+ boolean outputToConsole = getAttribute(configuration, IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
+ String stdinFromFile = getAttribute(configuration, IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, (String) null);
+ String outputFile = getAttribute(configuration, IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String) null);
+ boolean append = getAttribute(configuration, IDebugUIConstants.ATTR_APPEND_TO_FILE, false);
+ boolean mergeOutput = getAttribute(configuration, DebugPlugin.ATTR_MERGE_OUTPUT, false);
boolean supportsMergeOutput = false;
-
- 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);
- mergeOutput = configuration.getAttribute(DebugPlugin.ATTR_MERGE_OUTPUT, false);
+ try {
supportsMergeOutput = configuration.getType().supportsOutputMerging();
- } catch (CoreException e) {
- }
+ } catch (CoreException e) {
+ }
fConsoleOutput.setSelection(outputToConsole);
- fAppend.setSelection(append);
+ fAppend.setSelection(append);
if (supportsMergeOutput) {
fMergeOutput = createCheckButton(fIoComposit, LaunchConfigurationsMessages.CommonTab_21);
GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
gd.horizontalSpan = 5;
fMergeOutput.setLayoutData(gd);
- fMergeOutput.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
+ fMergeOutput.addSelectionListener(widgetSelectedAdapter(e -> updateLaunchConfigurationDialog()));
fMergeOutput.setSelection(mergeOutput);
}
else if (fMergeOutput != null) {
fMergeOutput.dispose();
fMergeOutput = null;
}
- boolean haveOutputFile= outputFile != null;
- if (haveOutputFile) {
- fFileText.setText(outputFile);
- }
- fFileOutput.setSelection(haveOutputFile);
- enableOuputCaptureWidgets(haveOutputFile);
+ boolean haveOutputFile= outputFile != null;
+ if (haveOutputFile) {
+ fFileText.setText(outputFile);
+ }
+ fFileOutput.setSelection(haveOutputFile);
+ enableOuputCaptureWidgets(haveOutputFile);
boolean haveInputFile = stdinFromFile != null;
if (haveInputFile) {
@@ -764,13 +687,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));
}
@@ -779,24 +702,20 @@ 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);
- 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);
- }
+ String encoding = getAttribute(configuration, DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null);
+ String defaultEncoding = getDefaultEncoding(configuration);
+ fDefaultEncodingButton.setText(MessageFormat.format(LaunchConfigurationsMessages.CommonTab_2, 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);
+ }
}
/**
@@ -806,13 +725,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
* @return whether the configuration is configured to launch in the background
*/
public static boolean isLaunchInBackground(ILaunchConfiguration configuration) {
- boolean launchInBackground= true;
- try {
- launchInBackground= configuration.getAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
- } catch (CoreException ce) {
- DebugUIPlugin.log(ce);
- }
- return launchInBackground;
+ return getAttribute(configuration, IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
}
/**
@@ -823,29 +736,26 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
private void updateFavoritesFromConfig(ILaunchConfiguration config) {
fFavoritesTable.setInput(config);
fFavoritesTable.setCheckedElements(new Object[]{});
- try {
- List<String> groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<String>());
- if (groups.isEmpty()) {
- // check old attributes for backwards compatible
- if (config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) {
- groups.add(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
- }
- if (config.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false)) {
- groups.add(IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
- }
+ List<String> groups = getAttribute(config, IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<>());
+
+ if (groups.isEmpty()) {
+ // check old attributes for backwards compatible
+ if (getAttribute(config, IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) {
+ groups.add(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
}
- if (!groups.isEmpty()) {
- List<LaunchGroupExtension> list = new ArrayList<>();
- for (String id : groups) {
- LaunchGroupExtension extension = getLaunchConfigurationManager().getLaunchGroup(id);
- if (extension != null) {
- list.add(extension);
- }
+ if (getAttribute(config, IDebugUIConstants.ATTR_RUN_FAVORITE, false)) {
+ groups.add(IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
+ }
+ }
+ if (!groups.isEmpty()) {
+ List<LaunchGroupExtension> list = new ArrayList<>();
+ for (String id : groups) {
+ LaunchGroupExtension extension = getLaunchConfigurationManager().getLaunchGroup(id);
+ if (extension != null) {
+ list.add(extension);
}
- fFavoritesTable.setCheckedElements(list.toArray());
}
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
+ fFavoritesTable.setCheckedElements(list.toArray());
}
}
@@ -887,49 +797,72 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
*/
@SuppressWarnings("deprecation")
private void updateConfigFromFavorites(ILaunchConfigurationWorkingCopy config) {
- try {
- Object[] checked = fFavoritesTable.getCheckedElements();
- boolean debug = config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false);
- boolean run = config.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false);
- if (debug || run) {
- // old attributes
- List<LaunchGroupExtension> groups = new ArrayList<>();
- int num = 0;
- if (debug) {
- groups.add(getLaunchConfigurationManager().getLaunchGroup(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP));
- num++;
- }
- if (run) {
- num++;
- groups.add(getLaunchConfigurationManager().getLaunchGroup(IDebugUIConstants.ID_RUN_LAUNCH_GROUP));
- }
- // see if there are any changes
- if (num == checked.length) {
- boolean different = false;
- for (int i = 0; i < checked.length; i++) {
- if (!groups.contains(checked[i])) {
- different = true;
- break;
- }
- }
- if (!different) {
- return;
+ Object[] checked = fFavoritesTable.getCheckedElements();
+ boolean debug = getAttribute(config, IDebugUIConstants.ATTR_DEBUG_FAVORITE, false);
+ boolean run = getAttribute(config, IDebugUIConstants.ATTR_RUN_FAVORITE, false);
+ if (debug || run) {
+ // old attributes
+ List<LaunchGroupExtension> groups = new ArrayList<>();
+ int num = 0;
+ if (debug) {
+ groups.add(getLaunchConfigurationManager().getLaunchGroup(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP));
+ num++;
+ }
+ if (run) {
+ num++;
+ groups.add(getLaunchConfigurationManager().getLaunchGroup(IDebugUIConstants.ID_RUN_LAUNCH_GROUP));
+ }
+ // see if there are any changes
+ if (num == checked.length) {
+ boolean different = false;
+ for (Object checked1 : checked) {
+ if (!groups.contains(checked1)) {
+ different = true;
+ break;
}
}
- }
- config.setAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, (String)null);
- config.setAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, (String)null);
- List<String> groups = null;
- for (int i = 0; i < checked.length; i++) {
- LaunchGroupExtension group = (LaunchGroupExtension)checked[i];
- if (groups == null) {
- groups = new ArrayList<>();
+ if (!different) {
+ return;
}
- groups.add(group.getIdentifier());
}
- config.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, groups);
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
+ }
+ config.setAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, (String) null);
+ config.setAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, (String) null);
+ List<String> groups = null;
+ for (Object c : checked) {
+ LaunchGroupExtension group = (LaunchGroupExtension) c;
+ if (groups == null) {
+ groups = new ArrayList<>();
+ }
+ groups.add(group.getIdentifier());
+ }
+ config.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, groups);
+ }
+
+ private static boolean getAttribute(ILaunchConfiguration config, String attribute, boolean defaultValue) {
+ try {
+ return config.getAttribute(attribute, defaultValue);
+ } catch (CoreException ce) {
+ DebugUIPlugin.log(ce);
+ return defaultValue;
+ }
+ }
+
+ private static String getAttribute(ILaunchConfiguration config, String attribute, String defaultValue) {
+ try {
+ return config.getAttribute(attribute, defaultValue);
+ } catch (CoreException ce) {
+ DebugUIPlugin.log(ce);
+ return defaultValue;
+ }
+ }
+
+ private static List<String> getAttribute(ILaunchConfiguration config, String attribute, List<String> defaultValue) {
+ try {
+ return config.getAttribute(attribute, defaultValue);
+ } catch (CoreException ce) {
+ DebugUIPlugin.log(ce);
+ return defaultValue;
}
}
@@ -949,42 +882,39 @@ 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() && fEncodingCombo.getSelectionIndex() == -1
+ && !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);
@@ -1025,18 +955,24 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
updateConfigFromLocalShared(configuration);
updateConfigFromFavorites(configuration);
- setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, configuration, fLaunchInBackgroundButton.getSelection(), true);
+
+ boolean launchInBackground = fLaunchInBackgroundButton.getSelection();
+ setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, configuration, launchInBackground, true);
+
+ boolean terminateDescendants = fTerminateDescendantsButton.getSelection();
+ setAttribute(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, configuration, terminateDescendants, 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());
@@ -1044,16 +980,16 @@ 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 (fMergeOutput != null) {
if (fMergeOutput.getSelection()) {
@@ -1064,9 +1000,9 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
}
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);
}
}
@@ -1113,6 +1049,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
getAttributesLabelsForPrototype().put(IDebugUIConstants.ATTR_APPEND_TO_FILE, LaunchConfigurationsMessages.CommonTab_AttributeLabel_AppendToFile);
getAttributesLabelsForPrototype().put(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, LaunchConfigurationsMessages.CommonTab_AttributeLabel_LaunchInBackground);
getAttributesLabelsForPrototype().put(IDebugUIConstants.ATTR_FAVORITE_GROUPS, LaunchConfigurationsMessages.CommonTab_AttributeLabel_FavoriteGroups);
+ getAttributesLabelsForPrototype().put(DebugPlugin.ATTR_TERMINATE_DESCENDANTS, LaunchConfigurationsMessages.CommonTab_AttributeLabel_TerminateDescendants);
}
/**
@@ -1125,8 +1062,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
ILaunchGroup[] groups = DebugUITools.getLaunchGroups();
List<ILaunchGroup> possibleGroups = new ArrayList<>();
ILaunchConfiguration configuration = (ILaunchConfiguration)inputElement;
- for (int i = 0; i < groups.length; i++) {
- ILaunchGroup extension = groups[i];
+ for (ILaunchGroup extension : groups) {
LaunchHistory history = getLaunchConfigurationManager().getLaunchHistory(extension.getIdentifier());
if (history != null && history.accepts(configuration)) {
possibleGroups.add(extension);
@@ -1153,15 +1089,10 @@ public class CommonTab extends AbstractLaunchConfigurationTab {
@Override
public Image getColumnImage(Object element, int columnIndex) {
- Image image = fImages.get(element);
- if (image == null) {
- ImageDescriptor descriptor = ((LaunchGroupExtension)element).getImageDescriptor();
- if (descriptor != null) {
- image = descriptor.createImage();
- fImages.put(element, image);
- }
- }
- return image;
+ return fImages.computeIfAbsent(element, e -> {
+ ImageDescriptor descriptor = ((LaunchGroupExtension) e).getImageDescriptor();
+ return descriptor != null ? descriptor.createImage() : null;
+ });
}
@Override
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 d939d751d..d8afa766d 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
@@ -13,11 +13,12 @@
*******************************************************************************/
package org.eclipse.debug.ui;
+import java.text.MessageFormat;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.PopupDialog;
@@ -31,8 +32,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.keys.IBindingService;
-
-import com.ibm.icu.text.MessageFormat;
+import org.osgi.framework.FrameworkUtil;
/**
* A <code>PopupDialog</code> that is automatically positioned relative
@@ -171,8 +171,7 @@ public abstract class DebugPopup extends PopupDialog {
@Override
protected IDialogSettings getDialogSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
- return settings;
+ return PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(DebugPopup.class)).getDialogSettings();
}
@Override
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 886f32ef6..f5e1e6f17 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,7 +16,6 @@ package org.eclipse.debug.ui;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -29,6 +28,7 @@ import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.commands.operations.ObjectUndoContext;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -73,6 +73,7 @@ import org.eclipse.debug.internal.ui.memory.MemoryRenderingManager;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIUtils;
import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager;
+import org.eclipse.debug.internal.ui.views.breakpoints.DeleteBreakpointMarkersOperation;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetManager;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextManager;
@@ -102,7 +103,6 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.undo.DeleteMarkersOperation;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
@@ -220,11 +220,9 @@ public class DebugUITools {
IExtensionPoint point= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.ID_DEBUG_MODEL_PRESENTATION);
if (point != null) {
IExtension[] extensions= point.getExtensions();
- for (int i= 0; i < extensions.length; i++) {
- IExtension extension= extensions[i];
+ for (IExtension extension : extensions) {
IConfigurationElement[] configElements= extension.getConfigurationElements();
- for (int j= 0; j < configElements.length; j++) {
- IConfigurationElement elt= configElements[j];
+ for (IConfigurationElement elt : configElements) {
String id= elt.getAttribute("id"); //$NON-NLS-1$
if (id != null && id.equals(identifier)) {
return new LazyModelPresentation(elt);
@@ -304,6 +302,13 @@ public class DebugUITools {
* @since 3.7
*/
public static void deleteBreakpoints(IBreakpoint[] breakpoints, final Shell shell, IProgressMonitor progressMonitor) throws CoreException {
+ if (breakpoints.length == 0) {
+ // Note: this is not only a small performance optimization but also the fix for
+ // bug 344352. When removing no breakpoints the DeleteMarkersOperation will show
+ // an error dialog about missing markers.
+ return;
+ }
+
IMarker[] markers= new IMarker[breakpoints.length];
int markerCount;
for (markerCount= 0; markerCount < breakpoints.length; markerCount++) {
@@ -322,11 +327,6 @@ public class DebugUITools {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoints(breakpoints, !allowUndo);
if (allowUndo) {
-
- for (int i= 0; i < markers.length; i++) {
- markers[i].setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, true);
- }
-
IAdaptable context= null;
if (shell != null) {
context= new IAdaptable() {
@@ -342,7 +342,7 @@ public class DebugUITools {
}
String operationName= markers.length == 1 ? ActionMessages.DeleteBreakpointOperationName : ActionMessages.DeleteBreakpointsOperationName;
- IUndoableOperation deleteMarkerOperation= new DeleteMarkersOperation(markers, operationName);
+ IUndoableOperation deleteMarkerOperation = new DeleteBreakpointMarkersOperation(markers, operationName);
deleteMarkerOperation.removeContext(WorkspaceUndoUtil.getWorkspaceUndoContext());
deleteMarkerOperation.addContext(DebugUITools.getBreakpointsUndoContext());
IOperationHistory operationHistory= PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
@@ -537,8 +537,7 @@ public class DebugUITools {
@Deprecated
public static int openLaunchConfigurationDialog(Shell shell, IStructuredSelection selection, String mode) {
ILaunchGroup[] groups = getLaunchGroups();
- for (int i = 0; i < groups.length; i++) {
- ILaunchGroup group = groups[i];
+ for (ILaunchGroup group : groups) {
if (group.getMode().equals(mode) && group.getCategory() == null) {
return openLaunchConfigurationDialogOnGroup(shell, selection, group.getIdentifier());
}
@@ -859,8 +858,7 @@ public class DebugUITools {
try {
IResource[] configResource = iLaunch.getLaunchConfiguration().getMappedResources();
if (configResource != null && configResource.length == 1) {
- for (Iterator<Object> iter = fgLaunchToggleTerminateMap.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
+ for (Object key : fgLaunchToggleTerminateMap.keySet()) {
if (key instanceof IEditorPart) {
IEditorInput input = ((IEditorPart) key).getEditorInput();
if (input.getAdapter(IResource.class).equals(configResource[0])) {
@@ -871,7 +869,7 @@ public class DebugUITools {
TreePath[] treePath = selection.getPaths();
if (treePath != null && treePath.length == 1) {
Object lastSegmentObj = treePath[0].getLastSegment();
- IResource selectedResource = ((IAdaptable) lastSegmentObj).getAdapter(IResource.class);
+ IResource selectedResource = Adapters.adapt(lastSegmentObj, IResource.class);
if (selectedResource!= null && selectedResource.equals(configResource[0])) {
return isShiftTerminateLaunch(key);
}
@@ -879,8 +877,7 @@ public class DebugUITools {
}
}
} else {
- for (Iterator<Object> iter = fgLaunchToggleTerminateMap.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
+ for (Object key : fgLaunchToggleTerminateMap.keySet()) {
if (key instanceof IStructuredSelection) {
Object toggleValue = getToggleTerminateValue(key);
if (toggleValue instanceof TerminateToggleValue) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java
index b83d7bbe5..966500e90 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java
@@ -18,6 +18,7 @@
*******************************************************************************/
package org.eclipse.debug.ui;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -63,7 +64,6 @@ import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -88,8 +88,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
@@ -98,8 +96,6 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.PlatformUI;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Launch configuration tab for configuring the environment passed into
* Runtime.exec(...) when a config is launched.
@@ -314,12 +310,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
environmentTable.setContentProvider(new EnvironmentVariableContentProvider());
environmentTable.setLabelProvider(new EnvironmentVariableLabelProvider());
environmentTable.setColumnProperties(new String[] { P_VARIABLE, P_VALUE });
- environmentTable.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- handleTableSelectionChanged(event);
- }
- });
+ environmentTable.addSelectionChangedListener(this::handleTableSelectionChanged);
// Setup right-click context menu
Menu menuTable = new Menu(table);
@@ -367,29 +358,23 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
}
});
- environmentTable.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = environmentTable.getStructuredSelection();
- if (selection.size() == 1) {
- miRemove.setText(LaunchConfigurationsMessages.EnvironmentTab_Remove_6);
- } else if (selection.size() > 1) {
- miRemove.setText(LaunchConfigurationsMessages.EnvironmentTab_Remove_All);
- }
+ environmentTable.addSelectionChangedListener(event -> {
+ IStructuredSelection selection = environmentTable.getStructuredSelection();
+ if (selection.size() == 1) {
+ miRemove.setText(LaunchConfigurationsMessages.EnvironmentTab_Remove_6);
+ } else if (selection.size() > 1) {
+ miRemove.setText(LaunchConfigurationsMessages.EnvironmentTab_Remove_All);
}
});
// Disable certain context menu item's if no table item is selected
- table.addListener(SWT.MenuDetect, new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (table.getSelectionCount() <= 0) {
- miRemove.setEnabled(false);
- miCopy.setEnabled(false);
- } else {
- miRemove.setEnabled(true);
- miCopy.setEnabled(true);
- }
+ table.addListener(SWT.MenuDetect, event -> {
+ if (table.getSelectionCount() <= 0) {
+ miRemove.setEnabled(false);
+ miCopy.setEnabled(false);
+ } else {
+ miRemove.setEnabled(true);
+ miCopy.setEnabled(true);
}
});
@@ -412,12 +397,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
// Setup environment variable name column
final TableViewerColumn tcv1 = new TableViewerColumn(environmentTable, SWT.NONE, 0);
- tcv1.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- return ((EnvironmentVariable) element).getName();
- }
- });
+ tcv1.setLabelProvider(
+ ColumnLabelProvider.createTextProvider(element -> ((EnvironmentVariable) element).getName()));
TableColumn tc1 = tcv1.getColumn();
tc1.setText(envTableColumnHeaders[0]);
@@ -438,12 +419,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
// Setup environment variable value column
final TableViewerColumn tcv2 = new TableViewerColumn(environmentTable, SWT.NONE, 1);
- tcv2.setLabelProvider(new ColumnLabelProvider() {
- @Override
- public String getText(Object element) {
- return ((EnvironmentVariable) element).getValue();
- }
- });
+ tcv2.setLabelProvider(
+ ColumnLabelProvider.createTextProvider(element -> ((EnvironmentVariable) element).getValue()));
TableColumn tc2 = tcv2.getColumn();
tc2.setText(envTableColumnHeaders[1]);
@@ -579,9 +556,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
* @return whether the new name should be used or not
*/
private boolean canRenameVariable(String newVariableName) {
- TableItem[] items = environmentTable.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- EnvironmentVariable existingVariable = (EnvironmentVariable) items[i].getData();
+ for (TableItem item : environmentTable.getTable().getItems()) {
+ EnvironmentVariable existingVariable = (EnvironmentVariable) item.getData();
if (existingVariable.getName().equals(newVariableName)) {
boolean overWrite = MessageDialog.openQuestion(getShell(),
@@ -608,8 +584,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
protected boolean addVariable(EnvironmentVariable variable) {
String name = variable.getName();
TableItem[] items = environmentTable.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- EnvironmentVariable existingVariable = (EnvironmentVariable) items[i].getData();
+ for (TableItem item : items) {
+ EnvironmentVariable existingVariable = (EnvironmentVariable) item.getData();
if (existingVariable.getName().equals(name)) {
boolean overWrite = MessageDialog.openQuestion(getShell(),
@@ -685,8 +661,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
// get Environment Variables from the table
TableItem[] items = environmentTable.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
+ for (TableItem item : items) {
+ EnvironmentVariable var = (EnvironmentVariable) item.getData();
envVariables.remove(var.getName());
}
@@ -696,8 +672,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
int button = dialog.open();
if (button == Window.OK) {
Object[] selected = dialog.getResult();
- for (int i = 0; i < selected.length; i++) {
- environmentTable.add(selected[i]);
+ for (Object o : selected) {
+ environmentTable.add(o);
}
}
@@ -735,7 +711,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
MultipleInputDialog dialog = new MultipleInputDialog(getShell(),
LaunchConfigurationsMessages.EnvironmentTab_11);
dialog.addTextField(NAME_LABEL, originalName, false);
- if (value != null && value.contains(System.getProperty("line.separator"))) { //$NON-NLS-1$
+ if (value != null && value.contains(System.lineSeparator())) {
dialog.addMultilinedVariablesField(VALUE_LABEL, value, true);
} else {
dialog.addVariablesField(VALUE_LABEL, value, true);
@@ -883,8 +859,8 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
// configuration's attributes.
TableItem[] items = environmentTable.getTable().getItems();
Map<String, String> map = new HashMap<>(items.length);
- for (int i = 0; i < items.length; i++) {
- EnvironmentVariable var = (EnvironmentVariable) items[i].getData();
+ for (TableItem item : items) {
+ EnvironmentVariable var = (EnvironmentVariable) item.getData();
map.put(var.getName(), var.getValue());
}
if (map.isEmpty()) {
@@ -1037,13 +1013,10 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab {
public Object[] getElements(Object inputElement) {
EnvironmentVariable[] elements = null;
if (inputElement instanceof HashMap) {
- Comparator<Object> comparator = new Comparator<Object>() {
- @Override
- public int compare(Object o1, Object o2) {
- String s1 = (String) o1;
- String s2 = (String) o2;
- return s1.compareTo(s2);
- }
+ Comparator<Object> comparator = (o1, o2) -> {
+ String s1 = (String) o1;
+ String s2 = (String) o2;
+ return s1.compareTo(s2);
};
TreeMap<Object, Object> envVars = new TreeMap<>(comparator);
envVars.putAll((Map<?, ?>) inputElement);
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 1fd65d468..208e033e8 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
@@ -966,9 +966,8 @@ public interface IDebugUIConstants {
String ATTR_CAPTURE_IN_CONSOLE = PLUGIN_ID + ".ATTR_CONSOLE_OUTPUT_ON"; //$NON-NLS-1$
/**
- * Launch configuration boolean attribute specifying whether input for the
- * launched process will be captured from file. Default value is
- * <code>null</code>.
+ * Launch configuration attribute to specifying a file whose content is supplied
+ * to the launched process input stream. Default value is <code>null</code>.
*
* @since 3.11
*/
@@ -1281,6 +1280,13 @@ public interface IDebugUIConstants {
String PREF_DETAIL_PANE_FONT= "org.eclipse.debug.ui.DetailPaneFont"; //$NON-NLS-1$
/**
+ * Preference to enable variable view inline on text editors.
+ *
+ * @since 3.16
+ */
+ String PREF_SHOW_VARIABLES_INLINE = "org.eclipse.debug.ui.ShowVariableInline"; //$NON-NLS-1$
+
+ /**
* Instruction pointer image for editor ruler for the currently executing
* instruction in the top stack frame.
*
@@ -1348,4 +1354,5 @@ public interface IDebugUIConstants {
* @since 3.8
*/
String COLUMN_ID_VARIABLE_VALUE_TYPE = COLUMN_PRESENTATION_ID_VARIABLE + ".COL_VALUE_TYPE"; //$NON-NLS-1$
+
}
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 244d2d55f..f49774165 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
@@ -110,9 +110,7 @@ public class InspectPopupDialog extends DebugPopup {
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];
+ for (String key : copy.getProperties()) {
fContext.setProperty(key, copy.getProperty(key));
}
}
@@ -140,9 +138,8 @@ public class InspectPopupDialog extends DebugPopup {
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]);
+ for (ViewerFilter filter : structuredViewer.getFilters()) {
+ fViewer.addFilter(filter);
}
}
}
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 8db2295f0..e2f8c1dc1 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
@@ -49,6 +49,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.osgi.framework.FrameworkUtil;
/**
* A dialog that prompts the user to choose and configure a string
@@ -183,13 +184,13 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
ArrayList<Object> filtered = new ArrayList<>();
filtered.addAll(Arrays.asList(elements));
if(!fFilters.isEmpty() && !fShowAllSelected) {
- for (int i = 0; i < elements.length; i++) {
- if(elements[i] instanceof IDynamicVariable) {
+ for (Object element : elements) {
+ if (element instanceof IDynamicVariable) {
boolean bFiltered = false;
for (int j = 0; (j < fFilters.size()) && !bFiltered; j++) {
VariableFilter filter = fFilters.get(j);
- if(filter.isFiltered((IDynamicVariable)elements[i])) {
- filtered.remove(elements[i]);
+ if (filter.isFiltered((IDynamicVariable) element)) {
+ filtered.remove(element);
bFiltered = true;
}
}
@@ -387,7 +388,9 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog {
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(StringVariableSelectionDialog.class))
+ .getDialogSettings();
IDialogSettings section = settings.getSection(getDialogSettingsSectionName());
if (section == null) {
section = settings.addNewSection(getDialogSettingsSectionName());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java
index d0fc7c389..f68a5a13d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java
@@ -14,9 +14,11 @@
package org.eclipse.debug.ui.actions;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.CompletableFuture;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -51,6 +53,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MenuAdapter;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
@@ -58,8 +61,6 @@ import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Abstract implementation of an action that displays a drop-down launch
* history for a specific launch group.
@@ -181,8 +182,8 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I
*/
private boolean existsConfigTypesForMode() {
ILaunchConfigurationType[] configTypes = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes();
- for (int i = 0; i < configTypes.length; i++) {
- if (configTypes[i].supportsMode(getMode())) {
+ for (ILaunchConfigurationType configType : configTypes) {
+ if (configType.supportsMode(getMode())) {
return true;
}
}
@@ -198,7 +199,10 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I
* </p>
*/
protected void updateTooltip() {
- getAction().setToolTipText(getToolTip());
+ CompletableFuture.supplyAsync(this::getToolTip)
+ .thenAccept(tooltip ->
+ Display.getDefault().asyncExec(() -> getAction().setToolTipText(tooltip))
+ );
}
/**
@@ -314,8 +318,8 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I
if (fRecreateMenu) {
Menu m = (Menu)e.widget;
MenuItem[] items = m.getItems();
- for (int i=0; i < items.length; i++) {
- items[i].dispose();
+ for (MenuItem item : items) {
+ item.dispose();
}
fillMenu(m);
fRecreateMenu= false;
@@ -347,8 +351,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I
// Add favorites
int accelerator = 1;
- for (int i = 0; i < favoriteList.length; i++) {
- ILaunchConfiguration launch= favoriteList[i];
+ for (ILaunchConfiguration launch : favoriteList) {
LaunchAction action= new LaunchAction(launch, getMode());
addToMenu(menu, action, accelerator);
accelerator++;
@@ -360,8 +363,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I
}
// Add history launches next
- for (int i = 0; i < historyList.length; i++) {
- ILaunchConfiguration launch= historyList[i];
+ for (ILaunchConfiguration launch : historyList) {
LaunchAction action= new LaunchAction(launch, getMode());
addToMenu(menu, action, accelerator);
accelerator++;
@@ -423,7 +425,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I
/**
* @since 3.12
*/
- protected void runInternal(IAction action, boolean isShift) {
+ protected void runInternal(IAction action, @SuppressWarnings("unused") boolean isShift) {
run(action);
}
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 30eba5386..2abcd920a 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
@@ -118,8 +118,8 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
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();
+ for (MenuItem item : items) {
+ item.dispose();
}
fillMenu(m);
}
@@ -133,9 +133,8 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct
{
IMemoryRenderingType[] types = fActionDelegate.getMemoryRenderingTypes(fPart, fCurrentSelection);
- for (int i=0; i<types.length; i++)
- {
- AddMemoryRenderingAction action = new AddMemoryRenderingAction(types[i]);
+ for (IMemoryRenderingType type : types) {
+ AddMemoryRenderingAction action = new AddMemoryRenderingAction(type);
ActionContributionItem item = new ActionContributionItem(action);
item.fill(parent, -1);
}
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 a763267c5..f3a9da714 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
@@ -86,8 +86,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I
fMode = mode;
ILaunchGroup[] groups = DebugUITools.getLaunchGroups();
fGroupsByCategory = new HashMap<>(3);
- for (int i = 0; i < groups.length; i++) {
- ILaunchGroup group = groups[i];
+ for (ILaunchGroup group : groups) {
if (group.getMode().equals(mode)) {
if (group.getCategory() == null) {
fGroup = group;
@@ -132,8 +131,8 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I
if (fFillMenu) {
Menu m = (Menu)e.widget;
MenuItem[] items = m.getItems();
- for (int i=0; i < items.length; i++) {
- items[i].dispose();
+ for (MenuItem item : items) {
+ item.dispose();
}
fillMenu(m);
fFillMenu = false;
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 c3ce545d2..528fe429e 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
@@ -16,7 +16,6 @@ package org.eclipse.debug.ui.actions;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.internal.ui.commands.actions.DebugCommandService;
-import org.eclipse.debug.internal.ui.commands.actions.ICommandParticipant;
import org.eclipse.debug.internal.ui.commands.actions.IEnabledTarget;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
@@ -82,12 +81,7 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
*/
private IAction fAction;
- private IEnabledTarget fEnabledTarget = new IEnabledTarget() {
- @Override
- public void setEnabled(boolean enabled) {
- DebugCommandAction.this.setEnabled(enabled);
- }
- };
+ private IEnabledTarget fEnabledTarget = DebugCommandAction.this::setEnabled;
/**
* Constructor
@@ -122,12 +116,7 @@ public abstract class DebugCommandAction extends Action implements IDebugContext
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);
- }
- });
+ request -> DebugCommandAction.this.postExecute(request, targets));
}
/**
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 442bbc396..973128ba6 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
@@ -25,7 +25,6 @@ import org.eclipse.core.commands.HandlerEvent;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.internal.ui.commands.actions.DebugCommandService;
-import org.eclipse.debug.internal.ui.commands.actions.ICommandParticipant;
import org.eclipse.debug.internal.ui.commands.actions.IEnabledTarget;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
@@ -228,12 +227,7 @@ public abstract class DebugCommandHandler extends AbstractHandler {
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);
- }
- });
+ request -> DebugCommandHandler.this.postExecute(request, targets));
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java
index 9d26718bf..40ad4cfb5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java
@@ -21,6 +21,7 @@ import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
+import java.text.MessageFormat;
import java.util.Map.Entry;
import org.eclipse.core.resources.IMarker;
@@ -41,8 +42,6 @@ import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.XMLMemento;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Exports breakpoints to a file or string buffer.
* <p>
@@ -90,11 +89,10 @@ public class ExportBreakpointsOperation implements IRunnableWithProgress {
SubMonitor localmonitor = SubMonitor.convert(monitor, ImportExportMessages.ExportOperation_0, fBreakpoints.length);
XMLMemento memento = XMLMemento.createWriteRoot(IImportExportConstants.IE_NODE_BREAKPOINTS);
try (Writer writer = fWriter) {
- for (int i = 0; i < fBreakpoints.length; i++) {
+ for (IBreakpoint breakpoint : fBreakpoints) {
if (localmonitor.isCanceled()) {
return;
}
- IBreakpoint breakpoint = fBreakpoints[i];
//in the event we are in working set view, we can have multiple selection of the same breakpoint
//so do a simple check for it
IMarker marker = breakpoint.getMarker();
@@ -170,10 +168,9 @@ public class ExportBreakpointsOperation implements IRunnableWithProgress {
IWorkingSetManager mgr = PlatformUI.getWorkbench().getWorkingSetManager();
StringBuilder buffer = new StringBuilder();
IWorkingSet[] sets = mgr.getWorkingSets();
- for (int i = 0; i < sets.length; i++) {
- if(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(sets[i].getId()) &&
- containsBreakpoint(sets[i], breakpoint)) {
- buffer.append(IImportExportConstants.DELIMITER).append(sets[i].getName());
+ for (IWorkingSet set : sets) {
+ if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId()) && containsBreakpoint(set, breakpoint)) {
+ buffer.append(IImportExportConstants.DELIMITER).append(set.getName());
}
}
return buffer.toString();
@@ -188,8 +185,8 @@ public class ExportBreakpointsOperation implements IRunnableWithProgress {
*/
private boolean containsBreakpoint(IWorkingSet set, IBreakpoint breakpoint) {
IAdaptable[] elements = set.getElements();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i].equals(breakpoint)) {
+ for (IAdaptable element : elements) {
+ if (element.equals(breakpoint)) {
return true;
}
}
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 945cc6422..a01b70189 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
@@ -23,6 +23,7 @@ import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -53,8 +54,6 @@ import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.XMLMemento;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Imports breakpoints from a file or string buffer into the workspace.
* <p>
@@ -183,11 +182,11 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
localmonitor.setWorkRemaining(nodes.length);
Map<String, Object> attributes = null;
IBreakpointImportParticipant[] participants = null;
- for(int i = 0; i < nodes.length; i++) {
+ for (IMemento node : nodes) {
if(localmonitor.isCanceled()) {
return;
}
- attributes = collectBreakpointProperties(nodes[i]);
+ attributes = collectBreakpointProperties(node);
if(attributes == null) {
continue;
}
@@ -197,7 +196,6 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
} else {
resource = workspace;
}
-
// filter resource breakpoints that do not exist in this workspace
if(resource != null) {
try {
@@ -245,14 +243,13 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
*/
protected IMarker findExistingMarker(Map<String, Object> attributes, IBreakpointImportParticipant[] participants) {
IBreakpoint[] bps = fManager.getBreakpoints();
- for(int i = 0; i < bps.length; i++) {
- for(int j = 0; j < participants.length; j++) {
+ for (IBreakpoint bp : bps) {
+ for (IBreakpointImportParticipant participant : participants) {
try {
- if(participants[j].matches(attributes, bps[i])) {
- return bps[i].getMarker();
+ if (participant.matches(attributes, bp)) {
+ return bp.getMarker();
}
- }
- catch(CoreException ce) {}
+ }catch(CoreException ce) {}
}
}
return null;
@@ -285,8 +282,8 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
//copy all the marker attributes to the map
IMemento[] children = child.getChildren(IImportExportConstants.IE_NODE_ATTRIB);
- for(int i = 0; i < children.length; i++) {
- readAttribute(children[i], map);
+ for (IMemento c : children) {
+ readAttribute(c, map);
}
//collect attributes from the 'resource' node
@@ -349,8 +346,8 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
updateWorkingSets(names, breakpoint);
}
if(participants != null) {
- for(int i = 0; i < participants.length; i++) {
- participants[i].verify(breakpoint);
+ for (IBreakpointImportParticipant participant : participants) {
+ participant.verify(breakpoint);
}
}
}
@@ -376,14 +373,14 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
IWorkingSetManager mgr = PlatformUI.getWorkbench().getWorkingSetManager();
ArrayList<IWorkingSet> sets = new ArrayList<>();
collectContainingWorkingsets(breakpoint, sets);
- for (int i = 0; i < wsnames.length; i++) {
- if("".equals(wsnames[i])) { //$NON-NLS-1$
+ for (String wsname : wsnames) {
+ if ("".equals(wsname)) { //$NON-NLS-1$
continue;
}
- IWorkingSet set = mgr.getWorkingSet(wsnames[i]);
- if(set == null) {
+ IWorkingSet set = mgr.getWorkingSet(wsname);
+ if (set == null) {
//create working set
- set = mgr.createWorkingSet(wsnames[i], new IAdaptable[] {});
+ set = mgr.createWorkingSet(wsname, new IAdaptable[] {});
set.setId(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID);
mgr.addWorkingSet(set);
}
@@ -416,10 +413,9 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
private void collectContainingWorkingsets(IBreakpoint breakpoint, List<IWorkingSet> collector) {
IWorkingSetManager mgr = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet[] sets = mgr.getWorkingSets();
- for (int i = 0; i < sets.length; i++) {
- if(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(sets[i].getId()) &&
- containsBreakpoint(sets[i], breakpoint)) {
- collector.add(sets[i]);
+ for (IWorkingSet set : sets) {
+ if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId()) && containsBreakpoint(set, breakpoint)) {
+ collector.add(set);
}
}
}
@@ -432,8 +428,8 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress {
*/
private boolean containsBreakpoint(IWorkingSet set, IBreakpoint breakpoint) {
IAdaptable[] elements = set.getElements();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i].equals(breakpoint)) {
+ for (IAdaptable element : elements) {
+ if (element.equals(breakpoint)) {
return true;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java
index 1e010a204..41c5cb3ed 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java
@@ -14,6 +14,7 @@
package org.eclipse.debug.ui.actions;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Set;
@@ -36,8 +37,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.PlatformUI;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Launches a launch configuration in a specific mode.
* <p>
@@ -143,12 +142,12 @@ public class LaunchAction extends Action {
*/
private void removeFromLaunchHistories(ILaunchConfiguration config, ILaunchGroup[] groups) {
LaunchHistory history = null;
- for(int i = 0; i < groups.length; i++) {
- history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(groups[i].getIdentifier());
- if(history != null) {
+ for (ILaunchGroup group : groups) {
+ history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(group.getIdentifier());
+ if (history != null) {
history.removeFromHistory(fConfiguration);
} else {
- DebugUIPlugin.logErrorMessage(MessageFormat.format("Unable to remove configuration [{0}] from launch history. The launch history for mode [{1}] does not exist.", new Object[] { config.getName(), groups[i].getMode() })); //$NON-NLS-1$
+ DebugUIPlugin.logErrorMessage(MessageFormat.format("Unable to remove configuration [{0}] from launch history. The launch history for mode [{1}] does not exist.", new Object[]{config.getName(), group.getMode()})); //$NON-NLS-1$
}
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java
index b0d800b58..082b7c817 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java
@@ -182,8 +182,8 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi
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();
+ for (MenuItem item : items) {
+ item.dispose();
}
fillMenu();
}
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 17dcd129a..dd9b6994c 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
@@ -275,8 +275,8 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork
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();
+ for (MenuItem item : items) {
+ item.dispose();
}
fillMenu();
}
@@ -335,8 +335,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork
*/
private boolean existsConfigTypesForMode() {
ILaunchConfigurationType[] configTypes = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes();
- for (int i = 0; i < configTypes.length; i++) {
- ILaunchConfigurationType configType = configTypes[i];
+ for (ILaunchConfigurationType configType : configTypes) {
if (configType.supportsMode(getMode())) {
return true;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java
index 9eabdfa9b..b2535ba23 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.ui.actions;
+import java.text.MessageFormat;
+
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -35,8 +37,6 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Opens the launch configuration dialog in the context of a launch group.
* <p>
@@ -115,8 +115,7 @@ public class OpenLaunchDialogAction extends Action implements IActionDelegate2,
*/
private boolean existsConfigTypesForMode() {
ILaunchConfigurationType[] configTypes = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes();
- for (int i = 0; i < configTypes.length; i++) {
- ILaunchConfigurationType configType = configTypes[i];
+ for (ILaunchConfigurationType configType : configTypes) {
if (configType.supportsMode(getMode())) {
return true;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java
index 14ec2c03e..b0fe19821 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java
@@ -15,6 +15,8 @@
package org.eclipse.debug.ui.actions;
+import java.text.MessageFormat;
+
import org.eclipse.core.commands.Command;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -47,8 +49,6 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Re-launches the last launch.
*
@@ -195,8 +195,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega
*/
private boolean existsConfigTypesForMode() {
ILaunchConfigurationType[] configTypes = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes();
- for (int i = 0; i < configTypes.length; i++) {
- ILaunchConfigurationType configType = configTypes[i];
+ for (ILaunchConfigurationType configType : configTypes) {
if (configType.supportsMode(getMode())) {
return true;
}
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 fcf6627e9..60c14b0a9 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
@@ -241,9 +241,8 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate
@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();
+ for (MenuItem item : m.getItems()) {
+ item.dispose();
}
fillMenu(m);
}
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 8a6b7ad75..c1bc665d7 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
@@ -67,8 +67,7 @@ public class RunToLineHandler implements IDebugEventSetListener, IBreakpointMana
@Override
public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event= events[i];
+ for (DebugEvent event : events) {
Object source= event.getSource();
if (source instanceof IThread && event.getKind() == DebugEvent.SUSPEND &&
event.getDetail() == DebugEvent.BREAKPOINT) {
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 5f020524e..ca2d2c969 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
@@ -52,12 +52,7 @@ public class ToggleBreakpointAction extends Action implements IUpdate {
private IWorkbenchPart fPart;
private IDocument fDocument;
private IVerticalRulerInfo fRulerInfo;
- private IToggleBreakpointsTargetManagerListener fListener = new IToggleBreakpointsTargetManagerListener() {
- @Override
- public void preferredTargetsChanged() {
- update();
- }
- };
+ private IToggleBreakpointsTargetManagerListener fListener = this::update;
/**
* Constructs a new action to toggle a breakpoint in the given
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 04cf4febd..897526c27 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
@@ -57,14 +57,15 @@ public class FileLink implements IConsoleHyperlink {
/**
* Constructs a hyperlink to the specified file.
*
- * @param file the file to open when activated
- * @param editorId the identifier of the editor to open the file in, or
- * <code>null</code> if the default editor should be used
- * @param fileOffset the offset in the file to select when activated, or -1
- * @param fileLength the length of text to select in the file when activated
- * or -1
- * @param fileLineNumber the line number to select in the file when
- * activated, or -1
+ * @param file the file to open when activated
+ * @param editorId the identifier of the editor to open the file in, or
+ * <code>null</code> if the default editor should be used
+ * @param fileOffset the offset in the file to select when activated, or -1
+ * @param fileLength the length of text to select in the file when activated
+ * or -1
+ * @param fileLineNumber the line number to select in the file when activated,
+ * or -1. First line number is 1. Only used if
+ * <em>fileOffset</em> is not set.
*/
public FileLink(IFile file, String editorId, int fileOffset, int fileLength, int fileLineNumber) {
fFile = file;
@@ -82,7 +83,7 @@ public class FileLink implements IConsoleHyperlink {
if (page != null) {
try {
IEditorPart editorPart = page.openEditor(new FileEditorInput(fFile), getEditorId() , true);
- if (fFileLineNumber > 0) {
+ if (fFileLineNumber > 0 || (fFileOffset >= 0 && fFileLength >= 0)) {
ITextEditor textEditor = null;
if (editorPart instanceof ITextEditor) {
textEditor = (ITextEditor) editorPart;
@@ -90,8 +91,8 @@ public class FileLink implements IConsoleHyperlink {
textEditor = editorPart.getAdapter(ITextEditor.class);
}
if (textEditor != null) {
- IEditorInput input = editorPart.getEditorInput();
if (fFileOffset < 0) {
+ IEditorInput input = editorPart.getEditorInput();
IDocumentProvider provider = textEditor.getDocumentProvider();
try {
provider.connect(input);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
index 122dab8e1..6d96bedb6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java
@@ -1450,17 +1450,15 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
// clean up old columns
TableColumn[] oldColumns = fTableViewer.getTable().getColumns();
- for (int i=0; i<oldColumns.length; i++)
- {
- oldColumns[i].dispose();
+ for (TableColumn oldColumn : oldColumns) {
+ oldColumn.dispose();
}
// clean up old cell editors
CellEditor[] oldCellEditors = fTableViewer.getCellEditors();
- for (int i=0; i<oldCellEditors.length; i++)
- {
- oldCellEditors[i].dispose();
+ for (CellEditor oldCellEditor : oldCellEditors) {
+ oldCellEditor.dispose();
}
}
@@ -2377,9 +2375,8 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
fTableCursor = null;
// clean up cell editors
- for (int i=0; i<fEditors.length; i++)
- {
- fEditors[i].dispose();
+ for (CellEditor editor : fEditors) {
+ editor.dispose();
}
// remove font change listener when the view tab is disposed
@@ -2751,9 +2748,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
int colNum = -1;
int numCol = fTableViewer.getColumnProperties().length;
- for (int j=0; j<tableItems.length; j++)
- {
- TableItem item = tableItems[j];
+ for (TableItem item : tableItems) {
for (int i=0; i<numCol; i++)
{
Rectangle bound = item.getBounds(i);
@@ -3350,9 +3345,8 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
// check each of the items and find the minimum
TableItem[] items = table.getItems();
int minHeight = table.getItemHeight();
- for (int i=0; i<items.length; i++)
- {
- minHeight = Math.min(items[i].getBounds(0).height, minHeight);
+ for (TableItem item : items) {
+ minHeight = Math.min(item.getBounds(0).height, minHeight);
}
return minHeight;
@@ -3676,14 +3670,12 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering
private TableItem getItem(Point point)
{
TableItem[] items = fTableViewer.getTable().getItems();
- for (int i=0; i<items.length; i++)
- {
- Point start = new Point(items[i].getBounds(0).x, items[i].getBounds(0).y);
+ for (TableItem item : items) {
+ Point start = new Point(item.getBounds(0).x, item.getBounds(0).y);
start = fTableViewer.getTable().toDisplay(start);
- Point end = new Point(start.x + items[i].getBounds(0).width, start.y + items[i].getBounds(0).height);
-
+ Point end = new Point(start.x + item.getBounds(0).width, start.y + item.getBounds(0).height);
if (start.y < point.y && point.y < end.y) {
- return items[i];
+ return item;
}
}
return null;
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 e718db992..709dd4758 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
@@ -269,8 +269,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE
Object artifact = getArtifact();
if (artifact instanceof IDebugElement) {
IDebugElement element = (IDebugElement)artifact;
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
+ for (ILaunch launch : launches) {
if (launch.equals(element.getLaunch())) {
closeEditor();
return;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java
index f0a3ed757..7fee68f8e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.ui.sourcelookup;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages;
@@ -22,8 +24,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
-import com.ibm.icu.text.MessageFormat;
-
/**
* Editor input for the <code>CommonSourceNotFoundEditor</code>. The editor
* input can be created on an artifact that has a source association.
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 92440853b..3aa4351e6 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
@@ -34,6 +34,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.FrameworkUtil;
/**
* A dialog for editing the source lookup path of a
@@ -128,7 +129,8 @@ public class SourceLookupDialog extends TitleAreaDialog {
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = PlatformUI
+ .getDialogSettingsProvider(FrameworkUtil.getBundle(SourceLookupDialog.class)).getDialogSettings();
IDialogSettings section = settings.getSection(getClass().getName());
if (section == null) {
section = settings.addNewSection(getClass().getName());
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java
index 722cef429..0a0425397 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java
@@ -86,18 +86,17 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{
}
ArrayList<ISourceContainer> locationList = new ArrayList<>();
- for (int i = 0; i < elements.length; i++) {
- IResource resource = elements[i].getAdapter(IResource.class);
-
+ for (IAdaptable element : elements) {
+ IResource resource = element.getAdapter(IResource.class);
if (resource != null) {
switch (resource.getType()) {
- case IResource.FOLDER:
- locationList.add(new FolderSourceContainer((IFolder)resource, true));
- break;
- case IResource.PROJECT:
- locationList.add(new ProjectSourceContainer((IProject)resource, true));
- break;
- //if the element corresponds to an IFile, do nothing
+ case IResource.FOLDER:
+ locationList.add(new FolderSourceContainer((IFolder)resource, true));
+ break;
+ case IResource.PROJECT:
+ locationList.add(new ProjectSourceContainer((IProject)resource, true));
+ break;
+ //if the element corresponds to an IFile, do nothing
default:
break;
}
diff --git a/org.eclipse.ui.console/.classpath b/org.eclipse.ui.console/.classpath
index eca7bdba8..e801ebfb4 100644
--- a/org.eclipse.ui.console/.classpath
+++ b/org.eclipse.ui.console/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
index 568f4d675..74839bc3c 100644
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,13 +135,14 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -147,20 +150,23 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
@@ -252,11 +258,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -287,6 +294,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -311,13 +320,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -365,6 +378,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -401,9 +416,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -439,10 +457,14 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
index aba901028..77568d8af 100644
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
@@ -1,55 +1,3 @@
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=false
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_Platform Debug Cleanups
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs b/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.ui.console/META-INF/MANIFEST.MF b/org.eclipse.ui.console/META-INF/MANIFEST.MF
index 2e5be95a9..d3fbb40d2 100644
--- a/org.eclipse.ui.console/META-INF/MANIFEST.MF
+++ b/org.eclipse.ui.console/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ui.console; singleton:=true
-Bundle-Version: 3.8.600.qualifier
+Bundle-Version: 3.11.200.qualifier
Bundle-Activator: org.eclipse.ui.console.ConsolePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -14,8 +14,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)"
+ org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
+ org.eclipse.debug.core;bundle-version="[3.16.0,4.0.0)"
Bundle-ActivationPolicy: lazy
-Import-Package: com.ibm.icu.text
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.eclipse.ui.console
diff --git a/org.eclipse.ui.console/forceQualifierUpdate.txt b/org.eclipse.ui.console/forceQualifierUpdate.txt
new file mode 100644
index 000000000..e3185a3bd
--- /dev/null
+++ b/org.eclipse.ui.console/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update add the bug here
+Bug 566471 - I20200828-0150 - Comparator Errors Found
diff --git a/org.eclipse.ui.console/icons/full/cview16/console_view.gif b/org.eclipse.ui.console/icons/full/cview16/console_view.gif
deleted file mode 100644
index a598f6082..000000000
--- a/org.eclipse.ui.console/icons/full/cview16/console_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/eview16/console_view.gif b/org.eclipse.ui.console/icons/full/eview16/console_view.gif
deleted file mode 100644
index a598f6082..000000000
--- a/org.eclipse.ui.console/icons/full/eview16/console_view.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/pom.xml b/org.eclipse.ui.console/pom.xml
deleted file mode 100644
index 9662bb121..000000000
--- a/org.eclipse.ui.console/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2012, 2018 Eclipse Foundation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Igor Fedorenko - initial implementation
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>eclipse.platform.debug</artifactId>
- <groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
- </parent>
- <groupId>org.eclipse.ui</groupId>
- <artifactId>org.eclipse.ui.console</artifactId>
- <version>3.8.600-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/org.eclipse.ui.console/schema/consoleFactories.exsd b/org.eclipse.ui.console/schema/consoleFactories.exsd
index 4f47c49d5..0a2ac5391 100644
--- a/org.eclipse.ui.console/schema/consoleFactories.exsd
+++ b/org.eclipse.ui.console/schema/consoleFactories.exsd
@@ -1,139 +1,139 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.console">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.console" id="consoleFactories" name="Console Factories"/>
- </appInfo>
- <documentation>
- A console factory creates or activates a console, and appears as an action in the console view.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="consoleFactory"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="consoleFactory">
- <complexType>
- <attribute name="label" type="string" use="required">
- <annotation>
- <documentation>
- action label to appear in menu
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="icon" type="string">
- <annotation>
- <documentation>
- optional plug-in relative path to an icon to appear with the action
- </documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- class implementing &lt;code&gt;org.eclipse.ui.console.IConsoleFactory&lt;/code&gt; that will be called when the associated action is invoked
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.ui.console.IConsoleFactory"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.1
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a console factory extension point:
-&lt;pre&gt;
-&lt;extension point=&quot;org.eclipse.ui.console.consoleFactories&quot;&gt;
- &lt;consoleFactory
- label=&quot;Command Console&quot;
- class=&quot;com.example.CommandConsoleFactory&quot;
- icon=&quot;icons/cmd_console.png&quot;&gt;
- &lt;/consoleFactory&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-This extension will cause an entry to appear in the console view&apos;s &lt;b&gt;Open Console&lt;/b&gt; drop-down menu labelled &lt;b&gt;Command Console&lt;/b&gt; with the specified icon. When the action is invoked by a user, the method &lt;b&gt;openConsole()&lt;/b&gt; on the class &lt;b&gt;com.example.CommandConsoleFactory&lt;/b&gt; will be called. The factory can the decide to create a new console or activate an existing console.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.ui.console.IConsoleFactory&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The console plug-in provides a console factory to open a new console view.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.ui.console">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.ui.console" id="consoleFactories" name="Console Factories"/>
+ </appInfo>
+ <documentation>
+ A console factory creates or activates a console, and appears as an action in the console view.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="consoleFactory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="consoleFactory">
+ <complexType>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+ action label to appear in menu
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+ optional plug-in relative path to an icon to appear with the action
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="resource"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ class implementing &lt;code&gt;org.eclipse.ui.console.IConsoleFactory&lt;/code&gt; that will be called when the associated action is invoked
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.ui.console.IConsoleFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a console factory extension point:
+&lt;pre&gt;
+&lt;extension point=&quot;org.eclipse.ui.console.consoleFactories&quot;&gt;
+ &lt;consoleFactory
+ label=&quot;Command Console&quot;
+ class=&quot;com.example.CommandConsoleFactory&quot;
+ icon=&quot;icons/cmd_console.png&quot;&gt;
+ &lt;/consoleFactory&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+This extension will cause an entry to appear in the console view&apos;s &lt;b&gt;Open Console&lt;/b&gt; drop-down menu labelled &lt;b&gt;Command Console&lt;/b&gt; with the specified icon. When the action is invoked by a user, the method &lt;b&gt;openConsole()&lt;/b&gt; on the class &lt;b&gt;com.example.CommandConsoleFactory&lt;/b&gt; will be called. The factory can the decide to create a new console or activate an existing console.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.ui.console.IConsoleFactory&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ The console plug-in provides a console factory to open a new console view.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd b/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd
index 435f8288b..1f3e6e4bc 100644
--- a/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd
+++ b/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd
@@ -1,156 +1,156 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.console">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.ui.console" id="consolePatternMatchListeners" name="Console Pattern Match Listeners"/>
- </appInfo>
- <documentation>
- Provides regular expression matching for text consoles. Pattern match listeners can be contributed to specific consoles by using an enablement expression. Listeners are notified as matches are found.
- </documentation>
- </annotation>
-
- <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="consolePatternMatchListener" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="consolePatternMatchListener">
- <complexType>
- <sequence>
- <element ref="enablement"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- specifies a unique identifier for this console pattern match listener
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- specifies a fully qualified name of a Java class that implements &lt;code&gt;IPatternMatchListenerDelegate&lt;/code&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.ui.console.IPatternMatchListenerDelegate"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="regex" type="string" use="required">
- <annotation>
- <documentation>
- specifies the regular expression to be matched. Since 3.2, this attribute supports string variable substitution.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="flags" type="string">
- <annotation>
- <documentation>
- specifies flags to be used when matching the pattern. Acceptable flags are defined in &lt;code&gt;java.util.regex.Pattern&lt;/code&gt; and should be specified as Strings (eg &quot;Pattern.MULTILINE&quot; or &quot;MULTILINE&quot;)
- </documentation>
- </annotation>
- </attribute>
- <attribute name="qualifier" type="string">
- <annotation>
- <documentation>
- a simple regular expression used to identify a line that may contain this pattern match listener&apos;s complete regular expression &lt;code&gt;regex&lt;/code&gt;. When a line is found containing this expression, a search is performed from the beginning of the line for this pattern matcher&apos;s complete &lt;code&gt;regex&lt;/code&gt;. Use of this attribute is optional but can greatly improve performance as lines not containing this expression are disqualified from the search. Since 3.2, this attribute supports string variable substitution.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 3.1
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a console pattern match listener extension point:
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.eclipse.ui.console.consolePatternMatchListeners&quot;&gt;
- &lt;consolePatternMatchListener
- class=&quot;com.example.ExampleConsolePatternMatcher&quot;
- id=&quot;com.example.ExampleConsolePatternMatcher&quot;
- regex=&quot;.*foo.*&quot;&gt;
- &lt;enablement&gt;
- &lt;test property=&quot;org.eclipse.ui.console.consoleTypeTest&quot; value=&quot;exampleConsole&quot;/&gt;
- &lt;/enablement&gt;
- &lt;/consolePatternMatchListener&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-In the above example, the contributed console pattern matcher will be used for consoles with a type of &quot;exampleConsole.&quot;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.ui.console.IPatternMatchListenerDelegate&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- The console plug-in provides a console type property tester for enablement expressions that tests the value of &lt;code&gt;IConsole.getType()&lt;/code&gt;. The property tester&apos;s identifier is &lt;code&gt;org.eclipse.ui.console.consoleTypeTest&lt;/code&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.ui.console">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.ui.console" id="consolePatternMatchListeners" name="Console Pattern Match Listeners"/>
+ </appInfo>
+ <documentation>
+ Provides regular expression matching for text consoles. Pattern match listeners can be contributed to specific consoles by using an enablement expression. Listeners are notified as matches are found.
+ </documentation>
+ </annotation>
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+ <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="consolePatternMatchListener" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="consolePatternMatchListener">
+ <complexType>
+ <sequence>
+ <element ref="enablement"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a unique identifier for this console pattern match listener
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies a fully qualified name of a Java class that implements &lt;code&gt;IPatternMatchListenerDelegate&lt;/code&gt;
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.ui.console.IPatternMatchListenerDelegate"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="regex" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the regular expression to be matched. Since 3.2, this attribute supports string variable substitution.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="flags" type="string">
+ <annotation>
+ <documentation>
+ specifies flags to be used when matching the pattern. Acceptable flags are defined in &lt;code&gt;java.util.regex.Pattern&lt;/code&gt; and should be specified as Strings (eg &quot;Pattern.MULTILINE&quot; or &quot;MULTILINE&quot;)
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="qualifier" type="string">
+ <annotation>
+ <documentation>
+ a simple regular expression used to identify a line that may contain this pattern match listener&apos;s complete regular expression &lt;code&gt;regex&lt;/code&gt;. When a line is found containing this expression, a search is performed from the beginning of the line for this pattern matcher&apos;s complete &lt;code&gt;regex&lt;/code&gt;. Use of this attribute is optional but can greatly improve performance as lines not containing this expression are disqualified from the search. Since 3.2, this attribute supports string variable substitution.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a console pattern match listener extension point:
+&lt;pre&gt;
+ &lt;extension
+ point=&quot;org.eclipse.ui.console.consolePatternMatchListeners&quot;&gt;
+ &lt;consolePatternMatchListener
+ class=&quot;com.example.ExampleConsolePatternMatcher&quot;
+ id=&quot;com.example.ExampleConsolePatternMatcher&quot;
+ regex=&quot;.*foo.*&quot;&gt;
+ &lt;enablement&gt;
+ &lt;test property=&quot;org.eclipse.ui.console.consoleTypeTest&quot; value=&quot;exampleConsole&quot;/&gt;
+ &lt;/enablement&gt;
+ &lt;/consolePatternMatchListener&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+In the above example, the contributed console pattern matcher will be used for consoles with a type of &quot;exampleConsole.&quot;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.ui.console.IPatternMatchListenerDelegate&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ The console plug-in provides a console type property tester for enablement expressions that tests the value of &lt;code&gt;IConsole.getType()&lt;/code&gt;. The property tester&apos;s identifier is &lt;code&gt;org.eclipse.ui.console.consoleTypeTest&lt;/code&gt;.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java
index 5b0d7009f..3539baa6a 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java
@@ -59,8 +59,7 @@ public abstract class AbstractConsole implements IConsole {
@Override
public void consolesAdded(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
+ for (IConsole console : consoles) {
if (console == AbstractConsole.this) {
initialize();
}
@@ -70,8 +69,7 @@ public abstract class AbstractConsole implements IConsole {
@Override
public void consolesRemoved(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
+ for (IConsole console : consoles) {
if (console == AbstractConsole.this) {
ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
destroy();
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java
index b43b47544..f55935e5b 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java
@@ -56,6 +56,8 @@ public class ConsolePlugin extends AbstractUIPlugin {
/**
* Returns the singleton instance of the console plug-in.
+ *
+ * @return the singleton instance of this console plug-in
*/
public static ConsolePlugin getDefault() {
return fgPlugin;
@@ -68,6 +70,8 @@ public class ConsolePlugin extends AbstractUIPlugin {
/**
* Convenience method which returns the unique identifier of this plug-in.
+ *
+ * @return this plug-in's unique identifier
*/
public static String getUniqueIdentifier() {
return PI_UI_CONSOLE;
@@ -120,6 +124,8 @@ public class ConsolePlugin extends AbstractUIPlugin {
/**
* Returns the workbench display.
+ *
+ * @return the workbench display
*/
public static Display getStandardDisplay() {
return PlatformUI.getWorkbench().getDisplay();
@@ -127,6 +133,11 @@ public class ConsolePlugin extends AbstractUIPlugin {
/**
* Utility method with conventions
+ *
+ * @param shell the parent shell for the dialog
+ * @param title dialog title
+ * @param message dialog message
+ * @param t error to show in dialog
*/
public static void errorDialog(Shell shell, String title, String message, Throwable t) {
IStatus status;
@@ -146,11 +157,12 @@ public class ConsolePlugin extends AbstractUIPlugin {
}
/**
- * Returns the <code>Image</code> identified by the given key,
- * or <code>null</code> if it does not exist.
+ * Returns the <code>Image</code> identified by the given key, or
+ * <code>null</code> if it does not exist.
*
- * @return the <code>Image</code> identified by the given key,
- * or <code>null</code> if it does not exist
+ * @param key the image's key
+ * @return the <code>Image</code> identified by the given key, or
+ * <code>null</code> if it does not exist
* @since 3.1
*/
public static Image getImage(String key) {
@@ -158,11 +170,12 @@ public class ConsolePlugin extends AbstractUIPlugin {
}
/**
- * Returns the <code>ImageDescriptor</code> identified by the given key,
- * or <code>null</code> if it does not exist.
+ * Returns the <code>ImageDescriptor</code> identified by the given key, or
+ * <code>null</code> if it does not exist.
*
- * @return the <code>ImageDescriptor</code> identified by the given key,
- * or <code>null</code> if it does not exist
+ * @param key the image's key
+ * @return the <code>ImageDescriptor</code> identified by the given key, or
+ * <code>null</code> if it does not exist
* @since 3.1
*/
public static ImageDescriptor getImageDescriptor(String key) {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
index cbb02a8f5..1cfb1dc5d 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -157,6 +157,13 @@ public interface IConsoleConstants {
String P_BACKGROUND_COLOR = ConsolePlugin.getUniqueIdentifier() + ".P_BACKGROUND_COLOR"; //$NON-NLS-1$
/**
+ * Property constant indicating the user preference for word wrap enabling.
+ *
+ * @since 3.10
+ */
+ String P_CONSOLE_WORD_WRAP = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_WORD_WRAP"; //$NON-NLS-1$
+
+ /**
* The default tab size for text consoles.
*
* @since 3.1
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java
index 87d3c3785..8441bda77 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -21,12 +21,24 @@ import org.eclipse.swt.custom.StyleRange;
* A document partitioner for a text console.
* <p>
* In addition to regular partitioner duties, a console document partitioner
- * dictates which regions in its document are read-only and provides style ranges.
+ * dictates which regions in its document are read-only and provides style
+ * ranges.
* </p>
* <p>
* Clients may implement this interface.
* </p>
+ * <p>
+ * In order to provided backward compatibility for clients of
+ * <code>IConsoleDocumentPartitioner</code>, extension interfaces are used to
+ * provide a means of evolution. The following extension interfaces exist:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.ui.console.IConsoleDocumentPartitionerExtension} since
+ * version 3.9 adding more possibilities to query read-only regions.</li>
+ * </ul>
+ *
* @see org.eclipse.ui.console.TextConsole
+ * @see org.eclipse.ui.console.IConsoleDocumentPartitionerExtension
* @since 3.1
*/
public interface IConsoleDocumentPartitioner extends IDocumentPartitioner {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitionerExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitionerExtension.java
new file mode 100644
index 000000000..e03418ddc
--- /dev/null
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitionerExtension.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.ui.console;
+
+import org.eclipse.jface.text.ITypedRegion;
+
+/**
+ * Extension interface for {@link IConsoleDocumentPartitioner}.
+ * <p>
+ * It adds more possibilities to query read-only regions of the partitioned
+ * document.
+ * </p>
+ *
+ * @see org.eclipse.ui.console.IConsoleDocumentPartitioner
+ * @since 3.9
+ */
+public interface IConsoleDocumentPartitionerExtension {
+
+ /**
+ * Returns all partitions which are read-only.
+ *
+ * @return all read-only partitions. Ordered by offset and never
+ * <code>null</code>.
+ */
+ ITypedRegion[] computeReadOnlyPartitions();
+
+ /**
+ * Returns all read-only partitions in given range.
+ *
+ * @param offset the offset of the range of interest
+ * @param length the length of the range of interest
+ * @return read-only partitions in given range. Ordered by offset and never
+ * <code>null</code>. Returned regions may start and/or end outside
+ * given range.
+ */
+ ITypedRegion[] computeReadOnlyPartitions(int offset, int length);
+
+ /**
+ * Returns all partitions which are writable.
+ *
+ * @return all writable partitions. Ordered by offset and never
+ * <code>null</code>.
+ */
+ ITypedRegion[] computeWritablePartitions();
+
+ /**
+ * Returns all writable partitions in given range.
+ *
+ * @param offset the offset of the range of interest
+ * @param length the length of the range of interest
+ * @return writable partitions in given range. Ordered by offset and never
+ * <code>null</code>. Returned regions may start and/or end outside
+ * given range.
+ */
+ ITypedRegion[] computeWritablePartitions(int offset, int length);
+
+ /**
+ * Returns whether this partitioner's document is read-only in the specified
+ * range. Only returns <code>true</code> if the whole range is read-only.
+ *
+ * @param offset document offset
+ * @param length range length
+ * @return whether this partitioner's document is read-only in the specific
+ * range
+ */
+ boolean isReadOnly(int offset, int length);
+
+ /**
+ * Returns whether this partitioner's document is read-only at any point in the
+ * specified range.
+ *
+ * @param offset document offset
+ * @param length range length
+ * @return returns <code>true</code> if any offset in the given range is
+ * read-only
+ */
+ boolean containsReadOnly(int offset, int length);
+
+ /**
+ * Get this offset or the nearest offset before which is, depending on argument,
+ * writable or read-only.
+ *
+ * @param offset the offset of interest
+ * @param searchWritable if <code>true</code> return the nearest writable
+ * offset. If <code>false</code> return the nearest
+ * read-only offset.
+ * @return the given offset if it has the requested read-only/writable state or
+ * the nearest offset before with requested state. Returns
+ * <code>-1</code> if there is no offset with requested state before
+ * requested offset.
+ */
+ int getPreviousOffsetByState(int offset, boolean searchWritable);
+
+ /**
+ * Get this offset or the nearest offset after which is, depending on argument,
+ * writable or read-only.
+ *
+ * @param offset the offset of interest
+ * @param searchWritable if <code>true</code> return the nearest writable
+ * offset. If <code>false</code> return the nearest
+ * read-only offset.
+ * @return the given offset if it has the requested read-only/writable state or
+ * the nearest offset after with requested state. Returns the document
+ * length if there is no offset with requested state after requested
+ * offset.
+ */
+ int getNextOffsetByState(int offset, boolean searchWritable);
+}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java
index e3ab8f690..3052f014a 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java
@@ -23,7 +23,7 @@ package org.eclipse.ui.console;
* <p>
* Following is an example console factory extension.
* </p>
- *
+ *
* <pre>
* &lt;extension point="org.eclipse.ui.console.consoleFactories"&gt;
* &lt;consoleFactory
@@ -43,7 +43,7 @@ package org.eclipse.ui.console;
* Clients providing console factory extensions are intended to implement this
* interface.
* </p>
- *
+ *
* @since 3.1
*/
public interface IConsoleFactory {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java
index 7eda90542..ef0e23edf 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java
@@ -29,7 +29,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
* <p>
* Following is an example extension definition.
* </p>
- *
+ *
* <pre>
* &lt;extension point=&quot;org.eclipse.ui.console.consolePageParticipants&quot;&gt;
* &lt;consolePageParticipant
@@ -38,7 +38,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
* &lt;/consolePageParticipant&gt;
* &lt;/extension&gt;
* </pre>
- *
+ *
* The example page participant is contributed to all console pages. An optional
* <code>enablement</code> attribute may be specified to control which consoles
* a page participant is applicable to.
@@ -46,7 +46,7 @@ import org.eclipse.ui.part.IPageBookViewPage;
* Clients contributing console page participant extensions are intended to
* implement this interface.
* </p>
- *
+ *
* @since 3.1
*/
public interface IConsolePageParticipant extends IAdaptable {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java
index f409fa327..11ccba32f 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.WorkbenchEncoding;
import org.eclipse.ui.internal.console.IOConsolePage;
import org.eclipse.ui.internal.console.IOConsolePartitioner;
@@ -42,7 +43,7 @@ public class IOConsole extends TextConsole {
/**
* The document partitioner
*/
- private IOConsolePartitioner partitioner;
+ private final IOConsolePartitioner partitioner;
/**
* The stream from which user input may be read
@@ -52,12 +53,12 @@ public class IOConsole extends TextConsole {
/**
* A collection of open streams connected to this console.
*/
- private List<Closeable> openStreams = Collections.synchronizedList(new ArrayList<Closeable>());
+ private final List<Closeable> openStreams = Collections.synchronizedList(new ArrayList<>());
/**
* The encoding used to for displaying console output.
*/
- private Charset charset;
+ private final Charset charset;
/**
@@ -115,10 +116,11 @@ public class IOConsole extends TextConsole {
inputStream = new IOConsoleInputStream(this);
openStreams.add(inputStream);
}
-
- if (inputStream instanceof IOConsoleInputStream) {
- partitioner = new IOConsolePartitioner((IOConsoleInputStream) inputStream, this);
- partitioner.connect(getDocument());
+ partitioner = new IOConsolePartitioner(this);
+ final IDocument document = getDocument();
+ if (document != null) {
+ partitioner.connect(document);
+ document.setDocumentPartitioner(partitioner);
}
}
@@ -166,14 +168,18 @@ public class IOConsole extends TextConsole {
*/
public IOConsoleOutputStream newOutputStream() {
IOConsoleOutputStream outputStream = new IOConsoleOutputStream(this, this.charset);
- synchronized(openStreams) {
- openStreams.add(outputStream);
- }
+ addOpenStream(outputStream);
return outputStream;
}
/**
* Returns the input stream connected to the keyboard.
+ * <p>
+ * Note: It returns the stream connected to keyboard. There is no guarantee to
+ * get the stream last set with {@link #setInputStream(InputStream)}. The return
+ * value might be <code>null</code> if the current input stream is not connected
+ * to the keyboard.
+ * </p>
*
* @return the input stream connected to the keyboard.
*/
@@ -283,9 +289,7 @@ public class IOConsole extends TextConsole {
@Override
public void clearConsole() {
- if (partitioner != null) {
- partitioner.clearBuffer();
- }
+ partitioner.clearBuffer();
}
/**
@@ -293,28 +297,38 @@ public class IOConsole extends TextConsole {
*/
@Override
protected void dispose() {
- super.dispose();
- partitioner.disconnect();
- //make a copy of the open streams and close them all
- //a copy is needed as close the streams results in a callback that
- //removes the streams from the openStreams collection (bug 152794)
- List<Closeable> list = new ArrayList<>(openStreams);
- for (Closeable closable : list) {
- try {
- closable.close();
- } catch (IOException e) {
- // e.printStackTrace();
+ // Get lock on ourself before closing. Closing streams check for console finish.
+ // Finish check need lock on (this) console. Since closing also lock on stream
+ // this can deadlock with other threads (double) closing streams at same time
+ // but already own a lock on console. (bug 551902)
+ // Long story short. Before closing IOConsole...Stream get lock from associated
+ // console to prevent deadlocks.
+ synchronized (this) {
+ // make a copy of the open streams and close them all
+ // a copy is needed as close the streams results in a callback that
+ // removes the streams from the openStreams collection (bug 152794)
+ List<Closeable> list = new ArrayList<>(openStreams);
+ for (Closeable closable : list) {
+ try {
+ closable.close();
+ } catch (IOException e) {
+ // e.printStackTrace();
+ }
}
+ inputStream = null;
}
- inputStream = null;
+
+ final IDocument document = partitioner.getDocument();
+ partitioner.disconnect();
+ document.setDocumentPartitioner(null);
+
+ super.dispose();
}
/**
- * Returns the encoding for this console, or <code>null</code> to indicate
- * default encoding.
+ * Returns the encoding for this console.
*
- * @return the encoding set for this console, or <code>null</code> to indicate
- * default encoding
+ * @return the encoding set for this console
* @since 3.3
*/
public String getEncoding() {
@@ -322,15 +336,79 @@ public class IOConsole extends TextConsole {
}
/**
- * Returns the Charset for this console, or <code>null</code> to indicate
- * default encoding.
+ * Returns the Charset for this console.
*
- * @return the Charset for this console, or <code>null</code> to indicate
- * default encoding
+ * @return the Charset for this console
* @since 3.7
*/
public Charset getCharset() {
return this.charset;
}
+ /**
+ * Check if console currently interprets ASCII control characters.
+ *
+ * @return <code>true</code> if console interprets ASCII control characters
+ * @since 3.9
+ */
+ public boolean isHandleControlCharacters() {
+ return partitioner.isHandleControlCharacters();
+ }
+
+ /**
+ * Enable or disable interpretation of ASCII control characters like backspace
+ * (<code>\b</code>).
+ *
+ * @param handleControlCharacters interpret control characters if
+ * <code>true</code>
+ * @since 3.9
+ */
+ public void setHandleControlCharacters(boolean handleControlCharacters) {
+ partitioner.setHandleControlCharacters(handleControlCharacters);
+ }
+
+ /**
+ * Check if carriage returns (<code>\r</code>) in console output are interpreted
+ * as control characters. They are also not interpreted if general control
+ * character handling is disabled.
+ *
+ * @return if <code>true</code> carriage returns are interpreted as control
+ * characters.
+ * @see #isHandleControlCharacters()
+ * @since 3.9
+ */
+ public boolean isCarriageReturnAsControlCharacter() {
+ return partitioner.isCarriageReturnAsControlCharacter();
+ }
+
+ /**
+ * If control characters in console output are interpreted by this console
+ * carriage returns (<code>\r</code>) are either ignored (<code>false</code>)
+ * and usually handled as line break by connected console document or if
+ * <code>true</code> interpreted with there control character meaning.
+ * <p>
+ * Note: this option has no effect if control character interpretation is
+ * disabled in general.
+ * </p>
+ *
+ * @param carriageReturnAsControlCharacter set <code>false</code> to exclude
+ * carriage return from control
+ * character interpretation
+ * @see #setHandleControlCharacters(boolean)
+ * @since 3.9
+ */
+ public void setCarriageReturnAsControlCharacter(boolean carriageReturnAsControlCharacter) {
+ partitioner.setCarriageReturnAsControlCharacter(carriageReturnAsControlCharacter);
+ }
+
+ /**
+ * Registers a stream that will be managed by this console.
+ *
+ * @param stream The stream which will be closed on {@link #dispose()}.
+ */
+ void addOpenStream(Closeable stream) {
+ synchronized (openStreams) {
+ openStreams.add(stream);
+ }
+ }
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
index d4442f41e..1b94147f3 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
@@ -16,7 +16,7 @@ package org.eclipse.ui.console;
import java.io.IOException;
import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
@@ -56,7 +56,7 @@ public class IOConsoleInputStream extends InputStream {
/**
* Flag to indicate that the stream has been closed.
*/
- private boolean closed = false;
+ private volatile boolean closed;
/**
* The console that this stream is connected to.
@@ -150,14 +150,10 @@ public class IOConsoleInputStream extends InputStream {
* @param text the text to append to the buffer.
*/
public synchronized void appendData(String text) {
- String encoding = console.getEncoding();
+ Charset charset = console.getCharset();
byte[] newData;
- if (encoding!=null) {
- try {
- newData = text.getBytes(encoding);
- } catch (UnsupportedEncodingException e) {
- newData = text.getBytes();
- }
+ if (charset != null) {
+ newData = text.getBytes(charset);
} else {
newData = text.getBytes();
}
@@ -255,13 +251,19 @@ public class IOConsoleInputStream extends InputStream {
}
@Override
- public synchronized void close() throws IOException {
+ public void close() throws IOException {
if(closed) {
// Closeable#close() has no effect if already closed
return;
}
- closed = true;
- notifyAll();
+ synchronized (this) {
+ if (closed) {
+ return;
+ }
+ closed = true;
+ notifyAll();
+ }
+ // Locked in the console
console.streamClosed(this);
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
index dd1a505fb..38cd40b7c 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
@@ -18,10 +18,10 @@ import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
+import org.eclipse.debug.internal.core.StreamDecoder;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.WorkbenchEncoding;
import org.eclipse.ui.internal.console.IOConsolePartitioner;
-import org.eclipse.ui.internal.console.StreamDecoder;
/**
* OutputStream used to write to an IOConsole.
@@ -43,7 +43,7 @@ public class IOConsoleOutputStream extends OutputStream {
/**
* Flag indicating whether this stream has been closed.
*/
- private boolean closed = false;
+ private volatile boolean closed;
/**
* The console's document partitioner.
@@ -53,32 +53,35 @@ public class IOConsoleOutputStream extends OutputStream {
/**
* The console this stream is attached to.
*/
- private IOConsole console;
+ private final IOConsole console;
/**
* Flag indicating that the console should be activated when data
* is written to this stream.
*/
- private boolean activateOnWrite = false;
+ private volatile boolean activateOnWrite;
/**
* The color used to decorate data written to this stream.
*/
- private Color color;
+ private volatile Color color;
/**
* The font style used to decorate data written to this stream.
*/
- private int fontStyle;
+ private volatile int fontStyle;
+ /** synchronized access for atomic update **/
private StreamDecoder decoder;
+ /** synchronized access for atomic update **/
private boolean prependCR;
/**
* Constructs a new output stream on the given console.
*
* @param console I/O console
+ * @param charset the encoding used to write to console
*/
IOConsoleOutputStream(IOConsole console, Charset charset) {
this.decoder = new StreamDecoder(charset);
@@ -158,7 +161,7 @@ public class IOConsoleOutputStream extends OutputStream {
* Returns true if the stream has been closed
* @return true is the stream has been closed, false otherwise.
*/
- public synchronized boolean isClosed() {
+ public boolean isClosed() {
return closed;
}
@@ -168,14 +171,13 @@ public class IOConsoleOutputStream extends OutputStream {
// Closeable#close() has no effect if already closed
return;
}
- StringBuilder builder = new StringBuilder();
if (prependCR) { // force writing of last /r
prependCR = false;
- builder.append('\r');
+ notifyParitioner("\r"); //$NON-NLS-1$
}
- this.decoder.finish(builder);
- if (builder.length() > 0) {
- notifyParitioner(builder.toString());
+ String s = this.decoder.finish();
+ if (s.length() > 0) {
+ notifyParitioner(s);
}
console.streamClosed(this);
closed = true;
@@ -195,9 +197,8 @@ public class IOConsoleOutputStream extends OutputStream {
if (closed) {
throw new IOException("Output Stream is closed"); //$NON-NLS-1$
}
- StringBuilder builder = new StringBuilder();
- this.decoder.decode(builder, b, off, len);
- encodedWrite(builder.toString());
+ String s = this.decoder.decode(b, off, len);
+ encodedWrite(s);
}
@Override
@@ -270,7 +271,7 @@ public class IOConsoleOutputStream extends OutputStream {
}
if (newencoding.endsWith("\r")) { //$NON-NLS-1$
prependCR = true;
- newencoding = new String(newencoding.substring(0, newencoding.length() - 1));
+ newencoding = newencoding.substring(0, newencoding.length() - 1);
}
notifyParitioner(newencoding);
}
@@ -322,10 +323,9 @@ public class IOConsoleOutputStream extends OutputStream {
if (closed) {
throw new IOException("Output Stream is closed"); //$NON-NLS-1$
}
- StringBuilder builder = new StringBuilder();
- this.decoder.finish(builder);
- if (builder.length() > 0) {
- this.encodedWrite(builder.toString());
+ String s = this.decoder.finish();
+ if (s.length() > 0) {
+ this.encodedWrite(s);
}
this.decoder = new StreamDecoder(charset);
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
index 39995671e..ccdc077c7 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
@@ -127,7 +127,9 @@ public class MessageConsole extends IOConsole {
* @return a new message stream connected to this console
*/
public MessageConsoleStream newMessageStream() {
- return new MessageConsoleStream(this, this.getCharset());
+ MessageConsoleStream messageConsoleStream = new MessageConsoleStream(this, this.getCharset());
+ addOpenStream(messageConsoleStream);
+ return messageConsoleStream;
}
@Override
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
index da454eb61..be35b2304 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
@@ -43,7 +43,8 @@ public class MessageConsoleStream extends IOConsoleOutputStream {
private MessageConsole fMessageConsole;
/**
- * Constructs a new stream connected to the given console.
+ * Constructs a new stream connected to the given console with workbench default
+ * encoding.
*
* @param console the console to write messages to
*/
@@ -55,6 +56,7 @@ public class MessageConsoleStream extends IOConsoleOutputStream {
* Constructs a new stream connected to the given console.
*
* @param console the console to write messages to
+ * @param charset encoding used to write to console
* @since 3.7
*/
public MessageConsoleStream(MessageConsole console, Charset charset) {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
index e847c23fa..3f511fc65 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
@@ -376,10 +376,10 @@ public abstract class TextConsole extends AbstractConsole {
}
/**
- * Returns the hyperlink at the given offset of <code>null</code> if none.
+ * Returns the hyperlink at the given offset or <code>null</code> if none.
*
* @param offset offset for which a hyperlink is requested
- * @return the hyperlink at the given offset of <code>null</code> if none
+ * @return the hyperlink at the given offset or <code>null</code> if none
*/
public IHyperlink getHyperlink(int offset) {
try {
@@ -399,7 +399,8 @@ public abstract class TextConsole extends AbstractConsole {
/**
* Binary search for the position at a given offset.
*
- * @param offset the offset whose position should be found
+ * @param offset the offset whose position should be found
+ * @param positions the positions list to search in
* @return the position containing the offset, or <code>null</code>
*/
private Position findPosition(int offset, Position[] positions) {
@@ -570,8 +571,8 @@ public abstract class TextConsole extends AbstractConsole {
IDocument doc = getDocument();
if (doc != null) {
Position[] positions = doc.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- for (int i = 0; i < positions.length; i++) {
- ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition)positions[i];
+ for (Position p : positions) {
+ ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition) p;
if (position.getHyperLink().equals(link)) {
return new Region(position.getOffset(), position.getLength());
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
index 467b11fc2..8483e9def 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,11 +18,12 @@ package org.eclipse.ui.console;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
import java.util.ResourceBundle;
+import java.util.stream.Stream;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
@@ -32,11 +33,9 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IFindReplaceTarget;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
@@ -55,8 +54,11 @@ import org.eclipse.ui.internal.console.FollowHyperlinkAction;
import org.eclipse.ui.internal.console.IConsoleHelpContextIds;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.texteditor.FindNextAction;
import org.eclipse.ui.texteditor.FindReplaceAction;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.IUpdate;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
/**
* A page for a text console.
@@ -83,27 +85,19 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
protected ClearOutputAction fClearOutputAction;
// text selection listener, used to update selection dependent actions on selection changes
- private ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateSelectionDependentActions();
- }
- };
-
- // updates the find replace action and the clear action if the document length is > 0
- private ITextListener textListener = new ITextListener() {
- @Override
- public void textChanged(TextEvent event) {
- IUpdate findReplace = (IUpdate)fGlobalActions.get(ActionFactory.FIND.getId());
- if (findReplace != null) {
- findReplace.update();
- }
-
- if (fClearOutputAction != null) {
- IDocument doc = fViewer.getDocument();
- if(doc != null) {
- fClearOutputAction.setEnabled(doc.getLength() > 0);
- }
+ private ISelectionChangedListener selectionChangedListener = event -> updateSelectionDependentActions();
+
+ // updates the find actions and the clear action if the document length is > 0
+ private ITextListener textListener = event -> {
+ Stream.of(ActionFactory.FIND.getId(), ITextEditorActionConstants.FIND_NEXT,
+ ITextEditorActionConstants.FIND_PREVIOUS)
+ .map(id -> fGlobalActions.get(id)).filter(Objects::nonNull).map(IUpdate.class::cast)
+ .forEach(IUpdate::update);
+
+ if (fClearOutputAction != null) {
+ IDocument doc = fViewer.getDocument();
+ if(doc != null) {
+ fClearOutputAction.setEnabled(doc.getLength() > 0);
}
}
};
@@ -162,12 +156,7 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
}
fMenuManager= new MenuManager("#ContextMenu", id); //$NON-NLS-1$
fMenuManager.setRemoveAllWhenShown(true);
- fMenuManager.addMenuListener(new IMenuListener() {
- @Override
- public void menuAboutToShow(IMenuManager m) {
- contextMenuAboutToShow(m);
- }
- });
+ fMenuManager.addMenuListener(this::contextMenuAboutToShow);
Menu menu = fMenuManager.createContextMenu(getControl());
getControl().setMenu(menu);
@@ -278,10 +267,23 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
PlatformUI.getWorkbench().getHelpSystem().setHelp(fraction, IConsoleHelpContextIds.CONSOLE_FIND_REPLACE_ACTION);
setGlobalAction(actionBars, ActionFactory.FIND.getId(), fraction);
+ FindNextAction findNextAction = new FindNextAction(bundle, "find_next_action_", fConsoleView, true); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(findNextAction, IConsoleHelpContextIds.CONSOLE_FIND_NEXT_ACTION);
+ findNextAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_NEXT);
+ setGlobalAction(actionBars, ITextEditorActionConstants.FIND_NEXT, findNextAction);
+
+ FindNextAction findPreviousAction = new FindNextAction(bundle, "find_previous_action_", fConsoleView, false); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(findPreviousAction,
+ IConsoleHelpContextIds.CONSOLE_FIND_PREVIOUS_ACTION);
+ findPreviousAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.FIND_PREVIOUS);
+ setGlobalAction(actionBars, ITextEditorActionConstants.FIND_PREVIOUS, findPreviousAction);
+
fSelectionActions.add(ActionFactory.CUT.getId());
fSelectionActions.add(ActionFactory.COPY.getId());
fSelectionActions.add(ActionFactory.PASTE.getId());
fSelectionActions.add(ActionFactory.FIND.getId());
+ fSelectionActions.add(ITextEditorActionConstants.FIND_NEXT);
+ fSelectionActions.add(ITextEditorActionConstants.FIND_PREVIOUS);
actionBars.updateActionBars();
}
@@ -359,7 +361,9 @@ public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListen
menuManager.add(new Separator("FIND")); //$NON-NLS-1$
menuManager.add(fGlobalActions.get(ActionFactory.FIND.getId()));
- menuManager.add(new FollowHyperlinkAction(fViewer));
+ menuManager.add(fGlobalActions.get(ITextEditorActionConstants.FIND_NEXT));
+ menuManager.add(fGlobalActions.get(ITextEditorActionConstants.FIND_PREVIOUS));
+ menuManager.add(new FollowHyperlinkAction(fViewer.getHyperlink()));
menuManager.add(fClearOutputAction);
menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
index 6a94c00bb..2e4187125 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Paul Pazderski - Bug 550620: reimplementation of style override (to fix existing and future problems with link styling)
*******************************************************************************/
package org.eclipse.ui.console;
@@ -31,6 +32,7 @@ import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentAdapter;
import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.JFaceTextUtil;
@@ -198,9 +200,7 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
try {
IDocument document = getDocument();
if (document != null) {
- Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- for (int i = 0; i < positions.length; i++) {
- Position position = positions[i];
+ for (Position position : document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY)) {
if (position.offset == event.fOffset && position.length <= event.fLength) {
position.delete();
}
@@ -377,11 +377,13 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
int offset = event.lineOffset;
int length = event.lineText.length();
- StyleRange[] partitionerStyles = ((IConsoleDocumentPartitioner) document.getDocumentPartitioner()).getStyleRanges(event.lineOffset, event.lineText.length());
- if (partitionerStyles != null) {
- Collections.addAll(ranges, partitionerStyles);
- } else {
- ranges.add(new StyleRange(offset, length, null, null));
+ IDocumentPartitioner partitioner = document.getDocumentPartitioner();
+ if (partitioner instanceof IConsoleDocumentPartitioner) {
+ StyleRange[] partitionerStyles = ((IConsoleDocumentPartitioner) partitioner).getStyleRanges(offset,
+ length);
+ if (partitionerStyles != null) {
+ Collections.addAll(ranges, partitionerStyles);
+ }
}
try {
@@ -389,11 +391,10 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
Position[] overlap = findPosition(offset, length, positions);
Color color = JFaceColors.getHyperlinkText(Display.getCurrent());
if (overlap != null) {
- for (int i = 0; i < overlap.length; i++) {
- Position position = overlap[i];
+ for (Position position : overlap) {
StyleRange linkRange = new StyleRange(position.offset, position.length, color, null);
linkRange.underline = true;
- override(ranges, linkRange);
+ overrideStyleRange(ranges, linkRange);
}
}
} catch (BadPositionCategoryException e) {
@@ -405,52 +406,92 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
}
}
- private void override(List<StyleRange> ranges, StyleRange newRange) {
- if (ranges.isEmpty()) {
- ranges.add(newRange);
- return;
- }
-
- int start = newRange.start;
- int end = start + newRange.length;
- for (int i = 0; i < ranges.size(); i++) {
- StyleRange existingRange = ranges.get(i);
- int rEnd = existingRange.start + existingRange.length;
- if (end <= existingRange.start || start >= rEnd) {
- continue;
- }
-
- if (start < existingRange.start && end > existingRange.start) {
- start = existingRange.start;
+ /**
+ * Apply new style range to list of existing style ranges. If the new style
+ * range overlaps with any of the existing style ranges the new style overrides
+ * the existing one in the affected range by splitting/adjusting the existing
+ * ones.
+ *
+ * @param ranges list of existing style ranges (will contain the new style
+ * range when finished)
+ * @param newRange new style range which should be combined with the existing
+ * ranges
+ */
+ private static void overrideStyleRange(List<StyleRange> ranges, StyleRange newRange) {
+ final int overrideStart = newRange.start;
+ final int overrideEnd = overrideStart + newRange.length;
+ int insertIndex = ranges.size();
+ for (int i = ranges.size() - 1; i >= 0; i--) {
+ final StyleRange existingRange = ranges.get(i);
+ final int existingStart = existingRange.start;
+ final int existingEnd = existingStart + existingRange.length;
+
+ // Find first position to insert where offset of new range is smaller then all
+ // offsets before. This way the list is still sorted by offset after insert if
+ // it was sorted before and it will not fail if list was not sorted.
+ if (overrideStart <= existingStart) {
+ insertIndex = i;
}
- if (start >= existingRange.start && end <= rEnd) {
- existingRange.length = start - existingRange.start;
- ranges.add(++i, newRange);
- if (end != rEnd) {
- ranges.add(++i, new StyleRange(end, rEnd - end - 1, existingRange.foreground, existingRange.background));
+ // adjust the existing range if required
+ if (overrideStart <= existingStart) { // new range starts before or with existing
+ if (overrideEnd < existingStart) {
+ // new range lies before existing range. No overlapping.
+ // new range: ++++_________
+ // existing : ________=====
+ // . result : ++++____=====
+ // nothing to do
+ } else if (overrideEnd < existingEnd) {
+ // new range overlaps start of existing.
+ // new range: ++++++++_____
+ // existing : _____========
+ // . result : ++++++++=====
+ final int overlap = overrideEnd - existingStart;
+ existingRange.start += overlap;
+ existingRange.length -= overlap;
+ } else {
+ // new range completely overlaps existing.
+ // new range: ___++++++++++
+ // existing : ___======____
+ // . result : ___++++++++++
+ ranges.remove(i);
+ }
+ } else { // new range starts inside or after existing
+ if (existingEnd < overrideStart) {
+ // new range lies after existing range. No overlapping.
+ // new range: _________++++
+ // existing : =====________
+ // . result : =====____++++
+ // nothing to do
+ } else if (overrideEnd >= existingEnd) {
+ // new range overlaps end of existing.
+ // new range: _____++++++++
+ // existing : ========_____
+ // . result : =====++++++++
+ existingRange.length -= existingEnd - overrideStart;
+ } else {
+ // new range lies inside existing range but not overrides all of it
+ // (and does not touch first or last offset of existing)
+ // new range: ____+++++____
+ // existing : =============
+ // . result : ====+++++====
+ final StyleRange clonedRange = (StyleRange) existingRange.clone();
+ existingRange.length = overrideStart - existingStart;
+ clonedRange.start = overrideEnd;
+ clonedRange.length = existingEnd - overrideEnd;
+ ranges.add(i + 1, clonedRange);
}
- return;
- } else if (start >= existingRange.start && start < rEnd) {
- existingRange.length = start - existingRange.start;
- ranges.add(++i, newRange);
- } else if (end >= rEnd) {
- ranges.remove(i);
- } else {
- ranges.add(++i, new StyleRange(end + 1, rEnd - end + 1, existingRange.foreground, existingRange.background));
}
}
+ ranges.add(insertIndex, newRange);
}
/**
* Binary search for the positions overlapping the given range
*
- * @param offset
- * the offset of the range
- * @param length
- * the length of the range
- * @param positions
- * the positions to search
+ * @param offset the offset of the range
+ * @param length the length of the range
+ * @param positions the positions to search
* @return the positions overlapping the given range, or <code>null</code>
*/
private Position[] findPosition(int offset, int length, Position[] positions) {
@@ -635,8 +676,7 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
* Returns the hyperlink at the specified offset, or <code>null</code> if
* none.
*
- * @param offset
- * offset at which a hyperlink has been requested
+ * @param offset offset at which a hyperlink has been requested
* @return hyperlink at the specified offset, or <code>null</code> if none
*/
public IHyperlink getHyperlink(int offset) {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java
index 6b5fb10fa..f2c4b5435 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java
@@ -14,6 +14,8 @@
package org.eclipse.ui.console.actions;
+import java.text.MessageFormat;
+
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.text.BadLocationException;
@@ -25,7 +27,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.internal.console.ConsoleMessages;
-import com.ibm.icu.text.MessageFormat;
/**
* Action to position a text viewer to a specific line.
@@ -64,7 +65,10 @@ public class TextViewerGotoLineAction extends TextViewerAction {
protected ITextViewer fTextViewer;
/**
- * Constructs a goto line action for the viewer using the provided resource bundle
+ * Constructs a goto line action for the viewer using the provided resource
+ * bundle.
+ *
+ * @param viewer the viewer to jump in
*/
public TextViewerGotoLineAction(ITextViewer viewer) {
super(viewer, -1);
@@ -83,6 +87,8 @@ public class TextViewerGotoLineAction extends TextViewerAction {
/**
* Jumps to the line.
+ *
+ * @param line the target line. First line is line <code>0</code>.
*/
protected void gotoLine(int line) {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java
index 2d6aef421..f5c44276d 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java
@@ -99,4 +99,10 @@ public class ConsoleDocument extends Document {
public synchronized Position[] getPositions(String category) throws BadPositionCategoryException {
return super.getPositions(category);
}
+
+ /** for debug only **/
+ @Override
+ public synchronized String toString() {
+ return get();
+ }
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java
index 64b4616a5..89a545a95 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java
@@ -25,8 +25,9 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentAdapter;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.MultiStringMatcher;
+import org.eclipse.jface.text.MultiStringMatcher.Match;
import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
import org.eclipse.swt.custom.TextChangeListener;
import org.eclipse.swt.custom.TextChangedEvent;
import org.eclipse.swt.custom.TextChangingEvent;
@@ -80,12 +81,13 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
/** Adapted document. */
private IDocument document;
/**
- * The strings the connected document interprets as line delimiters.
+ * The matcher to find the legal line delimiters of the connected document in
+ * some text. <code>null</code> if no document connected.
* <p>
- * This is usually <code>{ "\r", "\n", "\r\n" }</code>.
+ * This usually matches <code>{ "\r", "\n", "\r\n" }</code>.
* </p>
*/
- private String[] docLegalLineDelimiters;
+ private MultiStringMatcher docLegalLineDelimiterMatcher;
/**
* Number of widget lines in document. If fixed width is disabled it is always
@@ -133,6 +135,47 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
private int[] widgetLineOffsets = new int[1];
/**
+ * The fact that wrapped lines are new lines without a newline delimiter leads
+ * to some hard to handle edge cases since all involved interfaces (implicit)
+ * assume a newline has its unique offset.
+ * <p>
+ * Consider a fixed with of 10 and a console filled with (automatically wrapped)
+ * content of:
+ * </p>
+ *
+ * <pre>
+ * 0123456789
+ * 0
+ * </pre>
+ *
+ * <p>
+ * If we remove the last character ('0') we must set replaceLineCount to 1 since
+ * there is one line less due to the unwrapped line. The replaceLineCount is
+ * necessary so that StyledTextRenderer updates the lines which possible follow
+ * below and have changed due to moved content.
+ * </p>
+ * <p>
+ * But StyledTextRenderer presumes that the line index where the event occurs is
+ * the same before and after the text change. This is not the case for our auto
+ * wrapped lines since getLineAtOffset(10) is 1 before text change and 0 after
+ * </p>
+ * <p>
+ * To solve this unlucky situation we will lie to StyledText(Renderer) for the
+ * short time between text changing event and actual text change. If we know the
+ * same (start) offset will yield a different line index before and after change
+ * we will return for this offset the line index it will have after the change
+ * already before the change is applied. In this example if StyledText ask for
+ * getLineAtOffset(10) we return 0 already before the text is actual changed.
+ * </p>
+ * <p>
+ * This field store the offset for which we should preempt the new line index.
+ * It must be an offset at fixed width border (or negative for none) because
+ * only those have the potential for two different line indexes at same offset.
+ * </p>
+ */
+ private int preemptLineWrapChange = -1;
+
+ /**
* New {@link ConsoleDocumentAdapter} with no {@link IDocument} connected yet.
*
* @param width fixed console width to enforce text wrap or &lt;= 0 to disable
@@ -149,12 +192,12 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
}
document = doc;
- docLegalLineDelimiters = null;
+ docLegalLineDelimiterMatcher = null;
updateWidgetOffsets(0);
if (doc != null) {
doc.addDocumentListener(this);
- docLegalLineDelimiters = doc.getLegalLineDelimiters();
+ docLegalLineDelimiterMatcher = MultiStringMatcher.create(doc.getLegalLineDelimiters());
}
}
@@ -262,6 +305,13 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
// is the index before the insertion index.
widgetLine = (-widgetLine) - 2;
}
+ if (offset == preemptLineWrapChange) {
+ // The requested offset is at fixed width border. In some text change situations
+ // we must return the line index it will have after the change even if the
+ // change is not applied yet. See #preemptLineWrapChange Javadoc for more
+ // details.
+ widgetLine--;
+ }
return widgetLine;
}
}
@@ -383,10 +433,10 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
* @throws BadLocationException if document event is invalid
*/
private TextChangingEvent generateTextChangingEvent(DocumentEvent event) throws BadLocationException {
- String newText = event.getText() == null ? "" : event.getText(); //$NON-NLS-1$
- int newTextLength = newText.length();
- int eventOffset = event.getOffset();
- int eventLength = event.getLength();
+ final String newText = event.getText() == null ? "" : event.getText(); //$NON-NLS-1$
+ final int newTextLength = newText.length();
+ final int eventOffset = event.getOffset();
+ final int eventLength = event.getLength();
int replaceLineCount = 0;
int newLineCount = 0;
@@ -398,52 +448,22 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
// single character inserted at first offset can, from StyledText-Widgets
// perspective, change the content of every line.
- if (newTextLength >= 0 || eventLength > 0) {
+ if (newTextLength > 0 || eventLength > 0) {
// In this method first and last refer to the first and last line affected by
// the current document event
- final int firstDocLineIndex = document.getLineOfOffset(eventOffset);
- final int firstDocLineOffset = document.getLineOffset(firstDocLineIndex);
-
- if (eventOffset != firstDocLineOffset && (eventOffset - firstDocLineOffset) % fixedConsoleWidth == 0) {
- // event start is at fixed width border
- // XXX: the trick here is important to do the impossible
- // The fact that wrapped lines are new lines without a newline delimiter leads
- // to some (nearly) impossible edge cases since all involved interfaces
- // (implicit) assume a newline has its unique offset.
- //
- // Consider a fixed with of 10 and a console filled with (automatically wrapped)
- // content of:
- // 0123456789
- // 0
- // If we remove the last character ('0') we must set replaceLineCount to 1 since
- // there is one line less due to the unwrapped line. The replaceLineCount is
- // necessary so that StyledTextRenderer updates the lines which possible follow
- // below and have changed due to moved content.
- // But StyledTextRenderer presumes that the line index where the event occurs is
- // the same before and after the text change. This is not the case for our auto
- // wrapped lines since getLineAtOffset(10) is 1 before text change and 0 after.
- //
- // To solve this unlucky situation we simply never send text change event
- // occurring at the fixed width wrap border. If such an document change happens
- // we expand the text change to include also the character before the wrap
- // border.
- eventOffset--;
- eventLength++;
- newText = document.get(eventOffset, 1) + newText;
- newTextLength++;
- }
-
final int eventEnd = eventOffset + eventLength;
final int firstWidgetLineIndex = getLineOfOffset(eventOffset);
final int firstWidgetLineOffset = getLineOffset(firstWidgetLineIndex);
+ final int firstInsertLength;
final int lastInsertLength;
int lastDocLineLengthDiff = -eventLength;
int newTextOffset = 0;
- int[] result = TextUtilities.indexOf(docLegalLineDelimiters, newText, newTextOffset);
- if (result[1] < 0) {
+ Match newLineMatch = docLegalLineDelimiterMatcher.indexOf(newText, newTextOffset);
+ if (newLineMatch == null) {
// single line insert
+ firstInsertLength = newTextLength;
lastInsertLength = eventOffset - firstWidgetLineOffset + newTextLength;
lastDocLineLengthDiff += newTextLength;
} else {
@@ -456,19 +476,19 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
// 3. Last line: everything (including) last line delimiter to end of inserted
// text
- final int firstInsertLength = result[0];
+ firstInsertLength = newLineMatch.getOffset();
// newLineCount here is numbers of lines required if text is wrapped -1 because
// we start inserting in an existing line and +1 for the first line delimiter we
// had found
newLineCount = linesIfWrapped(eventOffset - firstWidgetLineOffset + firstInsertLength);
while (true) {
- newTextOffset = result[0] + docLegalLineDelimiters[result[1]].length();
- result = TextUtilities.indexOf(docLegalLineDelimiters, newText, newTextOffset);
- if (result[1] < 0) {
+ newTextOffset = newLineMatch.getOffset() + newLineMatch.getText().length();
+ newLineMatch = docLegalLineDelimiterMatcher.indexOf(newText, newTextOffset);
+ if (newLineMatch == null) {
break;
}
- final int insertedLineLength = result[0] - newTextOffset;
+ final int insertedLineLength = newLineMatch.getOffset() - newTextOffset;
// new text's middle lines are unaffected from existing content and simply count
// as number of lines they need with wrapping
newLineCount += linesIfWrapped(insertedLineLength);
@@ -510,6 +530,18 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
lastAffectedWidgetLineIndex--;
}
replaceLineCount = lastAffectedWidgetLineIndex - firstWidgetLineIndex;
+
+ if (firstInsertLength == 0 && eventLength > 0 && affectedContentAfterRange == 0) {
+ final int firstDocLineOffset = document.getLineInformationOfOffset(eventOffset).getOffset();
+ if (eventOffset != firstDocLineOffset && (eventOffset - firstDocLineOffset) % fixedConsoleWidth == 0) {
+ // Text change produce a tricky wrapped line change. Change start at fixed width
+ // border and is at start of wrapped line because there is wrapped content after
+ // event start. After change there is no more wrapped content after so the same
+ // event start offset is now one widget line above.
+ replaceLineCount++;
+ preemptLineWrapChange = eventOffset;
+ }
+ }
}
final TextChangingEvent changingEvent = new TextChangingEvent(this);
@@ -548,7 +580,7 @@ public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListen
@Override
public synchronized void documentChanged(DocumentEvent event) {
-
+ preemptLineWrapChange = -1;
updateWidgetOffsets(event.getOffset());
TextChangedEvent changeEvent = new TextChangedEvent(this);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
index 7c27120ae..911a1e71b 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
@@ -107,8 +107,7 @@ public class ConsoleManager implements IConsoleManager {
}
IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
+ for (IWorkbenchWindow window : workbenchWindows) {
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
@@ -204,8 +203,7 @@ public class ConsoleManager implements IConsoleManager {
public void addConsoles(IConsole[] consoles) {
List<IConsole> added = new ArrayList<>(consoles.length);
synchronized (fConsoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
+ for (IConsole console : consoles) {
if(console instanceof TextConsole) {
TextConsole ioconsole = (TextConsole)console;
createPatternMatchListeners(ioconsole);
@@ -225,8 +223,7 @@ public class ConsoleManager implements IConsoleManager {
public void removeConsoles(IConsole[] consoles) {
List<IConsole> removed = new ArrayList<>(consoles.length);
synchronized (fConsoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
+ for (IConsole console : consoles) {
if (fConsoles.remove(console)) {
removed.add(console);
}
@@ -338,16 +335,20 @@ public class ConsoleManager implements IConsoleManager {
}
/**
- * Returns whether the given console view should be brought to the top.
- * The view should not be brought to the top if the view is pinned on
- * a console other than the given console.
+ * Returns whether the given console view should be brought to the top. The view
+ * should not be brought to the top if the view is pinned on a console other
+ * than the given console.
+ *
+ * @param console the console to be shown in the view
+ * @param consoleView the view which should be brought to the top
+ * @return whether the given console view should be brought to the top
*/
private boolean shouldBringToTop(IConsole console, IViewPart consoleView) {
- boolean bringToTop= true;
+ boolean bringToTop = true;
if (consoleView instanceof IConsoleView) {
- IConsoleView cView= (IConsoleView)consoleView;
+ IConsoleView cView = (IConsoleView) consoleView;
if (cView.isPinned()) {
- IConsole pinnedConsole= cView.getConsole();
+ IConsole pinnedConsole = cView.getConsole();
bringToTop = console.equals(pinnedConsole);
}
}
@@ -386,8 +387,7 @@ public class ConsoleManager implements IConsoleManager {
fPatternMatchListeners = new ArrayList<>();
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_PATTERN_MATCH_LISTENERS);
IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement config = elements[i];
+ for (IConfigurationElement config : elements) {
PatternMatchListenerExtension extension = new PatternMatchListenerExtension(config);
fPatternMatchListeners.add(extension);
}
@@ -429,15 +429,13 @@ public class ConsoleManager implements IConsoleManager {
fPageParticipants = new ArrayList<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_PAGE_PARTICIPANTS);
IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for(int i = 0; i < elements.length; i++) {
- IConfigurationElement config = elements[i];
+ for (IConfigurationElement config : elements) {
ConsolePageParticipantExtension extension = new ConsolePageParticipantExtension(config);
fPageParticipants.add(extension);
}
}
ArrayList<IConsolePageParticipant> list = new ArrayList<>();
- for (Iterator<ConsolePageParticipantExtension> i = fPageParticipants.iterator(); i.hasNext();) {
- ConsolePageParticipantExtension extension = i.next();
+ for (ConsolePageParticipantExtension extension : fPageParticipants) {
try {
if (extension.isEnabledFor(console)) {
list.add(extension.createDelegate());
@@ -457,8 +455,8 @@ public class ConsoleManager implements IConsoleManager {
fConsoleFactoryExtensions = new ArrayList<>();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.EXTENSION_POINT_CONSOLE_FACTORIES);
IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- fConsoleFactoryExtensions.add(new ConsoleFactoryExtension(configurationElements[i]));
+ for (IConfigurationElement configurationElement : configurationElements) {
+ fConsoleFactoryExtensions.add(new ConsoleFactoryExtension(configurationElement));
}
}
return fConsoleFactoryExtensions.toArray(new ConsoleFactoryExtension[0]);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
index e742ad59f..c82ec6b6e 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
@@ -83,11 +83,11 @@ public class ConsolePatternMatcher implements IDocumentListener {
synchronized (fPatterns) {
patterns = fPatterns.toArray();
}
- for (int i = 0; i < patterns.length; i++) {
+ for (Object pattern : patterns) {
if (monitor.isCanceled()) {
break;
}
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) patterns[i];
+ CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) pattern;
int baseOffset = notifier.end;
int lengthToSearch = endOfSearch - baseOffset;
if (lengthToSearch > 0) {
@@ -179,7 +179,7 @@ public class ConsolePatternMatcher implements IDocumentListener {
}
- private class CompiledPatternMatchListener {
+ private static class CompiledPatternMatchListener {
Pattern pattern;
Pattern qualifier;
@@ -276,12 +276,10 @@ public class ConsolePatternMatcher implements IDocumentListener {
for (CompiledPatternMatchListener notifier : fPatterns) {
notifier.end = 0;
}
- } else {
- if (event.fOffset == 0) {
- //document was trimmed
- for (CompiledPatternMatchListener notifier : fPatterns) {
- notifier.end = notifier.end > event.fLength ? notifier.end - event.fLength : 0;
- }
+ } else if (event.fOffset == 0) {
+ //document was trimmed
+ for (CompiledPatternMatchListener notifier : fPatterns) {
+ notifier.end = notifier.end > event.fLength ? notifier.end - event.fLength : 0;
}
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java
index b299c8140..7cf2e76f5 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java
@@ -98,6 +98,8 @@ public class ConsolePluginImages {
/**
* Returns the ImageRegistry.
+ *
+ * @return the ImageRegistry
*/
public static ImageRegistry getImageRegistry() {
if (imageRegistry == null) {
@@ -107,11 +109,12 @@ public class ConsolePluginImages {
}
/**
- * Initialize the image registry by declaring all of the required
- * graphics. This involves creating JFace image descriptors describing
- * how to create/find the image should it be needed.
- * The image is not actually allocated until requested.
+ * Initialize the image registry by declaring all of the required graphics. This
+ * involves creating JFace image descriptors describing how to create/find the
+ * image should it be needed. The image is not actually allocated until
+ * requested.
*
+ * <pre>
* Prefix conventions
* Wizard Banners WIZBAN_
* Preference Banners PREF_BAN_
@@ -132,25 +135,36 @@ public class ConsolePluginImages {
* 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
+ * </pre>
+ *
+ * @return the initialized ImageRegistry
+ * @see org.eclipse.jface.resource.ImageRegistry
*/
public static ImageRegistry initializeImageRegistry() {
- imageRegistry= new ImageRegistry(ConsolePlugin.getStandardDisplay());
+ imageRegistry = new ImageRegistry(ConsolePlugin.getStandardDisplay());
declareImages();
return imageRegistry;
}
/**
- * Returns the <code>Image<code> identified by the given key,
- * or <code>null</code> if it does not exist.
+ * Returns the <code>Image</code> identified by the given key, or
+ * <code>null</code> if it does not exist.
+ *
+ * @param key the image's key
+ * @return the <code>Image</code> identified by the given key, or
+ * <code>null</code> if it does not exist
*/
public static Image getImage(String key) {
return getImageRegistry().get(key);
}
/**
- * Returns the <code>ImageDescriptor<code> identified by the given key,
- * or <code>null</code> if it does not exist.
+ * Returns the <code>ImageDescriptor</code> identified by the given key, or
+ * <code>null</code> if it does not exist.
+ *
+ * @param key the image's key
+ * @return the <code>ImageDescriptor</code> identified by the given key, or
+ * <code>null</code> if it does not exist
*/
public static ImageDescriptor getImageDescriptor(String key) {
return getImageRegistry().getDescriptor(key);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties
index 95a6613d4..7ac0b3651 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
+# Copyright (c) 2000, 2020 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -20,3 +20,13 @@ find_replace_action_label=&Find/Replace...
find_replace_action_tooltip=Find/Replace
find_replace_action_image=
find_replace_action_description=Find/Replace
+
+find_next_action_label=Find Next
+find_next_action_tooltip=Find Next
+find_next_action_image=
+find_next_action_description=Find next item
+
+find_previous_action_label=Find Previous
+find_previous_action_tooltip=Find Previous
+find_previous_action_image=
+find_previous_action_description=Find previous item \ No newline at end of file
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
index 71f199998..e87dc6605 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2018 Andrey Loskutov <loskutov@gmx.de> and others.
+ * Copyright (c) 2018, 2020 Andrey Loskutov <loskutov@gmx.de> and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,6 +28,7 @@ public class ConsoleUIPreferenceInitializer extends AbstractPreferenceInitialize
public void initializeDefaultPreferences() {
IPreferenceStore prefs = ConsolePlugin.getDefault().getPreferenceStore();
prefs.setDefault(IConsoleConstants.P_CONSOLE_AUTO_SCROLL_LOCK, true);
+ prefs.setDefault(IConsoleConstants.P_CONSOLE_WORD_WRAP, false);
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
index e0985b17b..88d374eff 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
@@ -167,18 +167,20 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
}
super.showPageRec(pageRec);
- fActiveConsole = recConsole;
- IConsole tos = null;
- if (!fStack.isEmpty()) {
- tos = fStack.get(0);
- }
- if (tos != null && !tos.equals(fActiveConsole) && fActive) {
- deactivateParticipants(tos);
+
+ if (fActiveConsole != recConsole) {
+ if (fActive && fActiveConsole != null) {
+ deactivateParticipants(fActiveConsole);
+ }
+ if (recConsole != null) {
+ activateParticipants(recConsole);
+ }
}
- if (fActiveConsole != null && !fActiveConsole.equals(tos)) {
+ fActiveConsole = recConsole;
+ // bring active console on top of stack
+ if (fActiveConsole != null && !fStack.isEmpty() && !fActiveConsole.equals(fStack.get(0))) {
fStack.remove(fActiveConsole);
- fStack.add(0,fActiveConsole);
- activateParticipants(fActiveConsole);
+ fStack.add(0, fActiveConsole);
}
updateTitle();
updateHelp();
@@ -329,8 +331,8 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
// initialize page participants
IConsolePageParticipant[] consoleParticipants = ((ConsoleManager)getConsoleManager()).getPageParticipants(console);
final ListenerList<IConsolePageParticipant> participants = new ListenerList<>();
- for (int i = 0; i < consoleParticipants.length; i++) {
- participants.add(consoleParticipants[i]);
+ for (IConsolePageParticipant consoleParticipant : consoleParticipants) {
+ participants.add(consoleParticipant);
}
fConsoleToPageParticipants.put(console, participants);
for (IConsolePageParticipant iConsolePageParticipant : participants) {
@@ -398,13 +400,11 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
public void consolesAdded(final IConsole[] consoles) {
if (isAvailable()) {
Runnable r = () -> {
- for (int i = 0; i < consoles.length; i++) {
+ for (IConsole console : consoles) {
if (isAvailable()) {
- IConsole console = consoles[i];
// ensure it's still registered since this is done asynchronously
IConsole[] allConsoles = getConsoleManager().getConsoles();
- for (int j = 0; j < allConsoles.length; j++) {
- IConsole registered = allConsoles[j];
+ for (IConsole registered : allConsoles) {
if (registered.equals(console)) {
ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
fConsoleToPart.put(console, part);
@@ -413,7 +413,6 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
break;
}
}
-
}
}
};
@@ -425,9 +424,8 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
public void consolesRemoved(final IConsole[] consoles) {
if (isAvailable()) {
Runnable r = () -> {
- for (int i = 0; i < consoles.length; i++) {
+ for (IConsole console : consoles) {
if (isAvailable()) {
- IConsole console = consoles[i];
fStack.remove(console);
ConsoleWorkbenchPart part = fConsoleToPart.get(console);
if (part != null) {
@@ -513,6 +511,11 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
ConsoleWorkbenchPart part = fConsoleToPart.get(console);
if (part != null) {
partActivated(part);
+ // Workaround for bug 345435: call activated for this to force PageBookView to
+ // activate the new pages context
+ if (fActive) {
+ partActivated(this);
+ }
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java
index 393f0ce12..41be92d72 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java
@@ -40,8 +40,10 @@ public class ConsoleWorkbenchPart implements IWorkbenchPart {
}
/**
- * Constructs a part for the given console that binds to the given
- * site
+ * Constructs a part for the given console that binds to the given site.
+ *
+ * @param console the console which is part of the part
+ * @param site the site to bind the part to
*/
public ConsoleWorkbenchPart(IConsole console, IWorkbenchPartSite site) {
fConsole = console;
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java
index 67a84a3a6..461432766 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,7 +16,6 @@ package org.eclipse.ui.internal.console;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IHyperlink;
-import org.eclipse.ui.console.TextConsoleViewer;
/**
* Follows a hyperlink in the console
@@ -25,28 +24,29 @@ import org.eclipse.ui.console.TextConsoleViewer;
*/
public class FollowHyperlinkAction extends Action {
- private TextConsoleViewer viewer;
+ private IHyperlink hyperlink;
/**
- * Constructs a follow link action
+ * Constructs a follow link action.
+ *
+ * @param hyperlink the hyperlink to follow when activated
*/
- public FollowHyperlinkAction(TextConsoleViewer consoleViewer) {
+ public FollowHyperlinkAction(IHyperlink hyperlink) {
super(ConsoleMessages.FollowHyperlinkAction_0);
setToolTipText(ConsoleMessages.FollowHyperlinkAction_1);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_OPEN_LINK_ACTION);
- this.viewer = consoleViewer;
+ this.hyperlink = hyperlink;
}
@Override
public boolean isEnabled() {
- return viewer.getHyperlink() != null;
+ return hyperlink != null;
}
@Override
public void run() {
- IHyperlink link = viewer.getHyperlink();
- if (link != null) {
- link.linkActivated();
+ if (hyperlink != null) {
+ hyperlink.linkActivated();
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
index 5574fb690..2c734468c 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -37,6 +37,8 @@ public interface IConsoleHelpContextIds {
String CONSOLE_CUT_ACTION = PREFIX + "console_cut_action_context"; //$NON-NLS-1$
String CONSOLE_PASTE_ACTION = PREFIX + "console_paste_action_context"; //$NON-NLS-1$
String CONSOLE_FIND_REPLACE_ACTION = PREFIX + "console_find_replace_action_context"; //$NON-NLS-1$
+ String CONSOLE_FIND_NEXT_ACTION = PREFIX + "console_find_next_action_context"; //$NON-NLS-1$
+ String CONSOLE_FIND_PREVIOUS_ACTION = PREFIX + "console_find_previous_action_context"; //$NON-NLS-1$
String CONSOLE_OPEN_LINK_ACTION = PREFIX + "console_open_link_action_context"; //$NON-NLS-1$
String CONSOLE_OPEN_CONSOLE_ACTION = PREFIX + "console_open_console_action_context"; //$NON-NLS-1$
String CONSOLE_DISPLAY_CONSOLE_ACTION = PREFIX + "console_display_console_action"; //$NON-NLS-1$
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
index 9f6fe30cc..0d27cb25c 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
@@ -17,7 +17,6 @@ package org.eclipse.ui.internal.console;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.console.IConsoleConstants;
@@ -47,13 +46,10 @@ public class IOConsolePage extends TextConsolePage {
super(console, view);
fView = view;
- fPropertyChangeListener = new IPropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
- setReadOnly();
- }
+ fPropertyChangeListener = event -> {
+ String property = event.getProperty();
+ if (property.equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
+ setReadOnly();
}
};
console.addPropertyChangeListener(fPropertyChangeListener);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java
index 3f43137d0..48af576ff 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java
@@ -160,7 +160,7 @@ public class IOConsolePartition implements ITypedRegion {
*/
private int getFontStyle() {
if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getFontStyle();
+ return inputStream != null ? inputStream.getFontStyle() : 0;
}
return outputStream.getFontStyle();
}
@@ -174,7 +174,7 @@ public class IOConsolePartition implements ITypedRegion {
*/
public Color getColor() {
if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getColor();
+ return inputStream != null ? inputStream.getColor() : null;
}
return outputStream.getColor();
}
@@ -236,6 +236,26 @@ public class IOConsolePartition implements ITypedRegion {
return inputStream;
}
+ /**
+ * Test if this partition belongs to the given input stream.
+ *
+ * @param in the input stream to test or <code>null</code>
+ * @return <code>true</code> if this partition belongs to input stream
+ */
+ boolean belongsTo(IOConsoleInputStream in) {
+ return inputStream == in;
+ }
+
+ /**
+ * Test if this partition belongs to the given output stream.
+ *
+ * @param out the output stream to test or <code>null</code>
+ * @return <code>true</code> if this partition belongs to output stream
+ */
+ boolean belongsTo(IOConsoleOutputStream out) {
+ return outputStream == out;
+ }
+
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(40);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
index 81aac3846..3158162b6 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,6 +13,11 @@
* Paul Pazderski - Contributions for:
* Bug 547064: use binary search for getPartition
* Bug 548356: fixed user input handling
+ * Bug 550618: getStyleRanges produced invalid overlapping styles
+ * Bug 550621: Implementation of IConsoleDocumentPartitionerExtension
+ * Bug 76936: Support interpretation of \b and \r in console output
+ * Bug 365770: Race condition in console clearing
+ * Bug 553282: Support interpretation of \f and \v in console output
*******************************************************************************/
package org.eclipse.ui.internal.console;
@@ -22,6 +27,12 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -34,13 +45,15 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitionerExtension;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.MultiStringMatcher;
+import org.eclipse.jface.text.MultiStringMatcher.Match;
import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.text.TypedRegion;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsoleDocumentPartitioner;
+import org.eclipse.ui.console.IConsoleDocumentPartitionerExtension;
import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IOConsoleInputStream;
import org.eclipse.ui.console.IOConsoleOutputStream;
@@ -52,7 +65,27 @@ import org.eclipse.ui.progress.WorkbenchJob;
*
* @since 3.1
*/
-public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocumentPartitionerExtension {
+public class IOConsolePartitioner
+ implements IConsoleDocumentPartitioner, IConsoleDocumentPartitionerExtension, IDocumentPartitionerExtension {
+ /**
+ * Enumeration used to distinct sources of document updates. (especially to
+ * distinct updates triggered by this partitioner from other document changes)
+ */
+ private enum DocUpdateType {
+ /**
+ * Default if reason for document change is not known. Document change is
+ * interpreted as user input.
+ */
+ INPUT,
+ /**
+ * Document update was triggered from this partitioner by appending content
+ * received from output streams.
+ */
+ OUTPUT,
+ /** Document update was triggered from this partitioner's {@link TrimJob}. */
+ TRIM,
+ }
+
/**
* If true validate partitioning after changes and do other additional
* assertions. Useful for developing/debugging.
@@ -64,7 +97,17 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
*/
private static final Comparator<IRegion> CMP_REGION_BY_OFFSET = Comparator.comparing(IRegion::getOffset);
- private PendingPartition consoleClosedPartition;
+ /**
+ * Pattern used to find supported ASCII control characters <b>except</b>
+ * carriage return.
+ */
+ private static final String CONTROL_CHARACTERS_PATTERN_STR = "(?:\b+|\u0000+|\u000b+|\f+)"; //$NON-NLS-1$
+ /**
+ * Pattern used to find supported ASCII control characters <b>including</b>
+ * carriage return.
+ */
+ private static final String CONTROL_CHARACTERS_WITH_CR_PATTERN_STR = "(?:\b+|\u0000+|\u000b+|\f+|\r+(?!\n))"; //$NON-NLS-1$
+
/** The connected {@link IDocument} this partitioner manages. */
private IDocument document;
/**
@@ -72,56 +115,87 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
* {@link IRegion#getOffset()} and not contain <code>null</code> or 0-length
* elements. (see also {@link #checkPartitions()})
*/
- private ArrayList<IOConsolePartition> partitions;
- /** Blocks of data that have not yet been appended to the document. */
- private ArrayList<PendingPartition> pendingPartitions;
+ private final ArrayList<IOConsolePartition> partitions = new ArrayList<>();
/**
- * A list of PendingPartitions to be appended by the updateJob
+ * max ~ 16MB when debugged application outputs faster then we can handle. Seems
+ * to be a could compromise between memory and speed we can handle. Eclipse IDE
+ * may use that memory size ~3 times during processing (buffer+document+parser)
*/
- private ArrayList<PendingPartition> updatePartitions;
+ private static final int MAX_BUFFER_BYTES = 16_000_000;
/**
- * Job that appends pending partitions to the document.
+ * Queue of buffers that have not yet been appended to the document. Every
+ * buffer will hold up to 8192 byte - but typically a single line output if
+ * handled fast. The debugged application will block if the limit is exceeded.
*/
- private QueueProcessingJob queueJob;
+ private final BlockingQueue<PendingPartition> pendingPartitions = new LinkedBlockingQueue<>(
+ MAX_BUFFER_BYTES / 8192);
+ /** Job that appends pending partitions to the document. */
+ private final QueueProcessingJob queueJob = new QueueProcessingJob();
/** Job that trims console content if it exceeds {@link #highWaterMark}. */
- private TrimJob trimJob = new TrimJob();
- /** The input stream attached to this document. */
- private IOConsoleInputStream inputStream;
+ private final TrimJob trimJob = new TrimJob();
/**
- * Flag to indicate that the updateJob is updating the document.
+ * Reason for document update. Set before changing document inside this
+ * partitioner to prevent that change is interpreted as user input.
+ * <p>
+ * Automatically reset to {@link DocUpdateType#INPUT} after every document
+ * change.
+ * </p>
*/
- private boolean updateInProgress;
+ private DocUpdateType updateType = DocUpdateType.INPUT;
/**
* A list of partitions containing input from the console, that have not been
* appended to the input stream yet. No guarantees on element order.
*/
private ArrayList<IOConsolePartition> inputPartitions;
/**
- * offset used by updateJob
+ * A matcher to search for legal line delimiters in new input. Never
+ * <code>null</code> but match nothing if no document connected.
+ */
+ private MultiStringMatcher legalLineDelimiterMatcher;
+ /**
+ * The high mark for console content trimming. If console content exceeds this
+ * length trimming is scheduled. Trimming is disabled if value is negative.
*/
- private int firstOffset;
- /** An array of legal line delimiters. */
- private String[] lld;
private int highWaterMark = -1;
+ /**
+ * The low mark for console content trimming. If trim is performed approximate
+ * this many characters are remain in console.
+ */
private int lowWaterMark = -1;
- private boolean connected = false;
/** The partitioned {@link IOConsole}. */
private IOConsole console;
+ /** Set after console signaled that all streams are closed. */
+ private volatile boolean streamsClosed;
/**
- * Lock for appending to and removing from the document - used
- * to synchronize addition of new text/partitions in the update
- * job and handling buffer overflow/clearing of the console.
+ * Active pattern to search for supported control characters. If
+ * <code>null</code> control characters are treated as any other characters.
*/
- private Object overflowLock = new Object();
-
-
- private int fBuffer;
+ private Pattern controlCharacterPattern = null;
+ /**
+ * Whether <code>\r</code> is interpreted as control characters
+ * (<code>true</code>) or not in console output. If <code>false</code> they are
+ * probably handled as newline.
+ */
+ private boolean carriageReturnAsControlCharacter = true;
+ /**
+ * Offset where next output is written to console.
+ */
+ private int outputOffset = 0;
- public IOConsolePartitioner(IOConsoleInputStream inputStream, IOConsole console) {
- this.inputStream = inputStream;
- this.console = console;
+ /**
+ * Create new partitioner for an {@link IOConsole}.
+ * <p>
+ * The partitioner must be explicit {@link #connect(IDocument) connected} with
+ * the consoles {@link IDocument}.
+ * </p>
+ *
+ * @param console the partitioned console. Not <code>null</code>.
+ */
+ public IOConsolePartitioner(IOConsole console) {
+ this.console = Objects.requireNonNull(console);
+ queueJob.setRule(console.getSchedulingRule());
trimJob.setRule(console.getSchedulingRule());
}
@@ -136,27 +210,59 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
@Override
public void connect(IDocument doc) {
- document = doc;
- document.setDocumentPartitioner(this);
- lld = document.getLegalLineDelimiters();
- partitions = new ArrayList<>();
- pendingPartitions = new ArrayList<>();
- inputPartitions = new ArrayList<>();
- queueJob = new QueueProcessingJob();
- queueJob.setSystem(true);
- queueJob.setPriority(Job.INTERACTIVE);
- queueJob.setRule(console.getSchedulingRule());
- connected = true;
+ if (doc == document) {
+ return;
+ }
+ disconnect();
+ if (doc != null) {
+ synchronized (partitions) {
+ inputPartitions = new ArrayList<>();
+ document = doc;
+ legalLineDelimiterMatcher = MultiStringMatcher.create(document.getLegalLineDelimiters());
+ }
+ }
+ }
+
+ @Override
+ public void disconnect() {
+ pendingPartitions.clear();
+ synchronized (partitions) {
+ trimJob.cancel();
+ queueJob.cancel();
+ legalLineDelimiterMatcher = null;
+ document = null;
+ inputPartitions = null;
+ partitions.clear();
+ }
}
+ /**
+ * Get high water mark.
+ *
+ * @return the trim if exceeded mark
+ * @see IOConsole#getHighWaterMark()
+ */
public int getHighWaterMark() {
return highWaterMark;
}
+ /**
+ * Get low water mark.
+ *
+ * @return the trim to this length mark
+ * @see IOConsole#getLowWaterMark()
+ */
public int getLowWaterMark() {
return lowWaterMark;
}
+ /**
+ * Set low and high water marks.
+ *
+ * @param low the trim to this length mark
+ * @param high the trim if exceeded mark
+ * @see IOConsole#setWaterMarks(int, int)
+ */
public void setWaterMarks(int low, int high) {
lowWaterMark = low;
highWaterMark = high;
@@ -167,22 +273,28 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
* Notification from the console that all of its streams have been closed.
*/
public void streamsClosed() {
- consoleClosedPartition = new PendingPartition(null, null);
- synchronized (pendingPartitions) {
- pendingPartitions.add(consoleClosedPartition);
+ if (streamsClosed) {
+ String msg = "Streams are already closed.";//$NON-NLS-1$
+ log(IStatus.ERROR, msg, new IllegalStateException(msg));
+ return;
}
- queueJob.schedule(); //ensure that all pending partitions are processed.
+ streamsClosed = true;
+ checkFinished();
}
- @Override
- public void disconnect() {
- synchronized (overflowLock) {
- document = null;
- partitions.clear();
- connected = false;
- try {
- inputStream.close();
- } catch (IOException e) {
+ /**
+ * Check if partitioner is finished and does not expect any new data appended to
+ * document.
+ */
+ private void checkFinished() {
+ if (streamsClosed) {
+ // do not expect new data since all streams are closed
+ // check if pending data is queued
+ final boolean morePending = !pendingPartitions.isEmpty();
+ if (morePending) {
+ queueJob.schedule();
+ } else {
+ console.partitionerFinished();
}
}
}
@@ -220,6 +332,21 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
* @return the partitioning of the requested range (never <code>null</code>)
*/
private IOConsolePartition[] computeIOPartitioning(int offset, int length) {
+ return computePartitioning(offset, length, true, true);
+ }
+
+ /**
+ * Get partitioning for a given range with possibility to filter partitions by
+ * their read-only property.
+ *
+ * @param offset the offset of the range of interest
+ * @param length the length of the range of interest
+ * @param includeWritable if false writable partitions are skipped
+ * @param includeReadOnly if false read-only partitions are skipped
+ * @return the partitioning of the requested range (never <code>null</code>)
+ */
+ private IOConsolePartition[] computePartitioning(int offset, int length, boolean includeWritable,
+ boolean includeReadOnly) {
final List<IOConsolePartition> result = new ArrayList<>();
synchronized (partitions) {
int index = findPartitionCandidate(offset);
@@ -233,7 +360,9 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
if (partition.getOffset() >= end) {
break;
}
- result.add(partition);
+ if ((includeWritable && !partition.isReadOnly()) || (includeReadOnly && partition.isReadOnly())) {
+ result.add(partition);
+ }
}
}
return result.toArray(new IOConsolePartition[0]);
@@ -295,74 +424,79 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
/**
* Enforces the buffer size.
- * When the number of lines in the document exceeds the high water mark, the
- * beginning of the document is trimmed until the number of lines equals the
- * low water mark.
+ * <p>
+ * When the document length exceeds the high water mark, the beginning of the
+ * document is trimmed until the document length is approximately the low water
+ * mark.
+ * </p>
*/
private void checkBufferSize() {
if (document != null && highWaterMark > 0) {
int length = document.getLength();
if (length > highWaterMark) {
- if (trimJob.getState() == Job.NONE) { //if the job isn't already running
- trimJob.setOffset(length - lowWaterMark);
- trimJob.schedule();
- }
+ // do trim synchronous to prevent drawing trimmed text - we are already in UI and have the lock
+ trim(length - lowWaterMark, true);
}
}
}
/**
- * Clears the console
+ * Clears the console content.
*/
public void clearBuffer() {
- synchronized (overflowLock) {
- trimJob.setOffset(-1);
- trimJob.schedule();
+ pendingPartitions.clear();
+ synchronized (partitions) {
+ if (document != null) {
+ trimJob.setTrimOffset(document.getLength());
+ trimJob.schedule();
+ }
}
}
@Override
public IRegion documentChanged2(DocumentEvent event) {
- if (document == null) {
- return null; //another thread disconnected the partitioner
- }
- if (document.getLength() == 0) { // document cleared
- synchronized (partitions) {
- partitions.clear();
- inputPartitions.clear();
+ try {
+ if (document != event.getDocument()) {
+ log(IStatus.WARNING, "IOConsolePartitioner is connected to wrong document."); //$NON-NLS-1$
+ return null;
+ }
+ if (document.getLength() == 0) { // document cleared
+ synchronized (partitions) {
+ partitions.clear();
+ inputPartitions.clear();
+ outputOffset = 0;
+ }
+ return new Region(0, 0);
}
- return new Region(0, 0);
- }
-
- if (updateInProgress) {
- synchronized(partitions) {
- if (updatePartitions != null) {
- IOConsolePartition lastPartition = getPartitionByIndex(partitions.size() - 1);
- for (PendingPartition pp : updatePartitions) {
- if (pp == consoleClosedPartition) {
- continue;
- }
- int ppLen = pp.text.length();
- if (lastPartition != null && lastPartition.getOutputStream() == pp.stream) {
- int len = lastPartition.getLength();
- lastPartition.setLength(len + ppLen);
- } else {
- IOConsolePartition partition = new IOConsolePartition(firstOffset, pp.stream);
- partition.setLength(ppLen);
- lastPartition = partition;
- partitions.add(partition);
+ synchronized (partitions) {
+ switch (updateType) {
+ case INPUT:
+ if (event.getOffset() <= outputOffset) { // move output offset if necessary
+ outputOffset -= Math.min(event.getLength(), outputOffset - event.getOffset());
+ if (event.getText() != null) {
+ outputOffset += event.getText().length();
}
- firstOffset += ppLen;
}
+ return applyUserInput(event);
+
+ // update and trim jobs are triggered by this partitioner and all partitioning
+ // changes are applied separately
+ case OUTPUT:
+ return null; // changedRegion was never assigned
+ case TRIM:
+ return null; // trim does not change partition types
+
+ default:
+ log(IStatus.ERROR, "Invalid enum value " + updateType); //$NON-NLS-1$
+ return null;
}
}
- } else {
- synchronized (partitions) {
- return applyUserInput(event);
- }
+ } finally {
+ // always reset type since all change events not triggered by this partitioner
+ // are interpreted as user input
+ updateType = DocUpdateType.INPUT;
}
- return new Region(event.fOffset, event.fText.length());
}
/**
@@ -379,10 +513,14 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
* @return the region of the document in which the partition type changed or
* <code>null</code>
*/
+ // Required for a false 'resource not closed' warning on inputStream.
+ // This input stream must not be closed by this method.
+ @SuppressWarnings("resource")
private IRegion applyUserInput(DocumentEvent event) {
final int eventTextLength = event.getText() != null ? event.getText().length() : 0;
final int offset = event.getOffset();
final int amountDeleted = event.getLength();
+ final IOConsoleInputStream inputStream = console.getInputStream(); // do not close this stream
if (amountDeleted == 0 && eventTextLength == 0) {
// event did not changed document
@@ -422,9 +560,9 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
// process event text in parts split on line delimiters
int textOffset = 0;
while (textOffset < eventTextLength) {
- final int[] result = TextUtilities.indexOf(lld, event.getText(), textOffset);
- final boolean foundNewline = result[1] >= 0;
- final int newTextOffset = foundNewline ? result[0] + lld[result[1]].length() : eventTextLength;
+ final Match nextNewline = legalLineDelimiterMatcher.indexOf(event.getText(), textOffset);
+ final int newTextOffset = nextNewline != null ? nextNewline.getOffset() + nextNewline.getText().length()
+ : eventTextLength;
final int inputLength = newTextOffset - textOffset;
if (inputPartition == null || inputPartition.isReadOnly()) {
@@ -443,7 +581,7 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
inputPartition.setLength(inputPartition.getLength() + inputLength);
- if (foundNewline) {
+ if (nextNewline != null) {
inputPartitions.sort(CMP_REGION_BY_OFFSET);
final StringBuilder inputLine = new StringBuilder();
for (IOConsolePartition p : inputPartitions) {
@@ -459,7 +597,9 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
if (ASSERT) {
Assert.isTrue(inputLine.length() > 0);
}
- inputStream.appendData(inputLine.toString());
+ if (inputStream != null) {
+ inputStream.appendData(inputLine.toString());
+ }
}
Assert.isTrue(newTextOffset > textOffset); // can prevent infinity loop
textOffset = newTextOffset;
@@ -512,6 +652,7 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
* and a new partition will start
* @return the newly created partition (i.e. the right side of the split)
*/
+ @SuppressWarnings("resource") // suppress wrong 'not closed' warnings
private IOConsolePartition splitPartition(int offset) {
final int partitionIndex = findPartitionCandidate(offset);
final IOConsolePartition existingPartition = partitions.get(partitionIndex);
@@ -533,15 +674,11 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
return newPartition;
}
- private void setUpdateInProgress(boolean b) {
- updateInProgress = b;
- }
-
/**
* A stream has been appended, add to pendingPartions list and schedule
* updateJob. updateJob is scheduled with a slight delay, this allows the
* console to run the job less frequently and update the document with a greater
- * amount of data each time the job is run
+ * amount of data each time the job is run.
*
* @param stream The stream that was written to.
* @param s The string that should be appended to the document.
@@ -551,33 +688,30 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
if (document == null) {
throw new IOException("Document is closed"); //$NON-NLS-1$
}
- synchronized(pendingPartitions) {
- PendingPartition last = pendingPartitions.size() > 0 ? pendingPartitions.get(pendingPartitions.size()-1) : null;
- if (last != null && last.stream == stream) {
- last.append(s);
- } else {
- pendingPartitions.add(new PendingPartition(stream, s));
- if (fBuffer > 1000) {
- queueJob.schedule();
- } else {
- queueJob.schedule(50);
- }
- }
+ if (s == null) {
+ return;
+ }
+ PendingPartition partition = new PendingPartition(stream, s);
+ while (!offer(partition)) {
+ helpProgress();
+ }
+ queueJob.schedule();
+ }
- if (fBuffer > 160000) {
- if(Display.getCurrent() == null){
- try {
- pendingPartitions.wait();
- } catch (InterruptedException e) {
- }
- } else {
- /*
- * if we are in UI thread we cannot lock it, so process
- * queued output.
- */
- processQueue();
- }
- }
+ private void helpProgress() {
+ if (Display.getCurrent() != null) {
+ // make sure pendingPartitions can take
+ queueJob.processPendingPartitions();
+ } else {
+ Thread.yield(); // give UI thread chance to proceed
+ }
+ }
+
+ private boolean offer(PendingPartition p) {
+ try {
+ return pendingPartitions.offer(p, 10, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ return false;
}
}
@@ -585,35 +719,43 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
* Holds data until updateJob can be run and the document can be updated.
*/
private class PendingPartition {
- StringBuilder text = new StringBuilder(8192);
- IOConsoleOutputStream stream;
+ private final CharSequence text;
+ private final IOConsoleOutputStream stream;
- PendingPartition(IOConsoleOutputStream stream, String text) {
+ PendingPartition(IOConsoleOutputStream stream, CharSequence text) {
this.stream = stream;
- if (text != null) {
- append(text);
- }
+ this.text = text;
}
- void append(String moreText) {
- text.append(moreText);
- fBuffer += moreText.length();
+ @Override
+ public String toString() {
+ return text.toString();
}
}
/**
- * Updates the document. Will append everything that is available before
- * finishing.
+ * Updates the document and partitioning structure. Will append everything
+ * received from output streams that is available before finishing.
*/
private class QueueProcessingJob extends UIJob {
+ /** The partition which contains the current output offset. */
+ private IOConsolePartition atOutputPartition = null;
+ /** The index of atOutputPartition in the partitions list. */
+ private int atOutputPartitionIndex = -1;
+ /** The pending number of characters to replace in document. */
+ private int replaceLength;
+ /** The offset in document where to apply the next replace. */
+ private int nextWriteOffset;
QueueProcessingJob() {
super("IOConsole Updater"); //$NON-NLS-1$
+ setSystem(true);
+ setPriority(Job.INTERACTIVE);
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- processQueue();
+ processPendingPartitions();
if (ASSERT) {
checkPartitions();
}
@@ -621,76 +763,401 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
}
/*
- * Job will process as much as it can each time it's run, but it gets
- * scheduled everytime a PendingPartition is added to the list, meaning
- * that this job could get scheduled unnecessarily in cases of heavy output.
- * Note however, that schedule() will only reschedule a running/scheduled Job
- * once even if it's called many times.
+ * Job will process as much as it can each time it's run, but it gets scheduled
+ * everytime a PendingPartition is added to the list, meaning that this job
+ * could get scheduled unnecessarily in cases of heavy output. Note however,
+ * that schedule() will only reschedule a running/scheduled Job once even if
+ * it's called many times.
*/
@Override
public boolean shouldRun() {
- boolean shouldRun = connected && pendingPartitions != null && pendingPartitions.size() > 0;
- return shouldRun;
- }
- }
-
- void processQueue() {
- synchronized (overflowLock) {
- ArrayList<PendingPartition> pendingCopy = new ArrayList<>();
- StringBuilder buffer = null;
- boolean consoleClosed = false;
- synchronized(pendingPartitions) {
- pendingCopy.addAll(pendingPartitions);
- pendingPartitions.clear();
- fBuffer = 0;
- pendingPartitions.notifyAll();
- }
- // determine buffer size
- int size = 0;
- for (PendingPartition pp : pendingCopy) {
- if (pp != consoleClosedPartition) {
- size+= pp.text.length();
+ return !pendingPartitions.isEmpty();
+ }
+
+ /**
+ * Process {@link #pendingPartitions}, append their content to document and
+ * update partitioning.
+ */
+ private void processPendingPartitions() {
+ final List<PendingPartition> pendingCopy = new ArrayList<>();
+ // draining the whole buffer here is important - this way we get as much data as
+ // available and may skip to draw text that exceeds the Console buffer size
+ // anyway (see checkBufferSize()).
+ pendingPartitions.drainTo(pendingCopy);
+ int sizeHint = 0;
+ if (pendingCopy.isEmpty()) {
+ return;
+ }
+ IOConsoleOutputStream stream = pendingCopy.get(0).stream;
+ for (PendingPartition p : pendingCopy) {
+ if (p.stream != stream) {
+ break;
+ }
+ sizeHint += p.text.length();
+ }
+ synchronized (partitions) {
+ if (document != null) {
+ applyStreamOutput(pendingCopy, sizeHint);
}
+ checkFinished();
+ checkBufferSize(); // needs partitions synchronized
}
- buffer = new StringBuilder(size);
- for (PendingPartition pp : pendingCopy) {
- if (pp != consoleClosedPartition) {
- buffer.append(pp.text);
+ }
+
+ /**
+ * Apply content collected in pending partitions to document and update
+ * partitioning structure.
+ * <p>
+ * This method is also responsible to interpret control characters if enabled
+ * (see {@link #isHandleControlCharacters()}).
+ * </p>
+ *
+ * @param pendingCopy the pending partitions to process
+ * @param sizeHint a hint for expected content length to initialize buffer
+ * size. Does not have to be exact as long as it is not
+ * negative.
+ */
+ private void applyStreamOutput(List<PendingPartition> pendingCopy, int sizeHint) {
+ // local reference to get consistent parsing without blocking pattern changes
+ final Pattern controlPattern = controlCharacterPattern;
+ // Variables to collect required data to reduce number of document updates. The
+ // partitioning must be updated in smaller iterations as the actual document
+ // content. E.g. pending partitions are distinct on source output stream
+ // resulting in multiple partitions but if all the content is appended to the
+ // document there is only one update required to add the actual content.
+ nextWriteOffset = outputOffset;
+ StringBuilder content = new StringBuilder(sizeHint);
+ replaceLength = 0;
+ atOutputPartition = null;
+ atOutputPartitionIndex = -1;
+
+ for (PendingPartition pending : pendingCopy) {
+ // create matcher to find control characters in pending content (if enabled)
+ CharSequence text = pending.text;
+ IOConsoleOutputStream stream = pending.stream;
+ final Matcher controlCharacterMatcher = controlPattern != null ? controlPattern.matcher(text)
+ : null;
+
+ for (int textOffset = 0; textOffset < text.length();) {
+ // Process pending content in chunks.
+ // Processing is primary split on control characters since there interpretation
+ // is easier if all content changes before are already applied.
+ // Additional processing splits may result while overwriting existing output and
+ // overwrite overlaps partitions.
+ final boolean foundControlCharacter;
+ final int partEnd;
+ if (controlCharacterMatcher != null && controlCharacterMatcher.find()) {
+ if (ASSERT) {
+ // check used pattern. Assert it matches only sequences of same characters.
+ final String match = controlCharacterMatcher.group();
+ Assert.isTrue(match.length() > 0);
+ final char matchedChar = match.charAt(0);
+ for (char c : match.toCharArray()) {
+ Assert.isTrue(c == matchedChar);
+ }
+ }
+ partEnd = controlCharacterMatcher.start();
+ foundControlCharacter = true;
+ } else {
+ partEnd = text.length();
+ foundControlCharacter = false;
+ }
+
+ partititonContent(stream, text, textOffset, partEnd, content);
+ textOffset = partEnd;
+
+ // finished processing of regular content before control characters
+ // now interpret control characters if any
+ if (controlCharacterMatcher != null && foundControlCharacter) {
+ // at first update console document since it is easier to interpret control
+ // characters on an up-to-date document and partitioning
+ applyOutputToDocument(content.toString(), nextWriteOffset, replaceLength);
+ content.setLength(0);
+ replaceLength = 0;
+ nextWriteOffset = outputOffset;
+
+ final String controlCharacterMatch = controlCharacterMatcher.group();
+ final char controlCharacter = controlCharacterMatch.charAt(0);
+ final int outputLineStartOffset = findOutputLineStartOffset(outputOffset);
+ switch (controlCharacter) {
+ case '\b':
+ // move virtual output cursor one step back for each \b
+ // but stop at current line start and skip any input partitions
+ int backStepCount = controlCharacterMatch.length();
+ if (partitions.isEmpty()) {
+ outputOffset = 0;
+ break;
+ }
+ if (atOutputPartition == null) {
+ atOutputPartitionIndex = partitions.size() - 1;
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+ }
+ while (backStepCount > 0 && outputOffset > outputLineStartOffset) {
+ if (atOutputPartition != null && isInputPartition(atOutputPartition)) {
+ do {
+ outputOffset = atOutputPartition.getOffset() - 1;
+ atOutputPartitionIndex--;
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+ } while (atOutputPartition != null && isInputPartition(atOutputPartition));
+ backStepCount--;
+ }
+ if (atOutputPartition == null) {
+ outputOffset = 0;
+ break;
+ }
+ final int backSteps = Math.min(outputOffset - atOutputPartition.getOffset(),
+ backStepCount);
+ outputOffset -= backSteps;
+ backStepCount -= backSteps;
+ atOutputPartitionIndex--;
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+ }
+ outputOffset = Math.max(outputOffset, outputLineStartOffset);
+ nextWriteOffset = outputOffset;
+ break;
+
+ case '\r':
+ // move virtual output cursor to start of output line
+ outputOffset = outputLineStartOffset;
+ atOutputPartitionIndex = -1;
+ atOutputPartition = null;
+ nextWriteOffset = outputOffset;
+ break;
+
+ case '\f':
+ case '\u000b': // \v
+ // Vertical tab does not override existing content. It will introduce a newline
+ // (at the end of current line even if output offset is inside the line) and
+ // indent the new line dependent on current output offset.
+ int indention = outputOffset - outputLineStartOffset;
+ final int vtabCount = controlCharacterMatch.length();
+ final StringBuilder vtab = new StringBuilder(indention + vtabCount);
+ for (int i = 0; i < vtabCount; i++) {
+ vtab.append(System.lineSeparator());
+ }
+ for (int i = 0; i < indention; i++) {
+ vtab.append(' ');
+ }
+ outputOffset = document.getLength();
+ nextWriteOffset = outputOffset;
+ partititonContent(stream, vtab, 0, vtab.length(), content);
+ break;
+
+ case 0:
+ // Do nothing for null bytes. The use of this is that a null byte which reach
+ // the IOConsoleViewer will truncate the line on some platforms and will disturb
+ // copying text on most platforms.
+ // This case should simply filter out any null bytes.
+ break;
+
+ default:
+ // should never happen as long as the used regex pattern is valid
+ log(IStatus.ERROR, "No implementation to handle control character 0x" //$NON-NLS-1$
+ + Integer.toHexString(controlCharacter));
+ break;
+ }
+ textOffset = controlCharacterMatcher.end();
+ }
+ }
+ }
+ applyOutputToDocument(content.toString(), nextWriteOffset, replaceLength);
+ }
+
+ /**
+ * If {@link IOConsolePartitioner#outputOffset} is at end of current content it
+ * will simply append the new partition or extend the last existing if
+ * applicable.
+ * <p>
+ * If output offset is within existing content the method will overwrite
+ * existing content and handle all required replacements and adjustments of
+ * existing partitions.
+ * </p>
+ *
+ * @param stream the stream the to be partitioned content belongs to aka the
+ * stream which appended the content
+ * @param text the text to partition. Depending on given offsets only a
+ * part of text is partitioned.
+ * @param offset the start offset (inclusive) within text to partition
+ * @param endOffset the end offset (exclusive) within text to partition
+ */
+ private void partititonContent(IOConsoleOutputStream stream, CharSequence text, int offset, int endOffset,
+ StringBuilder content) {
+ int textOffset = offset;
+ while (textOffset < endOffset) {
+ // Process content part. This part never contains control characters.
+ // Processing may require multiple iterations if we overwrite existing content
+ // which consists of distinct partitions.
+
+ if (outputOffset >= document.getLength()) {
+ // content is appended to document end (the easy case)
+ if (atOutputPartition == null) {
+ // get the last existing partition to try to expand it
+ atOutputPartitionIndex = partitions.size() - 1;
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+ if (ASSERT) {
+ Assert.isTrue(atOutputPartitionIndex == findPartitionCandidate(outputOffset - 1));
+ }
+ }
+ if (atOutputPartition == null || !atOutputPartition.belongsTo(stream)) {
+ // no partitions yet or last partition is incompatible to reuse -> add new one
+ atOutputPartition = new IOConsolePartition(outputOffset, stream);
+ partitions.add(atOutputPartition);
+ atOutputPartitionIndex = partitions.size() - 1;
+ }
+ final int appendedLength = endOffset - textOffset;
+ content.append(text, textOffset, endOffset);
+ atOutputPartition.setLength(atOutputPartition.getLength() + appendedLength);
+ outputOffset += appendedLength;
+ textOffset = endOffset;
} else {
- consoleClosed = true;
+ // content overwrites existing console content (the tricky case)
+ if (atOutputPartition == null) {
+ // find partition where output will overwrite or create one if unpartitioned
+ atOutputPartitionIndex = findPartitionCandidate(outputOffset);
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+ if (atOutputPartition == null) {
+ atOutputPartition = new IOConsolePartition(outputOffset, stream);
+ atOutputPartitionIndex++;
+ partitions.add(atOutputPartitionIndex, atOutputPartition);
+ }
+ }
+
+ // we do not overwrite input partitions at the moment so they need to be skipped
+ if (isInputPartition(atOutputPartition)) {
+ outputOffset = atOutputPartition.getOffset() + atOutputPartition.getLength();
+ atOutputPartitionIndex++;
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+
+ // apply document changes collected until now
+ applyOutputToDocument(content.toString(), nextWriteOffset, replaceLength);
+ content.setLength(0);
+ replaceLength = 0;
+ nextWriteOffset = outputOffset;
+ continue; // to check if next selected partition is also input or appending now
+ }
+
+ // limit chunks to overwrite only one existing partition at a time
+ final int chunkLength = Math.min(endOffset - textOffset,
+ atOutputPartition.getLength() - (outputOffset - atOutputPartition.getOffset()));
+ Assert.isTrue(chunkLength > 0); // do not remove since it can prevent an infinity loop
+
+ if (!atOutputPartition.belongsTo(stream)) {
+ // new output is from other stream then overwritten output
+
+ // Note: this implementation ignores the possibility to reuse the partition
+ // where the overwrite chunk ends and expand it towards replace begin since this
+ // makes things code much more complex. In some cases this may leads to
+ // consecutive partitions which could be merged to one partition. Merging is not
+ // implemented at the moment.
+
+ // in this part outputPartition is used to partition the new content
+ // and atOutputPartition points to the partition whose content is overwritten
+ // i.e. the new partition grows and the old one must shrink
+ IOConsolePartition outputPartition = null;
+ if (atOutputPartition.getOffset() == outputOffset) {
+ // try to expand the partition before our output offset
+ outputPartition = getPartitionByIndex(atOutputPartitionIndex - 1);
+ } else {
+ // overwrite starts inside existing incompatible partition
+ atOutputPartition = splitPartition(outputOffset);
+ atOutputPartitionIndex++;
+ }
+ if (outputPartition == null || !outputPartition.belongsTo(stream)) {
+ outputPartition = new IOConsolePartition(outputOffset, stream);
+ partitions.add(atOutputPartitionIndex, outputPartition);
+ atOutputPartitionIndex++;
+ }
+
+ // update partitioning of the overwritten chunk
+ outputPartition.setLength(outputPartition.getLength() + chunkLength);
+ atOutputPartition.setOffset(atOutputPartition.getOffset() + chunkLength);
+ atOutputPartition.setLength(atOutputPartition.getLength() - chunkLength);
+
+ if (atOutputPartition.getLength() == 0) {
+ // overwritten partition is now empty and must be be removed
+ partitions.remove(atOutputPartitionIndex);
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+ }
+ }
+ content.append(text, textOffset, textOffset + chunkLength);
+ replaceLength += chunkLength;
+ textOffset += chunkLength;
+ outputOffset += chunkLength;
+ if (atOutputPartition != null
+ && outputOffset == atOutputPartition.getOffset() + atOutputPartition.getLength()) {
+ atOutputPartitionIndex++;
+ atOutputPartition = getPartitionByIndex(atOutputPartitionIndex);
+ }
}
}
- if (connected) {
- setUpdateInProgress(true);
- updatePartitions = pendingCopy;
- firstOffset = document.getLength();
- try {
- if (buffer != null) {
- document.replace(firstOffset, 0, buffer.toString());
+ }
+
+ /**
+ * Find offset of line start from given output offset. This method ignores line
+ * breaks partitioned as input. I.e. it looks at the document as if it only
+ * consist of the output parts.
+ *
+ * @param outOffset offset where output should be written
+ * @return the start offset of line where output should be written
+ */
+ private int findOutputLineStartOffset(int outOffset) {
+ int outputLineStartOffset = 0;
+ try {
+ for (int lineIndex = document.getLineOfOffset(outOffset); lineIndex >= 0; lineIndex--) {
+ outputLineStartOffset = document.getLineOffset(lineIndex);
+ final IOConsolePartition lineBreakPartition = getIOPartition(outputLineStartOffset - 1);
+ if (lineBreakPartition == null || !isInputPartition(lineBreakPartition)) {
+ break;
}
- } catch (BadLocationException e) {
}
- updatePartitions = null;
- setUpdateInProgress(false);
+ } catch (BadLocationException e) {
+ log(e);
+ outputLineStartOffset = 0;
}
- if (consoleClosed) {
- console.partitionerFinished();
+ if (ASSERT) {
+ Assert.isTrue(outputLineStartOffset <= outOffset);
}
- checkBufferSize();
+ return outputLineStartOffset;
}
+ /**
+ * Apply content from output streams to document. It expects the partitioning
+ * has or will update partitioning to reflect the change since it prevents this
+ * partitioner's {@link #documentChanged2(DocumentEvent)} method from changing
+ * partitioning.
+ *
+ * @param text collected content from output streams; not <code>null</code>
+ * @param offset offset in document where content is inserted
+ * @param length length of overwritten old output
+ */
+ private void applyOutputToDocument(String text, int offset, int length) {
+ if (text.length() > 0 || length > 0) {
+ if (ASSERT) {
+ Assert.isTrue(length <= text.length());
+ }
+ try {
+ updateType = DocUpdateType.OUTPUT;
+ document.replace(offset, length, text);
+ } catch (BadLocationException e) {
+ log(e);
+ }
+ }
+ }
}
/**
- * Job to trim the console document, runs in the UI thread.
+ * Job to trim the console document, runs in the UI thread.
*/
private class TrimJob extends WorkbenchJob {
+ /** Trims output up to given offset. */
+ private int truncateOffset;
+
/**
- * trims output up to the line containing the given offset,
- * or all output if -1.
+ * If <code>true</code> trim only to start of line containing the
+ * {@link #truncateOffset}.
*/
- private int truncateOffset;
+ private boolean truncateToOffsetLineStart;
/**
* Creates a new job to trim the buffer.
@@ -703,85 +1170,244 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
/**
* Sets the trim offset.
*
- * @param offset trims output up to the line containing the given offset
+ * @param offset trims console content up to this offset
*/
- public void setOffset(int offset) {
+ public void setTrimOffset(int offset) {
+ // XXX an arbitrary offset would cause follow up errors if we trim a delim
+ // exactly between \r and \n
truncateOffset = offset;
+ truncateToOffsetLineStart = false;
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- if (document == null) {
- return Status.OK_STATUS;
+ synchronized (partitions) {
+ trim(truncateOffset, truncateToOffsetLineStart);
}
+ return Status.OK_STATUS;
+ }
- int length = document.getLength();
- if (truncateOffset < length) {
- synchronized (overflowLock) {
- try {
- if (truncateOffset < 0) {
- // clear
- setUpdateInProgress(true);
- document.set(""); //$NON-NLS-1$
- setUpdateInProgress(false);
- } else {
- // overflow
- int cutoffLine = document.getLineOfOffset(truncateOffset);
- int cutOffset = document.getLineOffset(cutoffLine);
-
-
- // set the new length of the first partition
- IOConsolePartition partition = (IOConsolePartition) getPartition(cutOffset);
- partition.setLength(partition.getOffset() + partition.getLength() - cutOffset);
-
- setUpdateInProgress(true);
- document.replace(0, cutOffset, ""); //$NON-NLS-1$
- setUpdateInProgress(false);
-
- //remove partitions and reset Partition offsets
- int index = partitions.indexOf(partition);
- for (int i = 0; i < index; i++) {
- partitions.remove(0);
- }
+ }
- int offset = 0;
- for (IOConsolePartition p : partitions) {
- p.setOffset(offset);
- offset += p.getLength();
- }
+ private void trim(int truncateOffset, boolean truncateToOffsetLineStart) {
+ if (document != null) {
+ {
+ try {
+ int length = document.getLength();
+ int cutOffset = truncateOffset;
+ if (truncateToOffsetLineStart) {
+ int cutoffLine = document.getLineOfOffset(truncateOffset);
+ cutOffset = document.getLineOffset(cutoffLine);
+ }
+ if (cutOffset >= length) {
+ updateType = DocUpdateType.TRIM;
+ document.set(""); //$NON-NLS-1$
+ } else {
+ // set the new length of the first partition
+ IOConsolePartition partition = getIOPartition(cutOffset);
+ partition.setLength(partition.getOffset() + partition.getLength() - cutOffset);
+
+ updateType = DocUpdateType.TRIM;
+ document.replace(0, cutOffset, ""); //$NON-NLS-1$
+
+ // remove partitions and reset Partition offsets
+ int index = partitions.indexOf(partition);
+ for (int i = 0; i < index; i++) {
+ partitions.remove(0);
}
- if (ASSERT) {
- checkPartitions();
+
+ int offset = 0;
+ for (IOConsolePartition p : partitions) {
+ p.setOffset(offset);
+ offset += p.getLength();
}
- } catch (BadLocationException e) {
+
+ // fix output offset
+ int removedLength = cutOffset;
+ outputOffset = Math.max(outputOffset - removedLength, 0);
+ }
+ if (ASSERT) {
+ checkPartitions();
}
+ } catch (BadLocationException e) {
+ log(e);
}
}
- return Status.OK_STATUS;
}
}
@Override
public boolean isReadOnly(int offset) {
final IOConsolePartition partition = getIOPartition(offset);
- return partition != null ? partition.isReadOnly() : false;
+ return partition != null ? partition.isReadOnly() : true;
}
@Override
public StyleRange[] getStyleRanges(int offset, int length) {
- if (!connected) {
- return new StyleRange[0];
- }
- IOConsolePartition[] computedPartitions = computeIOPartitioning(offset, length);
- StyleRange[] styles = new StyleRange[computedPartitions.length];
+ final IOConsolePartition[] computedPartitions = computeIOPartitioning(offset, length);
+ final StyleRange[] styles = new StyleRange[computedPartitions.length];
for (int i = 0; i < computedPartitions.length; i++) {
- int rangeStart = Math.max(computedPartitions[i].getOffset(), offset);
+ int rangeStart = computedPartitions[i].getOffset();
int rangeLength = computedPartitions[i].getLength();
+
+ // snap partitions to requested range
+ final int underflow = offset - rangeStart;
+ if (underflow > 0) {
+ rangeStart += underflow;
+ rangeLength -= underflow;
+ }
+ final int overflow = (rangeStart + rangeLength) - (offset + length);
+ if (overflow > 0) {
+ rangeLength -= overflow;
+ }
+
styles[i] = computedPartitions[i].getStyleRange(rangeStart, rangeLength);
}
return styles;
}
+ @Override
+ public ITypedRegion[] computeReadOnlyPartitions() {
+ if (document == null) {
+ return new IOConsolePartition[0];
+ }
+ return computeReadOnlyPartitions(0, document.getLength());
+ }
+
+ @Override
+ public ITypedRegion[] computeReadOnlyPartitions(int offset, int length) {
+ return computePartitioning(offset, length, false, true);
+ }
+
+ @Override
+ public ITypedRegion[] computeWritablePartitions() {
+ if (document == null) {
+ return new IOConsolePartition[0];
+ }
+ return computeWritablePartitions(0, document.getLength());
+ }
+
+ @Override
+ public ITypedRegion[] computeWritablePartitions(int offset, int length) {
+ return computePartitioning(offset, length, true, false);
+ }
+
+ @Override
+ public boolean isReadOnly(int offset, int length) {
+ final ITypedRegion[] readOnlyRegions = computeReadOnlyPartitions(offset, length);
+ int o = offset;
+ int end = offset + length;
+ for (ITypedRegion readOnlyRegion : readOnlyRegions) {
+ if (o < readOnlyRegion.getOffset()) {
+ return false;
+ }
+ o += readOnlyRegion.getLength();
+ if (o >= end) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean containsReadOnly(int offset, int length) {
+ return computeReadOnlyPartitions(offset, length).length > 0;
+ }
+
+ @Override
+ public int getPreviousOffsetByState(int offset, boolean searchWritable) {
+ synchronized (partitions) {
+ int partitionIndex = findPartitionCandidate(offset);
+ for (; partitionIndex >= 0; partitionIndex--) {
+ final IOConsolePartition partition = partitions.get(partitionIndex);
+ if (partition.isReadOnly() != searchWritable) {
+ return Math.min(partition.getOffset() + partition.getLength() - 1, offset);
+ }
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public int getNextOffsetByState(int offset, boolean searchWritable) {
+ synchronized (partitions) {
+ int partitionIndex = findPartitionCandidate(offset);
+ if (partitionIndex >= 0) {
+ for (; partitionIndex < partitions.size(); partitionIndex++) {
+ final IOConsolePartition partition = partitions.get(partitionIndex);
+ if (partition.isReadOnly() != searchWritable) {
+ return Math.max(partition.getOffset(), offset);
+ }
+ }
+ }
+ }
+ return document != null ? document.getLength() : 0;
+ }
+
+ /**
+ * Check if console currently interprets ASCII control characters.
+ *
+ * @return <code>true</code> if console interprets ASCII control characters
+ * @since 3.9
+ */
+ public boolean isHandleControlCharacters() {
+ return controlCharacterPattern != null;
+ }
+
+ /**
+ * Enable or disable interpretation of ASCII control characters like backspace
+ * (<code>\b</code>).
+ *
+ * @param handleControlCharacters interpret control characters if
+ * <code>true</code>
+ * @since 3.9
+ */
+ public void setHandleControlCharacters(boolean handleControlCharacters) {
+ if (handleControlCharacters) {
+ controlCharacterPattern = Pattern
+ .compile(carriageReturnAsControlCharacter ? CONTROL_CHARACTERS_WITH_CR_PATTERN_STR
+ : CONTROL_CHARACTERS_PATTERN_STR);
+ } else {
+ controlCharacterPattern = null;
+ }
+ }
+
+ /**
+ * Check if carriage returns (<code>\r</code>) are interpreted as control
+ * characters. They are also not interpreted if general control character
+ * handling is disabled.
+ *
+ * @return if <code>true</code> carriage returns are interpreted as control
+ * characters.
+ * @see #isHandleControlCharacters()
+ * @since 3.9
+ */
+ public boolean isCarriageReturnAsControlCharacter() {
+ return carriageReturnAsControlCharacter;
+ }
+
+ /**
+ * If control characters are interpreted by this console carriage returns
+ * (<code>\r</code>) are either ignored (<code>false</code>) and usually handled
+ * as line break by connected console document or if <code>true</code>
+ * interpreted with there control character meaning.
+ * <p>
+ * Note: this option has no effect if control character interpretation is
+ * disabled in general.
+ * </p>
+ *
+ * @param carriageReturnAsControlCharacter set <code>false</code> to exclude
+ * carriage return from control
+ * character interpretation
+ * @see #setHandleControlCharacters(boolean)
+ * @since 3.9
+ */
+ public void setCarriageReturnAsControlCharacter(boolean carriageReturnAsControlCharacter) {
+ this.carriageReturnAsControlCharacter = carriageReturnAsControlCharacter;
+ // reset to update control character pattern
+ setHandleControlCharacters(isHandleControlCharacters());
+ }
+
/**
* Get a partition by its index. Safe from out of bounds exceptions.
*
@@ -806,27 +1432,37 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
ConsolePlugin.log(t);
}
+ private static void log(int status, String msg) {
+ ConsolePlugin.log(new Status(status, ConsolePlugin.getUniqueIdentifier(), msg));
+ }
+
+ private static void log(int status, String msg, Throwable t) {
+ ConsolePlugin.log(new Status(status, ConsolePlugin.getUniqueIdentifier(), msg, t));
+ }
+
/**
* For debug purpose. Check if whole document is partitioned, partitions are
* ordered by offset, every partition has length greater 0 and all writable
* input partitions are listed in {@link #inputPartitions}.
*/
private void checkPartitions() {
- if (!connected) {
+ if (document == null) {
return;
}
- final List<IOConsolePartition> knownInputPartitions = new ArrayList<>(inputPartitions);
- int offset = 0;
- for (IOConsolePartition partition : partitions) {
- Assert.isTrue(offset == partition.getOffset());
- Assert.isTrue(partition.getLength() > 0);
- offset += partition.getLength();
-
- if (isInputPartition(partition) && !partition.isReadOnly()) {
- Assert.isTrue(knownInputPartitions.remove(partition));
+ synchronized (partitions) {
+ final List<IOConsolePartition> knownInputPartitions = new ArrayList<>(inputPartitions);
+ int offset = 0;
+ for (IOConsolePartition partition : partitions) {
+ Assert.isTrue(offset == partition.getOffset());
+ Assert.isTrue(partition.getLength() > 0);
+ offset += partition.getLength();
+
+ if (isInputPartition(partition) && !partition.isReadOnly()) {
+ Assert.isTrue(knownInputPartitions.remove(partition));
+ }
}
+ Assert.isTrue(offset == document.getLength());
+ Assert.isTrue(knownInputPartitions.isEmpty());
}
- Assert.isTrue(offset == document.getLength());
- Assert.isTrue(knownInputPartitions.isEmpty());
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
index dba5fec11..7d977066a 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -11,38 +11,57 @@
* Contributors:
* IBM Corporation - initial API and implementation
* vogella GmbH - Bug 287303 - [patch] Add Word Wrap action to Console View
+ * Paul Pazderski - Bug 550621 - improved verification of user input
*******************************************************************************/
package org.eclipse.ui.internal.console;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.MultiStringMatcher;
+import org.eclipse.jface.text.MultiStringMatcher.Match;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.StyledTextContent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsoleDocumentPartitioner;
+import org.eclipse.ui.console.IConsoleDocumentPartitionerExtension;
+import org.eclipse.ui.console.IOConsole;
import org.eclipse.ui.console.IScrollLockStateProvider;
import org.eclipse.ui.console.TextConsole;
import org.eclipse.ui.console.TextConsoleViewer;
/**
- * Viewer used to display an IOConsole
+ * Viewer used to display an {@link IOConsole}.
*
* @since 3.1
*/
public class IOConsoleViewer extends TextConsoleViewer {
/**
- * will always scroll with output if value is true.
+ * Will always scroll with output if value is true.
*/
private boolean fAutoScroll = true;
- private boolean fWordWrap = false;
+ /**
+ * Listener required for auto scroll.
+ */
+ private IDocumentListener fAutoScrollListener;
- private IDocumentListener fDocumentListener;
+ /**
+ * Matcher to find line delimiters which are used by current document.
+ * <code>null</code> if no document is set.
+ */
+ private MultiStringMatcher lineDelimiterMatcher;
+ /**
+ * Constructs a new viewer in the given parent for the specified console.
+ *
+ * @param parent the containing composite
+ * @param console the IO console
+ */
public IOConsoleViewer(Composite parent, TextConsole console) {
super(parent, console);
}
@@ -50,8 +69,8 @@ public class IOConsoleViewer extends TextConsoleViewer {
/**
* Constructs a new viewer in the given parent for the specified console.
*
- * @param parent the containing composite
- * @param console the IO console
+ * @param parent the containing composite
+ * @param console the IO console
* @param scrollLockStateProvider the scroll lock state provider
* @since 3.6
*/
@@ -68,78 +87,95 @@ public class IOConsoleViewer extends TextConsoleViewer {
}
public boolean isWordWrap() {
- return fWordWrap;
+ return getTextWidget().getWordWrap();
}
public void setWordWrap(boolean wordwrap) {
- fWordWrap = wordwrap;
getTextWidget().setWordWrap(wordwrap);
}
@Override
protected void handleVerifyEvent(VerifyEvent e) {
- IDocument doc = getDocument();
- String[] legalLineDelimiters = doc.getLegalLineDelimiters();
- String eventString = e.text;
- try {
- IConsoleDocumentPartitioner partitioner = (IConsoleDocumentPartitioner) doc.getDocumentPartitioner();
- if (!partitioner.isReadOnly(e.start)) {
- boolean isCarriageReturn = false;
- for (int i = 0; i < legalLineDelimiters.length; i++) {
- if (e.text.equals(legalLineDelimiters[i])) {
- isCarriageReturn = true;
- break;
- }
+ final IConsoleDocumentPartitioner partitioner = (IConsoleDocumentPartitioner) getDocument()
+ .getDocumentPartitioner();
+ if (partitioner == null) {
+ e.doit = false;
+ return;
+ }
+ final IConsoleDocumentPartitionerExtension partitionerExt = (IConsoleDocumentPartitionerExtension) partitioner;
+
+ final StyledTextContent content = getTextWidget().getContent();
+ final String eventText = e.text != null ? e.text : ""; //$NON-NLS-1$
+ final Match newlineMatch = lineDelimiterMatcher != null ? lineDelimiterMatcher.indexOf(eventText, 0) : null;
+ final IRegion eventRange = event2ModelRange(e);
+ final int offset = eventRange.getOffset();
+ final int length = eventRange.getLength();
+
+ if (length > 0 && partitionerExt.containsReadOnly(offset, length)) {
+ // If user tries to remove or replace text range containing read-only content we
+ // modify the change to only remove the writable parts.
+ e.doit = false;
+
+ final ITypedRegion[] writableParts = partitionerExt.computeWritablePartitions(offset, length);
+ // process text removes in reveres to not bother with changing offsets
+ for (int i = writableParts.length - 1; i >= 0; i--) {
+ final ITypedRegion writablePart = writableParts[i];
+ int replaceOffset = writablePart.getOffset();
+ int replaceLength = writablePart.getLength();
+
+ // snap partitions to event range
+ final int underflow = offset - writablePart.getOffset();
+ if (underflow > 0) {
+ replaceOffset += underflow;
+ replaceLength -= underflow;
}
-
- if (!isCarriageReturn) {
- super.handleVerifyEvent(e);
- return;
+ final int overflow = (replaceOffset + replaceLength) - (offset + length);
+ if (overflow > 0) {
+ replaceLength -= overflow;
}
+
+ content.replaceTextRange(replaceOffset, replaceLength, ""); //$NON-NLS-1$
}
- int length = doc.getLength();
- if (e.start == length) {
- super.handleVerifyEvent(e);
+ // now add the users input if any
+ if (eventText.length() > 0) {
+ getTextWidget().replaceTextRange(offset, 0, eventText);
+ }
+ } else if (newlineMatch != null && offset != content.getCharCount()) {
+ // If newline is entered within a line this viewer will not break that line and
+ // instead pretend as if newline was entered at end of document.
+ e.doit = false;
+
+ if (newlineMatch.getOffset() > 0) {
+ // insert text until newline with further verification
+ // and newline plus trailing text without
+ getTextWidget().replaceTextRange(offset, length, eventText.substring(0, newlineMatch.getOffset()));
+ content.replaceTextRange(content.getCharCount(), 0,
+ eventText.substring(newlineMatch.getOffset(), eventText.length()));
} else {
- try {
- doc.replace(length, 0, eventString);
- updateWidgetCaretLocation(length);
- } catch (BadLocationException e1) {
- }
- e.doit = false;
+ // inserted text starts with newline
+ content.replaceTextRange(content.getCharCount(), 0, eventText);
}
- } finally {
- StyledText text = (StyledText) e.widget;
- text.setCaretOffset(text.getCharCount());
- }
- }
- /*
- * Update the Text widget location to new location
- */
- private void updateWidgetCaretLocation(int documentCaret) {
- int widgetCaret = modelOffset2WidgetOffset(documentCaret);
- if (widgetCaret == -1) {
- // try to move it to the closest spot
- IRegion region = getModelCoverage();
- if (region != null) {
- if (documentCaret <= region.getOffset()) {
- widgetCaret = 0;
- } else if (documentCaret >= region.getOffset() + region.getLength()) {
- widgetCaret = getVisibleRegion().getLength();
- }
- }
- }
- if (widgetCaret != -1) {
- // there is a valid widget caret
- getTextWidget().setCaretOffset(widgetCaret);
+ getTextWidget().setCaretOffset(content.getCharCount());
getTextWidget().showSelection();
+ } else if (partitioner.isReadOnly(offset) && partitioner.isReadOnly(offset - 1)) {
+ // If input is entered in read-only partition add it to the next writable
+ // partition instead
+ e.doit = false;
+
+ final int insertOffset = partitionerExt.getNextOffsetByState(offset, true);
+ content.replaceTextRange(insertOffset, 0, eventText);
+
+ getTextWidget().setCaretOffset(insertOffset + eventText.length());
+ getTextWidget().showSelection();
+ } else {
+ super.handleVerifyEvent(e);
}
}
/**
- * makes the associated text widget uneditable.
+ * Makes the associated text widget uneditable.
*/
public void setReadOnly() {
ConsolePlugin.getStandardDisplay().asyncExec(() -> {
@@ -159,21 +195,28 @@ public class IOConsoleViewer extends TextConsoleViewer {
@Override
public void setDocument(IDocument document) {
- IDocument oldDocument= getDocument();
+ if (getDocument() != null) {
+ getDocument().removeDocumentListener(getAutoScrollListener());
+ }
super.setDocument(document);
- if (oldDocument != null) {
- oldDocument.removeDocumentListener(getDocumentListener());
- }
+ lineDelimiterMatcher = null;
if (document != null) {
- document.addDocumentListener(getDocumentListener());
+ lineDelimiterMatcher = MultiStringMatcher.create(document.getLegalLineDelimiters());
+ document.addDocumentListener(getAutoScrollListener());
}
}
- private IDocumentListener getDocumentListener() {
- if (fDocumentListener == null) {
- fDocumentListener= new IDocumentListener() {
+ /**
+ * Must create listener dynamically since super constructor may call
+ * {@link #setDocument(IDocument)} before field initialization.
+ *
+ * @return document listener to perform auto scroll
+ */
+ private IDocumentListener getAutoScrollListener() {
+ if (fAutoScrollListener == null) {
+ fAutoScrollListener = new IDocumentListener() {
@Override
public void documentAboutToBeChanged(DocumentEvent event) {
}
@@ -186,6 +229,6 @@ public class IOConsoleViewer extends TextConsoleViewer {
}
};
}
- return fDocumentListener;
+ return fAutoScrollListener;
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
index 6559f6601..1f5be00c3 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
@@ -14,7 +14,6 @@
package org.eclipse.ui.internal.console;
import java.util.Arrays;
-import java.util.Comparator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
@@ -52,20 +51,16 @@ public class OpenConsoleAction extends Action implements IMenuCreator {
private ConsoleFactoryExtension[] getSortedFactories() {
ConsoleFactoryExtension[] factoryExtensions = ((ConsoleManager) ConsolePlugin.getDefault().getConsoleManager()).getConsoleFactoryExtensions();
- Arrays.sort(factoryExtensions, new Comparator<ConsoleFactoryExtension>() {
-
- @Override
- public int compare(ConsoleFactoryExtension e1, ConsoleFactoryExtension e2) {
- if (e1.isNewConsoleExtenson()) {
- return -1;
- }
- if (e2.isNewConsoleExtenson()) {
- return 1;
- }
- String first = e1.getLabel();
- String second = e2.getLabel();
- return first.compareTo(second);
+ Arrays.sort(factoryExtensions, (e1, e2) -> {
+ if (e1.isNewConsoleExtenson()) {
+ return -1;
+ }
+ if (e2.isNewConsoleExtenson()) {
+ return 1;
}
+ String first = e1.getLabel();
+ String second = e2.getLabel();
+ return first.compareTo(second);
});
return factoryExtensions;
}
@@ -101,8 +96,7 @@ public class OpenConsoleAction extends Action implements IMenuCreator {
fMenu= new Menu(parent);
int accel = 1;
- for (int i = 0; i < fFactoryExtensions.length; i++) {
- ConsoleFactoryExtension extension = fFactoryExtensions[i];
+ for (ConsoleFactoryExtension extension : fFactoryExtensions) {
if (!WorkbenchActivityHelper.filterItem(extension) && extension.isEnabled()) {
String label = extension.getLabel();
ImageDescriptor image = extension.getImageDescriptor();
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
index 8d226809b..d3ca1de6f 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
@@ -14,6 +14,7 @@
package org.eclipse.ui.internal.console;
import java.lang.reflect.Field;
+import java.text.MessageFormat;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
@@ -30,7 +31,6 @@ import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IPatternMatchListenerDelegate;
-import com.ibm.icu.text.MessageFormat;
public class PatternMatchListenerExtension implements IPluginContribution {
@@ -59,9 +59,8 @@ public class PatternMatchListenerExtension implements IPluginContribution {
String flags = flagsElement.replaceAll("Pattern.", ""); //$NON-NLS-1$ //$NON-NLS-2$
String[] tokens = flags.split("\\s\\|\\s"); //$NON-NLS-1$
Class<?> clazz = Class.forName("java.util.regex.Pattern"); //$NON-NLS-1$
-
- for (int i = 0; i < tokens.length; i++) {
- Field field = clazz.getDeclaredField(tokens[i]);
+ for (String token : tokens) {
+ Field field = clazz.getDeclaredField(token);
val |= field.getInt(null);
}
} catch (ClassNotFoundException e) {
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java
index 9c5bfb919..13aa4a094 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java
@@ -27,7 +27,9 @@ public class PinConsoleAction extends Action implements IUpdate {
private IConsoleView fView = null;
/**
- * Constructs a 'pin console' action
+ * Constructs a 'pin console' action.
+ *
+ * @param view the view to pin with this action
*/
public PinConsoleAction(IConsoleView view) {
super(ConsoleMessages.PinConsoleAction_0, IAction.AS_CHECK_BOX);
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java
index 75d7e93e7..05b197480 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 vogella GmbH
+ * Copyright (c) 2014, 2020 vogella GmbH and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,19 +12,25 @@
* Gaetano Santoro - initial implementation
* Matthias Mailänder - rebase onto Mars
* Lars Vogel <Lars.Vogel@gmail.com> - Bug 287303
+ * Christian Gabrisch <eclipse@cgabrisch.de> - Bug 491853
*******************************************************************************/
package org.eclipse.ui.internal.console;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsoleView;
/**
* Activates line breaks in the Console view so that the full log statement is
* always visible
*/
-public class WordWrapAction extends Action {
+public class WordWrapAction extends Action implements IPropertyChangeListener {
private IConsoleView fConsoleView = null;
@@ -38,16 +44,36 @@ public class WordWrapAction extends Action {
setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_WRAP));
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_WORD_WRAP_ACTION);
- boolean checked = fConsoleView.getWordWrap();
- setChecked(checked);
+ getPreferenceStore().addPropertyChangeListener(this);
+ applyPreferences();
}
@Override
public void run() {
- fConsoleView.setWordWrap(isChecked());
+ boolean enableWordWrap = isChecked();
+ getPreferenceStore().setValue(IConsoleConstants.P_CONSOLE_WORD_WRAP, enableWordWrap);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ if (IConsoleConstants.P_CONSOLE_WORD_WRAP.equals(property)) {
+ applyPreferences();
+ }
}
public void dispose() {
+ getPreferenceStore().removePropertyChangeListener(this);
fConsoleView = null;
}
+
+ private void applyPreferences() {
+ boolean enableWordWrap = getPreferenceStore().getBoolean(IConsoleConstants.P_CONSOLE_WORD_WRAP);
+ setChecked(enableWordWrap);
+ fConsoleView.setWordWrap(enableWordWrap);
+ }
+
+ private IPreferenceStore getPreferenceStore() {
+ return ConsolePlugin.getDefault().getPreferenceStore();
+ }
}
diff --git a/org.eclipse.ui.externaltools/.classpath b/org.eclipse.ui.externaltools/.classpath
index a612ce54a..71ebb06d5 100644
--- a/org.eclipse.ui.externaltools/.classpath
+++ b/org.eclipse.ui.externaltools/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="External Tools Base"/>
<classpathentry kind="src" path="Program Tools Support"/>
diff --git a/org.eclipse.ui.externaltools/.project b/org.eclipse.ui.externaltools/.project
index 657184697..08fe84eac 100644
--- a/org.eclipse.ui.externaltools/.project
+++ b/org.eclipse.ui.externaltools/.project
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.externaltools</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ui.externaltools</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs
index 129d9d8a1..46a1b61e4 100644
--- a/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.core.prefs
@@ -19,9 +19,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -38,6 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
@@ -96,6 +97,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warn
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
@@ -133,11 +135,13 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
@@ -145,17 +149,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=0
org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=0
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
@@ -239,11 +246,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@@ -273,6 +281,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -297,13 +307,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@@ -350,6 +364,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -386,9 +402,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -414,8 +433,12 @@ org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.ui.prefs
index 8e18452e3..ddcf96428 100644
--- a/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.ui.externaltools/.settings/org.eclipse.jdt.ui.prefs
@@ -1,55 +1,3 @@
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=false
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_Platform Debug Cleanups
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
diff --git a/org.eclipse.ui.externaltools/.settings/org.eclipse.pde.prefs b/org.eclipse.ui.externaltools/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.ui.externaltools/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.ui.externaltools/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
index 82f689608..efd514529 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuildTab.java
@@ -79,7 +79,7 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab {
// projects to build (empty if none)
private List<IProject> fProjects = new ArrayList<>();
- class ProjectsContentProvider implements IStructuredContentProvider {
+ static class ProjectsContentProvider implements IStructuredContentProvider {
@Override
public Object[] getElements(Object inputElement) {
@@ -186,8 +186,8 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab {
}
Object[] res = dialog.getResult();
fProjects = new ArrayList<>(res.length);
- for (int i = 0; i < res.length; i++) {
- fProjects.add((IProject) res[i]);
+ for (Object re : res) {
+ fProjects.add((IProject) re);
}
updateLaunchConfigurationDialog();
}
@@ -232,17 +232,15 @@ public class ExternalToolsBuildTab extends AbstractLaunchConfigurationTab {
// select the workspace by default
fBuildButton.setSelection(true);
fWorkspaceButton.setSelection(true);
- } else {
- if (scope.equals("${none}")) { //$NON-NLS-1$
- fBuildButton.setSelection(false);
- } else if (scope.equals("${project}")) { //$NON-NLS-1$
- fProjectButton.setSelection(true);
- } else if (scope.startsWith("${projects:")) { //$NON-NLS-1$
- fSpecificProjectsButton.setSelection(true);
- IProject[] projects = getBuildProjects(configuration, IExternalToolConstants.ATTR_BUILD_SCOPE);
- fProjects = new ArrayList<>(projects.length);
- Collections.addAll(fProjects, projects);
- }
+ } else if (scope.equals("${none}")) { //$NON-NLS-1$
+ fBuildButton.setSelection(false);
+ } else if (scope.equals("${project}")) { //$NON-NLS-1$
+ fProjectButton.setSelection(true);
+ } else if (scope.startsWith("${projects:")) { //$NON-NLS-1$
+ fSpecificProjectsButton.setSelection(true);
+ IProject[] projects = getBuildProjects(configuration, IExternalToolConstants.ATTR_BUILD_SCOPE);
+ fProjects = new ArrayList<>(projects.length);
+ Collections.addAll(fProjects, projects);
}
}
@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 33c9f94af..334a01753 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
@@ -34,8 +34,6 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -273,12 +271,7 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
}
});
- fFileText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- }
- });
+ fFileText.addModifyListener(e -> updateLaunchConfigurationDialog());
fVariables.addSelectionListener(new SelectionListener() {
@Override
@@ -346,9 +339,8 @@ public class ExternalToolsBuilderTab extends AbstractLaunchConfigurationTab {
}
if (fCreateBuildScheduleComponent) {
- int buildTypes[]= BuilderUtils.buildTypesToArray(buildKindString);
- for (int i = 0; i < buildTypes.length; i++) {
- switch (buildTypes[i]) {
+ for (int buildType : BuilderUtils.buildTypesToArray(buildKindString)) {
+ switch (buildType) {
case IncrementalProjectBuilder.FULL_BUILD:
afterClean.setSelection(true);
break;
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 7c050f866..0eab24c12 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
@@ -36,8 +36,6 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -260,12 +258,9 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
group.setFont(parent.getFont());
argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
- argumentField.addTraverseListener(new TraverseListener() {
- @Override
- public void keyTraversed(TraverseEvent event) {
- if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) {
- event.doit= true;
- }
+ argumentField.addTraverseListener(event -> {
+ if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) {
+ event.doit= true;
}
});
@@ -625,13 +620,13 @@ public abstract class ExternalToolsMainTab extends AbstractLaunchConfigurationTa
//strip mnemonic (&)
String[] strs = controlName.split("&"); //$NON-NLS-1$
StringBuilder stripped = new StringBuilder();
- for (int i = 0; i < strs.length; i++) {
- stripped.append(strs[i]);
+ for (String str : strs) {
+ stripped.append(str);
}
control.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString()));
}
- private class ControlAccessibleListener extends AccessibleAdapter {
+ private static class ControlAccessibleListener extends AccessibleAdapter {
private String controlName;
ControlAccessibleListener(String name) {
controlName = name;
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 2605b8587..039cd0a7e 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
@@ -82,20 +82,6 @@ public class BuilderUtils {
}
/**
- * Returns whether the given configuration is an "unmigrated" builder.
- * Unmigrated builders are external tools that are stored in an old format
- * but have not been migrated by the user. Old format builders are always
- * translated into launch config working copies in memory, but they're not
- * considered "migrated" until the config has been saved and the project spec
- * updated.
- * @param config the config to examine
- * @return whether the given config represents an unmigrated builder
- */
- public static boolean isUnmigratedConfig(ILaunchConfiguration config) {
- return BuilderCoreUtils.isUnmigratedConfig(config);
- }
-
- /**
* Converts the given config to a build command which is stored in the
* given command.
*
@@ -115,8 +101,7 @@ public class BuilderUtils {
IConfigurationElement[] elements = ep.getConfigurationElements();
String sourceType= config.getType().getIdentifier();
String builderType= null;
- for (int i= 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
+ for (IConfigurationElement element : elements) {
if (element.getName().equals(TAG_CONFIGURATION_MAP) && sourceType.equals(element.getAttribute(TAG_SOURCE_TYPE))) {
builderType= element.getAttribute(TAG_BUILDER_TYPE);
break;
@@ -155,25 +140,6 @@ public class BuilderUtils {
return newWorkingCopy.doSave();
}
- /**
- * Migrates the launch configuration working copy, which is based on an old-
- * style external tool builder, to a new, saved launch configuration. The
- * returned launch configuration will contain the same attributes as the
- * given working copy with the exception of the configuration name, which
- * may be changed during the migration. The name of the configuration will
- * only be changed if the current name is not a valid name for a saved
- * config.
- *
- * @param workingCopy the launch configuration containing attributes from an
- * old-style project builder.
- * @return ILaunchConfiguration a new, saved launch configuration whose
- * attributes match those of the given working copy as well as possible
- * @throws CoreException if an exception occurs while attempting to save the
- * new launch configuration
- */
- public static ILaunchConfiguration migrateBuilderConfiguration(IProject project, ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
- return BuilderCoreUtils.migrateBuilderConfiguration(project, workingCopy);
- }
/**
* Converts the build types string into an array of
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java
index c081e478d..3d66b868e 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPlugin.java
@@ -63,7 +63,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements
* A window listener that warns the user about any running programs when the
* workbench closes. Programs are killed when the VM exits.
*/
- private class ProgramLaunchWindowListener implements IWindowListener {
+ private static class ProgramLaunchWindowListener implements IWindowListener {
@Override
public void windowActivated(IWorkbenchWindow window) {
}
@@ -90,9 +90,9 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements
ILaunch launches[] = manager.getLaunches();
ILaunchConfigurationType configType;
ILaunchConfiguration config;
- for (int i = 0; i < launches.length; i++) {
+ for (ILaunch launch : launches) {
try {
- config = launches[i].getLaunchConfiguration();
+ config = launch.getLaunchConfiguration();
if (config == null) {
continue;
}
@@ -101,7 +101,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements
continue;
}
if (configType.equals(programType)) {
- if (!launches[i].isTerminated()) {
+ if (!launch.isTerminated()) {
MessageDialog
.openWarning(
window.getShell(),
@@ -187,7 +187,7 @@ public final class ExternalToolsPlugin extends AbstractUIPlugin implements
* Returns the active workbench window or <code>null</code> if none
*/
public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
/**
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java
deleted file mode 100644
index 1c8043a5b..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolsPreferenceInitializer.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2013 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.model;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-public class ExternalToolsPreferenceInitializer extends AbstractPreferenceInitializer {
-
- public ExternalToolsPreferenceInitializer() {
- super();
- }
-
- @Override
- public void initializeDefaultPreferences() {
- IPreferenceStore prefs = ExternalToolsPlugin.getDefault().getPreferenceStore();
- prefs.setDefault(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION, true);
- prefs.setDefault(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, true);
- }
-}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IPreferenceConstants.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IPreferenceConstants.java
deleted file mode 100644
index c63cd7e74..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/IPreferenceConstants.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.model;
-
-
-/**
- * Constants used to identify user preferences.
- */
-public interface IPreferenceConstants {
-
- /**
- * Boolean preference key which indicates whether or not the user should be prompted
- * before an external tool project builder is migrated to the new builder format.
- * This is used before an old-style (Eclipse 1.0 or 2.0) builder is migrated to
- * the new format (launch configurations).
- */
- String PROMPT_FOR_TOOL_MIGRATION = "externaltools.builders.promptForMigration"; //$NON-NLS-1$
- /**
- * Boolean preference key which indicates whether or not the user should be prompted
- * before a project is migrated tot he new builder handle format.
- * This is used before an old-style (Eclipse 2.1) project handle is migrated
- * from the old format (launch config handles) to the new format (path to the launch).
- */
- String PROMPT_FOR_PROJECT_MIGRATION = "externaltools.builders.promptForProjectMigration"; //$NON-NLS-1$
-}
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 369ccf6b4..fd87237ad 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
@@ -50,9 +50,7 @@ import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
@@ -84,7 +82,6 @@ import org.eclipse.ui.externaltools.internal.launchConfigurations.IgnoreWhiteSpa
import org.eclipse.ui.externaltools.internal.model.BuilderUtils;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds;
-import org.eclipse.ui.externaltools.internal.model.IPreferenceConstants;
import org.eclipse.ui.progress.IProgressService;
/**
@@ -116,7 +113,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
* Error configs are objects representing entries pointing to
* invalid launch configurations
*/
- public class ErrorConfig {
+ public static class ErrorConfig {
private ICommand command;
public ErrorConfig(ICommand command) {
this.command= command;
@@ -169,8 +166,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
Display.getDefault().asyncExec(() -> {
TableItem[] items = viewer.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
+ for (TableItem item : items) {
Object data = item.getData();
if (data == oldConfig) {
// Found the movedFrom config in the tree. Replace it
@@ -215,15 +211,9 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
return;
}
- boolean projectNeedsMigration= false;
- for (int i = 0; i < commands.length; i++) {
+ for (ICommand command : commands) {
String[] version= new String[] {IExternalToolConstants.EMPTY_STRING};
- ILaunchConfiguration config = BuilderUtils.configFromBuildCommandArgs(project, commands[i].getArguments(), version);
- if (BuilderCoreUtils.VERSION_2_1.equals(version[0])) {
- // Storing the .project file of a project with 2.1 configs, will
- // edit the file in a way that isn't backwards compatible.
- projectNeedsMigration= true;
- }
+ ILaunchConfiguration config = BuilderUtils.configFromBuildCommandArgs(project, command.getArguments(), version);
Object element= null;
if (config != null) {
if (!config.isWorkingCopy() && !config.exists()) {
@@ -233,19 +223,19 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
}
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()}),
- status);
+ NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_External_Tool_Builder__0__Not_Added_2, new String[]{config.getName()}),
+ status);
userHasMadeChanges= true;
} else {
element= config;
}
} else {
- String builderID = commands[i].getBuilderName();
- if (builderID.equals(ExternalToolBuilder.ID) && commands[i].getArguments().get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE) != null) {
+ String builderID = command.getBuilderName();
+ if (builderID.equals(ExternalToolBuilder.ID) && command.getArguments().get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE) != null) {
// An invalid external tool entry.
- element= new ErrorConfig(commands[i]);
+ element = new ErrorConfig(command);
} else {
- element= commands[i];
+ element = command;
}
}
if (element != null) {
@@ -253,29 +243,6 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
viewer.setChecked(element, isEnabled(element));
}
}
- if (projectNeedsMigration) {
- IPreferenceStore store= ExternalToolsPlugin.getDefault().getPreferenceStore();
- boolean prompt= store.getBoolean(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION);
- boolean proceed= true;
- if (prompt) {
- 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());
- }
- if (!proceed) {
- // Open the page read-only
- viewer.getTable().setEnabled(false);
- downButton.setEnabled(false);
- editButton.setEnabled(false);
- importButton.setEnabled(false);
- newButton.setEnabled(false);
- removeButton.setEnabled(false);
- }
- }
}
/**
@@ -462,8 +429,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
} else {
// Replace the config with a working copy
TableItem[] items= viewer.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
+ for (TableItem item : items) {
if (item.getData() == configuration) {
workingCopy = configuration.getWorkingCopy();
item.setData(workingCopy);
@@ -500,8 +466,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
for (ILaunchConfigurationType type : toolTypes) {
try {
ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
- for (int i = 0; i < configs.length; i++) {
- ILaunchConfiguration launchConfiguration = configs[i];
+ for (ILaunchConfiguration launchConfiguration : configs) {
if (!DebugUITools.isPrivate(launchConfiguration)) {
configurations.add(launchConfiguration);
}
@@ -674,8 +639,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
private List<ILaunchConfigurationType> getConfigurationTypes(String category) {
ILaunchConfigurationType types[] = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes();
List<ILaunchConfigurationType> externalToolTypes = new ArrayList<>();
- for (int i = 0; i < types.length; i++) {
- ILaunchConfigurationType configurationType = types[i];
+ for (ILaunchConfigurationType configurationType : types) {
if (category.equals(configurationType.getCategory())) {
externalToolTypes.add(configurationType);
}
@@ -697,19 +661,6 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
Object data = selection.getData();
if (data instanceof ILaunchConfiguration) {
ILaunchConfiguration config= (ILaunchConfiguration) data;
- if (BuilderUtils.isUnmigratedConfig(config)) {
- if (!shouldProceedWithMigration()) {
- return;
- }
- try {
- config= BuilderUtils.migrateBuilderConfiguration(getInputProject(), (ILaunchConfigurationWorkingCopy) config);
- } catch (CoreException e) {
- handleException(e);
- return;
- }
- // Replace the working copy in the table with the migrated configuration
- selection.setData(config);
- }
userHasMadeChanges= true;
boolean wasAutobuilding= ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding();
try {
@@ -740,32 +691,6 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
return Window.OK == dialog.open();
}
- /**
- * Prompts the user to proceed with the migration of a project builder from
- * the old format to the new, launch configuration-based, format and returns
- * whether or not the user wishes to proceed with the migration.
- *
- * @return boolean whether or not the user wishes to proceed with migration
- */
- private boolean shouldProceedWithMigration() {
- if (!ExternalToolsPlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION)) {
- // User has asked not to be prompted
- return true;
- }
- 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,
- ExternalToolsUIMessages.BuilderPropertyPage_Not_Support,
- ExternalToolsUIMessages.BuilderPropertyPage_Prompt,
- false,
- ExternalToolsPlugin.getDefault().getPreferenceStore(),
- IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION);
- return dialog.getReturnCode() == IDialogConstants.YES_ID;
- }
/**
* Handles unexpected internal exceptions
@@ -812,8 +737,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
enableUp = indices[0] != 0;
enableDown = indices[indices.length - 1] < max - 1;
}
- for (int i = 0; i < items.length; i++) {
- TableItem item = items[i];
+ for (TableItem item : items) {
Object data= item.getData();
if (data instanceof ILaunchConfiguration) {
ILaunchConfiguration config= (ILaunchConfiguration)data;
@@ -944,9 +868,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
IProgressService service= PlatformUI.getWorkbench().getProgressService();
try {
service.busyCursorWhile(runnable);
- } catch (InvocationTargetException e) {
- return false;
- } catch (InterruptedException e) {
+ } catch (InvocationTargetException | InterruptedException e) {
return false;
}
return super.performOk();
@@ -995,17 +917,17 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
}
} catch (CoreException e1) {
}
-
- if (!BuilderUtils.isUnmigratedConfig(config) && (config instanceof ILaunchConfigurationWorkingCopy)) {
- ILaunchConfigurationWorkingCopy workingCopy= ((ILaunchConfigurationWorkingCopy) config);
+ if (config instanceof ILaunchConfigurationWorkingCopy) {
+ ILaunchConfigurationWorkingCopy workingCopy = ((ILaunchConfigurationWorkingCopy) config);
// Save any changes to the config (such as enable/disable)
if (workingCopy.isDirty()) {
try {
workingCopy.doSave();
} catch (CoreException e) {
- Shell shell= getShell();
+ Shell shell = getShell();
if (shell != null) {
- MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] {workingCopy.getName()}));
+ MessageDialog.openError(shell, ExternalToolsUIMessages.BuilderPropertyPage_39, NLS.bind(ExternalToolsUIMessages.BuilderPropertyPage_40, new String[] {
+ workingCopy.getName() }));
}
}
}
@@ -1060,7 +982,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
try {
ICommand newCommand = project.getDescription().newCommand();
String builderName= config.getAttribute(IExternalToolConstants.ATTR_DISABLED_BUILDER, (String)null);
- Map<String, String> args = config.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, new HashMap<String, String>(0));
+ Map<String, String> args = config.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, new HashMap<>(0));
newCommand.setBuilderName(builderName);
newCommand.setArguments(args);
@@ -1176,8 +1098,9 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta
if(oldArgs.size() != newArgs.size()) {
return true;
}
- for (String key : oldArgs.keySet()) {
- if (comparator.compare(oldArgs.get(key), newArgs.get(key)) != 0) {
+ for (Map.Entry<String, String> entry : oldArgs.entrySet()) {
+ String key = entry.getKey();
+ if (comparator.compare(entry.getValue(), newArgs.get(key)) != 0) {
return true;
}
}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java
deleted file mode 100644
index b3728dfbe..000000000
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsPreferencePage.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Frederic Gurr - Fixed restore default behavior (bug 346082)
- *******************************************************************************/
-package org.eclipse.ui.externaltools.internal.ui;
-
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
-import org.eclipse.ui.externaltools.internal.model.IExternalToolsHelpContextIds;
-import org.eclipse.ui.externaltools.internal.model.IPreferenceConstants;
-
-/**
- * Preference page that allows the user to customize external tools
- */
-public class ExternalToolsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private Button promptForToolMigrationButton;
- private Button promptForProjectMigrationButton;
-
- public ExternalToolsPreferencePage() {
- setPreferenceStore(ExternalToolsPlugin.getDefault().getPreferenceStore());
- setDescription(ExternalToolsUIMessages.ExternalToolsPreferencePage_External_tool_project_builders_migration_2);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IExternalToolsHelpContextIds.EXTERNAL_TOOLS_PREFERENCE_PAGE);
- //The main composite
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginHeight=0;
- layout.marginWidth=0;
- composite.setLayout(layout);
- composite.setFont(parent.getFont());
-
- promptForToolMigrationButton= createCheckButton(composite, ExternalToolsUIMessages.ExternalToolsPreferencePage_Prompt_before_migrating_3, IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION);
- promptForProjectMigrationButton= createCheckButton(composite, ExternalToolsUIMessages.ExternalToolsPreferencePage_1, IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION);
-
- applyDialogFont(composite);
-
- return composite;
- }
-
- /**
- * Returns a new check button with the given label for the given preference.
- */
- private Button createCheckButton(Composite parent, String label, String preferenceKey) {
- Button button= new Button(parent, SWT.CHECK | SWT.LEFT);
- button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- button.setFont(parent.getFont());
- button.setText(label);
- button.setSelection(getPreferenceStore().getBoolean(preferenceKey));
- return button;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- @Override
- public void init(IWorkbench workbench) {
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- @Override
- public boolean performOk() {
- getPreferenceStore().setValue(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION, promptForToolMigrationButton.getSelection());
- getPreferenceStore().setValue(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION, promptForProjectMigrationButton.getSelection());
- return super.performOk();
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- @Override
- protected void performDefaults() {
- promptForToolMigrationButton.setSelection(getPreferenceStore().getDefaultBoolean(IPreferenceConstants.PROMPT_FOR_TOOL_MIGRATION));
- promptForProjectMigrationButton.setSelection(getPreferenceStore().getDefaultBoolean(IPreferenceConstants.PROMPT_FOR_PROJECT_MIGRATION));
- super.performDefaults();
- }
-}
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
index 6c8b79ce6..e28068367 100644
--- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
+++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/ExternalToolsUIMessages.properties
@@ -49,10 +49,6 @@ FileSelectionDialog_Choose_Location_1=Choose Location
FileSelectionDialog_Ok_2=OK
FileSelectionDialog_Cancel_3=Cancel
-ExternalToolsPreferencePage_External_tool_project_builders_migration_2=External tool project builders stored in an old format will be migrated to a new format when edited. Projects which store builders using an old format will be migrated whenever a change is made. Once migrated, project builders will not be understood by installations using these older formats.
-ExternalToolsPreferencePage_Prompt_before_migrating_3=&Confirm before migrating external tool project builders for edit
-ExternalToolsPreferencePage_1=C&onfirm before migrating projects to the new format
-
EditCommandDialog_0=Configure Builder
EditCommandDialog_1=Run this builder:
EditCommandDialog_2=After a "&Clean"
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 dc927a575..062f07f97 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
@@ -23,12 +23,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
@@ -149,8 +145,8 @@ public class FileSelectionDialog extends MessageDialog {
//Also try and reset the size of the columns as appropriate
TableColumn[] columns =
selectionGroup.getListTable().getColumns();
- for (int i = 0; i < columns.length; i++) {
- columns[i].pack();
+ for (TableColumn column : columns) {
+ column.pack();
}
}
});
@@ -170,8 +166,7 @@ public class FileSelectionDialog extends MessageDialog {
try {
members = ((IContainer) o).members();
List<IResource> accessibleMembers = new ArrayList<>(members.length);
- for (int i = 0; i < members.length; i++) {
- IResource resource = members[i];
+ for (IResource resource : members) {
if (resource.isAccessible()) {
accessibleMembers.add(resource);
}
@@ -184,16 +179,14 @@ public class FileSelectionDialog extends MessageDialog {
//filter out the desired resource types
ArrayList<IResource> results = new ArrayList<>();
- for (int i = 0; i < members.length; i++) {
+ for (IResource member : members) {
//And the test bits with the resource types to see if
// they are what we want
- if ((members[i].getType() & resourceType) > 0) {
- if (members[i].getType() == IResource.FILE
- && fPattern != null
- && !fPattern.matcher(members[i].getName()).find()) {
+ if ((member.getType() & resourceType) > 0) {
+ if (member.getType() == IResource.FILE && fPattern != null && !fPattern.matcher(member.getName()).find()) {
continue;
}
- results.add(members[i]);
+ results.add(member);
}
}
return results.toArray();
@@ -208,19 +201,9 @@ public class FileSelectionDialog extends MessageDialog {
*/
private void initializeDialog() {
selectionGroup
- .addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- getButton(IDialogConstants.OK_ID).setEnabled(
- !selectionGroup.getListTableSelection().isEmpty());
- }
- });
- selectionGroup.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- buttonPressed(IDialogConstants.OK_ID);
- }
- });
+ .addSelectionChangedListener(event -> getButton(IDialogConstants.OK_ID).setEnabled(
+ !selectionGroup.getListTableSelection().isEmpty()));
+ selectionGroup.addDoubleClickListener(event -> buttonPressed(IDialogConstants.OK_ID));
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
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 b52e78a0a..ab548bafd 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
@@ -177,18 +177,10 @@ public class TreeAndListGroup implements ISelectionChangedListener {
listViewer.setContentProvider(listContentProvider);
listViewer.setLabelProvider(listLabelProvider);
listViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- notifySelectionListeners(event);
- }
- });
- listViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (!event.getSelection().isEmpty()) {
- notifyDoubleClickListeners(event);
- }
+ listViewer.addSelectionChangedListener(this::notifySelectionListeners);
+ listViewer.addDoubleClickListener(event -> {
+ if (!event.getSelection().isEmpty()) {
+ notifyDoubleClickListeners(event);
}
});
}
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 b0fc9bd2c..3ee183caa 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
@@ -93,46 +93,41 @@ public class BuildFilesResolver implements IDynamicVariableResolver
final boolean trackFiles = files;
- buildDelta.accept(new IResourceDeltaVisitor()
- {
- @Override
- public boolean visit(IResourceDelta delta) throws CoreException
- {
- IResource resource = delta.getResource();
+ buildDelta.accept((IResourceDeltaVisitor) delta -> {
+ 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)
+ // 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))
{
- String osPath = resource.getLocation().toOSString();
- if (changedResources.add(osPath))
+ if (fileList.length() > 0)
{
- 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$
+ 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;
}
+ return true;
}, deltas);
result = fileList.toString();
}
diff --git a/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF b/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF
index cc4da5b47..bf34b2762 100644
--- a/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF
+++ b/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.externaltools; singleton:=true
-Bundle-Version: 3.4.400.qualifier
+Bundle-Version: 3.5.100.qualifier
Bundle-Activator: org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
@@ -21,5 +21,5 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)";resolution:=op
org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)",
org.eclipse.core.externaltools;bundle-version="[1.0.300,2.0.0)"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: org.eclipse.ui.externaltools
diff --git a/org.eclipse.ui.externaltools/plugin.xml b/org.eclipse.ui.externaltools/plugin.xml
index 3800d0d63..1809465e3 100644
--- a/org.eclipse.ui.externaltools/plugin.xml
+++ b/org.eclipse.ui.externaltools/plugin.xml
@@ -78,15 +78,6 @@
</command>
</extension>
<extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="%PreferencePage.externalToolsPreferences"
- category="org.eclipse.debug.ui.DebugPreferencePage"
- class="org.eclipse.ui.externaltools.internal.ui.ExternalToolsPreferencePage"
- id="org.eclipse.ui.externaltools.ExternalToolsPreferencePage">
- </page>
- </extension>
- <extension
point="org.eclipse.ui.propertyPages">
<page
name="%PropertyPage.externalToolsBuilders"
@@ -198,9 +189,5 @@
id="org.eclipse.ui.externaltools.workingSetComparator">
</launchConfigurationComparator>
</extension>
-
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer class="org.eclipse.ui.externaltools.internal.model.ExternalToolsPreferenceInitializer"/>
- </extension>
</plugin>
diff --git a/org.eclipse.ui.externaltools/pom.xml b/org.eclipse.ui.externaltools/pom.xml
deleted file mode 100644
index 532d12517..000000000
--- a/org.eclipse.ui.externaltools/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2012, 2016 Eclipse Foundation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Igor Fedorenko - initial implementation
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>eclipse.platform.debug</artifactId>
- <groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
- </parent>
- <groupId>org.eclipse.ui</groupId>
- <artifactId>org.eclipse.ui.externaltools</artifactId>
- <version>3.4.400-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/org.eclipse.ui.externaltools/schema/configurationDuplicationMaps.exsd b/org.eclipse.ui.externaltools/schema/configurationDuplicationMaps.exsd
index 3ce9caa11..a657b1f88 100644
--- a/org.eclipse.ui.externaltools/schema/configurationDuplicationMaps.exsd
+++ b/org.eclipse.ui.externaltools/schema/configurationDuplicationMaps.exsd
@@ -1,120 +1,120 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.ui.externaltools" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.ui.externaltools" id="configurationDuplicationMaps" name="Configuration Duplication Maps"/>
- </appinfo>
- <documentation>
- This is an internal extension point to declare the launch configuration type that
-should be created when duplicating an existing configuration as a project builder.
-
-Clients are not intended to use this extension point.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="configurationMap" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="configurationMap">
- <complexType>
- <attribute name="sourceType" type="string" use="required">
- <annotation>
- <documentation>
- specifies the identifier of the launch configuration type for which this mapping is provided
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.debug.core.launchConfigurationTypes/launchConfigurationType/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="builderType" type="string" use="required">
- <annotation>
- <documentation>
- specifies the identifier of the launch configuration type which should be created when a configuration of type &quot;sourceType&quot; is imported to be a project builder
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.debug.core.launchConfigurationTypes/launchConfigurationType/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- The following example specifies that when the user chooses to import a launch configuration
-of the type &quot;org.eclipse.ui.externaltools.ProgramLaunchConfigurationType&quot;, a new launch
-configuration of the type&quot;org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType&quot;
-should be created.
-
-&lt;pre&gt;
-&lt;extension
- point=&quot;org.eclipse.ui.externaltools.configurationDuplicationMaps&quot;&gt;
- &lt;configurationMap
- sourceType=&quot;org.eclipse.ui.externaltools.ProgramLaunchConfigurationType&quot;
- builderType=&quot;org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType&quot;&gt;
- &lt;/configurationMap&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
-
-
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.ui.externaltools" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.ui.externaltools" id="configurationDuplicationMaps" name="Configuration Duplication Maps"/>
+ </appinfo>
+ <documentation>
+ This is an internal extension point to declare the launch configuration type that
+should be created when duplicating an existing configuration as a project builder.
-This program and the accompanying materials are made
-available under the terms of the Eclipse Public License 2.0 which
-accompanies this distribution, and is available at
+Clients are not intended to use this extension point.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="configurationMap" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="configurationMap">
+ <complexType>
+ <attribute name="sourceType" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the identifier of the launch configuration type for which this mapping is provided
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.debug.core.launchConfigurationTypes/launchConfigurationType/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="builderType" type="string" use="required">
+ <annotation>
+ <documentation>
+ specifies the identifier of the launch configuration type which should be created when a configuration of type &quot;sourceType&quot; is imported to be a project builder
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.debug.core.launchConfigurationTypes/launchConfigurationType/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ The following example specifies that when the user chooses to import a launch configuration
+of the type &quot;org.eclipse.ui.externaltools.ProgramLaunchConfigurationType&quot;, a new launch
+configuration of the type&quot;org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType&quot;
+should be created.
+
+&lt;pre&gt;
+&lt;extension
+ point=&quot;org.eclipse.ui.externaltools.configurationDuplicationMaps&quot;&gt;
+ &lt;configurationMap
+ sourceType=&quot;org.eclipse.ui.externaltools.ProgramLaunchConfigurationType&quot;
+ builderType=&quot;org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType&quot;&gt;
+ &lt;/configurationMap&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
+
+This program and the accompanying materials are made
+available under the terms of the Eclipse Public License 2.0 which
+accompanies this distribution, and is available at
&lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
-SPDX-License-Identifier: EPL-2.0
- </documentation>
- </annotation>
-
-</schema>
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.unittest.ui/.classpath b/org.eclipse.unittest.ui/.classpath
new file mode 100644
index 000000000..4a00becd8
--- /dev/null
+++ b/org.eclipse.unittest.ui/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.unittest.ui/.project b/org.eclipse.unittest.ui/.project
new file mode 100644
index 000000000..3b2e76cfb
--- /dev/null
+++ b/org.eclipse.unittest.ui/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.unittest.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.unittest.ui/.settings/org.eclipse.core.resources.prefs b/org.eclipse.unittest.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/org.eclipse.unittest.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/org.eclipse.unittest.ui/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.unittest.ui/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 000000000..5a0ad22d2
--- /dev/null
+++ b/org.eclipse.unittest.ui/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.unittest.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.unittest.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..5ab320324
--- /dev/null
+++ b/org.eclipse.unittest.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,538 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=fg
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
+org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=info
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=info
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=info
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=info
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=info
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=info
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=info
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=11
+org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
+org.eclipse.jdt.core.formatter.align_with_spaces=false
+org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assertion_message=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
+org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_record_components=16
+org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0
+org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
+org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.text_block_indentation=0
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/org.eclipse.unittest.ui/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.unittest.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..e1de5eec4
--- /dev/null
+++ b/org.eclipse.unittest.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,84 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
+formatter_settings_version=20
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;sun;com;org;org.apache;org.w3c;org.eclipse;org.eclipse.swt;org.eclipse.core;org.eclipse.core.runtime;org.eclipse.core.resources;org.eclipse.core.filebuffers;org.eclipse.text;org.eclipse.jface;org.eclipse.jface.text;org.eclipse.ui;org.eclipse.ui.workbench.texteditor;org.eclipse.ui.texteditor;org.eclipse.ui.editors;org.eclipse.compare;org.eclipse.debug;org.eclipse.debug.ui;org.eclipse.search;org.eclipse.search2;org.eclipse.ltk;org.eclipse.jdt.core;org.eclipse.jdt.internal;org.eclipse.jdt.launching;org.eclipse.jdt.ui;org.eclipse.jdt.internal.ui;
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.lazy_logical_operator=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.merge_conditional_blocks=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.number_suffix=false
+sp_cleanup.objects_equals=false
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.precompile_regex=true
+sp_cleanup.push_down_negation=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=true
+sp_cleanup.remove_redundant_semicolons=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_array_creation=true
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.simplify_lambda_expression_and_method_ref=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_autoboxing=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_directly_map_method=true
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_unboxing=false
+sp_cleanup.use_var=false
diff --git a/org.eclipse.unittest.ui/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.unittest.ui/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644
index 000000000..9d6e2dc79
--- /dev/null
+++ b/org.eclipse.unittest.ui/.settings/org.eclipse.pde.api.tools.prefs
@@ -0,0 +1,102 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_FIELD=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_DEFAULT_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_ANNOTATION=Ignore
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Warning
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+changed_execution_env=Error
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_report_major_without_breaking_change=Error
+incompatible_api_component_version_report_minor_without_api_change=Error
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/org.eclipse.unittest.ui/.settings/org.eclipse.pde.prefs b/org.eclipse.unittest.ui/.settings/org.eclipse.pde.prefs
new file mode 100644
index 000000000..9dbfcc5af
--- /dev/null
+++ b/org.eclipse.unittest.ui/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,36 @@
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=0
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.exec-env-too-low=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=1
+compilers.p.no-required-att=0
+compilers.p.no.automatic.module=1
+compilers.p.not-externalized-att=1
+compilers.p.service.component.without.lazyactivation=1
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=0
+compilers.p.unknown-identifier=0
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.unittest.ui/META-INF/MANIFEST.MF b/org.eclipse.unittest.ui/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..3849febd5
--- /dev/null
+++ b/org.eclipse.unittest.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Automatic-Module-Name: org.eclipse.unittest.ui
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.unittest.ui;singleton:=true
+Bundle-Version: 1.0.100.qualifier
+Bundle-Activator: org.eclipse.unittest.internal.UnitTestPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Export-Package: org.eclipse.unittest.launcher,
+ org.eclipse.unittest.model,
+ org.eclipse.unittest.ui
+Require-Bundle:
+ org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.debug.ui;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
+ org.eclipse.compare;bundle-version="[3.5.0,4.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-11
diff --git a/org.eclipse.unittest.ui/about.html b/org.eclipse.unittest.ui/about.html
new file mode 100644
index 000000000..164f781a8
--- /dev/null
+++ b/org.eclipse.unittest.ui/about.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>About</title>
+</head>
+<body lang="EN-US">
+ <h2>About This Content</h2>
+
+ <p>November 30, 2017</p>
+ <h3>License</h3>
+
+ <p>
+ The Eclipse Foundation makes available all content in this plug-in
+ (&quot;Content&quot;). Unless otherwise indicated below, the Content
+ is provided to you under the terms and conditions of the Eclipse
+ Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is
+ available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.
+ </p>
+
+ <p>
+ If you did not receive this Content directly from the Eclipse
+ Foundation, the Content is being redistributed by another party
+ (&quot;Redistributor&quot;) and different terms and conditions may
+ apply to your use of any object code in the Content. Check the
+ Redistributor's license that was provided with the Content. If no such
+ license exists, contact the Redistributor. Unless otherwise indicated
+ below, the terms and conditions of the EPL still apply to any source
+ code in the Content and such source code may be obtained at <a
+ href="http://www.eclipse.org/">http://www.eclipse.org</a>.
+ </p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.unittest.ui/build.properties b/org.eclipse.unittest.ui/build.properties
new file mode 100644
index 000000000..136d1bca6
--- /dev/null
+++ b/org.eclipse.unittest.ui/build.properties
@@ -0,0 +1,25 @@
+###############################################################################
+# Copyright (c) 2000, 2011 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = plugin.xml,\
+ about.html,\
+ icons/,\
+ plugin.properties,\
+ .,\
+ META-INF/
+
+source.. = src/
+src.includes = about.html,\
+ schema/
+
+javacWarnings..=-unavoidableGenericProblems
diff --git a/org.eclipse.unittest.ui/icons-work/unitViewIcon.xcf b/org.eclipse.unittest.ui/icons-work/unitViewIcon.xcf
new file mode 100644
index 000000000..9391c1c7d
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons-work/unitViewIcon.xcf
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/cfilter.png b/org.eclipse.unittest.ui/icons/full/dlcl16/cfilter.png
new file mode 100644
index 000000000..fd883fb43
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/cfilter.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/cfilter@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/cfilter@2x.png
new file mode 100644
index 000000000..1473192df
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/cfilter@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/compare.png b/org.eclipse.unittest.ui/icons/full/dlcl16/compare.png
new file mode 100644
index 000000000..cbeeeabe5
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/compare.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/compare@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/compare@2x.png
new file mode 100644
index 000000000..bd6e98107
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/compare@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout.png b/org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout.png
new file mode 100644
index 000000000..061b593ca
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout@2x.png
new file mode 100644
index 000000000..23540f72b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/flatLayout@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout.png b/org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout.png
new file mode 100644
index 000000000..64822eaa0
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout@2x.png
new file mode 100644
index 000000000..b84fb01bf
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/hierarchicalLayout@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/history_list.png b/org.eclipse.unittest.ui/icons/full/dlcl16/history_list.png
new file mode 100644
index 000000000..033bef13d
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/history_list.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/history_list@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/history_list@2x.png
new file mode 100644
index 000000000..2a9eeb412
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/history_list@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/lock.png b/org.eclipse.unittest.ui/icons/full/dlcl16/lock.png
new file mode 100644
index 000000000..615dbbb64
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/lock.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/lock@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/lock@2x.png
new file mode 100644
index 000000000..cde2a0f41
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/lock@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/open_console.png b/org.eclipse.unittest.ui/icons/full/dlcl16/open_console.png
new file mode 100644
index 000000000..735f57b08
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/open_console.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/open_console@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/open_console@2x.png
new file mode 100644
index 000000000..e0232a871
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/open_console@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/relaunch.png b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunch.png
new file mode 100644
index 000000000..f84f509a0
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunch.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/relaunch@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunch@2x.png
new file mode 100644
index 000000000..42a5cbddf
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunch@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf.png b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf.png
new file mode 100644
index 000000000..b30f5738a
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf@2x.png
new file mode 100644
index 000000000..a4a23a5e6
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/relaunchf@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/select_next.png b/org.eclipse.unittest.ui/icons/full/dlcl16/select_next.png
new file mode 100644
index 000000000..1a71a7923
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/select_next.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/select_next@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/select_next@2x.png
new file mode 100644
index 000000000..064c3002c
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/select_next@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/select_prev.png b/org.eclipse.unittest.ui/icons/full/dlcl16/select_prev.png
new file mode 100644
index 000000000..7eaaff979
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/select_prev.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/select_prev@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/select_prev@2x.png
new file mode 100644
index 000000000..0b95e38b5
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/select_prev@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/stop.png b/org.eclipse.unittest.ui/icons/full/dlcl16/stop.png
new file mode 100644
index 000000000..ed5e84804
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/stop.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/stop@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/stop@2x.png
new file mode 100644
index 000000000..561447b40
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/stop@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic.png b/org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic.png
new file mode 100644
index 000000000..0d8f6ddd1
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic@2x.png
new file mode 100644
index 000000000..7e5f9d7a8
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/th_automatic@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal.png b/org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal.png
new file mode 100644
index 000000000..a7b1f6bbd
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal@2x.png
new file mode 100644
index 000000000..943c571bb
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/th_horizontal@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical.png b/org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical.png
new file mode 100644
index 000000000..a524112f9
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical@2x.png b/org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical@2x.png
new file mode 100644
index 000000000..a12d09145
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dlcl16/th_vertical@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dtool16/new_testcase.png b/org.eclipse.unittest.ui/icons/full/dtool16/new_testcase.png
new file mode 100644
index 000000000..d9cb08eac
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dtool16/new_testcase.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dtool16/new_testcase@2x.png b/org.eclipse.unittest.ui/icons/full/dtool16/new_testcase@2x.png
new file mode 100644
index 000000000..5c596075d
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dtool16/new_testcase@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite.png b/org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite.png
new file mode 100644
index 000000000..eda2dad33
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite@2x.png b/org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite@2x.png
new file mode 100644
index 000000000..2441d86cf
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/dtool16/new_testsuite@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/cfilter.png b/org.eclipse.unittest.ui/icons/full/elcl16/cfilter.png
new file mode 100644
index 000000000..e779b3e29
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/cfilter.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/cfilter@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/cfilter@2x.png
new file mode 100644
index 000000000..3bea811c8
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/cfilter@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/compare.png b/org.eclipse.unittest.ui/icons/full/elcl16/compare.png
new file mode 100644
index 000000000..07fb14ee9
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/compare.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/compare@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/compare@2x.png
new file mode 100644
index 000000000..89c631a38
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/compare@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/flatLayout.png b/org.eclipse.unittest.ui/icons/full/elcl16/flatLayout.png
new file mode 100644
index 000000000..13f83a237
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/flatLayout.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/flatLayout@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/flatLayout@2x.png
new file mode 100644
index 000000000..280561aeb
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/flatLayout@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout.png b/org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout.png
new file mode 100644
index 000000000..665aa5cee
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout@2x.png
new file mode 100644
index 000000000..84039be3a
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/hierarchicalLayout@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/history_list.png b/org.eclipse.unittest.ui/icons/full/elcl16/history_list.png
new file mode 100644
index 000000000..7808b5070
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/history_list.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/history_list@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/history_list@2x.png
new file mode 100644
index 000000000..585fc17b9
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/history_list@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/lock.png b/org.eclipse.unittest.ui/icons/full/elcl16/lock.png
new file mode 100644
index 000000000..91fef558a
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/lock.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/lock@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/lock@2x.png
new file mode 100644
index 000000000..8742944db
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/lock@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/open_console.png b/org.eclipse.unittest.ui/icons/full/elcl16/open_console.png
new file mode 100644
index 000000000..fdb3b0cb3
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/open_console.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/open_console@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/open_console@2x.png
new file mode 100644
index 000000000..55bcdc0e2
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/open_console@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/relaunch.png b/org.eclipse.unittest.ui/icons/full/elcl16/relaunch.png
new file mode 100644
index 000000000..89228fa08
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/relaunch.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/relaunch@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/relaunch@2x.png
new file mode 100644
index 000000000..c0a3d3ab8
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/relaunch@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/relaunchf.png b/org.eclipse.unittest.ui/icons/full/elcl16/relaunchf.png
new file mode 100644
index 000000000..d25cafa34
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/relaunchf.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/relaunchf@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/relaunchf@2x.png
new file mode 100644
index 000000000..74550215f
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/relaunchf@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/select_next.png b/org.eclipse.unittest.ui/icons/full/elcl16/select_next.png
new file mode 100644
index 000000000..9fcc646d9
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/select_next.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/select_next@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/select_next@2x.png
new file mode 100644
index 000000000..d46b3a062
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/select_next@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/select_prev.png b/org.eclipse.unittest.ui/icons/full/elcl16/select_prev.png
new file mode 100644
index 000000000..f2e6a039c
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/select_prev.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/select_prev@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/select_prev@2x.png
new file mode 100644
index 000000000..8e26ea4b4
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/select_prev@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/stop.png b/org.eclipse.unittest.ui/icons/full/elcl16/stop.png
new file mode 100644
index 000000000..032a26c1c
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/stop.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/stop@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/stop@2x.png
new file mode 100644
index 000000000..a7dc14cc9
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/stop@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/th_automatic.png b/org.eclipse.unittest.ui/icons/full/elcl16/th_automatic.png
new file mode 100644
index 000000000..a1103e8a5
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/th_automatic.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/th_automatic@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/th_automatic@2x.png
new file mode 100644
index 000000000..bf6057510
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/th_automatic@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal.png b/org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal.png
new file mode 100644
index 000000000..ca4602849
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal@2x.png
new file mode 100644
index 000000000..217f8560e
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/th_horizontal@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/th_vertical.png b/org.eclipse.unittest.ui/icons/full/elcl16/th_vertical.png
new file mode 100644
index 000000000..07baf5138
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/th_vertical.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/elcl16/th_vertical@2x.png b/org.eclipse.unittest.ui/icons/full/elcl16/th_vertical@2x.png
new file mode 100644
index 000000000..62e0a379a
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/elcl16/th_vertical@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/etool16/new_testcase.png b/org.eclipse.unittest.ui/icons/full/etool16/new_testcase.png
new file mode 100644
index 000000000..7c4692f69
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/etool16/new_testcase.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/etool16/new_testcase@2x.png b/org.eclipse.unittest.ui/icons/full/etool16/new_testcase@2x.png
new file mode 100644
index 000000000..eb4401afe
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/etool16/new_testcase@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/etool16/new_testsuite.png b/org.eclipse.unittest.ui/icons/full/etool16/new_testsuite.png
new file mode 100644
index 000000000..8ceabbcb7
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/etool16/new_testsuite.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/etool16/new_testsuite@2x.png b/org.eclipse.unittest.ui/icons/full/etool16/new_testsuite@2x.png
new file mode 100644
index 000000000..87bc8eb52
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/etool16/new_testsuite@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/stackframe.png b/org.eclipse.unittest.ui/icons/full/eview16/stackframe.png
new file mode 100644
index 000000000..cffa1aaea
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/stackframe.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/stackframe@2x.png b/org.eclipse.unittest.ui/icons/full/eview16/stackframe@2x.png
new file mode 100644
index 000000000..3f880c529
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/stackframe@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/unit.png b/org.eclipse.unittest.ui/icons/full/eview16/unit.png
new file mode 100644
index 000000000..358eba121
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/unit.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/unit@2x.png b/org.eclipse.unittest.ui/icons/full/eview16/unit@2x.png
new file mode 100644
index 000000000..70cf88e8b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/unit@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/uniterr.png b/org.eclipse.unittest.ui/icons/full/eview16/uniterr.png
new file mode 100644
index 000000000..834deffeb
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/uniterr.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/uniterr@2x.png b/org.eclipse.unittest.ui/icons/full/eview16/uniterr@2x.png
new file mode 100644
index 000000000..7b71aa58b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/uniterr@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/uniterrq.png b/org.eclipse.unittest.ui/icons/full/eview16/uniterrq.png
new file mode 100644
index 000000000..9e17bb9f5
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/uniterrq.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/uniterrq@2x.png b/org.eclipse.unittest.ui/icons/full/eview16/uniterrq@2x.png
new file mode 100644
index 000000000..aa2e0b5ab
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/uniterrq@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/unitsucc.png b/org.eclipse.unittest.ui/icons/full/eview16/unitsucc.png
new file mode 100644
index 000000000..ef6dd9412
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/unitsucc.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/unitsucc@2x.png b/org.eclipse.unittest.ui/icons/full/eview16/unitsucc@2x.png
new file mode 100644
index 000000000..53b19687b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/unitsucc@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/unitsuccq.png b/org.eclipse.unittest.ui/icons/full/eview16/unitsuccq.png
new file mode 100644
index 000000000..97884575b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/unitsuccq.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/eview16/unitsuccq@2x.png b/org.eclipse.unittest.ui/icons/full/eview16/unitsuccq@2x.png
new file mode 100644
index 000000000..1a7a42572
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/eview16/unitsuccq@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/exc_catch.png b/org.eclipse.unittest.ui/icons/full/obj16/exc_catch.png
new file mode 100644
index 000000000..2962f6e63
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/exc_catch.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/exc_catch@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/exc_catch@2x.png
new file mode 100644
index 000000000..b943d360d
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/exc_catch@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/faillist.png b/org.eclipse.unittest.ui/icons/full/obj16/faillist.png
new file mode 100644
index 000000000..c33980f65
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/faillist.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/faillist@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/faillist@2x.png
new file mode 100644
index 000000000..d3686b843
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/faillist@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/failures.png b/org.eclipse.unittest.ui/icons/full/obj16/failures.png
new file mode 100644
index 000000000..c2cd90d96
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/failures.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/failures@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/failures@2x.png
new file mode 100644
index 000000000..1d6815daf
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/failures@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/julaunch.png b/org.eclipse.unittest.ui/icons/full/obj16/julaunch.png
new file mode 100644
index 000000000..ede46fbac
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/julaunch.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/julaunch@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/julaunch@2x.png
new file mode 100644
index 000000000..e9e9b1d69
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/julaunch@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj.png b/org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj.png
new file mode 100644
index 000000000..cffa1aaea
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj@2x.png
new file mode 100644
index 000000000..3f880c529
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/stkfrm_obj@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/test.png b/org.eclipse.unittest.ui/icons/full/obj16/test.png
new file mode 100644
index 000000000..c95f6b58b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/test.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/test@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/test@2x.png
new file mode 100644
index 000000000..c404f6507
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/test@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed.png b/org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed.png
new file mode 100644
index 000000000..e12b607ed
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed@2x.png
new file mode 100644
index 000000000..4702a33f3
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testassumptionfailed@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testerr.png b/org.eclipse.unittest.ui/icons/full/obj16/testerr.png
new file mode 100644
index 000000000..1814c22a0
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testerr.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testerr@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testerr@2x.png
new file mode 100644
index 000000000..221811a32
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testerr@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testfail.png b/org.eclipse.unittest.ui/icons/full/obj16/testfail.png
new file mode 100644
index 000000000..f7ebe5efd
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testfail.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testfail@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testfail@2x.png
new file mode 100644
index 000000000..944e6381c
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testfail@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testfile_obj.png b/org.eclipse.unittest.ui/icons/full/obj16/testfile_obj.png
new file mode 100644
index 000000000..0905b505f
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testfile_obj.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testfile_obj@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testfile_obj@2x.png
new file mode 100644
index 000000000..9cb969611
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testfile_obj@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testhier.png b/org.eclipse.unittest.ui/icons/full/obj16/testhier.png
new file mode 100644
index 000000000..acfde8818
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testhier.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testhier@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testhier@2x.png
new file mode 100644
index 000000000..9ab1d917f
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testhier@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testignored.png b/org.eclipse.unittest.ui/icons/full/obj16/testignored.png
new file mode 100644
index 000000000..7f241980b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testignored.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testignored@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testignored@2x.png
new file mode 100644
index 000000000..459d022cf
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testignored@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testok.png b/org.eclipse.unittest.ui/icons/full/obj16/testok.png
new file mode 100644
index 000000000..c27c47ea5
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testok.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testok@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testok@2x.png
new file mode 100644
index 000000000..272d3577b
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testok@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testrun.png b/org.eclipse.unittest.ui/icons/full/obj16/testrun.png
new file mode 100644
index 000000000..8a08a1d33
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testrun.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/testrun@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/testrun@2x.png
new file mode 100644
index 000000000..54c54d615
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/testrun@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuite.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuite.png
new file mode 100644
index 000000000..d45394e5a
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuite.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuite@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuite@2x.png
new file mode 100644
index 000000000..b3bdb79f7
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuite@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror.png
new file mode 100644
index 000000000..53ab5187e
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror@2x.png
new file mode 100644
index 000000000..c1dd70b1e
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteerror@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuitefail.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuitefail.png
new file mode 100644
index 000000000..21402750d
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuitefail.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuitefail@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuitefail@2x.png
new file mode 100644
index 000000000..830da7e99
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuitefail@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuiteok.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteok.png
new file mode 100644
index 000000000..a6bfbf83e
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteok.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuiteok@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteok@2x.png
new file mode 100644
index 000000000..bb0604352
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuiteok@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuiterun.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuiterun.png
new file mode 100644
index 000000000..d4d5170be
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuiterun.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/obj16/tsuiterun@2x.png b/org.eclipse.unittest.ui/icons/full/obj16/tsuiterun@2x.png
new file mode 100644
index 000000000..d829ce8f1
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/obj16/tsuiterun@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/ovr16/error_ovr.png b/org.eclipse.unittest.ui/icons/full/ovr16/error_ovr.png
new file mode 100644
index 000000000..412588ac5
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/ovr16/error_ovr.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/ovr16/error_ovr@2x.png b/org.eclipse.unittest.ui/icons/full/ovr16/error_ovr@2x.png
new file mode 100644
index 000000000..683b3f743
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/ovr16/error_ovr@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr.png b/org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr.png
new file mode 100644
index 000000000..a2f7f2812
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr@2x.png b/org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr@2x.png
new file mode 100644
index 000000000..453e52792
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/ovr16/failed_ovr@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/ovr16/success_ovr.png b/org.eclipse.unittest.ui/icons/full/ovr16/success_ovr.png
new file mode 100644
index 000000000..40c5322bd
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/ovr16/success_ovr.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/ovr16/success_ovr@2x.png b/org.eclipse.unittest.ui/icons/full/ovr16/success_ovr@2x.png
new file mode 100644
index 000000000..d912a1772
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/ovr16/success_ovr@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz.png b/org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz.png
new file mode 100644
index 000000000..55f6dbb33
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz@2x.png b/org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz@2x.png
new file mode 100644
index 000000000..425b38e38
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/wizban/newsuite_wiz@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz.png b/org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz.png
new file mode 100644
index 000000000..d601a97f2
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz@2x.png b/org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz@2x.png
new file mode 100644
index 000000000..9011edd06
--- /dev/null
+++ b/org.eclipse.unittest.ui/icons/full/wizban/newtest_wiz@2x.png
Binary files differ
diff --git a/org.eclipse.unittest.ui/plugin.properties b/org.eclipse.unittest.ui/plugin.properties
new file mode 100644
index 000000000..473441c53
--- /dev/null
+++ b/org.eclipse.unittest.ui/plugin.properties
@@ -0,0 +1,31 @@
+###############################################################################
+# Copyright (c) 2000, 2019 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+pluginName=Debug Unit Test support
+providerName=Eclipse.org
+
+testRunListeners.name= Test Run Listeners
+
+testViewSupport.name= Unit Test View Support
+
+View.label= Test Results
+
+UnitTestShortcut.label= Unit Test
+UnitTestShortcut.description.run= Run Unit Test
+UnitTestShortcut.description.debug= Debug Unit Test
+UnitTestShortcut.description.rerunLast= Rerun Unit Test
+UnitTestShortcut.description.rerunFailedCases= Rerun Unit Test - Failures only
+UnitTestShortcut.description.history=Test Sessions History
+
+GotoTestCommand.name= Referring Tests
+GotoTestCommand.description= Referring Tests
diff --git a/org.eclipse.unittest.ui/plugin.xml b/org.eclipse.unittest.ui/plugin.xml
new file mode 100644
index 000000000..1e351367e
--- /dev/null
+++ b/org.eclipse.unittest.ui/plugin.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension-point id="unittestViewSupport" name="%testViewSupport.name" schema="schema/unittestViewSupport.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="%View.label"
+ icon="$nl$/icons/full/eview16/unit.png"
+ category="org.eclipse.debug.ui"
+ fastViewWidthRatio="0.40"
+ class="org.eclipse.unittest.internal.ui.TestRunnerViewPart"
+ id="org.eclipse.unittest.ui.ResultView">
+ </view>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ name="%GotoTestCommand.name"
+ description="%GotoTestCommand.description"
+ categoryId="org.eclipse.search.ui.category.search"
+ id="org.eclipse.unittest.ui.gotoTest">
+ </command>
+ <command
+ name="%UnitTestShortcut.description.run"
+ description="%UnitTestShortcut.description.run"
+ categoryId="org.eclipse.debug.ui.category.run"
+ id="org.eclipse.unittest.ui.UnitTestShortcut.run">
+ </command>
+ <command
+ name="%UnitTestShortcut.description.debug"
+ description="%UnitTestShortcut.description.debug"
+ categoryId="org.eclipse.debug.ui.category.run"
+ id="org.eclipse.unittest.ui.UnitTestShortcut.debug">
+ </command>
+ <command
+ name="%UnitTestShortcut.description.rerunLast"
+ description="%UnitTestShortcut.description.rerunLast"
+ categoryId="org.eclipse.debug.ui.category.run"
+ id="org.eclipse.unittest.ui.UnitTestShortcut.rerunLast">
+ </command>
+ <command
+ name="%UnitTestShortcut.description.rerunFailedCases"
+ description="%UnitTestShortcut.description.rerunFailedCases"
+ categoryId="org.eclipse.debug.ui.category.run"
+ id="org.eclipse.unittest.ui.UnitTestShortcut.rerunFailedCases">
+ </command>
+ <command
+ defaultHandler="org.eclipse.unittest.internal.ui.history.HistoryHandler"
+ description="%UnitTestShortcut.description.history"
+ id="org.eclipse.unittest.ui.history"
+ name="%UnitTestShortcut.description.history">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.unittest.ui.history"
+ disabledIcon="icons/full/dlcl16/history_list.png"
+ icon="icons/full/elcl16/history_list.png">
+ </image>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.debug.examples.ui/pom.xml b/org.eclipse.unittest.ui/pom.xml
index 175dc8ee5..095e3f78d 100644
--- a/org.eclipse.debug.examples.ui/pom.xml
+++ b/org.eclipse.unittest.ui/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2017 Eclipse Foundation and others.
+ Copyright (c) 2012, 2019 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -8,16 +8,17 @@
Contributors:
Igor Fedorenko - initial implementation
+ Jens Reimann (jreimann@redhat.com) - add copy & paste support
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>eclipse.platform.debug</artifactId>
<groupId>eclipse.platform.debug</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.debug</groupId>
- <artifactId>org.eclipse.debug.examples.ui</artifactId>
- <version>1.6.200-SNAPSHOT</version>
+ <artifactId>org.eclipse.unittest.ui</artifactId>
+ <version>1.0.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/org.eclipse.unittest.ui/schema/unittestViewSupport.exsd b/org.eclipse.unittest.ui/schema/unittestViewSupport.exsd
new file mode 100644
index 000000000..2217935a8
--- /dev/null
+++ b/org.eclipse.unittest.ui/schema/unittestViewSupport.exsd
@@ -0,0 +1,98 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.unittest.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.unittest.ui" id="unittestViewSupport" name="UnitTest View Support"/>
+ </appInfo>
+ <documentation>
+ Internal extension point to register Unit Test View support.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="viewSupport" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified extention point identifier
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ a name of this extention point
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="viewSupport">
+ <annotation>
+ <documentation>
+ A Test View Support definition that implements org.eclipse.unittest.launcher.ITestViewSupport.
+This is used by the &lt;i&gt;Unit Test&lt;/i&gt; view to provide support for test engines.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified extention point identifier.
+This identifier is used to load support for the &lt;i&gt;Unit Test&lt;/i&gt; view when some ILaunch is running, and the underlying launch configuration sets attributes &lt;code&gt;UnitTestLaunchConfigurationConstants.ATTR_UNIT_TEST_VIEW_SUPPORT&lt;/code&gt; to the given id.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified class name that implements org.eclipse.unittest.launcher.ITestViewSupport.
+This is used by the &lt;i&gt;Unit Test&lt;/i&gt; view to provide support for test engines.
+The class defines the method that creates a Unit Test Runner Client dedicated to communicate with a test engine and to gather the results of testing as well as a number of methods that help to the &lt;i&gt;Unit Test&lt;/i&gt; view in creation of unit test related actions, like openning a test source or a file reported on a stack trace in editor or returning a ILaunchConfiguration for Rerun action.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.unittest.launcher.ITestViewSupport"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
+
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2006, 2020 IBM Corporation and others.
+
+This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at &lt;a href=&quot;https://www.eclipse.org/legal/epl-2.0&quot;&gt;https://www.eclipse.org/legal/epl-v20.html&lt;/a&gt;/
+
+SPDX-License-Identifier: EPL-2.0
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPlugin.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPlugin.java
new file mode 100644
index 000000000..b1f3a2585
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPlugin.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal;
+
+import org.osgi.framework.BundleContext;
+
+import org.eclipse.unittest.internal.model.UnitTestLaunchListener;
+import org.eclipse.unittest.internal.model.UnitTestModel;
+import org.eclipse.unittest.internal.ui.history.History;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchListener;
+
+/**
+ * The plug-in runtime class for the Unit Test plug-in.
+ */
+public class UnitTestPlugin extends AbstractUIPlugin {
+
+ /**
+ * The single instance of this plug-in runtime class.
+ */
+ private static UnitTestPlugin fgPlugin = null;
+
+ private final ILaunchListener fLaunchListener = new UnitTestLaunchListener();
+
+ public static final String PLUGIN_ID = "org.eclipse.unittest.ui"; //$NON-NLS-1$
+
+ /**
+ * Constructs a {@link UnitTestPlugin} object
+ */
+ public UnitTestPlugin() {
+ fgPlugin = this;
+ }
+
+ /**
+ * Returns the {@link UnitTestPlugin} instance
+ *
+ * @return a {@link UnitTestPlugin} instance
+ */
+ public static UnitTestPlugin getDefault() {
+ return fgPlugin;
+ }
+
+ /**
+ * Logs the given exception.
+ *
+ * @param e the {@link Throwable} to log
+ */
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$
+ }
+
+ /**
+ * Logs the given status.
+ *
+ * @param status the status to log
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ UnitTestModel.getInstance().start();
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(fLaunchListener);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ try {
+ InstanceScope.INSTANCE.getNode(UnitTestPlugin.PLUGIN_ID).flush();
+ UnitTestModel.getInstance().stop();
+ DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(fLaunchListener);
+ History.INSTANCE.clear();
+ } finally {
+ super.stop(context);
+ }
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPreferencesConstants.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPreferencesConstants.java
new file mode 100644
index 000000000..2d043f0cb
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/UnitTestPreferencesConstants.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+/**
+ * Defines constants which are used to refer to values in the plugin's
+ * preference store.
+ */
+public class UnitTestPreferencesConstants {
+ /**
+ * Boolean preference controlling whether the failure stack should be filtered.
+ */
+ public static final String DO_FILTER_STACK = UnitTestPlugin.PLUGIN_ID + ".do_filter_stack"; //$NON-NLS-1$
+
+ /**
+ * Boolean preference controlling whether the Unit Test view should be shown on
+ * errors only.
+ */
+ public static final String SHOW_ON_ERROR_ONLY = UnitTestPlugin.PLUGIN_ID + ".show_on_error"; //$NON-NLS-1$
+
+ /**
+ * Maximum number of remembered test runs.
+ */
+ public static final String MAX_TEST_RUNS = UnitTestPlugin.PLUGIN_ID + ".max_test_runs"; //$NON-NLS-1$
+
+ private UnitTestPreferencesConstants() {
+ // no instance
+ }
+
+ /**
+ * Serializes the array of strings into one comma-separated string.
+ *
+ * @param list array of strings
+ * @return a single string composed of the given list
+ */
+ public static String serializeList(String[] list) {
+ if (list == null)
+ return ""; //$NON-NLS-1$
+
+ return String.join(String.valueOf(','), list);
+ }
+
+ /**
+ * Parses the comma-separated string into an array of strings.
+ *
+ * @param listString a comma-separated string
+ * @return an array of strings
+ */
+ public static String[] parseList(String listString) {
+ List<String> list = new ArrayList<>(10);
+ StringTokenizer tokenizer = new StringTokenizer(listString, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens())
+ list.add(tokenizer.nextToken());
+ return list.toArray(new String[list.size()]);
+ }
+
+ /**
+ * Indicates if a filter patterns are to be applied on a stacktrace/error
+ * messages
+ *
+ * @return <code>true</code> in case the stacktrace is to be filtered, otherwise
+ * - <code>false</code>
+ */
+ public static boolean getFilterStack() {
+ return Platform.getPreferencesService().getBoolean(UnitTestPlugin.PLUGIN_ID, DO_FILTER_STACK, false, null);
+ }
+
+ /**
+ * Sets up a value for the DO_FILTER_STACK preference
+ *
+ * @param filter boolean indicating if a stacktrace is to be filtered
+ */
+ public static void setFilterStack(boolean filter) {
+ InstanceScope.INSTANCE.getNode(UnitTestPlugin.PLUGIN_ID).putBoolean(DO_FILTER_STACK, filter);
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/HistoryEntryHandler.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/HistoryEntryHandler.java
new file mode 100644
index 000000000..c55df2bd3
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/HistoryEntryHandler.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Ha, Inc. and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.junitXmlReport;
+
+import java.time.Instant;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.eclipse.core.runtime.OperationCanceledException;
+
+/**
+ * Minimal reader to populate history entry data.
+ */
+public class HistoryEntryHandler extends DefaultHandler {
+
+ private int failuresAndErrors;
+ private Instant startTime;
+ private String name;
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ if (Thread.interrupted())
+ throw new OperationCanceledException();
+
+ if (IXMLTags.NODE_TESTRUN.equals(qName)) {
+ String attribute = attributes.getValue(IXMLTags.ATTR_ERRORS);
+ if (attribute != null) {
+ failuresAndErrors = getFailuresAndErrors() + Integer.parseInt(attribute);
+ }
+ attribute = attributes.getValue(IXMLTags.ATTR_FAILURES);
+ if (attribute != null) {
+ failuresAndErrors = getFailuresAndErrors() + Integer.parseInt(attribute);
+ }
+ name = attributes.getValue(IXMLTags.ATTR_NAME);
+ attribute = attributes.getValue(IXMLTags.ATTR_START_TIME);
+ if (attribute != null) {
+ startTime = Instant.parse(attribute);
+ }
+ }
+ }
+
+ /**
+ * Returns the number of failures and errors for the history entry
+ *
+ * @return a number of failures and errors
+ */
+ public int getFailuresAndErrors() {
+ return failuresAndErrors;
+ }
+
+ /**
+ * Returns an {@link Instant} object instance indicating a unit test start time.
+ *
+ * @return an {@link Instant} object instance
+ */
+ public Instant getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Returns a name of history entry
+ *
+ * @return a name of history entry
+ */
+ public String getName() {
+ return name;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/IXMLTags.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/IXMLTags.java
new file mode 100644
index 000000000..efe388a47
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/IXMLTags.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.junitXmlReport;
+
+interface IXMLTags {
+
+ String NODE_TESTRUN = "testrun"; //$NON-NLS-1$
+ String NODE_TESTSUITES = "testsuites"; //$NON-NLS-1$
+ String NODE_TESTSUITE = "testsuite"; //$NON-NLS-1$
+ String NODE_PROPERTIES = "properties"; //$NON-NLS-1$
+ String NODE_PROPERTY = "property"; //$NON-NLS-1$
+ String NODE_TESTCASE = "testcase"; //$NON-NLS-1$
+ String NODE_ERROR = "error"; //$NON-NLS-1$
+ String NODE_FAILURE = "failure"; //$NON-NLS-1$
+ String NODE_EXPECTED = "expected"; //$NON-NLS-1$
+ String NODE_ACTUAL = "actual"; //$NON-NLS-1$
+ String NODE_SYSTEM_OUT = "system-out"; //$NON-NLS-1$
+ String NODE_SYSTEM_ERR = "system-err"; //$NON-NLS-1$
+ String NODE_SKIPPED = "skipped"; //$NON-NLS-1$
+
+ /**
+ * value: String
+ */
+ String ATTR_NAME = "name"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_LAUNCH_CONFIG_NAME = "launch_config_name"; //$NON-NLS-1$
+ /**
+ * value: Integer
+ */
+ String ATTR_TESTS = "tests"; //$NON-NLS-1$
+ /**
+ * value: Integer
+ */
+ String ATTR_STARTED = "started"; //$NON-NLS-1$
+ /**
+ * value: Integer
+ */
+ String ATTR_FAILURES = "failures"; //$NON-NLS-1$
+ /**
+ * value: Integer
+ */
+ String ATTR_ERRORS = "errors"; //$NON-NLS-1$
+ /**
+ * value: Boolean
+ */
+ String ATTR_IGNORED = "ignored"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_PACKAGE = "package"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_ID = "id"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_CLASSNAME = "classname"; //$NON-NLS-1$
+ /**
+ * value: Boolean
+ */
+ String ATTR_INCOMPLETE = "incomplete"; //$NON-NLS-1$
+ /**
+ * value: Duration.toString()
+ */
+ String ATTR_START_TIME = "startTime"; //$NON-NLS-1$
+ /**
+ * value: Double (duration in seconds)
+ */
+ String ATTR_DURATION = "time"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_MESSAGE = "message"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_DISPLAY_NAME = "displayname"; //$NON-NLS-1$
+ /**
+ * value: Boolean
+ */
+ String ATTR_DYNAMIC_TEST = "dynamicTest"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_DATA = "data"; //$NON-NLS-1$
+
+ /**
+ * value: String
+ */
+ String ATTR_INCLUDE_TAGS = "include_tags"; //$NON-NLS-1$
+ /**
+ * value: String
+ */
+ String ATTR_EXCLUDE_TAGS = "exclude_tags"; //$NON-NLS-1$
+
+// public static final String ATTR_TYPE= "type"; //$NON-NLS-1$
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunHandler.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunHandler.java
new file mode 100644
index 000000000..29a49c38f
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunHandler.java
@@ -0,0 +1,365 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.junitXmlReport;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Stack;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.model.ModelMessages;
+import org.eclipse.unittest.internal.model.TestCaseElement;
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.model.TestSuiteElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+import org.eclipse.unittest.model.ITestElement.Result;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+public class TestRunHandler extends DefaultHandler {
+
+ /*
+ * TODO: validate (currently assumes correct XML)
+ */
+
+ private int fId;
+
+ private TestRunSession fTestRunSession;
+ private TestSuiteElement fTestSuite;
+ private TestCaseElement fTestCase;
+ private Stack<Boolean> fNotRun = new Stack<>();
+
+ private StringBuilder fFailureBuffer;
+ private boolean fInExpected;
+ private boolean fInActual;
+ private StringBuilder fExpectedBuffer;
+ private StringBuilder fActualBuffer;
+
+ private Locator fLocator;
+
+ private Result fStatus;
+
+ private final IProgressMonitor fMonitor;
+ private int fLastReportedLine;
+
+ /**
+ * Constructs a default {@link TestRunHandler} object instance
+ */
+ public TestRunHandler() {
+ fMonitor = new NullProgressMonitor();
+ }
+
+ /**
+ * Constructs a {@link TestRunHandler} object instance
+ *
+ * @param monitor a progress monitor
+ */
+ public TestRunHandler(IProgressMonitor monitor) {
+ fMonitor = monitor != null ? monitor : new NullProgressMonitor();
+ }
+
+ @Override
+ public void setDocumentLocator(Locator locator) {
+ fLocator = locator;
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ // Nothing to do
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ if (fMonitor.isCanceled())
+ throw new OperationCanceledException();
+
+ if (fLocator != null) {
+ int line = fLocator.getLineNumber();
+ if (line - 20 >= fLastReportedLine) {
+ line -= line % 20;
+ fLastReportedLine = line;
+ fMonitor.subTask(NLS.bind(ModelMessages.TestRunHandler_lines_read, Integer.valueOf(line)));
+ }
+ }
+
+ if (Thread.interrupted())
+ throw new OperationCanceledException();
+
+ switch (qName) {
+ case IXMLTags.NODE_TESTRUN:
+ if (fTestRunSession == null) {
+ String name = attributes.getValue(IXMLTags.ATTR_NAME);
+ String launchConfigName = attributes.getValue(IXMLTags.ATTR_LAUNCH_CONFIG_NAME);
+ ILaunchConfiguration launchConfiguration = null;
+ if (launchConfigName != null) {
+ try {
+ for (ILaunchConfiguration config : DebugPlugin.getDefault().getLaunchManager()
+ .getLaunchConfigurations()) {
+ if (config.getName().equals(launchConfigName)) {
+ launchConfiguration = config;
+ }
+ }
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+ fTestRunSession = new TestRunSession(name, Instant.parse(attributes.getValue(IXMLTags.ATTR_START_TIME)),
+ launchConfiguration);
+ readDuration(fTestRunSession, attributes);
+ // TODO: read counts?
+ } else {
+ fTestRunSession.reset();
+ }
+ fTestSuite = fTestRunSession;
+ break;
+ case IXMLTags.NODE_TESTSUITES:
+ break;
+ case IXMLTags.NODE_TESTSUITE: {
+ String name = attributes.getValue(IXMLTags.ATTR_NAME);
+ String pack = attributes.getValue(IXMLTags.ATTR_PACKAGE);
+ String suiteName = pack == null ? name : pack + "." + name; //$NON-NLS-1$
+ String displayName = attributes.getValue(IXMLTags.ATTR_DISPLAY_NAME);
+ String data = attributes.getValue(IXMLTags.ATTR_DATA);
+ if (data != null && data.isBlank()) {
+ data = null;
+ }
+ fTestSuite = (TestSuiteElement) fTestRunSession.createTestElement(fTestSuite, getNextId(), suiteName, true,
+ null, false, displayName, data);
+ readDuration(fTestSuite, attributes);
+ fNotRun.push(Boolean.valueOf(attributes.getValue(IXMLTags.ATTR_INCOMPLETE)));
+ break;
+ }
+ // not interested
+ case IXMLTags.NODE_PROPERTIES:
+ case IXMLTags.NODE_PROPERTY:
+ break;
+ case IXMLTags.NODE_TESTCASE: {
+ String name = attributes.getValue(IXMLTags.ATTR_NAME);
+ String classname = attributes.getValue(IXMLTags.ATTR_CLASSNAME);
+ String testName = name + '(' + classname + ')';
+ boolean isDynamicTest = Boolean.valueOf(attributes.getValue(IXMLTags.ATTR_DYNAMIC_TEST)).booleanValue();
+ String displayName = attributes.getValue(IXMLTags.ATTR_DISPLAY_NAME);
+ String data = attributes.getValue(IXMLTags.ATTR_DATA);
+ if (data != null && data.isBlank()) {
+ data = null;
+ }
+ fTestCase = (TestCaseElement) fTestRunSession.createTestElement(fTestSuite, getNextId(), testName, false, 1,
+ isDynamicTest, displayName, data);
+ fNotRun.push(Boolean.valueOf(attributes.getValue(IXMLTags.ATTR_INCOMPLETE)));
+ fTestCase.setIgnored(Boolean.parseBoolean(attributes.getValue(IXMLTags.ATTR_IGNORED)));
+ readDuration(fTestCase, attributes);
+ break;
+ }
+ case IXMLTags.NODE_ERROR:
+ // TODO: multiple failures: https://bugs.eclipse.org/bugs/show_bug.cgi?id=125296
+ fStatus = Result.ERROR;
+ fFailureBuffer = new StringBuilder();
+ break;
+ case IXMLTags.NODE_FAILURE:
+ // TODO: multiple failures: https://bugs.eclipse.org/bugs/show_bug.cgi?id=125296
+ fStatus = Result.FAILURE;
+ fFailureBuffer = new StringBuilder();
+ break;
+ case IXMLTags.NODE_EXPECTED:
+ fInExpected = true;
+ fExpectedBuffer = new StringBuilder();
+ break;
+ case IXMLTags.NODE_ACTUAL:
+ fInActual = true;
+ fActualBuffer = new StringBuilder();
+ break;
+ // not interested
+ case IXMLTags.NODE_SYSTEM_OUT:
+ case IXMLTags.NODE_SYSTEM_ERR:
+ break;
+ case IXMLTags.NODE_SKIPPED:
+ // before Ant 1.9.0: not an Ant JUnit tag, see
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=276068
+ // later: child of <suite> or <test>, see
+ // https://issues.apache.org/bugzilla/show_bug.cgi?id=43969
+ fStatus = Result.OK;
+ fFailureBuffer = new StringBuilder();
+ String message = attributes.getValue(IXMLTags.ATTR_MESSAGE);
+ if (message != null) {
+ fFailureBuffer.append(message).append('\n');
+ }
+ break;
+ default:
+ throw new SAXParseException("unknown node '" + qName + "'", fLocator); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+
+ private void readDuration(ITestElement testElement, Attributes attributes) {
+ if (testElement instanceof TestElement) {
+ TestElement element = (TestElement) testElement;
+ String timeString = attributes.getValue(IXMLTags.ATTR_DURATION);
+ if (timeString != null) {
+ try {
+ double seconds = Double.parseDouble(timeString);
+ long millis = (long) (seconds * 1000);
+ element.setDuration(Duration.ofMillis(millis));
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+ }
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ if (fInExpected) {
+ fExpectedBuffer.append(ch, start, length);
+
+ } else if (fInActual) {
+ fActualBuffer.append(ch, start, length);
+
+ } else if (fFailureBuffer != null) {
+ fFailureBuffer.append(ch, start, length);
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ switch (qName) {
+ // OK
+ case IXMLTags.NODE_TESTRUN:
+ break;
+ // OK
+ case IXMLTags.NODE_TESTSUITES:
+ break;
+ case IXMLTags.NODE_TESTSUITE:
+ handleTestElementEnd(fTestSuite);
+ fTestSuite = fTestSuite.getParent();
+ // TODO: end suite: compare counters?
+ break;
+ // OK
+ case IXMLTags.NODE_PROPERTIES:
+ case IXMLTags.NODE_PROPERTY:
+ break;
+ case IXMLTags.NODE_TESTCASE:
+ handleTestElementEnd(fTestCase);
+ fTestCase = null;
+ break;
+ case IXMLTags.NODE_FAILURE:
+ case IXMLTags.NODE_ERROR: {
+ ITestElement testElement = fTestCase;
+ if (testElement == null)
+ testElement = fTestSuite;
+ handleFailure(testElement);
+ break;
+ }
+ case IXMLTags.NODE_EXPECTED:
+ fInExpected = false;
+ if (fFailureBuffer != null) {
+ // skip whitespace from before <expected> and <actual> nodes
+ fFailureBuffer.setLength(0);
+ }
+ break;
+ case IXMLTags.NODE_ACTUAL:
+ fInActual = false;
+ if (fFailureBuffer != null) {
+ // skip whitespace from before <expected> and <actual> nodes
+ fFailureBuffer.setLength(0);
+ }
+ break;
+ // OK
+ case IXMLTags.NODE_SYSTEM_OUT:
+ case IXMLTags.NODE_SYSTEM_ERR:
+ break;
+ case IXMLTags.NODE_SKIPPED: {
+ TestElement testElement = fTestCase;
+ if (testElement == null)
+ testElement = fTestSuite;
+ if (fFailureBuffer != null && fFailureBuffer.length() > 0) {
+ handleFailure(testElement);
+ testElement.setAssumptionFailed(true);
+ } else if (fTestCase != null) {
+ fTestCase.setIgnored(true);
+ } else { // not expected
+ testElement.setAssumptionFailed(true);
+ }
+ break;
+ }
+ default:
+ handleUnknownNode(qName);
+ break;
+ }
+ }
+
+ private void handleTestElementEnd(ITestElement testElement) {
+ boolean completed = !fNotRun.pop().booleanValue();
+ fTestRunSession.registerTestEnded((TestElement) testElement, completed);
+ }
+
+ private void handleFailure(ITestElement testElement) {
+ if (fFailureBuffer != null) {
+ fTestRunSession.registerTestFailureStatus((TestElement) testElement, fStatus,
+ new FailureTrace(fFailureBuffer.toString(), toString(fExpectedBuffer), toString(fActualBuffer)));
+ fFailureBuffer = null;
+ fExpectedBuffer = null;
+ fActualBuffer = null;
+ fStatus = null;
+ }
+ }
+
+ private String toString(StringBuilder buffer) {
+ return buffer != null ? buffer.toString() : null;
+ }
+
+ private void handleUnknownNode(String qName) throws SAXException {
+ // TODO: just log if debug option is enabled?
+ String msg = "unknown node '" + qName + "'"; //$NON-NLS-1$//$NON-NLS-2$
+ if (fLocator != null) {
+ msg += " at line " + fLocator.getLineNumber() + ", column " + fLocator.getColumnNumber(); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ throw new SAXException(msg);
+ }
+
+ @Override
+ public void error(SAXParseException e) throws SAXException {
+ throw e;
+ }
+
+ @Override
+ public void warning(SAXParseException e) throws SAXException {
+ throw e;
+ }
+
+ private String getNextId() {
+ return Integer.toString(fId++);
+ }
+
+ /**
+ * @return the parsed test run session, or <code>null</code>
+ */
+ public TestRunSession getTestRunSession() {
+ return fTestRunSession;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunSessionSerializer.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunSessionSerializer.java
new file mode 100644
index 000000000..c5c6d3c85
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/junitXmlReport/TestRunSessionSerializer.java
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.junitXmlReport;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.time.Instant;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.AttributesImpl;
+
+import org.eclipse.unittest.internal.model.ProgressState;
+import org.eclipse.unittest.internal.model.TestCaseElement;
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.model.TestSuiteElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+import org.eclipse.unittest.model.ITestElement.Result;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * A {@link TestRunSession} object serializer
+ */
+public class TestRunSessionSerializer implements XMLReader {
+
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String CDATA = "CDATA"; //$NON-NLS-1$
+ private static final Attributes NO_ATTS = new AttributesImpl();
+
+ private final TestRunSession fTestRunSession;
+ private ContentHandler fHandler;
+ private ErrorHandler fErrorHandler;
+
+ /**
+ * @param testRunSession the test run session to serialize
+ */
+ public TestRunSessionSerializer(TestRunSession testRunSession) {
+ Assert.isNotNull(testRunSession);
+ fTestRunSession = testRunSession;
+ }
+
+ @Override
+ public void parse(InputSource input) throws IOException, SAXException {
+ if (fHandler == null)
+ throw new SAXException("ContentHandler missing"); //$NON-NLS-1$
+
+ fHandler.startDocument();
+ handleTestRun();
+ fHandler.endDocument();
+ }
+
+ private void handleTestRun() throws SAXException {
+ AttributesImpl atts = new AttributesImpl();
+ addCDATA(atts, IXMLTags.ATTR_NAME, fTestRunSession.getTestRunName());
+
+ ILaunchConfiguration launchConfig = fTestRunSession.getLaunch() != null
+ ? fTestRunSession.getLaunch().getLaunchConfiguration()
+ : null;
+ if (launchConfig != null) {
+ addCDATA(atts, IXMLTags.ATTR_LAUNCH_CONFIG_NAME, launchConfig.getName());
+ }
+
+ Integer total = fTestRunSession.getFinalTestCaseCount();
+ if (total != null) {
+ addCDATA(atts, IXMLTags.ATTR_TESTS, total.intValue());
+ }
+ addCDATA(atts, IXMLTags.ATTR_STARTED, fTestRunSession.countStartedTestCases());
+ addCDATA(atts, IXMLTags.ATTR_FAILURES, fTestRunSession.getCurrentFailureCount());
+ addCDATA(atts, IXMLTags.ATTR_ERRORS, fTestRunSession.getCurrentErrorCount());
+ addCDATA(atts, IXMLTags.ATTR_IGNORED, fTestRunSession.getCurrentIgnoredCount());
+ Instant startTime = fTestRunSession.getStartTime();
+ if (startTime != null) {
+ addCDATA(atts, IXMLTags.ATTR_START_TIME, startTime.toString());
+ }
+ Duration duration = fTestRunSession.getDuration();
+ if (duration != null) {
+ addCDATA(atts, IXMLTags.ATTR_DURATION, duration.toString());
+ }
+ startElement(IXMLTags.NODE_TESTRUN, atts);
+
+ for (ITestElement topSuite : fTestRunSession.getChildren()) {
+ handleTestElement(topSuite);
+ }
+
+ endElement(IXMLTags.NODE_TESTRUN);
+ }
+
+ private void handleTestElement(ITestElement testElement) throws SAXException {
+ if (testElement instanceof TestSuiteElement) {
+ TestSuiteElement testSuiteElement = (TestSuiteElement) testElement;
+
+ AttributesImpl atts = new AttributesImpl();
+ // Need to store the full #getTestName instead of only the #getSuiteTypeName for
+ // test factory methods
+ addCDATA(atts, IXMLTags.ATTR_NAME, testSuiteElement.getTestName());
+ if (testSuiteElement.getDuration() != null) {
+ addCDATA(atts, IXMLTags.ATTR_DURATION,
+ Double.toString(testSuiteElement.getDuration().toMillis() / 1000.));
+ }
+ if (testSuiteElement.getProgressState() != ProgressState.COMPLETED
+ || testSuiteElement.getTestResult(false) != Result.UNDEFINED)
+ addCDATA(atts, IXMLTags.ATTR_INCOMPLETE, Boolean.TRUE.toString());
+ if (testSuiteElement.getDisplayName() != null) {
+ addCDATA(atts, IXMLTags.ATTR_DISPLAY_NAME, testSuiteElement.getDisplayName());
+ }
+ if (testSuiteElement.getData() != null) {
+ addCDATA(atts, IXMLTags.ATTR_DATA, testSuiteElement.getData());
+ }
+ startElement(IXMLTags.NODE_TESTSUITE, atts);
+ addFailure(testSuiteElement);
+
+ for (ITestElement child : testSuiteElement.getChildren()) {
+ handleTestElement(child);
+ }
+ endElement(IXMLTags.NODE_TESTSUITE);
+
+ } else if (testElement instanceof TestCaseElement) {
+ TestCaseElement testCaseElement = (TestCaseElement) testElement;
+
+ AttributesImpl atts = new AttributesImpl();
+ if (testCaseElement.getDuration() != null) {
+ addCDATA(atts, IXMLTags.ATTR_DURATION, testCaseElement.getDuration().toString());
+ }
+ if (testCaseElement.getProgressState() != ProgressState.COMPLETED)
+ addCDATA(atts, IXMLTags.ATTR_INCOMPLETE, Boolean.TRUE.toString());
+ if (testCaseElement.isIgnored())
+ addCDATA(atts, IXMLTags.ATTR_IGNORED, Boolean.TRUE.toString());
+ if (testCaseElement.isDynamicTest()) {
+ addCDATA(atts, IXMLTags.ATTR_DYNAMIC_TEST, Boolean.TRUE.toString());
+ }
+ if (testCaseElement.getDisplayName() != null) {
+ addCDATA(atts, IXMLTags.ATTR_DISPLAY_NAME, testCaseElement.getDisplayName());
+ }
+ if (testCaseElement.getData() != null) {
+ addCDATA(atts, IXMLTags.ATTR_DATA, testCaseElement.getData());
+ }
+ startElement(IXMLTags.NODE_TESTCASE, atts);
+ addFailure(testCaseElement);
+
+ endElement(IXMLTags.NODE_TESTCASE);
+
+ } else {
+ throw new IllegalStateException(String.valueOf(testElement));
+ }
+
+ }
+
+ private void addFailure(TestElement testElement) throws SAXException {
+ FailureTrace failureTrace = testElement.getFailureTrace();
+
+ if (testElement.isAssumptionFailure()) {
+ startElement(IXMLTags.NODE_SKIPPED, NO_ATTS);
+ if (failureTrace != null) {
+ addCharacters(failureTrace.getTrace());
+ }
+ endElement(IXMLTags.NODE_SKIPPED);
+
+ } else if (failureTrace != null) {
+ AttributesImpl failureAtts = new AttributesImpl();
+// addCDATA(failureAtts, IXMLTags.ATTR_MESSAGE, xx);
+// addCDATA(failureAtts, IXMLTags.ATTR_TYPE, xx);
+ String failureKind = testElement.getTestResult(false) == Result.ERROR ? IXMLTags.NODE_ERROR
+ : IXMLTags.NODE_FAILURE;
+ startElement(failureKind, failureAtts);
+ String expected = failureTrace.getExpected();
+ String actual = failureTrace.getActual();
+ if (expected != null) {
+ startElement(IXMLTags.NODE_EXPECTED, NO_ATTS);
+ addCharacters(expected);
+ endElement(IXMLTags.NODE_EXPECTED);
+ }
+ if (actual != null) {
+ startElement(IXMLTags.NODE_ACTUAL, NO_ATTS);
+ addCharacters(actual);
+ endElement(IXMLTags.NODE_ACTUAL);
+ }
+ String trace = failureTrace.getTrace();
+ addCharacters(trace);
+ endElement(failureKind);
+ }
+ }
+
+ private void startElement(String name, Attributes atts) throws SAXException {
+ fHandler.startElement(EMPTY, name, name, atts);
+ }
+
+ private void endElement(String name) throws SAXException {
+ fHandler.endElement(EMPTY, name, name);
+ }
+
+ private static void addCDATA(AttributesImpl atts, String name, int value) {
+ addCDATA(atts, name, Integer.toString(value));
+ }
+
+ private static void addCDATA(AttributesImpl atts, String name, String value) {
+ atts.addAttribute(EMPTY, EMPTY, name, CDATA, value);
+ }
+
+ private void addCharacters(String string) throws SAXException {
+ string = escapeNonUnicodeChars(string);
+ fHandler.characters(string.toCharArray(), 0, string.length());
+ }
+
+ /**
+ * Replaces all non-Unicode characters in the given string.
+ *
+ * @param string a string
+ * @return string with Java-escapes
+ */
+ private static String escapeNonUnicodeChars(String string) {
+ StringBuilder buf = null;
+ for (int i = 0; i < string.length(); i++) {
+ char ch = string.charAt(i);
+ if (!(ch == 9 || ch == 10 || ch == 13 || ch >= 32)) {
+ if (buf == null) {
+ buf = new StringBuilder(string.substring(0, i));
+ }
+ buf.append("\\u"); //$NON-NLS-1$
+ String hex = Integer.toHexString(ch);
+ for (int j = hex.length(); j < 4; j++)
+ buf.append('0');
+ buf.append(hex);
+ } else if (buf != null) {
+ buf.append(ch);
+ }
+ }
+ if (buf != null) {
+ return buf.toString();
+ }
+ return string;
+ }
+
+ @Override
+ public void setContentHandler(ContentHandler handler) {
+ this.fHandler = handler;
+ }
+
+ @Override
+ public ContentHandler getContentHandler() {
+ return fHandler;
+ }
+
+ @Override
+ public void setErrorHandler(ErrorHandler handler) {
+ fErrorHandler = handler;
+ }
+
+ @Override
+ public ErrorHandler getErrorHandler() {
+ return fErrorHandler;
+ }
+
+ // ignored:
+
+ @Override
+ public void parse(String systemId) throws IOException, SAXException {
+ // Nothing to do
+ }
+
+ @Override
+ public void setDTDHandler(DTDHandler handler) {
+ // Nothing to do
+ }
+
+ @Override
+ public DTDHandler getDTDHandler() {
+ return null;
+ }
+
+ @Override
+ public void setEntityResolver(EntityResolver resolver) {
+ // Nothing to do
+ }
+
+ @Override
+ public EntityResolver getEntityResolver() {
+ return null;
+ }
+
+ @Override
+ public void setProperty(java.lang.String name, java.lang.Object value) {
+ // Nothing to do
+ }
+
+ @Override
+ public Object getProperty(java.lang.String name) {
+ return null;
+ }
+
+ @Override
+ public void setFeature(java.lang.String name, boolean value) {
+ // Nothing to do
+ }
+
+ @Override
+ public boolean getFeature(java.lang.String name) {
+ return false;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestListenerRegistry.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestListenerRegistry.java
new file mode 100644
index 000000000..a6ed3eaf9
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestListenerRegistry.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.launcher;
+
+import org.eclipse.unittest.internal.ui.UITestRunListener;
+
+import org.eclipse.core.runtime.ListenerList;
+
+/**
+ * Test View Support registry
+ */
+public class TestListenerRegistry {
+
+ /**
+ * Returns a {@link TestListenerRegistry} object instance
+ *
+ * @return a {@link TestListenerRegistry} object
+ */
+ public static TestListenerRegistry getDefault() {
+ if (fgRegistry != null)
+ return fgRegistry;
+
+ fgRegistry = new TestListenerRegistry();
+ return fgRegistry;
+ }
+
+ private static TestListenerRegistry fgRegistry;
+
+ /**
+ * List storing the registered test run listeners
+ */
+ private ListenerList<TestRunListener> fUnitTestRunListeners = new ListenerList<>();
+
+ private TestListenerRegistry() {
+ }
+
+ /**
+ * @return a <code>ListenerList</code> of all <code>TestRunListener</code>s
+ */
+ public ListenerList<TestRunListener> getUnitTestRunListeners() {
+ loadUnitTestRunListeners();
+ return fUnitTestRunListeners;
+ }
+
+ /**
+ * Initializes TestRun Listener extensions
+ */
+ private synchronized void loadUnitTestRunListeners() {
+ if (!fUnitTestRunListeners.isEmpty()) {
+ return;
+ }
+ fUnitTestRunListeners.add(new UITestRunListener());
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestRunListener.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestRunListener.java
new file mode 100644
index 000000000..0150734cd
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestRunListener.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.launcher;
+
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestRunSession;
+
+/**
+ * A test run listener default implementation.
+ *
+ * <p>
+ * A test run starts with the call to {@link #sessionLaunched(ITestRunSession)}
+ * and {@link #sessionStarted(ITestRunSession)}, followed by calls to
+ * {@link #testCaseStarted(ITestCaseElement)} and
+ * {@link #testCaseFinished(ITestCaseElement)} for all test cases contained in
+ * the tree.
+ * </p>
+ * <p>
+ * A test run session is ended with the call to
+ * {@link #sessionFinished(ITestRunSession)}. After that call, no references
+ * must be kept to the session or any of the test cases or suites.
+ * </p>
+ */
+public class TestRunListener {
+
+ /**
+ * A test run session has been launched. The test tree is not available yet.
+ * <p>
+ * Important: The implementor of this method must not keep a reference to the
+ * session element after {@link #sessionFinished(ITestRunSession)} has finished.
+ * </p>
+ *
+ * @param session the session that has just been launched
+ */
+ public void sessionLaunched(ITestRunSession session) {
+ // does nothing
+ }
+
+ /**
+ * A test run session has started. The test tree can be accessed through the
+ * session element.
+ * <p>
+ * Important: The implementor of this method must not keep a reference to the
+ * session element after {@link #sessionFinished(ITestRunSession)} has finished.
+ * </p>
+ *
+ * @param session the session that has just started.
+ */
+ public void sessionStarted(ITestRunSession session) {
+ // does nothing
+ }
+
+ /**
+ * A test run session has finished. The test tree can be accessed through the
+ * session element.
+ *
+ * <p>
+ * Important: The implementor of this method must not keep the session element
+ * when the method is finished.
+ * </p>
+ *
+ * @param session the test
+ */
+ public void sessionFinished(ITestRunSession session) {
+ // does nothing
+ }
+
+ /**
+ * A test case has started. The result can be accessed from the element.
+ * <p>
+ * Important: The implementor of this method must not keep a reference to the
+ * test case element after {@link #sessionFinished(ITestRunSession)} has
+ * finished.
+ * </p>
+ *
+ * @param testCaseElement the test that has started to run
+ */
+ public void testCaseStarted(ITestCaseElement testCaseElement) {
+ // does nothing
+ }
+
+ /**
+ * A test case has ended. The result can be accessed from the element.
+ * <p>
+ * Important: The implementor of this method must not keep a reference to the
+ * test case element after {@link #sessionFinished(ITestRunSession)} has
+ * finished.
+ * </p>
+ *
+ * @param testCaseElement the test that has finished running
+ */
+ public void testCaseFinished(ITestCaseElement testCaseElement) {
+ // does nothing
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportExtension.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportExtension.java
new file mode 100644
index 000000000..7e61cfba3
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportExtension.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Victor Rubezhny, Mickael Istria (Red Hat Inc.) - Adaptation from JUnit
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.launcher;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.model.ModelMessages;
+import org.eclipse.unittest.ui.ITestViewSupport;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A {@link TestViewSupportExtension} implementation
+ */
+public class TestViewSupportExtension {
+
+ private static final String ID = "id"; //$NON-NLS-1$
+ private static final String CLASS = "class"; //$NON-NLS-1$
+
+ private final IConfigurationElement fElement;
+
+ /**
+ * Constructs a {@link TestViewSupportExtension} object
+ *
+ * @param element an {@link IConfigurationElement} object
+ */
+ public TestViewSupportExtension(IConfigurationElement element) {
+ fElement = element;
+ }
+
+ /**
+ * Returns an identifier of the test view support extension
+ *
+ * @return A test view support identifier
+ */
+ public String getId() {
+ return getAttribute(ID);
+ }
+
+ /**
+ * Returns an attribute by a given name
+ *
+ * @param attributeName an attribute name
+ *
+ * @return a value of an attribute
+ */
+ protected String getAttribute(String attributeName) {
+ return fElement.getAttribute(attributeName);
+ }
+
+ /**
+ * Instantiates an {@link ITestViewSupport} object
+ *
+ * @return an instance of {@link ITestViewSupport} for the given extension.
+ * <code>null</code> if class couldn't be loaded.
+ * @throws CoreException In case of error during the Test View Support
+ * instantiation
+ */
+ ITestViewSupport instantiateTestViewSupport() throws CoreException {
+ try {
+ return (ITestViewSupport) fElement.createExecutableExtension(CLASS);
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, UnitTestPlugin.PLUGIN_ID,
+ ModelMessages.UnitTestModel_could_not_instantiate_support, e));
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getId();
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportRegistry.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportRegistry.java
new file mode 100644
index 000000000..c8d2f8bd0
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/TestViewSupportRegistry.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.launcher;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.ui.ITestViewSupport;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * Test View Support registry
+ */
+public class TestViewSupportRegistry {
+ /**
+ * An identifier of Test View Support extension point
+ */
+ public static final String ID_EXTENSION_POINT_TEST_VIEW_SUPPORTS = UnitTestPlugin.PLUGIN_ID + "." //$NON-NLS-1$
+ + "unittestViewSupport"; //$NON-NLS-1$
+
+ /**
+ * Returns an instance of {@link TestViewSupportRegistry} object
+ *
+ * @return a {@link TestViewSupportRegistry} object
+ */
+ public static TestViewSupportRegistry getDefault() {
+ if (fgRegistry != null)
+ return fgRegistry;
+
+ fgRegistry = new TestViewSupportRegistry(
+ Platform.getExtensionRegistry().getExtensionPoint(ID_EXTENSION_POINT_TEST_VIEW_SUPPORTS));
+ return fgRegistry;
+ }
+
+ private static TestViewSupportRegistry fgRegistry;
+
+ private final IExtensionPoint fPoint;
+ private List<TestViewSupportExtension> fTestViewSupportExtensions;
+
+ private TestViewSupportRegistry(IExtensionPoint point) {
+ fPoint = point;
+ }
+
+ /**
+ * Returns all the registered View Support extensions
+ *
+ * @return a {@link List} containing all the registered View Support extensions
+ */
+ private List<TestViewSupportExtension> getAllTestViewSupportExtensions() {
+ loadTestViewSupportExtensions();
+ return fTestViewSupportExtensions;
+ }
+
+ /**
+ * Returns all the registered View Support extensions that suit the specified
+ * filter
+ *
+ * @param filter a registry identifier filter
+ * @return an {@link ArrayList} containing the registry kings filtered by
+ * identifier
+ */
+ public List<TestViewSupportExtension> getTestViewSupportExtensions(final String filter) {
+ List<TestViewSupportExtension> all = getAllTestViewSupportExtensions();
+ if (all == null)
+ return Collections.emptyList();
+
+ return all.stream().filter(p -> p.getId().startsWith(filter)).collect(Collectors.toList());
+ }
+
+ private void loadTestViewSupportExtensions() {
+ if (fTestViewSupportExtensions != null)
+ return;
+
+ List<TestViewSupportExtension> items = getConfigurationElements().stream().map(TestViewSupportExtension::new)
+ .collect(Collectors.toList());
+
+ fTestViewSupportExtensions = items;
+ }
+
+ /*
+ * Returns an {@link Optional <ITestViewSupport>} object instance by its
+ * identifier
+ *
+ * @param id an identifier, can be <code>null</code>
+ *
+ * @return an {@link Optional <ITestViewSupport>} object instance
+ */
+ private Optional<ITestViewSupport> findTestViewSupport(String id) {
+ return getAllTestViewSupportExtensions().stream().filter(ext -> ext.getId().equals(id)).findFirst().map(t -> {
+ try {
+ return t.instantiateTestViewSupport();
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Returns {@link ITestViewSupport} instance from the given launch configuration
+ *
+ * @param launchConfiguration a launch configuration
+ * @return an {@link Optional <ITestViewSupport>} object instance
+ */
+ public static Optional<ITestViewSupport> newTestRunnerViewSupport(ILaunchConfiguration launchConfiguration) {
+ try {
+ return getDefault().findTestViewSupport(launchConfiguration
+ .getAttribute(UnitTestLaunchConfigurationConstants.ATTR_UNIT_TEST_VIEW_SUPPORT, (String) null));
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ return Optional.empty();
+ }
+ }
+
+ private List<IConfigurationElement> getConfigurationElements() {
+ List<IConfigurationElement> items = new ArrayList<>();
+ for (IExtension extension : fPoint.getExtensions()) {
+ Collections.addAll(items, extension.getConfigurationElements());
+ }
+ return items;
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/UnitTestLaunchConfigurationConstants.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/UnitTestLaunchConfigurationConstants.java
new file mode 100644
index 000000000..6431887d5
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/launcher/UnitTestLaunchConfigurationConstants.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.launcher;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.ui.ITestViewSupport;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * Attribute keys used by the UnitTest LaunchConfiguration. Note that these
+ * constants are not API and might change in the future.
+ */
+public class UnitTestLaunchConfigurationConstants {
+
+ /**
+ * An identifier of a property to be set on a {@link ILaunchConfiguration} to
+ * identify an {@link ITestViewSupport} implementation.
+ */
+ public static final String ATTR_UNIT_TEST_VIEW_SUPPORT = UnitTestPlugin.PLUGIN_ID + ".TEST_VIEW_SUPPPORT"; //$NON-NLS-1$
+
+ private UnitTestLaunchConfigurationConstants() {
+ // No instance allowed
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionListener.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionListener.java
new file mode 100644
index 000000000..d647ec149
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionListener.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.model;
+
+import org.eclipse.unittest.model.ITestRunSession;
+
+/**
+ * An interface to listen to the events from the on added/removed
+ * {@link ITestRunSession} instances.
+ */
+public interface ITestRunSessionListener {
+ /**
+ * Notifies on an added {@link ITestRunSession} instance.
+ *
+ * @param testRunSession the new session
+ */
+ void sessionAdded(ITestRunSession testRunSession);
+
+ /**
+ * Notifies on a removed {@link ITestRunSession} instance.
+ *
+ * @param testRunSession the new session
+ */
+ void sessionRemoved(ITestRunSession testRunSession);
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionReport.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionReport.java
new file mode 100644
index 000000000..acb0ac094
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestRunSessionReport.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc. and others
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+/**
+ * An {@link ITestRunSessionReport} object
+ */
+public interface ITestRunSessionReport {
+
+ /**
+ * Returns the name of the test run. The name is the name of the launch
+ * configuration use to run this test.
+ *
+ * @return returns the test run name
+ */
+ String getTestRunName();
+
+ /**
+ * Indicates if the test run session is starting
+ *
+ * @return <code>true</code> in case of the test session is starting, otherwise
+ * returns <code>false</code>
+ */
+ boolean isStarting();
+
+ /**
+ * Indicates if the test run session is running
+ *
+ * @return <code>true</code> in case of the test session is running, otherwise
+ * returns <code>false</code>
+ */
+ boolean isRunning();
+
+ /**
+ * Indicates if the test run session has been stopped or terminated
+ *
+ * @return <code>true</code> if the session has been stopped or terminated,
+ * otherwise returns <code>false</code>
+ */
+ boolean isStopped();
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestSessionListener.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestSessionListener.java
new file mode 100644
index 000000000..ed35d4ff4
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ITestSessionListener.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.model;
+
+import java.time.Duration;
+
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+import org.eclipse.unittest.model.ITestElement.Result;
+
+/**
+ * A listener interface for observing the execution of a test session (initial
+ * run and reruns).
+ */
+public interface ITestSessionListener {
+ /**
+ * A test run has started.
+ */
+ void sessionStarted();
+
+ /**
+ * A test run has ended.
+ *
+ * @param duration the total elapsed time of the test run
+ */
+ void sessionCompleted(Duration duration);
+
+ /**
+ * A test run has been stopped prematurely.
+ *
+ * @param duration the time elapsed before the test run was stopped
+ */
+ void sessionAborted(Duration duration);
+
+ /**
+ * A test has been added to the plan.
+ *
+ * @param testElement the test
+ */
+ void testAdded(ITestElement testElement);
+
+ /**
+ * All test have been added and running begins
+ */
+ void runningBegins();
+
+ /**
+ * An individual test has started.
+ *
+ * @param testCaseElement the test
+ */
+ void testStarted(ITestCaseElement testCaseElement);
+
+ /**
+ * An individual test has ended.
+ *
+ * @param testCaseElement the test
+ */
+ void testEnded(ITestCaseElement testCaseElement);
+
+ /**
+ * An individual test has failed with a stack trace.
+ *
+ * @param testElement the test
+ * @param status the outcome of the test; one of
+ * {@link org.eclipse.unittest.model.ITestElement.Result#ERROR}
+ * or
+ * {@link org.eclipse.unittest.model.ITestElement.Result#FAILURE}
+ * @param trace the stack trace
+ */
+ void testFailed(ITestElement testElement, Result status, FailureTrace trace);
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.java
new file mode 100644
index 000000000..f2ddf946d
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.model;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Unit Test Model messages
+ */
+public class ModelMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.unittest.internal.model.ModelMessages"; //$NON-NLS-1$
+
+ public static String UnitTestModel_could_not_instantiate_support;
+ public static String UnitTestModel_could_not_import;
+ public static String UnitTestModel_could_not_export;
+ public static String UnitTestModel_could_not_read;
+ public static String UnitTestModel_could_not_write;
+ public static String UnitTestModel_importing_from_url;
+ public static String TestRunHandler_lines_read;
+
+ public static String TestingSession_finished_status;
+ public static String TestingSession_name_format;
+ public static String TestingSession_starting_status;
+ public static String TestingSession_stopped_status;
+
+ public static String TestRunSession_unrootedTests;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, ModelMessages.class);
+ }
+
+ private ModelMessages() {
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.properties b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.properties
new file mode 100644
index 000000000..521f0eff3
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ModelMessages.properties
@@ -0,0 +1,31 @@
+###############################################################################
+# Copyright (c) 2009, 2010 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+# From JUnit Model
+UnitTestModel_could_not_instantiate_support=A Test View Support instance couldn't be instantiated.
+UnitTestModel_could_not_export=Test run could not be exported.
+UnitTestModel_could_not_import=Test run could not be imported.
+UnitTestModel_could_not_write=The test run could not be written to file ''{0}''.
+UnitTestModel_could_not_read=The test run could not be imported from file ''{0}''.
+UnitTestModel_importing_from_url=Importing from URL...
+TestRunHandler_lines_read={0} lines read
+
+# From CDT Model
+TestingSession_name_format={0} ({1})
+TestingSession_finished_status=Finished after {0} seconds
+TestingSession_starting_status=Starting...
+TestingSession_stopped_status=Testing was stopped by user
+
+TestRunSession_unrootedTests=Unrooted Tests
+
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ProgressState.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ProgressState.java
new file mode 100644
index 000000000..051d18526
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/ProgressState.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+/**
+ * Running states of a test.
+ */
+public enum ProgressState {
+ /** state that describes that the test element has not started */
+ NOT_STARTED("Not Started"), //$NON-NLS-1$
+ /** state that describes that the test element is running */
+ RUNNING("Running"), //$NON-NLS-1$
+ /**
+ * state that describes that the test element has been stopped before being
+ * completed
+ */
+ ABORTED("Aborted"), //$NON-NLS-1$
+ /** state that describes that the test element has completed */
+ COMPLETED("Completed"); //$NON-NLS-1$
+
+ private String fName;
+
+ private ProgressState(String name) {
+ fName = name;
+ }
+
+ @Override
+ public String toString() {
+ return fName;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/Status.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/Status.java
new file mode 100644
index 000000000..b9bd597f8
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/Status.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+import org.eclipse.unittest.model.ITestElement.Result;
+
+/**
+ * An object describing a test current status
+ */
+public final class Status {
+ public static final Status RUNNING_ERROR = new Status("RUNNING_ERROR"); //$NON-NLS-1$
+ public static final Status RUNNING_FAILURE = new Status("RUNNING_FAILURE"); //$NON-NLS-1$
+ public static final Status RUNNING = new Status("RUNNING"); //$NON-NLS-1$
+
+ public static final Status ERROR = new Status("ERROR"); //$NON-NLS-1$
+ public static final Status FAILURE = new Status("FAILURE"); //$NON-NLS-1$
+ public static final Status OK = new Status("OK"); //$NON-NLS-1$
+ public static final Status NOT_RUN = new Status("NOT_RUN"); //$NON-NLS-1$
+
+ private static final Status[] OLD_CODE = { OK, ERROR, FAILURE };
+
+ private final String fName;
+
+ private Status(String name) {
+ fName = name;
+ }
+
+ @Override
+ public String toString() {
+ return fName;
+ }
+
+ /* error state predicates */
+
+ /**
+ * Indicates if current test status is OK
+ *
+ * @return <code>true</code> if current status is OK, otherwise returns
+ * <code>false</code>
+ */
+ public boolean isOK() {
+ return this == OK || this == RUNNING || this == NOT_RUN;
+ }
+
+ /**
+ * Indicates if current test has failures
+ *
+ * @return <code>true</code> if current test has failures, otherwise return
+ * <code>false</code>
+ */
+ public boolean isFailure() {
+ return this == FAILURE || this == RUNNING_FAILURE;
+ }
+
+ /**
+ * Indicates if current test has errors
+ *
+ * @return <code>true</code> if current test has errors, otherwise return
+ * <code>false</code>
+ */
+ public boolean isError() {
+ return this == ERROR || this == RUNNING_ERROR;
+ }
+
+ /**
+ * Indicates if current test has errors and/or failures
+ *
+ * @return <code>true</code> if current test has errors and/or failures,
+ * otherwise return <code>false</code>
+ */
+ public boolean isErrorOrFailure() {
+ return isError() || isFailure();
+ }
+
+ /* progress state predicates */
+
+ /**
+ * Indicates if current test isn't run yet
+ *
+ * @return <code>true</code> if current test isn't run yet, otherwise return
+ * <code>false</code>
+ */
+ public boolean isNotRun() {
+ return this == NOT_RUN;
+ }
+
+ /**
+ * Indicates if current test is running
+ *
+ * @return <code>true</code> if current test is running, otherwise return
+ * <code>false</code>
+ */
+ public boolean isRunning() {
+ return this == RUNNING || this == RUNNING_FAILURE || this == RUNNING_ERROR;
+ }
+
+ public boolean isDone() {
+ return this == OK || this == FAILURE || this == ERROR;
+ }
+
+ /**
+ * Converts from an old status code to a {@link Status} constant
+ *
+ * @param oldStatus one of {@link Status}'s constants
+ * @return the {@link Status} constant
+ */
+ public static Status convert(int oldStatus) {
+ return OLD_CODE[oldStatus];
+ }
+
+ /**
+ * Converts the current {@link Status} object into a
+ * {@link org.eclipse.unittest.model.ITestElement.Result} object
+ *
+ * @return a {@link org.eclipse.unittest.model.ITestElement.Result} object
+ * instance
+ */
+ public Result convertToResult() {
+ if (isNotRun())
+ return Result.UNDEFINED;
+ if (isError())
+ return Result.ERROR;
+ if (isFailure())
+ return Result.FAILURE;
+ if (isRunning()) {
+ return Result.UNDEFINED;
+ }
+ return Result.OK;
+ }
+
+ /**
+ * Converts the current {@link Status} object into a {@link ProgressState}
+ * object
+ *
+ * @return a {@link ProgressState} object instance
+ */
+ public ProgressState convertToProgressState() {
+ if (isRunning()) {
+ return ProgressState.RUNNING;
+ }
+ if (isDone()) {
+ return ProgressState.COMPLETED;
+ }
+ return ProgressState.NOT_STARTED;
+ }
+
+ /**
+ * Creates a {@link Status} object from a given
+ * {@link org.eclipse.unittest.model.ITestElement.Result} object
+ *
+ * @param status a {@link Status} object
+ * @return an {@link org.eclipse.unittest.model.ITestElement.Result} object
+ * instance
+ */
+ public static Status fromResult(Result status) {
+ switch (status) {
+ case ERROR:
+ return Status.ERROR;
+ case FAILURE:
+ return Status.FAILURE;
+ case OK:
+ return Status.OK;
+ case IGNORED:
+ return Status.OK;
+ case UNDEFINED:
+ return Status.NOT_RUN;
+ default:
+ return Status.NOT_RUN;
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestCaseElement.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestCaseElement.java
new file mode 100644
index 000000000..9e0c4f075
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestCaseElement.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.model;
+
+import org.eclipse.unittest.model.ITestCaseElement;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * A test case element. Holds all information about a test case
+ */
+public class TestCaseElement extends TestElement implements ITestCaseElement {
+
+ private boolean fIgnored;
+ private boolean fIsDynamicTest;
+
+ /**
+ * Constructs a {@link TestCaseElement} object
+ *
+ * @param parent a parent {@link TestSuiteElement} object
+ * @param id an identifier of the object
+ * @param testName a name of the test case
+ * @param displayName a display name for a test case
+ * @param isDynamicTest an indicator of a "dynamic" test case
+ * @param uniqueId an unique test case identifier or <code>null</code>
+ */
+ public TestCaseElement(TestSuiteElement parent, String id, String testName, String displayName,
+ boolean isDynamicTest, String uniqueId) {
+ super(parent, id, testName, displayName, uniqueId);
+ Assert.isNotNull(parent);
+ fIsDynamicTest = isDynamicTest;
+ }
+
+ @Override
+ public Result getTestResult(boolean includeChildren) {
+ return isIgnored() ? Result.IGNORED : super.getTestResult(includeChildren);
+ }
+
+ public void setIgnored(boolean ignored) {
+ fIgnored = ignored;
+ }
+
+ @Override
+ public boolean isIgnored() {
+ return fIgnored;
+ }
+
+ @Override
+ public String toString() {
+ return "TestCase: " + super.toString(); //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean isDynamicTest() {
+ return fIsDynamicTest;
+ }
+
+ @Override
+ Integer getFinalTestCaseCount() {
+ return Integer.valueOf(1);
+ }
+
+ @Override
+ int countStartedTestCases() {
+ return getProgressState() != ProgressState.NOT_STARTED || testStartedInstant != null ? 1 : 0;
+ }
+
+ @Override
+ int getCurrentFailureCount() {
+ return getStatus() == Status.FAILURE ? 1 : 0;
+ }
+
+ @Override
+ int getCurrentAssumptionFailureCount() {
+ return isAssumptionFailure() ? 1 : 0;
+ }
+
+ @Override
+ int getCurrentIgnoredCount() {
+ return isIgnored() ? 1 : 0;
+ }
+
+ @Override
+ int getCurrentErrorCount() {
+ return getStatus() == Status.ERROR ? 1 : 0;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestElement.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestElement.java
new file mode 100644
index 000000000..7171e12f4
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestElement.java
@@ -0,0 +1,313 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+import java.time.Duration;
+import java.time.Instant;
+
+import org.eclipse.unittest.model.ITestElement;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * A test element n holds basic information about a test case or a test suite
+ * element
+ */
+public abstract class TestElement implements ITestElement {
+ private final TestSuiteElement fParent;
+ private final String fId;
+ private final String fTestName;
+ /**
+ * Extra (runner-specific) data, can be <code>null</code>
+ */
+ private final String fData;
+
+ /**
+ * The display name of the test element, can be <code>null</code>. In that case,
+ * use {@link TestElement#fTestName fTestName}.
+ */
+ private final String fDisplayName;
+
+ private Status fStatus;
+ protected FailureTrace fTrace;
+
+ private boolean fAssumptionFailed;
+
+ protected Instant testStartedInstant = null;
+ protected Duration fDuration = null;
+
+ /**
+ * Constructs the test element object
+ *
+ * @param parent the parent, can be <code>null</code>
+ * @param id the test id
+ * @param testName the test name
+ * @param displayName the test display name, can be <code>null</code>
+ * @param data some runner-specific data, can be <code>null</code>
+ */
+ public TestElement(TestSuiteElement parent, String id, String testName, String displayName, String data) {
+ Assert.isNotNull(id);
+ Assert.isNotNull(testName);
+ fParent = parent;
+ fId = id;
+ fTestName = testName;
+ fDisplayName = displayName;
+ fData = data;
+ fStatus = Status.NOT_RUN;
+ if (parent != null) {
+ parent.addChild(this);
+ } else if (!(this instanceof TestRunSession)) {
+ throw new IllegalArgumentException("Test elements must have a parent"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Returns the progress state of this test element.
+ * <ul>
+ * <li>{@link ProgressState#NOT_STARTED}: the test has not yet started</li>
+ * <li>{@link ProgressState#RUNNING}: the test is currently running</li>
+ * <li>{@link ProgressState#ABORTED}: the test has stopped before being
+ * completed</li>
+ * <li>{@link ProgressState#COMPLETED}: the test (and all its children) has
+ * completed</li>
+ * </ul>
+ *
+ * @return returns one of {@link ProgressState#NOT_STARTED},
+ * {@link ProgressState#RUNNING}, {@link ProgressState#ABORTED} or
+ * {@link ProgressState#COMPLETED}.
+ */
+ public ProgressState getProgressState() {
+ return getStatus().convertToProgressState();
+ }
+
+ /**
+ * Returns the result of the test element.
+ * <ul>
+ * <li>{@link org.eclipse.unittest.model.ITestElement.Result#UNDEFINED}: the
+ * result is not yet evaluated</li>
+ * <li>{@link org.eclipse.unittest.model.ITestElement.Result#OK}: the test has
+ * succeeded</li>
+ * <li>{@link org.eclipse.unittest.model.ITestElement.Result#ERROR}: the test
+ * has returned an error</li>
+ * <li>{@link org.eclipse.unittest.model.ITestElement.Result#FAILURE}: the test
+ * has returned an failure</li>
+ * <li>{@link org.eclipse.unittest.model.ITestElement.Result#IGNORED}: the test
+ * has been ignored (skipped)</li>
+ * </ul>
+ *
+ * @param includeChildren if <code>true</code>, the returned result is the
+ * combined result of the test and its children (if it
+ * has any). If <code>false</code>, only the test's
+ * result is returned.
+ *
+ * @return returns one of
+ * {@link org.eclipse.unittest.model.ITestElement.Result#UNDEFINED},
+ * {@link org.eclipse.unittest.model.ITestElement.Result#OK},
+ * {@link org.eclipse.unittest.model.ITestElement.Result#ERROR},
+ * {@link org.eclipse.unittest.model.ITestElement.Result#FAILURE} or
+ * {@link org.eclipse.unittest.model.ITestElement.Result#IGNORED}.
+ * Clients should also prepare for other, new values.
+ */
+ public Result getTestResult(boolean includeChildren) {
+ if (fAssumptionFailed) {
+ return Result.IGNORED;
+ }
+ return getStatus().convertToResult();
+ }
+
+ /**
+ * Returns the parent test element container or <code>null</code> if the test
+ * element is the test run session.
+ *
+ * @return the parent test suite
+ */
+ public TestSuiteElement getParentContainer() {
+ return fParent;
+ }
+
+ @Override
+ public FailureTrace getFailureTrace() {
+ Result testResult = getTestResult(false);
+ if ((testResult == Result.ERROR || testResult == Result.FAILURE
+ || (testResult == Result.IGNORED) && fTrace != null)) {
+ return fTrace;
+ }
+ return null;
+ }
+
+ @Override
+ public TestSuiteElement getParent() {
+ return fParent;
+ }
+
+ @Override
+ public String getId() {
+ return fId;
+ }
+
+ @Override
+ public String getTestName() {
+ return fTestName;
+ }
+
+ /**
+ * Sets the current test element status
+ *
+ * @param status one of {@link Status#NOT_RUN}, {@link Status#OK},
+ * {@link Status#ERROR} or {@link Status#FAILURE}.
+ */
+ public void setStatus(Status status) {
+ if (status == Status.RUNNING) {
+ testStartedInstant = Instant.now();
+ } else if (status.convertToProgressState() == ProgressState.COMPLETED && testStartedInstant != null) {
+ this.fDuration = Duration.between(testStartedInstant, Instant.now());
+ }
+
+ fStatus = status;
+ TestSuiteElement parent = getParent();
+ if (parent != null) {
+ parent.childChangedStatus(this, status);
+ }
+ }
+
+ /**
+ * Sets the extended status for this test element
+ *
+ * @param status one of {@link Status#NOT_RUN}, {@link Status#OK},
+ * {@link Status#ERROR} or {@link Status#FAILURE}.
+ * @param failureTrace stacktracee/error message or null
+ */
+ public void setStatus(Status status, FailureTrace failureTrace) {
+ if (failureTrace != null && fTrace != null) {
+ // don't overwrite first trace if same test run logs multiple errors
+ fTrace = new FailureTrace(fTrace.getTrace() + failureTrace.getTrace(), fTrace.getExpected(),
+ fTrace.getActual());
+ } else {
+ fTrace = failureTrace;
+ }
+ setStatus(status);
+ }
+
+ /**
+ * Returns the status of this test element
+ * <ul>
+ * <li>{@link Status#NOT_RUN}: the test has not executed</li>
+ * <li>{@link Status#OK}: the test is successful</li>
+ * <li>{@link Status#ERROR}: the test had an error</li>
+ * <li>{@link Status#FAILURE}: the test had an assertion failure</li>
+ * </ul>
+ *
+ * @return returns one of {@link Status#NOT_RUN}, {@link Status#OK},
+ * {@link Status#ERROR} or {@link Status#FAILURE}.
+ */
+ public Status getStatus() {
+ return fStatus;
+ }
+
+ /**
+ * Sets a duration value for a test element
+ *
+ * @param duration a duration value
+ */
+ public void setDuration(Duration duration) {
+ this.fDuration = duration;
+ }
+
+ @Override
+ public Duration getDuration() {
+ return this.fDuration;
+ }
+
+ /**
+ * Sets up the assumption failure flag for this test
+ *
+ * @param assumptionFailed a flag indicating the assumption failure
+ */
+ public void setAssumptionFailed(boolean assumptionFailed) {
+ fAssumptionFailed = assumptionFailed;
+ }
+
+ /**
+ * Indicates if there was an assumption failure
+ *
+ * @return true if there was a comparison failure, otherwise return false
+ */
+ public boolean isAssumptionFailure() {
+ return fAssumptionFailed;
+ }
+
+ @Override
+ public String toString() {
+ return getTestName() + '[' + getProgressState() + " - " + getTestResult(true) + ']'; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getDisplayName() {
+ return fDisplayName != null ? fDisplayName : getTestName();
+ }
+
+ @Override
+ public String getData() {
+ return fData;
+ }
+
+ @Override
+ public TestRunSession getTestRunSession() {
+ return getParent().getTestRunSession();
+ }
+
+ /**
+ * Returns the total number of expected test case elements, or the total number
+ * of ran test case elements if completed, or <code>null</null> if tests are
+ * still running and we can't know the final count.
+ *
+ * @return a total number of test cases
+ */
+ abstract Integer getFinalTestCaseCount();
+
+ /**
+ * Returns the number of started test case elements
+ *
+ * @return a number of started test cases
+ */
+ abstract int countStartedTestCases();
+
+ /**
+ * Returns the number of failed test case elements
+ *
+ * @return a number of failed test cases
+ */
+ abstract int getCurrentFailureCount();
+
+ /**
+ * Returns the number of assumption failures
+ *
+ * @return a number of assumption failures
+ */
+ abstract int getCurrentAssumptionFailureCount();
+
+ /**
+ * Returns the number of ignored test case elements
+ *
+ * @return a number of ignored test cases
+ */
+ abstract int getCurrentIgnoredCount();
+
+ /**
+ * Returns the number of test case elements with errors
+ *
+ * @return a number of test cases with errors
+ */
+ abstract int getCurrentErrorCount();
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunListenerAdapter.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunListenerAdapter.java
new file mode 100644
index 000000000..f3a04a1d5
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunListenerAdapter.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+import java.time.Duration;
+
+import org.eclipse.unittest.internal.launcher.TestListenerRegistry;
+import org.eclipse.unittest.internal.launcher.TestRunListener;
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+import org.eclipse.unittest.model.ITestElement.Result;
+
+import org.eclipse.core.runtime.ListenerList;
+
+/**
+ * Notifier for the callback listener API {@link TestRunListener}.
+ */
+public class TestRunListenerAdapter implements ITestSessionListener {
+
+ private final TestRunSession fSession;
+
+ /**
+ * Constructs a {@link TestRunListenerAdapter} object
+ *
+ * @param session a {@link TestRunSession} object
+ */
+ public TestRunListenerAdapter(TestRunSession session) {
+ fSession = session;
+ }
+
+ private ListenerList<TestRunListener> getListenerList() {
+ return TestListenerRegistry.getDefault().getUnitTestRunListeners();
+ }
+
+ private void fireSessionStarted() {
+ for (TestRunListener listener : getListenerList()) {
+ listener.sessionStarted(fSession);
+ }
+ }
+
+ private void fireSessionFinished() {
+ for (TestRunListener listener : getListenerList()) {
+ listener.sessionFinished(fSession);
+ }
+ }
+
+ private void fireTestCaseStarted(ITestCaseElement testCaseElement) {
+ for (TestRunListener listener : getListenerList()) {
+ listener.testCaseStarted(testCaseElement);
+ }
+ }
+
+ private void fireTestCaseFinished(ITestCaseElement testCaseElement) {
+ for (TestRunListener listener : getListenerList()) {
+ listener.testCaseFinished(testCaseElement);
+ }
+ }
+
+ @Override
+ public void sessionStarted() {
+ // wait until all test are added
+ }
+
+ @Override
+ public void sessionCompleted(Duration duration) {
+ fireSessionFinished();
+ }
+
+ @Override
+ public void sessionAborted(Duration duration) {
+ fireSessionFinished();
+ }
+
+ @Override
+ public void testAdded(ITestElement testElement) {
+ // do nothing
+ }
+
+ @Override
+ public void runningBegins() {
+ fireSessionStarted();
+ }
+
+ @Override
+ public void testStarted(ITestCaseElement testCaseElement) {
+ fireTestCaseStarted(testCaseElement);
+ }
+
+ @Override
+ public void testEnded(ITestCaseElement testCaseElement) {
+ fireTestCaseFinished(testCaseElement);
+ }
+
+ @Override
+ public void testFailed(ITestElement testElement, Result status, FailureTrace trace) {
+ // ignore
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunSession.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunSession.java
new file mode 100644
index 000000000..333ee659d
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestRunSession.java
@@ -0,0 +1,749 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+import java.text.DateFormat;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.launcher.TestViewSupportRegistry;
+import org.eclipse.unittest.launcher.ITestRunnerClient;
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestRunSession;
+import org.eclipse.unittest.model.ITestSuiteElement;
+import org.eclipse.unittest.ui.ITestViewSupport;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.SafeRunner;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.debug.core.Launch;
+import org.eclipse.debug.core.model.ISourceLocator;
+
+/**
+ * A test run session holds all information about a test run, i.e. launch
+ * configuration, launch, test tree (including results).
+ */
+public class TestRunSession extends TestSuiteElement implements ITestRunSession, ITestRunSessionReport {
+
+ /**
+ * The launch, or <code>null</code> iff this session was run externally.
+ */
+ private final ILaunch fLaunch;
+ private final String fTestRunName;
+ private final ITestViewSupport fTestRunnerSupport;
+
+ /**
+ * Test runner client or <code>null</code>.
+ */
+ private ITestRunnerClient fTestRunnerClient;
+
+ private final ListenerList<ITestSessionListener> fSessionListeners;
+ private final TestSessionNotifier fSessionNotifier = new TestSessionNotifier();
+
+ /**
+ * The test run session's cached result, or <code>null</code> if
+ * <code>fTestRoot != null</code>.
+ */
+ private Result fTestResult;
+
+ /**
+ * Map from testId to testElement.
+ */
+ private HashMap<String, TestElement> fIdToTest;
+
+ volatile Instant fStartTime;
+ volatile Integer fPredefinedTestCount;
+
+ volatile boolean fIsAborted;
+ private Integer predefinedTestCount;
+ private boolean completedOrAborted;
+
+ /**
+ * Constructs a test run session object.
+ *
+ * @param testRunName name of the test run
+ * @param startTime a start time of a test run
+ * @param launchConfiguration a launch configuration for a test run
+ */
+ public TestRunSession(String testRunName, Instant startTime, ILaunchConfiguration launchConfiguration) {
+ super(null, "-1", testRunName, null, null, null); //$NON-NLS-1$
+ // TODO: check assumptions about non-null fields
+
+ fLaunch = new NoopLaunch(launchConfiguration, ILaunchManager.RUN_MODE, null);
+ fTestRunnerSupport = TestViewSupportRegistry.newTestRunnerViewSupport(launchConfiguration).orElse(null);
+
+ Assert.isNotNull(testRunName);
+ fTestRunName = testRunName;
+
+ fIdToTest = new HashMap<>();
+
+ fTestRunnerClient = null;
+ fStartTime = startTime;
+
+ fSessionListeners = new ListenerList<>();
+ }
+
+ /**
+ * Constructs a test run session object from a launch.
+ *
+ * @param launch an {@link ILaunch} object
+ */
+ public TestRunSession(ILaunch launch) {
+ super(null, "-1", "<TestRunSession>", null, null, null); //$NON-NLS-1$ //$NON-NLS-2$
+ Assert.isNotNull(launch);
+
+ fLaunch = launch;
+
+ ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
+ if (launchConfiguration != null) {
+ fTestRunName = launchConfiguration.getName();
+ fTestRunnerSupport = TestViewSupportRegistry.newTestRunnerViewSupport(launchConfiguration).orElse(null);
+ } else {
+ fTestRunName = "<TestRunSession>"; //$NON-NLS-1$
+ fTestRunnerSupport = null;
+ }
+
+ fIdToTest = new HashMap<>();
+
+ if (fTestRunnerSupport != null) {
+ fTestRunnerClient = fTestRunnerSupport.newTestRunnerClient(this);
+ }
+
+ final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ launchManager.addLaunchListener(new ILaunchesListener2() {
+ @Override
+ public void launchesTerminated(ILaunch[] launches) {
+ if (Arrays.asList(launches).contains(fLaunch)) {
+ launchManager.removeLaunchListener(this);
+ }
+ }
+
+ @Override
+ public void launchesRemoved(ILaunch[] launches) {
+ if (Arrays.asList(launches).contains(fLaunch)) {
+ launchManager.removeLaunchListener(this);
+ }
+ }
+
+ @Override
+ public void launchesChanged(ILaunch[] launches) {
+ // do nothing
+ }
+
+ @Override
+ public void launchesAdded(ILaunch[] launches) {
+ // do nothing
+ }
+ });
+ fSessionListeners = new ListenerList<>();
+ setStatus(Status.RUNNING);
+ addTestSessionListener(new TestRunListenerAdapter(this));
+ fTestRunnerClient.startMonitoring();
+ }
+
+ /**
+ * Resets a test run session object (used when re-creating a test run session
+ * from an XML file(
+ *
+ * TODO Consider removal as it's only use in XML parsing
+ */
+ public void reset() {
+ fTestResult = null;
+ fIdToTest = new HashMap<>();
+ }
+
+ @Override
+ public ProgressState getProgressState() {
+ if (isRunning()) {
+ return ProgressState.RUNNING;
+ }
+ if (isStopped()) {
+ return ProgressState.ABORTED;
+ }
+ return ProgressState.COMPLETED;
+ }
+
+ @Override
+ public FailureTrace getFailureTrace() {
+ return null;
+ }
+
+ @Override
+ public TestSuiteElement getParentContainer() {
+ return null;
+ }
+
+ @Override
+ public TestRunSession getTestRunSession() {
+ return this;
+ }
+
+ /**
+ * Returns the Test Runner View Support for which this test run session has been
+ * launched, or <code>null</code> if not available.
+ *
+ * @return the test runner view support, or <code>null</code> is not available.
+ */
+ public ITestViewSupport getTestViewSupport() {
+ return fTestRunnerSupport;
+ }
+
+ /**
+ * @return the launch, or <code>null</code> iff this session was run externally
+ */
+ @Override
+ public ILaunch getLaunch() {
+ return fLaunch;
+ }
+
+ @Override
+ public String getTestRunName() {
+ return fTestRunName;
+ }
+
+ @Override
+ public int getCurrentErrorCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentErrorCount).sum();
+ }
+
+ @Override
+ public int getCurrentFailureCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentFailureCount).sum();
+ }
+
+ @Override
+ public int getCurrentAssumptionFailureCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentAssumptionFailureCount).sum();
+ }
+
+ @Override
+ public int getCurrentIgnoredCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentIgnoredCount).sum();
+ }
+
+ /**
+ * Returns start time for a run session
+ *
+ * @return an {@link Instant} object indicating a test run session start time
+ */
+ public Instant getStartTime() {
+ return fStartTime;
+ }
+
+ /**
+ * Indicates if the test run session has been stopped or terminated
+ *
+ * @return <code>true</code> if the session has been stopped or terminated,
+ * otherwise returns <code>false</code>
+ */
+ @Override
+ public boolean isStopped() {
+ return fIsAborted;
+ }
+
+ /**
+ * Adds an {@link ITestSessionListener} listener
+ *
+ * @param listener an {@link ITestSessionListener} object
+ */
+ public synchronized void addTestSessionListener(ITestSessionListener listener) {
+ fSessionListeners.add(listener);
+ }
+
+ /**
+ * Removes an {@link ITestSessionListener} listener
+ *
+ * @param listener an {@link ITestSessionListener} object
+ */
+ public void removeTestSessionListener(ITestSessionListener listener) {
+ fSessionListeners.remove(listener);
+ }
+
+ @Override
+ public boolean isStarting() {
+ return getStartTime() == null && fLaunch != null && !fLaunch.isTerminated();
+ }
+
+ /**
+ * Forces a test run session to abort its execution
+ */
+ public void abortTestRun() {
+ fIsAborted = true;
+ if (fTestRunnerClient != null) {
+ fTestRunnerClient.stopTest();
+ fTestRunnerClient.stopMonitoring();
+ }
+ }
+
+ @Override
+ public boolean isRunning() {
+ return getStartTime() != null && fTestRunnerClient != null && !completedOrAborted;
+ }
+
+ @Override
+ public TestElement getTestElement(String id) {
+ return fIdToTest.get(id);
+ }
+
+ private TestElement addTreeEntry(String id, String testName, boolean isSuite, Integer testCount,
+ boolean isDynamicTest, TestSuiteElement parent, String displayName, String data) {
+ return createTestElement(parent != null ? parent : this, id, testName, isSuite, testCount, isDynamicTest,
+ displayName, data);
+ }
+
+ /**
+ * Creates a test element, either {@link ITestSuiteElement} or
+ * {@link ITestCaseElement} instance, depending on the arguments.
+ *
+ * @param parent a parent test suite element
+ * @param id an identifier of the test element
+ * @param testName a name of the test element
+ * @param isSuite a flag indicating if the test element should be
+ * represented by a test suite element
+ * @param testCount a number of predefined test cases in case of test suite
+ * element
+ * @param isDynamicTest a flag indicating that test suite is dynamic (that
+ * doesn't have predefined tests)
+ * @param displayName a display name for the test element
+ * @param data some test runner specific data, can be <code>null</code>
+ * @return a created {@link ITestSuiteElement} or {@link ITestCaseElement}
+ * instance
+ */
+ public TestElement createTestElement(TestSuiteElement parent, String id, String testName, boolean isSuite,
+ Integer testCount, boolean isDynamicTest, String displayName, String data) {
+ TestElement testElement;
+ if (isSuite) {
+ TestSuiteElement testSuiteElement = new TestSuiteElement(parent != null ? parent : this, id, testName,
+ testCount, displayName, data);
+ testElement = testSuiteElement;
+ } else {
+ testElement = new TestCaseElement(parent != null ? parent : this, id, testName, displayName, isDynamicTest,
+ data);
+ }
+ fIdToTest.put(id, testElement);
+ return testElement;
+ }
+
+ private final class NoopLaunch extends Launch {
+ private NoopLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
+ super(launchConfiguration, mode, locator);
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return true;
+ }
+
+ @Override
+ public boolean isDisconnected() {
+ return true;
+ }
+ }
+
+ /**
+ * Listens to events from the and translates {@link ITestRunnerClient} them into
+ * high-level model events (broadcasted to {@link ITestSessionListener}s).
+ */
+ private class TestSessionNotifier {
+
+ private boolean firstStart;
+
+ /**
+ * Notifies on a test run started
+ *
+ * @param testCount number of tests in this run
+ */
+ public void testRunStarted(Integer testCount) {
+ fStartTime = Instant.now();
+ fPredefinedTestCount = testCount;
+
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.sessionStarted();
+ }
+ }
+
+ /**
+ * Notifies on a test run ended
+ *
+ * @param duration a duration of this test run
+ */
+ public void testRunEnded(Duration duration) {
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.sessionCompleted(duration);
+ }
+ }
+
+ /**
+ * Notifies on a test run stopped (aborted)
+ *
+ * @param duration a duration of this test run
+ */
+ public void testRunStopped(Duration duration) {
+ fIsAborted = true;
+
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.sessionAborted(duration);
+ }
+ }
+
+ /**
+ * Notifies on a test tree entry is created
+ *
+ * @param testId an identifier of a test entry
+ * @param testName a name of test
+ * @param isSuite <code>true</code> indicates that a test entry is a test
+ * suite, <code>false</code> - a test case
+ * @param testCount a number of tests in a test suite or <code>null</code>
+ * @param isDynamicTest indicates if a test is a dynamic test (doesn't have a
+ * predefined number of tests)
+ * @param parent a parent test suite element
+ * @param displayName a display name for the test
+ * @param uniqueId an unique identifier of test entry or <code>null</code>
+ * @return an {@link ITestElement} object instance
+ */
+ public ITestElement testTreeEntry(String testId, String testName, boolean isSuite, Integer testCount,
+ boolean isDynamicTest, ITestSuiteElement parent, String displayName, String uniqueId) {
+ ITestElement testElement = addTreeEntry(testId, testName, isSuite, testCount, isDynamicTest,
+ (TestSuiteElement) parent, displayName, uniqueId);
+
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.testAdded(testElement);
+ }
+ return testElement;
+ }
+
+ /**
+ * Notifies on a test started
+ *
+ * @param test a test element object
+ */
+ public void testStarted(ITestElement test) {
+ if (!(test instanceof TestCaseElement)) {
+ return;
+ }
+ if (firstStart) {
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.runningBegins();
+ }
+ firstStart = false;
+ }
+ setStatus(test, Status.RUNNING);
+
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.testStarted((ITestCaseElement) test);
+ }
+ }
+
+ /**
+ * Notifies on a test ended
+ *
+ * @param testElement a test element object
+ * @param isIgnored indicates a skipped (not run) test element
+ */
+ public void testEnded(ITestElement testElement, boolean isIgnored) {
+ if (testElement == null) {
+ return;
+ }
+ if (!(testElement instanceof TestCaseElement)) {
+ if (isIgnored) {
+ ((TestElement) testElement).setAssumptionFailed(true);
+ setStatus(testElement, Status.OK);
+ } else {
+ logUnexpectedTest(testElement.getId(), testElement);
+ }
+ return;
+ }
+ TestCaseElement testCaseElement = (TestCaseElement) testElement;
+ if (isIgnored) {
+ testCaseElement.setIgnored(true);
+ }
+
+ if (testCaseElement.getStatus() == Status.RUNNING)
+ setStatus(testCaseElement, Status.OK);
+
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.testEnded(testCaseElement);
+ }
+ }
+
+ /**
+ * Notifies on a failed test element
+ *
+ * @param testElement a failed test element
+ * @param status a result status of test execution
+ * @param isAssumptionFailed indicates if the failure is an assumption failure
+ * @param trace a failure trace
+ */
+ public void testFailed(ITestElement testElement, Result status, boolean isAssumptionFailed,
+ FailureTrace trace) {
+ if (testElement == null) {
+ return;
+ }
+
+ if (isAssumptionFailed) {
+ ((TestElement) testElement).setAssumptionFailed(true);
+ status = Result.OK;
+ }
+
+ registerTestFailureStatus((TestElement) testElement, status, trace);
+
+ for (ITestSessionListener listener : fSessionListeners) {
+ listener.testFailed(testElement, status, trace);
+ }
+ }
+
+ private void logUnexpectedTest(String testId, ITestElement testElement) {
+ UnitTestPlugin
+ .log(new Exception("Unexpected TestElement type for testId '" + testId + "': " + testElement)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * Registers a failure status for a test element
+ *
+ * @param testElement a test element
+ * @param status a result of test execution
+ * @param failureTrace a failure trace
+ */
+ public void registerTestFailureStatus(TestElement testElement, Result status, FailureTrace failureTrace) {
+ testElement.setStatus(Status.fromResult(status), failureTrace);
+ }
+
+ /**
+ * Registers an ended test element
+ *
+ * @param testElement a test element
+ * @param completed <code>true</code> indicates that the test was completed.
+ * <code>false</code> otherwise
+ */
+ public void registerTestEnded(TestElement testElement, boolean completed) {
+ if (testElement instanceof TestCaseElement) {
+ if (!completed) {
+ return;
+ }
+ TestCaseElement testCaseElement = (TestCaseElement) testElement;
+ if (!testCaseElement.getStatus().isErrorOrFailure())
+ setStatus(testElement, Status.OK);
+ }
+ }
+
+ /**
+ * Sets a {@link Status} for a test element
+ *
+ * @param testElement a test element
+ * @param status an execution status
+ */
+ private void setStatus(ITestElement testElement, Status status) {
+ ((TestElement) testElement).setStatus(status);
+ }
+
+ /**
+ * Returns an array of all failed {@link ITestElement}s
+ *
+ * @return an array of failed {@link ITestElement}s
+ */
+ public List<TestElement> getAllFailedTestElements() {
+ List<TestElement> failures = new ArrayList<>();
+ addFailures(failures, this);
+ return Collections.unmodifiableList(failures);
+ }
+
+ private void addFailures(Collection<TestElement> failures, TestElement testElement) {
+ Result testResult = testElement.getTestResult(true);
+ if (testResult == Result.ERROR || testResult == Result.FAILURE) {
+ failures.add(testElement);
+ }
+ if (testElement instanceof TestSuiteElement) {
+ TestSuiteElement testSuiteElement = (TestSuiteElement) testElement;
+ for (TestElement child : testSuiteElement.getChildren()) {
+ addFailures(failures, child);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return fTestRunName + " " + DateFormat.getDateTimeInstance().format(new Date(fStartTime.toEpochMilli())); //$NON-NLS-1$
+ }
+
+ @Override
+ public TestSuiteElement getParent() {
+ return null;
+ }
+
+ @Override
+ public String getTestName() {
+ return getTestRunName();
+ }
+
+ /**
+ * An abstract base class for a listener safe runnable
+ */
+ public abstract class ListenerSafeRunnable implements ISafeRunnable {
+ @Override
+ public void handleException(Throwable exception) {
+ UnitTestPlugin.log(exception);
+ }
+ }
+
+ @Override
+ public TestCaseElement newTestCase(String testId, String testName, ITestSuiteElement parent, String displayName,
+ String data) {
+ return (TestCaseElement) fSessionNotifier.testTreeEntry(testId, testName, false, Integer.valueOf(1), false,
+ parent, displayName, data);
+ }
+
+ @Override
+ public TestSuiteElement newTestSuite(String testId, String testName, Integer testCount, ITestSuiteElement parent,
+ String displayName, String data) {
+ return (TestSuiteElement) fSessionNotifier.testTreeEntry(testId, testName, true, testCount, testCount == null,
+ parent, displayName, data);
+ }
+
+ @Override
+ public void notifyTestSessionAborted(final Duration reportDuration, Exception cause) {
+ if (isStopped()) {
+ return;
+ }
+ if (reportDuration != null) {
+ setDuration(reportDuration);
+ }
+ fTestRunnerClient.stopMonitoring();
+ this.completedOrAborted = true;
+ SafeRunner.run(new ListenerSafeRunnable() {
+ @Override
+ public void run() {
+ fSessionNotifier.testRunStopped(fDuration);
+ }
+ });
+ }
+
+ @Override
+ public void notifyTestSessionCompleted(final Duration reportDuration) {
+ if (isStopped()) {
+ return;
+ }
+ if (reportDuration != null) {
+ setDuration(reportDuration);
+ }
+ fTestRunnerClient.stopMonitoring();
+ this.completedOrAborted = true;
+ SafeRunner.run(new ListenerSafeRunnable() {
+ @Override
+ public void run() {
+ fSessionNotifier.testRunEnded(fDuration);
+ }
+ });
+ }
+
+ @Override
+ public void notifyTestEnded(ITestElement test, boolean isIgnored) {
+ if (isStopped()) {
+ return;
+ }
+ SafeRunner.run(new ListenerSafeRunnable() {
+ @Override
+ public void run() {
+ fSessionNotifier.testEnded(test, isIgnored);
+ }
+ });
+ }
+
+ @Override
+ public void notifyTestStarted(ITestElement test) {
+ if (isStopped()) {
+ return;
+ }
+ SafeRunner.run(new ListenerSafeRunnable() {
+ @Override
+ public void run() {
+ fSessionNotifier.testStarted(test);
+ }
+ });
+ }
+
+ @Override
+ public void notifyTestSessionStarted(final Integer count) {
+ if (isStopped()) {
+ return;
+ }
+ this.predefinedTestCount = count;
+ SafeRunner.run(new ListenerSafeRunnable() {
+ @Override
+ public void run() {
+ fSessionNotifier.testRunStarted(count);
+ }
+ });
+ }
+
+ @Override
+ public void notifyTestFailed(ITestElement test, Result status, boolean isAssumptionFailed,
+ FailureTrace failureTrace) {
+ if (isStopped()) {
+ return;
+ }
+ if (status != Result.FAILURE && status != Result.ERROR) {
+ throw new IllegalArgumentException("Status has to be FAILURE or ERROR"); //$NON-NLS-1$
+ }
+ SafeRunner.run(new ListenerSafeRunnable() {
+ @Override
+ public void run() {
+ fSessionNotifier.testFailed(test, status, isAssumptionFailed, failureTrace);
+ }
+ });
+ }
+
+ @Override
+ public Integer getFinalTestCaseCount() {
+ if (predefinedTestCount != null) {
+ return predefinedTestCount;
+ }
+ if (getChildren().isEmpty()) {
+ return null;
+ }
+ if (!isRunning()) {
+ int res = 0;
+ for (TestElement child : getChildren()) {
+ Integer childCount = child.getFinalTestCaseCount();
+ if (childCount == null) {
+ return null;
+ }
+ res += childCount.intValue();
+ }
+ return Integer.valueOf(res);
+ }
+ return null;
+ }
+
+ @Override
+ public Result getTestResult(boolean includeChildren) {
+ return this.fTestResult != null ? this.fTestResult : super.getTestResult(includeChildren);
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestSuiteElement.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestSuiteElement.java
new file mode 100644
index 000000000..f285502df
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/TestSuiteElement.java
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.model;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestSuiteElement;
+
+/**
+ * A test suite element. Holds all information about a test case
+ */
+public class TestSuiteElement extends TestElement implements ITestSuiteElement {
+
+ private final List<TestElement> fChildren;
+ private Status fChildrenStatus;
+ private Integer expectedTestCount;
+
+ /**
+ * Constructs a test suite object
+ *
+ * @param parent a parent {@link TestSuiteElement} object
+ * @param id an identifier of a test suite
+ * @param testName a name of test suite
+ * @param expectedChildrenCount an expected children count
+ * @param displayName a display name of test suite
+ * @param data an optional additional data for a test suite
+ */
+ public TestSuiteElement(TestSuiteElement parent, String id, String testName, Integer expectedChildrenCount,
+ String displayName, String data) {
+ super(parent, id, testName, displayName, data);
+ this.expectedTestCount = expectedChildrenCount;
+ fChildren = new ArrayList<>(expectedChildrenCount == null ? 0 : expectedChildrenCount.intValue());
+ }
+
+ @Override
+ public Result getTestResult(boolean includeChildren) {
+ if (includeChildren) {
+ return getStatus().convertToResult();
+ } else {
+ return super.getStatus().convertToResult();
+ }
+ }
+
+ @Override
+ public List<TestElement> getChildren() {
+ return Collections.unmodifiableList(fChildren);
+ }
+
+ /**
+ * Adds a child {@link ITestElement} to this test suite element
+ *
+ * @param child a child {@link ITestElement}
+ */
+ public void addChild(TestElement child) {
+ fChildren.add(child);
+ }
+
+ /**
+ * Removes a child {@link ITestElement} from this test suite element
+ *
+ * @param child a child {@link ITestElement}
+ */
+ public void removeChild(TestElement child) {
+ fChildren.remove(child);
+ }
+
+ @Override
+ public Status getStatus() {
+ Status suiteStatus = getSuiteStatus();
+ if (fChildrenStatus != null) {
+ // must combine children and suite status here, since failures can occur e.g. in
+ // @AfterClass
+ return combineStatus(fChildrenStatus, suiteStatus);
+ } else {
+ return suiteStatus;
+ }
+ }
+
+ private Status getCumulatedStatus() {
+ TestElement[] children = fChildren.toArray(new TestElement[fChildren.size()]); // copy list to avoid concurreny
+ // problems
+ if (children.length == 0)
+ return getSuiteStatus();
+
+ Status cumulated = children[0].getStatus();
+
+ for (int i = 1; i < children.length; i++) {
+ Status childStatus = children[i].getStatus();
+ cumulated = combineStatus(cumulated, childStatus);
+ }
+ // not necessary, see special code in Status.combineProgress()
+// if (suiteStatus.isErrorOrFailure() && cumulated.isNotRun())
+// return suiteStatus; //progress is Done if error in Suite and no children run
+ return cumulated;
+ }
+
+ /**
+ * Returns a test suite execution status
+ *
+ * @return a test suite execution status
+ */
+ public Status getSuiteStatus() {
+ return super.getStatus();
+ }
+
+ /**
+ * Notifies on the status changes in a specified child {@link ITestElement}
+ * element
+ *
+ * @param child a child {@link ITestElement} element
+ * @param childStatus a new status value
+ */
+ public void childChangedStatus(ITestElement child, Status childStatus) {
+ int childCount = fChildren.size();
+ if (child == fChildren.get(0) && childStatus.isRunning()) {
+ // is first child, and is running -> copy status
+ internalSetChildrenStatus(childStatus);
+ return;
+ }
+ TestElement lastChild = fChildren.get(childCount - 1);
+ if (child == lastChild) {
+ if (childStatus.isDone()) {
+ // all children done, collect cumulative status
+ internalSetChildrenStatus(getCumulatedStatus());
+ return;
+ }
+ // go on (child could e.g. be a TestSuiteElement with RUNNING_FAILURE)
+
+ } else if (!lastChild.getStatus().isNotRun()) {
+ // child is not last, but last child has been run -> child has been rerun or is
+ // rerunning
+ internalSetChildrenStatus(getCumulatedStatus());
+ return;
+ }
+
+ // finally, set RUNNING_FAILURE/ERROR if child has failed but suite has not
+ // failed:
+ if (childStatus.isFailure()) {
+ if (fChildrenStatus == null || !fChildrenStatus.isErrorOrFailure()) {
+ internalSetChildrenStatus(Status.RUNNING_FAILURE);
+ return;
+ }
+ } else if (childStatus.isError()) {
+ if (fChildrenStatus == null || !fChildrenStatus.isError()) {
+ internalSetChildrenStatus(Status.RUNNING_ERROR);
+ return;
+ }
+ }
+ }
+
+ private void internalSetChildrenStatus(Status status) {
+ if (fChildrenStatus == status)
+ return;
+
+ if (status == Status.RUNNING) {
+ if (fDuration != null) {
+ // re-running child: ignore change
+ } else {
+ testStartedInstant = Instant.now();
+ }
+ } else if (status.convertToProgressState() == ProgressState.COMPLETED && fDuration == null
+ && testStartedInstant != null) {
+ fDuration = Duration.between(testStartedInstant, Instant.now());
+ }
+
+ fChildrenStatus = status;
+
+ TestSuiteElement parent = getParent();
+ if (parent != null) {
+ parent.childChangedStatus(this, getStatus());
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "TestSuite: " + getTestName() + " : " + super.toString() + " (" + fChildren.size() + ")"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ private static Status combineStatus(Status one, Status two) {
+ Status progress = combineProgress(one, two);
+ Status error = combineError(one, two);
+ return combineProgressAndErrorStatus(progress, error);
+ }
+
+ private static Status combineProgress(Status one, Status two) {
+ if (one.isNotRun() && two.isNotRun()) {
+ return Status.NOT_RUN;
+ }
+ if (one.isDone() && two.isDone()) {
+ return Status.OK;
+ }
+ if (!one.isRunning() && !two.isRunning()) {
+ return Status.OK; // one done, one not-run -> a parent failed and its children are not run
+ }
+ return Status.RUNNING;
+ }
+
+ private static Status combineError(Status one, Status two) {
+ if (one.isError() || two.isError()) {
+ return Status.ERROR;
+ }
+ if (one.isFailure() || two.isFailure()) {
+ return Status.FAILURE;
+ }
+ return Status.OK;
+ }
+
+ private static Status combineProgressAndErrorStatus(Status progress, Status error) {
+ if (progress.isDone()) {
+ if (error.isError()) {
+ return Status.ERROR;
+ }
+ if (error.isFailure()) {
+ return Status.FAILURE;
+ }
+ return Status.OK;
+ }
+
+ if (progress.isNotRun()) {
+ return Status.NOT_RUN;
+ }
+
+ if (error.isError()) {
+ return Status.RUNNING_ERROR;
+ }
+ if (error.isFailure()) {
+ return Status.RUNNING_FAILURE;
+ }
+ return Status.RUNNING;
+ }
+
+ @Override
+ Integer getFinalTestCaseCount() {
+ if (expectedTestCount != null) {
+ return expectedTestCount;
+ }
+ if (getStatus().isDone()) {
+ return Integer.valueOf(getChildren().stream().map(TestElement::getFinalTestCaseCount)
+ .filter(Objects::nonNull).mapToInt(Integer::intValue).sum());
+ }
+ return null;
+ }
+
+ @Override
+ public int countStartedTestCases() {
+ return getChildren().stream().mapToInt(TestElement::countStartedTestCases).sum();
+ }
+
+ @Override
+ int getCurrentFailureCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentFailureCount).sum();
+ }
+
+ @Override
+ int getCurrentAssumptionFailureCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentAssumptionFailureCount).sum();
+ }
+
+ @Override
+ int getCurrentIgnoredCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentIgnoredCount).sum();
+ }
+
+ @Override
+ int getCurrentErrorCount() {
+ return getChildren().stream().mapToInt(TestElement::getCurrentErrorCount).sum();
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestLaunchListener.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestLaunchListener.java
new file mode 100644
index 000000000..5801547e3
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestLaunchListener.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+import java.util.HashSet;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.launcher.TestListenerRegistry;
+import org.eclipse.unittest.internal.launcher.TestRunListener;
+import org.eclipse.unittest.internal.launcher.TestViewSupportRegistry;
+import org.eclipse.unittest.internal.launcher.UnitTestLaunchConfigurationConstants;
+import org.eclipse.unittest.ui.ITestViewSupport;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchListener;
+
+/**
+ * Used to track new launches. We need to do this so that we only attach a
+ * TestRunner once to a launch. Once a test runner is connected, it is removed
+ * from the set.
+ */
+public class UnitTestLaunchListener implements ILaunchListener {
+
+ /**
+ * Used to track new launches. We need to do this so that we only attach a
+ * TestRunner once to a launch. Once a test runner is connected, it is removed
+ * from the set.
+ */
+ private HashSet<ILaunch> fTrackedLaunches = new HashSet<>(20);
+
+ @Override
+ public void launchAdded(ILaunch launch) {
+ ILaunchConfiguration config = launch.getLaunchConfiguration();
+ if (config == null)
+ return;
+
+ try {
+ if (!config.hasAttribute(UnitTestLaunchConfigurationConstants.ATTR_UNIT_TEST_VIEW_SUPPORT))
+ return;
+ } catch (CoreException e1) {
+ UnitTestPlugin.log(e1);
+ return;
+ }
+
+ ITestViewSupport testRunnerViewSupport = TestViewSupportRegistry.newTestRunnerViewSupport(config).orElse(null);
+ if (testRunnerViewSupport == null)
+ return;
+
+ fTrackedLaunches.add(launch);
+ }
+
+ @Override
+ public void launchRemoved(final ILaunch launch) {
+ fTrackedLaunches.remove(launch);
+ }
+
+ @Override
+ public void launchChanged(final ILaunch launch) {
+ if (!fTrackedLaunches.contains(launch))
+ return;
+
+ // Load session on 1st change (usually 1st process added), although it's not
+ // much reliable. Each TestRunnerClient should take care of listening to the
+ // launch to get the right IProcess or stream or whatever else i useful
+ if (UnitTestModel.getInstance().getTestRunSessions().stream()
+ .noneMatch(session -> launch.equals(session.getLaunch()))) {
+ TestRunSession testRunSession = new TestRunSession(launch);
+ UnitTestModel.getInstance().addTestRunSession(testRunSession);
+ for (TestRunListener listener : TestListenerRegistry.getDefault().getUnitTestRunListeners()) {
+ listener.sessionLaunched(testRunSession);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestModel.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestModel.java
new file mode 100644
index 000000000..2e270c7ba
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/model/UnitTestModel.java
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.model;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.SAXException;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.UnitTestPreferencesConstants;
+import org.eclipse.unittest.internal.junitXmlReport.TestRunHandler;
+import org.eclipse.unittest.model.ITestRunSession;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Central registry for Unit Test test runs.
+ */
+public final class UnitTestModel {
+
+ private final ListenerList<ITestRunSessionListener> fTestRunSessionListeners = new ListenerList<>();
+ /**
+ * Active test run sessions, youngest first.
+ */
+ private final LinkedList<TestRunSession> fTestRunSessions = new LinkedList<>();
+
+ private static UnitTestModel INSTANCE = null;
+
+ private UnitTestModel() {
+
+ }
+
+ /**
+ * Returns a {@link UnitTestModel} object instance
+ *
+ * @return a {@link UnitTestModel} object instance
+ */
+ public static synchronized UnitTestModel getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new UnitTestModel();
+ }
+ return INSTANCE;
+ }
+
+ /**
+ * Starts the model (called by the {@link UnitTestPlugin} on startup).
+ */
+ public void start() {
+ /*
+ * TODO: restore on restart: - only import headers! - only import last n
+ * sessions; remove all other files in historyDirectory
+ */
+// File historyDirectory= UnitTestPlugin.getHistoryDirectory();
+// File[] swapFiles= historyDirectory.listFiles();
+// if (swapFiles != null) {
+// Arrays.sort(swapFiles, new Comparator() {
+// public int compare(Object o1, Object o2) {
+// String name1= ((File) o1).getName();
+// String name2= ((File) o2).getName();
+// return name1.compareTo(name2);
+// }
+// });
+// for (int i= 0; i < swapFiles.length; i++) {
+// final File file= swapFiles[i];
+// SafeRunner.run(new ISafeRunnable() {
+// public void run() throws Exception {
+// importTestRunSession(file );
+// }
+// public void handleException(Throwable exception) {
+// UnitTestPlugin.log(exception);
+// }
+// });
+// }
+// }
+
+// addTestRunSessionListener(new LegacyTestRunSessionListener());
+ }
+
+ /**
+ * Stops the model (called by the {@link UnitTestPlugin} on shutdown).
+ */
+ public void stop() {
+// for (Iterator iter= fTestRunSessions.iterator(); iter.hasNext();) {
+// final TestRunSession session= (TestRunSession) iter.next();
+// SafeRunner.run(new ISafeRunnable() {
+// public void run() throws Exception {
+// session.swapOut();
+// }
+// public void handleException(Throwable exception) {
+// UnitTestPlugin.log(exception);
+// }
+// });
+// }
+ }
+
+ /**
+ * Adds an {@link ITestRunSessionListener} object
+ *
+ * @param listener a listener object
+ */
+ public void addTestRunSessionListener(ITestRunSessionListener listener) {
+ fTestRunSessionListeners.add(listener);
+ }
+
+ /**
+ * Removes an {@link ITestRunSessionListener} object
+ *
+ * @param listener a listener object
+ */
+ public void removeTestRunSessionListener(ITestRunSessionListener listener) {
+ fTestRunSessionListeners.remove(listener);
+ }
+
+ /**
+ * Returns a list of {@link TestRunSession} objects
+ *
+ * @return a list of {@link TestRunSession} objects
+ */
+ public synchronized List<TestRunSession> getTestRunSessions() {
+ return new ArrayList<>(fTestRunSessions);
+ }
+
+ /**
+ * Adds a specified {@link TestRunSession} object into the list of processed
+ * test run sessions.
+ *
+ * The list length is limited by the value of
+ * {@link UnitTestPreferencesConstants#MAX_TEST_RUNS} preference.
+ *
+ * @param testRunSession a {@link TestRunSession} object to be added
+ * @see org.eclipse.unittest.internal.UnitTestPreferencesConstants#MAX_TEST_RUNS
+ * @see org.eclipse.unittest.internal.model.UnitTestModel#removeTestRunSession(TestRunSession)
+ */
+ void addTestRunSession(TestRunSession testRunSession) {
+ Assert.isNotNull(testRunSession);
+ ArrayList<TestRunSession> toRemove = new ArrayList<>();
+
+ synchronized (this) {
+ Assert.isLegal(!fTestRunSessions.contains(testRunSession));
+ fTestRunSessions.addFirst(testRunSession);
+
+ int maxCount = Platform.getPreferencesService().getInt(UnitTestPlugin.PLUGIN_ID,
+ UnitTestPreferencesConstants.MAX_TEST_RUNS, 10, null);
+ int size = fTestRunSessions.size();
+ if (size > maxCount) {
+ List<TestRunSession> excess = fTestRunSessions.subList(maxCount, size);
+ for (Iterator<TestRunSession> iter = excess.iterator(); iter.hasNext();) {
+ TestRunSession oldSession = iter.next();
+ if (oldSession.isStopped()) {
+ toRemove.add(oldSession);
+ iter.remove();
+ }
+ }
+ }
+ }
+
+ toRemove.forEach(this::notifyTestRunSessionRemoved);
+ notifyTestRunSessionAdded(testRunSession);
+ }
+
+ /**
+ * Imports a test run session from an URL
+ *
+ * @param url an URL to source file
+ * @param monitor a progress monitor object
+ * @return an {@link ITestRunSession} object instance
+ *
+ * @throws InvocationTargetException in case of problems during import operation
+ * @throws InterruptedException in case of import operation is interrupted
+ */
+ public ITestRunSession importTestRunSession(String url, IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(ModelMessages.UnitTestModel_importing_from_url, IProgressMonitor.UNKNOWN);
+ final String trimmedUrl = url.trim().replaceAll("\r\n?|\n", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ final TestRunHandler handler = new TestRunHandler(monitor);
+
+ final CoreException[] exception = { null };
+ final TestRunSession[] session = { null };
+
+ Thread importThread = new Thread("UnitTest URL importer") { //$NON-NLS-1$
+ @Override
+ public void run() {
+ try {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+// parserFactory.setValidating(true); // TODO: add DTD and debug flag
+ SAXParser parser = parserFactory.newSAXParser();
+ parser.parse(trimmedUrl, handler);
+ session[0] = handler.getTestRunSession();
+ } catch (OperationCanceledException e) {
+ // canceled
+ } catch (ParserConfigurationException e) {
+ storeImportError(e);
+ } catch (SAXException e) {
+ storeImportError(e);
+ } catch (IOException e) {
+ storeImportError(e);
+ } catch (IllegalArgumentException e) {
+ // Bug in parser: can throw IAE even if URL is not null
+ storeImportError(e);
+ }
+ }
+
+ private void storeImportError(Exception e) {
+ exception[0] = new CoreException(new org.eclipse.core.runtime.Status(IStatus.ERROR,
+ UnitTestPlugin.PLUGIN_ID, ModelMessages.UnitTestModel_could_not_import, e));
+ }
+ };
+ importThread.start();
+
+ while (session[0] == null && exception[0] == null && !monitor.isCanceled()) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // that's OK
+ }
+ }
+ if (session[0] == null) {
+ if (exception[0] != null) {
+ throw new InvocationTargetException(exception[0]);
+ } else {
+ importThread.interrupt(); // have to kill the thread since we don't control URLConnection and XML
+ // parsing
+ throw new InterruptedException();
+ }
+ }
+
+ addTestRunSession(session[0]);
+ monitor.done();
+ return session[0];
+ }
+
+ /**
+ * Removes the given {@link TestRunSession} and notifies all registered
+ * {@link ITestRunSessionListener}s.
+ *
+ * @param testRunSession the session to remove
+ * @see org.eclipse.unittest.internal.model.UnitTestModel#addTestRunSession(TestRunSession)
+ */
+ void removeTestRunSession(TestRunSession testRunSession) {
+ boolean existed;
+ synchronized (this) {
+ existed = fTestRunSessions.remove(testRunSession);
+ }
+ if (existed) {
+ notifyTestRunSessionRemoved(testRunSession);
+ }
+ }
+
+ private void notifyTestRunSessionRemoved(TestRunSession testRunSession) {
+ for (ITestRunSessionListener listener : fTestRunSessionListeners) {
+ listener.sessionRemoved(testRunSession);
+ }
+ }
+
+ private void notifyTestRunSessionAdded(ITestRunSession testRunSession) {
+ for (ITestRunSessionListener listener : fTestRunSessionListeners) {
+ listener.sessionAdded(testRunSession);
+ }
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/BasicElementLabels.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/BasicElementLabels.java
new file mode 100644
index 000000000..feab70e81
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/BasicElementLabels.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.io.File;
+
+import org.eclipse.osgi.util.TextProcessor;
+
+import org.eclipse.core.runtime.IPath;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * A label provider for basic elements like paths. The label provider will make
+ * sure that the labels are correctly shown in RTL environments.
+ */
+public class BasicElementLabels {
+
+ private BasicElementLabels() {
+ }
+
+ /**
+ * Adds special marks so that that the given string is readable in a BIDI
+ * environment.
+ *
+ * @param string the string
+ * @param delimiters the additional delimiters
+ * @return the processed styled string
+ */
+ private static String markLTR(String string, String delimiters) {
+ return TextProcessor.process(string, delimiters);
+ }
+
+ /**
+ * Returns the label of a path.
+ *
+ * @param path the path
+ * @param isOSPath if <code>true</code>, the path represents an OS path, if
+ * <code>false</code> it is a workspace path.
+ * @return the label of the path to be used in the UI.
+ */
+ public static String getPathLabel(IPath path, boolean isOSPath) {
+ String label;
+ if (isOSPath) {
+ label = path.toOSString();
+ } else {
+ label = path.makeRelative().toString();
+ }
+ return markLTR(label, "/\\:."); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the label of the path of a file.
+ *
+ * @param file the file
+ * @return the label of the file path to be used in the UI.
+ */
+ public static String getPathLabel(File file) {
+ return markLTR(file.getAbsolutePath(), "/\\:."); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the label for a file pattern like '*.java'
+ *
+ * @param name the pattern
+ * @return the label of the pattern.
+ */
+ public static String getFilePattern(String name) {
+ return markLTR(name, "*.?/\\:."); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the label for a URL, URI or URL part. Example is
+ * 'http://www.x.xom/s.html#1'
+ *
+ * @param name the URL string
+ * @return the label of the URL.
+ */
+ public static String getURLPart(String name) {
+ return markLTR(name, ":@?-#/\\:."); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns a label for a resource name.
+ *
+ * @param resource the resource
+ * @return the label of the resource name.
+ */
+ public static String getResourceName(IResource resource) {
+ return markLTR(resource.getName(), ":."); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns a label for a resource name.
+ *
+ * @param resourceName the resource name
+ * @return the label of the resource name.
+ */
+ public static String getResourceName(String resourceName) {
+ return markLTR(resourceName, ":."); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns a label for a version name. Example is '1.4.1'
+ *
+ * @param name the version string
+ * @return the version label
+ */
+ public static String getVersionName(String name) {
+ return markLTR(name, ":."); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns a label for Java element name. Example is 'new Test<? extends List>()
+ * { ...}'. This method should only be used for simple element names. Use
+ * JavaElementLabels to create a label from a Java element.
+ *
+ * @param name the Java element name.
+ * @return the label for the Java element
+ */
+ public static String getJavaElementName(String name) {
+ return markLTR(name, "<>()?,{}.:"); //$NON-NLS-1$
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultDialog.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultDialog.java
new file mode 100644
index 000000000..67924ba5e
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultDialog.java
@@ -0,0 +1,323 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import org.osgi.framework.FrameworkUtil;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.TrayDialog;
+
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.TextPresentation;
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.jface.text.presentation.IPresentationDamager;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.IPresentationRepairer;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+
+import org.eclipse.ui.PlatformUI;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareViewerPane;
+import org.eclipse.compare.IEncodedStreamContentAccessor;
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.contentmergeviewer.TextMergeViewer;
+import org.eclipse.compare.structuremergeviewer.DiffNode;
+
+/**
+ * A Compare result dialog
+ */
+public class CompareResultDialog extends TrayDialog {
+ private static final String PREFIX_SUFFIX_PROPERTY = UnitTestPlugin.PLUGIN_ID + ".CompareResultDialog.prefixSuffix"; //$NON-NLS-1$
+
+ private static class CompareResultMergeViewer extends TextMergeViewer {
+ private CompareResultMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
+ super(parent, style, configuration);
+ }
+
+ @Override
+ protected void createControls(Composite composite) {
+ super.createControls(composite);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IUnitTestHelpContextIds.RESULT_COMPARE_DIALOG);
+ }
+
+// protected void createToolItems(ToolBarManager tbm) {
+// ResourceBundle bundle= CompareUI.getResourceBundle();
+// tbm.add(new IgnoreWhiteSpaceAction(bundle, getCompareConfiguration()));
+// super.createToolItems(tbm);
+// }
+
+ @Override
+ protected void configureTextViewer(TextViewer textViewer) {
+ if (textViewer instanceof SourceViewer) {
+ int[] prefixSuffixOffsets = (int[]) getCompareConfiguration().getProperty(PREFIX_SUFFIX_PROPERTY);
+ ((SourceViewer) textViewer).configure(new CompareResultViewerConfiguration(prefixSuffixOffsets));
+ }
+ }
+ }
+
+ private static class CompareResultViewerConfiguration extends SourceViewerConfiguration {
+ private static class SimpleDamagerRepairer implements IPresentationDamager, IPresentationRepairer {
+ private IDocument fDocument;
+ private final int[] fPrefixSuffixOffsets2;
+
+ public SimpleDamagerRepairer(int[] prefixSuffixOffsets) {
+ fPrefixSuffixOffsets2 = prefixSuffixOffsets;
+ }
+
+ @Override
+ public void setDocument(IDocument document) {
+ fDocument = document;
+ }
+
+ @Override
+ public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, boolean changed) {
+ return new Region(0, fDocument.getLength());
+ }
+
+ @Override
+ public void createPresentation(TextPresentation presentation, ITypedRegion damage) {
+ presentation.setDefaultStyleRange(new StyleRange(0, fDocument.getLength(), null, null));
+ int prefix = fPrefixSuffixOffsets2[0];
+ int suffix = fPrefixSuffixOffsets2[1];
+ TextAttribute attr = new TextAttribute(Display.getDefault().getSystemColor(SWT.COLOR_RED));
+ presentation.addStyleRange(new StyleRange(prefix, fDocument.getLength() - suffix - prefix,
+ attr.getForeground(), attr.getBackground(), attr.getStyle()));
+ }
+ }
+
+ private final int[] fPrefixSuffixOffsets;
+
+ public CompareResultViewerConfiguration(int[] prefixSuffixOffsets) {
+ fPrefixSuffixOffsets = prefixSuffixOffsets;
+ }
+
+ @Override
+ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+ SimpleDamagerRepairer dr = new SimpleDamagerRepairer(fPrefixSuffixOffsets);
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ return reconciler;
+ }
+ }
+
+ private static class CompareElement implements ITypedElement, IEncodedStreamContentAccessor {
+ private String fContent;
+
+ public CompareElement(String content) {
+ fContent = content;
+ }
+
+ @Override
+ public String getName() {
+ return "<no name>"; //$NON-NLS-1$
+ }
+
+ @Override
+ public Image getImage() {
+ return null;
+ }
+
+ @Override
+ public String getType() {
+ return "txt"; //$NON-NLS-1$
+ }
+
+ @Override
+ public InputStream getContents() {
+ return new ByteArrayInputStream(fContent.getBytes(StandardCharsets.UTF_8));
+ }
+
+ @Override
+ public String getCharset() throws CoreException {
+ return "UTF-8"; //$NON-NLS-1$
+ }
+ }
+
+ private TextMergeViewer fViewer;
+ private FailureTrace trace;
+ private String fTestName;
+
+ /**
+ * Lengths of common prefix and suffix. Note: this array is passed to the
+ * DamagerRepairer and the lengths are updated on content change.
+ */
+ private final int[] fPrefixSuffix = new int[2];
+
+ private CompareViewerPane fCompareViewerPane;
+
+ /**
+ * Constructs a compare results dialog
+ *
+ * @param parentShell a parent shell object
+ * @param element a {@link TestElement} object
+ */
+ public CompareResultDialog(Shell parentShell, TestElement element) {
+ super(parentShell);
+ setShellStyle((getShellStyle() & ~SWT.APPLICATION_MODAL) | SWT.TOOL);
+ setFailedTest(element);
+ }
+
+ @Override
+ protected boolean isResizable() {
+ return true;
+ }
+
+ private void setFailedTest(TestElement failedTest) {
+ fTestName = failedTest.getTestName();
+ trace = failedTest.getFailureTrace();
+ computePrefixSuffix();
+ }
+
+ @Override
+ protected IDialogSettings getDialogBoundsSettings() {
+ return getDialogSettingsSection(getClass().getName());
+ }
+
+ /**
+ * Returns the section with the given name in this dialog settings.
+ *
+ * @param name the key
+ * @return {@link IDialogSettings} (the section)
+ */
+ private IDialogSettings getDialogSettingsSection(String name) {
+ IDialogSettings dialogSettings = PlatformUI.getDialogSettingsProvider(FrameworkUtil.getBundle(getClass()))
+ .getDialogSettings();
+ IDialogSettings section = dialogSettings.getSection(name);
+ if (section == null) {
+ section = dialogSettings.addNewSection(name);
+ }
+ return section;
+ }
+
+ private void computePrefixSuffix() {
+ String expected = trace.getExpected();
+ String actual = trace.getActual();
+ int end = Math.min(expected.length(), actual.length());
+ int i = 0;
+ for (; i < end; i++)
+ if (expected.charAt(i) != actual.charAt(i))
+ break;
+ fPrefixSuffix[0] = i;
+
+ int j = expected.length() - 1;
+ int k = actual.length() - 1;
+ int l = 0;
+ for (; k >= i && j >= i; k--, j--) {
+ if (expected.charAt(j) != actual.charAt(k))
+ break;
+ l++;
+ }
+ fPrefixSuffix[1] = l;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.CompareResultDialog_title);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IUnitTestHelpContextIds.RESULT_COMPARE_DIALOG);
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+
+ fCompareViewerPane = new CompareViewerPane(composite, SWT.BORDER | SWT.FLAT);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
+ data.widthHint = convertWidthInCharsToPixels(120);
+ data.heightHint = convertHeightInCharsToPixels(13);
+ fCompareViewerPane.setLayoutData(data);
+
+ Control previewer = createPreviewer(fCompareViewerPane);
+ fCompareViewerPane.setContent(previewer);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ previewer.setLayoutData(gd);
+ applyDialogFont(parent);
+ return composite;
+ }
+
+ private Control createPreviewer(Composite parent) {
+ final CompareConfiguration compareConfiguration = new CompareConfiguration();
+ compareConfiguration.setLeftLabel(Messages.CompareResultDialog_expectedLabel);
+ compareConfiguration.setLeftEditable(false);
+ compareConfiguration.setRightLabel(Messages.CompareResultDialog_actualLabel);
+ compareConfiguration.setRightEditable(false);
+ compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);
+ compareConfiguration.setProperty(PREFIX_SUFFIX_PROPERTY, fPrefixSuffix);
+
+ fViewer = new CompareResultMergeViewer(parent, SWT.NONE, compareConfiguration);
+ setCompareViewerInput();
+
+ Control control = fViewer.getControl();
+ control.addDisposeListener(e -> compareConfiguration.dispose());
+ return control;
+ }
+
+ private void setCompareViewerInput() {
+ if (!fViewer.getControl().isDisposed()) {
+ fViewer.setInput(
+ new DiffNode(new CompareElement(trace.getExpected()), new CompareElement(trace.getActual())));
+ fCompareViewerPane.setText(fTestName);
+ }
+ }
+
+ /**
+ * Sets a failed {@link ITestElement} as input for the CompareResultDialog
+ *
+ * @param failedTest a failed test element
+ */
+ public void setInput(TestElement failedTest) {
+ setFailedTest(failedTest);
+ setCompareViewerInput();
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultsAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultsAction.java
new file mode 100644
index 000000000..40082dc84
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CompareResultsAction.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.model.ITestElement;
+
+import org.eclipse.jface.action.Action;
+
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action to enable/disable stack trace filtering.
+ */
+public class CompareResultsAction extends Action {
+
+ private FailureTraceUIBlock fView;
+ private CompareResultDialog fOpenDialog;
+
+ /**
+ * Constructs a compare result object
+ *
+ * @param view a {@link FailureTraceUIBlock} object
+ */
+ public CompareResultsAction(FailureTraceUIBlock view) {
+ super(Messages.CompareResultsAction_label);
+ setDescription(Messages.CompareResultsAction_description);
+ setToolTipText(Messages.CompareResultsAction_tooltip);
+
+ setDisabledImageDescriptor(Images.getImageDescriptor("dlcl16/compare.png")); //$NON-NLS-1$
+ setHoverImageDescriptor(Images.getImageDescriptor("elcl16/compare.png")); //$NON-NLS-1$
+ setImageDescriptor(Images.getImageDescriptor("elcl16/compare.png")); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IUnitTestHelpContextIds.ENABLEFILTER_ACTION);
+ fView = view;
+ }
+
+ @Override
+ public void run() {
+ TestElement failedTest = fView.getFailedTest();
+ if (fOpenDialog != null) {
+ fOpenDialog.setInput(failedTest);
+ fOpenDialog.getShell().setActive();
+
+ } else {
+ fOpenDialog = new CompareResultDialog(fView.getShell(), failedTest);
+ fOpenDialog.create();
+ fOpenDialog.getShell().addDisposeListener(e -> fOpenDialog = null);
+ fOpenDialog.setBlockOnOpen(false);
+ fOpenDialog.open();
+ }
+ }
+
+ /**
+ * Updates the CompareResultDialog with a failed {@link ITestElement} as input
+ *
+ * @param failedTest a failed test element
+ */
+ public void updateOpenDialog(TestElement failedTest) {
+ if (fOpenDialog != null) {
+ fOpenDialog.setInput(failedTest);
+ }
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CopyFailureListAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CopyFailureListAction.java
new file mode 100644
index 000000000..68cf68bcc
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CopyFailureListAction.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Copies the names of the methods that failed and their traces to the
+ * clipboard.
+ */
+public class CopyFailureListAction extends Action {
+
+ private final Clipboard fClipboard;
+ private final TestRunnerViewPart fRunner;
+
+ /**
+ * Constructs a copy failure list action object
+ *
+ * @param runner a test runner view part object
+ * @param clipboard a clipboard object
+ */
+ public CopyFailureListAction(TestRunnerViewPart runner, Clipboard clipboard) {
+ super(Messages.CopyFailureList_action_label);
+ fRunner = runner;
+ fClipboard = clipboard;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IUnitTestHelpContextIds.COPYFAILURELIST_ACTION);
+ }
+
+ @Override
+ public void run() {
+ TextTransfer plainTextTransfer = TextTransfer.getInstance();
+
+ try {
+ fClipboard.setContents(new String[] { getAllFailureTraces() }, new Transfer[] { plainTextTransfer });
+ } catch (SWTError e) {
+ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
+ throw e;
+ if (MessageDialog.openQuestion(fRunner.getSite().getShell(), Messages.CopyFailureList_problem,
+ Messages.CopyFailureList_clipboard_busy))
+ run();
+ }
+ }
+
+ /**
+ * Returns the failure trace lines as a string
+ *
+ * @return a failure traces string
+ */
+ public String getAllFailureTraces() {
+ StringBuilder buf = new StringBuilder();
+ String lineDelim = System.getProperty("line.separator", "\n"); //$NON-NLS-1$//$NON-NLS-2$
+ for (TestElement failure : fRunner.getCurrentTestRunSession().getAllFailedTestElements()) {
+ buf.append(failure.getTestName()).append(lineDelim);
+ FailureTrace failureTrace = failure.getFailureTrace();
+ String trace = failureTrace != null ? failureTrace.getTrace() : null;
+ if (trace != null) {
+ int start = 0;
+ while (start < trace.length()) {
+ int idx = trace.indexOf('\n', start);
+ if (idx != -1) {
+ String line = trace.substring(start, idx);
+ buf.append(line).append(lineDelim);
+ start = idx + 1;
+ } else {
+ start = Integer.MAX_VALUE;
+ }
+ }
+ }
+ }
+ return buf.toString();
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CounterPanel.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CounterPanel.java
new file mode 100644
index 000000000..8e7959b99
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/CounterPanel.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.text.MessageFormat;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * A panel with counters for the number of Runs, Errors and Failures.
+ */
+public class CounterPanel extends Composite {
+ protected Text fNumberOfErrors;
+ protected Text fNumberOfFailures;
+ protected Text fNumberOfRuns;
+ protected Integer fTotal;
+ protected int fIgnoredCount;
+ protected int fAssumptionFailedCount;
+
+ private final Image fErrorIcon = Images.createImage("ovr16/error_ovr.png"); //$NON-NLS-1$
+ private final Image fFailureIcon = Images.createImage("ovr16/failed_ovr.png"); //$NON-NLS-1$
+
+ /**
+ * Constructs a CounterPanel object
+ *
+ * @param parent a parent composite
+ */
+ public CounterPanel(Composite parent) {
+ super(parent, SWT.WRAP);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 9;
+ gridLayout.makeColumnsEqualWidth = false;
+ gridLayout.marginWidth = 0;
+ setLayout(gridLayout);
+
+ fNumberOfRuns = createLabel(Messages.CounterPanel_label_runs, null, " 0/0 "); //$NON-NLS-1$
+ fNumberOfErrors = createLabel(Messages.CounterPanel_label_errors, fErrorIcon, " 0 "); //$NON-NLS-1$
+ fNumberOfFailures = createLabel(Messages.CounterPanel_label_failures, fFailureIcon, " 0 "); //$NON-NLS-1$
+
+ addDisposeListener(e -> disposeIcons());
+ }
+
+ private void disposeIcons() {
+ fErrorIcon.dispose();
+ fFailureIcon.dispose();
+ }
+
+ private Text createLabel(String name, Image image, String init) {
+ Label label = new Label(this, SWT.NONE);
+ if (image != null) {
+ image.setBackground(label.getBackground());
+ label.setImage(image);
+ }
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ label = new Label(this, SWT.NONE);
+ label.setText(name);
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+ // label.setFont(JFaceResources.getBannerFont());
+
+ Text value = new Text(this, SWT.READ_ONLY);
+ value.setText(init);
+ fixReadonlyTextBackground(value);
+ value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING));
+ return value;
+ }
+
+ /**
+ * Resets the counters presented on the panel
+ */
+ public void reset() {
+ fTotal = null;
+ setErrorValue(0);
+ setFailureValue(0);
+ setRunValue(0, 0, 0);
+ }
+
+ /**
+ * Sets the total count value
+ *
+ * @param value total count value, can be <code>null</code> if unknown yet
+ */
+ public void setTotal(Integer value) {
+ fTotal = value;
+ }
+
+ /**
+ * Sets the run counter values
+ *
+ * @param value a run counter value
+ * @param ignoredCount an ignored tests counter value
+ * @param assumptionFailureCount a number of assumption failure counter value
+ */
+ public void setRunValue(int value, int ignoredCount, int assumptionFailureCount) {
+ String runString;
+ String runStringTooltip;
+ String totalString = fTotal == null ? "?" : fTotal.toString(); //$NON-NLS-1$
+ if (ignoredCount == 0 && assumptionFailureCount == 0) {
+ runString = MessageFormat.format(Messages.CounterPanel_runcount, Integer.toString(value), totalString);
+ runStringTooltip = runString;
+ } else if (ignoredCount != 0 && assumptionFailureCount == 0) {
+ runString = MessageFormat.format(Messages.CounterPanel_runcount_skipped, Integer.toString(value),
+ totalString, Integer.toString(ignoredCount));
+ runStringTooltip = MessageFormat.format(Messages.CounterPanel_runcount_ignored, Integer.toString(value),
+ totalString, Integer.toString(ignoredCount));
+ } else if (ignoredCount == 0 && assumptionFailureCount != 0) {
+ runString = MessageFormat.format(Messages.CounterPanel_runcount_skipped, Integer.toString(value),
+ totalString, Integer.toString(assumptionFailureCount));
+ runStringTooltip = MessageFormat.format(Messages.CounterPanel_runcount_assumptionsFailed,
+ Integer.toString(value), totalString, Integer.toString(assumptionFailureCount));
+ } else {
+ runString = MessageFormat.format(Messages.CounterPanel_runcount_skipped, Integer.toString(value),
+ totalString, Integer.toString(ignoredCount + assumptionFailureCount));
+ runStringTooltip = MessageFormat.format(Messages.CounterPanel_runcount_ignored_assumptionsFailed,
+ Integer.toString(value), totalString, Integer.toString(ignoredCount),
+ Integer.toString(assumptionFailureCount));
+ }
+ fNumberOfRuns.setText(runString);
+ fNumberOfRuns.setToolTipText(runStringTooltip);
+
+ if (fIgnoredCount == 0 && ignoredCount > 0 || fIgnoredCount != 0 && ignoredCount == 0) {
+ layout();
+ } else if (fAssumptionFailedCount == 0 && assumptionFailureCount > 0
+ || fAssumptionFailedCount != 0 && assumptionFailureCount == 0) {
+ layout();
+ } else {
+ fNumberOfRuns.redraw();
+ redraw();
+ }
+ fIgnoredCount = ignoredCount;
+ fAssumptionFailedCount = assumptionFailureCount;
+ }
+
+ /**
+ * Sets an error counter value
+ *
+ * @param value am error counter value
+ */
+ public void setErrorValue(int value) {
+ fNumberOfErrors.setText(Integer.toString(value));
+ redraw();
+ }
+
+ /**
+ * Sets a failure counter value
+ *
+ * @param value a failure counter value
+ */
+ public void setFailureValue(int value) {
+ fNumberOfFailures.setText(Integer.toString(value));
+ redraw();
+ }
+
+ /**
+ * Fixes https://bugs.eclipse.org/71765 by setting the background color to
+ * {@code SWT.COLOR_WIDGET_BACKGROUND}.
+ * <p>
+ * Should be applied to all SWT.READ_ONLY Texts in dialogs (or at least those
+ * which don't have an SWT.BORDER). Search regex:
+ * {@code new Text\([^,]+,[^\)]+SWT\.READ_ONLY}
+ *
+ * @param textField the text field
+ */
+ public static void fixReadonlyTextBackground(Text textField) {
+ textField.setBackground(textField.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/EnableStackFilterAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/EnableStackFilterAction.java
new file mode 100644
index 000000000..df2ecc85e
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/EnableStackFilterAction.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.unittest.internal.UnitTestPreferencesConstants;
+
+import org.eclipse.jface.action.Action;
+
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action to enable/disable stack trace filtering.
+ */
+public class EnableStackFilterAction extends Action {
+
+ private FailureTraceUIBlock fView;
+
+ /**
+ * Constructs an enable stack filter action object
+ *
+ * @param view a {@link FailureTraceUIBlock} object
+ */
+ public EnableStackFilterAction(FailureTraceUIBlock view) {
+ super(Messages.EnableStackFilterAction_action_label);
+ setDescription(Messages.EnableStackFilterAction_action_description);
+ setToolTipText(Messages.EnableStackFilterAction_action_tooltip);
+
+ setDisabledImageDescriptor(Images.getImageDescriptor("dlcl16/cfilter.png")); //$NON-NLS-1$
+ setHoverImageDescriptor(Images.getImageDescriptor("elcl16/cfilter.png")); //$NON-NLS-1$
+ setImageDescriptor(Images.getImageDescriptor("elcl16/cfilter.png")); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IUnitTestHelpContextIds.ENABLEFILTER_ACTION);
+
+ fView = view;
+ setChecked(UnitTestPreferencesConstants.getFilterStack());
+ }
+
+ @Override
+ public void run() {
+ UnitTestPreferencesConstants.setFilterStack(isChecked());
+ fView.refresh();
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTableDisplay.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTableDisplay.java
new file mode 100644
index 000000000..9d0a27adc
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTableDisplay.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * A failure table display
+ */
+public class FailureTableDisplay implements ITraceDisplay {
+ private final Table fTable;
+
+ private final Image fExceptionIcon = Images.createImage("obj16/exc_catch.png"); //$NON-NLS-1$
+
+ private final Image fStackIcon = Images.createImage("obj16/stkfrm_obj.png"); //$NON-NLS-1$
+
+ /**
+ * Constructs a failure table display
+ *
+ * @param table a table object
+ */
+ public FailureTableDisplay(Table table) {
+ fTable = table;
+ fTable.getParent().addDisposeListener(e -> disposeIcons());
+ }
+
+ @Override
+ public void addTraceLine(int lineType, String label) {
+ TableItem tableItem = newTableItem();
+ switch (lineType) {
+ case TextualTrace.LINE_TYPE_EXCEPTION:
+ tableItem.setImage(fExceptionIcon);
+ break;
+ case TextualTrace.LINE_TYPE_STACKFRAME:
+ tableItem.setImage(fStackIcon);
+ break;
+ case TextualTrace.LINE_TYPE_NORMAL:
+ default:
+ break;
+ }
+ tableItem.setText(label);
+ }
+
+ /**
+ * Returns an exception icon image
+ *
+ * @return an exception icon image
+ */
+ public Image getExceptionIcon() {
+ return fExceptionIcon;
+ }
+
+ /**
+ * Returns a stack icon image
+ *
+ * @return a stack icon image
+ */
+ public Image getStackIcon() {
+ return fStackIcon;
+ }
+
+ /**
+ * Returns a table object
+ *
+ * @return a table object
+ */
+ public Table getTable() {
+ return fTable;
+ }
+
+ private void disposeIcons() {
+ if (fExceptionIcon != null && !fExceptionIcon.isDisposed())
+ fExceptionIcon.dispose();
+ if (fStackIcon != null && !fStackIcon.isDisposed())
+ fStackIcon.dispose();
+ }
+
+ /**
+ * Returns a new table item
+ *
+ * @return a table item object instance
+ */
+ public TableItem newTableItem() {
+ return new TableItem(fTable, SWT.NONE);
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTraceUIBlock.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTraceUIBlock.java
new file mode 100644
index 000000000..9800f4c60
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/FailureTraceUIBlock.java
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Objects;
+
+import org.eclipse.unittest.internal.UnitTestPreferencesConstants;
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.model.ITestRunSession;
+import org.eclipse.unittest.ui.ITestViewSupport;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.ToolBar;
+
+import org.eclipse.core.text.StringMatcher;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.util.OpenStrategy;
+
+/**
+ * A pane that shows a stack trace of a failed test.
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public class FailureTraceUIBlock implements IMenuListener {
+
+ private static final int MAX_LABEL_LENGTH = 256;
+ private Table fTable;
+ private TestRunnerViewPart fTestRunner;
+ private String fInputTrace;
+ private final Clipboard fClipboard;
+ private TestElement fFailure;
+ private CompareResultsAction fCompareAction;
+ private final FailureTableDisplay fFailureTableDisplay;
+ private ShowStackTraceInConsoleViewAction fShowTraceInConsoleAction;
+
+ /**
+ * Constructs a {@link FailureTraceUIBlock} object
+ *
+ * @param parent a parent composite
+ * @param clipboard a {@link Clipboard} instance
+ * @param testRunner a Test Runner view part
+ * @param toolBar a {@link ToolBar} instance
+ */
+ public FailureTraceUIBlock(Composite parent, Clipboard clipboard, TestRunnerViewPart testRunner, ToolBar toolBar) {
+ Assert.isNotNull(clipboard);
+
+ // fill the failure trace viewer toolbar
+ ToolBarManager failureToolBarmanager = new ToolBarManager(toolBar);
+ fShowTraceInConsoleAction = new ShowStackTraceInConsoleViewAction();
+ fShowTraceInConsoleAction.setDelegate(null);
+ fShowTraceInConsoleAction.setEnabled(false);
+ failureToolBarmanager.add(fShowTraceInConsoleAction);
+ failureToolBarmanager.add(new EnableStackFilterAction(this));
+ fCompareAction = new CompareResultsAction(this);
+ fCompareAction.setEnabled(false);
+ failureToolBarmanager.add(fCompareAction);
+ failureToolBarmanager.update(true);
+ fTable = new Table(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
+ fTestRunner = testRunner;
+ fClipboard = clipboard;
+
+ OpenStrategy handler = new OpenStrategy(fTable);
+ handler.addOpenListener(e -> {
+ if (fTable.getSelectionIndex() == 0 && fFailure.getFailureTrace() != null
+ && fFailure.getFailureTrace().isComparisonFailure()) {
+ fCompareAction.run();
+ }
+ if (fTable.getSelection().length != 0) {
+ IAction a = createOpenEditorAction(getSelectedText());
+ if (a != null)
+ a.run();
+ }
+ });
+
+ initMenu();
+
+ fFailureTableDisplay = new FailureTableDisplay(fTable);
+ }
+
+ private void initMenu() {
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(this);
+ Menu menu = menuMgr.createContextMenu(fTable);
+ fTable.setMenu(menu);
+ }
+
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ if (fTable.getSelectionCount() > 0) {
+ IAction a = createOpenEditorAction(getSelectedText());
+ if (a != null)
+ manager.add(a);
+ manager.add(new UnitTestCopyAction(FailureTraceUIBlock.this, fClipboard));
+ }
+ // fix for bug 68058
+ if (fFailure != null && fFailure.getFailureTrace() != null
+ && fFailure.getFailureTrace().isComparisonFailure()) {
+ manager.add(fCompareAction);
+ }
+ }
+
+ /**
+ * Returns the current trace
+ *
+ * @return a current trace or <code>null</code>
+ */
+ public String getTrace() {
+ return fInputTrace;
+ }
+
+ private String getSelectedText() {
+ return fTable.getSelection()[0].getText();
+ }
+
+ private IAction createOpenEditorAction(String traceLine) {
+ return fFailure.getTestRunSession().getTestViewSupport()
+ .createOpenEditorAction(fTestRunner.getSite().getShell(), fFailure, traceLine);
+ }
+
+ /**
+ * Returns the composite used to present the trace
+ *
+ * @return The composite
+ */
+ public Composite getComposite() {
+ return fTable;
+ }
+
+ /**
+ * Refresh the table from the trace.
+ */
+ public void refresh() {
+ updateTable(fInputTrace);
+ }
+
+ /**
+ * Shows a TestFailure
+ *
+ * @param test the failed test
+ */
+ public void showFailure(TestElement test) {
+ fFailure = test;
+ String trace = ""; //$NON-NLS-1$
+ updateActions(test);
+ updateEnablement(test);
+ if (test != null && test.getFailureTrace() != null) {
+ trace = test.getFailureTrace().getTrace();
+ }
+ if (Objects.equals(fInputTrace, trace)) {
+ return;
+ }
+ fInputTrace = trace;
+ updateTable(trace);
+ }
+
+ private void updateActions(TestElement test) {
+ ITestViewSupport testViewSupport = test != null ? test.getTestRunSession().getTestViewSupport() : null;
+ fShowTraceInConsoleAction.setDelegate(testViewSupport != null && test.getFailureTrace() != null
+ ? testViewSupport.createShowStackTraceInConsoleViewActionDelegate(test)
+ : null);
+ }
+
+ private void updateEnablement(TestElement test) {
+ boolean enableCompare = test != null && test.getFailureTrace() != null
+ && test.getFailureTrace().isComparisonFailure();
+ fCompareAction.setEnabled(enableCompare);
+ if (enableCompare) {
+ fCompareAction.updateOpenDialog(test);
+ }
+
+ boolean enableShowTraceInConsole = test != null && test.getFailureTrace() != null;
+ fShowTraceInConsoleAction.setEnabled(enableShowTraceInConsole);
+ }
+
+ private void updateTable(String trace) {
+ if (trace == null || trace.trim().isEmpty()) {
+ clear();
+ return;
+ }
+ trace = trace.trim();
+ fTable.setRedraw(false);
+ fTable.removeAll();
+ new TextualTrace(trace, getFilterPatterns()).display(fFailureTableDisplay, MAX_LABEL_LENGTH);
+ fTable.setRedraw(true);
+ }
+
+ private Collection<StringMatcher> getFilterPatterns() {
+ if (UnitTestPreferencesConstants.getFilterStack())
+ return getFilterPatterns(fFailure.getTestRunSession());
+ return Collections.emptySet();
+ }
+
+ /**
+ * Returns an array of Filter patterns for Stacktraces/Error messages
+ *
+ * @param session a {@link ITestRunSession} to ask the filter pattern for
+ * @return an array of filter patterns
+ */
+ public Collection<StringMatcher> getFilterPatterns(ITestRunSession session) {
+ if (session == null) {
+ return Collections.emptySet();
+ }
+ ITestViewSupport viewSupport = ((TestRunSession) session).getTestViewSupport();
+ if (viewSupport != null) {
+ Collection<StringMatcher> res = viewSupport.getTraceExclusionFilterPatterns();
+ if (res != null) {
+ return res;
+ }
+ }
+ return Collections.emptySet();
+ }
+
+ /**
+ * Shows other information than a stack trace.
+ *
+ * @param text the informational message to be shown
+ */
+ public void setInformation(String text) {
+ clear();
+ TableItem tableItem = fFailureTableDisplay.newTableItem();
+ tableItem.setText(text);
+ }
+
+ /**
+ * Clears the non-stack trace info
+ */
+ public void clear() {
+ fTable.removeAll();
+ fInputTrace = null;
+ }
+
+ /**
+ * Returns a failed test element
+ *
+ * @return a failed test element
+ */
+ public TestElement getFailedTest() {
+ return fFailure;
+ }
+
+ /**
+ * Returns a shell object
+ *
+ * @return a shell object
+ */
+ public Shell getShell() {
+ return fTable.getShell();
+ }
+
+ /**
+ * Disposes the Failure trace UI Block
+ */
+ public void dispose() {
+ // Nothing to dispose
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ITraceDisplay.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ITraceDisplay.java
new file mode 100644
index 000000000..581ac594a
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ITraceDisplay.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+/**
+ * A trace display interface
+ */
+public interface ITraceDisplay {
+
+ /**
+ * Adds a trace text line
+ *
+ * @param lineType a type of trace line
+ * @param label a trace line text
+ */
+ void addTraceLine(int lineType, String label);
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/IUnitTestHelpContextIds.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/IUnitTestHelpContextIds.java
new file mode 100644
index 000000000..b0d4e5d37
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/IUnitTestHelpContextIds.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+
+/**
+ * Help context ids for the Unit Test UI.
+ */
+public interface IUnitTestHelpContextIds {
+ String PREFIX = UnitTestPlugin.PLUGIN_ID + '.';
+
+ // Actions
+ String COPYTRACE_ACTION = PREFIX + "copy_trace_action_context"; //$NON-NLS-1$
+ String COPYFAILURELIST_ACTION = PREFIX + "copy_failure_list_action_context"; //$NON-NLS-1$
+ String ENABLEFILTER_ACTION = PREFIX + "enable_filter_action_context"; //$NON-NLS-1$
+ String OPENEDITORATLINE_ACTION = PREFIX + "open_editor_atline_action_context"; //$NON-NLS-1$
+ String OPENTEST_ACTION = PREFIX + "open_test_action_context"; //$NON-NLS-1$
+ String RERUN_ACTION = PREFIX + "rerun_test_action_context"; //$NON-NLS-1$
+ String GOTO_REFERENCED_TEST_ACTION_CONTEXT = PREFIX + "goto_referenced_test_action_context"; //$NON-NLS-1$
+ String OUTPUT_SCROLL_LOCK_ACTION = PREFIX + "scroll_lock"; //$NON-NLS-1$
+
+ // view parts
+ String RESULTS_VIEW = PREFIX + "results_view_context"; //$NON-NLS-1$
+ String RESULTS_VIEW_TOGGLE_ORIENTATION_ACTION = PREFIX + "results_view_toggle_call_mode_action_context"; //$NON-NLS-1$
+
+ // Dialogs
+ String TEST_SELECTION_DIALOG = PREFIX + "test_selection_context"; //$NON-NLS-1$
+ String RESULT_COMPARE_DIALOG = PREFIX + "result_compare_context"; //$NON-NLS-1$
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Images.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Images.java
new file mode 100644
index 000000000..6c7423b71
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Images.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.net.URL;
+
+import org.osgi.framework.Bundle;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Image related utilities
+ */
+public class Images {
+
+ private static final IPath ICONS_PATH = new Path("$nl$/icons/full"); //$NON-NLS-1$
+
+ /**
+ * Create an {@link ImageDescriptor} from a given path
+ *
+ * @param relativePath relative path to the image
+ * @return an {@link ImageDescriptor}, or <code>null</code> iff there's no image
+ * at the given location and <code>useMissingImageDescriptor</code> is
+ * <code>true</code>
+ */
+ public static ImageDescriptor getImageDescriptor(String relativePath) {
+ IPath path = ICONS_PATH.append(relativePath);
+ return createImageDescriptor(UnitTestPlugin.getDefault().getBundle(), path, true);
+ }
+
+ /**
+ * Creates an {@link Image} from a given path
+ *
+ * @param path path to the image
+ * @return a new image or <code>null</code> if the image could not be created
+ */
+ public static Image createImage(String path) {
+ return getImageDescriptor(path).createImage();
+ }
+
+ /**
+ * Sets the three image descriptors for enabled, disabled, and hovered to an
+ * action. The actions are retrieved from the *lcl16 folders.
+ *
+ * @param action the action
+ * @param iconName the icon name
+ */
+ public static void setLocalImageDescriptors(IAction action, String iconName) {
+ setImageDescriptors(action, "lcl16", iconName); //$NON-NLS-1$
+ }
+
+ private static void setImageDescriptors(IAction action, String type, String relPath) {
+ ImageDescriptor id = createImageDescriptor("d" + type, relPath, false); //$NON-NLS-1$
+ if (id != null)
+ action.setDisabledImageDescriptor(id);
+
+ ImageDescriptor descriptor = createImageDescriptor("e" + type, relPath, true); //$NON-NLS-1$
+ action.setHoverImageDescriptor(descriptor);
+ action.setImageDescriptor(descriptor);
+ }
+
+ /*
+ * Creates an image descriptor for the given prefix and name in the JDT UI
+ * bundle. The path can contain variables like $NL$. If no image could be found,
+ * <code>useMissingImageDescriptor</code> decides if either the 'missing image
+ * descriptor' is returned or <code>null</code>. or <code>null</code>.
+ */
+ private static ImageDescriptor createImageDescriptor(String pathPrefix, String imageName,
+ boolean useMissingImageDescriptor) {
+ IPath path = ICONS_PATH.append(pathPrefix).append(imageName);
+ return createImageDescriptor(UnitTestPlugin.getDefault().getBundle(), path, useMissingImageDescriptor);
+ }
+
+ /**
+ * Creates an image descriptor for the given path in a bundle. The path can
+ * contain variables like $NL$. If no image could be found,
+ * <code>useMissingImageDescriptor</code> decides if either the 'missing image
+ * descriptor' is returned or <code>null</code>.
+ *
+ * @param bundle a bundle
+ * @param path path in the bundle
+ * @param useMissingImageDescriptor if <code>true</code>, returns the shared
+ * image descriptor for a missing image.
+ * Otherwise, returns <code>null</code> if the
+ * image could not be found
+ * @return an {@link ImageDescriptor}, or <code>null</code> iff there's no image
+ * at the given location and <code>useMissingImageDescriptor</code> is
+ * <code>true</code>
+ */
+ private static ImageDescriptor createImageDescriptor(Bundle bundle, IPath path, boolean useMissingImageDescriptor) {
+ URL url = FileLocator.find(bundle, path, null);
+ if (url != null) {
+ return ImageDescriptor.createFromURL(url);
+ }
+ if (useMissingImageDescriptor) {
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.java
new file mode 100644
index 000000000..3d4bcad5f
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Unit Test View UI Messages
+ */
+public final class Messages extends NLS {
+
+ static {
+ NLS.initializeMessages(Messages.class.getName(), Messages.class);
+ }
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ public static String CompareResultDialog_actualLabel;
+ public static String CompareResultDialog_expectedLabel;
+ public static String CompareResultDialog_title;
+ public static String CompareResultsAction_description;
+ public static String CompareResultsAction_label;
+ public static String CompareResultsAction_tooltip;
+
+ public static String CopyFailureList_action_label;
+ public static String CopyFailureList_clipboard_busy;
+ public static String CopyFailureList_problem;
+
+ public static String CopyTrace_action_label;
+ public static String CopyTraceAction_clipboard_busy;
+ public static String CopyTraceAction_problem;
+
+ public static String CounterPanel_label_errors;
+ public static String CounterPanel_label_failures;
+ public static String CounterPanel_label_runs;
+ public static String CounterPanel_runcount;
+ public static String CounterPanel_runcount_assumptionsFailed;
+ public static String CounterPanel_runcount_ignored;
+ public static String CounterPanel_runcount_skipped;
+ public static String CounterPanel_runcount_ignored_assumptionsFailed;
+
+ public static String EnableStackFilterAction_action_description;
+ public static String EnableStackFilterAction_action_label;
+ public static String EnableStackFilterAction_action_tooltip;
+
+ public static String ExpandAllAction_text;
+ public static String ExpandAllAction_tooltip;
+
+ public static String CollapseAllAction_text;
+ public static String CollapseAllAction_tooltip;
+
+ public static String RerunAction_label_debug;
+ public static String RerunAction_label_run;
+ public static String RerunAction_label_rerun;
+
+ public static String ScrollLockAction_action_label;
+ public static String ScrollLockAction_action_tooltip;
+
+ public static String ShowNextFailureAction_label;
+ public static String ShowNextFailureAction_tooltip;
+
+ public static String ShowPreviousFailureAction_label;
+ public static String ShowPreviousFailureAction_tooltip;
+
+ public static String ShowStackTraceInConsoleViewAction_description;
+ public static String ShowStackTraceInConsoleViewAction_label;
+ public static String ShowStackTraceInConsoleViewAction_tooltip;
+
+ public static String TestRunnerViewPart_activate_on_failure_only;
+ public static String TestRunnerViewPart_cannotrerun_title;
+ public static String TestRunnerViewPart_cannotrerurn_message;
+ public static String TestRunnerViewPart_configName;
+ public static String TestRunnerViewPart__error_cannotrun;
+ public static String TestRunnerViewPart_error_cannotrerun;
+ public static String TestRunnerViewPart_error_no_tests_found;
+
+ public static String TestRunnerViewPart_jobName;
+
+ public static String TestRunnerViewPart_label_failure;
+ public static String TestRunnerViewPart_Launching;
+ public static String TestRunnerViewPart_message_finish;
+ public static String TestRunnerViewPart_message_stopped;
+ public static String TestRunnerViewPart_message_terminated;
+ public static String TestRunnerViewPart_rerunaction_label;
+ public static String TestRunnerViewPart_rerunaction_tooltip;
+ public static String TestRunnerViewPart_rerunfailuresaction_label;
+ public static String TestRunnerViewPart_rerunfailuresaction_tooltip;
+ public static String TestRunnerViewPart_rerunFailedFirstLaunchConfigName;
+ public static String TestRunnerViewPart_stopaction_text;
+ public static String TestRunnerViewPart_stopaction_tooltip;
+ public static String TestRunnerViewPart_terminate_message;
+ public static String TestRunnerViewPart_terminate_title;
+ public static String TestRunnerViewPart_toggle_automatic_label;
+ public static String TestRunnerViewPart_toggle_horizontal_label;
+ public static String TestRunnerViewPart_toggle_vertical_label;
+ public static String TestRunnerViewPart_titleToolTip;
+ public static String TestRunnerViewPart_wrapperJobName;
+ public static String TestRunnerViewPart_show_execution_time;
+ public static String TestRunnerViewPart_show_failures_only;
+ public static String TestRunnerViewPart_show_ignored_only;
+
+ public static String TestRunnerViewPart_hierarchical_layout;
+ public static String TestSessionLabelProvider_testName_elapsedTimeInSeconds;
+ public static String TestSessionLabelProvider_testName_RunnerVersion;
+
+ public static String TestSessionLabelProvider_testMethodName_className;
+
+ public static String TestRunnerViewPart_message_stopping;
+ public static String TestRunnerViewPart_PasteAction_cannotpaste_message;
+ public static String TestRunnerViewPart_PasteAction_cannotpaste_title;
+ public static String TestRunnerViewPart_PasteAction_label;
+ public static String TestRunnerViewPart_layout_menu;
+ public static String TestRunnerViewPart_editLaunchConfiguration;
+ public static String TestRunnerViewPart_sortAlphabetical;
+ public static String TestRunnerViewPart_sortRunner;
+ public static String TestRunnerViewPart_sort;
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.properties b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.properties
new file mode 100644
index 000000000..701a41a95
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/Messages.properties
@@ -0,0 +1,109 @@
+###############################################################################
+# Copyright (c) 2000, 2017 IBM Corporation and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+CopyTrace_action_label=Copy Trace
+CopyTraceAction_problem=Problem Copying to Clipboard
+CopyTraceAction_clipboard_busy=There was a problem when accessing the system clipboard. Retry?
+
+CopyFailureList_action_label=Copy Failure List
+CopyFailureList_problem=Problem Copying Failure List to Clipboard
+CopyFailureList_clipboard_busy=There was a problem when accessing the system clipboard. Retry?
+
+CounterPanel_label_runs=Runs:
+CounterPanel_label_errors=Errors:
+CounterPanel_label_failures=Failures:
+CounterPanel_runcount= {0}/{1}
+CounterPanel_runcount_skipped= {0}/{1} ({2} skipped)
+CounterPanel_runcount_ignored= {0}/{1} ({2} disabled)
+CounterPanel_runcount_assumptionsFailed= {0}/{1} ({2} assumption failures)
+CounterPanel_runcount_ignored_assumptionsFailed= {0}/{1} ({2} disabled, {3} assumption failures)
+
+EnableStackFilterAction_action_label=Filter
+EnableStackFilterAction_action_description=Filter the stack trace
+EnableStackFilterAction_action_tooltip=Filter Stack Trace
+
+ScrollLockAction_action_label=Scroll Lock
+ScrollLockAction_action_tooltip=Scroll Lock
+
+TestRunnerViewPart_jobName=Update Unit Test
+TestRunnerViewPart_wrapperJobName=Unit Test Starter Job
+TestRunnerViewPart_stopaction_text=Stop Unit Test
+TestRunnerViewPart_stopaction_tooltip=Stop Unit Test Run
+TestRunnerViewPart_show_execution_time=Show Execution &Time
+TestRunnerViewPart_show_failures_only=Show &Failures Only
+TestRunnerViewPart_show_ignored_only=Show &Skipped Tests Only
+TestRunnerViewPart_rerunaction_label=Rerun all tests
+TestRunnerViewPart_rerunaction_tooltip=Rerun all tests
+TestRunnerViewPart_hierarchical_layout=Show Tests in &Hierarchy
+TestRunnerViewPart_rerunfailuresaction_label=Rerun Failed Tests
+TestRunnerViewPart_rerunfailuresaction_tooltip=Rerun Failed Tests
+TestRunnerViewPart_rerunFailedFirstLaunchConfigName={0} (Failed Tests)
+TestRunnerViewPart_error_cannotrerun=Could not rerun test
+TestRunnerViewPart_error_no_tests_found=No tests found with test runner ''{0}''.
+TestRunnerViewPart_message_terminated=Terminated
+TestRunnerViewPart_cannotrerun_title=Rerun Test
+TestRunnerViewPart_cannotrerurn_message=To rerun tests they must be launched under the debugger\nand \'Keep Unit Test running\' must be set in the launch configuration.
+TestRunnerViewPart_label_failure=Failure Trace
+TestRunnerViewPart_message_finish= Finished after {0}
+TestRunnerViewPart_message_stopped= Stopped
+TestRunnerViewPart_message_stopping=Stopping...
+TestRunnerViewPart_configName=Rerun {0}
+TestRunnerViewPart__error_cannotrun=Could not run test
+TestRunnerViewPart_layout_menu=&Layout
+TestRunnerViewPart_Launching=Launching {0}...
+TestRunnerViewPart_toggle_automatic_label=&Automatic
+TestRunnerViewPart_toggle_horizontal_label=&Horizontal
+TestRunnerViewPart_toggle_vertical_label=&Vertical
+TestRunnerViewPart_sortAlphabetical=&Alphabetical
+TestRunnerViewPart_sortRunner=&Runner natural order
+TestRunnerViewPart_sort=Sort
+TestRunnerViewPart_activate_on_failure_only=Activate on &Error/Failure Only
+TestRunnerViewPart_PasteAction_cannotpaste_message=Cannot import test results from the clipboard. Please copy a valid URL first.
+TestRunnerViewPart_PasteAction_cannotpaste_title=Paste
+TestRunnerViewPart_PasteAction_label=Import &URL from Clipboard
+TestRunnerViewPart_terminate_title=Rerun Test
+TestRunnerViewPart_terminate_message=Terminate currently running tests?
+TestRunnerViewPart_editLaunchConfiguration=Edit Launch Configuration
+
+# The first parameter is the test name and the second is the Test Kind name
+TestRunnerViewPart_titleToolTip={0} [Runner: {1}]
+TestSessionLabelProvider_testName_elapsedTimeInSeconds={0} \u23F1\uFE0F{1}s
+TestSessionLabelProvider_testName_RunnerVersion={0} [Runner: {1}]
+
+TestSessionLabelProvider_testMethodName_className={0} - {1}
+
+ShowNextFailureAction_label=Next Failure
+ShowNextFailureAction_tooltip=Next Failed Test
+ShowPreviousFailureAction_label=Previous Failure
+ShowPreviousFailureAction_tooltip=Previous Failed Test
+ShowStackTraceInConsoleViewAction_description=Show the failure stack trace in Console view
+ShowStackTraceInConsoleViewAction_label=Show Stack Trace in Console View
+ShowStackTraceInConsoleViewAction_tooltip=Show Stack Trace in Console View
+
+ExpandAllAction_text=Expand All
+ExpandAllAction_tooltip=Expand All Nodes
+
+CollapseAllAction_text=Collapse All
+CollapseAllAction_tooltip=Collapse All Nodes
+
+CompareResultsAction_label=Compare Result
+CompareResultsAction_description=Compare the actual and expected test result
+CompareResultsAction_tooltip=Compare Actual With Expected Test Result
+
+CompareResultDialog_title=Result Comparison
+CompareResultDialog_expectedLabel=Expected
+CompareResultDialog_actualLabel=Actual
+
+RerunAction_label_rerun=Rerun ({0})
+RerunAction_label_run=&Run
+RerunAction_label_debug=&Debug
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ProgressIcons.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ProgressIcons.java
new file mode 100644
index 000000000..4cb6c1661
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ProgressIcons.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ * Manages a set of images that can show progress in the image itself.
+ */
+public class ProgressIcons {
+ private final ImageData initialImageData;
+
+ private static final class ProgressIconKey {
+ private final int pixels;
+ private final RGB color;
+
+ public ProgressIconKey(int pixels, RGB color) {
+ this.pixels = pixels;
+ this.color = color;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof ProgressIconKey)) {
+ return false;
+ }
+ ProgressIconKey other = (ProgressIconKey) obj;
+ return this.pixels == other.pixels && Objects.equals(this.color, other.color);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(Integer.valueOf(pixels), color);
+ }
+ }
+
+ private final Map<ProgressIconKey, Image> progressIcons = new HashMap<>();
+ private Device display;
+
+ /**
+ * Constructs a progress icons object
+ *
+ * @param sourceImage a source image object
+ */
+ public ProgressIcons(Image sourceImage) {
+ this.initialImageData = sourceImage.getImageData();
+ this.display = sourceImage.getDevice();
+ }
+
+ /**
+ * Disposes a progress icons object
+ */
+ public void dispose() {
+ this.progressIcons.values().forEach(Image::dispose);
+ this.progressIcons.clear();
+ }
+
+ /**
+ * Returns an image added with counters
+ *
+ * @param current a current test run number
+ * @param total a total test count
+ * @param hasFailures a flag indicating if a test has failures
+ * @return an image object instance
+ */
+ public Image getImage(int current, Integer total, boolean hasFailures) {
+ int totalAsInt = total != null ? total.intValue() : current + 1;
+ int pixelsToDraw = initialImageData.width * current / totalAsInt;
+ RGB color = display.getSystemColor(hasFailures ? SWT.COLOR_RED : SWT.COLOR_GREEN).getRGB();
+ ProgressIconKey key = new ProgressIconKey(pixelsToDraw, color);
+ return progressIcons.computeIfAbsent(key, progressKey -> {
+ ImageData imageData = (ImageData) initialImageData.clone();
+ int pixelColorCode = imageData.palette.getPixel(color);
+ for (int line = 4 * imageData.height / 5; line < imageData.height; line++) {
+ for (int column = 0; column < pixelsToDraw && column < imageData.width; column++) {
+ imageData.setAlpha(column, line, 255);
+ imageData.setPixel(column, line, pixelColorCode);
+ }
+ }
+ return new Image(display, imageData);
+ });
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/RerunAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/RerunAction.java
new file mode 100644
index 000000000..64c8ce566
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/RerunAction.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.unittest.internal.UnitTestPlugin;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jface.action.Action;
+
+import org.eclipse.ui.PlatformUI;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * Requests to rerun a test.
+ */
+public class RerunAction extends Action {
+
+ private ILaunchConfiguration fLaunchConfiguration;
+ private String fLaunchMode;
+
+ /**
+ * Constructs a rerun action
+ *
+ * @param launchConfiguration a launch configuration object
+ * @param launchMode a launch mode
+ */
+ public RerunAction(ILaunchConfiguration launchConfiguration, String launchMode) {
+ super(NLS.bind(Messages.RerunAction_label_rerun,
+ DebugPlugin.getDefault().getLaunchManager().getLaunchMode(launchMode).getLabel()));
+ fLaunchConfiguration = launchConfiguration;
+ fLaunchMode = launchMode;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IUnitTestHelpContextIds.RERUN_ACTION);
+ }
+
+ @Override
+ public void run() {
+ try {
+ DebugPlugin.getDefault().getLaunchManager().addLaunch(fLaunchConfiguration.launch(fLaunchMode, null));
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ScrollLockAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ScrollLockAction.java
new file mode 100644
index 000000000..1f0eeca17
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ScrollLockAction.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.jface.action.Action;
+
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Toggles console auto-scroll
+ */
+public class ScrollLockAction extends Action {
+
+ private TestRunnerViewPart fRunnerViewPart;
+
+ /**
+ * Constructs a scroll lock toggle action
+ *
+ * @param viewer a test runner viewer part object
+ */
+ public ScrollLockAction(TestRunnerViewPart viewer) {
+ super(Messages.ScrollLockAction_action_label);
+ fRunnerViewPart = viewer;
+ setToolTipText(Messages.ScrollLockAction_action_tooltip);
+ setDisabledImageDescriptor(Images.getImageDescriptor("dlcl16/lock.png")); //$NON-NLS-1$
+ setHoverImageDescriptor(Images.getImageDescriptor("elcl16/lock.png")); //$NON-NLS-1$
+ setImageDescriptor(Images.getImageDescriptor("elcl16/lock.png")); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IUnitTestHelpContextIds.OUTPUT_SCROLL_LOCK_ACTION);
+ setChecked(false);
+ }
+
+ @Override
+ public void run() {
+ fRunnerViewPart.setAutoScroll(!isChecked());
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/SelectionProviderMediator.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/SelectionProviderMediator.java
new file mode 100644
index 000000000..911df8096
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/SelectionProviderMediator.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Widget;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ListenerList;
+
+import org.eclipse.jface.viewers.IPostSelectionProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+
+/**
+ * A selection provider for view parts with more that one viewer. Tracks the
+ * focus of the viewers to provide the correct selection.
+ */
+public class SelectionProviderMediator implements IPostSelectionProvider {
+
+ private class InternalListener implements ISelectionChangedListener, FocusListener {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ doSelectionChanged(event);
+ }
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ doFocusChanged(e.widget);
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ // do not reset due to focus behavior on GTK
+ // fViewerInFocus= null;
+ }
+ }
+
+ private class InternalPostSelectionListener implements ISelectionChangedListener {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ doPostSelectionChanged(event);
+ }
+
+ }
+
+ private StructuredViewer[] fViewers;
+
+ private StructuredViewer fViewerInFocus;
+ private ListenerList<ISelectionChangedListener> fSelectionChangedListeners;
+ private ListenerList<ISelectionChangedListener> fPostSelectionChangedListeners;
+
+ /**
+ * Constructs a selection provider mediator object
+ *
+ * @param viewers All viewers that can provide a selection
+ * @param viewerInFocus the viewer currently in focus or <code>null</code>
+ */
+ public SelectionProviderMediator(StructuredViewer[] viewers, StructuredViewer viewerInFocus) {
+ Assert.isNotNull(viewers);
+ fViewers = viewers;
+ InternalListener listener = new InternalListener();
+ fSelectionChangedListeners = new ListenerList<>();
+ fPostSelectionChangedListeners = new ListenerList<>();
+ fViewerInFocus = viewerInFocus;
+
+ for (StructuredViewer viewer : fViewers) {
+ viewer.addSelectionChangedListener(listener);
+ viewer.addPostSelectionChangedListener(new InternalPostSelectionListener());
+ Control control = viewer.getControl();
+ control.addFocusListener(listener);
+ }
+ }
+
+ private void doFocusChanged(Widget control) {
+ for (StructuredViewer viewer : fViewers) {
+ if (viewer.getControl() == control) {
+ propagateFocusChanged(viewer);
+ return;
+ }
+ }
+ }
+
+ final void doPostSelectionChanged(SelectionChangedEvent event) {
+ ISelectionProvider provider = event.getSelectionProvider();
+ if (provider == fViewerInFocus) {
+ firePostSelectionChanged();
+ }
+ }
+
+ final void doSelectionChanged(SelectionChangedEvent event) {
+ ISelectionProvider provider = event.getSelectionProvider();
+ if (provider == fViewerInFocus) {
+ fireSelectionChanged();
+ }
+ }
+
+ final void propagateFocusChanged(StructuredViewer viewer) {
+ if (viewer != fViewerInFocus) { // OK to compare by identity
+ fViewerInFocus = viewer;
+ fireSelectionChanged();
+ firePostSelectionChanged();
+ }
+ }
+
+ private void fireSelectionChanged() {
+ if (fSelectionChangedListeners != null) {
+ SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
+
+ for (ISelectionChangedListener listener : fSelectionChangedListeners) {
+ listener.selectionChanged(event);
+ }
+ }
+ }
+
+ private void firePostSelectionChanged() {
+ if (fPostSelectionChangedListeners != null) {
+ SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
+
+ for (ISelectionChangedListener listener : fPostSelectionChangedListeners) {
+ listener.selectionChanged(event);
+ }
+ }
+ }
+
+ @Override
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ fSelectionChangedListeners.add(listener);
+ }
+
+ @Override
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ fSelectionChangedListeners.remove(listener);
+ }
+
+ @Override
+ public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
+ fPostSelectionChangedListeners.add(listener);
+ }
+
+ @Override
+ public void removePostSelectionChangedListener(ISelectionChangedListener listener) {
+ fPostSelectionChangedListeners.remove(listener);
+ }
+
+ @Override
+ public ISelection getSelection() {
+ if (fViewerInFocus != null) {
+ return fViewerInFocus.getSelection();
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ @Override
+ public void setSelection(ISelection selection) {
+ if (fViewerInFocus != null) {
+ fViewerInFocus.setSelection(selection);
+ }
+ }
+
+ /**
+ * Sets current selection
+ *
+ * @param selection a selection object
+ * @param reveal a flag indicating if a reveal is needed
+ */
+ public void setSelection(ISelection selection, boolean reveal) {
+ if (fViewerInFocus != null) {
+ fViewerInFocus.setSelection(selection, reveal);
+ }
+ }
+
+ /**
+ * Returns the viewer in focus or null if no viewer has the focus
+ *
+ * @return returns the current viewer in focus
+ */
+ public StructuredViewer getViewerInFocus() {
+ return fViewerInFocus;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowNextFailureAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowNextFailureAction.java
new file mode 100644
index 000000000..5e2809ec5
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowNextFailureAction.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.jface.action.Action;
+
+/**
+ * Show next failure action
+ */
+public class ShowNextFailureAction extends Action {
+
+ private TestRunnerViewPart fPart;
+
+ /**
+ * Constructs a show next failure action object
+ *
+ * @param part a test runner view part object
+ */
+ public ShowNextFailureAction(TestRunnerViewPart part) {
+ super(Messages.ShowNextFailureAction_label);
+ setDisabledImageDescriptor(Images.getImageDescriptor("dlcl16/select_next.png")); //$NON-NLS-1$
+ setHoverImageDescriptor(Images.getImageDescriptor("elcl16/select_next.png")); //$NON-NLS-1$
+ setImageDescriptor(Images.getImageDescriptor("elcl16/select_next.png")); //$NON-NLS-1$
+ setToolTipText(Messages.ShowNextFailureAction_tooltip);
+ fPart = part;
+ }
+
+ @Override
+ public void run() {
+ fPart.selectNextFailure();
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowPreviousFailureAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowPreviousFailureAction.java
new file mode 100644
index 000000000..f5919f564
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowPreviousFailureAction.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.jface.action.Action;
+
+/**
+ * Show previous failure action
+ */
+public class ShowPreviousFailureAction extends Action {
+
+ private TestRunnerViewPart fPart;
+
+ /**
+ * Constructs a show previous failure action object
+ *
+ * @param part a test runner view part object
+ */
+ public ShowPreviousFailureAction(TestRunnerViewPart part) {
+ super(Messages.ShowPreviousFailureAction_label);
+ setDisabledImageDescriptor(Images.getImageDescriptor("dlcl16/select_prev.png")); //$NON-NLS-1$
+ setHoverImageDescriptor(Images.getImageDescriptor("elcl16/select_prev.png")); //$NON-NLS-1$
+ setImageDescriptor(Images.getImageDescriptor("elcl16/select_prev.png")); //$NON-NLS-1$
+ setToolTipText(Messages.ShowPreviousFailureAction_tooltip);
+ fPart = part;
+ }
+
+ @Override
+ public void run() {
+ fPart.selectPreviousFailure();
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowStackTraceInConsoleViewAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowStackTraceInConsoleViewAction.java
new file mode 100644
index 000000000..5270eed0b
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/ShowStackTraceInConsoleViewAction.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+
+/**
+ * Action to show the stack trace of a failed test from Unit Test view's failure
+ * trace in debug's Java stack trace console.
+ */
+public class ShowStackTraceInConsoleViewAction extends Action {
+
+ private Runnable fDelegate;
+
+ /**
+ * Constructs a show stacktrace in console view action object
+ */
+ public ShowStackTraceInConsoleViewAction() {
+ super(Messages.ShowStackTraceInConsoleViewAction_label, IAction.AS_PUSH_BUTTON);
+ setDescription(Messages.ShowStackTraceInConsoleViewAction_description);
+ setToolTipText(Messages.ShowStackTraceInConsoleViewAction_tooltip);
+
+ setHoverImageDescriptor(Images.getImageDescriptor("elcl16/open_console.png")); //$NON-NLS-1$
+ setImageDescriptor(Images.getImageDescriptor("elcl16/open_console.png")); //$NON-NLS-1$
+ setDisabledImageDescriptor(Images.getImageDescriptor("dlcl16/open_console.png")); //$NON-NLS-1$
+
+ fDelegate = null;
+ }
+
+ @Override
+ public void run() {
+ if (fDelegate != null) {
+ fDelegate.run();
+ }
+ }
+
+ /**
+ * Sets an action delegate
+ *
+ * @param delegate an action delegate
+ */
+ public void setDelegate(Runnable delegate) {
+ fDelegate = delegate;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled() && fDelegate != null;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestRunnerViewPart.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestRunnerViewPart.java
new file mode 100644
index 000000000..b08266cc0
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestRunnerViewPart.java
@@ -0,0 +1,1823 @@
+/*******************************************************************************
+L * Copyright (c) 2000, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.UnitTestPreferencesConstants;
+import org.eclipse.unittest.internal.model.ITestRunSessionListener;
+import org.eclipse.unittest.internal.model.ITestSessionListener;
+import org.eclipse.unittest.internal.model.ProgressState;
+import org.eclipse.unittest.internal.model.TestCaseElement;
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.model.UnitTestModel;
+import org.eclipse.unittest.internal.ui.history.History;
+import org.eclipse.unittest.internal.ui.history.HistoryHandler;
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+import org.eclipse.unittest.model.ITestElement.Result;
+import org.eclipse.unittest.model.ITestRunSession;
+import org.eclipse.unittest.model.ITestSuiteElement;
+import org.eclipse.unittest.ui.ITestViewSupport;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ViewForm;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.URLTransfer;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorActionBarContributor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.eclipse.ui.menus.CommandContributionItemParameter;
+import org.eclipse.ui.part.EditorActionBarContributor;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+import org.eclipse.ui.progress.UIJob;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.actions.EditLaunchConfigurationAction;
+
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * A ViewPart that shows the results of a test run.
+ */
+@SuppressWarnings("restriction")
+public class TestRunnerViewPart extends ViewPart {
+
+ /**
+ * An identifier of Test Runner View Part
+ */
+ public static final String NAME = UnitTestPlugin.PLUGIN_ID + ".ResultView"; //$NON-NLS-1$
+
+ private static final String RERUN_LAST_COMMAND = UnitTestPlugin.PLUGIN_ID + ".UnitTestShortcut.rerunLast"; //$NON-NLS-1$
+ private static final String RERUN_FAILED_CASES_COMMAND = UnitTestPlugin.PLUGIN_ID
+ + ".UnitTestShortcut.rerunFailedCases"; //$NON-NLS-1$
+
+ static final int REFRESH_INTERVAL = 200;
+
+ /**
+ * A Test Result layout
+ */
+ public enum TestResultsLayout {
+ FLAT, HIERARCHICAL
+ }
+
+ /**
+ * Whether the output scrolls and reveals tests as they are executed.
+ */
+ protected boolean fAutoScroll = true;
+ /**
+ * The current orientation; either <code>VIEW_ORIENTATION_HORIZONTAL</code>
+ * <code>VIEW_ORIENTATION_VERTICAL</code>, or
+ * <code>VIEW_ORIENTATION_AUTOMATIC</code>.
+ */
+ private int fOrientation = VIEW_ORIENTATION_AUTOMATIC;
+ /**
+ * The current orientation; either <code>VIEW_ORIENTATION_HORIZONTAL</code>
+ * <code>VIEW_ORIENTATION_VERTICAL</code>.
+ */
+ private int fCurrentOrientation;
+ /**
+ * The current layout mode (LAYOUT_FLAT or LAYOUT_HIERARCHICAL).
+ */
+ private TestResultsLayout fLayout = TestResultsLayout.HIERARCHICAL;
+
+ private UnitTestProgressBar fProgressBar;
+ private ProgressIcons fProgressImages;
+ protected Image fViewImage;
+ private CounterPanel fCounterPanel;
+ protected boolean fShowOnErrorOnly = false;
+ protected Clipboard fClipboard;
+ protected volatile String fInfoMessage;
+
+ private FailureTraceUIBlock fFailureTrace;
+
+ private TestViewer fTestViewer;
+ /**
+ * Is the UI disposed?
+ */
+ private boolean fIsDisposed = false;
+
+ /**
+ * Actions
+ */
+ private Action fNextAction;
+ private Action fPreviousAction;
+
+ private StopAction fStopAction;
+ private UnitTestCopyAction fCopyAction;
+ private Action fPasteAction;
+
+ private Action fRerunLastTestAction;
+ private IHandlerActivation fRerunLastActivation;
+ private Action fRerunFailedCasesAction;
+ private IHandlerActivation fRerunFailedFirstActivation;
+ private EditLaunchConfigurationAction fEditLaunchConfigAction;
+
+ private Action fFailuresOnlyFilterAction;
+ private Action fIgnoredOnlyFilterAction;
+ private ScrollLockAction fScrollLockAction;
+ private ToggleOrientationAction[] fToggleOrientationActions;
+ private ShowTestHierarchyAction fShowTestHierarchyAction;
+ private ShowTimeAction fShowTimeAction;
+ private ActivateOnErrorAction fActivateOnErrorAction;
+ private IMenuListener fViewMenuListener;
+
+ private TestRunSession fTestRunSession;
+ private TestSessionListener fTestSessionListener;
+
+// private RunnerViewHistory fViewHistory;
+ private TestRunSessionListener fTestRunSessionListener;
+
+ final Image fStackViewIcon;
+ final Image fTestRunOKIcon;
+ final Image fTestRunFailIcon;
+ final Image fTestRunOKDirtyIcon;
+ final Image fTestRunFailDirtyIcon;
+
+ final Image fTestIcon;
+ final Image fTestOkIcon;
+ final Image fTestErrorIcon;
+ final Image fTestFailIcon;
+ final Image fTestAssumptionFailureIcon;
+ final Image fTestRunningIcon;
+ final Image fTestIgnoredIcon;
+
+ final ImageDescriptor fSuiteIconDescriptor = Images.getImageDescriptor("obj16/tsuite.png"); //$NON-NLS-1$
+ final ImageDescriptor fSuiteOkIconDescriptor = Images.getImageDescriptor("obj16/tsuiteok.png"); //$NON-NLS-1$
+ final ImageDescriptor fSuiteErrorIconDescriptor = Images.getImageDescriptor("obj16/tsuiteerror.png"); //$NON-NLS-1$
+ final ImageDescriptor fSuiteFailIconDescriptor = Images.getImageDescriptor("obj16/tsuitefail.png"); //$NON-NLS-1$
+ final ImageDescriptor fSuiteRunningIconDescriptor = Images.getImageDescriptor("obj16/tsuiterun.png"); //$NON-NLS-1$
+
+ final Image fSuiteIcon;
+ final Image fSuiteOkIcon;
+ final Image fSuiteErrorIcon;
+ final Image fSuiteFailIcon;
+ final Image fSuiteRunningIcon;
+
+ final List<Image> fImagesToDispose;
+
+ // Persistence tags.
+ static final String TAG_PAGE = "page"; //$NON-NLS-1$
+ static final String TAG_RATIO = "ratio"; //$NON-NLS-1$
+ static final String TAG_TRACEFILTER = "tracefilter"; //$NON-NLS-1$
+ static final String TAG_ORIENTATION = "orientation"; //$NON-NLS-1$
+ static final String TAG_SCROLL = "scroll"; //$NON-NLS-1$
+ /**
+ */
+ static final String TAG_LAYOUT = "layout"; //$NON-NLS-1$
+ /**
+ */
+ static final String TAG_FAILURES_ONLY = "failuresOnly"; //$NON-NLS-1$
+
+ /**
+ */
+ static final String TAG_IGNORED_ONLY = "ignoredOnly"; //$NON-NLS-1$
+ /**
+ */
+ static final String TAG_SHOW_TIME = "time"; //$NON-NLS-1$
+
+ /**
+ */
+ static final String PREF_LAST_PATH = "lastImportExportPath"; //$NON-NLS-1$
+
+ /**
+ */
+ static final String PREF_LAST_URL = "lastImportURL"; //$NON-NLS-1$
+
+ // orientations
+ static final int VIEW_ORIENTATION_VERTICAL = 0;
+ static final int VIEW_ORIENTATION_HORIZONTAL = 1;
+ static final int VIEW_ORIENTATION_AUTOMATIC = 2;
+
+ private IMemento fMemento;
+
+ Image fOriginalViewImage;
+
+ private SashForm fSashForm;
+
+ private Composite fCounterComposite;
+ private Composite fParent;
+
+ /**
+ * A Job that periodically updates view description, counters, and progress bar.
+ */
+ private UpdateUIJob fUpdateJob;
+
+ /**
+ * A Job that runs as long as a test run is running. It is used to show busyness
+ * for running jobs in the view (title in italics).
+ */
+ private UnitTestIsRunningJob fUnitTestIsRunningJob;
+ private ILock fUnitTestIsRunningLock;
+ public static final Object FAMILY_UNITTEST_RUN = new Object();
+
+ private IPartListener2 fPartListener = new IPartListener2() {
+ @Override
+ public void partActivated(IWorkbenchPartReference ref) {
+ }
+
+ @Override
+ public void partBroughtToTop(IWorkbenchPartReference ref) {
+ }
+
+ @Override
+ public void partInputChanged(IWorkbenchPartReference ref) {
+ }
+
+ @Override
+ public void partClosed(IWorkbenchPartReference ref) {
+ }
+
+ @Override
+ public void partDeactivated(IWorkbenchPartReference ref) {
+ }
+
+ @Override
+ public void partOpened(IWorkbenchPartReference ref) {
+ }
+
+ @Override
+ public void partVisible(IWorkbenchPartReference ref) {
+ if (getSite().getId().equals(ref.getId())) {
+ fPartIsVisible = true;
+ }
+ }
+
+ @Override
+ public void partHidden(IWorkbenchPartReference ref) {
+ if (getSite().getId().equals(ref.getId())) {
+ fPartIsVisible = false;
+ }
+ }
+ };
+
+ protected boolean fPartIsVisible = false;
+
+ private static class UnitTesttPasteAction extends Action {
+ private final Shell fShell;
+ private Clipboard fClipboard;
+
+ public UnitTesttPasteAction(Shell shell, Clipboard clipboard) {
+ super(Messages.TestRunnerViewPart_PasteAction_label);
+ Assert.isNotNull(clipboard);
+ fShell = shell;
+ fClipboard = clipboard;
+ }
+
+ @Override
+ public void run() {
+ String urlData = (String) fClipboard.getContents(URLTransfer.getInstance());
+ if (urlData == null) {
+ urlData = (String) fClipboard.getContents(TextTransfer.getInstance());
+ }
+ if (urlData != null && urlData.length() > 0) {
+ if (isValidUrl(urlData)) {
+ importTestRunSession(urlData);
+ return;
+ }
+ }
+ MessageDialog.openInformation(fShell, Messages.TestRunnerViewPart_PasteAction_cannotpaste_title,
+ Messages.TestRunnerViewPart_PasteAction_cannotpaste_message);
+ }
+
+ private boolean isValidUrl(String urlData) {
+ try {
+ @SuppressWarnings("unused")
+ URL url = new URL(urlData);
+ } catch (MalformedURLException e) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ private class TestRunSessionListener implements ITestRunSessionListener {
+ @Override
+ public void sessionAdded(final ITestRunSession testRunSession) {
+ getDisplay().asyncExec(() -> {
+ if (UnitTestUIPreferencesConstants.getShowInAllViews()
+ || getSite().getWorkbenchWindow() == PlatformUI.getWorkbench().getActiveWorkbenchWindow()) {
+ if (fInfoMessage == null) {
+ String testRunLabel = BasicElementLabels
+ .getJavaElementName(((TestRunSession) testRunSession).getTestRunName());
+ String msg;
+ if (testRunSession.getLaunch() != null) {
+ msg = MessageFormat.format(Messages.TestRunnerViewPart_Launching, testRunLabel);
+ } else {
+ msg = testRunLabel;
+ }
+ registerInfoMessage(msg);
+ }
+
+ setActiveTestRunSession((TestRunSession) testRunSession);
+ }
+ });
+ }
+
+ @Override
+ public void sessionRemoved(final ITestRunSession testRunSession) {
+ getDisplay().asyncExec(() -> {
+ if (testRunSession.equals(fTestRunSession)) {
+ List<TestRunSession> testRunSessions = UnitTestModel.getInstance().getTestRunSessions();
+ if (!testRunSessions.isEmpty()) {
+ setActiveTestRunSession(testRunSessions.get(0));
+ } else {
+ setActiveTestRunSession(null);
+ }
+ }
+ });
+ }
+ }
+
+ private class TestSessionListener implements ITestSessionListener {
+ @Override
+ public void sessionStarted() {
+ fTestViewer.registerViewersRefresh();
+ fShowOnErrorOnly = getShowOnErrorOnly();
+
+ startUpdateJobs();
+
+ fStopAction.setEnabled(true);
+ fRerunLastTestAction.setEnabled(true);
+ fEditLaunchConfigAction.setEnabled(fTestRunSession.getLaunch() != null);
+ }
+
+ @Override
+ public void sessionCompleted(Duration duration) {
+ deregisterTestSessionListener();
+
+ fTestViewer.registerAutoScrollTarget(null);
+
+ final String msg = MessageFormat.format(Messages.TestRunnerViewPart_message_finish,
+ Double.valueOf(duration != null ? duration.toNanos() / 1.0e9 : 0));
+ getDisplay().asyncExec(() -> registerInfoMessage(msg));
+
+ postSyncRunnable(() -> {
+ if (isDisposed())
+ return;
+ fStopAction.setEnabled(lastLaunchStillRunning());
+ updateRerunFailedFirstAction();
+ processChangesInUI();
+ if (hasErrorsOrFailures()) {
+ selectFirstFailure();
+ }
+ /*
+ * if (fDirtyListener == null) { fDirtyListener= new DirtyListener();
+ * JavaCore.addElementChangedListener(fDirtyListener); }
+ */
+ warnOfContentChange();
+ });
+ stopUpdateJobs();
+ showMessageIfNoTests();
+ }
+
+ @Override
+ public void sessionAborted(Duration duration) {
+ deregisterTestSessionListener();
+
+ fTestViewer.registerAutoScrollTarget(null);
+
+ getDisplay().asyncExec(() -> registerInfoMessage(Messages.TestRunnerViewPart_message_stopped));
+ handleStopped();
+ }
+
+ @Override
+ public void runningBegins() {
+ if (!fShowOnErrorOnly)
+ postShowTestResultsView();
+ }
+
+ @Override
+ public void testStarted(ITestCaseElement testCaseElement) {
+ fTestViewer.registerAutoScrollTarget(testCaseElement);
+ fTestViewer.registerViewerUpdate(testCaseElement);
+ registerInfoMessage(testCaseElement.getDisplayName());
+ }
+
+ @Override
+ public void testFailed(ITestElement testElement, ITestElement.Result status, FailureTrace trace) {
+ if (isAutoScroll()) {
+ fTestViewer.registerFailedForAutoScroll(testElement);
+ }
+ fTestViewer.registerViewerUpdate(testElement);
+
+ // show the view on the first error only
+ if (fShowOnErrorOnly && (getErrorsPlusFailures() == 1))
+ postShowTestResultsView();
+ }
+
+ @Override
+ public void testEnded(ITestCaseElement testCaseElement) {
+ fTestViewer.registerViewerUpdate(testCaseElement);
+ }
+
+ @Override
+ public void testAdded(ITestElement testElement) {
+ fTestViewer.registerTestAdded(testElement);
+ }
+ }
+
+ private class UpdateUIJob extends UIJob {
+ private boolean fRunning = true;
+
+ public UpdateUIJob(String name) {
+ super(name);
+ setSystem(true);
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (!isDisposed()) {
+ processChangesInUI();
+ }
+ schedule(REFRESH_INTERVAL);
+ return Status.OK_STATUS;
+ }
+
+ public void stop() {
+ fRunning = false;
+ }
+
+ @Override
+ public boolean shouldSchedule() {
+ return fRunning;
+ }
+ }
+
+ private class UnitTestIsRunningJob extends Job {
+ public UnitTestIsRunningJob(String name) {
+ super(name);
+ setSystem(true);
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ // wait until the test run terminates
+ fUnitTestIsRunningLock.acquire();
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public boolean belongsTo(Object family) {
+ return family == TestRunnerViewPart.FAMILY_UNITTEST_RUN;
+ }
+ }
+
+ private class StopAction extends Action {
+ public StopAction() {
+ setText(Messages.TestRunnerViewPart_stopaction_text);
+ setToolTipText(Messages.TestRunnerViewPart_stopaction_tooltip);
+ Images.setLocalImageDescriptors(this, "stop.png"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ stopTest();
+ setEnabled(false);
+ }
+ }
+
+ private class RerunLastAction extends Action {
+ public RerunLastAction() {
+ setText(Messages.TestRunnerViewPart_rerunaction_label);
+ setToolTipText(Messages.TestRunnerViewPart_rerunaction_tooltip);
+ Images.setLocalImageDescriptors(this, "relaunch.png"); //$NON-NLS-1$
+ setEnabled(false);
+ setActionDefinitionId(RERUN_LAST_COMMAND);
+ }
+
+ @Override
+ public void run() {
+ DebugUITools.launch(fTestRunSession.getLaunch().getLaunchConfiguration(), rerunLaunchMode());
+ }
+ }
+
+ private class RerunFailedCasesAction extends Action {
+ public RerunFailedCasesAction() {
+ setText(Messages.TestRunnerViewPart_rerunfailuresaction_label);
+ setToolTipText(Messages.TestRunnerViewPart_rerunfailuresaction_tooltip);
+ Images.setLocalImageDescriptors(this, "relaunchf.png"); //$NON-NLS-1$
+ setEnabled(false);
+ setActionDefinitionId(RERUN_FAILED_CASES_COMMAND);
+ }
+
+ @Override
+ public void run() {
+ rerunFailedTestCases();
+ }
+ }
+
+ private class ToggleOrientationAction extends Action {
+ private final int fActionOrientation;
+
+ public ToggleOrientationAction(int orientation) {
+ super("", AS_RADIO_BUTTON); //$NON-NLS-1$
+ switch (orientation) {
+ case TestRunnerViewPart.VIEW_ORIENTATION_HORIZONTAL:
+ setText(Messages.TestRunnerViewPart_toggle_horizontal_label);
+ setImageDescriptor(Images.getImageDescriptor("elcl16/th_horizontal.png")); //$NON-NLS-1$
+ break;
+ case TestRunnerViewPart.VIEW_ORIENTATION_VERTICAL:
+ setText(Messages.TestRunnerViewPart_toggle_vertical_label);
+ setImageDescriptor(Images.getImageDescriptor("elcl16/th_vertical.png")); //$NON-NLS-1$
+ break;
+ case TestRunnerViewPart.VIEW_ORIENTATION_AUTOMATIC:
+ setText(Messages.TestRunnerViewPart_toggle_automatic_label);
+ setImageDescriptor(Images.getImageDescriptor("elcl16/th_automatic.png")); //$NON-NLS-1$
+ break;
+ default:
+ break;
+ }
+ fActionOrientation = orientation;
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+ IUnitTestHelpContextIds.RESULTS_VIEW_TOGGLE_ORIENTATION_ACTION);
+ }
+
+ public int getOrientation() {
+ return fActionOrientation;
+ }
+
+ @Override
+ public void run() {
+ if (isChecked()) {
+ fOrientation = fActionOrientation;
+ computeOrientation();
+ }
+ }
+ }
+
+ private class SortAction extends Action {
+ private final boolean enableAlphabeticalSort;
+
+ public SortAction(boolean enableAlphabeticalSort) {
+ super(enableAlphabeticalSort ? Messages.TestRunnerViewPart_sortAlphabetical
+ : Messages.TestRunnerViewPart_sortRunner, AS_RADIO_BUTTON);
+ this.enableAlphabeticalSort = enableAlphabeticalSort;
+ }
+
+ @Override
+ public void run() {
+ fTestViewer.setAlphabeticalSort(enableAlphabeticalSort);
+ }
+
+ @Override
+ public boolean isChecked() {
+ return fTestViewer.isAlphabeticalSort() == enableAlphabeticalSort;
+ }
+ }
+
+ private class FailuresOnlyFilterAction extends Action {
+ public FailuresOnlyFilterAction() {
+ super(Messages.TestRunnerViewPart_show_failures_only, AS_CHECK_BOX);
+ setToolTipText(Messages.TestRunnerViewPart_show_failures_only);
+ setImageDescriptor(Images.getImageDescriptor("obj16/failures.png")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ setShowFailuresOnly(isChecked());
+ }
+ }
+
+ private class IgnoredOnlyFilterAction extends Action {
+ public IgnoredOnlyFilterAction() {
+ super(Messages.TestRunnerViewPart_show_ignored_only, AS_CHECK_BOX);
+ setToolTipText(Messages.TestRunnerViewPart_show_ignored_only);
+ setImageDescriptor(Images.getImageDescriptor("obj16/testignored.png")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ setShowIgnoredOnly(isChecked());
+ }
+ }
+
+ private class ShowTimeAction extends Action {
+ public ShowTimeAction() {
+ super(Messages.TestRunnerViewPart_show_execution_time, IAction.AS_CHECK_BOX);
+ }
+
+ @Override
+ public void run() {
+ setShowExecutionTime(isChecked());
+ }
+ }
+
+ private class ShowTestHierarchyAction extends Action {
+ public ShowTestHierarchyAction() {
+ super(Messages.TestRunnerViewPart_hierarchical_layout, IAction.AS_CHECK_BOX);
+ setImageDescriptor(Images.getImageDescriptor("elcl16/hierarchicalLayout.png")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ setFilterAndLayout(fFailuresOnlyFilterAction.isChecked(), fIgnoredOnlyFilterAction.isChecked(),
+ isChecked() ? TestResultsLayout.HIERARCHICAL : TestResultsLayout.FLAT);
+ }
+ }
+
+ private class ActivateOnErrorAction extends Action {
+ public ActivateOnErrorAction() {
+ super(Messages.TestRunnerViewPart_activate_on_failure_only, IAction.AS_CHECK_BOX);
+ // setImageDescriptor(UnitTestPlugin.getImageDescriptor("obj16/failures.png"));
+ // //$NON-NLS-1$
+ update();
+ }
+
+ public void update() {
+ setChecked(getShowOnErrorOnly());
+ }
+
+ @Override
+ public void run() {
+ boolean checked = isChecked();
+ fShowOnErrorOnly = checked;
+ InstanceScope.INSTANCE.getNode(UnitTestPlugin.PLUGIN_ID)
+ .putBoolean(UnitTestPreferencesConstants.SHOW_ON_ERROR_ONLY, checked);
+ }
+ }
+
+ /**
+ * Constructs Test Runner View part object
+ */
+ public TestRunnerViewPart() {
+ fImagesToDispose = new ArrayList<>();
+
+ fStackViewIcon = createManagedImage("eview16/stackframe.png");//$NON-NLS-1$
+ fTestRunOKIcon = createManagedImage("eview16/unitsucc.png"); //$NON-NLS-1$
+ fTestRunFailIcon = createManagedImage("eview16/uniterr.png"); //$NON-NLS-1$
+ fTestRunOKDirtyIcon = createManagedImage("eview16/unitsuccq.png"); //$NON-NLS-1$
+ fTestRunFailDirtyIcon = createManagedImage("eview16/uniterrq.png"); //$NON-NLS-1$
+
+ fTestIcon = createManagedImage("obj16/test.png"); //$NON-NLS-1$
+ fTestOkIcon = createManagedImage("obj16/testok.png"); //$NON-NLS-1$
+ fTestErrorIcon = createManagedImage("obj16/testerr.png"); //$NON-NLS-1$
+ fTestFailIcon = createManagedImage("obj16/testfail.png"); //$NON-NLS-1$
+ fTestRunningIcon = createManagedImage("obj16/testrun.png"); //$NON-NLS-1$
+ fTestIgnoredIcon = createManagedImage("obj16/testignored.png"); //$NON-NLS-1$
+ fTestAssumptionFailureIcon = createManagedImage("obj16/testassumptionfailed.png"); //$NON-NLS-1$
+
+ fSuiteIcon = createManagedImage(fSuiteIconDescriptor);
+ fSuiteOkIcon = createManagedImage(fSuiteOkIconDescriptor);
+ fSuiteErrorIcon = createManagedImage(fSuiteErrorIconDescriptor);
+ fSuiteFailIcon = createManagedImage(fSuiteFailIconDescriptor);
+ fSuiteRunningIcon = createManagedImage(fSuiteRunningIconDescriptor);
+ }
+
+ private Image createManagedImage(String path) {
+ return createManagedImage(Images.getImageDescriptor(path));
+ }
+
+ private Image createManagedImage(ImageDescriptor descriptor) {
+ Image image = descriptor.createImage();
+ if (image == null) {
+ image = ImageDescriptor.getMissingImageDescriptor().createImage();
+ }
+ fImagesToDispose.add(image);
+ return image;
+ }
+
+ @Override
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ fMemento = memento;
+ IWorkbenchSiteProgressService progressService = getProgressService();
+ if (progressService != null)
+ progressService.showBusyForFamily(TestRunnerViewPart.FAMILY_UNITTEST_RUN);
+ }
+
+ private IWorkbenchSiteProgressService getProgressService() {
+ Object siteService = getSite().getAdapter(IWorkbenchSiteProgressService.class);
+ if (siteService != null)
+ return (IWorkbenchSiteProgressService) siteService;
+ return null;
+ }
+
+ @Override
+ public void saveState(IMemento memento) {
+ if (fSashForm == null) {
+ // part has not been created
+ if (fMemento != null) // Keep the old state;
+ memento.putMemento(fMemento);
+ return;
+ }
+
+// int activePage= fTabFolder.getSelectionIndex();
+// memento.putInteger(TAG_PAGE, activePage);
+ memento.putString(TAG_SCROLL, fScrollLockAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ int weigths[] = fSashForm.getWeights();
+ int ratio = (weigths[0] * 1000) / (weigths[0] + weigths[1]);
+ memento.putInteger(TAG_RATIO, ratio);
+ memento.putInteger(TAG_ORIENTATION, fOrientation);
+
+ memento.putString(TAG_FAILURES_ONLY, fFailuresOnlyFilterAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ memento.putString(TAG_IGNORED_ONLY, fIgnoredOnlyFilterAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ memento.putString(TAG_LAYOUT, fLayout.name());
+ memento.putString(TAG_SHOW_TIME, fShowTimeAction.isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private void restoreLayoutState(IMemento memento) {
+// Integer page= memento.getInteger(TAG_PAGE);
+// if (page != null) {
+// int p= page.intValue();
+// if (p < fTestRunTabs.size()) { // tab count can decrease if a contributing plug-in is removed
+// fTabFolder.setSelection(p);
+// fActiveRunTab= (TestRunTab)fTestRunTabs.get(p);
+// }
+// }
+ Integer ratio = memento.getInteger(TAG_RATIO);
+ if (ratio != null)
+ fSashForm.setWeights(ratio.intValue(), 1000 - ratio.intValue());
+ Integer orientation = memento.getInteger(TAG_ORIENTATION);
+ if (orientation != null)
+ fOrientation = orientation.intValue();
+ computeOrientation();
+ String scrollLock = memento.getString(TAG_SCROLL);
+ if (scrollLock != null) {
+ fScrollLockAction.setChecked(scrollLock.equals("true")); //$NON-NLS-1$
+ setAutoScroll(!fScrollLockAction.isChecked());
+ }
+
+ String layoutString = memento.getString(TAG_LAYOUT);
+ TestResultsLayout layout = layoutString == null ? TestResultsLayout.HIERARCHICAL
+ : TestResultsLayout.valueOf(layoutString);
+
+ String failuresOnly = memento.getString(TAG_FAILURES_ONLY);
+ boolean showFailuresOnly = false;
+ if (failuresOnly != null)
+ showFailuresOnly = failuresOnly.equals("true"); //$NON-NLS-1$
+
+ String ignoredOnly = memento.getString(TAG_IGNORED_ONLY);
+ boolean showIgnoredOnly = false;
+ if (ignoredOnly != null)
+ showIgnoredOnly = ignoredOnly.equals("true"); //$NON-NLS-1$
+
+ String time = memento.getString(TAG_SHOW_TIME);
+ boolean showTime = true;
+ if (time != null)
+ showTime = time.equals("true"); //$NON-NLS-1$
+
+ setFilterAndLayout(showFailuresOnly, showIgnoredOnly, layout);
+ setShowExecutionTime(showTime);
+ }
+
+ /**
+ * Stops the currently running test and shuts down the RemoteTestRunner
+ */
+ public void stopTest() {
+ if (fTestRunSession != null) {
+ if (fTestRunSession.isRunning()) {
+ setContentDescription(Messages.TestRunnerViewPart_message_stopping);
+ }
+ fTestRunSession.abortTestRun();
+ }
+ }
+
+ private void startUpdateJobs() {
+ postSyncProcessChanges();
+
+ if (fUpdateJob != null) {
+ return;
+ }
+ fUnitTestIsRunningJob = new UnitTestIsRunningJob(Messages.TestRunnerViewPart_wrapperJobName);
+ fUnitTestIsRunningLock = Job.getJobManager().newLock();
+ // acquire lock while a test run is running
+ // the lock is released when the test run terminates
+ // the wrapper job will wait on this lock.
+ fUnitTestIsRunningLock.acquire();
+ getProgressService().schedule(fUnitTestIsRunningJob);
+
+ fUpdateJob = new UpdateUIJob(Messages.TestRunnerViewPart_jobName);
+ fUpdateJob.schedule(REFRESH_INTERVAL);
+ }
+
+ private void stopUpdateJobs() {
+ if (fUpdateJob != null) {
+ fUpdateJob.stop();
+ fUpdateJob = null;
+ }
+ if (fUnitTestIsRunningJob != null && fUnitTestIsRunningLock != null) {
+ fUnitTestIsRunningLock.release();
+ fUnitTestIsRunningJob = null;
+ }
+ postSyncProcessChanges();
+ }
+
+ private void processChangesInUI() {
+ if (fSashForm.isDisposed())
+ return;
+
+ doShowInfoMessage();
+ refreshCounters();
+
+ if (!fPartIsVisible)
+ updateViewTitleProgress();
+ else {
+ updateViewIcon();
+ }
+ updateNextPreviousActions();
+
+ fTestViewer.processChangesInUI();
+ }
+
+ private void updateNextPreviousActions() {
+ boolean hasErrorsOrFailures = !fIgnoredOnlyFilterAction.isChecked() && hasErrorsOrFailures();
+ fNextAction.setEnabled(hasErrorsOrFailures);
+ fPreviousAction.setEnabled(hasErrorsOrFailures);
+ }
+
+ private String rerunLaunchMode() {
+ return fTestRunSession != null && fTestRunSession.getLaunch() != null
+ ? fTestRunSession.getLaunch().getLaunchMode()
+ : ILaunchManager.RUN_MODE;
+ }
+
+ /**
+ * Re-runs the tests executing the failed tests first
+ */
+ private void rerunFailedTestCases() {
+ if (lastLaunchStillRunning()) {
+ // prompt for terminating the existing run
+ if (MessageDialog.openQuestion(getSite().getShell(), Messages.TestRunnerViewPart_terminate_title,
+ Messages.TestRunnerViewPart_terminate_message) && fTestRunSession != null) {
+ fTestRunSession.abortTestRun();
+ }
+ }
+ List<ITestElement> allFailedTestCases = new ArrayList<>();
+ collectFailedTestCases(fTestRunSession, allFailedTestCases);
+ ILaunchConfiguration tmp = fTestRunSession.getTestViewSupport().getRerunLaunchConfiguration(allFailedTestCases);
+ if (tmp != null) {
+ DebugUITools.launch(tmp, rerunLaunchMode());
+ }
+ }
+
+ private void collectFailedTestCases(TestElement testElement, List<ITestElement> allFailedTestCases) {
+ if (testElement == null) {
+ return;
+ }
+ Result result = testElement.getTestResult(true);
+ if (result != Result.ERROR && result != Result.FAILURE) {
+ return;
+ }
+ if (testElement instanceof TestCaseElement) {
+ allFailedTestCases.add(testElement);
+ } else if (testElement instanceof ITestSuiteElement) {
+ ((ITestSuiteElement) testElement).getChildren()
+ .forEach(child -> collectFailedTestCases((TestElement) child, allFailedTestCases));
+ }
+
+ }
+
+ /**
+ * Sets auto-scroll enabled value
+ *
+ * @param scroll <code>true</code> in case of auto-scroll enabled, otherwise -
+ * <code>false</code>
+ */
+ public void setAutoScroll(boolean scroll) {
+ fAutoScroll = scroll;
+ }
+
+ /**
+ * Indicates if autoscroll is enabled
+ *
+ * @return <code>true</code> if the output scroll and reveal is needed for the
+ * tests as they are executed, otherwise returns <code>false</code>
+ */
+ public boolean isAutoScroll() {
+ return fAutoScroll;
+ }
+
+ /**
+ * Selects the next failure in the tests tree
+ */
+ public void selectNextFailure() {
+ fTestViewer.selectFailure(true);
+ }
+
+ /**
+ * Selects the previous failure in the tests tree
+ */
+ public void selectPreviousFailure() {
+ fTestViewer.selectFailure(false);
+ }
+
+ /**
+ * Selects the first failure in the tests tree
+ */
+ protected void selectFirstFailure() {
+ fTestViewer.selectFirstFailure();
+ }
+
+ private boolean hasErrorsOrFailures() {
+ return getErrorsPlusFailures() > 0;
+ }
+
+ private int getErrorsPlusFailures() {
+ if (fTestRunSession == null)
+ return 0;
+ else
+ return fTestRunSession.getCurrentErrorCount() + fTestRunSession.getCurrentFailureCount();
+ }
+
+ private void handleStopped() {
+ postSyncRunnable(() -> {
+ if (isDisposed())
+ return;
+ resetViewIcon();
+ fStopAction.setEnabled(false);
+ updateRerunFailedFirstAction();
+ });
+ stopUpdateJobs();
+ showMessageIfNoTests();
+ }
+
+ private void showMessageIfNoTests() {
+ if (fTestRunSession != null && fTestRunSession.getFinalTestCaseCount() != null
+ && fTestRunSession.getFinalTestCaseCount().intValue() == 0) {
+ Display.getDefault().asyncExec(() -> {
+ String msg = MessageFormat.format(Messages.TestRunnerViewPart_error_no_tests_found, getDisplayName());
+ MessageDialog.openInformation(getSite().getShell(), Messages.TestRunnerViewPart__error_cannotrun, msg);
+ });
+ }
+ }
+
+ private void resetViewIcon() {
+ fViewImage = fOriginalViewImage;
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ }
+
+ private void updateViewIcon() {
+ if (fTestRunSession == null || fTestRunSession.isStopped() || fTestRunSession.isRunning()
+ || fTestRunSession.countStartedTestCases() == 0)
+ fViewImage = fOriginalViewImage;
+ else if (hasErrorsOrFailures())
+ fViewImage = fTestRunFailIcon;
+ else
+ fViewImage = fTestRunOKIcon;
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ }
+
+ private void updateViewTitleProgress() {
+ if (fTestRunSession != null) {
+ if (fTestRunSession.isRunning()) {
+ Image progress = fProgressImages.getImage(fTestRunSession.countStartedTestCases(),
+ fTestRunSession.getFinalTestCaseCount(),
+ fTestRunSession.getCurrentErrorCount() > 0 || fTestRunSession.getCurrentFailureCount() > 0);
+ if (progress != fViewImage) {
+ fViewImage = progress;
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ }
+ } else {
+ updateViewIcon();
+ }
+ } else {
+ resetViewIcon();
+ }
+ }
+
+ /**
+ * Sets an active test run session
+ *
+ * @param testRunSession new active test run session
+ * @return deactivated session, or <code>null</code> iff no session got
+ * deactivated
+ */
+ public TestRunSession setActiveTestRunSession(TestRunSession testRunSession) {
+ /*
+ * - State: fTestRunSession fTestSessionListener Jobs
+ * fTestViewer.processChangesInUI(); - UI: fCounterPanel fProgressBar
+ * setContentDescription / fInfoMessage setTitleToolTip view icons statusLine
+ * fFailureTrace
+ *
+ * action enablement
+ */
+ if (fTestRunSession == testRunSession)
+ return null;
+
+ deregisterTestSessionListener();
+
+ TestRunSession deactivatedSession = fTestRunSession;
+
+ fTestRunSession = testRunSession;
+ fTestViewer.registerActiveSession(testRunSession);
+ History.INSTANCE.watch(testRunSession);
+
+ if (fSashForm.isDisposed()) {
+ stopUpdateJobs();
+ return deactivatedSession;
+ }
+
+ if (testRunSession == null) {
+ setTitleToolTip(null);
+ resetViewIcon();
+ clearStatus();
+ fFailureTrace.clear();
+
+ registerInfoMessage(" "); //$NON-NLS-1$
+ stopUpdateJobs();
+
+ fStopAction.setEnabled(false);
+ fRerunFailedCasesAction.setEnabled(false);
+ fRerunLastTestAction.setEnabled(false);
+
+ } else {
+ if (fTestRunSession.isStarting() || fTestRunSession.isRunning()) {
+ fTestSessionListener = new TestSessionListener();
+ fTestRunSession.addTestSessionListener(fTestSessionListener);
+ }
+ if (!fTestRunSession.isStarting() && !fShowOnErrorOnly) {
+ showTestResultsView();
+ }
+
+ setTitleToolTip();
+
+ clearStatus();
+ fFailureTrace.clear();
+ registerInfoMessage(BasicElementLabels.getJavaElementName(fTestRunSession.getTestRunName()));
+
+ updateRerunFailedFirstAction();
+ fRerunLastTestAction.setEnabled(fTestRunSession.getLaunch() != null);
+ fEditLaunchConfigAction.setEnabled(fTestRunSession.getLaunch() != null);
+
+ fStopAction.setEnabled(fTestRunSession.isRunning());
+ if (fTestRunSession.isRunning()) {
+ startUpdateJobs();
+ } else /* old or fresh session: don't want jobs at this stage */ {
+ stopUpdateJobs();
+ }
+ }
+ getSite().getShell().getDisplay().asyncExec(this::processChangesInUI);
+ return deactivatedSession;
+ }
+
+ private void deregisterTestSessionListener() {
+ if (fTestRunSession != null && fTestSessionListener != null) {
+ fTestRunSession.removeTestSessionListener(fTestSessionListener);
+ fTestSessionListener = null;
+ }
+ }
+
+ private void updateRerunFailedFirstAction() {
+ boolean state = hasErrorsOrFailures() && fTestRunSession.getLaunch().getLaunchConfiguration() != null;
+ fRerunFailedCasesAction.setEnabled(state);
+ }
+
+ /**
+ * Returns the display name of the current test run session
+ *
+ * @return the display name of the current test run session, or
+ * <code>null</code>
+ */
+ public String getDisplayName() {
+ ITestViewSupport testViewSupport = fTestRunSession.getTestViewSupport();
+ return testViewSupport != null ? testViewSupport.getDisplayName() : null;
+ }
+
+ private void setTitleToolTip() {
+ String displayStr = getDisplayName();
+
+ String testRunLabel = BasicElementLabels.getJavaElementName(fTestRunSession.getTestRunName());
+ if (displayStr != null)
+ setTitleToolTip(MessageFormat.format(Messages.TestRunnerViewPart_titleToolTip, testRunLabel, displayStr));
+ else
+ setTitleToolTip(testRunLabel);
+ }
+
+ @Override
+ public synchronized void dispose() {
+ fIsDisposed = true;
+ if (fTestRunSessionListener != null)
+ UnitTestModel.getInstance().removeTestRunSessionListener(fTestRunSessionListener);
+
+ IHandlerService handlerService = getSite().getWorkbenchWindow().getService(IHandlerService.class);
+ handlerService.deactivateHandler(fRerunLastActivation);
+ handlerService.deactivateHandler(fRerunFailedFirstActivation);
+ setActiveTestRunSession(null);
+
+ if (fProgressImages != null)
+ fProgressImages.dispose();
+ getViewSite().getPage().removePartListener(fPartListener);
+
+ disposeImages();
+ if (fClipboard != null)
+ fClipboard.dispose();
+ if (fViewMenuListener != null) {
+ getViewSite().getActionBars().getMenuManager().removeMenuListener(fViewMenuListener);
+ }
+ /*
+ * if (fDirtyListener != null) {
+ * JavaCore.removeElementChangedListener(fDirtyListener); fDirtyListener= null;
+ * }
+ */
+ if (fFailureTrace != null) {
+ fFailureTrace.dispose();
+ }
+ }
+
+ private void disposeImages() {
+ for (Image imageToDispose : fImagesToDispose) {
+ imageToDispose.dispose();
+ }
+ }
+
+ private void postSyncRunnable(Runnable r) {
+ if (!isDisposed())
+ getDisplay().syncExec(r);
+ }
+
+ private void refreshCounters() {
+ // TODO: Inefficient. Either
+ // - keep a boolean fHasTestRun and update only on changes, or
+ // - improve components to only redraw on changes (once!).
+
+ int startedCount;
+ int ignoredCount;
+ Integer totalCount;
+ int errorCount;
+ int failureCount;
+ int assumptionFailureCount;
+ boolean hasErrorsOrFailures;
+ boolean stopped;
+
+ if (fTestRunSession != null) {
+ startedCount = fTestRunSession.countStartedTestCases();
+ ignoredCount = fTestRunSession.getCurrentIgnoredCount();
+ totalCount = fTestRunSession.getFinalTestCaseCount();
+ errorCount = fTestRunSession.getCurrentErrorCount();
+ failureCount = fTestRunSession.getCurrentFailureCount();
+ assumptionFailureCount = fTestRunSession.getCurrentAssumptionFailureCount();
+ hasErrorsOrFailures = errorCount + failureCount > 0;
+ stopped = fTestRunSession.isStopped();
+ } else {
+ startedCount = 0;
+ ignoredCount = 0;
+ totalCount = null;
+ errorCount = 0;
+ failureCount = 0;
+ assumptionFailureCount = 0;
+ hasErrorsOrFailures = false;
+ stopped = false;
+ }
+
+ fCounterPanel.setTotal(totalCount);
+ fCounterPanel.setRunValue(startedCount, ignoredCount, assumptionFailureCount);
+ fCounterPanel.setErrorValue(errorCount);
+ fCounterPanel.setFailureValue(failureCount);
+
+ int ticksDone;
+ if (startedCount == 0) {
+ ticksDone = 0;
+ } else if (totalCount != null && startedCount == totalCount.intValue()
+ && fTestRunSession.getProgressState() == ProgressState.COMPLETED) {
+ ticksDone = totalCount.intValue();
+ } else {
+ ticksDone = startedCount - 1;
+ }
+
+ fProgressBar.reset(hasErrorsOrFailures, stopped, ticksDone,
+ totalCount != null ? totalCount.intValue() : ticksDone + 1);
+ }
+
+ /**
+ * Queues a runnable that shows a test results view
+ */
+ protected void postShowTestResultsView() {
+ postSyncRunnable(() -> {
+ if (isDisposed())
+ return;
+ showTestResultsView();
+ });
+ }
+
+ /**
+ * Makes the test results view visible
+ */
+ public void showTestResultsView() {
+ IWorkbenchWindow window = getSite().getWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ TestRunnerViewPart testRunner = null;
+
+ if (page != null) {
+ try { // show the result view
+ testRunner = (TestRunnerViewPart) page.findView(TestRunnerViewPart.NAME);
+ if (testRunner == null) {
+ IWorkbenchPart activePart = page.getActivePart();
+ testRunner = (TestRunnerViewPart) page.showView(TestRunnerViewPart.NAME, null,
+ IWorkbenchPage.VIEW_VISIBLE);
+ // restore focus
+ page.activate(activePart);
+ } else {
+ page.bringToTop(testRunner);
+ }
+ } catch (PartInitException pie) {
+ UnitTestPlugin.log(pie);
+ }
+ }
+ }
+
+ /**
+ * Shows an info message
+ */
+ protected void doShowInfoMessage() {
+ if (fInfoMessage != null) {
+ setContentDescription(fInfoMessage);
+ fInfoMessage = null;
+ }
+ }
+
+ /**
+ * Registers a test information message
+ *
+ * @param message an information message to register
+ */
+ public void registerInfoMessage(String message) {
+ fInfoMessage = message;
+ }
+
+ private SashForm createSashForm(Composite parent) {
+ fSashForm = new SashForm(parent, SWT.VERTICAL);
+
+ ViewForm top = new ViewForm(fSashForm, SWT.NONE);
+
+ Composite empty = new Composite(top, SWT.NONE);
+ empty.setLayout(new Layout() {
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ return new Point(1, 1); // (0, 0) does not work with super-intelligent ViewForm
+ }
+
+ @Override
+ protected void layout(Composite composite, boolean flushCache) {
+ }
+ });
+ top.setTopLeft(empty); // makes ViewForm draw the horizontal separator line ...
+ fTestViewer = new TestViewer(top, fClipboard, this);
+ top.setContent(fTestViewer.getTestViewerControl());
+
+ ViewForm bottom = new ViewForm(fSashForm, SWT.NONE);
+
+ CLabel label = new CLabel(bottom, SWT.NONE);
+ label.setText(Messages.TestRunnerViewPart_label_failure);
+ label.setImage(fStackViewIcon);
+ bottom.setTopLeft(label);
+ ToolBar failureToolBar = new ToolBar(bottom, SWT.FLAT | SWT.WRAP);
+ bottom.setTopCenter(failureToolBar);
+ fFailureTrace = new FailureTraceUIBlock(bottom, fClipboard, this, failureToolBar);
+ bottom.setContent(fFailureTrace.getComposite());
+
+ fSashForm.setWeights(50, 50);
+ return fSashForm;
+ }
+
+ private void clearStatus() {
+ getStatusLine().setMessage(null);
+ getStatusLine().setErrorMessage(null);
+ }
+
+ @Override
+ public void setFocus() {
+ if (fTestViewer != null)
+ fTestViewer.getTestViewerControl().setFocus();
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ fParent = parent;
+ addResizeListener(parent);
+ fClipboard = new Clipboard(parent.getDisplay());
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ parent.setLayout(gridLayout);
+
+// fViewHistory= new RunnerViewHistory();
+ configureToolBar();
+
+ fCounterComposite = createProgressCountPanel(parent);
+ fCounterComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ SashForm sashForm = createSashForm(parent);
+ sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ IActionBars actionBars = getViewSite().getActionBars();
+
+ fCopyAction = new UnitTestCopyAction(fFailureTrace, fClipboard);
+ fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId());
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction);
+
+ fPasteAction = new UnitTesttPasteAction(parent.getShell(), fClipboard);
+ fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId());
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction);
+
+ initPageSwitcher();
+ addDropAdapter(parent);
+
+ fOriginalViewImage = getTitleImage();
+ fProgressImages = new ProgressIcons(fOriginalViewImage);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IUnitTestHelpContextIds.RESULTS_VIEW);
+
+ getViewSite().getPage().addPartListener(fPartListener);
+
+ setFilterAndLayout(false, false, TestResultsLayout.HIERARCHICAL);
+ setShowExecutionTime(true);
+ if (fMemento != null) {
+ restoreLayoutState(fMemento);
+ }
+ fMemento = null;
+
+ fTestRunSessionListener = new TestRunSessionListener();
+ UnitTestModel.getInstance().addTestRunSessionListener(fTestRunSessionListener);
+ UnitTestModel.getInstance().addTestRunSessionListener(History.INSTANCE);
+
+ // always show youngest test run in view. simulate "sessionAdded" event to do
+ // that
+ List<TestRunSession> testRunSessions = UnitTestModel.getInstance().getTestRunSessions();
+ if (!testRunSessions.isEmpty()) {
+ fTestRunSessionListener.sessionAdded(testRunSessions.get(0));
+ }
+ }
+
+ private void addDropAdapter(Composite parent) {
+ DropTarget dropTarget = new DropTarget(parent,
+ DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT);
+ dropTarget.setTransfer(TextTransfer.getInstance());
+ class DropAdapter extends DropTargetAdapter {
+ @Override
+ public void dragEnter(DropTargetEvent event) {
+ event.detail = DND.DROP_COPY;
+ event.feedback = DND.FEEDBACK_NONE;
+ }
+
+ @Override
+ public void dragOver(DropTargetEvent event) {
+ event.detail = DND.DROP_COPY;
+ event.feedback = DND.FEEDBACK_NONE;
+ }
+
+ @Override
+ public void dragOperationChanged(DropTargetEvent event) {
+ event.detail = DND.DROP_COPY;
+ event.feedback = DND.FEEDBACK_NONE;
+ }
+
+ @Override
+ public void drop(final DropTargetEvent event) {
+ if (TextTransfer.getInstance().isSupportedType(event.currentDataType)) {
+ String url = (String) event.data;
+ importTestRunSession(url);
+ }
+ }
+ }
+ dropTarget.addDropListener(new DropAdapter());
+ }
+
+ private void initPageSwitcher() {
+ /*
+ * @SuppressWarnings("unused") PageSwitcher pageSwitcher= new PageSwitcher(this)
+ * {
+ *
+ * @Override public Object[] getPages() { return
+ * fViewHistory.getHistoryEntries().toArray(); }
+ *
+ * @Override public String getName(Object page) { return
+ * fViewHistory.getText((TestRunSession) page); }
+ *
+ * @Override public ImageDescriptor getImageDescriptor(Object page) { return
+ * fViewHistory.getImageDescriptor(page); }
+ *
+ * @Override public void activatePage(Object page) {
+ * fViewHistory.setActiveEntry((TestRunSession) page); }
+ *
+ * @Override public int getCurrentPageIndex() { return
+ * fViewHistory.getHistoryEntries().indexOf(fViewHistory.getCurrentEntry()); }
+ * };
+ */
+ }
+
+ private void addResizeListener(Composite parent) {
+ parent.addControlListener(ControlListener.controlResizedAdapter(e -> {
+ computeOrientation();
+ }));
+ }
+
+ void computeOrientation() {
+ if (fOrientation != VIEW_ORIENTATION_AUTOMATIC) {
+ fCurrentOrientation = fOrientation;
+ setOrientation(fCurrentOrientation);
+ } else {
+ Point size = fParent.getSize();
+ if (size.x != 0 && size.y != 0) {
+ if (size.x > size.y)
+ setOrientation(VIEW_ORIENTATION_HORIZONTAL);
+ else
+ setOrientation(VIEW_ORIENTATION_VERTICAL);
+ }
+ }
+ }
+
+ private void configureToolBar() {
+ IActionBars actionBars = getViewSite().getActionBars();
+ IToolBarManager toolBar = actionBars.getToolBarManager();
+ IMenuManager viewMenu = actionBars.getMenuManager();
+ fNextAction = new ShowNextFailureAction(this);
+ fNextAction.setEnabled(false);
+ actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNextAction);
+
+ fPreviousAction = new ShowPreviousFailureAction(this);
+ fPreviousAction.setEnabled(false);
+ actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPreviousAction);
+ fStopAction = new StopAction();
+ fStopAction.setEnabled(false);
+
+ fRerunLastTestAction = new RerunLastAction();
+ IHandlerService handlerService = getSite().getWorkbenchWindow().getService(IHandlerService.class);
+ IHandler handler = new AbstractHandler() {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ fRerunLastTestAction.run();
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return fRerunLastTestAction.isEnabled();
+ }
+ };
+ fRerunLastActivation = handlerService.activateHandler(RERUN_LAST_COMMAND, handler);
+
+ fRerunFailedCasesAction = new RerunFailedCasesAction();
+ handler = new AbstractHandler() {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ fRerunFailedCasesAction.run();
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return fRerunFailedCasesAction.isEnabled();
+ }
+ };
+ fRerunFailedFirstActivation = handlerService.activateHandler(RERUN_FAILED_CASES_COMMAND, handler);
+ fEditLaunchConfigAction = new EditLaunchConfigurationAction() {
+ @Override
+ protected ILaunchConfiguration getLaunchConfiguration() {
+ return fTestRunSession != null ? fTestRunSession.getLaunch().getLaunchConfiguration() : null;
+ }
+
+ @Override
+ protected String getMode() {
+ return rerunLaunchMode();
+ }
+
+ @Override
+ protected boolean isTerminated() {
+ return true; // always allow to re-run
+ }
+ };
+ fEditLaunchConfigAction.setToolTipText(Messages.TestRunnerViewPart_editLaunchConfiguration);
+ fEditLaunchConfigAction.setImageDescriptor(
+ DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT));
+ fEditLaunchConfigAction.setDisabledImageDescriptor(
+ DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_MODIFICATION_WATCHPOINT_DISABLED));
+
+ fFailuresOnlyFilterAction = new FailuresOnlyFilterAction();
+ fIgnoredOnlyFilterAction = new IgnoredOnlyFilterAction();
+
+ fScrollLockAction = new ScrollLockAction(this);
+ fScrollLockAction.setChecked(!fAutoScroll);
+
+ fToggleOrientationActions = new ToggleOrientationAction[] {
+ new ToggleOrientationAction(VIEW_ORIENTATION_VERTICAL),
+ new ToggleOrientationAction(VIEW_ORIENTATION_HORIZONTAL),
+ new ToggleOrientationAction(VIEW_ORIENTATION_AUTOMATIC) };
+
+ toolBar.add(fNextAction);
+ toolBar.add(fPreviousAction);
+ toolBar.add(fFailuresOnlyFilterAction);
+ toolBar.add(fIgnoredOnlyFilterAction);
+ toolBar.add(fScrollLockAction);
+ toolBar.add(new Separator());
+ toolBar.add(fRerunLastTestAction);
+ toolBar.add(fRerunFailedCasesAction);
+ toolBar.add(fStopAction);
+ toolBar.add(fEditLaunchConfigAction);
+ toolBar.add(new Separator());
+ IContributionItem historyIte = new CommandContributionItem(new CommandContributionItemParameter(getSite(),
+ HistoryHandler.COMMAND_ID, HistoryHandler.COMMAND_ID, SWT.PUSH));
+ toolBar.add(historyIte);
+
+ fShowTestHierarchyAction = new ShowTestHierarchyAction();
+ fShowTimeAction = new ShowTimeAction();
+ viewMenu.add(fShowTestHierarchyAction);
+ viewMenu.add(fShowTimeAction);
+ viewMenu.add(new Separator());
+
+ MenuManager layoutSubMenu = new MenuManager(Messages.TestRunnerViewPart_layout_menu);
+ for (ToggleOrientationAction toggleOrientationAction : fToggleOrientationActions) {
+ layoutSubMenu.add(toggleOrientationAction);
+ }
+ viewMenu.add(layoutSubMenu);
+ MenuManager sortSubmenu = new MenuManager(Messages.TestRunnerViewPart_sort);
+ sortSubmenu.add(new SortAction(true));
+ sortSubmenu.add(new SortAction(false));
+ viewMenu.add(sortSubmenu);
+ viewMenu.add(new Separator());
+
+ viewMenu.add(fFailuresOnlyFilterAction);
+ viewMenu.add(fIgnoredOnlyFilterAction);
+
+ fActivateOnErrorAction = new ActivateOnErrorAction();
+ viewMenu.add(fActivateOnErrorAction);
+ fViewMenuListener = manager -> fActivateOnErrorAction.update();
+
+ viewMenu.addMenuListener(fViewMenuListener);
+
+ actionBars.updateActionBars();
+ }
+
+ private IStatusLineManager getStatusLine() {
+ // we want to show messages globally hence we
+ // have to go through the active part
+ IViewSite site = getViewSite();
+ IWorkbenchPage page = site.getPage();
+ IWorkbenchPart activePart = page.getActivePart();
+
+ if (activePart instanceof IViewPart) {
+ IViewPart activeViewPart = (IViewPart) activePart;
+ IViewSite activeViewSite = activeViewPart.getViewSite();
+ return activeViewSite.getActionBars().getStatusLineManager();
+ }
+
+ if (activePart instanceof IEditorPart) {
+ IEditorPart activeEditorPart = (IEditorPart) activePart;
+ IEditorActionBarContributor contributor = activeEditorPart.getEditorSite().getActionBarContributor();
+ if (contributor instanceof EditorActionBarContributor)
+ return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
+ }
+ // no active part
+ return getViewSite().getActionBars().getStatusLineManager();
+ }
+
+ /**
+ * Creates a progress count panel
+ *
+ * @param parent a parent composite
+ * @return a progress count ppanel composite object
+ */
+ protected Composite createProgressCountPanel(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ setCounterColumns(layout);
+
+ fCounterPanel = new CounterPanel(composite);
+ fCounterPanel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ fProgressBar = new UnitTestProgressBar(composite);
+ fProgressBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ return composite;
+ }
+
+ /**
+ * Handles the test element selection
+ *
+ * @param test a selected test element
+ */
+ public void handleTestSelected(TestElement test) {
+ showFailure(test);
+ fCopyAction.handleTestSelected(test);
+ }
+
+ private void showFailure(final TestElement test) {
+ postSyncRunnable(() -> {
+ if (!isDisposed()) {
+ fFailureTrace.showFailure(test);
+ }
+ });
+ }
+
+ /**
+ * Returns a current test run session object
+ *
+ * @return the current test run session, or <code>null</code>
+ */
+ public TestRunSession getCurrentTestRunSession() {
+ return fTestRunSession;
+ }
+
+ private boolean isDisposed() {
+ return fIsDisposed || fCounterPanel.isDisposed();
+ }
+
+ private Display getDisplay() {
+ return getViewSite().getShell().getDisplay();
+ }
+
+ @Override
+ public Image getTitleImage() {
+ if (fOriginalViewImage == null) {
+ fOriginalViewImage = super.getTitleImage();
+ }
+
+ if (fViewImage == null) {
+ return super.getTitleImage();
+ }
+ return fViewImage;
+ }
+
+ void codeHasChanged() {
+ /*
+ * if (fDirtyListener != null) {
+ * JavaCore.removeElementChangedListener(fDirtyListener); fDirtyListener= null;
+ * }
+ */
+ if (fViewImage == fTestRunOKIcon)
+ fViewImage = fTestRunOKDirtyIcon;
+ else if (fViewImage == fTestRunFailIcon)
+ fViewImage = fTestRunFailDirtyIcon;
+
+ Runnable r = () -> {
+ if (isDisposed())
+ return;
+ firePropertyChange(IWorkbenchPart.PROP_TITLE);
+ };
+ if (!isDisposed())
+ getDisplay().asyncExec(r);
+ }
+
+ private void postSyncProcessChanges() {
+ postSyncRunnable(this::processChangesInUI);
+ }
+
+ /**
+ * Warns on content change
+ */
+ public void warnOfContentChange() {
+ IWorkbenchSiteProgressService service = getProgressService();
+ if (service != null)
+ service.warnOfContentChange();
+ }
+
+ /**
+ * Indicates if the last test launch is kept alive
+ *
+ * @return <code>true</code> in case of the last test launch is kept alive,
+ * otherwise returns <code>false</code>
+ */
+ public boolean lastLaunchStillRunning() {
+ return fTestRunSession != null && !fTestRunSession.getLaunch().isTerminated();
+ }
+
+ private void setOrientation(int orientation) {
+ if ((fSashForm == null) || fSashForm.isDisposed())
+ return;
+ boolean horizontal = orientation == VIEW_ORIENTATION_HORIZONTAL;
+ fSashForm.setOrientation(horizontal ? SWT.HORIZONTAL : SWT.VERTICAL);
+ for (ToggleOrientationAction toggleOrientationAction : fToggleOrientationActions)
+ toggleOrientationAction.setChecked(fOrientation == toggleOrientationAction.getOrientation());
+ fCurrentOrientation = orientation;
+ GridLayout layout = (GridLayout) fCounterComposite.getLayout();
+ setCounterColumns(layout);
+ fParent.layout();
+ }
+
+ private void setCounterColumns(GridLayout layout) {
+ if (fCurrentOrientation == VIEW_ORIENTATION_HORIZONTAL)
+ layout.numColumns = 2;
+ else
+ layout.numColumns = 1;
+ }
+
+ static boolean getShowOnErrorOnly() {
+ return Platform.getPreferencesService().getBoolean(UnitTestPlugin.PLUGIN_ID,
+ UnitTestPreferencesConstants.SHOW_ON_ERROR_ONLY, false, null);
+ }
+
+ static void importTestRunSession(final String url) {
+ try {
+ PlatformUI.getWorkbench().getProgressService()
+ .busyCursorWhile(monitor -> UnitTestModel.getInstance().importTestRunSession(url, monitor));
+ } catch (InterruptedException e) {
+ // cancelled
+ } catch (InvocationTargetException e) {
+ CoreException ce = (CoreException) e.getCause();
+ StatusManager.getManager().handle(ce.getStatus(), StatusManager.SHOW | StatusManager.LOG);
+ }
+ }
+
+ /**
+ * Returns the Failure Trace UI Block
+ *
+ * @return the current failure trace OI block
+ */
+ public FailureTraceUIBlock getFailureTrace() {
+ return fFailureTrace;
+ }
+
+ void setShowFailuresOnly(boolean failuresOnly) {
+ setFilterAndLayout(failuresOnly, false /* ignoredOnly must be off */, fLayout);
+ }
+
+ void setShowIgnoredOnly(boolean ignoredOnly) {
+ setFilterAndLayout(false /* failuresOnly must be off */, ignoredOnly, fLayout);
+ }
+
+ private void setFilterAndLayout(boolean failuresOnly, boolean ignoredOnly, TestResultsLayout layoutMode) {
+ fShowTestHierarchyAction.setChecked(layoutMode == TestResultsLayout.HIERARCHICAL);
+ fLayout = layoutMode;
+ fFailuresOnlyFilterAction.setChecked(failuresOnly);
+ fIgnoredOnlyFilterAction.setChecked(ignoredOnly);
+ fTestViewer.setShowFailuresOrIgnoredOnly(failuresOnly, ignoredOnly, layoutMode);
+ updateNextPreviousActions();
+ }
+
+ private void setShowExecutionTime(boolean showTime) {
+ fTestViewer.setShowTime(showTime);
+ fShowTimeAction.setChecked(showTime);
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionLabelProvider.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionLabelProvider.java
new file mode 100644
index 000000000..d7a7e98fb
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionLabelProvider.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.ui;
+
+import java.text.MessageFormat;
+import java.time.Duration;
+
+import org.eclipse.unittest.internal.model.Status;
+import org.eclipse.unittest.internal.model.TestCaseElement;
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.internal.ui.TestRunnerViewPart.TestResultsLayout;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestRunSession;
+
+import org.eclipse.swt.graphics.Image;
+
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.StyledCellLabelProvider;
+import org.eclipse.jface.viewers.StyledString;
+
+/**
+ * A Test Session label provider implementation.
+ */
+class TestSessionLabelProvider extends LabelProvider implements IStyledLabelProvider {
+
+ private final TestRunnerViewPart fTestRunnerPart;
+ private final TestResultsLayout fLayoutMode;
+
+ private boolean fShowTime;
+
+ /**
+ * Constructs Test Session Provider object.
+ *
+ * @param testRunnerPart a test runner view part object
+ * @param layoutMode a layout mode
+ */
+ public TestSessionLabelProvider(TestRunnerViewPart testRunnerPart, TestResultsLayout layoutMode) {
+ fTestRunnerPart = testRunnerPart;
+ fLayoutMode = layoutMode;
+ fShowTime = true;
+ }
+
+ @Override
+ public StyledString getStyledText(Object element) {
+ if (!(element instanceof ITestElement)) {
+ return new StyledString(element.toString());
+ }
+ TestElement testElement = (TestElement) element;
+ StyledString text = new StyledString(testElement.getDisplayName());
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL) {
+ if (testElement.getParentContainer() instanceof ITestRunSession) {
+ String displayName = fTestRunnerPart.getDisplayName();
+ if (displayName != null) {
+ String decorated = MessageFormat.format(Messages.TestSessionLabelProvider_testName_RunnerVersion,
+ text.getString(), displayName);
+ text = StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, text);
+ }
+ }
+
+ } else {
+ if (element instanceof TestCaseElement) {
+ String decorated = getTextForFlatLayout((TestCaseElement) testElement, text.getString());
+ text = StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, text);
+ }
+ }
+ return addElapsedTime(text, testElement.getDuration());
+ }
+
+ private String getTextForFlatLayout(TestCaseElement testCaseElement, String label) {
+ String parentName;
+ String parentDisplayName = testCaseElement.getParent().getDisplayName();
+ if (parentDisplayName != null) {
+ parentName = parentDisplayName;
+ } else {
+ parentName = testCaseElement.getTestName();
+ }
+ return MessageFormat.format(Messages.TestSessionLabelProvider_testMethodName_className, label,
+ BasicElementLabels.getJavaElementName(parentName));
+ }
+
+ private StyledString addElapsedTime(StyledString styledString, Duration duration) {
+ String string = styledString.getString();
+ String decorated = addElapsedTime(string, duration);
+ return StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.COUNTER_STYLER, styledString);
+ }
+
+ private String addElapsedTime(String string, Duration duration) {
+ if (!fShowTime || duration == null) {
+ return string;
+ }
+ return MessageFormat.format(Messages.TestSessionLabelProvider_testName_elapsedTimeInSeconds, string,
+ Double.valueOf(duration.toNanos() / 1.0e9));
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (!(element instanceof ITestElement)) {
+ return element.toString();
+ }
+ TestElement testElement = (TestElement) element;
+ String label = testElement.getDisplayName();
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL) {
+ if (testElement instanceof ITestRunSession || (testElement.getParent() instanceof ITestRunSession
+ && testElement.getParent().getChildren().size() <= 1)) {
+ String displayName = fTestRunnerPart.getDisplayName();
+ if (displayName != null) {
+ label = MessageFormat.format(Messages.TestSessionLabelProvider_testName_RunnerVersion, label,
+ displayName);
+ }
+ }
+ } else {
+ if (element instanceof TestCaseElement) {
+ label = getTextForFlatLayout((TestCaseElement) testElement, label);
+ }
+ }
+ return addElapsedTime(label, testElement.getDuration());
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof TestElement && ((TestElement) element).isAssumptionFailure())
+ return fTestRunnerPart.fTestAssumptionFailureIcon;
+
+ if (element instanceof TestCaseElement) {
+ TestCaseElement testCaseElement = ((TestCaseElement) element);
+ if (testCaseElement.isIgnored())
+ return fTestRunnerPart.fTestIgnoredIcon;
+
+ Status status = testCaseElement.getStatus();
+ if (status.isNotRun())
+ return fTestRunnerPart.fTestIcon;
+ else if (status.isRunning())
+ return fTestRunnerPart.fTestRunningIcon;
+ else if (status.isError())
+ return fTestRunnerPart.fTestErrorIcon;
+ else if (status.isFailure())
+ return fTestRunnerPart.fTestFailIcon;
+ else if (status.isOK())
+ return fTestRunnerPart.fTestOkIcon;
+ else
+ throw new IllegalStateException(element.toString());
+ } else if (element instanceof TestElement) { // suite or session
+ Status status = ((TestElement) element).getStatus();
+ if (status.isNotRun())
+ return fTestRunnerPart.fSuiteIcon;
+ else if (status.isRunning())
+ return fTestRunnerPart.fSuiteRunningIcon;
+ else if (status.isError())
+ return fTestRunnerPart.fSuiteErrorIcon;
+ else if (status.isFailure())
+ return fTestRunnerPart.fSuiteFailIcon;
+ else if (status.isOK())
+ return fTestRunnerPart.fSuiteOkIcon;
+ else
+ throw new IllegalStateException(element.toString());
+ } else {
+ throw new IllegalArgumentException(String.valueOf(element));
+ }
+ }
+
+ /**
+ * Makes the label provider to show time on the generated labels
+ *
+ * @param showTime <code>true</code> in case a time value is to be shown,
+ * otherwise - <code>false</code>
+ */
+ public void setShowTime(boolean showTime) {
+ fShowTime = showTime;
+ fireLabelProviderChanged(new LabelProviderChangedEvent(this));
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTableContentProvider.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTableContentProvider.java
new file mode 100644
index 000000000..93dfb7cee
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTableContentProvider.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.unittest.internal.model.TestCaseElement;
+import org.eclipse.unittest.internal.model.TestSuiteElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestRunSession;
+import org.eclipse.unittest.model.ITestSuiteElement;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * A test session table content provider
+ */
+public class TestSessionTableContentProvider implements IStructuredContentProvider {
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ ITestRunSession session = (ITestRunSession) inputElement;
+ List<ITestElement> all = new ArrayList<>();
+ addAll(all, session);
+ return all.toArray();
+ }
+
+ private void addAll(List<ITestElement> all, ITestSuiteElement suite) {
+ for (ITestElement element : suite.getChildren()) {
+ if (element instanceof TestSuiteElement) {
+ if (((TestSuiteElement) element).getSuiteStatus().isErrorOrFailure())
+ all.add(element); // add failed suite to flat list too
+ addAll(all, (TestSuiteElement) element);
+ } else if (element instanceof TestCaseElement) {
+ all.add(element);
+ }
+ }
+ }
+
+ @Override
+ public void dispose() {
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTreeContentProvider.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTreeContentProvider.java
new file mode 100644
index 000000000..239ac6953
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestSessionTreeContentProvider.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.model.TestSuiteElement;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * A test session tree content provider
+ */
+public class TestSessionTreeContentProvider implements ITreeContentProvider {
+
+ private static final Object[] NO_CHILDREN = new Object[0];
+
+ @Override
+ public void dispose() {
+ // nothing to dispose
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof TestSuiteElement) {
+ return ((TestSuiteElement) parentElement).getChildren().toArray();
+ } else {
+ return NO_CHILDREN;
+ }
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ TestRunnerViewPart part = (TestRunnerViewPart) inputElement;
+ TestRunSession session = part.getCurrentTestRunSession();
+ return new Object[] { session.getChildren().size() == 1 ? session.getChildren().get(0) : session };
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ return ((TestElement) element).getParent();
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof TestSuiteElement) {
+ return !((TestSuiteElement) element).getChildren().isEmpty();
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // nothing
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestViewer.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestViewer.java
new file mode 100644
index 000000000..a36384d9a
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TestViewer.java
@@ -0,0 +1,871 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.unittest.internal.ui;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.model.Status;
+import org.eclipse.unittest.internal.model.TestCaseElement;
+import org.eclipse.unittest.internal.model.TestElement;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.model.TestSuiteElement;
+import org.eclipse.unittest.internal.ui.TestRunnerViewPart.TestResultsLayout;
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.Result;
+import org.eclipse.unittest.model.ITestRunSession;
+import org.eclipse.unittest.model.ITestSuiteElement;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.TableItem;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.part.PageBook;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+
+/**
+ * A Test Viewer implementation
+ */
+class TestViewer {
+
+ private final class TestSelectionListener implements ISelectionChangedListener {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) fSelectionProvider.getSelection();
+ TestElement testElement = null;
+ if (selection.size() == 1) {
+ testElement = (TestElement) selection.getFirstElement();
+ }
+ fTestRunnerPart.handleTestSelected(testElement);
+ }
+ }
+
+ private final class TestOpenListener extends SelectionAdapter {
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ handleDefaultSelected();
+ }
+ }
+
+ private final class FailuresOnlyFilter extends ViewerFilter {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return select(((TestElement) element));
+ }
+
+ public boolean select(TestElement testElement) {
+ Status status = testElement.getStatus();
+ if (status.isErrorOrFailure())
+ return true;
+ else
+ return !fTestRunSession.isRunning() && status == Status.RUNNING; // rerunning
+ }
+ }
+
+ private final class IgnoredOnlyFilter extends ViewerFilter {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return select(((TestElement) element));
+ }
+
+ public boolean select(TestElement testElement) {
+ if (hasIgnoredInTestResult(testElement))
+ return true;
+ else
+ return !fTestRunSession.isRunning() && testElement.getStatus() == Status.RUNNING; // rerunning
+ }
+
+ /**
+ * Checks whether a test was skipped i.e. it was ignored (<code>@Ignored</code>)
+ * or had any assumption failure.
+ *
+ * @param testElement the test element (a test suite or a single test case)
+ *
+ * @return <code>true</code> if the test element or any of its children has
+ * {@link Result#IGNORED} test result
+ */
+ private boolean hasIgnoredInTestResult(TestElement testElement) {
+ if (testElement instanceof TestSuiteElement) {
+ List<TestElement> children = ((TestSuiteElement) testElement).getChildren();
+ for (TestElement child : children) {
+ boolean hasIgnoredTestResult = hasIgnoredInTestResult(child);
+ if (hasIgnoredTestResult) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ return testElement.getTestResult(false) == Result.IGNORED;
+ }
+ }
+
+ private static class ReverseList<E> extends AbstractList<E> {
+ private final List<E> fList;
+
+ public ReverseList(List<E> list) {
+ fList = list;
+ }
+
+ @Override
+ public E get(int index) {
+ return fList.get(fList.size() - index - 1);
+ }
+
+ @Override
+ public int size() {
+ return fList.size();
+ }
+ }
+
+ private class ExpandAllAction extends Action {
+ public ExpandAllAction() {
+ setText(Messages.ExpandAllAction_text);
+ setToolTipText(Messages.ExpandAllAction_tooltip);
+ }
+
+ @Override
+ public void run() {
+ fTreeViewer.expandAll();
+ }
+ }
+
+ private class CollapseAllAction extends Action {
+ public CollapseAllAction() {
+ setText(Messages.CollapseAllAction_text);
+ setToolTipText(Messages.CollapseAllAction_tooltip);
+ }
+
+ @Override
+ public void run() {
+ fTreeViewer.collapseAll();
+ }
+ }
+
+ /**
+ * Compares two {@link TestElement}s: - {@link TestSuiteElement}s are placed on
+ * top of {@link TestCaseElement}s - TestElements are alphabetically ordered(by
+ * their names)
+ */
+ private static final ViewerComparator TEST_ELEMENT_ALPHABETIC_ORDER = new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ // Show test suites on top of test messages
+ int weight1 = (e1 instanceof ITestSuiteElement) ? 0 : 1;
+ int weight2 = (e2 instanceof ITestSuiteElement) ? 0 : 1;
+ if (weight1 != weight2) {
+ return weight1 - weight2;
+ }
+ // Compare by element names
+ return ((TestElement) e1).getTestName().compareTo(((TestElement) e2).getTestName());
+ }
+ };
+
+ private final FailuresOnlyFilter fFailuresOnlyFilter = new FailuresOnlyFilter();
+ private final IgnoredOnlyFilter fIgnoredOnlyFilter = new IgnoredOnlyFilter();
+
+ private final TestRunnerViewPart fTestRunnerPart;
+ private final Clipboard fClipboard;
+
+ private PageBook fViewerbook;
+ private TreeViewer fTreeViewer;
+ private TestSessionTreeContentProvider fTreeContentProvider;
+ private TestSessionLabelProvider fTreeLabelProvider;
+ private TableViewer fTableViewer;
+ private TestSessionLabelProvider fTableLabelProvider;
+ private SelectionProviderMediator fSelectionProvider;
+
+ private TestResultsLayout fLayoutMode;
+ private boolean fTreeHasFilter;
+ private boolean fTableHasFilter;
+
+ private TestRunSession fTestRunSession;
+
+ private boolean fTreeNeedsRefresh;
+ private boolean fTableNeedsRefresh;
+ private HashSet<ITestElement> fNeedUpdate;
+ private ITestCaseElement fAutoScrollTarget;
+
+ private LinkedList<ITestSuiteElement> fAutoClose;
+ private HashSet<ITestSuiteElement> fAutoExpand;
+
+ /**
+ * Constructs a Test Viewer object
+ *
+ * @param parent a parent composite
+ * @param clipboard a {@link Clipboard} instance
+ * @param runner a Test Runner view part
+ */
+ public TestViewer(Composite parent, Clipboard clipboard, TestRunnerViewPart runner) {
+ fTestRunnerPart = runner;
+ fClipboard = clipboard;
+
+ fLayoutMode = TestRunnerViewPart.TestResultsLayout.HIERARCHICAL;
+
+ createTestViewers(parent);
+
+ registerViewersRefresh();
+
+ initContextMenu();
+ }
+
+ private void createTestViewers(Composite parent) {
+ fViewerbook = new PageBook(parent, SWT.NULL);
+
+ fTreeViewer = new TreeViewer(fViewerbook, SWT.V_SCROLL | SWT.SINGLE);
+ fTreeViewer.setUseHashlookup(true);
+ fTreeContentProvider = new TestSessionTreeContentProvider();
+ fTreeViewer.setContentProvider(fTreeContentProvider);
+ fTreeLabelProvider = new TestSessionLabelProvider(fTestRunnerPart,
+ TestRunnerViewPart.TestResultsLayout.HIERARCHICAL);
+// fTreeViewer.setLabelProvider(new ColoringLabelProvider(fTreeLabelProvider));
+ fTreeViewer.setLabelProvider(fTreeLabelProvider);
+
+ fTableViewer = new TableViewer(fViewerbook, SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
+ fTableViewer.setUseHashlookup(true);
+ TestSessionTableContentProvider fTableContentProvider = new TestSessionTableContentProvider();
+ fTableViewer.setContentProvider(fTableContentProvider);
+ fTableLabelProvider = new TestSessionLabelProvider(fTestRunnerPart, TestRunnerViewPart.TestResultsLayout.FLAT);
+// fTableViewer.setLabelProvider(new ColoringLabelProvider(fTableLabelProvider));
+ fTableViewer.setLabelProvider(fTableLabelProvider);
+
+ fSelectionProvider = new SelectionProviderMediator(new StructuredViewer[] { fTreeViewer, fTableViewer },
+ fTreeViewer);
+ fSelectionProvider.addSelectionChangedListener(new TestSelectionListener());
+ TestOpenListener testOpenListener = new TestOpenListener();
+ fTreeViewer.getTree().addSelectionListener(testOpenListener);
+ fTableViewer.getTable().addSelectionListener(testOpenListener);
+
+ fTestRunnerPart.getSite().setSelectionProvider(fSelectionProvider);
+
+ fViewerbook.showPage(fTreeViewer.getTree());
+ }
+
+ private void initContextMenu() {
+ MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(this::handleMenuAboutToShow);
+ fTestRunnerPart.getSite().registerContextMenu(menuMgr, fSelectionProvider);
+ Menu menu = menuMgr.createContextMenu(fViewerbook);
+ fTreeViewer.getTree().setMenu(menu);
+ fTableViewer.getTable().setMenu(menu);
+ }
+
+ void handleMenuAboutToShow(IMenuManager manager) {
+ IStructuredSelection selection = (IStructuredSelection) fSelectionProvider.getSelection();
+ if (!selection.isEmpty()) {
+ TestElement testElement = (TestElement) selection.getFirstElement();
+
+ if (testElement instanceof TestSuiteElement) {
+ TestSuiteElement testSuiteElement = (TestSuiteElement) testElement;
+ IAction openTestAction = testSuiteElement.getTestRunSession().getTestViewSupport()
+ .getOpenTestAction(fTestRunnerPart.getSite().getShell(), testSuiteElement);
+ if (openTestAction != null) {
+ manager.add(openTestAction);
+ }
+ manager.add(new Separator());
+ if (!fTestRunnerPart.lastLaunchStillRunning()) {
+ addRerunActions(manager, testSuiteElement);
+ }
+ } else {
+ TestCaseElement testCaseElement = (TestCaseElement) testElement;
+ IAction openTestAction = testElement.getTestRunSession().getTestViewSupport()
+ .getOpenTestAction(fTestRunnerPart.getSite().getShell(), testCaseElement);
+ if (openTestAction != null) {
+ manager.add(openTestAction);
+ }
+ manager.add(new Separator());
+ addRerunActions(manager, testCaseElement);
+ }
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL) {
+ manager.add(new Separator());
+ manager.add(new ExpandAllAction());
+ manager.add(new CollapseAllAction());
+ }
+
+ }
+ if (fTestRunSession != null
+ && fTestRunSession.getCurrentFailureCount() + fTestRunSession.getCurrentErrorCount() > 0) {
+ if (fLayoutMode != TestRunnerViewPart.TestResultsLayout.HIERARCHICAL) {
+ manager.add(new Separator());
+ }
+ manager.add(new CopyFailureListAction(fTestRunnerPart, fClipboard));
+ }
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end")); //$NON-NLS-1$
+ }
+
+ private void addRerunActions(IMenuManager manager, TestElement testCaseElement) {
+ ILaunchConfiguration rerunLaunchConfiguration = testCaseElement.getTestRunSession().getTestViewSupport()
+ .getRerunLaunchConfiguration(Collections.singletonList(testCaseElement));
+ if (rerunLaunchConfiguration == null) {
+ return;
+ }
+ if (fTestRunnerPart.lastLaunchStillRunning()) {
+ manager.add(new RerunAction(rerunLaunchConfiguration, ILaunchManager.RUN_MODE));
+ } else {
+ try {
+ rerunLaunchConfiguration.getType().getSupportedModeCombinations().stream() //
+ .filter(modes -> modes.size() == 1) //
+ .flatMap(Collection::stream) //
+ .forEach(mode -> manager.add(new RerunAction(rerunLaunchConfiguration, mode)));
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+ }
+
+ /**
+ * Returns the tree viewer control
+ *
+ * @return tree viewer control object
+ */
+ public Control getTestViewerControl() {
+ return fViewerbook;
+ }
+
+ /**
+ * Registers a given active test session
+ *
+ * @param testRunSession a test session object
+ */
+ public synchronized void registerActiveSession(TestRunSession testRunSession) {
+ fTestRunSession = testRunSession;
+ registerAutoScrollTarget(null);
+ registerViewersRefresh();
+ }
+
+ void handleDefaultSelected() {
+ IStructuredSelection selection = (IStructuredSelection) fSelectionProvider.getSelection();
+ if (selection.size() != 1)
+ return;
+
+ TestElement testElement = (TestElement) selection.getFirstElement();
+ IAction action;
+ if (testElement instanceof ITestSuiteElement) {
+ action = testElement.getTestRunSession().getTestViewSupport()
+ .getOpenTestAction(fTestRunnerPart.getSite().getShell(), (ITestSuiteElement) testElement);
+ } else if (testElement instanceof ITestCaseElement) {
+ action = testElement.getTestRunSession().getTestViewSupport()
+ .getOpenTestAction(fTestRunnerPart.getSite().getShell(), (ITestCaseElement) testElement);
+ } else {
+ throw new IllegalStateException(String.valueOf(testElement));
+ }
+
+ if (action != null && action.isEnabled())
+ action.run();
+ }
+
+ /**
+ * Tunes the label providers to show time on the generated labels
+ *
+ * @param showTime <code>true</code> in case a time value is to be shown,
+ * otherwise - <code>false</code>
+ */
+ public synchronized void setShowTime(boolean showTime) {
+ try {
+ fViewerbook.setRedraw(false);
+ fTreeLabelProvider.setShowTime(showTime);
+ fTableLabelProvider.setShowTime(showTime);
+ } finally {
+ fViewerbook.setRedraw(true);
+ }
+ }
+
+ /**
+ * It makes sense to display either failed or ignored tests, not both together.
+ *
+ * @param failuresOnly whether to show only failed tests
+ * @param ignoredOnly whether to show only skipped tests
+ * @param layoutMode the layout mode
+ */
+ public synchronized void setShowFailuresOrIgnoredOnly(boolean failuresOnly, boolean ignoredOnly,
+ TestResultsLayout layoutMode) {
+ /*
+ * Management of fTreeViewer and fTableViewer
+ * ****************************************** - invisible viewer is updated on
+ * registerViewerUpdate unless its f*NeedsRefresh is true - invisible viewer is
+ * not refreshed upfront - on layout change, new viewer is refreshed if
+ * necessary - filter only applies to "current" layout mode / viewer
+ */
+ try {
+ fViewerbook.setRedraw(false);
+
+ IStructuredSelection selection = null;
+ boolean switchLayout = layoutMode != fLayoutMode;
+ if (switchLayout) {
+ selection = (IStructuredSelection) fSelectionProvider.getSelection();
+ if (layoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL) {
+ if (fTreeNeedsRefresh) {
+ clearUpdateAndExpansion();
+ }
+ } else {
+ if (fTableNeedsRefresh) {
+ clearUpdateAndExpansion();
+ }
+ }
+ fLayoutMode = layoutMode;
+ fViewerbook.showPage(getActiveViewer().getControl());
+ }
+ // avoid realizing all TableItems, especially in flat mode!
+ StructuredViewer viewer = getActiveViewer();
+ if (failuresOnly || ignoredOnly) {
+ if (getActiveViewerHasFilter()) {
+ // For simplicity clear both filters (only one of them is used)
+ viewer.removeFilter(fFailuresOnlyFilter);
+ viewer.removeFilter(fIgnoredOnlyFilter);
+ }
+ setActiveViewerHasFilter(true);
+ viewer.setInput(null);
+ // Set either the failures or the skipped tests filter
+ ViewerFilter filter = fFailuresOnlyFilter;
+ if (ignoredOnly == true) {
+ filter = fIgnoredOnlyFilter;
+ }
+ viewer.addFilter(filter);
+ setActiveViewerNeedsRefresh(true);
+
+ } else {
+ if (getActiveViewerHasFilter()) {
+ setActiveViewerNeedsRefresh(true);
+ setActiveViewerHasFilter(false);
+ viewer.setInput(null);
+ viewer.removeFilter(fIgnoredOnlyFilter);
+ viewer.removeFilter(fFailuresOnlyFilter);
+ }
+ }
+ processChangesInUI();
+
+ if (selection != null) {
+ // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=125708
+ // (ITreeSelection not adapted if TreePaths changed):
+ StructuredSelection flatSelection = new StructuredSelection(selection.toList());
+ fSelectionProvider.setSelection(flatSelection, true);
+ }
+
+ } finally {
+ fViewerbook.setRedraw(true);
+ }
+ }
+
+ private boolean getActiveViewerHasFilter() {
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL)
+ return fTreeHasFilter;
+ else
+ return fTableHasFilter;
+ }
+
+ private void setActiveViewerHasFilter(boolean filter) {
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL)
+ fTreeHasFilter = filter;
+ else
+ fTableHasFilter = filter;
+ }
+
+ private StructuredViewer getActiveViewer() {
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL)
+ return fTreeViewer;
+ else
+ return fTableViewer;
+ }
+
+ private boolean getActiveViewerNeedsRefresh() {
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL)
+ return fTreeNeedsRefresh;
+ else
+ return fTableNeedsRefresh;
+ }
+
+ private void setActiveViewerNeedsRefresh(boolean needsRefresh) {
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.HIERARCHICAL)
+ fTreeNeedsRefresh = needsRefresh;
+ else
+ fTableNeedsRefresh = needsRefresh;
+ }
+
+ /**
+ * To be called periodically by the TestRunnerViewPart (in the UI thread).
+ */
+ public void processChangesInUI() {
+ if (fTestRunSession == null) {
+ registerViewersRefresh();
+ fTreeNeedsRefresh = false;
+ fTableNeedsRefresh = false;
+ fTreeViewer.setInput(null);
+ fTableViewer.setInput(null);
+ return;
+ }
+
+ StructuredViewer viewer = getActiveViewer();
+ if (getActiveViewerNeedsRefresh()) {
+ clearUpdateAndExpansion();
+ setActiveViewerNeedsRefresh(false);
+ viewer.setInput(fTestRunnerPart);
+ } else {
+ Object[] toUpdate;
+ synchronized (this) {
+ toUpdate = fNeedUpdate.toArray();
+ fNeedUpdate.clear();
+ }
+ if (!fTreeNeedsRefresh && toUpdate.length > 0) {
+ if (fTreeHasFilter)
+ for (Object element : toUpdate)
+ updateElementInTree((TestElement) element);
+ else {
+ HashSet<Object> toUpdateWithParents = new HashSet<>();
+ toUpdateWithParents.addAll(Arrays.asList(toUpdate));
+ for (Object element : toUpdate) {
+ ITestElement parent = ((ITestElement) element).getParent();
+ while (parent != null) {
+ toUpdateWithParents.add(parent);
+ parent = parent.getParent();
+ }
+ }
+ fTreeViewer.update(toUpdateWithParents.toArray(), null);
+ }
+ }
+ if (!fTableNeedsRefresh && toUpdate.length > 0) {
+ if (fTableHasFilter)
+ for (Object element : toUpdate)
+ updateElementInTable((TestElement) element);
+ else
+ fTableViewer.update(toUpdate, null);
+ }
+ }
+ autoScrollInUI();
+ }
+
+ private void updateElementInTree(final TestElement testElement) {
+ if (isShown(testElement)) {
+ updateShownElementInTree(testElement);
+ } else {
+ TestElement current = testElement;
+ do {
+ if (fTreeViewer.testFindItem(current) != null)
+ fTreeViewer.remove(current);
+ current = current.getParent();
+ } while (!(current instanceof ITestRunSession) && !isShown(current));
+
+ while (current != null && !(current instanceof ITestRunSession)) {
+ fTreeViewer.update(current, null);
+ current = current.getParent();
+ }
+ }
+ }
+
+ private void updateShownElementInTree(ITestElement testElement) {
+ if (testElement == null || testElement instanceof ITestRunSession) // paranoia null check
+ return;
+
+ ITestSuiteElement parent = testElement.getParent();
+ updateShownElementInTree(parent); // make sure parent is shown and up-to-date
+
+ if (fTreeViewer.testFindItem(testElement) == null) {
+ fTreeViewer.add(parent, testElement); // if not yet in tree: add
+ } else {
+ fTreeViewer.update(testElement, null); // if in tree: update
+ }
+ }
+
+ private void updateElementInTable(TestElement element) {
+ if (isShown(element)) {
+ if (fTableViewer.testFindItem(element) == null) {
+ TestElement previous = getNextFailure(element, false);
+ int insertionIndex = -1;
+ if (previous != null) {
+ TableItem item = (TableItem) fTableViewer.testFindItem(previous);
+ if (item != null)
+ insertionIndex = fTableViewer.getTable().indexOf(item);
+ }
+ fTableViewer.insert(element, insertionIndex);
+ } else {
+ fTableViewer.update(element, null);
+ }
+ } else {
+ fTableViewer.remove(element);
+ }
+ }
+
+ private boolean isShown(TestElement current) {
+ return fFailuresOnlyFilter.select(current);
+ }
+
+ private void autoScrollInUI() {
+ if (!fTestRunnerPart.isAutoScroll()) {
+ clearAutoExpand();
+ fAutoClose.clear();
+ return;
+ }
+
+ if (fLayoutMode == TestRunnerViewPart.TestResultsLayout.FLAT) {
+ if (fAutoScrollTarget != null)
+ fTableViewer.reveal(fAutoScrollTarget);
+ return;
+ }
+
+ synchronized (this) {
+ for (ITestSuiteElement suite : fAutoExpand) {
+ fTreeViewer.setExpandedState(suite, true);
+ }
+ clearAutoExpand();
+ }
+
+ ITestCaseElement current = fAutoScrollTarget;
+ fAutoScrollTarget = null;
+
+ ITestSuiteElement parent = current == null ? null : (ITestSuiteElement) fTreeContentProvider.getParent(current);
+ if (fAutoClose.isEmpty() || !fAutoClose.getLast().equals(parent)) {
+ // we're in a new branch, so let's close old OK branches:
+ for (ListIterator<ITestSuiteElement> iter = fAutoClose.listIterator(fAutoClose.size()); iter
+ .hasPrevious();) {
+ ITestSuiteElement previousAutoOpened = iter.previous();
+ if (previousAutoOpened.equals(parent))
+ break;
+
+ if (((TestElement) previousAutoOpened).getStatus() == Status.OK) {
+ // auto-opened the element, and all children are OK -> auto close
+ iter.remove();
+ fTreeViewer.collapseToLevel(previousAutoOpened, AbstractTreeViewer.ALL_LEVELS);
+ }
+ }
+
+ while (parent != null && !fTestRunSession.equals(parent) && fTreeViewer.getExpandedState(parent) == false) {
+ fAutoClose.add(parent); // add to auto-opened elements -> close later if STATUS_OK
+ parent = (ITestSuiteElement) fTreeContentProvider.getParent(parent);
+ }
+ }
+ if (current != null)
+ fTreeViewer.reveal(current);
+ }
+
+ /**
+ * Selects the next failure test element
+ */
+ public void selectFirstFailure() {
+ ITestElement firstFailure = getNextChildFailure(fTestRunSession, true);
+ if (firstFailure != null)
+ getActiveViewer().setSelection(new StructuredSelection(firstFailure), true);
+ }
+
+ /**
+ * Selects a next failure test element
+ *
+ * @param showNext <code>true</code> if a next failed element is to be shown,
+ * otherwise - <code>false</code>
+ */
+ public void selectFailure(boolean showNext) {
+ IStructuredSelection selection = (IStructuredSelection) getActiveViewer().getSelection();
+ TestElement selected = (TestElement) selection.getFirstElement();
+ ITestElement next;
+
+ if (selected == null) {
+ next = getNextChildFailure(fTestRunSession, showNext);
+ } else {
+ next = getNextFailure(selected, showNext);
+ }
+
+ if (next != null)
+ getActiveViewer().setSelection(new StructuredSelection(next), true);
+ }
+
+ private TestElement getNextFailure(TestElement selected, boolean showNext) {
+ if (selected instanceof TestSuiteElement) {
+ TestElement nextChild = getNextChildFailure((TestSuiteElement) selected, showNext);
+ if (nextChild != null)
+ return nextChild;
+ }
+ return getNextFailureSibling(selected, showNext);
+ }
+
+ private TestElement getNextFailureSibling(TestElement current, boolean showNext) {
+ TestSuiteElement parent = current.getParent();
+ if (parent == null)
+ return null;
+
+ List<TestElement> siblings = getSortedChildren(parent);
+ if (!showNext)
+ siblings = new ReverseList<>(siblings);
+
+ int nextIndex = siblings.indexOf(current) + 1;
+ for (int i = nextIndex; i < siblings.size(); i++) {
+ TestElement sibling = siblings.get(i);
+ if (sibling.getStatus().isErrorOrFailure()) {
+ if (sibling instanceof ITestCaseElement) {
+ return sibling;
+ } else {
+ TestSuiteElement testSuiteElement = (TestSuiteElement) sibling;
+ if (testSuiteElement.getChildren().isEmpty()) {
+ return testSuiteElement;
+ }
+ return getNextChildFailure(testSuiteElement, showNext);
+ }
+ }
+ }
+ return getNextFailureSibling(parent, showNext);
+ }
+
+ private TestElement getNextChildFailure(TestSuiteElement root, boolean showNext) {
+ List<TestElement> children = getSortedChildren(root);
+ if (!showNext)
+ children = new ReverseList<>(children);
+ for (TestElement child : children) {
+ if (child.getStatus().isErrorOrFailure()) {
+ if (child instanceof ITestCaseElement) {
+ return child;
+ } else {
+ TestSuiteElement testSuiteElement = (TestSuiteElement) child;
+ if (testSuiteElement.getChildren().isEmpty()) {
+ return testSuiteElement;
+ }
+ return getNextChildFailure(testSuiteElement, showNext);
+ }
+ }
+ }
+ return null;
+ }
+
+ private List<TestElement> getSortedChildren(TestSuiteElement parent) {
+ List<TestElement> siblings = new ArrayList<>(parent.getChildren());
+ ViewerComparator comparator = fTreeViewer.getComparator();
+ if (comparator != null) {
+ siblings.sort((e1, e2) -> comparator.compare(fTreeViewer, e1, e2));
+ }
+ return siblings;
+ }
+
+ /**
+ * Initializes a viewers refresh
+ */
+ public synchronized void registerViewersRefresh() {
+ fTreeNeedsRefresh = true;
+ fTableNeedsRefresh = true;
+ clearUpdateAndExpansion();
+ }
+
+ private void clearUpdateAndExpansion() {
+ fNeedUpdate = new LinkedHashSet<>();
+ fAutoClose = new LinkedList<>();
+ fAutoExpand = new HashSet<>();
+ }
+
+ /**
+ * Registers a test element
+ *
+ * @param testElement the added test
+ */
+ public synchronized void registerTestAdded(ITestElement testElement) {
+ // TODO: performance: would only need to refresh parent of added element
+ fTreeNeedsRefresh = true;
+ fTableNeedsRefresh = true;
+ }
+
+ /**
+ * Initializes an update for a test element
+ *
+ * @param testElement a test element that needs to be updated
+ */
+ public synchronized void registerViewerUpdate(final ITestElement testElement) {
+ fNeedUpdate.add(testElement);
+ }
+
+ private synchronized void clearAutoExpand() {
+ fAutoExpand.clear();
+ }
+
+ /**
+ * Registers an auto-scroll target test case element
+ *
+ * @param testCaseElement a test case element
+ */
+ public void registerAutoScrollTarget(ITestCaseElement testCaseElement) {
+ fAutoScrollTarget = testCaseElement;
+ }
+
+ /**
+ * Registers a failed test element for an auto-scroll
+ *
+ * @param testElement a failed test element
+ */
+ public synchronized void registerFailedForAutoScroll(ITestElement testElement) {
+ ITestSuiteElement parent = (TestSuiteElement) fTreeContentProvider.getParent(testElement);
+ if (parent != null)
+ fAutoExpand.add(parent);
+ }
+
+ /**
+ * Expands the test element tree first level
+ */
+ public void expandFirstLevel() {
+ fTreeViewer.expandToLevel(2);
+ }
+
+ /**
+ * Sets up an alphabetical sort flag
+ *
+ * @param enableAlphabeticalSort <code>true</code> if an alphabetical sort is
+ * enabled, otherwise <code>false</code>
+ */
+ public void setAlphabeticalSort(boolean enableAlphabeticalSort) {
+ fTreeViewer.setComparator(enableAlphabeticalSort ? TEST_ELEMENT_ALPHABETIC_ORDER : null);
+ fTreeViewer.refresh();
+ }
+
+ /**
+ * Indicates if an alphabetical sort is enabled
+ *
+ * @return <code>true</code> if an alphabetical sort is enabled, otherwise
+ * <code>false</code>
+ */
+ public boolean isAlphabeticalSort() {
+ return fTreeViewer.getComparator() == TEST_ELEMENT_ALPHABETIC_ORDER;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TextualTrace.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TextualTrace.java
new file mode 100644
index 000000000..2d428b1da
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/TextualTrace.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.unittest.internal.ui;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Collection;
+
+import org.eclipse.core.text.StringMatcher;
+
+/**
+ * A Textual Trace
+ */
+public class TextualTrace {
+ /**
+ * An exception line type
+ */
+ public static final int LINE_TYPE_EXCEPTION = 1;
+
+ /**
+ * An normal line type
+ */
+ public static final int LINE_TYPE_NORMAL = 0;
+
+ /**
+ * An stackframe line type
+ */
+ public static final int LINE_TYPE_STACKFRAME = 2;
+
+ private final String fTrace;
+
+ /**
+ * Constructs a Textual Trace object
+ *
+ * @param trace a trace line
+ * @param filterPatterns a collection of filter string matchers
+ */
+ public TextualTrace(String trace, Collection<StringMatcher> filterPatterns) {
+ super();
+ fTrace = filterStack(trace, filterPatterns);
+ }
+
+ /**
+ * Displays a trace line on a specified display
+ *
+ * @param display a target display
+ * @param maxLabelLength a maximum number of characters to be displayed
+ */
+ public void display(ITraceDisplay display, int maxLabelLength) {
+ StringReader stringReader = new StringReader(fTrace);
+ BufferedReader bufferedReader = new BufferedReader(stringReader);
+ String line;
+
+ try {
+ // first line contains the thrown exception
+ line = readLine(bufferedReader);
+ if (line == null)
+ return;
+
+ displayWrappedLine(display, maxLabelLength, line, LINE_TYPE_EXCEPTION);
+
+ // the stack frames of the trace
+ while ((line = readLine(bufferedReader)) != null) {
+ int type = isAStackFrame(line) ? LINE_TYPE_STACKFRAME : LINE_TYPE_NORMAL;
+ displayWrappedLine(display, maxLabelLength, line, type);
+ }
+ } catch (IOException e) {
+ display.addTraceLine(LINE_TYPE_NORMAL, fTrace);
+ }
+ }
+
+ private void displayWrappedLine(ITraceDisplay display, int maxLabelLength, String line, int type) {
+ final int labelLength = line.length();
+ if (labelLength < maxLabelLength) {
+ display.addTraceLine(type, line);
+ } else {
+ display.addTraceLine(type, line.substring(0, maxLabelLength));
+ int offset = maxLabelLength;
+ while (offset < labelLength) {
+ int nextOffset = Math.min(labelLength, offset + maxLabelLength);
+ display.addTraceLine(LINE_TYPE_NORMAL, line.substring(offset, nextOffset));
+ offset = nextOffset;
+ }
+ }
+ }
+
+ private boolean filterLine(Collection<StringMatcher> patterns, String line) {
+ for (StringMatcher pattern : patterns) {
+ if (pattern.match(line)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String filterStack(String stackTrace, Collection<StringMatcher> filterPatterns) {
+ if (filterPatterns == null || filterPatterns.isEmpty() || stackTrace == null)
+ return stackTrace;
+
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+ StringReader stringReader = new StringReader(stackTrace);
+ BufferedReader bufferedReader = new BufferedReader(stringReader);
+
+ String line;
+ boolean firstLine = true;
+ try {
+ while ((line = bufferedReader.readLine()) != null) {
+ if (firstLine || !filterLine(filterPatterns, line))
+ printWriter.println(line);
+ firstLine = false;
+ }
+ } catch (IOException e) {
+ return stackTrace; // return the stack unfiltered
+ }
+ return stringWriter.toString();
+ }
+
+ private boolean isAStackFrame(String itemLabel) {
+ // heuristic for detecting a stack frame - works for JDK
+ return itemLabel.startsWith(" at "); //$NON-NLS-1$
+ }
+
+ private String readLine(BufferedReader bufferedReader) throws IOException {
+ String readLine = bufferedReader.readLine();
+ return readLine == null ? null : readLine.replace('\t', ' ');
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UITestRunListener.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UITestRunListener.java
new file mode 100644
index 000000000..26d55526c
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UITestRunListener.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.launcher.TestRunListener;
+import org.eclipse.unittest.model.ITestRunSession;
+
+import org.eclipse.swt.widgets.Display;
+
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This test run listener is the entry point that makes sure the
+ * org.eclipse.unittest plug-in gets loaded when a UnitTest launch configuration
+ * is launched.
+ */
+public class UITestRunListener extends TestRunListener {
+ @Override
+ public void sessionLaunched(ITestRunSession session) {
+ getDisplay().asyncExec(this::showTestRunnerViewPartInActivePage);
+ }
+
+ /**
+ * Creates a Test Runner View Part if it's not yet created and makes it visible
+ * in active page
+ *
+ * @return a {@link TestRunnerViewPart} instance
+ */
+ private TestRunnerViewPart showTestRunnerViewPartInActivePage() {
+ try {
+ // Have to force the creation of view part contents
+ // otherwise the UI will not be updated
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if (page == null)
+ return null;
+ TestRunnerViewPart view = (TestRunnerViewPart) page.findView(TestRunnerViewPart.NAME);
+ if (view == null) {
+ // create and show the result view if it isn't created yet.
+ return (TestRunnerViewPart) page.showView(TestRunnerViewPart.NAME, null, IWorkbenchPage.VIEW_VISIBLE);
+ } else {
+ page.activate(view);
+ return view;
+ }
+ } catch (PartInitException pie) {
+ UnitTestPlugin.log(pie);
+ return null;
+ }
+ }
+
+ private static Display getDisplay() {
+ Display display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ return display;
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestCopyAction.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestCopyAction.java
new file mode 100644
index 000000000..7acc70088
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestCopyAction.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import org.eclipse.unittest.model.ITestElement;
+
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+
+import org.eclipse.core.runtime.Assert;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+/**
+ * Copies a test failure stack trace to the clipboard.
+ */
+public class UnitTestCopyAction extends SelectionListenerAction {
+ private FailureTraceUIBlock fView;
+
+ private final Clipboard fClipboard;
+
+ private ITestElement fTestElement;
+
+ /**
+ * Constructs a Unit Test Copy action
+ *
+ * @param view a {@link FailureTraceUIBlock} object
+ * @param clipboard a {@link Clipboard} object
+ */
+ public UnitTestCopyAction(FailureTraceUIBlock view, Clipboard clipboard) {
+ super(Messages.CopyTrace_action_label);
+ Assert.isNotNull(clipboard);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IUnitTestHelpContextIds.COPYTRACE_ACTION);
+ fView = view;
+ fClipboard = clipboard;
+ }
+
+ @Override
+ public void run() {
+ String trace = fView.getTrace();
+ String source = null;
+ if (trace != null) {
+ source = convertLineTerminators(trace);
+ } else if (fTestElement != null) {
+ source = fTestElement.getTestName();
+ }
+ if (source == null || source.length() == 0)
+ return;
+
+ TextTransfer plainTextTransfer = TextTransfer.getInstance();
+ try {
+ fClipboard.setContents(new String[] { convertLineTerminators(source) },
+ new Transfer[] { plainTextTransfer });
+ } catch (SWTError e) {
+ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
+ throw e;
+ if (MessageDialog.openQuestion(fView.getComposite().getShell(), Messages.CopyTraceAction_problem,
+ Messages.CopyTraceAction_clipboard_busy))
+ run();
+ }
+ }
+
+ /**
+ * Handles a test selection
+ *
+ * @param test an {@link ITestElement} object
+ */
+ public void handleTestSelected(ITestElement test) {
+ fTestElement = test;
+ }
+
+ private String convertLineTerminators(String in) {
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+ StringReader stringReader = new StringReader(in);
+ BufferedReader bufferedReader = new BufferedReader(stringReader);
+ String line;
+ try {
+ while ((line = bufferedReader.readLine()) != null) {
+ printWriter.println(line);
+ }
+ } catch (IOException e) {
+ return in; // return the trace unfiltered
+ }
+ return stringWriter.toString();
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestProgressBar.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestProgressBar.java
new file mode 100644
index 000000000..c377589dd
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestProgressBar.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * A progress bar with a red/green indication for success or failure.
+ */
+public class UnitTestProgressBar extends Canvas {
+ private static final int DEFAULT_WIDTH = 160;
+ private static final int DEFAULT_HEIGHT = 18;
+
+ private int fCurrentTickCount = 0;
+ private int fMaxTickCount = 0;
+ private int fColorBarWidth = 0;
+ private Color fOKColor;
+ private Color fFailureColor;
+ private Color fStoppedColor;
+ private boolean fError;
+ private boolean fStopped = false;
+
+ /**
+ * Constructs a Unit Test Progress Bar object
+ *
+ * @param parent a parent composite
+ */
+ public UnitTestProgressBar(Composite parent) {
+ super(parent, SWT.NONE);
+
+ addControlListener(new ControlAdapter() {
+ @Override
+ public void controlResized(ControlEvent e) {
+ fColorBarWidth = scale(fCurrentTickCount);
+ redraw();
+ }
+ });
+ addPaintListener(this::paint);
+ addDisposeListener(event -> {
+ fFailureColor.dispose();
+ fOKColor.dispose();
+ fStoppedColor.dispose();
+ });
+ Display display = parent.getDisplay();
+ fFailureColor = new Color(display, 159, 63, 63);
+ fOKColor = new Color(display, 95, 191, 95);
+ fStoppedColor = new Color(display, 120, 120, 120);
+ }
+
+ /**
+ * Sets a maximum ticks count
+ *
+ * @param max a value of maximum ticks count
+ */
+ public void setMaximum(int max) {
+ fMaxTickCount = max;
+ }
+
+ /**
+ * Resets the progress bar
+ */
+ public void reset() {
+ fError = false;
+ fStopped = false;
+ fCurrentTickCount = 0;
+ fMaxTickCount = 0;
+ fColorBarWidth = 0;
+ redraw();
+ }
+
+ /**
+ * Resets the progress bar using new initial values
+ *
+ * @param hasErrors <code>true</code> if a test has errors, otherwise
+ * <code>false</code>
+ * @param stopped <code>true</code> if a test is stopped, otherwise
+ * <code>false</code>
+ * @param ticksDone a number of ticks done
+ * @param maximum a maximum ticks count
+ */
+ public void reset(boolean hasErrors, boolean stopped, int ticksDone, int maximum) {
+ boolean noChange = fError == hasErrors && fStopped == stopped && fCurrentTickCount == ticksDone
+ && fMaxTickCount == maximum;
+ fError = hasErrors;
+ fStopped = stopped;
+ fCurrentTickCount = ticksDone;
+ fMaxTickCount = maximum;
+ fColorBarWidth = scale(ticksDone);
+ if (!noChange)
+ redraw();
+ }
+
+ private void paintStep(int startX, int endX) {
+ GC gc = new GC(this);
+ setStatusColor(gc);
+ Rectangle rect = getClientArea();
+ startX = Math.max(1, startX);
+ gc.fillRectangle(startX, 1, endX - startX, rect.height - 2);
+ gc.dispose();
+ }
+
+ private void setStatusColor(GC gc) {
+ if (fStopped)
+ gc.setBackground(fStoppedColor);
+ else if (fError)
+ gc.setBackground(fFailureColor);
+ else
+ gc.setBackground(fOKColor);
+ }
+
+ /**
+ * Sets a stopped flag on the progress bar
+ */
+ public void stopped() {
+ fStopped = true;
+ redraw();
+ }
+
+ private int scale(int value) {
+ if (fMaxTickCount > 0) {
+ Rectangle r = getClientArea();
+ if (r.width != 0)
+ return Math.max(0, value * (r.width - 2) / fMaxTickCount);
+ }
+ return value;
+ }
+
+ private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
+ gc.setForeground(topleft);
+ gc.drawLine(x, y, x + w - 1, y);
+ gc.drawLine(x, y, x, y + h - 1);
+
+ gc.setForeground(bottomright);
+ gc.drawLine(x + w, y, x + w, y + h);
+ gc.drawLine(x, y + h, x + w, y + h);
+ }
+
+ private void paint(PaintEvent event) {
+ GC gc = event.gc;
+ Display disp = getDisplay();
+
+ Rectangle rect = getClientArea();
+ gc.fillRectangle(rect);
+ drawBevelRect(gc, rect.x, rect.y, rect.width - 1, rect.height - 1,
+ disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW),
+ disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
+
+ setStatusColor(gc);
+ fColorBarWidth = Math.min(rect.width - 2, fColorBarWidth);
+ gc.fillRectangle(1, 1, fColorBarWidth, rect.height - 2);
+ }
+
+ @Override
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ checkWidget();
+ Point size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ if (wHint != SWT.DEFAULT)
+ size.x = wHint;
+ if (hHint != SWT.DEFAULT)
+ size.y = hHint;
+ return size;
+ }
+
+ /**
+ * Steps the progress according to failures count
+ *
+ * @param failures a failures count
+ */
+ public void step(int failures) {
+ fCurrentTickCount++;
+ int x = fColorBarWidth;
+
+ fColorBarWidth = scale(fCurrentTickCount);
+
+ if (!fError && failures > 0) {
+ fError = true;
+ x = 1;
+ }
+ if (fCurrentTickCount == fMaxTickCount)
+ fColorBarWidth = getClientArea().width - 1;
+ paintStep(x, fColorBarWidth);
+ }
+
+ /**
+ * Refreshes the progress bar
+ *
+ * @param hasErrors <code>true</code> if a test has errors, otherwise
+ * <code>false</code>
+ */
+ public void refresh(boolean hasErrors) {
+ fError = hasErrors;
+ redraw();
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestUIPreferencesConstants.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestUIPreferencesConstants.java
new file mode 100644
index 000000000..f1396ea24
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/UnitTestUIPreferencesConstants.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2017 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui;
+
+import org.osgi.service.prefs.BackingStoreException;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+/**
+ * Defines constants which are used to refer to values in the plugin's
+ * preference store.
+ */
+public class UnitTestUIPreferencesConstants {
+ /**
+ * Boolean preference controlling whether newly launched Unit tests should be
+ * shown in all Unit Test views (in all windows).
+ */
+ public static final String SHOW_IN_ALL_VIEWS = UnitTestPlugin.PLUGIN_ID + ".show_in_all_views"; //$NON-NLS-1$
+
+ /**
+ * A default value for SHOW_IN_ALL_VIEWS preference
+ */
+ public static final boolean SHOW_IN_ALL_VIEWS_DEFAULT = false; // would need a PreferenceInitializer if this was
+ // changed to true!
+
+ private UnitTestUIPreferencesConstants() {
+ // no instance
+ }
+
+ /**
+ * Returns a value of SHOW_IN_ALL_VIEWS preference
+ *
+ * @return boolean value of SHOW_IN_ALL_VIEWS preference
+ */
+ public static boolean getShowInAllViews() {
+ return Platform.getPreferencesService().getBoolean(UnitTestPlugin.PLUGIN_ID, SHOW_IN_ALL_VIEWS,
+ SHOW_IN_ALL_VIEWS_DEFAULT, null);
+ }
+
+ /**
+ * Sets a value of SHOW_IN_ALL_VIEWS preference
+ *
+ * @param show <code>true</code> if the results view is to be shown in all
+ * views, otherwise <code>false</code>
+ */
+ public static void setShowInAllViews(boolean show) {
+ IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(UnitTestPlugin.PLUGIN_ID);
+ preferences.putBoolean(SHOW_IN_ALL_VIEWS, show);
+ try {
+ preferences.flush();
+ } catch (BackingStoreException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/History.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/History.java
new file mode 100644
index 000000000..ea41f16db
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/History.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui.history;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.model.ITestRunSessionListener;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.model.ITestRunSession;
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * A test run sessions history object
+ */
+public class History implements ITestRunSessionListener {
+
+ private static final String HISTORY_DIR_NAME = "history"; //$NON-NLS-1$
+
+ /**
+ * An instance of test run sessions history object
+ */
+ public static final History INSTANCE = new History();
+
+ private History() {
+ }
+
+ private boolean wasRead = false;
+ private List<HistoryItem> items = new ArrayList<>();
+
+ /**
+ * Creates and returns a directory to store the History information
+ *
+ * @return the file corresponding to History directory
+ * @throws IllegalStateException in case of failed to create or find an existing
+ * directory
+ */
+ public File getDirectory() throws IllegalStateException {
+ File historyDir = UnitTestPlugin.getDefault().getStateLocation().append(HISTORY_DIR_NAME).toFile();
+ if (!historyDir.isDirectory()) {
+ historyDir.mkdir();
+ }
+ return historyDir;
+ }
+
+ /**
+ * Returns a list of history items
+ *
+ * @return a list of history items
+ */
+ public List<HistoryItem> getHistory() {
+ if (!wasRead) {
+ Arrays.stream(getDirectory().listFiles()).map(HistoryItem::new).forEach(items::add);
+ wasRead = true;
+ }
+ return Collections.unmodifiableList(items);
+ }
+
+ /**
+ * Clears the history
+ */
+ public void clear() {
+ for (HistoryItem item : items) {
+ try {
+ item.removeSwapFile();
+ } catch (IOException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+ items.clear();
+ }
+
+ @Override
+ public void sessionAdded(ITestRunSession testRunSession) {
+ items.add(new HistoryItem((TestRunSession) testRunSession));
+ }
+
+ @Override
+ public void sessionRemoved(ITestRunSession testRunSession) {
+ items.stream().filter(item -> item.getCurrentTestRunSession().filter(testRunSession::equals).isPresent())
+ .forEach(toRemove -> {
+ try {
+ toRemove.removeSwapFile();
+ } catch (IOException e) {
+ UnitTestPlugin.log(e);
+ }
+ });
+ }
+
+ /**
+ * Saves a test run session into history
+ *
+ * @param testRunSession a test run session object
+ */
+ public void watch(TestRunSession testRunSession) {
+ for (HistoryItem item : items) {
+ if (testRunSession == null || item.getCurrentTestRunSession().filter(testRunSession::equals).isEmpty()) {
+ try {
+ item.swapOut();
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes a history item
+ *
+ * @param selected a history item to remove
+ */
+ public void remove(HistoryItem selected) {
+ this.items.remove(selected);
+ try {
+ selected.removeSwapFile();
+ } catch (IOException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+
+ /**
+ * adds a history item
+ *
+ * @param historyItem history item to add
+ */
+ public void add(HistoryItem historyItem) {
+ items.add(historyItem);
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryDialog.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryDialog.java
new file mode 100644
index 000000000..1bf1a87af
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryDialog.java
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui.history;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.model.TestRunSession;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * A History item selection dialog
+ */
+public class HistoryDialog extends SelectionDialog {
+
+ private static final Comparator<HistoryItem> COMPARING_START_DATE = Comparator.comparing(HistoryItem::getStartDate)
+ .reversed();
+ private Set<TestRunSession> fCurrentlyVisible;
+ private Button fRemoveButton;
+ private Button fExportButton;
+ private TableViewer fTable;
+
+ /**
+ * Constructs a history item selection dialog object
+ *
+ * @param shell a shell object
+ * @param visibleSessions a set of visible {@link TestRunSession} objects
+ */
+ public HistoryDialog(Shell shell, Set<TestRunSession> visibleSessions) {
+ super(shell);
+ fCurrentlyVisible = visibleSessions;
+ setResult(Collections.emptyList());
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ setTitle(Messages.HistoryDialog_title);
+ getShell().setText(Messages.HistoryDialog_title);
+ Composite res = new Composite(parent, SWT.NONE);
+ res.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ res.setLayout(new GridLayout(2, false));
+ this.fTable = createTable(res);
+ fTable.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ createButtons(res);
+ return fTable.getControl();
+ }
+
+ private void createButtons(Composite res) {
+ Composite buttons = new Composite(res, SWT.NONE);
+ buttons.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, false, false));
+ RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
+ rowLayout.fill = true;
+ buttons.setLayout(rowLayout);
+ fRemoveButton = new Button(buttons, SWT.PUSH);
+ fRemoveButton.setText(Messages.HistoryDialog_remove);
+ fRemoveButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ for (Object selected : getResult()) {
+ History.INSTANCE.remove((HistoryItem) selected);
+ }
+ fTable.refresh();
+ }));
+ Button importButton = new Button(buttons, SWT.PUSH);
+ importButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ FileDialog fileDialog = new FileDialog(getShell());
+ fileDialog.setFilterExtensions(new String[] { "*.xml" }); //$NON-NLS-1$
+ fileDialog.setText(Messages.HistoryDialog_selectImport);
+ String path = fileDialog.open();
+ if (path == null) {
+ return;
+ }
+ Path sourcePath = Path.of(path);
+ Path targetPath = Path.of(History.INSTANCE.getDirectory().getAbsolutePath(),
+ sourcePath.getFileName().toString());
+ try {
+ Files.copy(sourcePath, targetPath);
+ History.INSTANCE.add(new HistoryItem(targetPath.toFile()));
+ } catch (IOException e1) {
+ UnitTestPlugin.log(e1);
+ }
+ fTable.refresh();
+ }));
+ importButton.setText(Messages.HistoryDialog_import);
+ fExportButton = new Button(buttons, SWT.PUSH);
+ fExportButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
+ directoryDialog.setText(Messages.HistoryDialog_selectExport);
+ String path = directoryDialog.open();
+ if (path == null) {
+ return;
+ }
+ File directory = new File(path);
+ for (Object object : getResult()) {
+ HistoryItem historyItem = (HistoryItem) object;
+ try {
+ historyItem.storeSessionToFile(new File(directory, historyItem.getFile().getName()));
+ } catch (TransformerFactoryConfigurationError | CoreException e1) {
+ UnitTestPlugin.log(e1);
+ }
+ }
+ fTable.refresh();
+ }));
+ fExportButton.setText(Messages.HistoryDialog_export);
+ updateButtons();
+ }
+
+ private TableViewer createTable(Composite parent) {
+ TableViewer table = new TableViewer(parent);
+ table.setContentProvider(new ArrayContentProvider());
+ table.setComparator(new ViewerComparator() {
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ HistoryItem item1 = (HistoryItem) e1;
+ HistoryItem item2 = (HistoryItem) e2;
+ return COMPARING_START_DATE.compare(item1, item2);
+ }
+ });
+ int fontSize = table.getTable().getFont().getFontData()[0].getHeight();
+ table.getTable().setHeaderVisible(true);
+ TableViewerColumn visibleColumn = new TableViewerColumn(table, SWT.DEFAULT);
+ visibleColumn.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((HistoryItem) element).getCurrentTestRunSession().filter(fCurrentlyVisible::contains)
+ .map(any -> "👁️").orElse(""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ visibleColumn.getColumn().setWidth(2 * fontSize);
+ TableViewerColumn nameColumn = new TableViewerColumn(table, SWT.DEFAULT);
+ nameColumn.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((HistoryItem) element).getName();
+ }
+ });
+ nameColumn.getColumn().setWidth(20 * fontSize);
+ nameColumn.getColumn().setText(Messages.HistoryDialog_name);
+ TableViewerColumn dateColumn = new TableViewerColumn(table, SWT.DEFAULT);
+ dateColumn.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Instant startDate = ((HistoryItem) element).getStartDate();
+ return startDate != null
+ ? startDate.atZone(ZoneId.systemDefault()).format(DateTimeFormatter.RFC_1123_DATE_TIME)
+ : ""; //$NON-NLS-1$
+ }
+ });
+ dateColumn.getColumn().setWidth(25 * fontSize);
+ dateColumn.getColumn().setText(Messages.HistoryDialog_date);
+ TableViewerColumn progressColumn = new TableViewerColumn(table, SWT.DEFAULT);
+ progressColumn.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return ((HistoryItem) element).getCurrentTestRunSession().filter(TestRunSession::isRunning)
+ .map(any -> "🏃").orElse(""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ progressColumn.getColumn().setWidth(2 * fontSize);
+ progressColumn.getColumn().setText(Messages.HistoryDialog_progress);
+ TableViewerColumn successColumn = new TableViewerColumn(table, SWT.DEFAULT);
+ successColumn.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ int failures = ((HistoryItem) element).getFailureCount();
+ if (failures == 0) {
+ return "✅"; //$NON-NLS-1$
+ }
+ return "❌ " + failures + Messages.HistoryDialog_failures; //$NON-NLS-1$
+ }
+ });
+ successColumn.getColumn().setWidth(15 * fontSize);
+ successColumn.getColumn().setText(Messages.HistoryDialog_result);
+ TableViewerColumn sizeColumn = new TableViewerColumn(table, SWT.DEFAULT);
+ sizeColumn.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Long size = ((HistoryItem) element).getSizeOnDisk();
+ if (size != null) {
+ return size.toString() + " B"; //$NON-NLS-1$
+ }
+ return Character.toString('?');
+ }
+ });
+ sizeColumn.getColumn().setText(Messages.HistoryDialog_size);
+ sizeColumn.getColumn().setWidth(10 * fontSize);
+ table.setInput(History.INSTANCE.getHistory());
+ table.setSelection(new StructuredSelection(getInitialElementSelections().toArray()));
+ table.addSelectionChangedListener(
+ event -> setSelectionResult(((IStructuredSelection) event.getSelection()).toArray()));
+ return table;
+ }
+
+ @Override
+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+ return super.createButton(parent, id, id == IDialogConstants.OK_ID ? IDialogConstants.OPEN_LABEL : label,
+ defaultButton);
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ updateButtons();
+ }
+
+ @Override
+ protected void setSelectionResult(Object[] newResult) {
+ super.setSelectionResult(newResult);
+ updateButtons();
+ }
+
+ private void updateButtons() {
+ Object[] selection = getResult();
+ boolean singleItemSelection = selection.length == 1;
+ Stream.of(getButton(IDialogConstants.OK_ID), fRemoveButton, fExportButton) //
+ .filter(Objects::nonNull) //
+ .forEach(button -> button.setEnabled(singleItemSelection));
+ if (singleItemSelection) {
+ HistoryItem item = (HistoryItem) selection[0];
+ boolean isRunning = item.getCurrentTestRunSession().filter(TestRunSession::isRunning).isPresent();
+ fRemoveButton.setEnabled(!isRunning);
+ fExportButton.setEnabled(!isRunning);
+ }
+
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryHandler.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryHandler.java
new file mode 100644
index 000000000..ea36c41de
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryHandler.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui.history;
+
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.ui.TestRunnerViewPart;
+
+import org.eclipse.swt.widgets.Shell;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * A handler for Show History command
+ */
+public class HistoryHandler extends AbstractHandler {
+
+ /**
+ * An identifier of Show History command
+ */
+ public static final String COMMAND_ID = UnitTestPlugin.PLUGIN_ID + ".history"; //$NON-NLS-1$
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Shell shell = HandlerUtil.getActiveShell(event);
+ IWorkbenchPage page = HandlerUtil.getActivePart(event).getSite().getPage();
+ Set<TestRunSession> visibleSessions = Arrays.stream(page.getViewReferences()) //
+ .map(ref -> ref.getPart(false)) //
+ .filter(TestRunnerViewPart.class::isInstance) //
+ .map(TestRunnerViewPart.class::cast) //
+ .map(TestRunnerViewPart::getCurrentTestRunSession) //
+ .filter(Objects::nonNull) //
+ .collect(Collectors.toSet());
+ SelectionDialog historyDialog = new HistoryDialog(shell, visibleSessions);
+ historyDialog.setBlockOnOpen(true);
+ if (historyDialog.open() == IDialogConstants.OK_ID) {
+ HistoryItem item = (HistoryItem) historyDialog.getResult()[0];
+ try {
+ TestRunnerViewPart part = findCurrentPartOrOpenNew(HandlerUtil.getActivePart(event));
+ part.setActiveTestRunSession(item.reloadTestRunSession());
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+ return null;
+ }
+
+ private TestRunnerViewPart findCurrentPartOrOpenNew(IWorkbenchPart part) throws PartInitException {
+ if (part instanceof TestRunnerViewPart) {
+ return (TestRunnerViewPart) part;
+ }
+ return (TestRunnerViewPart) part.getSite().getPage().showView(TestRunnerViewPart.NAME);
+ }
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryItem.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryItem.java
new file mode 100644
index 000000000..ec541db62
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/HistoryItem.java
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui.history;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Date;
+import java.util.Optional;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.xml.sax.InputSource;
+
+import org.eclipse.unittest.internal.UnitTestPlugin;
+import org.eclipse.unittest.internal.junitXmlReport.HistoryEntryHandler;
+import org.eclipse.unittest.internal.junitXmlReport.TestRunHandler;
+import org.eclipse.unittest.internal.junitXmlReport.TestRunSessionSerializer;
+import org.eclipse.unittest.internal.model.ITestSessionListener;
+import org.eclipse.unittest.internal.model.ModelMessages;
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.ui.BasicElementLabels;
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestElement.FailureTrace;
+import org.eclipse.unittest.model.ITestElement.Result;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+/**
+ * A history item object
+ */
+public class HistoryItem {
+
+ private File historyFile;
+
+ private TestRunSession session;
+
+ private String name;
+
+ private Instant startTime;
+
+ private int failuresAndErrors;
+
+ /**
+ * Constructs a history item object for a {@link TestRunSession}
+ *
+ * @param session a {@link TestRunSession} object
+ */
+ public HistoryItem(TestRunSession session) {
+ this.session = session;
+ this.name = session.getTestRunName();
+ this.startTime = session.getStartTime();
+ this.failuresAndErrors = session.getCurrentErrorCount() + session.getCurrentFailureCount();
+ session.addTestSessionListener(new ITestSessionListener() {
+ @Override
+ public void testStarted(ITestCaseElement testCaseElement) {
+ // nothing
+ }
+
+ @Override
+ public void testFailed(ITestElement testElement, Result status, FailureTrace trace) {
+ // nothing
+ }
+
+ @Override
+ public void testEnded(ITestCaseElement testCaseElement) {
+ // nothing
+ }
+
+ @Override
+ public void testAdded(ITestElement testElement) {
+ // nothing
+ }
+
+ @Override
+ public void sessionStarted() {
+ getFile(); // Force creating a History File
+ }
+
+ @Override
+ public void sessionCompleted(Duration duration) {
+ try {
+ storeSessionToFile(getFile());
+ } catch (CoreException e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+
+ @Override
+ public void sessionAborted(Duration duration) {
+ sessionCompleted(duration);
+ }
+
+ @Override
+ public void runningBegins() {
+ // nothing
+ }
+ });
+ }
+
+ /**
+ * Constructs a history item object from a file
+ *
+ * @param file a history item file
+ */
+ public HistoryItem(File file) {
+ this.historyFile = file;
+ try {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ SAXParser parser = parserFactory.newSAXParser();
+ HistoryEntryHandler handler = new HistoryEntryHandler();
+ parser.parse(getFile(), handler);
+ this.name = handler.getName();
+ this.startTime = handler.getStartTime();
+ this.failuresAndErrors = handler.getFailuresAndErrors();
+ } catch (Exception e) {
+ UnitTestPlugin.log(e);
+ }
+ }
+
+ /**
+ * Reloads a {@link TestRunSession} object
+ *
+ * @return a {@link TestRunSession} object instance
+ * @throws CoreException in case of a problem during the object reading
+ */
+ public TestRunSession reloadTestRunSession() throws CoreException {
+ if (this.session == null && getFile() != null) {
+ try {
+ SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+ SAXParser parser = parserFactory.newSAXParser();
+ TestRunHandler handler = new TestRunHandler(new NullProgressMonitor());
+ parser.parse(getFile(), handler);
+ this.session = handler.getTestRunSession();
+ } catch (Exception e) {
+ throwImportError(getFile(), e);
+ }
+ }
+ return this.session;
+ }
+
+ /**
+ * Returns current {@link TestRunSession} object
+ *
+ * @return a {@link TestRunSession} object
+ */
+ public Optional<TestRunSession> getCurrentTestRunSession() {
+ return Optional.ofNullable(this.session);
+ }
+
+ /**
+ * Removes a swap file for a history item
+ *
+ * @throws IOException in case of I/O failure
+ */
+ public void removeSwapFile() throws IOException {
+ if (historyFile != null && historyFile.exists()) {
+ Files.delete(historyFile.toPath());
+ }
+ }
+
+ /**
+ * Saves a history item into a file
+ *
+ * @param target a target file
+ * @throws TransformerFactoryConfigurationError in case of transformation
+ * operation failure
+ * @throws CoreException in case of storing operation
+ * failure
+ */
+ void storeSessionToFile(File target) throws TransformerFactoryConfigurationError, CoreException {
+ if (this.session == null) {
+ return;
+ }
+ try (FileOutputStream out = new FileOutputStream(target)) {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ InputSource inputSource = new InputSource();
+ SAXSource source = new SAXSource(new TestRunSessionSerializer(this.session), inputSource);
+ StreamResult result = new StreamResult(out);
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+ /*
+ * Bug in Xalan: Only indents if proprietary property
+ * org.apache.xalan.templates.OutputProperties.S_KEY_INDENT_AMOUNT is set.
+ *
+ * Bug in Xalan as shipped with J2SE 5.0: Does not read the indent-amount
+ * property at all >:-(.
+ */
+ try {
+ transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (IllegalArgumentException e) {
+ // no indentation today...
+ }
+ transformer.transform(source, result);
+ } catch (Exception e) {
+ throwExportError(target, e);
+ }
+ }
+
+ /**
+ * Returns the history item swap file
+ *
+ * @return a history item file
+ */
+ public File getFile() {
+ if (this.historyFile == null) {
+ File historyDir = History.INSTANCE.getDirectory();
+ String isoTime = new SimpleDateFormat("yyyyMMdd-HHmmss.SSS") //$NON-NLS-1$
+ .format(new Date(getStartDate().toEpochMilli()));
+ String swapFileName = session.getTestRunName() + '@' + isoTime + ".xml"; //$NON-NLS-1$
+ this.historyFile = new File(historyDir, swapFileName);
+ }
+
+ return this.historyFile;
+ }
+
+ /**
+ * Stores test session into a swap file
+ *
+ * @throws CoreException in case of a problem
+ */
+ public void swapOut() throws CoreException {
+ if (session != null && session.isStopped()) {
+ storeSessionToFile(getFile());
+ session = null;
+ }
+ }
+
+ /**
+ * Returns a test session name.
+ *
+ * If a test session name is <code>null</code> returns a name of file
+ *
+ * @return a test session name
+ */
+ public String getName() {
+ if (session != null) {
+ return session.getTestRunName();
+ }
+ if (name != null) {
+ return name;
+ }
+ return getFile().getName();
+ }
+
+ /**
+ * Returns a test session start date/time.
+ *
+ * If date/time of a test session cannot be obtained returns a time of last swap
+ * file modification, or "now"
+ *
+ *
+ * @return an {@link Instant} object indicating a test session start date/time
+ */
+ public Instant getStartDate() {
+ if (session != null) {
+ startTime = session.getStartTime();
+ }
+ if (startTime != null) {
+ return startTime;
+ }
+ return Instant.now();
+ }
+
+ /**
+ * Returns a failure count for a test session
+ *
+ * @return a failure count
+ */
+ public int getFailureCount() {
+ if (session != null) {
+ return session.getCurrentErrorCount() + session.getCurrentFailureCount();
+ }
+ return failuresAndErrors;
+ }
+
+ private static void throwExportError(File file, Exception e) throws CoreException {
+ throw new CoreException(
+ new org.eclipse.core.runtime.Status(IStatus.ERROR, UnitTestPlugin.PLUGIN_ID, MessageFormat.format(
+ ModelMessages.UnitTestModel_could_not_write, BasicElementLabels.getPathLabel(file)), e));
+ }
+
+ private static void throwImportError(File file, Exception e) throws CoreException {
+ throw new CoreException(new org.eclipse.core.runtime.Status(IStatus.ERROR, UnitTestPlugin.PLUGIN_ID,
+ MessageFormat.format(ModelMessages.UnitTestModel_could_not_read, BasicElementLabels.getPathLabel(file)),
+ e));
+ }
+
+ /**
+ * Returns a size of a swap file
+ *
+ * @return a size of a swap file
+ */
+ public Long getSizeOnDisk() {
+ File file = getFile();
+ if (file != null && file.isFile()) {
+ return Long.valueOf(file.length());
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/Messages.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/Messages.java
new file mode 100644
index 000000000..73eca9510
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/Messages.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.unittest.internal.ui.history;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * History messages
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.unittest.internal.ui.history.messages"; //$NON-NLS-1$
+ public static String HistoryDialog_date;
+ public static String HistoryDialog_export;
+ public static String HistoryDialog_failures;
+ public static String HistoryDialog_import;
+ public static String HistoryDialog_name;
+ public static String HistoryDialog_progress;
+ public static String HistoryDialog_remove;
+ public static String HistoryDialog_result;
+ public static String HistoryDialog_selectExport;
+ public static String HistoryDialog_selectImport;
+ public static String HistoryDialog_title;
+ public static String HistoryDialog_size;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/messages.properties b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/messages.properties
new file mode 100644
index 000000000..599521b40
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/internal/ui/history/messages.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2020 Red Hat, Inc. and others.
+#
+# This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+###############################################################################
+HistoryDialog_date=Date
+HistoryDialog_export=\uD83D\uDCE4 &Export...
+HistoryDialog_failures=\ Failures
+HistoryDialog_import=\uD83D\uDCE5 &Import...
+HistoryDialog_name=Name
+HistoryDialog_progress=Progress
+HistoryDialog_remove=\uD83D\uDDD1\uFE0F &Remove
+HistoryDialog_result=Result
+HistoryDialog_selectExport=Select a directory to export test session report
+HistoryDialog_selectImport=Select test report file to import
+HistoryDialog_title=Select a test session to display
+HistoryDialog_size=Size
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/launcher/ITestRunnerClient.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/launcher/ITestRunnerClient.java
new file mode 100644
index 000000000..61a62c7e3
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/launcher/ITestRunnerClient.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc. and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.launcher;
+
+import org.eclipse.unittest.internal.model.TestRunSession;
+import org.eclipse.unittest.internal.ui.UITestRunListener;
+
+import org.eclipse.debug.core.ILaunch;
+
+/**
+ * An interface to be implemented by a Test Runner Client. Its implementation
+ * should takes care of placing the right listeners to a given
+ * {@link TestRunSession} (usually received in the constructor) and to react to
+ * the various test engine events (can be some notifications via some network,
+ * reading standard output, etc. depending on design of a specified test runner)
+ * by sending notifications to the {@link UITestRunListener}s.
+ */
+public interface ITestRunnerClient {
+
+ /**
+ * Starts monitoring test execution.
+ *
+ * @see #stopMonitoring()
+ */
+ void startMonitoring();
+
+ /**
+ * Requests to stop the tests execution. Usually requested by user; so it should
+ * stop the test runner client (usually calling {@link #stopMonitoring()} and
+ * also related test specific closable objects like an underlying
+ * {@link ILaunch} (unless launch is configured to be kept alive).
+ */
+ void stopTest();
+
+ /**
+ * Stops monitoring and disconnects this test runner client; this is typically
+ * happening when a test run session is marked as terminated.
+ */
+ void stopMonitoring();
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestCaseElement.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestCaseElement.java
new file mode 100644
index 000000000..4ab28b76d
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestCaseElement.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.model;
+
+/**
+ * Represents a test case element.
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface ITestCaseElement extends ITestElement {
+
+ /**
+ * Indicates if the test case was ignored
+ *
+ * @return true in case of the test case was ignored, otherwise false
+ */
+ boolean isIgnored();
+
+ /**
+ * Indicates if the test case is dynamic
+ *
+ * @return true in case of dynamic test case element, otherwise false
+ */
+ boolean isDynamicTest();
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestElement.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestElement.java
new file mode 100644
index 000000000..c59c8b935
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestElement.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.model;
+
+import java.time.Duration;
+import java.util.Objects;
+
+import org.eclipse.unittest.internal.model.ProgressState;
+
+/**
+ * Common protocol for test elements. This set consists of
+ * {@link ITestCaseElement}, {@link ITestSuiteElement} and
+ * {@link ITestRunSession}
+ *
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface ITestElement {
+
+ /**
+ * Result states of a test.
+ */
+ public enum Result {
+ UNDEFINED("Undefined"), //$NON-NLS-1$
+ OK("OK"), //$NON-NLS-1$
+ ERROR("Error"), //$NON-NLS-1$
+ FAILURE("Failure"), //$NON-NLS-1$
+ IGNORED("Ignored"); //$NON-NLS-1$
+
+ private String fName;
+
+ private Result(String name) {
+ fName = name;
+ }
+
+ @Override
+ public String toString() {
+ return fName;
+ }
+ }
+
+ /**
+ * A failure trace of a test.
+ *
+ * This class is not intended to be instantiated or extended by clients.
+ */
+ public static final class FailureTrace {
+ private final String fActual;
+ private final String fExpected;
+ private final String fTrace;
+
+ public FailureTrace(String trace, String expected, String actual) {
+ fActual = actual;
+ fExpected = expected;
+ fTrace = trace;
+ }
+
+ /**
+ * Returns the failure stack trace.
+ *
+ * @return the failure stack trace
+ */
+ public String getTrace() {
+ return fTrace;
+ }
+
+ /**
+ * Returns the expected result or <code>null</code> if the trace is not a
+ * comparison failure.
+ *
+ * @return the expected result or <code>null</code> if the trace is not a
+ * comparison failure.
+ */
+ public String getExpected() {
+ return fExpected;
+ }
+
+ /**
+ * Returns the actual result or <code>null</code> if the trace is not a
+ * comparison failure.
+ *
+ * @return the actual result or <code>null</code> if the trace is not a
+ * comparison failure.
+ */
+ public String getActual() {
+ return fActual;
+ }
+
+ /**
+ * Returns <code>true</code> in case of comparison failure.
+ *
+ * @return <code>true</code> in case of comparison failure, otherwise returns
+ * <code>false</code>
+ */
+ public boolean isComparisonFailure() {
+ return (fExpected != null || fActual != null) && !Objects.equals(fActual, fExpected);
+ }
+ }
+
+ /**
+ * Returns an identifier of the test element
+ *
+ * @return a test element identifier
+ */
+ String getId();
+
+ /**
+ * Returns some runner-specific data, such as complete test description or other
+ * data allowing further operations not covered by the generic test model.
+ *
+ * @return some runner-specific data, such as complete test description or other
+ * data allowing further operations not covered by the generic test
+ * model.
+ */
+ String getData();
+
+ /**
+ * Returns the test run session.
+ *
+ * @return the parent test run session.
+ */
+ ITestRunSession getTestRunSession();
+
+ /**
+ * Returns the estimated total time elapsed while executing this test element.
+ * The total time for a test suite includes the time used for all tests in that
+ * suite. The total time for a test session includes the time used for all tests
+ * in that session.
+ * <p>
+ * <strong>Note:</strong> The elapsed time is only valid for
+ * {@link ProgressState#COMPLETED} test elements.
+ * </p>
+ *
+ * @return total execution duration for the test element, or <code>null</code>
+ * if the state of the element is not {@link ProgressState#COMPLETED}
+ */
+ Duration getDuration();
+
+ /**
+ * Returns the failure trace of this test element or <code>null</code> if the
+ * test has not resulted in an error or failure.
+ *
+ * @return the failure trace of this test or <code>null</code>.
+ */
+ FailureTrace getFailureTrace();
+
+ /**
+ * Returns parent test suite element of this test element
+ *
+ * @return a parent test suite element
+ */
+ ITestSuiteElement getParent();
+
+ /**
+ * Returns the name of the test element
+ *
+ * @return a name of test element
+ */
+ String getTestName();
+
+ /**
+ * Returns the display name of the test. Can be <code>null</code>. In that case,
+ * use {@link ITestElement#getTestName() getTestName()}.
+ *
+ * @return the test display name, can be <code>null</code>
+ */
+ String getDisplayName();
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestRunSession.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestRunSession.java
new file mode 100644
index 000000000..3c47ad701
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestRunSession.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.model;
+
+import java.time.Duration;
+
+import org.eclipse.debug.core.ILaunch;
+
+/**
+ * Represents a test run session.
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface ITestRunSession extends ITestSuiteElement {
+
+ /**
+ * Returns the {@link ILaunch} from which this test run session has been
+ * started, or <code>null</code> if not available.
+ *
+ * @return the {@link ILaunch} object instance, or <code>null</code> is not
+ * available.
+ */
+ ILaunch getLaunch();
+
+ /**
+ * Returns a test element by its identifier
+ *
+ * @param id a test element identifier
+ * @return a {@link ITestElement} found or <code>null</code>
+ */
+ ITestElement getTestElement(String id);
+
+ /**
+ * Creates a new Test Case and adds it to the model
+ *
+ * @param testId a unique id for the test
+ * @param testName the name of the test
+ * @param parent the parent, can be <code>null</code>
+ * @param displayName the display name of the test
+ * @param data runner specific data
+ * @return the new test case element
+ */
+ ITestCaseElement newTestCase(String testId, String testName, ITestSuiteElement parent, String displayName,
+ String data);
+
+ /**
+ * Creates a new Test Suite and adds it to the model
+ *
+ * @param testId a unique id for the test
+ * @param testName the name of the test
+ * @param testCount the number of tests this suite will run, <code>null</code>
+ * if unknown.
+ * @param parent the parent
+ * @param displayName the display name of the test
+ * @param data runner specific data
+ * @return the new test case element
+ */
+ ITestSuiteElement newTestSuite(String testId, String testName, Integer testCount, ITestSuiteElement parent,
+ String displayName, String data);
+
+ /**
+ * Notifies on a test run ended normally. Individual test success don't matter.
+ * If the test session failed to complete for some reason, use
+ * {@link #notifyTestSessionAborted(Duration, Exception)}.
+ *
+ * @param duration the total elapsed time of the test run, can be
+ * <code>null</code>.
+ * @see #notifyTestSessionAborted(Duration, Exception) notifyTestRunAborted to
+ * use for abnormal termination of the test session.
+ */
+ void notifyTestSessionCompleted(final Duration duration);
+
+ /**
+ * Notifies on a test run aborted, abnormally.
+ *
+ * @param duration duration of the test run session until abortion, can be
+ * <code>null</code>.
+ * @param cause the cause of the abortion, can be shown in log or to user,
+ * can be <code>null</code>.
+ * @see #notifyTestSessionCompleted(Duration) notifyTestRunAborted to use for
+ * normal completion.
+ */
+ void notifyTestSessionAborted(final Duration duration, final Exception cause);
+
+ /**
+ * Notifies on an individual test ended.
+ *
+ * @param test a unique Id identifying the test
+ * @param isIgnored <code>true</code> indicates that the specified test was
+ * ignored, otherwise - <code>false</code>
+ */
+ void notifyTestEnded(ITestElement test, boolean isIgnored);
+
+ /**
+ * Notifies on an individual test started.
+ *
+ * @param test the test
+ */
+ void notifyTestStarted(ITestElement test);
+
+ /**
+ * Notifies on a test run started.
+ *
+ * @param count the number of individual tests that will be run,
+ * <code>null</code> if unknown
+ */
+ void notifyTestSessionStarted(final Integer count);
+
+ /**
+ * Notifies on an individual test failed with a stack trace.
+ *
+ * @param test the test
+ * @param status the outcome of the test; one of
+ * {@link org.eclipse.unittest.model.ITestElement.Result#ERROR}
+ * or
+ * {@link org.eclipse.unittest.model.ITestElement.Result#FAILURE}.
+ * An exception is thrown otherwise
+ * @param isAssumptionFailed indicates that an assumption is failed
+ * @param failureTrace The failure trace
+ * @throws IllegalArgumentException if status doesn't indicate ERROR or FAILURE.
+ */
+ void notifyTestFailed(ITestElement test, Result status, boolean isAssumptionFailed, FailureTrace failureTrace)
+ throws IllegalArgumentException;
+
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestSuiteElement.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestSuiteElement.java
new file mode 100644
index 000000000..ef544add2
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/ITestSuiteElement.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.model;
+
+import java.util.List;
+
+/**
+ * Represents a test suite element.
+ * <p>
+ * This interface is not intended to be implemented by clients.
+ * </p>
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface ITestSuiteElement extends ITestElement {
+
+ /**
+ * Returns all tests (and test suites) contained in the suite.
+ *
+ * @return returns all tests (and test suites) contained in the suite.
+ */
+ List<? extends ITestElement> getChildren();
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/package.html b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/package.html
new file mode 100644
index 000000000..0115c4c90
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/model/package.html
@@ -0,0 +1,15 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="IBM">
+ <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Application programming interfaces representing test elements as shown in the Unit Test view.
+<h2>
+Package Specification</h2>
+APIs to access the test elements of the Unit Test view
+</body>
+</html>
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ConfigureViewerSupport.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ConfigureViewerSupport.java
new file mode 100644
index 000000000..db4a2c113
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ConfigureViewerSupport.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc. and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.ui;
+
+import java.util.function.Function;
+
+import org.eclipse.unittest.internal.launcher.UnitTestLaunchConfigurationConstants;
+
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+
+/**
+ * Configures a Launch configuration Working Copy with an identifier of Test
+ * View Support extension
+ */
+public final class ConfigureViewerSupport
+ implements Function<ILaunchConfigurationWorkingCopy, ILaunchConfigurationWorkingCopy> {
+ private final String identifier;
+
+ public ConfigureViewerSupport(String testViewSupportExtensionId) {
+ this.identifier = testViewSupportExtensionId;
+ }
+
+ @Override
+ public ILaunchConfigurationWorkingCopy apply(ILaunchConfigurationWorkingCopy configuration) {
+ if (configuration != null && identifier != null) {
+ configuration.setAttribute(UnitTestLaunchConfigurationConstants.ATTR_UNIT_TEST_VIEW_SUPPORT, identifier);
+ }
+ return configuration;
+ }
+}
diff --git a/org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ITestViewSupport.java b/org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ITestViewSupport.java
new file mode 100644
index 000000000..9894b21c2
--- /dev/null
+++ b/org.eclipse.unittest.ui/src/org/eclipse/unittest/ui/ITestViewSupport.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Red Hat Inc. and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.unittest.ui;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.unittest.launcher.ITestRunnerClient;
+import org.eclipse.unittest.model.ITestCaseElement;
+import org.eclipse.unittest.model.ITestElement;
+import org.eclipse.unittest.model.ITestRunSession;
+import org.eclipse.unittest.model.ITestSuiteElement;
+
+import org.eclipse.swt.widgets.Shell;
+
+import org.eclipse.core.text.StringMatcher;
+
+import org.eclipse.jface.action.IAction;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * Interface to be implemented by a Test View Support to be returned by
+ * org.org.eclipse.unittest.unittestViewSupport extension.
+ */
+public interface ITestViewSupport {
+ /**
+ * Returns a Test Runner Client.
+ *
+ * @param session the test session. ⚠️ The session may not be fully initialized
+ * at that point, however {@link ITestRunSession#getLaunch()} is
+ * supposed to return the proper launch.
+ *
+ * @return returns a Test Runner Client
+ */
+ ITestRunnerClient newTestRunnerClient(ITestRunSession session);
+
+ /**
+ * Returns filter patterns to exclude lines from stack trace or an error message
+ *
+ * @return filter patterns, matching lines will be hidden in the UI
+ */
+ Collection<StringMatcher> getTraceExclusionFilterPatterns();
+
+ /**
+ * Returns an action to open a specified test elements
+ *
+ * @param shell a parent {@link Shell} instance
+ * @param testCase a test case element
+ * @return an action to open a specified test case element, or <code>null</code>
+ */
+ IAction getOpenTestAction(Shell shell, ITestCaseElement testCase);
+
+ /**
+ * Returns an action to open a specified test suite element
+ *
+ * @param shell a parent {@link Shell} instance
+ * @param testSuite a test suite element
+ * @return an action to open a specified test suite element, or
+ * <code>null</code>
+ */
+ IAction getOpenTestAction(Shell shell, ITestSuiteElement testSuite);
+
+ /**
+ * Returns an action to open a failure trace element
+ *
+ * @param shell a parent {@link Shell} instance
+ * @param failure a test element that is failed
+ * @param traceLine a stack trace or an error message text
+ * @return an action to open a failure trace element, or <code>null</code>
+ */
+ IAction createOpenEditorAction(Shell shell, ITestElement failure, String traceLine);
+
+ /**
+ * Returns an action to copy an existing stack trace/error message into a
+ * console view
+ *
+ * @param failedTest the failed test
+ * @return an {@link Runnable} if it can be created, otherwise -
+ * <code>null</code>
+ */
+ Runnable createShowStackTraceInConsoleViewActionDelegate(ITestElement failedTest);
+
+ /**
+ * Returns a Rerun launch configuration for the given element
+ *
+ * @param testElements the tests to rerun
+ * @return a {@link ILaunchConfiguration}, derived from current test session and
+ * selected element.
+ */
+ ILaunchConfiguration getRerunLaunchConfiguration(List<ITestElement> testElements);
+
+ /**
+ * Returns a Test View Support display name
+ *
+ * @return returns a display name
+ */
+ String getDisplayName();
+}
diff --git a/pom.xml b/pom.xml
index 2996cdde6..201de859c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.eclipse</groupId>
<artifactId>eclipse-platform-parent</artifactId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../eclipse-platform-parent</relativePath>
</parent>
@@ -24,7 +24,7 @@
<packaging>pom</packaging>
<properties>
- <tycho.scmUrl>scm:git:git://git.eclipse.org/gitroot/platform/eclipse.platform.debug.git</tycho.scmUrl>
+ <tycho.scmUrl>scm:git:https://git.eclipse.org/r/platform/eclipse.platform.debug.git</tycho.scmUrl>
</properties>
<!--
@@ -60,7 +60,10 @@
<module>org.eclipse.debug.examples.ui</module>
<module>org.eclipse.debug.tests</module>
<module>org.eclipse.debug.ui</module>
+ <module>org.eclipse.debug.ui.launchview</module>
+ <module>org.eclipse.debug.ui.launchview.tests</module>
<module>org.eclipse.ui.console</module>
<module>org.eclipse.ui.externaltools</module>
+ <module>org.eclipse.unittest.ui</module>
</modules>
</project>

Back to the top