Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.core.externaltools/.classpath7
-rw-r--r--org.eclipse.core.externaltools/.cvsignore1
-rw-r--r--org.eclipse.core.externaltools/.project34
-rw-r--r--org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs74
-rw-r--r--org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs25
-rw-r--r--org.eclipse.core.externaltools/META-INF/MANIFEST.MF17
-rw-r--r--org.eclipse.core.externaltools/about.html28
-rw-r--r--org.eclipse.core.externaltools/build.properties18
-rw-r--r--org.eclipse.core.externaltools/plugin.properties16
-rw-r--r--org.eclipse.core.externaltools/plugin.xml42
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java118
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java213
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java89
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java274
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java30
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties19
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java207
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java340
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java290
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java24
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties13
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java410
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java25
-rw-r--r--org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties13
-rw-r--r--org.eclipse.core.variables/.classpath7
-rw-r--r--org.eclipse.core.variables/.cvsignore2
-rw-r--r--org.eclipse.core.variables/.project34
-rw-r--r--org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs96
-rw-r--r--org.eclipse.core.variables/.settings/org.eclipse.pde.prefs17
-rw-r--r--org.eclipse.core.variables/META-INF/MANIFEST.MF13
-rw-r--r--org.eclipse.core.variables/about.html28
-rw-r--r--org.eclipse.core.variables/build.properties18
-rw-r--r--org.eclipse.core.variables/plugin.properties16
-rw-r--r--org.eclipse.core.variables/plugin.xml26
-rw-r--r--org.eclipse.core.variables/schema/dynamicVariables.exsd130
-rw-r--r--org.eclipse.core.variables/schema/valueVariables.exsd156
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java142
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java76
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java55
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java291
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java81
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java607
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java76
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.java29
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties18
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java60
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariableResolver.java36
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariable.java57
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java191
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariable.java91
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableInitializer.java30
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableListener.java47
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java114
-rw-r--r--org.eclipse.core.variables/src/org/eclipse/core/variables/package.html45
-rw-r--r--org.eclipse.debug.examples.core/.classpath9
-rw-r--r--org.eclipse.debug.examples.core/.cvsignore1
-rw-r--r--org.eclipse.debug.examples.core/.project34
-rw-r--r--org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs47
-rw-r--r--org.eclipse.debug.examples.core/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.debug.examples.core/about.html28
-rw-r--r--org.eclipse.debug.examples.core/build.properties21
-rw-r--r--org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java1427
-rw-r--r--org.eclipse.debug.examples.core/pdavm/tests/vmtest10.pda38
-rw-r--r--org.eclipse.debug.examples.core/pdavm/tests/vmtest2.pda48
-rw-r--r--org.eclipse.debug.examples.core/pdavm/tests/vmtest3.pda13
-rw-r--r--org.eclipse.debug.examples.core/pdavm/tests/vmtest6.pda31
-rw-r--r--org.eclipse.debug.examples.core/pdavm/tests/vmtest8.pda14
-rw-r--r--org.eclipse.debug.examples.core/pdavm/tests/vmtest9.pda23
-rw-r--r--org.eclipse.debug.examples.core/pdavm/tests/vmtest_children.pda8
-rw-r--r--org.eclipse.debug.examples.core/plugin.xml103
-rw-r--r--org.eclipse.debug.examples.core/readme.html11
-rw-r--r--org.eclipse.debug.examples.core/samples/counter.pda11
-rw-r--r--org.eclipse.debug.examples.core/samples/drop.pda12
-rw-r--r--org.eclipse.debug.examples.core/samples/example.pda35
-rw-r--r--org.eclipse.debug.examples.core/samples/fibonacci.pda32
-rw-r--r--org.eclipse.debug.examples.core/samples/registers.pda72
-rw-r--r--org.eclipse.debug.examples.core/samples/stack.pda21
-rw-r--r--org.eclipse.debug.examples.core/samples/structures.pda29
-rw-r--r--org.eclipse.debug.examples.core/scripts/build.xml66
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java93
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java36
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java165
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java126
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java132
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java89
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java88
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java133
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java206
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java70
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java231
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java152
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/IPDAEventListener.java44
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java51
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java98
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java109
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java582
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java260
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java92
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java563
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java109
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java114
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java53
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java41
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java34
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java31
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java40
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java27
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java35
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java44
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java43
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java32
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java75
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java48
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java29
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java36
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java30
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java46
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java33
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java43
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java40
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java34
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java36
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java43
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java33
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java39
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java30
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java35
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java40
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java29
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java69
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java46
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java36
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java38
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java39
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java40
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java36
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java31
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java30
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java45
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java46
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java40
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java43
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java34
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java29
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java41
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java37
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java36
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java30
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java37
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java44
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java29
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java39
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java43
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/package.html99
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java32
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java38
-rw-r--r--org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java65
-rw-r--r--org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java295
-rw-r--r--org.eclipse.debug.tests/.classpath7
-rw-r--r--org.eclipse.debug.tests/.cvsignore1
-rw-r--r--org.eclipse.debug.tests/.project28
-rw-r--r--org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs98
-rw-r--r--org.eclipse.debug.tests/META-INF/MANIFEST.MF15
-rw-r--r--org.eclipse.debug.tests/about.html28
-rw-r--r--org.eclipse.debug.tests/build.properties9
-rwxr-xr-xorg.eclipse.debug.tests/plugin.properties13
-rw-r--r--org.eclipse.debug.tests/plugin.xml86
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AbstractLaunchTest.java77
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java59
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java205
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java118
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java1051
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchHistoryTests.java197
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java194
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java204
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/TestLaunchDelegate.java31
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java69
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java91
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockDynamic.java21
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockOne.java21
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockThree.java21
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockTwo.java21
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java151
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/RenderingTypeDelegate.java30
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java171
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java186
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java111
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java572
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java136
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java40
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java38
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java36
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java173
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java53
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java213
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java721
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java660
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java490
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java94
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java205
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java31
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java31
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java80
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java35
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java31
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java31
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java31
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java93
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java46
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java113
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandler.java29
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java56
-rw-r--r--org.eclipse.debug.tests/test-import/Import1.launch14
-rw-r--r--org.eclipse.debug.tests/test-import/Import2.launch14
-rw-r--r--org.eclipse.debug.tests/test-import/Import3.launch17
-rw-r--r--org.eclipse.debug.tests/test-import/Import4.launch14
-rw-r--r--org.eclipse.debug.tests/test-import/Import5.launch14
-rw-r--r--org.eclipse.debug.tests/test.xml51
-rw-r--r--org.eclipse.ui.console/.classpath7
-rw-r--r--org.eclipse.ui.console/.cvsignore1
-rw-r--r--org.eclipse.ui.console/.project34
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs99
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.pde.prefs17
-rw-r--r--org.eclipse.ui.console/META-INF/MANIFEST.MF20
-rw-r--r--org.eclipse.ui.console/about.html28
-rw-r--r--org.eclipse.ui.console/build.properties20
-rw-r--r--org.eclipse.ui.console/icons/full/clcl16/clear_co.gifbin595 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/clcl16/lock_co.gifbin626 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/clcl16/pin.gifbin358 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/cview16/console_view.gifbin582 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/clear_co.gifbin364 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/lock_co.gifbin588 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/pin.gifbin223 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/dlcl16/rem_co.gifbin159 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/clear_co.gifbin595 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/lock_co.gifbin626 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/new_con.gifbin612 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/pin.gifbin358 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/elcl16/rem_co.gifbin163 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/icons/full/eview16/console_view.gifbin582 -> 0 bytes
-rw-r--r--org.eclipse.ui.console/plugin.properties24
-rw-r--r--org.eclipse.ui.console/plugin.xml89
-rw-r--r--org.eclipse.ui.console/schema/consoleFactories.exsd136
-rw-r--r--org.eclipse.ui.console/schema/consolePageParticipants.exsd122
-rw-r--r--org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd153
-rw-r--r--org.eclipse.ui.console/scripts/exportplugin.xml35
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java335
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java182
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java97
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java156
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java51
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java48
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java39
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java107
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java71
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java93
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java37
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink2.java33
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java293
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java285
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java269
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java87
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java46
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java153
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java92
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java73
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java554
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java413
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java699
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java95
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java41
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java84
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java121
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html20
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/package.html36
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java115
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java394
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java169
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java121
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java51
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java461
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java68
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties53
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java73
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java310
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java158
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java35
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties19
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java32
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java807
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java46
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java125
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java55
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java56
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java46
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java31
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java141
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java209
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java699
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java144
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java153
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java71
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java153
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java54
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java51
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java64
311 files changed, 0 insertions, 31155 deletions
diff --git a/org.eclipse.core.externaltools/.classpath b/org.eclipse.core.externaltools/.classpath
deleted file mode 100644
index 2fbb7a23e..000000000
--- a/org.eclipse.core.externaltools/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/J2SE-1.4"/>
- <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.core.externaltools/.cvsignore b/org.eclipse.core.externaltools/.cvsignore
deleted file mode 100644
index c5e82d745..000000000
--- a/org.eclipse.core.externaltools/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/.project b/org.eclipse.core.externaltools/.project
deleted file mode 100644
index 4b19d2ac9..000000000
--- a/org.eclipse.core.externaltools/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.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.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.core.externaltools/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 5ac4bbd18..000000000
--- a/org.eclipse.core.externaltools/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,74 +0,0 @@
-#Wed Sep 16 09:50:20 CDT 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-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.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-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=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-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=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-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.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-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.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs b/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index 189611f2b..000000000
--- a/org.eclipse.core.externaltools/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,25 +0,0 @@
-#Wed Oct 07 13:13:28 CDT 2009
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-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.not-externalized-att=1
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-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
-eclipse.preferences.version=1
diff --git a/org.eclipse.core.externaltools/META-INF/MANIFEST.MF b/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
deleted file mode 100644
index dea5ba111..000000000
--- a/org.eclipse.core.externaltools/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.core.externaltools;singleton:=true
-Bundle-Version: 1.0.0.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.6.0,4.0.0)",
- org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-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",
- org.eclipse.core.externaltools.internal.launchConfigurations;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools",
- org.eclipse.core.externaltools.internal.model;x-friends:="org.eclipse.ant.launching,org.eclipse.ui.externaltools,org.eclipse.ant.ui",
- org.eclipse.core.externaltools.internal.registry;x-friends:="org.eclipse.ui.externaltools"
diff --git a/org.eclipse.core.externaltools/about.html b/org.eclipse.core.externaltools/about.html
deleted file mode 100644
index 8fcbcd90a..000000000
--- a/org.eclipse.core.externaltools/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>September 16, 2009</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 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</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.core.externaltools/build.properties b/org.eclipse.core.externaltools/build.properties
deleted file mode 100644
index 81d294c95..000000000
--- a/org.eclipse.core.externaltools/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- plugin.properties,\
- about.html
-src.includes = about.html
diff --git a/org.eclipse.core.externaltools/plugin.properties b/org.eclipse.core.externaltools/plugin.properties
deleted file mode 100644
index f2df1a6c0..000000000
--- a/org.eclipse.core.externaltools/plugin.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-pluginName=External Tools Headless Support
-providerName=Eclipse.org
-
-Program.externalTools = Program
-Builder.externalTools = Integrated External Tool Builder \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/plugin.xml b/org.eclipse.core.externaltools/plugin.xml
deleted file mode 100644
index 655c8a2c2..000000000
--- a/org.eclipse.core.externaltools/plugin.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?> <!--
- Copyright (c) 2005, 2009 IBM Corporation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- IBM Corporation - initial API and implementation
- -->
-
-<plugin>
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- name="%Program.externalTools"
- delegate="org.eclipse.core.externaltools.internal.launchConfigurations.ProgramLaunchDelegate"
- category="org.eclipse.ui.externaltools"
- modes="run"
- id="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
- </launchConfigurationType>
- <launchConfigurationType
- name="%Program.externalTools"
- delegate="org.eclipse.core.externaltools.internal.launchConfigurations.ProgramLaunchDelegate"
- category="org.eclipse.ui.externaltools.builder"
- modes="run"
- id="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
- </launchConfigurationType>
- </extension>
- <extension
- id="org.eclipse.ui.externaltools.ExternalToolBuilder"
- name="%Builder.externalTools"
- point="org.eclipse.core.resources.builders">
- <builder
- isConfigurable= "true">
- <run
- class="org.eclipse.core.externaltools.internal.model.ExternalToolBuilder">
- </run>
- </builder>
- </extension>
-</plugin>
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java
deleted file mode 100644
index e14df9960..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/ExternalToolsCore.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.externaltools.internal;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-/**
- * Controls the plug-in life cycle
- */
-public class ExternalToolsCore extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$
-
- private static final String EMPTY_STRING= ""; //$NON-NLS-1$
-
- /**
- * Status code indicating an unexpected internal error.
- * @since 2.1
- */
- public static final int INTERNAL_ERROR = 120;
-
- // The shared instance
- private static ExternalToolsCore plugin;
-
- /**
- * The constructor
- */
- public ExternalToolsCore() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ExternalToolsCore getDefault() {
- return plugin;
- }
-
- /**
- * Logs the specified throwable with this plug-in's log.
- *
- * @param t throwable to log
- */
- public static void log(Throwable t) {
- IStatus status= new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, "Error logged from Ant UI: ", t); //$NON-NLS-1$
- log(status);
- }
-
- /**
- * Logs the specified status with this plug-in's log.
- *
- * @param status status
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Writes the message to the plug-in's log
- *
- * @param message the text to write to the log
- */
- public static void log(String message, Throwable exception) {
- IStatus status = newErrorStatus(message, exception);
- log(status);
- }
-
- /**
- * Returns a new <code>IStatus</code> for this plug-in
- */
- public static IStatus newErrorStatus(String message, Throwable exception) {
- if (message == null) {
- message= EMPTY_STRING;
- }
- return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, exception);
- }
-
- /**
- * Returns a new <code>CoreException</code> for this plug-in
- */
- public static CoreException newError(String message, Throwable exception) {
- return new CoreException(new Status(IStatus.ERROR,
- IExternalToolConstants.PLUGIN_ID, 0, message, exception));
- }
-
-}
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java
deleted file mode 100644
index 4641a0e8c..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * dakshinamurthy.karra@gmail.com - bug 165371
- *******************************************************************************/
-
-package org.eclipse.core.externaltools.internal;
-/**
- * Defines the constants available for client use.
- * <p>
- * This interface is not intended to be extended or implemented by clients.
- * </p>
- */
-public interface IExternalToolConstants {
- /**
- * Plug-in identifier for external tools UI (value <code>org.eclipse.ui.externaltools</code>).
- */
- public static final String UI_PLUGIN_ID = "org.eclipse.ui.externaltools"; //$NON-NLS-1$;
-
- /**
- * Plug-in identifier for external tools core (value <code>org.eclipse.core.externaltools</code>).
- */
- public static final String PLUGIN_ID = "org.eclipse.core.externaltools"; //$NON-NLS-1$;
-
- // ------- Refresh Variables -------
- /**
- * Variable that expands to the workspace root object (value <code>workspace</code>).
- */
- public static final String VAR_WORKSPACE = "workspace"; //$NON-NLS-1$
- /**
- * Variable that expands to the project resource (value <code>project</code>).
- */
- public static final String VAR_PROJECT = "project"; //$NON-NLS-1$
- /**
- * Variable that expands to the container resource (value <code>container</code>).
- */
- public static final String VAR_CONTAINER = "container"; //$NON-NLS-1$
- /**
- * Variable that expands to a resource (value <code>resource</code>).
- */
- public static final String VAR_RESOURCE = "resource"; //$NON-NLS-1$
- /**
- * Variable that expands to the working set object (value <code>working_set</code>).
- */
- public static final String VAR_WORKING_SET = "working_set"; //$NON-NLS-1$
- // ------- Tool Types -------
- /**
- * External tool type for programs such as executables, batch files,
- * shell scripts, etc (value <code>programType</code>).
- */
- public static final String TOOL_TYPE_PROGRAM = "programType"; //$NON-NLS-1$;
-
- // ------- Build Types -------
- /**
- * Build type indicating an incremental project build request for
- * the external tool running as a builder (value <code>incremental</code>).
- */
- public static final String BUILD_TYPE_INCREMENTAL = "incremental"; //$NON-NLS-1$
-
- /**
- * Build type indicating a full project build request for
- * the external tool running as a builder (value <code>full</code>).
- */
- public static final String BUILD_TYPE_FULL = "full"; //$NON-NLS-1$
-
- /**
- * Build type indicating an automatic project build request for
- * the external tool running as a builder (value <code>auto</code>).
- */
- public static final String BUILD_TYPE_AUTO = "auto"; //$NON-NLS-1$
-
- /**
- * Build type indicating a clean project build request for
- * the external tool running as a builder (value <code>clean</code>).
- */
- public static final String BUILD_TYPE_CLEAN = "clean"; //$NON-NLS-1$
-
- /**
- * Build type indicating no project build request for
- * the external tool running as a builder (value <code>none</code>).
- */
- public static final String BUILD_TYPE_NONE = "none"; //$NON-NLS-1$
-
- // ------- Launch configuration types --------
- /**
- * Program launch configuration type identifier.
- */
- public static final String ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType"; //$NON-NLS-1$
-
- /**
- * Program builder launch configuration type identifier. Program project
- * builders are of this type.
- */
- public static final String ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"; //$NON-NLS-1$
-
- // ------- Launch configuration category --------
- /**
- * Identifier for external tools launch configuration category. Launch
- * configuration types for external tools that appear in the external tools
- * launch configuration dialog should belong to this category.
- */
- public static final String ID_EXTERNAL_TOOLS_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools"; //$NON-NLS-1$
- /**
- * Identifier for external tools launch configuration builders category.
- * Launch configuration types that can be added as project builders should
- * belong to this category.
- */
- public static final String ID_EXTERNAL_TOOLS_BUILDER_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools.builder"; //$NON-NLS-1$
-
- // ------- Common External Tool Launch Configuration Attributes -------
-
- /**
- * Boolean attribute indicating if external tool output should be captured.
- * Default value is <code>false</code>.
- * @deprecated since 3.1 Replaced by <code>org.eclipse.debug.core.DebugPlugin.ATTR_CAPTURE_OUTPUT</code>
- */
- public static final String ATTR_CAPTURE_OUTPUT = UI_PLUGIN_ID + ".ATTR_CAPTURE_OUTPUT"; //$NON-NLS-1$
- /**
- * String attribute identifying the location of an external. Default value
- * is <code>null</code>. Encoding is tool specific.
- */
- public static final String ATTR_LOCATION = UI_PLUGIN_ID + ".ATTR_LOCATION"; //$NON-NLS-1$
-
- /**
- * Boolean attribute indicating if the user should be prompted for
- * arguments before running a tool. Default value is <code>false</code>.
- * THIS ATTRIBUTE IS NOT USED.
- */
- public static final String ATTR_PROMPT_FOR_ARGUMENTS = UI_PLUGIN_ID + ".ATTR_PROMPT_FOR_ARGUMENTS"; //$NON-NLS-1$
-
- /**
- * String attribute identifying the scope of resources that should trigger an
- * external tool to run. Default value is <code>null</code>
- * indicating that the builder will be triggered for all changes.
- */
- public static final String ATTR_BUILDER_SCOPE = UI_PLUGIN_ID + ".ATTR_BUILD_SCOPE"; //$NON-NLS-1$
-
- /**
- * String attribute containing an array of build kinds for which an
- * external tool builder should be run.
- */
- public static final String ATTR_RUN_BUILD_KINDS = UI_PLUGIN_ID + ".ATTR_RUN_BUILD_KINDS"; //$NON-NLS-1$
-
- /**
- * Boolean attribute indicating if the console should be shown on external
- * tool output. Default value is <code>false</code>.
- */
- public static final String ATTR_SHOW_CONSOLE = UI_PLUGIN_ID + ".ATTR_SHOW_CONSOLE"; //$NON-NLS-1$
-
- /**
- * String attribute containing the arguments that should be passed to the
- * tool. Default value is <code>null</code>, and encoding is tool specific.
- */
- public static final String ATTR_TOOL_ARGUMENTS = UI_PLUGIN_ID + ".ATTR_TOOL_ARGUMENTS"; //$NON-NLS-1$
-
- /**
- * String attribute identifying the working directory of an external tool.
- * Default value is <code>null</code>, which indicates a default working
- * directory, which is tool specific.
- */
- public static final String ATTR_WORKING_DIRECTORY = UI_PLUGIN_ID + ".ATTR_WORKING_DIRECTORY"; //$NON-NLS-1$
-
- /**
- * String attribute identifying whether an external tool builder configuration
- * is enabled. The default value is <code>true</code>, which indicates
- * that the configuration will be executed as appropriate by the builder.
- */
- public static final String ATTR_BUILDER_ENABLED = UI_PLUGIN_ID + ".ATTR_BUILDER_ENABLED"; //$NON-NLS-1$
-
- /**
- * Boolean attribute identifying whether an external tool launcher should execute
- * synchronously (value <code>false</code>) or asynchronously (value <code>true</code>).
- * Default value is
- */
- public static final String ATTR_LAUNCH_IN_BACKGROUND = "org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND"; //$NON-NLS-1$
-
- /**
- * Status code indicating an unexpected internal error.
- */
- public static final int ERR_INTERNAL_ERROR = 150;
-
- /**
- * String attribute identifying a non-external tool builder launch configuration that is disabled
- * The value is the name of the disabled builder.
- */
- public static final String ATTR_DISABLED_BUILDER = UI_PLUGIN_ID + ".ATTR_DISABLED_BUILDER"; //$NON-NLS-1$
-
- /**
- * boolean attribute identifying that an external tool builder has been configured for triggering
- * using the <code>ICommand.setBuilding(int)</code> mechanism
- * @since 3.1
- */
- public static final String ATTR_TRIGGERS_CONFIGURED = UI_PLUGIN_ID + ".ATTR_TRIGGERS_CONFIGURED"; //$NON-NLS-1$
-
- /**
- * String attribute identifying the build scope for a launch configuration.
- * <code>null</code> indicates the default workspace build.
- */
- public static final String ATTR_BUILD_SCOPE = UI_PLUGIN_ID + ".ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE"; //$NON-NLS-1$
-
- /**
- * Attribute identifier specifying whether referenced projects should be
- * considered when computing the projects to build. Default value is
- * <code>true</code>.
- */
- public static final String ATTR_INCLUDE_REFERENCED_PROJECTS = UI_PLUGIN_ID + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$
-}
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
deleted file mode 100644
index de772967d..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/BackgroundResourceRefresher.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.externaltools.internal.launchConfigurations;
-
-
-import org.eclipse.core.externaltools.internal.ExternalToolsCore;
-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.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.RefreshUtil;
-import org.eclipse.debug.core.model.IProcess;
-
-/**
- * Refreshes resources as specified by a launch configuration, when
- * an associated process terminates.
- */
-public class BackgroundResourceRefresher implements IDebugEventSetListener {
-
- private ILaunchConfiguration fConfiguration;
- private IProcess fProcess;
-
-
-
- public BackgroundResourceRefresher(ILaunchConfiguration configuration, IProcess process) {
- fConfiguration = configuration;
- fProcess = process;
- }
-
- /**
- * If the process has already terminated, resource refreshing is done
- * immediately in the current thread. Otherwise, refreshing is done when the
- * process terminates.
- */
- public void startBackgroundRefresh() {
- synchronized (fProcess) {
- if (fProcess.isTerminated()) {
- refresh();
- } else {
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
- */
- public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (event.getSource() == fProcess && event.getKind() == DebugEvent.TERMINATE) {
- DebugPlugin.getDefault().removeDebugEventListener(this);
- refresh();
- break;
- }
- }
- }
-
- /**
- * Submits a job to do the refresh
- */
- protected void refresh() {
- Job job= new Job(ExternalToolsProgramMessages.BackgroundResourceRefresher_0) {
- public IStatus run(IProgressMonitor monitor) {
- try {
- RefreshUtil.refreshResources(fConfiguration, monitor);
- } catch (CoreException e) {
- ExternalToolsCore.log(e);
- return e.getStatus();
- }
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
-}
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java
deleted file mode 100644
index aba44bbcd..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsCoreUtil.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Keith Seitz (keiths@redhat.com) - Bug 27243 (environment variables contribution)
- * dakshinamurthy.karra@gmail.com - bug 165371
- *******************************************************************************/
-package org.eclipse.core.externaltools.internal.launchConfigurations;
-
-
-import java.io.File;
-
-import org.eclipse.core.externaltools.internal.ExternalToolsCore;
-import org.eclipse.core.externaltools.internal.IExternalToolConstants;
-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.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.RefreshUtil;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Utilities for external tool launch configurations.
- * <p>
- * This class it not intended to be instantiated.
- * </p>
- */
-public class ExternalToolsCoreUtil {
-
- /**
- * Throws a core exception with an error status object built from
- * the given message, lower level exception, and error code.
- * @param message the status message
- * @param exception lower level exception associated with the
- * error, or <code>null</code> if none
- * @param code error code
- */
- protected static void abort(String message, Throwable exception, int code) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, IExternalToolConstants.PLUGIN_ID, code, message, exception));
- }
-
- /**
- * Expands and returns the location attribute of the given launch
- * configuration. The location is
- * verified to point to an existing file, in the local file system.
- *
- * @param configuration launch configuration
- * @return an absolute path to a file in the local file system
- * @throws CoreException if unable to retrieve the associated launch
- * configuration attribute, if unable to resolve any variables, or if the
- * resolved location does not point to an existing file in the local file
- * system
- */
- public static IPath getLocation(ILaunchConfiguration configuration) throws CoreException {
- String location = configuration.getAttribute(IExternalToolConstants.ATTR_LOCATION, (String) null);
- if (location == null) {
- abort(NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_Location_not_specified_by__0__1, new String[] { configuration.getName()}), null, 0);
- } else {
- String expandedLocation = getStringVariableManager().performStringSubstitution(location);
- if (expandedLocation == null || expandedLocation.length() == 0) {
- String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()});
- abort(msg, null, 0);
- } else {
- File file = new File(expandedLocation);
- if (file.isFile()) {
- return new Path(expandedLocation);
- }
-
- String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidLocation__0_, new Object[] { configuration.getName()});
- abort(msg, null, 0);
- }
- }
- // execution will not reach here
- return null;
- }
-
- /**
- * Returns a boolean specifying whether or not output should be captured for
- * the given configuration
- *
- * @param configuration the configuration from which the value will be
- * extracted
- * @return boolean specifying whether or not output should be captured
- * @throws CoreException if unable to access the associated attribute
- */
- public static boolean getCaptureOutput(ILaunchConfiguration configuration) throws CoreException {
- return configuration.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
- }
-
- /**
- * Expands and returns the working directory attribute of the given launch
- * configuration. Returns <code>null</code> if a working directory is not
- * specified. If specified, the working is verified to point to an existing
- * directory in the local file system.
- *
- * @param configuration launch configuration
- * @return an absolute path to a directory in the local file system, or
- * <code>null</code> if unspecified
- * @throws CoreException if unable to retrieve the associated launch
- * configuration attribute, if unable to resolve any variables, or if the
- * resolved location does not point to an existing directory in the local
- * file system
- */
- public static IPath getWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
- String location = configuration.getAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) null);
- if (location != null) {
- String expandedLocation = getStringVariableManager().performStringSubstitution(location);
- if (expandedLocation.length() > 0) {
- File path = new File(expandedLocation);
- if (path.isDirectory()) {
- return new Path(expandedLocation);
- }
- String msg = NLS.bind(ExternalToolsProgramMessages.ExternalToolsUtil_invalidDirectory__0_, new Object[] { expandedLocation, configuration.getName()});
- abort(msg, null, 0);
- }
- }
- return null;
- }
-
- /**
- * Expands and returns the arguments attribute of the given launch
- * configuration. Returns <code>null</code> if arguments are not specified.
- *
- * @param configuration launch configuration
- * @return an array of resolved arguments, or <code>null</code> if
- * unspecified
- * @throws CoreException if unable to retrieve the associated launch
- * configuration attribute, or if unable to resolve any variables
- */
- public static String[] getArguments(ILaunchConfiguration configuration) throws CoreException {
- String args = configuration.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, (String) null);
- if (args != null) {
- String expanded = getStringVariableManager().performStringSubstitution(args);
- return parseStringIntoList(expanded);
- }
- return null;
- }
-
- private static IStringVariableManager getStringVariableManager() {
- return VariablesPlugin.getDefault().getStringVariableManager();
- }
-
- /**
- * Returns whether the given launch configuration is enabled. This property
- * is intended only to apply to external tool builder configurations and
- * determines whether the project builder will launch the configuration
- * when it builds.
- *
- * @param configuration the configuration for which the enabled state should
- * be determined.
- * @return whether the given configuration is enabled to be run when a build occurs.
- * @throws CoreException if unable to access the associated attribute
- */
- public static boolean isBuilderEnabled(ILaunchConfiguration configuration) throws CoreException {
- return configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_ENABLED, true);
- }
-
- /**
- * Returns the collection of resources for the build scope as specified by the given launch configuration.
- *
- * @param configuration launch configuration
- * @throws CoreException if an exception occurs while retrieving the resources
- */
- public static IResource[] getResourcesForBuildScope(ILaunchConfiguration configuration) throws CoreException {
- String scope = configuration.getAttribute(IExternalToolConstants.ATTR_BUILDER_SCOPE, (String) null);
- if (scope == null) {
- return null;
- }
-
- return RefreshUtil.toResources(scope);
- }
-
- /**
- * Parses the argument text into an array of individual
- * strings using the space character as the delimiter.
- * An individual argument containing spaces must have a
- * double quote (") at the start and end. Two double
- * quotes together is taken to mean an embedded double
- * quote in the argument text.
- *
- * @param arguments the arguments as one string
- * @return the array of arguments
- */
- public static String[] parseStringIntoList(String arguments) {
- if (arguments == null || arguments.length() == 0) {
- return new String[0];
- }
- String[] res= DebugPlugin.parseArguments(arguments);
- return res;
- }
- /**
- * Returns a collection of projects referenced by a build scope attribute.
- *
- * @return collection of projects referred to by configuration
- */
- public static IProject[] getBuildProjects(ILaunchConfiguration configuration, String buildScopeId) {
-
- String scope = null;
- String id = buildScopeId ;
- if (id == null) {
- id = IExternalToolConstants.ATTR_BUILD_SCOPE ;
- }
- try {
- scope = configuration.getAttribute(id, (String)null);
- } catch (CoreException e) {
- return null;
- }
- if (scope == null) {
- return null;
- }
- if (scope.startsWith("${projects:")) { //$NON-NLS-1$
- String pathString = scope.substring(11, scope.length() - 1);
- if (pathString.length() > 1) {
- String[] names = pathString.split(","); //$NON-NLS-1$
- IProject[] projects = new IProject[names.length];
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- for (int i = 0; i < names.length; i++) {
- projects[i] = root.getProject(names[i]);
- }
- return projects;
- }
- } else if (scope.equals("${project}")) { //$NON-NLS-1$
- if(configuration.getFile()!=null)
- return new IProject[]{((IResource)configuration.getFile()).getProject()};
- }
- return new IProject[0];
- }
-
- /**
- * Whether referenced projects should be considered when building. Only valid
- * when a set of projects is to be built.
- *
- * @param configuration
- * @return whether referenced projects should be considerd when building
- * @throws CoreException if unable to access the associated attribute
- */
- public static boolean isIncludeReferencedProjects(ILaunchConfiguration configuration, String includeReferencedProjectsId) throws CoreException {
- String id = includeReferencedProjectsId;
- if (id == null) {
- id = IExternalToolConstants.ATTR_INCLUDE_REFERENCED_PROJECTS ;
- }
- return configuration.getAttribute(id, true);
- }
-
- /**
- * Returns whether the given external builder configuration should build asynchronously.
- *
- * @param configuration the configuration
- * @return whether the configuration is configured to build asynchronously
- */
- public static boolean isAsynchronousBuild(ILaunchConfiguration configuration) {
- boolean launchInBackground= false;
- try {
- launchInBackground= configuration.getAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
- } catch (CoreException ce) {
- ExternalToolsCore.log(ce);
- }
- return launchInBackground;
- }
-}
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
deleted file mode 100644
index 889fe2b12..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.externaltools.internal.launchConfigurations;
-
-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 ExternalToolsUtil_Location_not_specified_by__0__1;
- public static String ExternalToolsUtil_invalidLocation__0_;
- public static String ExternalToolsUtil_invalidDirectory__0_;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, ExternalToolsProgramMessages.class);
- }
-} \ No newline at end of file
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
deleted file mode 100644
index e76e7cdbd..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ExternalToolsProgramMessages.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-BackgroundResourceRefresher_0=Refreshing resources...
-
-ProgramLaunchDelegate_3=Running {0}...
-ProgramLaunchDelegate_4=An IProcess could not be created for the launch
-
-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}.
-ExternalToolsUtil_invalidDirectory__0_ = The working directory {0} does not exist for the external tool named {1}. \ No newline at end of file
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
deleted file mode 100644
index 635f340fd..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/launchConfigurations/ProgramLaunchDelegate.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Keith Seitz (keiths@redhat.com) - environment variables contribution (Bug 27243)
- * dakshinamurthy.karra@gmail.com - bug 165371
- *******************************************************************************/
-package org.eclipse.core.externaltools.internal.launchConfigurations;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.externaltools.internal.IExternalToolConstants;
-import org.eclipse.core.resources.IProject;
-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.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.RefreshUtil;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Launch delegate for a program.
- */
-public class ProgramLaunchDelegate extends LaunchConfigurationDelegate {
-
- /**
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration,
- * java.lang.String, org.eclipse.debug.core.ILaunch,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode,
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
-
- if (monitor.isCanceled()) {
- return;
- }
-
- // resolve location
- IPath location = ExternalToolsCoreUtil.getLocation(configuration);
-
- if (monitor.isCanceled()) {
- return;
- }
-
- // resolve working directory
- IPath workingDirectory = ExternalToolsCoreUtil
- .getWorkingDirectory(configuration);
-
- if (monitor.isCanceled()) {
- return;
- }
-
- // resolve arguments
- String[] arguments = ExternalToolsCoreUtil.getArguments(configuration);
-
- if (monitor.isCanceled()) {
- return;
- }
-
- int cmdLineLength = 1;
- if (arguments != null) {
- cmdLineLength += arguments.length;
- }
- String[] cmdLine = new String[cmdLineLength];
- cmdLine[0] = location.toOSString();
- if (arguments != null) {
- System.arraycopy(arguments, 0, cmdLine, 1, arguments.length);
- }
-
- File workingDir = null;
- if (workingDirectory != null) {
- workingDir = workingDirectory.toFile();
- }
-
- if (monitor.isCanceled()) {
- return;
- }
-
- String[] envp = DebugPlugin.getDefault().getLaunchManager()
- .getEnvironment(configuration);
-
- if (monitor.isCanceled()) {
- return;
- }
-
- Process p = DebugPlugin.exec(cmdLine, workingDir, envp);
- IProcess process = null;
-
- // add process type to process attributes
- Map processAttributes = new HashMap();
- String programName = location.lastSegment();
- String extension = location.getFileExtension();
- if (extension != null) {
- programName = programName.substring(0, programName.length()
- - (extension.length() + 1));
- }
- programName = programName.toLowerCase();
- processAttributes.put(IProcess.ATTR_PROCESS_TYPE, programName);
-
- if (p != null) {
- monitor.beginTask(NLS.bind(
- ExternalToolsProgramMessages.ProgramLaunchDelegate_3,
- new String[] { configuration.getName() }),
- IProgressMonitor.UNKNOWN);
- process = DebugPlugin.newProcess(launch, p, location.toOSString(),
- processAttributes);
- }
- if (p == null || process == null) {
- if (p != null)
- p.destroy();
- throw new CoreException(new Status(IStatus.ERROR,
- IExternalToolConstants.PLUGIN_ID,
- IExternalToolConstants.ERR_INTERNAL_ERROR,
- ExternalToolsProgramMessages.ProgramLaunchDelegate_4, null));
- }
- process.setAttribute(IProcess.ATTR_CMDLINE,
- generateCommandLine(cmdLine));
-
-// if (launchManager.isLaunchInBackground(configuration)) {
-// // refresh resources after process finishes
-// if (launchManager.getRefreshScope(configuration) != null) {
-// BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(
-// configuration, process);
-// refresher.startBackgroundRefresh();
-// }
-// } else {
- // wait for process to exit
- while (!process.isTerminated()) {
- try {
- if (monitor.isCanceled()) {
- process.terminate();
- break;
- }
- Thread.sleep(50);
- } catch (InterruptedException e) {
- }
- }
-
- // refresh resources
- RefreshUtil.refreshResources(configuration, monitor);
-// }
- }
-
- private String generateCommandLine(String[] commandLine) {
- if (commandLine.length < 1)
- return ""; //$NON-NLS-1$
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < commandLine.length; i++) {
- buf.append(' ');
- char[] characters = commandLine[i].toCharArray();
- StringBuffer command = new StringBuffer();
- boolean containsSpace = false;
- for (int j = 0; j < characters.length; j++) {
- char character = characters[j];
- if (character == '\"') {
- command.append('\\');
- } else if (character == ' ') {
- containsSpace = true;
- }
- command.append(character);
- }
- if (containsSpace) {
- buf.append('\"');
- buf.append(command);
- buf.append('\"');
- } else {
- buf.append(command);
- }
- }
- return buf.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder
- * (org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
- */
- protected IProject[] getBuildOrder(ILaunchConfiguration configuration,
- String mode) throws CoreException {
- IProject[] projects = ExternalToolsCoreUtil.getBuildProjects(
- configuration, null);
- if (projects == null) {
- return null;
- }
- boolean isRef = ExternalToolsCoreUtil.isIncludeReferencedProjects(
- configuration, null);
- if (isRef) {
- return computeReferencedBuildOrder(projects);
- }
- return computeBuildOrder(projects);
- }
-}
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
deleted file mode 100644
index f3b7acd6d..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.externaltools.internal.model;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.externaltools.internal.IExternalToolConstants;
-import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration;
-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;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-
-/**
- * Utility methods for working with external tool project builders.
- */
-public class BuilderCoreUtils {
-
- public static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$
-
- /**
- * Constant used to find a builder using the 3.0-interim format
- */
- public static final String BUILDER_FOLDER_NAME = ".externalToolBuilders"; //$NON-NLS-1$
- /**
- * Constant used to represent the current project in the 3.0-final format.
- */
- public static final String PROJECT_TAG = "<project>"; //$NON-NLS-1$
-
- public static final String VERSION_1_0 = "1.0"; //$NON-NLS-1$
- public static final String VERSION_2_1 = "2.1"; //$NON-NLS-1$
- // The format shipped up to and including Eclipse 3.0 RC1
- public static final String VERSION_3_0_interim = "3.0.interim"; //$NON-NLS-1$
- // The format shipped in Eclipse 3.0 final
- public static final String VERSION_3_0_final = "3.0"; //$NON-NLS-1$
-
- private static final String BUILD_TYPE_SEPARATOR = ","; //$NON-NLS-1$
- private static final int[] DEFAULT_BUILD_TYPES = new int[] {
- IncrementalProjectBuilder.INCREMENTAL_BUILD,
- IncrementalProjectBuilder.FULL_BUILD };
-
- /**
- * Returns a launch configuration from the given ICommand arguments. If the
- * given arguments are from an old-style external tool, an unsaved working
- * copy will be created from the arguments and returned.
- *
- * @param commandArgs
- * the builder ICommand arguments
- * @return a launch configuration, a launch configuration working copy, or
- * <code>null</code> if not possible.
- */
- public static ILaunchConfiguration configFromBuildCommandArgs(
- IProject project, Map commandArgs, String[] version) {
- String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE);
- if (configHandle == null) {
- // Probably an old-style (Eclipse 1.0 or 2.0) external tool. Try to
- // migrate.
- version[0] = VERSION_1_0;
- return ExternalToolMigration.configFromArgumentMap(commandArgs);
- }
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfiguration configuration = null;
- if (configHandle.startsWith(PROJECT_TAG)) {
- version[0] = VERSION_3_0_final;
- IPath path = new Path(configHandle);
- IFile file = project.getFile(path.removeFirstSegments(1));
- if (file.exists()) {
- configuration = manager.getLaunchConfiguration(file);
- }
- } else {
- // Try treating the handle as a file name.
- // This is the format used in 3.0 RC1.
- IPath path = new Path(BUILDER_FOLDER_NAME).append(configHandle);
- IFile file = project.getFile(path);
- if (file.exists()) {
- version[0] = VERSION_3_0_interim;
- configuration = manager.getLaunchConfiguration(file);
- } else {
- try {
- // Treat the configHandle as a memento. This is the format
- // used in Eclipse 2.1.
- configuration = manager
- .getLaunchConfiguration(configHandle);
- } catch (CoreException e) {
- }
- if (configuration != null) {
- version[0] = VERSION_2_1;
- }
- }
- }
- return configuration;
- }
-
- public static void configureTriggers(ILaunchConfiguration config,
- ICommand newCommand) throws CoreException {
- newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, false);
- newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD,
- false);
- 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 = BuilderCoreUtils.buildTypesToArray(buildKinds);
- for (int i = 0; i < triggers.length; i++) {
- switch (triggers[i]) {
- case IncrementalProjectBuilder.FULL_BUILD:
- newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD,
- true);
- break;
- case IncrementalProjectBuilder.INCREMENTAL_BUILD:
- newCommand.setBuilding(
- IncrementalProjectBuilder.INCREMENTAL_BUILD, true);
- break;
- case IncrementalProjectBuilder.AUTO_BUILD:
- newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD,
- true);
- break;
- case IncrementalProjectBuilder.CLEAN_BUILD:
- newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD,
- true);
- break;
- }
- }
- if (!config.getAttribute(
- IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) {
- ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
- copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED,
- true);
- copy.doSave();
- }
- }
-
- /**
- * 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 config.isWorkingCopy()
- && ((ILaunchConfigurationWorkingCopy) config).getOriginal() == null;
- }
-
- /**
- * Converts the given config to a build command which is stored in the given
- * command.
- *
- * @return the configured build command
- */
- public static ICommand toBuildCommand(IProject project,
- ILaunchConfiguration config, ICommand command) throws CoreException {
- Map args = null;
- if (isUnmigratedConfig(config)) {
- // This config represents an old external tool builder that hasn't
- // been edited. Try to find the old ICommand and reuse the
- // arguments.
- // 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];
- String name = ExternalToolMigration
- .getNameFromCommandArgs(projectCommand.getArguments());
- if (name != null && name.equals(config.getName())) {
- args = projectCommand.getArguments();
- break;
- }
- }
- } else {
- if (config instanceof ILaunchConfigurationWorkingCopy) {
- ILaunchConfigurationWorkingCopy workingCopy = (ILaunchConfigurationWorkingCopy) config;
- if (workingCopy.getOriginal() != null) {
- config = workingCopy.getOriginal();
- }
- }
- args = new HashMap();
- // Launch configuration builders are stored with a project-relative
- // path
- StringBuffer buffer = new StringBuffer(PROJECT_TAG);
- // Append the project-relative path (workspace path minus first
- // segment)
- buffer.append('/').append(
- config.getFile().getFullPath().removeFirstSegments(1));
- args.put(LAUNCH_CONFIG_HANDLE, buffer.toString());
- }
- command.setBuilderName(ExternalToolBuilder.ID);
- command.setArguments(args);
- return command;
- }
-
- /**
- * Returns the folder where project builders should be stored or
- * <code>null</code> if the folder could not be created
- */
- public static IFolder getBuilderFolder(IProject project, boolean create) {
- IFolder folder = project.getFolder(BUILDER_FOLDER_NAME);
- if (!folder.exists() && create) {
- try {
- folder.create(true, true, new NullProgressMonitor());
- } catch (CoreException e) {
- return null;
- }
- }
- 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.
- *
- * @param buildTypes
- * the string of built types to convert
- * @return the array of build kinds.
- */
- public static int[] buildTypesToArray(String buildTypes) {
- if (buildTypes == null || buildTypes.length() == 0) {
- return DEFAULT_BUILD_TYPES;
- }
-
- int count = 0;
- boolean incremental = false;
- boolean full = false;
- boolean auto = false;
- boolean clean = false;
-
- StringTokenizer tokenizer = new StringTokenizer(buildTypes,
- BUILD_TYPE_SEPARATOR);
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- if (IExternalToolConstants.BUILD_TYPE_INCREMENTAL.equals(token)) {
- if (!incremental) {
- incremental = true;
- count++;
- }
- } else if (IExternalToolConstants.BUILD_TYPE_FULL.equals(token)) {
- if (!full) {
- full = true;
- count++;
- }
- } else if (IExternalToolConstants.BUILD_TYPE_AUTO.equals(token)) {
- if (!auto) {
- auto = true;
- count++;
- }
- } else if (IExternalToolConstants.BUILD_TYPE_CLEAN.equals(token)) {
- if (!clean) {
- clean = true;
- count++;
- }
- }
- }
-
- int[] results = new int[count];
- count = 0;
- if (incremental) {
- results[count] = IncrementalProjectBuilder.INCREMENTAL_BUILD;
- count++;
- }
- if (full) {
- results[count] = IncrementalProjectBuilder.FULL_BUILD;
- count++;
- }
- if (auto) {
- results[count] = IncrementalProjectBuilder.AUTO_BUILD;
- count++;
- }
- if (clean) {
- results[count] = IncrementalProjectBuilder.CLEAN_BUILD;
- count++;
- }
-
- return results;
- }
-}
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
deleted file mode 100644
index 244a833f6..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Matthew Conway - Bug 175186
- *******************************************************************************/
-package org.eclipse.core.externaltools.internal.model;
-
-
-import java.util.Map;
-
-import org.eclipse.core.externaltools.internal.ExternalToolsCore;
-import org.eclipse.core.externaltools.internal.IExternalToolConstants;
-import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil;
-import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-/**
- * This project builder implementation will run an external tool during the
- * build process.
- */
-public final class ExternalToolBuilder extends IncrementalProjectBuilder {
- private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor {
- private boolean[] fTrueChange;
- private IgnoreTeamPrivateChanges(boolean[] trueChange) {
- super();
- fTrueChange= trueChange;
- }
- public boolean visit(IResourceDelta visitDelta) throws CoreException {
- IResource resource= visitDelta.getResource();
- if (resource instanceof IFile) {
- fTrueChange[0]= true;
- return false;
- }
- return true;
- }
- }
-
- public static final String ID = "org.eclipse.ui.externaltools.ExternalToolBuilder"; //$NON-NLS-1$;
-
- private static String buildType = IExternalToolConstants.BUILD_TYPE_NONE;
-
- private static IProject buildProject= null;
- private static IResourceDelta buildDelta= null;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
- if (ExternalToolsCore.getDefault().getBundle().getState() != Bundle.ACTIVE) {
- return null;
- }
-
- ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]);
- if (config == null) {
- throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null);
- }
- IProject[] projectsWithinScope= null;
- IResource[] resources = ExternalToolsCoreUtil.getResourcesForBuildScope(config);
- if (resources != null) {
- projectsWithinScope= new IProject[resources.length];
- for (int i = 0; i < resources.length; i++) {
- projectsWithinScope[i]= resources[i].getProject();
- }
- }
- boolean kindCompatible= commandConfiguredForKind(config, kind);
- if (kindCompatible && configEnabled(config)) {
- doBuildBasedOnScope(resources, kind, config, monitor);
- }
-
- return projectsWithinScope;
- }
-
- private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) {
- try {
- if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
- ICommand command= getCommand();
- //adapt the builder command to make use of the 3.1 support for setting command build kinds
- //this will only happen once for builder/command defined before the support existed
- BuilderCoreUtils.configureTriggers(config, command);
- IProjectDescription desc= getProject().getDescription();
- ICommand[] commands= desc.getBuildSpec();
- int index= getBuilderCommandIndex(commands, command);
- if (index != -1) {
- commands[index]= command;
- desc.setBuildSpec(commands);
- getProject().setDescription(desc, null);
- ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy();
- copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
- copy.doSave();
- }
- return command.isBuilding(kind);
- }
- } catch (CoreException e) {
- ExternalToolsCore.log(e);
- return true;
- }
- return true;
- }
-
- private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) {
- Map commandArgs= command.getArguments();
- if (commandArgs == null) {
- return -1;
- }
- String handle= (String) commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE);
- if (handle == null) {
- return -1;
- }
- for (int i = 0; i < buildSpec.length; ++i) {
- ICommand buildSpecCommand= buildSpec[i];
- if (ID.equals(buildSpecCommand.getBuilderName())) {
- Map buildSpecArgs= buildSpecCommand.getArguments();
- if (buildSpecArgs != null) {
- String buildSpecHandle= (String) buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE);
- if (handle.equals(buildSpecHandle)) {
- return i;
- }
- }
- }
- }
- return -1;
- }
-
- /**
- * Returns whether the given builder config is enabled or not.
- *
- * @param config the config to examine
- * @return whether the config is enabled
- */
- private boolean configEnabled(ILaunchConfiguration config) {
- try {
- return ExternalToolsCoreUtil.isBuilderEnabled(config);
- } catch (CoreException e) {
- ExternalToolsCore.log(e);
- }
- return true;
- }
-
- private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
- boolean buildForChange = true;
- if (kind != FULL_BUILD) { //scope not applied for full builds
- if (resources != null && resources.length > 0) {
- buildForChange = buildScopeIndicatesBuild(resources);
- }
- }
-
- if (buildForChange) {
- launchBuild(kind, config, monitor);
- }
- }
-
- private void launchBuild(int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
- monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()}));
- buildStarted(kind);
- // The default value for "launch in background" is true in debug core. If
- // the user doesn't go through the UI, the new attribute won't be set. This means
- // that existing Ant builders will try to run in the background (and likely conflict with
- // each other) without migration.
- config= ExternalToolMigration.migrateRunInBackground(config);
- config.launch(ILaunchManager.RUN_MODE, monitor);
- buildEnded();
- }
-
- /**
- * Returns the build type being performed if the
- * external tool is being run as a project builder.
- *
- * @return one of the <code>IExternalToolConstants.BUILD_TYPE_*</code> constants.
- */
- public static String getBuildType() {
- return buildType;
- }
-
- /**
- * Returns the project that is being built and has triggered the current external
- * tool builder. <code>null</code> is returned if no build is currently occurring.
- *
- * @return project being built or <code>null</code>.
- */
- public static IProject getBuildProject() {
- return buildProject;
- }
-
- /**
- * Returns the <code>IResourceDelta</code> that is being built and has triggered the current external
- * tool builder. <code>null</code> is returned if no build is currently occurring.
- *
- * @return resource delta for the build or <code>null</code>
- */
- public static IResourceDelta getBuildDelta() {
- return buildDelta;
- }
-
- /**
- * Stores the currently active build kind and build project when a build begins
- * @param buildKind
- */
- private void buildStarted(int buildKind) {
- switch (buildKind) {
- case IncrementalProjectBuilder.INCREMENTAL_BUILD :
- buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL;
- buildDelta = getDelta(getProject());
- break;
- case IncrementalProjectBuilder.FULL_BUILD :
- buildType = IExternalToolConstants.BUILD_TYPE_FULL;
- break;
- case IncrementalProjectBuilder.AUTO_BUILD :
- buildType = IExternalToolConstants.BUILD_TYPE_AUTO;
- buildDelta = getDelta(getProject());
- break;
- case IncrementalProjectBuilder.CLEAN_BUILD :
- buildType = IExternalToolConstants.BUILD_TYPE_CLEAN;
- break;
- default :
- buildType = IExternalToolConstants.BUILD_TYPE_NONE;
- break;
- }
- buildProject= getProject();
- }
-
- /**
- * Clears the current build kind, build project and build delta when a build finishes.
- */
- private void buildEnded() {
- buildType= IExternalToolConstants.BUILD_TYPE_NONE;
- buildProject= null;
- buildDelta= null;
- }
-
- private boolean buildScopeIndicatesBuild(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- IResourceDelta delta = getDelta(resources[i].getProject());
- if (delta == null) {
- //project just added to the workspace..no previous build tree
- return true;
- }
- IPath path= resources[i].getProjectRelativePath();
- IResourceDelta change= delta.findMember(path);
- if (change != null) {
- final boolean[] trueChange= new boolean[1];
- trueChange[0]= false;
- try {
- change.accept(new IgnoreTeamPrivateChanges(trueChange));
- } catch (CoreException e) {
- ExternalToolsCore.log("Internal error resolving changed resources during build", e); //$NON-NLS-1$
- }
-
- return trueChange[0]; //filtered out team private changes
- }
- }
- return false;
- }
-
- protected void clean(IProgressMonitor monitor) throws CoreException {
- ICommand command= getCommand();
- ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]);
- if (!configEnabled(config)) {
- return;
- }
-
- if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
- //old behavior
- super.clean(monitor);
- return;
- }
-
- launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, monitor);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java
deleted file mode 100644
index 9e38b5041..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.externaltools.internal.model;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ExternalToolsModelMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.model.ExternalToolsModelMessages";//$NON-NLS-1$
-
- public static String ExternalToolBuilder_Running__0_____1;
- public static String ExternalToolBuilder_0;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, ExternalToolsModelMessages.class);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties
deleted file mode 100644
index 0f16fe71a..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolsModelMessages.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-ExternalToolBuilder_Running__0_____1=Running {0}...
-ExternalToolBuilder_0=The builder launch configuration could not be found.
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
deleted file mode 100644
index a06bc8782..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.externaltools.internal.registry;
-
-
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.externaltools.internal.ExternalToolsCore;
-import org.eclipse.core.externaltools.internal.IExternalToolConstants;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-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.RefreshUtil;
-
-
-/**
- * Responsible reading an old external tool format and creating
- * and migrating it to create a new external tool.
- */
-public final class ExternalToolMigration {
- /**
- * Structure to represent a variable definition within a
- * source string.
- */
- public static final class VariableDefinition {
- /**
- * Index in the source text where the variable started
- * or <code>-1</code> if no valid variable start tag
- * identifier found.
- */
- public int start = -1;
-
- /**
- * Index in the source text of the character following
- * the end of the variable or <code>-1</code> if no
- * valid variable end tag found.
- */
- public int end = -1;
-
- /**
- * The variable's name found in the source text, or
- * <code>null</code> if no valid variable found.
- */
- public String name = null;
-
- /**
- * The variable's argument found in the source text, or
- * <code>null</code> if no valid variable found or if
- * the variable did not specify an argument
- */
- public String argument = null;
-
- /**
- * Create an initialized variable definition.
- */
- private VariableDefinition() {
- super();
- }
- }
-
- /**
- * Variable tag indentifiers
- */
- private static final String VAR_TAG_START = "${"; //$NON-NLS-1$
- private static final String VAR_TAG_END = "}"; //$NON-NLS-1$
- private static final String VAR_TAG_SEP = ":"; //$NON-NLS-1$
-
- /**
- * External tool type for Ant build files (value <code>antBuildType</code>).
- */
- public static final String TOOL_TYPE_ANT_BUILD = "antBuildType"; //$NON-NLS-1$;
- /**
- * Ant builder launch configuration type identifier. Ant project builders
- * are of this type.
- */
- public static final String ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE = "org.eclipse.ant.AntBuilderLaunchConfigurationType"; //$NON-NLS-1$
-
- public static final String RUN_TARGETS_ATTRIBUTE = TOOL_TYPE_ANT_BUILD + ".runTargets"; //$NON-NLS-1$;
-
- /**
- * String attribute indicating the Ant targets to execute. Default value is
- * <code>null</code> which indicates that the default target is to be
- * executed. Format is a comma separated listing of targets.
- * NOTE: This value is copied here from org.eclipse.ant.ui.internal.IAntLaunchConfigurationConstants.
- * Ant no longer resides in External Tools and this plug-in. This value is kept here only
- * for migration.
- */
- public static final String ATTR_ANT_TARGETS = IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_ANT_TARGETS"; //$NON-NLS-1$
-
- /*
- * 2.0 External Tool Tags
- */
- public static final String TAG_TOOL_TYPE = "!{tool_type}"; //$NON-NLS-1$
- public static final String TAG_TOOL_NAME = "!{tool_name}"; //$NON-NLS-1$
- public static final String TAG_TOOL_LOCATION = "!{tool_loc}"; //$NON-NLS-1$
- public static final String TAG_TOOL_ARGUMENTS = "!{tool_args}"; //$NON-NLS-1$
- public static final String TAG_TOOL_DIRECTORY = "!{tool_dir}"; //$NON-NLS-1$
- public static final String TAG_TOOL_REFRESH = "!{tool_refresh}"; //$NON-NLS-1$
- public static final String TAG_TOOL_SHOW_LOG = "!{tool_show_log}"; //$NON-NLS-1$
- public static final String TAG_TOOL_BUILD_TYPES = "!{tool_build_types}"; //$NON-NLS-1$
- public static final String TAG_TOOL_BLOCK = "!{tool_block}"; //$NON-NLS-1$
-
- // Known kind of tools
- private static final String TOOL_TYPE_ANT = "org.eclipse.ui.externaltools.type.ant"; //$NON-NLS-1$
- private static final String TOOL_TYPE_PROGRAM = "org.eclipse.ui.externaltools.type.program"; //$NON-NLS-1$
-
- /*
- * 2.1 External Tool Keys
- */
- public static final String TAG_TYPE = "type"; //$NON-NLS-1$
- public static final String TAG_NAME = "name"; //$NON-NLS-1$
- public static final String TAG_LOCATION = "location"; //$NON-NLS-1$
- public static final String TAG_WORK_DIR = "workDirectory"; //$NON-NLS-1$
- public static final String TAG_CAPTURE_OUTPUT = "captureOutput"; //$NON-NLS-1$
- public static final String TAG_SHOW_CONSOLE = "showConsole"; //$NON-NLS-1$
- public static final String TAG_RUN_BKGRND = "runInBackground"; //$NON-NLS-1$
- public static final String TAG_PROMPT_ARGS = "promptForArguments"; //$NON-NLS-1$
- public static final String TAG_ARGS = "arguments"; //$NON-NLS-1$
- public static final String TAG_REFRESH_SCOPE = "refreshScope"; //$NON-NLS-1$
- public static final String TAG_REFRESH_RECURSIVE = "refreshRecursive"; //$NON-NLS-1$
- public static final String TAG_RUN_BUILD_KINDS = "runForBuildKinds"; //$NON-NLS-1$
- public static final String TAG_EXTRA_ATTR = "extraAttribute"; //$NON-NLS-1$
- public static final String TAG_VERSION = "version"; //$NON-NLS-1$
-
- private static final String EXTRA_ATTR_SEPARATOR = "="; //$NON-NLS-1$
-
- private static final String VERSION_21 = "2.1"; //$NON-NLS-1$;
-
- private static final String TRUE = "true"; //$NON-NLS-1$
- private static final String FALSE = "false"; //$NON-NLS-1$
-
- /**
- * Allows no instances.
- */
- private ExternalToolMigration() {
- super();
- }
-
- /**
- * Returns a launch configuration working copy from the argument map or
- * <code>null</code> if the given map cannot be interpreted as a 2.0 or 2.1
- * branch external tool. The returned working copy will be unsaved and its
- * location will be set to the metadata area.
- */
- public static ILaunchConfigurationWorkingCopy configFromArgumentMap(Map args) {
- String version = (String) args.get(TAG_VERSION);
- if (VERSION_21.equals(version)) {
- return configFrom21ArgumentMap(args);
- }
- return configFrom20ArgumentMap(args);
- }
-
- public static ILaunchConfigurationWorkingCopy configFrom21ArgumentMap(Map commandArgs) {
- String name = (String) commandArgs.get(TAG_NAME);
- String type = (String) commandArgs.get(TAG_TYPE);
-
- ILaunchConfigurationWorkingCopy config = newConfig(type, name);
- if (config == null) {
- return null;
- }
-
- config.setAttribute(IExternalToolConstants.ATTR_LOCATION, (String) commandArgs.get(TAG_LOCATION));
- config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) commandArgs.get(TAG_WORK_DIR));
- config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(commandArgs.get(TAG_CAPTURE_OUTPUT)));
- config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(commandArgs.get(TAG_SHOW_CONSOLE)));
- config.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, TRUE.equals(commandArgs.get(TAG_RUN_BKGRND)));
- config.setAttribute(IExternalToolConstants.ATTR_PROMPT_FOR_ARGUMENTS, TRUE.equals(commandArgs.get(TAG_PROMPT_ARGS)));
- config.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, (String) commandArgs.get(TAG_REFRESH_SCOPE));
- config.setAttribute(RefreshUtil.ATTR_REFRESH_RECURSIVE, TRUE.equals(commandArgs.get(TAG_REFRESH_RECURSIVE)));
-
- config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) commandArgs.get(TAG_RUN_BUILD_KINDS));
-
- String args = (String) commandArgs.get(TAG_ARGS);
- if (args != null) {
- config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, args);
- }
-
- String extraAttributes = (String) commandArgs.get(TAG_EXTRA_ATTR);
- if (extraAttributes != null) {
- StringTokenizer tokenizer = new StringTokenizer(extraAttributes, EXTRA_ATTR_SEPARATOR);
- while (tokenizer.hasMoreTokens()) {
- String key = tokenizer.nextToken();
- if (!tokenizer.hasMoreTokens())
- break;
- String value = tokenizer.nextToken();
- if (key.equals(RUN_TARGETS_ATTRIBUTE)) {
- // 2.1 implementation only defined 1 "extra attribute"
- config.setAttribute(ATTR_ANT_TARGETS, value);
- }
- }
- }
- return config;
- }
-
- /**
- * Creates an external tool from the map.
- */
- public static ILaunchConfigurationWorkingCopy configFrom20ArgumentMap(Map args) {
- // Update the type...
- String type = (String) args.get(TAG_TOOL_TYPE);
- if (TOOL_TYPE_ANT.equals(type)) {
- type = TOOL_TYPE_ANT_BUILD;
- } else if (TOOL_TYPE_PROGRAM.equals(type)){
- type = IExternalToolConstants.TOOL_TYPE_PROGRAM;
- } else {
- return null;
- }
-
- String name = (String) args.get(TAG_TOOL_NAME);
-
- ILaunchConfigurationWorkingCopy config = newConfig(type, name);
- if (config == null) {
- return null;
- }
-
- // Update the location...
- String location = (String) args.get(TAG_TOOL_LOCATION);
- config.setAttribute(IExternalToolConstants.ATTR_LOCATION, location);
-
- // Update the refresh scope...
- String refresh = (String) args.get(TAG_TOOL_REFRESH);
- if (refresh != null) {
- VariableDefinition varDef = extractVariableDefinition(refresh, 0);
- if ("none".equals(varDef.name)) { //$NON-NLS-1$
- refresh = null;
- }
- config.setAttribute(RefreshUtil.ATTR_REFRESH_SCOPE, refresh);
- }
-
- // Update the arguments
- String arguments = (String) args.get(TAG_TOOL_ARGUMENTS);
- if (type.equals(TOOL_TYPE_ANT_BUILD)) {
- String targetNames = null;
- if (arguments != null) {
- int start = 0;
- ArrayList targets = new ArrayList();
- StringBuffer buffer = new StringBuffer();
- VariableDefinition varDef = extractVariableDefinition(arguments, start);
- while (varDef.end != -1) {
- if ("ant_target".equals(varDef.name) && varDef.argument != null) { //$NON-NLS-1$
- targets.add(varDef.argument);
- buffer.append(arguments.substring(start, varDef.start));
- } else {
- buffer.append(arguments.substring(start, varDef.end));
- }
- start = varDef.end;
- varDef = extractVariableDefinition(arguments, start);
- }
- buffer.append(arguments.substring(start, arguments.length()));
- arguments = buffer.toString();
-
- buffer.setLength(0);
- for (int i = 0; i < targets.size(); i++) {
- String target = (String) targets.get(i);
- if (target != null && target.length() > 0) {
- buffer.append(target);
- buffer.append(","); //$NON-NLS-1$
- }
- }
- targetNames = buffer.toString();
- }
- if (targetNames != null && targetNames.length() > 0) {
- config.setAttribute(ATTR_ANT_TARGETS, targetNames);
- }
- }
- config.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
-
- // Collect the rest of the information
- config.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG)));
- config.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, TRUE.equals(args.get(TAG_TOOL_SHOW_LOG)));
- config.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, FALSE.equals(args.get(TAG_TOOL_BLOCK)));
- String buildKinds= (String) args.get(TAG_TOOL_BUILD_TYPES);
- if (buildKinds != null) {
- buildKinds= buildKinds.replace(';', ','); // Replace the old separator with the new
- }
- config.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buildKinds);
- config.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY, (String) args.get(TAG_TOOL_DIRECTORY));
- return config;
- }
-
- /**
- * Returns a new working copy with the given external tool name and external
- * tool type or <code>null</code> if no config could be created.
- */
- private static ILaunchConfigurationWorkingCopy newConfig(String type, String name) {
- if (type == null || name == null) {
- return null;
- }
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType configType;
- if (TOOL_TYPE_ANT_BUILD.equals(type)) {
- configType = manager.getLaunchConfigurationType(ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE);
- } else if (IExternalToolConstants.TOOL_TYPE_PROGRAM.equals(type)) {
- configType = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_BUILDER_LAUNCH_CONFIGURATION_TYPE);
- } else {
- return null;
- }
- try {
- if (configType != null) {
- return configType.newInstance(null, name);
- }
- } catch (CoreException e) {
- ExternalToolsCore.log(e);
- }
- return null;
- }
-
- /**
- * Returns the tool name extracted from the given command argument map.
- * Extraction is attempted using 2.0 and 2.1 external tool formats.
- */
- public static String getNameFromCommandArgs(Map commandArgs) {
- String name= (String) commandArgs.get(TAG_NAME);
- if (name == null) {
- name= (String) commandArgs.get(TAG_TOOL_NAME);
- }
- return name;
- }
-
- /**
- * Migrate the old RUN_IN_BACKGROUND launch config attribute to the new
- * LAUNCH_IN_BACKGROUND attribute provided by the debug ui plugin.
- *
- * @param config the config to migrate
- * @return the migrated config
- */
- public static ILaunchConfiguration migrateRunInBackground(ILaunchConfiguration config) {
- String noValueFlag= "NoValue"; //$NON-NLS-1$
- String attr= null;
- try {
- attr = config.getAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, noValueFlag);
- } catch (CoreException e) {
- // Exception will occur if the attribute is already set because the attribute is actually a boolean.
- // No migration necessary.
- return config;
- }
- if (noValueFlag.equals(attr)) {
- //the old constant
- String ATTR_RUN_IN_BACKGROUND= IExternalToolConstants.UI_PLUGIN_ID + ".ATTR_RUN_IN_BACKGROUND"; //$NON-NLS-1$
- boolean runInBackground= false;
- try {
- runInBackground = config.getAttribute(ATTR_RUN_IN_BACKGROUND, runInBackground);
- } catch (CoreException e) {
- ExternalToolsCore.log(ExternalToolsMigrationMessages.ExternalToolMigration_37, e);
- }
- try {
- ILaunchConfigurationWorkingCopy workingCopy= config.getWorkingCopy();
- workingCopy.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, runInBackground);
- config= workingCopy.doSave();
- } catch (CoreException e) {
- ExternalToolsCore.log(ExternalToolsMigrationMessages.ExternalToolMigration_38, e);
- }
- }
- return config;
- }
-
- /**
- * Extracts a variable name and argument from the given string.
- *
- * @param text the source text to parse for a variable tag
- * @param start the index in the string to start the search
- * @return the variable definition
- */
- public static VariableDefinition extractVariableDefinition(String text, int start) {
- VariableDefinition varDef = new VariableDefinition();
-
- varDef.start = text.indexOf(VAR_TAG_START, start);
- if (varDef.start < 0){
- return varDef;
- }
- start = varDef.start + VAR_TAG_START.length();
-
- int end = text.indexOf(VAR_TAG_END, start);
- if (end < 0) {
- return varDef;
- }
- varDef.end = end + VAR_TAG_END.length();
- if (end == start) {
- return varDef;
- }
-
- int mid = text.indexOf(VAR_TAG_SEP, start);
- if (mid < 0 || mid > end) {
- varDef.name = text.substring(start, end);
- } else {
- if (mid > start) {
- varDef.name = text.substring(start, mid);
- }
- mid = mid + VAR_TAG_SEP.length();
- if (mid < end) {
- varDef.argument = text.substring(mid, end);
- }
- }
-
- return varDef;
- }
-}
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java
deleted file mode 100644
index 3e5fa46f7..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.externaltools.internal.registry;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ExternalToolsMigrationMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.externaltools.internal.registry.launchConfigurations.ExternalToolsUIMessages";//$NON-NLS-1$
-
- public static String ExternalToolMigration_37;
- public static String ExternalToolMigration_38;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME,
- ExternalToolsMigrationMessages.class);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties b/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties
deleted file mode 100644
index 1e18e673e..000000000
--- a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolsMigrationMessages.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-ExternalToolMigration_37=An exception occurred accessing external tool\'s \"run in background\" attribute
-ExternalToolMigration_38=An exception occurred attempting to migrate external tool\'s \"run in background\" attribute
diff --git a/org.eclipse.core.variables/.classpath b/org.eclipse.core.variables/.classpath
deleted file mode 100644
index ce7393340..000000000
--- a/org.eclipse.core.variables/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.core.variables/.cvsignore b/org.eclipse.core.variables/.cvsignore
deleted file mode 100644
index 693869726..000000000
--- a/org.eclipse.core.variables/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-bin
-doc
diff --git a/org.eclipse.core.variables/.project b/org.eclipse.core.variables/.project
deleted file mode 100644
index 03df26fb2..000000000
--- a/org.eclipse.core.variables/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.variables</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <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.core.variables/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 05664ee2f..000000000
--- a/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,96 +0,0 @@
-#Thu Feb 26 08:16:51 CST 2009
-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.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.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-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=disabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-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=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-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.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-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=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-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.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-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.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-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
deleted file mode 100644
index 7eebeb8c9..000000000
--- a/org.eclipse.core.variables/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,17 +0,0 @@
-#Tue Jan 30 11:38:48 CST 2007
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.deprecated=1
-compilers.p.illegal-att-value=0
-compilers.p.missing-packages=0
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=1
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=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
deleted file mode 100644
index b4215c634..000000000
--- a/org.eclipse.core.variables/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,13 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.variables; singleton:=true
-Bundle-Version: 3.2.300.qualifier
-Bundle-Activator: org.eclipse.core.variables.VariablesPlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-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: J2SE-1.4
diff --git a/org.eclipse.core.variables/about.html b/org.eclipse.core.variables/about.html
deleted file mode 100644
index 460233046..000000000
--- a/org.eclipse.core.variables/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>June 2, 2006</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 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</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.core.variables/build.properties b/org.eclipse.core.variables/build.properties
deleted file mode 100644
index bcf8553e1..000000000
--- a/org.eclipse.core.variables/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- plugin.properties,\
- .,\
- about.html,\
- META-INF/
-source.. = src/
-src.includes = about.html,\
- schema/
diff --git a/org.eclipse.core.variables/plugin.properties b/org.eclipse.core.variables/plugin.properties
deleted file mode 100644
index 88108aaa6..000000000
--- a/org.eclipse.core.variables/plugin.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-pluginName=Core Variables
-providerName=Eclipse.org
-valueVariablesExtensionPointName=Value Variables
-dynamicVariablesExtensionPointName=Dynamic Variables
-eclipse_home.description=The location of the base installation for the running platform
diff --git a/org.eclipse.core.variables/plugin.xml b/org.eclipse.core.variables/plugin.xml
deleted file mode 100644
index 38ae46646..000000000
--- a/org.eclipse.core.variables/plugin.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?> <!--
- Copyright (c) 2005, 2006 IBM Corporation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- IBM Corporation - initial API and implementation
- -->
-
-<plugin>
-
- <extension-point id="valueVariables" name="%valueVariablesExtensionPointName" schema="schema/valueVariables.exsd"/>
- <extension-point id="dynamicVariables" name="%dynamicVariablesExtensionPointName" schema="schema/dynamicVariables.exsd"/>
- <extension
- point="org.eclipse.core.variables.dynamicVariables">
- <variable
- description="%eclipse_home.description"
- name="eclipse_home"
- resolver="org.eclipse.core.internal.variables.EclipseHomeVariableResolver"
- supportsArgument="false"/>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.core.variables/schema/dynamicVariables.exsd b/org.eclipse.core.variables/schema/dynamicVariables.exsd
deleted file mode 100644
index 5168a891f..000000000
--- a/org.eclipse.core.variables/schema/dynamicVariables.exsd
+++ /dev/null
@@ -1,130 +0,0 @@
-<?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;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.core.variables/schema/valueVariables.exsd b/org.eclipse.core.variables/schema/valueVariables.exsd
deleted file mode 100644
index 7dd314c57..000000000
--- a/org.eclipse.core.variables/schema/valueVariables.exsd
+++ /dev/null
@@ -1,156 +0,0 @@
-<?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="valueVariables" name="Value Variables"/>
- </appInfo>
- <documentation>
- This extension point provides a mechanism for defining variables used for string substitution. A value variable has a static value.
- </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="readOnly" type="boolean">
- <annotation>
- <documentation>
- Specifies whether this variable is read only. When true, this variable&apos;s value will always be derived from the extension and cannot be edited by the user. When false, this variable&apos;s value will be initialized from any &lt;code&gt;initialValue&lt;/code&gt; attribtue or initializer class, and can be modified by the user. Once a read-write variable is modified, it&apos;s value is persisted and overrides any value specified by an extension&apos;s &lt;code&gt;initialValue&lt;/code&gt; or initializer class. When unspecified, the value of this attribute is &lt;code&gt;false&lt;/code&gt;. This attribute was added in the 3.3 release.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="initialValue" type="string">
- <annotation>
- <documentation>
- specifies the initial value for this variable. When specified, an &lt;code&gt;initializerClass&lt;/code&gt; attribute must not be specified.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="initializerClass" type="string">
- <annotation>
- <documentation>
- specifies the fully qualified name of the Java class that implements &lt;code&gt;org.eclipse.core.variables.IValueVariableInitializer&lt;/code&gt;. When specified, an &lt;code&gt;initialValue&lt;/code&gt; attribute must not be specified.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.core.variables.IValueVariableInitializer"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- specifies a human-readable description of this variable.
- </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="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a value variable contribution with an initial value:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.core.variables.valueVariables&quot;&gt;
- &lt;variable
- name=&quot;FOO_HOME&quot;
- initialValue=&quot;/usr/local/foo&quot;&gt;
- &lt;/variable&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-
-In the example above, the specified variable is created with the initial value &quot;/usr/local/foo&quot;.
-
- The following is an example of a value variable contribution with an initializer class:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.core.variables.valueVariables&quot;&gt;
- &lt;variable
- name=&quot;FOO_HOME&quot;
- initializerClass=&quot;com.example.FooLocator&quot;&gt;
- &lt;/variable&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-
-In the example above, the variable FOO_HOME is created and the class &quot;com.example.FooLocator&quot; will be
-used to initialize the value the first time it&apos;s requested.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute &lt;b&gt;initializerClass&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.core.variables.IValueVariableInitializer&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003, 2006 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java
deleted file mode 100644
index f53bf67e1..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ContributedValueVariable.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.variables;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.variables.IValueVariable;
-import org.eclipse.core.variables.IValueVariableInitializer;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Implementation of a value variable.
- */
-public class ContributedValueVariable extends StringVariable implements IValueVariable {
-
- /**
- * Variable value or <code>null</code> if none
- */
- private String fValue;
-
- /**
- * Whether this variable's value has been initialized
- */
- private boolean fInitialized = false;
-
- /**
- * Whether this variable is read only. If true, users cannot change the value.
- */
- private boolean fReadOnly;
-
- /**
- * Constructs a new value variable with the given name, description, read only
- * property and associated configuration element. The value will be initialized
- * from the configuration element the first time getValue() is called.
- *
- * @param name variable name
- * @param description variable description or <code>null</code>
- * @param readOnly whether the variable should be a read only variable
- * @param configurationElement configuration element
- */
- public ContributedValueVariable(String name, String description, boolean readOnly, IConfigurationElement configurationElement) {
- super(name, description, configurationElement);
- fReadOnly = readOnly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#setValue(java.lang.String)
- */
- public void setValue(String value) {
- if (!isReadOnly() || !isInitialized()){
- fValue = value;
- setInitialized(true);
- StringVariableManager.getDefault().notifyChanged(this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#getValue()
- */
- public String getValue() {
- if (!isInitialized()) {
- initialize();
- }
- return fValue;
- }
-
- /**
- * Initialize this variable's value from the configuration element.
- */
- private void initialize() {
- if (getConfigurationElement() != null) {
- // check for a explicit value specified in plug-in XML
- String value = getConfigurationElement().getAttribute("initialValue"); //$NON-NLS-1$
- if (value == null) {
- // check for initializer
- String className = getConfigurationElement().getAttribute("initializerClass"); //$NON-NLS-1$
- if (className != null) {
- try {
- Object object = getConfigurationElement().createExecutableExtension("initializerClass"); //$NON-NLS-1$
- if (object instanceof IValueVariableInitializer) {
- IValueVariableInitializer initializer = (IValueVariableInitializer)object;
- initializer.initialize(this);
- } else {
- VariablesPlugin.logMessage(NLS.bind("Unable to initialize variable {0} - initializer must be an instance of IValueVariableInitializer.", new String[]{getName()}), null); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- VariablesPlugin.logMessage(NLS.bind("Unable to initialize variable {0}",new String[]{getName()}), e); //$NON-NLS-1$
- }
- }
- } else {
- setValue(value);
- }
- }
- setInitialized(true);
- }
-
- /**
- * Returns whether this variable has been initialized with a value by one of:
- * <ul>
- * <li><code>setValue(String)</code></li>
- * <li>its configuration element's <code>initialValue</code> attribute</li>
- * <li>its configuration element's initializer</li>
- * </ul>
- * @return whether this variable has been initialized with a value
- */
- protected boolean isInitialized() {
- return fInitialized;
- }
-
- /**
- * Sets whether this variable has been initialized with a value.
- *
- * @param initialized whether this variable has been initialized
- */
- protected void setInitialized(boolean initialized) {
- fInitialized = initialized;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#isReadOnly()
- */
- public boolean isReadOnly() {
- return fReadOnly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#isContributed()
- */
- public boolean isContributed() {
- return getConfigurationElement() != null;
- }
-
-}
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
deleted file mode 100644
index f2d48d810..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/DynamicVariable.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.variables;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.IDynamicVariable;
-import org.eclipse.core.variables.IDynamicVariableResolver;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Dynamic variable
- */
-public class DynamicVariable extends StringVariable implements IDynamicVariable {
-
- /**
- * Resolver, or <code>null</code> until needed
- */
- private IDynamicVariableResolver fResolver;
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IContextVariable#getValue(java.lang.String)
- */
- public String getValue(String argument) throws CoreException {
- if (!supportsArgument()) {
- // check for an argument - not supported
- if (argument != null && argument.length() > 0) {
- throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.DynamicVariable_0, new String[]{argument, getName()}), null));
- }
- }
- if (fResolver == null) {
- String name = getConfigurationElement().getAttribute("resolver"); //$NON-NLS-1$
- if (name == null) {
- throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind("Contributed context variable {0} must specify a resolver.",new String[]{getName()}), null)); //$NON-NLS-1$
- }
- Object object = getConfigurationElement().createExecutableExtension("resolver"); //$NON-NLS-1$
- if (object instanceof IDynamicVariableResolver) {
- fResolver = (IDynamicVariableResolver)object;
- } else {
- throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind("Contributed context variable resolver for {0} must be an instance of IContextVariableResolver.",new String[]{getName()}), null)); //$NON-NLS-1$
- }
- }
- return fResolver.resolveValue(this, argument);
- }
-
- /**
- * Constructs a new context variable.
- *
- * @param name variable name
- * @param description variable description or <code>null</code>
- * @param configurationElement configuration element
- */
- public DynamicVariable(String name, String description, IConfigurationElement configurationElement) {
- super(name, description, configurationElement);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IDynamicVariable#supportsArgument()
- */
- public boolean supportsArgument() {
- String arg = getConfigurationElement().getAttribute("supportsArgument"); //$NON-NLS-1$
- return arg == null || Boolean.valueOf(arg).booleanValue();
- }
-
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java
deleted file mode 100644
index ac5e100d8..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/EclipseHomeVariableResolver.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.variables;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.variables.IDynamicVariable;
-import org.eclipse.core.variables.IDynamicVariableResolver;
-import org.eclipse.osgi.service.datalocation.Location;
-
-/**
- * Resolver for ${eclipse_home}
- *
- * @since 3.2
- */
-public class EclipseHomeVariableResolver implements IDynamicVariableResolver {
-
- public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
- Location installLocation = Platform.getInstallLocation();
- if (installLocation != null) {
- URL url = installLocation.getURL();
- if (url != null) {
-
- // Try to convert the URL to an OS string, to be consistent with
- // how other variables, like ${workspace_loc} resolve. See
- // ResourceResolver.translateToValue(). [bugzilla 263535]
- String file = url.getFile();
- IPath path = Path.fromOSString(file);
- String osstr = path.toOSString();
- if (osstr.length() != 0) {
- return osstr;
- }
-
- if (file.length() != 0) {
- return file;
- }
- }
- }
- return null;
- }
-
-}
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
deleted file mode 100644
index 94bd5d7ea..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringSubstitutionEngine.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.variables;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.IDynamicVariable;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.IValueVariable;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Performs string substitution for context and value variables.
- */
-public class StringSubstitutionEngine {
-
- // delimiters
- private static final String VARIABLE_START = "${"; //$NON-NLS-1$
- private static final char VARIABLE_END = '}';
- private static final char VARIABLE_ARG = ':';
- // parsing states
- private static final int SCAN_FOR_START = 0;
- private static final int SCAN_FOR_END = 1;
-
- /**
- * Resulting string
- */
- private StringBuffer fResult;
-
- /**
- * Whether substitutions were performed
- */
- private boolean fSubs;
-
- /**
- * Stack of variables to resolve
- */
- private Stack fStack;
-
- class VariableReference {
-
- // the text inside the variable reference
- private StringBuffer fText;
-
- public VariableReference() {
- fText = new StringBuffer();
- }
-
- public void append(String text) {
- fText.append(text);
- }
-
- public String getText() {
- return fText.toString();
- }
-
- }
-
- /**
- * Performs recursive string substitution and returns the resulting string.
- *
- * @param expression expression to resolve
- * @param reportUndefinedVariables whether to report undefined variables as an error
- * @param manager registry of variables
- * @return the resulting string with all variables recursively
- * substituted
- * @exception CoreException if unable to resolve a referenced variable or if a cycle exists
- * in referenced variables
- */
- public String performStringSubstitution(String expression, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException {
- substitute(expression, reportUndefinedVariables, resolveVariables, manager);
- List resolvedVariableSets = new ArrayList();
- while (fSubs) {
- HashSet resolved = substitute(fResult.toString(), reportUndefinedVariables, true, manager);
-
- for(int i=resolvedVariableSets.size()-1; i>=0; i--) {
-
- HashSet prevSet = (HashSet)resolvedVariableSets.get(i);
-
- if (prevSet.equals(resolved)) {
- HashSet conflictingSet = new HashSet();
- for (; i<resolvedVariableSets.size(); i++)
- conflictingSet.addAll((HashSet)resolvedVariableSets.get(i));
-
- StringBuffer problemVariableList = new StringBuffer();
- for (Iterator it=conflictingSet.iterator(); it.hasNext(); ) {
- problemVariableList.append(it.next().toString());
- problemVariableList.append(", "); //$NON-NLS-1$
- }
- problemVariableList.setLength(problemVariableList.length()-2); //truncate the last ", "
- throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.REFERENCE_CYCLE_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{problemVariableList.toString()}), null));
- }
- }
-
- resolvedVariableSets.add(resolved);
- }
- return fResult.toString();
- }
-
- /**
- * Performs recursive string validation to ensure that all of the variables
- * contained in the expression exist
- * @param expression expression to validate
- * @param manager registry of variables
- * @exception CoreException if a referenced variable does not exist or if a cycle exists
- * in referenced variables
- */
- public void validateStringVariables(String expression, IStringVariableManager manager) throws CoreException {
- performStringSubstitution(expression, true, false, manager);
- }
-
- /**
- * Makes a substitution pass of the given expression returns a Set of the variables that were resolved in this
- * pass
- *
- * @param expression source expression
- * @param reportUndefinedVariables whether to report undefined variables as an error
- * @param resolveVariables whether to resolve the value of any variables
- * @exception CoreException if unable to resolve a variable
- */
- private HashSet substitute(String expression, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException {
- fResult = new StringBuffer(expression.length());
- fStack = new Stack();
- fSubs = false;
-
- HashSet resolvedVariables = new HashSet();
-
- int pos = 0;
- int state = SCAN_FOR_START;
- while (pos < expression.length()) {
- switch (state) {
- case SCAN_FOR_START:
- int start = expression.indexOf(VARIABLE_START, pos);
- if (start >= 0) {
- int length = start - pos;
- // copy non-variable text to the result
- if (length > 0) {
- fResult.append(expression.substring(pos, start));
- }
- pos = start + 2;
- state = SCAN_FOR_END;
-
- fStack.push(new VariableReference());
- } else {
- // done - no more variables
- fResult.append(expression.substring(pos));
- pos = expression.length();
- }
- break;
- case SCAN_FOR_END:
- // be careful of nested variables
- start = expression.indexOf(VARIABLE_START, pos);
- int end = expression.indexOf(VARIABLE_END, pos);
- if (end < 0) {
- // variables are not completed
- VariableReference tos = (VariableReference)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 = (VariableReference)fStack.peek();
- tos.append(expression.substring(pos, start));
- }
- pos = start + 2;
- fStack.push(new VariableReference());
- } else {
- // end of variable reference
- VariableReference tos = (VariableReference)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 = (VariableReference)fStack.peek();
- tos.append(value);
- }
- }
- }
- break;
- }
- }
- // process incomplete variable references
- while (!fStack.isEmpty()) {
- VariableReference tos = (VariableReference)fStack.pop();
- if (fStack.isEmpty()) {
- fResult.append(VARIABLE_START);
- fResult.append(tos.getText());
- } else {
- VariableReference var = (VariableReference)fStack.peek();
- var.append(VARIABLE_START);
- var.append(tos.getText());
- }
- }
-
-
- return resolvedVariables;
- }
-
- /**
- * Resolve and return the value of the given variable reference,
- * possibly <code>null</code>.
- *
- * @param var
- * @param reportUndefinedVariables whether to report undefined variables as
- * an error
- * @param resolveVariables whether to resolve the variables value or just to validate that this variable is valid
- * @param manager variable registry
- * @return variable value, possibly <code>null</code>
- * @exception CoreException if unable to resolve a value
- */
- private String resolve(VariableReference var, boolean reportUndefinedVariables, boolean resolveVariables, IStringVariableManager manager) throws CoreException {
- String text = var.getText();
- int pos = text.indexOf(VARIABLE_ARG);
- String name = null;
- String arg = null;
- if (pos > 0) {
- name = text.substring(0, pos);
- pos++;
- if (pos < text.length()) {
- arg = text.substring(pos);
- }
- } else {
- name = text;
- }
- IValueVariable valueVariable = manager.getValueVariable(name);
- if (valueVariable == null) {
- IDynamicVariable dynamicVariable = manager.getDynamicVariable(name);
- if (dynamicVariable == null) {
- // no variables with the given name
- if (reportUndefinedVariables) {
- throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_3, new String[]{name}), null));
- }
- // leave as is
- return getOriginalVarText(var);
- }
-
- if (resolveVariables) {
- fSubs = true;
- return dynamicVariable.getValue(arg);
- }
- //leave as is
- return getOriginalVarText(var);
- }
-
- if (arg == null) {
- if (resolveVariables) {
- fSubs = true;
- return valueVariable.getValue();
- }
- //leave as is
- return getOriginalVarText(var);
- }
- // error - an argument specified for a value variable
- throw new CoreException(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, NLS.bind(VariablesMessages.StringSubstitutionEngine_4, new String[]{valueVariable.getName()}), null));
- }
-
- private String getOriginalVarText(VariableReference var) {
- StringBuffer res = new StringBuffer(var.getText());
- res.insert(0, VARIABLE_START);
- res.append(VARIABLE_END);
- return res.toString();
- }
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java
deleted file mode 100644
index 498b411b5..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariable.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.variables;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.variables.IStringVariable;
-
-/**
- * Common implementation of context and value variables
- */
-public abstract class StringVariable implements IStringVariable {
-
- /**
- * Variable name
- */
- private String fName;
-
- /**
- * Variable description, or <code>null</code>
- */
- private String fDescription;
-
- /**
- * Configuration element associated with this variable, or <code>null</code>
- */
- private IConfigurationElement fConfigurationElement;
-
- /**
- * Constructs a new variable with the given name, description and configuration element.
- *
- * @param name variable name
- * @param description variable description, or <code>null</code>
- * @param configurationElement configuration element or <code>null</code>
- */
- public StringVariable(String name, String description, IConfigurationElement configurationElement) {
- fName = name;
- fDescription = description;
- fConfigurationElement = configurationElement;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariable#getName()
- */
- public String getName() {
- return fName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariable#getDescription()
- */
- public String getDescription() {
- return fDescription;
- }
-
- /**
- * Returns the configuration element associated with this variable, or <code>null</code>
- * if none.
- *
- * @return configuration element or <code>null</code>
- */
- protected IConfigurationElement getConfigurationElement() {
- return fConfigurationElement;
- }
-
- /**
- * @see IValueVariable#setDescription(String)
- * @param description
- */
- public void setDescription(String description) {
- fDescription = description;
- }
-
-}
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
deleted file mode 100644
index e015008bd..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/StringVariableManager.java
+++ /dev/null
@@ -1,607 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Stefan Liebig - Bug 242685 StringVariableManager - Variable contributions may silently override existing variables
- *******************************************************************************/
-package org.eclipse.core.internal.variables;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
-import org.eclipse.core.variables.IDynamicVariable;
-import org.eclipse.core.variables.IStringVariable;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.IValueVariable;
-import org.eclipse.core.variables.IValueVariableListener;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.service.prefs.BackingStoreException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Singleton string variable manager.
- */
-public class StringVariableManager implements IStringVariableManager, IPreferenceChangeListener {
-
- /**
- * Dynamic variables - maps variable names to variables.
- */
- private Map fDynamicVariables;
-
- /**
- * Value variables - maps variable names to variables.
- */
- private Map fValueVariables;
-
- /**
- * Variable listeners
- */
- private ListenerList fListeners;
-
- // notifications
- private static final int ADDED = 0;
- private static final int CHANGED = 1;
- private static final int REMOVED = 2;
-
- /**
- * Singleton variable manager.
- */
- private static StringVariableManager fgManager;
-
- // true during internal updates indicates that change notification
- // should be suppressed/ignored.
- private boolean fInternalChange = false;
-
- // Variable extension point constants
- private static final String ATTR_NAME= "name"; //$NON-NLS-1$
- private static final String ATTR_DESCRIPTION="description"; //$NON-NLS-1$
- private static final String ATTR_READ_ONLY="readOnly"; //$NON-NLS-1$
- // Persisted variable XML constants
- private static final String VALUE_VARIABLES_TAG= "valueVariables"; //$NON-NLS-1$
- private static final String VALUE_VARIABLE_TAG= "valueVariable"; //$NON-NLS-1$
- private static final String NAME_TAG= "name"; //$NON-NLS-1$
- private static final String VALUE_TAG= "value"; //$NON-NLS-1$
- private static final String DESCRIPTION_TAG="description"; //$NON-NLS-1$
- private static final String READ_ONLY_TAG="readOnly"; //$NON-NLS-1$
- // XML values
- private static final String TRUE_VALUE= "true"; //$NON-NLS-1$
- private static final String FALSE_VALUE= "false"; //$NON-NLS-1$
- // preference store key for value variables
- private static final String PREF_VALUE_VARIABLES= VariablesPlugin.getUniqueIdentifier() + ".valueVariables"; //$NON-NLS-1$
-
- /**
- * Notifies a string variable listener in a safe runnable to handle
- * exceptions.
- */
- class StringVariableNotifier implements ISafeRunnable {
-
- private IValueVariableListener fListener;
- private int fType;
- private IValueVariable[] fVariables;
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
- */
- public void handleException(Throwable exception) {
- IStatus status = new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), VariablesPlugin.INTERNAL_ERROR, "An exception occurred during string variable change notification", exception); //$NON-NLS-1$
- VariablesPlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.variablesAdded(fVariables);
- break;
- case REMOVED:
- fListener.variablesRemoved(fVariables);
- break;
- case CHANGED:
- fListener.variablesChanged(fVariables);
- break;
- }
- }
-
- /**
- * Notifies the given listener of the add/change/remove
- *
- * @param listener the listener to notify
- * @param launch the launch that has changed
- * @param update the type of change
- */
- public void notify(IValueVariable[] variables, int update) {
- fVariables = variables;
- fType = update;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IValueVariableListener)copiedListeners[i];
- SafeRunner.run(this);
- }
- fVariables = null;
- fListener = null;
- // persist variables whenever there is an add/change/remove
- storeValueVariables();
- }
- }
-
- /**
- * Returns a new notifier.
- *
- * @return a new notifier
- */
- private StringVariableNotifier getNotifier() {
- return new StringVariableNotifier();
- }
-
- /**
- * Returns the default string variable manager
- *
- * @return string variable manager
- */
- public static StringVariableManager getDefault() {
- if (fgManager == null) {
- fgManager = new StringVariableManager();
- }
- return fgManager;
- }
-
- /**
- * Constructs a new string variable manager.
- */
- private StringVariableManager() {
- fListeners = new ListenerList();
- }
-
- /**
- * Load contributed variables and persisted variables
- */
- private synchronized void initialize() {
- if (fDynamicVariables == null) {
- fInternalChange = true;
- fDynamicVariables = new HashMap(5);
- fValueVariables = new HashMap(5);
- loadContributedValueVariables();
- loadPersistedValueVariables();
- loadDynamicVariables();
- new InstanceScope().getNode(VariablesPlugin.PI_CORE_VARIABLES).addPreferenceChangeListener(this);
- fInternalChange = false;
- }
- }
-
- /**
- * Loads contributed dynamic variables
- */
- 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];
- 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$
- continue;
- }
- String description= element.getAttribute(ATTR_DESCRIPTION);
- DynamicVariable variable= new DynamicVariable(name, description, element);
- Object old = fDynamicVariables.put(variable.getName(), variable);
- if (old != null) {
- 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);
- }
- }
- }
-
- /**
- * Loads contributed value variables. This is done before loading persisted values.
- */
- 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];
- 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$
- continue;
- }
- String description= element.getAttribute(ATTR_DESCRIPTION);
- boolean isReadOnly = TRUE_VALUE.equals(element.getAttribute(ATTR_READ_ONLY));
-
- IValueVariable variable = new ContributedValueVariable(name, description, isReadOnly, element);
- Object old = fValueVariables.put(name, variable);
- if (old != null) {
- 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);
- }
- }
- }
-
- /**
- * Loads persisted value variables from the preference store. This is done after
- * loading value variables from the extension point. If a persisted variable has the
- * same name as a extension contributed variable the variable's value will be set to
- * the persisted value unless either a) The persisted value is <code>null</code>, or
- * b) the variable is read-only.
- */
- private void loadPersistedValueVariables() {
- String variablesString = Platform.getPreferencesService().getString(VariablesPlugin.PI_CORE_VARIABLES, PREF_VALUE_VARIABLES, "", null); //$NON-NLS-1$
- if (variablesString.length() == 0) {
- return;
- }
- Element root= null;
- try {
- ByteArrayInputStream stream = new ByteArrayInputStream(variablesString.getBytes("UTF-8")); //$NON-NLS-1$
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- parser.setErrorHandler(new DefaultHandler());
- root = parser.parse(stream).getDocumentElement();
- } catch (Exception e) {
- VariablesPlugin.logMessage("An exception occurred while loading persisted value variables.", e); //$NON-NLS-1$
- return;
- }
- if (!root.getNodeName().equals(VALUE_VARIABLES_TAG)) {
- VariablesPlugin.logMessage("Invalid format encountered while loading persisted value variables.", null); //$NON-NLS-1$
- return;
- }
- NodeList list= root.getChildNodes();
- for (int i= 0, numItems= list.getLength(); i < numItems; i++) {
- Node node= list.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element= (Element) node;
- if (!element.getNodeName().equals(VALUE_VARIABLE_TAG)) {
- VariablesPlugin.logMessage(NLS.bind("Invalid XML element encountered while loading value variables: {0}", new String[] {node.getNodeName()}), null); //$NON-NLS-1$
- continue;
- }
- String name= element.getAttribute(NAME_TAG);
- if (name.length() > 0) {
- String value= element.getAttribute(VALUE_TAG);
- String description= element.getAttribute(DESCRIPTION_TAG);
- boolean readOnly= TRUE_VALUE.equals(element.getAttribute(READ_ONLY_TAG));
-
- IValueVariable existing = getValueVariable(name);
- if (existing == null){
- ValueVariable variable = new ValueVariable(name, description, readOnly, value);
- fValueVariables.put(name, variable);
- } else if (!existing.isReadOnly() && value != null){
- existing.setValue(value);
- }
- } else {
- VariablesPlugin.logMessage("Invalid variable entry encountered while loading value variables. Variable name is null.", null); //$NON-NLS-1$
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getVariables()
- */
- public synchronized IStringVariable[] getVariables() {
- initialize();
- List list = new ArrayList(fDynamicVariables.size() + fValueVariables.size());
- list.addAll(fDynamicVariables.values());
- list.addAll(fValueVariables.values());
- return (IStringVariable[]) list.toArray(new IStringVariable[list.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getValueVariables()
- */
- public synchronized IValueVariable[] getValueVariables() {
- initialize();
- return (IValueVariable[]) fValueVariables.values().toArray(new IValueVariable[fValueVariables.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getDynamicVariables()
- */
- public synchronized IDynamicVariable[] getDynamicVariables() {
- initialize();
- return (IDynamicVariable[]) fDynamicVariables.values().toArray(new IDynamicVariable[fDynamicVariables.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#performStringSubstitution(java.lang.String)
- */
- public String performStringSubstitution(String expression) throws CoreException {
- return performStringSubstitution(expression, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#newValueVariable(java.lang.String, java.lang.String)
- */
- public IValueVariable newValueVariable(String name, String description) {
- return newValueVariable(name, description, false, null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IStringVariableManager#newValueVariable(java.lang.String, java.lang.String, boolean, java.lang.String)
- */
- public IValueVariable newValueVariable(String name, String description, boolean readOnly, String value) {
- return new ValueVariable(name, description, readOnly, value);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#addVariables(org.eclipse.debug.internal.core.stringsubstitution.IValueVariable[])
- */
- 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];
- 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];
- fValueVariables.put(variable.getName(), variable);
- }
- IValueVariable[] copy = new IValueVariable[variables.length];
- System.arraycopy(variables, 0, copy, 0, variables.length);
- getNotifier().notify(copy, ADDED);
- return;
- }
- throw new CoreException(status);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#removeVariables(org.eclipse.debug.internal.core.stringsubstitution.IValueVariable[])
- */
- public synchronized void removeVariables(IValueVariable[] variables) {
- initialize();
- List removed = new ArrayList(variables.length);
- for (int i = 0; i < variables.length; i++) {
- IValueVariable variable = variables[i];
- if (fValueVariables.remove(variable.getName()) != null) {
- removed.add(variable);
- }
- }
- if (removed.size() > 0) {
- getNotifier().notify((IValueVariable[])removed.toArray(new IValueVariable[removed.size()]), REMOVED);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getDynamicVariable(java.lang.String)
- */
- public synchronized IDynamicVariable getDynamicVariable(String name) {
- initialize();
- return (IDynamicVariable) fDynamicVariables.get(name);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#getValueVariable(java.lang.String)
- */
- public synchronized IValueVariable getValueVariable(String name) {
- initialize();
- return (IValueVariable) fValueVariables.get(name);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#addValueVariableListener(org.eclipse.debug.internal.core.stringsubstitution.IValueVariableListener)
- */
- public void addValueVariableListener(IValueVariableListener listener) {
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#removeValueVariableListener(org.eclipse.debug.internal.core.stringsubstitution.IValueVariableListener)
- */
- public void removeValueVariableListener(IValueVariableListener listener) {
- fListeners.remove(listener);
- }
-
- /**
- * Returns a memento representing the value variables currently registered.
- *
- * @return memento representing the value variables currently registered
- * @throws IOException if an I/O exception occurs while creating the XML.
- */
- private String getValueVariablesAsXML() throws IOException, ParserConfigurationException, TransformerException {
- IValueVariable[] variables = getValueVariables();
-
- 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];
- if (!variable.isReadOnly()){
- // don't persist read-only variables or un-initialized contributed variables
- if (!variable.isContributed() || ((ContributedValueVariable)variable).isInitialized()) {
- Element element= document.createElement(VALUE_VARIABLE_TAG);
- element.setAttribute(NAME_TAG, variable.getName());
- String value= variable.getValue();
- if (value != null) {
- element.setAttribute(VALUE_TAG, value);
- }
- element.setAttribute(READ_ONLY_TAG, variable.isReadOnly() ? TRUE_VALUE : FALSE_VALUE);
- String description= variable.getDescription();
- if (description != null) {
- element.setAttribute(DESCRIPTION_TAG, description);
- }
- rootElement.appendChild(element);
- }
- }
- }
- return serializeDocument(document);
- }
-
- private Document getDocument() throws ParserConfigurationException {
- DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
- Document doc =docBuilder.newDocument();
- return doc;
- }
-
- /**
- * 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
- */
- private String serializeDocument(Document doc) throws TransformerException, UnsupportedEncodingException {
- ByteArrayOutputStream s= new ByteArrayOutputStream();
-
- TransformerFactory factory= TransformerFactory.newInstance();
- Transformer transformer= factory.newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
-
- DOMSource source= new DOMSource(doc);
- StreamResult outputTarget= new StreamResult(s);
- transformer.transform(source, outputTarget);
-
- return s.toString("UTF8"); //$NON-NLS-1$
- }
-
- /**
- * Saves the value variables currently registered in the
- * preference store.
- */
- private synchronized void storeValueVariables() {
- String variableString= ""; //$NON-NLS-1$
- if (!fValueVariables.isEmpty()) {
- try {
- variableString= getValueVariablesAsXML();
- } catch (IOException e) {
- VariablesPlugin.log(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), IStatus.ERROR, "An exception occurred while storing launch configuration variables.", e)); //$NON-NLS-1$
- return;
- } catch (ParserConfigurationException e) {
- VariablesPlugin.log(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), IStatus.ERROR, "An exception occurred while storing launch configuration variables.", e)); //$NON-NLS-1$
- return;
- } catch (TransformerException e) {
- VariablesPlugin.log(new Status(IStatus.ERROR, VariablesPlugin.getUniqueIdentifier(), IStatus.ERROR, "An exception occurred while storing launch configuration variables.", e)); //$NON-NLS-1$
- return;
- }
- }
- fInternalChange = true;
- try {
- IEclipsePreferences prefs = new InstanceScope().getNode(VariablesPlugin.PI_CORE_VARIABLES);
- prefs.put(PREF_VALUE_VARIABLES, variableString);
- prefs.flush();
- }
- catch(BackingStoreException bse) {
- VariablesPlugin.log(bse);
- }
- fInternalChange = false;
- }
-
- /**
- * Fire a change notification for the given variable.
- *
- * @param variable the variable that has changed
- */
- protected void notifyChanged(IValueVariable variable) {
- if (!fInternalChange) {
- IValueVariable existing = getValueVariable(variable.getName());
- if (variable.equals(existing)) {
- // do not do change notification for unregistered variables
- getNotifier().notify(new IValueVariable[]{variable}, CHANGED);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#generateVariableExpression(java.lang.String, java.lang.String)
- */
- public String generateVariableExpression(String varName, String arg) {
- StringBuffer buffer = new StringBuffer();
- buffer.append("${"); //$NON-NLS-1$
- buffer.append(varName);
- if (arg != null) {
- buffer.append(":"); //$NON-NLS-1$
- buffer.append(arg);
- }
- buffer.append("}"); //$NON-NLS-1$
- return buffer.toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.stringsubstitution.IStringVariableManager#performStringSubstitution(java.lang.String, boolean)
- */
- public String performStringSubstitution(String expression, boolean reportUndefinedVariables) throws CoreException {
- return new StringSubstitutionEngine().performStringSubstitution(expression, reportUndefinedVariables, true, this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IStringVariableManager#validateStringVariables(java.lang.String)
- */
- public void validateStringVariables(String expression) throws CoreException {
- new StringSubstitutionEngine().validateStringVariables(expression, this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IStringVariableManager#getContributingPluginId(org.eclipse.core.variables.IStringVariable)
- */
- public String getContributingPluginId(IStringVariable variable) {
- if (variable instanceof StringVariable) {
- return ((StringVariable) variable).getConfigurationElement().getContributor().getName();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
- */
- public void preferenceChange(PreferenceChangeEvent event) {
- if (PREF_VALUE_VARIABLES.equals(event.getKey())) {
- synchronized (this) {
- if (!fInternalChange) {
- fValueVariables.clear();
- loadPersistedValueVariables();
- loadContributedValueVariables();
- }
- }
- }
- }
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java
deleted file mode 100644
index 3bac3d076..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/ValueVariable.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.variables;
-
-import org.eclipse.core.variables.IValueVariable;
-
-/**
- * Implementation of a value variable.
- */
-public class ValueVariable extends StringVariable implements IValueVariable {
-
- /**
- * Variable value or <code>null</code> if none
- */
- private String fValue;
-
- /**
- * Whether this variable is read only. If true, users cannot change the value.
- */
- private boolean fReadOnly;
-
- /**
- * Constructs a new value variable with the given name, description, read only
- * property and string value. Value can be null.
- *
- * @param name variable name
- * @param description variable description or <code>null</code>
- * @param readOnly whether the variable should be a read only variable
- * @param value the initial value of the variable or <code>null</code>
- */
- public ValueVariable(String name, String description, boolean readOnly, String value) {
- super(name, description, null);
- fReadOnly = readOnly;
- fValue = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#setValue(java.lang.String)
- */
- public void setValue(String value) {
- if (!isReadOnly()){
- fValue = value;
- StringVariableManager.getDefault().notifyChanged(this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#getValue()
- */
- public String getValue() {
- return fValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#isReadOnly()
- */
- public boolean isReadOnly() {
- return fReadOnly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.variables.IValueVariable#isContributed()
- */
- public boolean isContributed() {
- return false;
- }
-
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.java b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.java
deleted file mode 100644
index d6afcfda2..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.internal.variables;
-
-import org.eclipse.osgi.util.NLS;
-
-public class VariablesMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.internal.variables.VariablesMessages";//$NON-NLS-1$
-
- public static String StringSubstitutionEngine_3;
- public static String StringSubstitutionEngine_4;
-
- public static String StringVariableManager_26;
- public static String StringVariableManager_27;
-
- public static String DynamicVariable_0;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, VariablesMessages.class);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties b/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties
deleted file mode 100644
index 945dbd36a..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/internal/variables/VariablesMessages.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-StringSubstitutionEngine_3=Reference to undefined variable {0}
-StringSubstitutionEngine_4=Variable {0} does not accept arguments
-
-StringVariableManager_26=Variables with the specified names are already registered.
-StringVariableManager_27=Variable named {0} already registered
-
-DynamicVariable_0=Unsupported argument {0} specified for variable {1}
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
deleted file mode 100644
index b81fff749..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariable.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.variables;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * A dynamic variable is a variable whose value is computed dynamically
- * by a resolver at the time a string substitution is performed. A dynamic
- * variable is contributed by an extension.
- * <p>
- * The following is a definition of a dynamic variable that resolves to the name of the selected resource:
- * <pre>
- * &lt;extension point="org.eclipse.core.variables.dynamicVariables"&gt;
- * &lt;variable
- * name="resource_name"
- * resolver="com.example.ResourceNameResolver"
- * description="The name of the selected resource"
- * supportsArgument="false"&gt;
- * &lt;/variable&gt;
- * &lt;/extension&gt;
- * </pre>
- * </p>
- * <p>
- * 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.
- */
-public interface IDynamicVariable extends IStringVariable {
-
- /**
- * Returns the value of this variable when referenced with the given
- * argument, possibly <code>null</code>.
- *
- * @param argument argument present in variable expression or <code>null</code>
- * if none
- * @return value of this variable when referenced with the given argument, possibly
- * <code>null</code>
- * @throws CoreException if unable to resolve a value for this variable
- */
- public String getValue(String argument) throws CoreException;
-
- /**
- * Returns whether this variable supports an argument, as specified
- * by this variable's extension definition in plug-in XML.
- *
- * @return whether this variable supports an argument
- */
- public boolean supportsArgument();
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariableResolver.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariableResolver.java
deleted file mode 100644
index b5cefaafb..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IDynamicVariableResolver.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.variables;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Resolves the value for a dynamic variable. A dynamic variable extension
- * contributes a resolver which must implement this interface.
- * <p>
- * Clients contributing a dynamic variable are intended to provide an implementation
- * of this interface.
- * </p>
- * @since 3.0
- */
-public interface IDynamicVariableResolver {
-
- /**
- * Resolves and returns a value for the specified variable when referenced
- * with the given argument, possibly <code>null</code>
- *
- * @param variable variable to resolve a value for
- * @param argument argument present in expression or <code>null</code> if none
- * @return variable value, possibly <code>null</code>
- * @throws CoreException if unable to resolve a value for the given variable
- */
- public String resolveValue(IDynamicVariable variable, String argument) throws CoreException;
-}
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
deleted file mode 100644
index 70c3e25f0..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariable.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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>
- * <p>
- * A variable is identified by its name, and optionally accepts an argument. When an
- * argument is present, a colon separates the variable name from its argument.
- * </p>
- * <p>
- * Variables can be contributed by extensions or programmatically. There are two
- * kinds of variables.
- * <ul>
- * <li><code>IValueVariable</code> - variables that have a value (with getter and setter), and
- * accept no arguments. The value of this type of variable is resolved at the time
- * its value is set via its setter API.</li>
- * <li><code>IDynamicVariable</code> - variables whose value is resolved at the time
- * a string substitution is performed by a contributed resolver. Dynamic variables
- * may accept an argument.</li>
- * </ul>
- * </p>
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IStringVariable {
-
- /**
- * Returns the name of this variable. A variable is uniquely identified by
- * its name.
- *
- * @return variable name
- */
- public String getName();
-
- /**
- * Returns a human readable description of this variable, possibly <code>null</code>
- *
- * @return a description of this variable, or <code>null</code> if none
- */
- public String getDescription();
-
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java
deleted file mode 100644
index e3502e99b..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IStringVariableManager.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.variables;
-
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Registry for string variables.
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IStringVariableManager {
-
- /**
- * Simple identifier constant (value <code>"dynamicVariables"</code>) for the
- * dynamic variables extension point.
- */
- public static final String EXTENSION_POINT_DYNAMIC_VARIABLES = "dynamicVariables"; //$NON-NLS-1$
-
- /**
- * Simple identifier constant (value <code>"valueVariables"</code>) for the
- * value variables extension point.
- */
- public static final String EXTENSION_POINT_VALUE_VARIABLES = "valueVariables"; //$NON-NLS-1$
-
- /**
- * Returns all registered variables.
- *
- * @return a collection of all registered variables
- */
- public IStringVariable[] getVariables();
-
- /**
- * Returns all registered value variables.
- *
- * @return a collection of all registered value variables
- */
- public IValueVariable[] getValueVariables();
-
- /**
- * Returns the value variable with the given name, or <code>null</code>
- * if none.
- *
- * @param name variable name
- * @return the value variable with the given name, or <code>null</code>
- * if none
- */
- public IValueVariable getValueVariable(String name);
-
- /**
- * Returns all registered dynamic variables.
- *
- * @return a collection of all registered dynamic variables
- */
- public IDynamicVariable[] getDynamicVariables();
-
- /**
- * Returns the dynamic variable with the given name or <code>null</code>
- * if none.
- *
- * @param name variable name
- * @return the dynamic variable with the given name or <code>null</code>
- * if none
- */
- public IDynamicVariable getDynamicVariable(String name);
-
- /**
- * Returns the plug-in identifier of the plug-in that contributed the
- * given variable via extension or <code>null</code> if the given
- * variable wasn't contributed via extension.
- *
- * @param variable the variable
- * @return the plug-in identifier of the plug-in that contributed the
- * given variable or <code>null</code>
- * @since 3.1
- */
- public String getContributingPluginId(IStringVariable variable);
-
- /**
- * Recursively resolves and replaces all variable references in the given
- * expression with their corresponding values. Reports errors for references
- * to undefined variables (equivalent to calling
- * <code>performStringSubstitution(expression, true)</code>).
- *
- * @param expression expression referencing variables
- * @return expression with variable references replaced with variable values
- * @throws CoreException if unable to resolve the value of one or more variables
- */
- public String performStringSubstitution(String expression) throws CoreException;
-
- /**
- * Recursively resolves and replaces all variable references in the given
- * expression with their corresponding values. Allows the client to control
- * whether references to undefined variables are reported as an error (i.e.
- * an exception is thrown).
- *
- * @param expression expression referencing variables
- * @param reportUndefinedVariables whether a reference to an undefined variable
- * is to be considered an error (i.e. throw an exception)
- * @return expression with variable references replaced with variable values
- * @throws CoreException if unable to resolve the value of one or more variables
- */
- public String performStringSubstitution(String expression, boolean reportUndefinedVariables) throws CoreException;
-
- /**
- * Validates variables references in the given expression and reports errors
- * for references to undefined variables.
- *
- * @param expression expression referencing variables
- * @throws CoreException if one or more referenced variables do not exist
- */
- public void validateStringVariables(String expression) throws CoreException;
-
- /**
- * Returns a new read-write value variable with the given name and description
- * with a <code>null</code> value.
- *
- * @param name variable name, cannot be <code>null</code>
- * @param description variable description, possibly <code>null</code>
- * @return a new value variable
- */
- public IValueVariable newValueVariable(String name, String description);
-
- /**
- * Returns a new value variable with the given properties.
- *
- * @param name variable name, cannot be <code>null</code>
- * @param description variable description, possibly <code>null</code>
- * @param readOnly whether this variable is to be a read only variable
- * @param value the string value to initialize this variable to - should
- * not be <code>null</code> for read-only variables
- * @return a new value variable
- * @since 3.3
- */
- public IValueVariable newValueVariable(String name, String description, boolean readOnly, String value);
-
- /**
- * Adds the given variables to the variable registry.
- *
- * @param variables the variables to add
- * @throws CoreException if one or more variables to add has a name collision with
- * an existing variable
- */
- public void addVariables(IValueVariable[] variables) throws CoreException;
-
- /**
- * Removes the given variables from the registry. Has no effect for unregistered
- * variables.
- *
- * @param variables variables to remove
- */
- public void removeVariables(IValueVariable[] variables);
-
- /**
- * Registers the given listener for value variable notifications. Has no effect
- * if an identical listener is already registered.
- *
- * @param listener value variable listener to add
- */
- public void addValueVariableListener(IValueVariableListener listener);
-
- /**
- * Removes the given listener from the list of registered value variable
- * listeners. Has no effect if an identical listener is not already registered.
- *
- * @param listener value variable listener to remove
- */
- public void removeValueVariableListener(IValueVariableListener listener);
-
- /**
- * Convenience method that returns an expression referencing the given
- * variable and optional argument. For example, calling the method with
- * a <code>varName</code> of <code>my_var</code> and an <code>argument</code>
- * of <code>my_arg</code> results in the string <code>$(my_var:my_arg}</code>.
- *
- * @param varName variable name
- * @param arg argument text or <code>null</code>
- * @return an expression referencing the given variable and
- * optional argument
- */
- public String generateVariableExpression(String varName, String arg);
-
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariable.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariable.java
deleted file mode 100644
index 4b25138d0..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariable.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.variables;
-
-/**
- * A variable with a value that can be set and retrieved. The context in which
- * a value variable is referenced does not effect the value of the variable.
- * A value variable can be contributed by an extension or created programmatically.
- * A contributor may optionally specify an initial value for a variable, or
- * provide a delegate that will initialize the variable with a value.
- * <p>
- * Since 3.3, a variable can be specified as a "read only" preventing users from changing
- * the value after it has been initialized. Furthermore, a read only variable that is
- * contributed by an extension will always load the value from the extension.
- * </p>
- * <p>
- * Example of a value variable contribution with an initial value, the specified
- * variable is created with the initial value "/usr/local/foo".
- * <pre>
- * &lt;extension point="org.eclipse.core.variables.valueVariables"&gt;
- * &lt;variable
- * name="FOO_HOME"
- * initialValue="/usr/local/foo"&gt;
- * &lt;/variable&gt;
- * &lt;/extension&gt;
- * </pre>
- * </p>
- * <p>
- * Example of a value variable contribution with an initializer class, the class
- * "com.example.FooLocator" will be used to initialize the value the first time
- * it's requested.
- * <pre>
- * &lt;extension point="org.eclipse.core.variables.valueVariables"&gt;
- * &lt;variable
- * name="FOO_HOME"
- * initializerClass="com.example.FooLocator"&gt;
- * &lt;/variable&gt;
- * &lt;/extension&gt;
- * </pre>
- * </p>
- * @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IValueVariable extends IStringVariable {
-
- /**
- * Sets the value of this variable to the given value.
- * Since 3.3, this has no effect if this variable is read only.
- *
- * @param value variable value
- */
- public void setValue(String value);
-
- /**
- * Returns the value of this variable, or <code>null</code> if none.
- *
- * @return the value of this variable, or <code>null</code> if none
- */
- public String getValue();
-
- /**
- * Returns whether this variable was contributed by an extension.
- *
- * @return whether this variable was contributed by an extension
- */
- public boolean isContributed();
-
- /**
- * Returns whether this variable is read only.
- *
- * @return whether this variable is read only
- * @since 3.3
- */
- public boolean isReadOnly();
-
- /**
- * Sets the description of this variable to the given value.
- *
- * @param description variable description, possibly <code>null</code>
- */
- public void setDescription(String description);
-
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableInitializer.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableInitializer.java
deleted file mode 100644
index 035a907db..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableInitializer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.variables;
-
-/**
- * Value variable initializers compute an initial value for a value
- * variable contributed by an extension, which is not defined with an initial
- * value. This provides a mechanism for programmatically computing the initial
- * value of a value variable.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.0
- */
-public interface IValueVariableInitializer {
- /**
- * Initializes the specified variable.
- *
- * @param variable variable to initialize
- */
- public void initialize(IValueVariable variable);
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableListener.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableListener.java
deleted file mode 100644
index 37dac25df..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/IValueVariableListener.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.variables;
-
-/**
- * A string variable listener is notified of variables as they are added
- * and removed from the string variable manager. As well, listeners are
- * notified when a value variable changes value.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.0
- */
-public interface IValueVariableListener {
-
- /**
- * Notification the given variables have been added to the variable
- * manager.
- *
- * @param variables added variables
- */
- public void variablesAdded(IValueVariable[] variables);
-
- /**
- * Notification the given variables have been removed from the variable
- * manager.
- *
- * @param variables removed variables
- */
- public void variablesRemoved(IValueVariable[] variables);
-
- /**
- * Notification the given variables have been changed value.
- *
- * @param variables changed variables
- */
- public void variablesChanged(IValueVariable[] variables);
-
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java b/org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java
deleted file mode 100644
index 4fa1b74a5..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/VariablesPlugin.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.core.variables;
-
-import org.eclipse.core.internal.variables.StringVariableManager;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-
-/**
- * The plug-in runtime class for the Core Variables plug-in.
- * @since 3.0
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class VariablesPlugin extends Plugin {
-
- /**
- * Status code indicating an unexpected internal error.
- */
- public static final int INTERNAL_ERROR = 120;
-
- /**
- * Status code indicating a variable reference cycle error.
- */
- public static final int REFERENCE_CYCLE_ERROR = 130;
-
- /**
- * The single instance of this plug-in runtime class.
- */
- private static VariablesPlugin plugin;
-
- /**
- * Unique identifier constant (value <code>"org.eclipse.core.variables"</code>)
- * for the Core Variables plug-in.
- */
- public static final String PI_CORE_VARIABLES = "org.eclipse.core.variables"; //$NON-NLS-1$
-
-
- /**
- * Constructs an instance of this plug-in runtime class.
- * <p>
- * An instance of this plug-in runtime class is automatically created
- * when the facilities provided by the Variables plug-in are required.
- * <b>Clients must never explicitly instantiate a plug-in runtime class.</b>
- * </p>
- */
- public VariablesPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * Returns this plug-in instance.
- *
- * @return the single instance of this plug-in runtime class
- */
- public static VariablesPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Logs the specified throwable with this plug-in's log.
- *
- * @param t throwable to log
- */
- public static void log(Throwable t) {
- log(new Status(IStatus.ERROR, PI_CORE_VARIABLES, INTERNAL_ERROR, "Error logged from Core Variables: ", t)); //$NON-NLS-1$
- }
-
- /**
- * Logs the given message with this plug-in's log and the given
- * throwable or <code>null</code> if none.
- * @param message the message to log
- * @param throwable the exception that occurred or <code>null</code> if none
- */
- public static void logMessage(String message, Throwable throwable) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), INTERNAL_ERROR, message, throwable));
- }
-
- /**
- * Logs the specified status with this plug-in's log.
- *
- * @param status status to log
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Convenience method which returns the unique identifier of this plug-in.
- */
- public static String getUniqueIdentifier() {
- return PI_CORE_VARIABLES;
- }
-
- /**
- * Returns the string variable manager.
- *
- * @return the string variable manager
- */
- public IStringVariableManager getStringVariableManager() {
- return StringVariableManager.getDefault();
- }
-}
diff --git a/org.eclipse.core.variables/src/org/eclipse/core/variables/package.html b/org.eclipse.core.variables/src/org/eclipse/core/variables/package.html
deleted file mode 100644
index 0d27de0b3..000000000
--- a/org.eclipse.core.variables/src/org/eclipse/core/variables/package.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Eclipse Debug Platform</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<p>Provides support for defining and contributing variables for the purpose of
- string substitution.</p>
-
-<h2>Package Specification</h2>
-
-<p>This package provides classes and interfaces to support the definition and
- contribution of variables for the purpose of string substitution. The plug-in
- supports the recursive replacement of variables referenced by name in arbitrary
- strings with the value of the variable. Two types of variables are provided
- - value variables (<code>IValueVariable</code>) and dynamic variables (<code>IDynamicVariable</code>).
- A value variable has a simple setter and getter for its current value. A dynamic
- variable has an associated resolver that provides a variable's value each time
- it is referenced (replaced) in a string substitution. A dynamic variable may
- also provide an argument in its reference that can be used by its resolver to
- determine its substitution value.</p>
-<p>A variable manager (<code>IStringVariableManager</code>) is provided to manage
- the set of defined variables. Value variables may be created via API on the
- variable manager, or contributed via the <code>valueVariables</code> extension
- point. Dynamic variables must be contributed via the <code>dynamicVariables</code>
- extension point. The variable manager also provides change notification for
- value variables. The variable manager also provides an API for performing string
- substitution, which accepts a string, and returns a string with all variable
- references replaced by associated variable values.</p>
-<p>Variables are referenced in strings by enclosing them in braces, preceded with
- a dollar sign. For example, consider a variable defined with the name <code>foo</code>,
- and referenced in the following string: <code>&quot;abc${foo}ghi&quot;</code>.
- If the value of <code>foo</code> is <code>&quot;def&quot;</code>, the result
- of a string substitution would be <code>&quot;abcdefghi&quot;</code>. In the
- case of a dynamic variable, an (optional) argument is supplied by appending
- a colon and argument value after the variable name. For example <code>&quot;${foo:bar}&quot;</code>.
- In this case, the resolver associated with <code>foo</code> would be provided
- with the referenced argument (<code>bar</code>) when asked to resolve a value
- for the variable <code>foo</code>. </p>
-</body>
-</html>
diff --git a/org.eclipse.debug.examples.core/.classpath b/org.eclipse.debug.examples.core/.classpath
deleted file mode 100644
index 9f8cf0e63..000000000
--- a/org.eclipse.debug.examples.core/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src_ant"/>
- <classpathentry kind="src" path="pdavm/src"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.debug.examples.core/.cvsignore b/org.eclipse.debug.examples.core/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/org.eclipse.debug.examples.core/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/org.eclipse.debug.examples.core/.project b/org.eclipse.debug.examples.core/.project
deleted file mode 100644
index b1f1fe3ee..000000000
--- a/org.eclipse.debug.examples.core/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.debug.examples.core</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.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.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index d6de6c150..000000000
--- a/org.eclipse.debug.examples.core/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,47 +0,0 @@
-#Mon Jan 24 20:23:34 CST 2005
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-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.problem.assertIdentifier=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.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-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.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-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.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
deleted file mode 100644
index 7e1ec2ad8..000000000
--- a/org.eclipse.debug.examples.core/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Example Debug Core Plug-in
-Bundle-SymbolicName: org.eclipse.debug.examples.core;singleton:=true
-Bundle-Version: 1.2.0
-Bundle-Activator: org.eclipse.debug.examples.core.pda.DebugCorePlugin
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.core.variables,
- org.eclipse.debug.core,
- org.apache.ant;bundle-version="1.7.0";resolution:=optional
-Eclipse-LazyStart: true
-Export-Package: org.eclipse.debug.examples.core.midi.launcher,
- org.eclipse.debug.examples.core.pda,
- org.eclipse.debug.examples.core.pda.breakpoints,
- org.eclipse.debug.examples.core.pda.launcher,
- org.eclipse.debug.examples.core.pda.model,
- org.eclipse.debug.examples.core.pda.protocol,
- org.eclipse.debug.examples.core.pda.sourcelookup
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.debug.examples.core/about.html b/org.eclipse.debug.examples.core/about.html
deleted file mode 100644
index 460233046..000000000
--- a/org.eclipse.debug.examples.core/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>June 2, 2006</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 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</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.examples.core/build.properties b/org.eclipse.debug.examples.core/build.properties
deleted file mode 100644
index f50444bad..000000000
--- a/org.eclipse.debug.examples.core/build.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
- pdavm/,\
- META-INF/,\
- about.html,\
- .,\
- readme.html,\
- samples/
-src.includes = about.html,\
- src/
diff --git a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java b/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
deleted file mode 100644
index e140e1085..000000000
--- a/org.eclipse.debug.examples.core/pdavm/src/org/eclipse/debug/examples/pdavm/PDAVirtualMachine.java
+++ /dev/null
@@ -1,1427 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.pdavm;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.StringWriter;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Push Down Automata interpreter.
- *
- * @since 3.5
- */
-public class PDAVirtualMachine {
-
- static class Stack extends LinkedList {
- private static final long serialVersionUID = 1L;
-
- public Object pop() {
- return isEmpty() ? new Integer(0) : remove(size() - 1);
- }
-
- public void push(Object value) {
- add(value);
- }
- }
-
- static class Register {
- Register(String name) {
- fName = name;
- }
- String fName;
- String fGroup = "<no_group>";
- boolean fIsWriteable = true;
- Map fBitFields = new LinkedHashMap(0);
- int fValue;
- }
-
- static class BitField {
- BitField(String name) {
- fName = name;
- }
- String fName;
- int fBitOffset;
- int fBitCount;
- Map fMnemonics = new LinkedHashMap(0);
- }
-
- Map fRegisters = new LinkedHashMap(0);
-
- class Args {
- final String[] fArgs;
-
- int next = 0;
-
- Args(String[] args) {
- fArgs = args;
- }
-
- boolean hasNextArg() {
- return fArgs.length > next;
- }
-
- String getNextStringArg() {
- if (fArgs.length > next) {
- return fArgs[next++];
- }
- return "";
- }
-
- int getNextIntArg() {
- String arg = getNextStringArg();
- try {
- return Integer.parseInt(arg);
- } catch (NumberFormatException e) {
- }
- return 0;
- }
-
- boolean getNextBooleanArg() {
- String arg = getNextStringArg();
- try {
- return Boolean.getBoolean(arg);
- } catch (NumberFormatException e) {
- }
- return false;
- }
-
- Object getNextIntOrStringArg() {
- String arg = getNextStringArg();
- try {
- return new Integer(arg);
- } catch (NumberFormatException e) {
- }
- return arg;
- }
-
- PDAThread getThreadArg() {
- int id = getNextIntArg();
- return (PDAThread)fThreads.get( new Integer(id) );
- }
- }
-
- class PDAThread {
- final int fID;
-
- /** The push down automata data stack (the data stack). */
- final Stack fStack = new Stack();
-
- /**
- * PDAThread copy of the code. It can differ from the program if
- * performing an evaluation.
- */
- String[] fThreadCode;
-
- /** PDAThread copy of the labels. */
- Map fThreadLabels;
-
- /** The stack of stack frames (the control stack) */
- final List fFrames = new LinkedList();
-
- /** Current stack frame (not includced in fFrames) */
- Frame fCurrentFrame;
-
- /**
- * The run flag is true if the thread is running. If the run flag is
- * false, the thread exits the next time the main instruction loop runs.
- */
- boolean fRun = true;
-
- String fSuspend = null;
-
- boolean fStep = false;
-
- boolean fStepReturn = false;
-
- int fSavedPC;
-
- boolean fPerformingEval = false;
-
- PDAThread(int id, String function, int pc) {
- fID = id;
- fCurrentFrame = new Frame(function, pc);
- fThreadCode = fCode;
- fThreadLabels = fLabels;
- }
- }
-
- final Map fThreads = new LinkedHashMap();
-
- int fNextThreadId = 1;
-
- boolean fStarted = true;
- /**
- * The code is stored as an array of strings, each line of the source file
- * being one entry in the array.
- */
- final String[] fCode;
-
- /** A mapping of labels to indicies in the code array */
- final Map fLabels;
-
- /** Each stack frame is a mapping of variable names to values. */
- class Frame {
- final Map fLocalVariables = new LinkedHashMap();
-
- /**
- * The name of the function in this frame
- */
- final String fFunction;
-
- /**
- * The current program counter in the frame the pc points to the next
- * instruction to be executed
- */
- int fPC;
-
- Frame(String function, int pc) {
- fFunction = function;
- fPC = pc;
- }
-
- void set(String name, Object value) {
- if (name.startsWith("$")) {
- setRegisterValue(name, value);
- } else {
- fLocalVariables.put(name, value);
- }
- }
-
- Object get(String name) {
- if (name.startsWith("$")) {
- return getRegisterValue(name);
- } else {
- return fLocalVariables.get(name);
- }
- }
- }
-
- void setRegisterValue(String name, Object value) {
- Register reg = (Register)fRegisters.get(getRegisterPartOfName(name));
- if (reg == null) return;
- String bitFieldName = getBitFieldPartOfName(name);
- if (bitFieldName != null) {
- BitField bitField = (BitField)reg.fBitFields.get(bitFieldName);
- if (bitField == null) return;
- Integer intValue = null;
- if (value instanceof Integer) {
- intValue = (Integer)value;
- } else if (value instanceof String) {
- intValue = (Integer)bitField.fMnemonics.get(value);
- }
- if (intValue != null) {
- int bitFieldMask = 2^(bitField.fBitCount - 1);
- int registerMask = ~(bitFieldMask << bitField.fBitOffset);
- int bitFieldValue = intValue.intValue() & bitFieldMask;
- reg.fValue = (reg.fValue & registerMask) | (bitFieldValue << bitField.fBitOffset);
- }
- } else if (value instanceof Integer) {
- reg.fValue = ((Integer)value).intValue();
- }
- }
-
- Object getRegisterValue(String name) {
- Register reg = (Register)fRegisters.get(getRegisterPartOfName(name));
- if (reg == null) return null;
- String bitFieldName = getBitFieldPartOfName(name);
- if (bitFieldName != null) {
- BitField bitField = (BitField)reg.fBitFields.get(bitFieldName);
- if (bitField == null) return null;
- int bitFieldMask = 2^(bitField.fBitCount - 1);
- int registerMask = bitFieldMask << bitField.fBitOffset;
- return new Integer( (reg.fValue & registerMask) >> bitField.fBitOffset );
- } else {
- return new Integer(reg.fValue);
- }
- }
-
- /**
- * Breakpoints are stored per each each line of code. The boolean indicates
- * whether the whole VM should suspend or just the triggering thread.
- */
- final Map fBreakpoints = new HashMap();
-
- /**
- * The suspend flag is true if the VM should suspend running the program and
- * just listen for debug commands.
- */
- String fSuspendVM;
-
- /** Flag indicating whether the debugger is performing a step. */
- boolean fStepVM = false;
-
- /** Flag indicating whether the debugger is performing a step return */
- boolean fStepReturnVM = false;
-
- int fSteppingThread = 0;
-
- /** Name of the pda program being debugged */
- final String fFilename;
-
- /** The command line argument to start a debug session. */
- final boolean fDebug;
-
- /** The port to listen for debug commands on */
- final int fCommandPort;
-
- /**
- * Command socket for receiving debug commands and sending command responses
- */
- Socket fCommandSocket;
-
- /** Command socket reader */
- BufferedReader fCommandReceiveStream;
-
- /** Command socket write stream. */
- OutputStream fCommandResponseStream;
-
- /** The port to send debug events to */
- final int fEventPort;
-
- /** Event socket */
- Socket fEventSocket;
-
- /** Event socket and write stream. */
- OutputStream fEventStream;
-
- /** The eventstops table holds which events cause suspends and which do not. */
- final Map fEventStops = new HashMap();
- {
- fEventStops.put("unimpinstr", Boolean.FALSE);
- fEventStops.put("nosuchlabel", Boolean.FALSE);
- }
-
- /**
- * The watchpoints table holds watchpoint information.
- * <p/>
- * variablename_stackframedepth => N
- * <ul>
- * <li>N = 0 is no watch</li>
- * <li>N = 1 is read watch</li>
- * <li>N = 2 is write watch</li>
- * <li>N = 3 is both, etc.</li>
- */
- final Map fWatchpoints = new HashMap();
-
- public static void main(String[] args) {
- String programFile = args.length >= 1 ? args[0] : null;
- if (programFile == null) {
- System.err.println("Error: No program specified");
- return;
- }
-
- String debugFlag = args.length >= 2 ? args[1] : "";
- boolean debug = "-debug".equals(debugFlag);
- int commandPort = 0;
- int eventPort = 0;
-
- if (debug) {
- String commandPortStr = args.length >= 3 ? args[2] : "";
- try {
- commandPort = Integer.parseInt(commandPortStr);
- } catch (NumberFormatException e) {
- System.err.println("Error: Invalid command port");
- return;
- }
-
- String eventPortStr = args.length >= 4 ? args[3] : "";
- try {
- eventPort = Integer.parseInt(eventPortStr);
- } catch (NumberFormatException e) {
- System.err.println("Error: Invalid event port");
- return;
- }
- }
-
- PDAVirtualMachine pdaVM = null;
- try {
- pdaVM = new PDAVirtualMachine(programFile, debug, commandPort, eventPort);
- pdaVM.startDebugger();
- } catch (IOException e) {
- System.err.println("Error: " + e.toString());
- return;
- }
- pdaVM.run();
- }
-
- PDAVirtualMachine(String inputFile, boolean debug, int commandPort, int eventPort) throws IOException {
- fFilename = inputFile;
-
- // Load all the code into memory
- FileReader fileReader = new FileReader(inputFile);
- StringWriter stringWriter = new StringWriter();
- List code = new LinkedList();
- int c = fileReader.read();
- while (c != -1) {
- if (c == '\n') {
- code.add(stringWriter.toString().trim());
- stringWriter = new StringWriter();
- } else {
- stringWriter.write(c);
- }
- c = fileReader.read();
- }
- code.add(stringWriter.toString().trim());
- fCode = (String[])code.toArray(new String[code.size()]);
-
- fLabels = mapLabels(fCode);
-
- fDebug = debug;
- fCommandPort = commandPort;
- fEventPort = eventPort;
- }
-
- /**
- * Initializes the labels map
- */
- Map mapLabels(String[] code) {
- Map labels = new HashMap();
- for (int i = 0; i < code.length; i++) {
- if (code[i].length() != 0 && code[i].charAt(0) == ':') {
- labels.put(code[i].substring(1), new Integer(i));
- }
- }
- return labels;
- }
-
- void sendCommandResponse(String response) {
- try {
- fCommandResponseStream.write(response.getBytes());
- fCommandResponseStream.flush();
- } catch (IOException e) {
- }
- }
-
- void sendDebugEvent(String event, boolean error) {
- if (fDebug) {
- try {
- fEventStream.write(event.getBytes());
- fEventStream.write('\n');
- fEventStream.flush();
- } catch (IOException e) {
- System.err.println("Error: " + e);
- System.exit(1);
- }
- } else if (error) {
- System.err.println("Error: " + event);
- }
- }
-
- void startDebugger() throws IOException {
- if (fDebug) {
- System.out.println("-debug " + fCommandPort + " " + fEventPort);
- }
-
- ServerSocket commandServerSocket = new ServerSocket(fCommandPort);
- fCommandSocket = commandServerSocket.accept();
- fCommandReceiveStream = new BufferedReader(new InputStreamReader(fCommandSocket.getInputStream()));
- fCommandResponseStream = new PrintStream(fCommandSocket.getOutputStream());
- commandServerSocket.close();
-
- ServerSocket eventServerSocket = new ServerSocket(fEventPort);
- fEventSocket = eventServerSocket.accept();
- fEventStream = new PrintStream(fEventSocket.getOutputStream());
- eventServerSocket.close();
-
- System.out.println("debug connection accepted");
-
- fSuspendVM = "client";
- }
-
- void run() {
- int id = fNextThreadId++;
- sendDebugEvent("vmstarted", false);
- fThreads.put(new Integer(id), new PDAThread(id, "main", 0));
- if (fDebug) {
- sendDebugEvent("started " + id, false);
- }
-
- boolean allThreadsSuspended = false;
- while (!fThreads.isEmpty()) {
- checkForBreakpoint();
-
- if (fSuspendVM != null) {
- debugUI();
- } else {
- yieldToDebug(allThreadsSuspended);
- if (fSuspendVM != null) {
- // Received a command to suspend VM, skip executing threads.
- continue;
- }
- }
-
- PDAThread[] threadsCopy = (PDAThread[])fThreads.values().toArray(new PDAThread[fThreads.size()]);
- allThreadsSuspended = true;
- for (int i = 0; i < threadsCopy.length; i++) {
- PDAThread thread = threadsCopy[i];
- if (thread.fSuspend == null) {
- allThreadsSuspended = false;
-
- String instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
- thread.fCurrentFrame.fPC++;
- doOneInstruction(thread, instruction);
- if (thread.fCurrentFrame.fPC >= thread.fThreadCode.length) {
- // Thread reached end of code, exit from the thread.
- thread.fRun = false;
- } else if (thread.fStepReturn) {
- // If this thread is in a step-return operation, check
- // if we've returned from a call.
- instruction = thread.fThreadCode[thread.fCurrentFrame.fPC];
- if ("return".equals(instruction)) {
- // Note: this will only be triggered if the current
- // thread also has the fStepReturn flag set.
- if (fStepReturnVM) {
- fSuspendVM = thread.fID + " step";
- } else {
- thread.fSuspend = "step";
- }
- }
- }
- if (!thread.fRun) {
- sendDebugEvent("exited " + thread.fID, false);
- fThreads.remove(new Integer(thread.fID));
- } else if (thread.fSuspend != null) {
- sendDebugEvent("suspended " + thread.fID + " " + thread.fSuspend, false);
- thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
- }
- }
- }
-
- // Force thread context switch to avoid starving out other
- // processes in the system.
- Thread.yield();
- }
-
- sendDebugEvent("vmterminated", false);
- if (fDebug) {
- try {
- fCommandReceiveStream.close();
- fCommandResponseStream.close();
- fCommandSocket.close();
- fEventStream.close();
- fEventSocket.close();
- } catch (IOException e) {
- System.out.println("Error: " + e);
- }
- }
-
- }
-
- void doOneInstruction(PDAThread thread, String instr) {
- StringTokenizer tokenizer = new StringTokenizer(instr);
- String op = tokenizer.nextToken();
- List tokens = new LinkedList();
- while (tokenizer.hasMoreTokens()) {
- tokens.add(tokenizer.nextToken());
- }
- Args args = new Args( (String[])tokens.toArray(new String[tokens.size()]) );
-
- boolean opValid = true;
- if (op.equals("add")) iAdd(thread, args);
- else if (op.equals("branch_not_zero")) iBranchNotZero(thread, args);
- else if (op.equals("call")) iCall(thread, args);
- else if (op.equals("dec")) iDec(thread, args);
- else if (op.equals("def")) iDef(thread, args);
- else if (op.equals("dup")) iDup(thread, args);
- else if (op.equals("exec")) iExec(thread, args);
- else if (op.equals("halt")) iHalt(thread, args);
- else if (op.equals("output")) iOutput(thread, args);
- else if (op.equals("pop")) iPop(thread, args);
- else if (op.equals("push")) iPush(thread, args);
- else if (op.equals("return")) iReturn(thread, args);
- else if (op.equals("var")) iVar(thread, args);
- else if (op.equals("xyzzy")) iInternalEndEval(thread, args);
- else if (op.startsWith(":")) {} // label
- else if (op.startsWith("#")) {} // comment
- else {
- opValid = false;
- }
-
- if (!opValid) {
- sendDebugEvent("unimplemented instruction " + op, true);
- if ( ((Boolean)fEventStops.get("unimpinstr")).booleanValue() ) {
- fSuspendVM = thread.fID + " event unimpinstr";
- thread.fCurrentFrame.fPC--;
- }
- } else if (thread.fStep) {
- if (fStepVM) {
- fSuspendVM = thread.fID + " step";
- fStepVM = false;
- } else {
- thread.fSuspend = "step";
- }
- thread.fStep = false;
- }
- }
-
- void checkForBreakpoint() {
- if (fDebug) {
- for (Iterator itr = fThreads.values().iterator(); itr.hasNext();) {
- PDAThread thread = (PDAThread)itr.next();
- Integer pc = new Integer(thread.fCurrentFrame.fPC);
- // Suspend for breakpoint if:
- // - the VM is not yet set to suspend, for e.g. as a result of step end,
- // - the thread is not yet suspended and is not performing an evaluation
- // - the breakpoints table contains a breakpoint for the given line.
- if (fSuspendVM == null &&
- thread.fSuspend == null && !thread.fPerformingEval &&
- fBreakpoints.containsKey(pc))
- {
- if ( ((Boolean)fBreakpoints.get(pc)).booleanValue() ) {
- fSuspendVM = thread.fID + " breakpoint " + pc;
- } else {
- thread.fSuspend = "breakpoint " + pc;
- thread.fStep = thread.fStepReturn = false;
- sendDebugEvent("suspended " + thread.fID + " " + thread.fSuspend, false);
- }
- }
- }
- }
- }
-
- /**
- * After each instruction, we check the debug command channel for control input. If
- * there are commands, process them.
- */
- void yieldToDebug(boolean allThreadsSuspended) {
- if (fDebug) {
- String line = "";
- try {
- if (allThreadsSuspended || fCommandReceiveStream.ready()) {
- line = fCommandReceiveStream.readLine();
- processDebugCommand(line);
- }
- } catch (IOException e) {
- System.err.println("Error: " + e);
- System.exit(1);
- }
- }
- }
-
- /**
- * Service the debugger commands while the VM is suspended
- */
- void debugUI() {
- if (!fStarted) {
- sendDebugEvent("vmsuspended " + fSuspendVM, false);
- } else {
- fStarted = false;
- }
-
- // Clear all stepping flags. In case the VM suspended while
- // a step operation was being performed for the VM or some thread.
- fStepVM = fStepReturnVM = false;
- for (Iterator itr = fThreads.values().iterator(); itr.hasNext();) {
- PDAThread thread = (PDAThread)itr.next();
- thread.fSuspend = null;
- thread.fStep = thread.fStepReturn = thread.fPerformingEval = false;
- }
-
- while (fSuspendVM != null) {
- String line = "";
- try {
- line = fCommandReceiveStream.readLine();
- } catch (IOException e) {
- System.err.println("Error: " + e);
- System.exit(1);
- return;
- }
- processDebugCommand(line);
- }
-
- if (fStepVM || fStepReturnVM) {
- sendDebugEvent("vmresumed step", false);
- } else {
- sendDebugEvent("vmresumed client", false);
- }
- }
-
- void processDebugCommand(String line) {
- StringTokenizer tokenizer = new StringTokenizer(line.trim());
- if (line.length() == 0) {
- return;
- }
-
- String command = tokenizer.nextToken();
- List tokens = new LinkedList();
- while (tokenizer.hasMoreTokens()) {
- tokens.add(tokenizer.nextToken());
- }
- Args args = new Args( (String[])tokens.toArray(new String[tokens.size()]));
-
- if ("children".equals(command)) debugChildren(args);
- else if ("clear".equals(command)) debugClearBreakpoint(args);
- else if ("data".equals(command)) debugData(args);
- else if ("drop".equals(command)) debugDropFrame(args);
- else if ("eval".equals(command)) debugEval(args);
- else if ("eventstop".equals(command)) debugEventStop(args);
- else if ("frame".equals(command)) debugFrame(args);
- else if ("groups".equals(command)) debugGroups(args);
- else if ("popdata".equals(command)) debugPopData(args);
- else if ("pushdata".equals(command)) debugPushData(args);
- else if ("registers".equals(command)) debugRegisters(args);
- else if ("restart".equals(command)) debugRestart(args);
- else if ("resume".equals(command)) debugResume(args);
- else if ("set".equals(command)) debugSetBreakpoint(args);
- else if ("setdata".equals(command)) debugSetData(args);
- else if ("setvar".equals(command)) debugSetVariable(args);
- else if ("stack".equals(command)) debugStack(args);
- else if ("stackdepth".equals(command)) debugStackDepth(args);
- else if ("state".equals(command)) debugState(args);
- else if ("step".equals(command)) debugStep(args);
- else if ("stepreturn".equals(command)) debugStepReturn(args);
- else if ("suspend".equals(command)) debugSuspend(args);
- else if ("terminate".equals(command)) debugTerminate();
- else if ("threads".equals(command)) debugThreads();
- else if ("var".equals(command)) debugVar(args);
- else if ("vmresume".equals(command)) debugVMResume();
- else if ("vmsuspend".equals(command)) debugVMSuspend();
- else if ("watch".equals(command)) debugWatch(args);
- else {
- sendCommandResponse("error: invalid command\n");
- }
- }
-
- void debugChildren(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- int sfnumber = args.getNextIntArg();
- String var = args.getNextStringArg();
-
- Frame frame = sfnumber >= thread.fFrames.size()
- ? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
-
- String varDot = var + ".";
- List children = new ArrayList();
- for (Iterator itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
- String localVar = (String)itr.next();
- if (localVar.startsWith(varDot) && localVar.indexOf('.', varDot.length() + 1) == -1) {
- children.add(localVar);
- }
- }
-
- StringBuffer result = new StringBuffer();
- for (Iterator itr = children.iterator(); itr.hasNext();) {
- result.append(itr.next());
- result.append('|');
- }
- result.append('\n');
-
- sendCommandResponse(result.toString());
- }
-
- void debugClearBreakpoint(Args args) {
- int line = args.getNextIntArg();
-
- fBreakpoints.remove( new Integer(line) );
- sendCommandResponse("ok\n");
- }
-
- private static Pattern fPackPattern = Pattern.compile("%([a-fA-F0-9][a-fA-F0-9])");
-
- void debugData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- StringBuffer result = new StringBuffer();
- for (Iterator itr = thread.fStack.iterator(); itr.hasNext();) {
- result.append(itr.next());
- result.append('|');
- }
- result.append('\n');
- sendCommandResponse(result.toString());
- }
-
- void debugDropFrame(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- if (!thread.fFrames.isEmpty()) {
- thread.fCurrentFrame = (Frame)thread.fFrames.remove(thread.fFrames.size() - 1);
- }
- thread.fCurrentFrame.fPC--;
- sendCommandResponse("ok\n");
- if (fSuspendVM != null) {
- sendDebugEvent("vmresumed drop", false);
- sendDebugEvent("vmsuspended " + thread.fID + " drop", false);
- } else {
- sendDebugEvent("resumed " + thread.fID + " drop", false);
- sendDebugEvent("suspended " + thread.fID + " drop", false);
- }
- }
-
- void debugEval(Args args) {
- if (fSuspendVM != null) {
- sendCommandResponse("error: cannot evaluate while vm is suspended\n");
- return;
- }
-
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread running\n");
- return;
- }
-
- StringTokenizer tokenizer = new StringTokenizer(args.getNextStringArg(), "|");
- tokenizer.countTokens();
-
- int numEvalLines = tokenizer.countTokens();
- thread.fThreadCode = new String[fCode.length + numEvalLines + 1];
- System.arraycopy(fCode, 0, thread.fThreadCode, 0, fCode.length);
- for (int i = 0; i < numEvalLines; i++) {
- String line = tokenizer.nextToken();
- StringBuffer lineBuf = new StringBuffer(line.length());
- Matcher matcher = fPackPattern.matcher(line);
- int lastMatchEnd = 0;
- while (matcher.find()) {
- lineBuf.append(line.substring(lastMatchEnd, matcher.start()));
- String charCode = line.substring(matcher.start() + 1, matcher.start() + 3);
- try {
- lineBuf.append((char) Integer.parseInt(charCode, 16));
- } catch (NumberFormatException e) {
- }
- lastMatchEnd = matcher.end();
- }
- if (lastMatchEnd < line.length()) {
- lineBuf.append(line.substring(lastMatchEnd));
- }
- thread.fThreadCode[fCode.length + i] = lineBuf.toString();
- }
- thread.fThreadCode[fCode.length + numEvalLines] = "xyzzy";
- thread.fThreadLabels = mapLabels(fCode);
-
- thread.fSavedPC = thread.fCurrentFrame.fPC;
- thread.fCurrentFrame.fPC = fCode.length;
- thread.fPerformingEval = true;
-
- thread.fSuspend = null;
-
- sendCommandResponse("ok\n");
-
- sendDebugEvent("resumed " + thread.fID + " eval", false);
- }
-
- void debugEventStop(Args args) {
- String event = args.getNextStringArg();
- int stop = args.getNextIntArg();
- fEventStops.put(event, new Boolean(stop > 0));
- sendCommandResponse("ok\n");
- }
-
- void debugTerminate() {
- sendCommandResponse("ok\n");
- sendDebugEvent("vmterminated", false);
- System.exit(0);
- }
-
- void debugFrame(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- int sfnumber = args.getNextIntArg();
- Frame frame = null;
- if (sfnumber >= thread.fFrames.size()) {
- frame = thread.fCurrentFrame;
- } else {
- frame = (Frame)thread.fFrames.get(sfnumber);
- }
- sendCommandResponse(printFrame(frame) + "\n");
- }
-
- void debugGroups(Args args) {
- TreeSet groups = new TreeSet();
- for (Iterator itr = fRegisters.values().iterator(); itr.hasNext();) {
- Register reg = (Register)itr.next();
- groups.add(reg.fGroup);
- }
- StringBuffer response = new StringBuffer();
- for (Iterator itr = groups.iterator(); itr.hasNext();) {
- response.append(itr.next());
- response.append('|');
- }
- response.append('\n');
- sendCommandResponse(response.toString());
- }
-
- void debugPopData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- thread.fStack.pop();
- sendCommandResponse("ok\n");
- }
-
- void debugPushData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- Object val = args.getNextIntOrStringArg();
- thread.fStack.push(val);
- sendCommandResponse("ok\n");
- }
-
- void debugRegisters(Args args) {
- String group = args.getNextStringArg();
-
- StringBuffer response = new StringBuffer();
- for (Iterator itr = fRegisters.values().iterator(); itr.hasNext();) {
- Register reg = (Register)itr.next();
- if (group.equals(reg.fGroup)) {
- response.append(reg.fName);
- response.append(' ');
- response.append(reg.fIsWriteable);
- for (Iterator itr2 = reg.fBitFields.values().iterator(); itr2.hasNext();) {
- BitField bitField = (BitField)itr2.next();
- response.append('|');
- response.append(bitField.fName);
- response.append(' ');
- response.append(bitField.fBitOffset);
- response.append(' ');
- response.append(bitField.fBitCount);
- response.append(' ');
- for (Iterator itr3 = bitField.fMnemonics.entrySet().iterator(); itr3.hasNext();) {
- Map.Entry mnemonicEntry = (Map.Entry)itr3.next();
- response.append(mnemonicEntry.getKey());
- response.append(' ');
- response.append(mnemonicEntry.getValue());
- response.append(' ');
- }
- }
-
- response.append('#');
- }
- }
- response.append('\n');
- sendCommandResponse(response.toString());
- }
-
- void debugRestart(Args args) {
- fSuspendVM = "restart";
-
- for (Iterator itr = fThreads.keySet().iterator(); itr.hasNext();) {
- Integer id = (Integer)itr.next();
- sendDebugEvent("exited " + id, false);
- }
- fThreads.clear();
-
- int id = fNextThreadId++;
- fThreads.put(new Integer(id), new PDAThread(id, "main", 0));
- sendDebugEvent("started " + id, false);
-
- fRegisters.clear();
-
- sendCommandResponse("ok\n");
- }
-
- void debugResume(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
- if (fSuspendVM != null) {
- sendCommandResponse("error: cannot resume thread when vm is suspended\n");
- return;
- }
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread already running\n");
- return;
- }
-
- thread.fSuspend = null;
- sendDebugEvent("resumed " + thread.fID + " client", false);
-
- sendCommandResponse("ok\n");
- }
-
- void debugSetBreakpoint(Args args) {
- int line = args.getNextIntArg();
- int stopVM = args.getNextIntArg();
-
- fBreakpoints.put(new Integer(line), new Boolean(stopVM != 0));
- sendCommandResponse("ok\n");
- }
-
- void debugSetData(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- int offset = args.getNextIntArg();
- Object val = args.getNextIntOrStringArg();
-
- if (offset < thread.fStack.size()) {
- thread.fStack.set(offset, val);
- } else {
- thread.fStack.add(0, val);
- }
- sendCommandResponse("ok\n");
- }
-
- void debugSetVariable(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- int sfnumber = args.getNextIntArg();
- String var = args.getNextStringArg();
- Object val = args.getNextIntOrStringArg();
- while (args.hasNextArg()) {
- val = val.toString() + " " + args.getNextStringArg();
- }
-
- if (sfnumber >= thread.fFrames.size()) {
- thread.fCurrentFrame.set(var, val);
- } else {
- ((Frame)thread.fFrames.get(sfnumber)).set(var, val);
- }
- sendCommandResponse("ok\n");
- }
-
- void debugStack(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- StringBuffer result = new StringBuffer();
-
- for (Iterator itr = thread.fFrames.iterator(); itr.hasNext();) {
- Frame frame = (Frame)itr.next();
- result.append(printFrame(frame));
- result.append('#');
- }
- result.append(printFrame(thread.fCurrentFrame));
- result.append('\n');
- sendCommandResponse(result.toString());
- }
-
- void debugStackDepth(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
- sendCommandResponse( Integer.toString(thread.fFrames.size() + 1) + "\n" );
- }
-
-
- /**
- * The stack frame output is: frame # frame # frame ... where each frame is:
- * filename | line number | function name | var | var | var | var ...
- */
- private String printFrame(Frame frame) {
- StringBuffer buf = new StringBuffer();
- buf.append(fFilename);
- buf.append('|');
- buf.append(frame.fPC);
- buf.append('|');
- buf.append(frame.fFunction);
- for (Iterator itr = frame.fLocalVariables.keySet().iterator(); itr.hasNext();) {
- String var = (String)itr.next();
- if (var.indexOf('.') == -1) {
- buf.append('|');
- buf.append(var);
- }
- }
- return buf.toString();
- }
-
- void debugState(Args args) {
- PDAThread thread = args.getThreadArg();
- String response = null;
- if (thread == null) {
- response = fSuspendVM == null ? "running" : fSuspendVM;
- } else if (fSuspendVM != null) {
- response = "vm";
- } else {
- response = thread.fSuspend == null ? "running" : thread.fSuspend;
- }
- sendCommandResponse(response + "\n");
- }
-
- void debugStep(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- // Set suspend to null to allow the debug loop to exit back to the
- // instruction loop and thus run an instruction. However, we want to
- // come back to the debug loop right away, so the step flag is set to
- // true which will cause the suspend flag to get set to true when we
- // get to the next instruction.
- if (fSuspendVM != null) {
- // All threads are suspended, so suspend all threads again when
- // step completes.
- fSuspendVM = null;
- fStepVM = true;
- // Also mark the thread that initiated the step to mark it as
- // the triggering thread when suspending.
- thread.fStep = true;
- } else {
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread already running\n");
- return;
- }
- thread.fSuspend = null;
- thread.fStep = true;
- sendDebugEvent("resumed " + thread.fID + " step", false);
- }
- sendCommandResponse("ok\n");
- }
-
- void debugStepReturn(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- if (fSuspendVM != null) {
- fSuspendVM = null;
- fStepReturnVM = true;
- thread.fStepReturn = true;
- } else {
- if (thread.fSuspend == null) {
- sendCommandResponse("error: thread running\n");
- return;
- }
- thread.fSuspend = null;
- thread.fStepReturn = true;
- sendDebugEvent("resumed " + thread.fID + " step", false);
- }
- sendCommandResponse("ok\n");
- }
-
- void debugSuspend(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
- if (fSuspendVM != null) {
- sendCommandResponse("error: vm already suspended\n");
- return;
- }
- if (thread.fSuspend != null) {
- sendCommandResponse("error: thread already suspended\n");
- return;
- }
-
- thread.fSuspend = "client";
- sendDebugEvent("suspended " + thread.fID + " client", false);
- sendCommandResponse("ok\n");
- }
-
- void debugThreads() {
- StringBuffer response = new StringBuffer();
- for (Iterator itr = fThreads.keySet().iterator(); itr.hasNext();) {
- response.append(itr.next());
- response.append(' ');
- }
- sendCommandResponse(response.toString().trim() + "\n");
- }
-
- void debugVar(Args args) {
- PDAThread thread = args.getThreadArg();
- if (thread == null) {
- sendCommandResponse("error: invalid thread\n");
- return;
- }
-
- int sfnumber = args.getNextIntArg();
- String var = args.getNextStringArg();
-
- Frame frame = sfnumber >= thread.fFrames.size()
- ? thread.fCurrentFrame : (Frame)thread.fFrames.get(sfnumber);
-
- Object val = frame.get(var);
- if (val == null) {
- sendCommandResponse("error: variable undefined\n");
- } else {
- sendCommandResponse(val.toString() + "\n");
- }
- }
-
- void debugVMResume() {
- if (fSuspendVM == null) {
- sendCommandResponse("error: vm already running\n");
- return;
- }
-
- fSuspendVM = null;
- sendCommandResponse("ok\n");
- }
-
- void debugVMSuspend() {
- if (fSuspendVM != null) {
- sendCommandResponse("error: vm already suspended\n");
- return;
- }
-
- fSuspendVM = "client";
- sendCommandResponse("ok\n");
- }
-
- void debugWatch(Args args) {
- String funcAndVar = args.getNextStringArg();
- int flags = args.getNextIntArg();
- fWatchpoints.put(funcAndVar, new Integer(flags));
- sendCommandResponse("ok\n");
- }
-
- void iAdd(PDAThread thread, Args args) {
- Object val1 = thread.fStack.pop();
- Object val2 = thread.fStack.pop();
- if (val1 instanceof Integer && val2 instanceof Integer) {
- int intVal1 = ((Integer) val1).intValue();
- int intVal2 = ((Integer) val2).intValue();
- thread.fStack.push( new Integer(intVal1 + intVal2) );
- } else {
- thread.fStack.push( new Integer(-1) );
- }
- }
-
- void iBranchNotZero(PDAThread thread, Args args) {
- Object val = thread.fStack.pop();
- if (val instanceof Integer && ((Integer) val).intValue() != 0) {
- String label = args.getNextStringArg();
- if (thread.fThreadLabels.containsKey(label)) {
- thread.fCurrentFrame.fPC = ((Integer)thread.fThreadLabels.get(label)).intValue();
- } else {
- sendDebugEvent("no such label " + label, true);
- if ( ((Boolean)fEventStops.get("nosuchlabel")).booleanValue() ) {
- fSuspendVM = thread.fID + " event nosuchlabel";
- thread.fStack.push(val);
- thread.fCurrentFrame.fPC--;
- }
- }
- }
- }
-
- void iCall(PDAThread thread, Args args) {
- String label = args.getNextStringArg();
- if (thread.fThreadLabels.containsKey(label)) {
- thread.fFrames.add(thread.fCurrentFrame);
- thread.fCurrentFrame = new Frame(label, ((Integer)thread.fThreadLabels.get(label)).intValue());
- } else {
- sendDebugEvent("no such label " + label, true);
- if ( ((Boolean)fEventStops.get("nosuchlabel")).booleanValue() ) {
- fSuspendVM = thread.fID + " event nosuchlabel";
- thread.fCurrentFrame.fPC--;
- }
- }
- }
-
- void iDec(PDAThread thread, Args args) {
- Object val = thread.fStack.pop();
- if (val instanceof Integer) {
- val = new Integer(((Integer) val).intValue() - 1);
- }
- thread.fStack.push(val);
- }
-
- void iDef(PDAThread thread, Args args) {
- String type = args.getNextStringArg();
-
- String name = args.getNextStringArg();
- String regName = getRegisterPartOfName(name);
- String bitFieldName = getBitFieldPartOfName(name);
-
- if ("register".equals(type)) {
- Register reg = new Register(regName);
- reg.fGroup = args.getNextStringArg();
- fRegisters.put(regName, reg);
- reg.fIsWriteable = args.getNextBooleanArg();
- } else if ("bitfield".equals(type)) {
- Register reg = (Register)fRegisters.get(regName);
- if (reg == null) return;
- BitField bitField = new BitField(bitFieldName);
- bitField.fBitOffset = args.getNextIntArg();
- bitField.fBitCount = args.getNextIntArg();
- reg.fBitFields.put(bitFieldName, bitField);
- } else if ("mnemonic".equals(type)) {
- Register reg = (Register)fRegisters.get(regName);
- if (reg == null) return;
- BitField bitField = (BitField)reg.fBitFields.get(bitFieldName);
- if (bitField == null) return;
- bitField.fMnemonics.put(args.getNextStringArg(), new Integer(args.getNextIntArg()));
- }
- sendDebugEvent("registers", false);
- }
-
- private String getRegisterPartOfName(String name) {
- if (name.startsWith("$")) {
- int end = name.indexOf('.');
- end = end != -1 ? end : name.length();
- return name.substring(1, end);
- }
- return null;
- }
-
- private String getBitFieldPartOfName(String name) {
- int start = name.indexOf('.');
- if (name.startsWith("$") && start != -1) {
- return name.substring(start + 1, name.length());
- }
- return null;
- }
-
- void iDup(PDAThread thread, Args args) {
- Object val = thread.fStack.pop();
- thread.fStack.push(val);
- thread.fStack.push(val);
- }
-
- void iExec(PDAThread thread, Args args) {
- String label = args.getNextStringArg();
- if (fLabels.containsKey(label)) {
- int id = fNextThreadId++;
- fThreads.put( new Integer(id), new PDAThread(id, label, ((Integer)fLabels.get(label)).intValue()) );
- sendDebugEvent("started " + id, false);
- } else {
- sendDebugEvent("no such label " + label, true);
- if ( ((Boolean)fEventStops.get("nosuchlabel")).booleanValue() ) {
- thread.fSuspend = "event nosuchlabel";
- thread.fCurrentFrame.fPC--;
- }
- }
- }
-
- void iHalt(PDAThread thread, Args args) {
- thread.fRun = false;
- }
-
- void iOutput(PDAThread thread, Args args) {
- System.out.println(thread.fStack.pop());
- }
-
- void iPop(PDAThread thread, Args args) {
- String arg = args.getNextStringArg();
- if (arg.startsWith("$")) {
- String var = arg.substring(1);
- thread.fCurrentFrame.set(var, thread.fStack.pop());
- String key = thread.fCurrentFrame.fFunction + "::" + var;
- if ( fWatchpoints.containsKey(key) && (((Integer)fWatchpoints.get(key)).intValue() & 2) != 0 ) {
- fSuspendVM = thread.fID + " watch write " + key;
- }
- } else {
- thread.fStack.pop();
- }
- }
-
- void iPush(PDAThread thread, Args args) {
- String arg = args.getNextStringArg();
- while (arg.length() != 0) {
- if (arg.startsWith("$")) {
- String var = arg.substring(1);
- Object val = thread.fCurrentFrame.get(var);
- if (val == null) val = "<undefined>";
- thread.fStack.push(val);
- String key = thread.fCurrentFrame.fFunction + "::" + var;
- if (fWatchpoints.containsKey(key) && (((Integer)fWatchpoints.get(key)).intValue() & 1) != 0) {
- fSuspendVM = thread.fID + " watch read " + key;
- }
- } else {
- Object val = arg;
- if (args.hasNextArg()) {
- while (args.hasNextArg()) {
- val = val.toString() + " " + args.getNextStringArg();
- }
- } else {
- try {
- val = new Integer(arg);
- } catch (NumberFormatException e) {
- }
- }
- thread.fStack.push(val);
- }
-
- arg = args.getNextStringArg();
- }
- }
-
- void iReturn(PDAThread thread, Args args) {
- if (!thread.fFrames.isEmpty()) {
- thread.fCurrentFrame = (Frame)thread.fFrames.remove(thread.fFrames.size() - 1);
- } else {
- // Execution returned from the top frame, which means this thread
- // should exit.
- thread.fRun = false;
- }
- }
-
- void iVar(PDAThread thread, Args args) {
- String var = args.getNextStringArg();
- thread.fCurrentFrame.set(var, new Integer(0));
- }
-
- void iInternalEndEval(PDAThread thread, Args args) {
- Object result = thread.fStack.pop();
- thread.fThreadCode = fCode;
- thread.fThreadLabels = fLabels;
- thread.fCurrentFrame.fPC = thread.fSavedPC;
- sendDebugEvent("evalresult " + result, false);
- thread.fSuspend = "eval";
- thread.fPerformingEval = false;
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/pdavm/tests/vmtest10.pda b/org.eclipse.debug.examples.core/pdavm/tests/vmtest10.pda
deleted file mode 100644
index 837277f5f..000000000
--- a/org.eclipse.debug.examples.core/pdavm/tests/vmtest10.pda
+++ /dev/null
@@ -1,38 +0,0 @@
-def register $reg1 group1 true
-def register $reg2 group1 false
-def register $reg3 group2 true
-def bitfield $reg1.field1 0 2
-def bitfield $reg1.field2 2 2
-def mnemonic $reg1.field2 zero 0
-def mnemonic $reg1.field2 one 1
-def mnemonic $reg1.field2 two 2
-def mnemonic $reg1.field2 three 3
-push 1
-pop $$reg1
-push $$reg1
-output
-push 2
-pop $$reg1.field1
-push $$reg1.field1
-output
-push 4
-pop $$reg1.field1
-push $$reg1.field1
-output
-push 1
-pop $$reg1.field2
-push $$reg1
-output
-push zero
-pop $$reg1.field2
-push $$reg1.field2
-output
-push $$reg1
-output
-push 2
-pop $$reg1.field2
-push $$reg1.field2
-output
-push $$reg1
-output
-halt \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/pdavm/tests/vmtest2.pda b/org.eclipse.debug.examples.core/pdavm/tests/vmtest2.pda
deleted file mode 100644
index 95a35f04f..000000000
--- a/org.eclipse.debug.examples.core/pdavm/tests/vmtest2.pda
+++ /dev/null
@@ -1,48 +0,0 @@
-push 6
-push 7
-push 8
-push 9
-push 10
-call sub1
-output
-call sub3
-call sub5
-push 3
-halt
-:sub2
-push 27
-return
-:sub1
-var m
-var n
-call sub2
-pop $n
-pop $m
-push $n
-push $m
-return
-# zero-based line 23
-:sub3
-push 1
-call sub4
-push 2
-call sub4
-push 3
-return
-:sub4
-push 4
-return
-# zero-based line 34
-:sub5
-var a
-var b
-var c
-pop $c
-pop $b
-call sub6
-push $a
-return
-:sub6
-var b
-pop $b
-return
diff --git a/org.eclipse.debug.examples.core/pdavm/tests/vmtest3.pda b/org.eclipse.debug.examples.core/pdavm/tests/vmtest3.pda
deleted file mode 100644
index 5aecdc5e6..000000000
--- a/org.eclipse.debug.examples.core/pdavm/tests/vmtest3.pda
+++ /dev/null
@@ -1,13 +0,0 @@
-push 1
-push 2
-push 3
-foobar swish
-push 4
-add
-add
-call zippy
-add
-output
-push 1
-branch_not_zero swishy
-halt
diff --git a/org.eclipse.debug.examples.core/pdavm/tests/vmtest6.pda b/org.eclipse.debug.examples.core/pdavm/tests/vmtest6.pda
deleted file mode 100644
index d90a960cf..000000000
--- a/org.eclipse.debug.examples.core/pdavm/tests/vmtest6.pda
+++ /dev/null
@@ -1,31 +0,0 @@
-var a
-var b
-push 1
-pop $a
-push 2
-pop $b
-push 3
-push 4
-#
-call inner
-#
-push $a
-push 2
-add
-pop $b
-output
-#
-halt
-#
-:inner
-var a
-var c
-pop $a
-pop $c
-push $a
-push $a
-add
-return
-:other
-push 15
-return \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/pdavm/tests/vmtest8.pda b/org.eclipse.debug.examples.core/pdavm/tests/vmtest8.pda
deleted file mode 100644
index 7729409c2..000000000
--- a/org.eclipse.debug.examples.core/pdavm/tests/vmtest8.pda
+++ /dev/null
@@ -1,14 +0,0 @@
-var a
-call inner
-push 1
-output
-halt
-:inner
-var b
-call inner2
-push 2
-return
-:inner2
-var c
-push 3
-return
diff --git a/org.eclipse.debug.examples.core/pdavm/tests/vmtest9.pda b/org.eclipse.debug.examples.core/pdavm/tests/vmtest9.pda
deleted file mode 100644
index 336a251d9..000000000
--- a/org.eclipse.debug.examples.core/pdavm/tests/vmtest9.pda
+++ /dev/null
@@ -1,23 +0,0 @@
-push 5
-:thread_create
-exec foo
-dec
-dup
-branch_not_zero thread_create
-push finished
-output
-halt
-:foo
-push thread_created
-output
-call inner
-halt
-:inner
-var b
-call inner2
-push 2
-return
-:inner2
-var c
-push 3
-return
diff --git a/org.eclipse.debug.examples.core/pdavm/tests/vmtest_children.pda b/org.eclipse.debug.examples.core/pdavm/tests/vmtest_children.pda
deleted file mode 100644
index b0bbd163d..000000000
--- a/org.eclipse.debug.examples.core/pdavm/tests/vmtest_children.pda
+++ /dev/null
@@ -1,8 +0,0 @@
-var a
-var a.b
-var a.c
-push 1
-pop $a.b
-push $a.b
-output
-halt
diff --git a/org.eclipse.debug.examples.core/plugin.xml b/org.eclipse.debug.examples.core/plugin.xml
deleted file mode 100644
index dadb0fe8f..000000000
--- a/org.eclipse.debug.examples.core/plugin.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?> <!--
- Copyright (c) 2005, 2008 IBM Corporation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- IBM Corporation - initial API and implementation
- -->
-
-<plugin>
- <extension
- point="org.eclipse.core.variables.valueVariables">
- <variable
- description="Path to Perl executable in the local file system"
- name="perlExecutable"
- initialValue="c:\perl\bin\perl.exe"/>
- </extension>
-<!--#ifdef ex1-->
-<!--#else-->
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- sourceLocatorId="pda.sourceLocator"
- delegate="org.eclipse.debug.examples.core.pda.launcher.PDALaunchDelegate"
- sourcePathComputerId="pda.sourcePathComputer"
- name="PDA Application"
- id="pda.launchType"
- modes="run, debug"/>
- </extension>
-<!--#endif-->
-
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- delegate="org.eclipse.debug.examples.core.midi.launcher.MidiLaunchDelegate"
- name="MIDI Sequence"
- id="midi.launchType"
- modes="run, debug"/>
- </extension>
-
-<!--#ifdef ex4-->
-<!--#else-->
- <extension
- point="org.eclipse.debug.core.sourceLocators">
- <sourceLocator
- class="org.eclipse.debug.examples.core.pda.sourcelookup.PDASourceLookupDirector"
- name="PDA Source Locator"
- id="pda.sourceLocator"/>
- </extension>
- <extension
- point="org.eclipse.debug.core.sourcePathComputers">
- <sourcePathComputer
- class="org.eclipse.debug.examples.core.pda.sourcelookup.PDASourcePathComputerDelegate"
- id="pda.sourcePathComputer"/>
- </extension>
-<!--#endif-->
-
-<!--#ifdef ex3-->
-<!--#else-->
- <extension
- point="org.eclipse.debug.core.breakpoints">
- <breakpoint
- class="org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint"
- name="PDA Line Breakpoints"
- markerType="org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"
- id="pda.lineBreakpoint"/>
- <breakpoint
- class="org.eclipse.debug.examples.core.pda.breakpoints.PDAWatchpoint"
- name="PDA Watchpoints"
- markerType="org.eclipse.debug.examples.core.pda.markerType.watchpoint"
- id="pda.watchpoint"/>
- </extension>
- <extension
- id="pda.markerType.lineBreakpoint"
- name="PDA Line Breakpoint Marker"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.debug.core.lineBreakpointMarker"/>
- <persistent value="true"/>
- </extension>
- <extension
- id="pda.markerType.watchpoint"
- name="PDA Watchpoint Marker"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint"/>
- <persistent value="true"/>
- </extension>
-<!--#endif-->
-
-<!--#ifdef ex6-->
-<!--#else-->
- <extension
- point="org.eclipse.debug.core.logicalStructureTypes">
- <logicalStructureType
- class="org.eclipse.debug.examples.core.pda.model.WordStructureDelegate"
- description="Words"
- id="pda.wordStructure"
- modelIdentifier="pda.debugModel"/>
- </extension>
-<!--#endif-->
-</plugin>
diff --git a/org.eclipse.debug.examples.core/readme.html b/org.eclipse.debug.examples.core/readme.html
deleted file mode 100644
index 2a7cb9df3..000000000
--- a/org.eclipse.debug.examples.core/readme.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<h1>Debug Examples ReadMe Notes</h1>
-<h2>PDA Debugger Example</h2>
-<p>In order to actually run the PDA debugger example, you will need a Perl interpreter.
- Linux&reg;&#8482; comes with Perl. For Microsoft&reg; Windows&reg;, we use either
- ActivePerl (<a href="http://www.activeperl.com/">http://www.activeperl.com/</a>) or Indigo Perl
- (<a href="http://www.indigostar.com/">http://www.indigostar.com/</a>). You also
- have to set the string substitution variable named &#8220;perlExecutable&#8221;
- to the complete path to your Perl interpreter. (For example, ours was C:\perl\bin\perl.exe)
- To set a string substitution variable, use the Windows &gt; Preferences &gt;
- Run/Debug &gt; String Substitution preferences page.<br>
-</p>
diff --git a/org.eclipse.debug.examples.core/samples/counter.pda b/org.eclipse.debug.examples.core/samples/counter.pda
deleted file mode 100644
index 9b2b73100..000000000
--- a/org.eclipse.debug.examples.core/samples/counter.pda
+++ /dev/null
@@ -1,11 +0,0 @@
-push 0
-:main
-var n
-pop $n
-push $n
-push 1
-add
-dup
-push $n
-output
-branch_not_zero main \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/samples/drop.pda b/org.eclipse.debug.examples.core/samples/drop.pda
deleted file mode 100644
index 84f60fee0..000000000
--- a/org.eclipse.debug.examples.core/samples/drop.pda
+++ /dev/null
@@ -1,12 +0,0 @@
-call one
-:one
-call two
-:two
-call three
-:three
-call four
-:four
-push DONE
-output
-
-
diff --git a/org.eclipse.debug.examples.core/samples/example.pda b/org.eclipse.debug.examples.core/samples/example.pda
deleted file mode 100644
index a95886358..000000000
--- a/org.eclipse.debug.examples.core/samples/example.pda
+++ /dev/null
@@ -1,35 +0,0 @@
-push "hello"
-output
-call foobar
-push 3
-:label
-dup
-push 4
-push 5
-add
-add
-output
-dec
-dup
-branch_not_zero label
-call foobar
-push "end"
-output
-halt
-:foobar
-var a
-var b
-call barfoo
-push "first"
-push "second"
-pop $a
-pop $b
-push $a
-push $b
-output
-output
-return
-:barfoo
-push "barfoo"
-output
-return
diff --git a/org.eclipse.debug.examples.core/samples/fibonacci.pda b/org.eclipse.debug.examples.core/samples/fibonacci.pda
deleted file mode 100644
index e39595a98..000000000
--- a/org.eclipse.debug.examples.core/samples/fibonacci.pda
+++ /dev/null
@@ -1,32 +0,0 @@
-push 6
-call fibonacci
-output
-halt
-#
-# f(n) = f(n-1) + f(n-2)
-# f(0) = 1
-# f(1) = 1
-#
-:fibonacci
-var n
-pop $n
-push $n
-branch_not_zero gt0
-push 1
-return
-:gt0
-push $n
-dec
-branch_not_zero gt1
-push 1
-return
-:gt1
-push $n
-dec
-call fibonacci
-push $n
-dec
-dec
-call fibonacci
-add
-return
diff --git a/org.eclipse.debug.examples.core/samples/registers.pda b/org.eclipse.debug.examples.core/samples/registers.pda
deleted file mode 100644
index 97fd8d409..000000000
--- a/org.eclipse.debug.examples.core/samples/registers.pda
+++ /dev/null
@@ -1,72 +0,0 @@
-def register $pc General true
-def register $sp General true
-def register $status General true
-def bitfield $status.BITS_00_07 0 8
-def bitfield $status.BITS_08_15 8 8
-def bitfield $status.BITS_16_23 16 8
-def bitfield $status.BITS_24_31 24 8
-def mnemonic $status.BITS_24_31 three 3
-def mnemonic $status.BITS_24_31 twelve 12
-def mnemonic $status.BITS_24_31 fourty_eight 48
-def mnemonic $status.BITS_24_31 one_nighty_two 192
-def register $stackdepth General true
-def register $stack[0] General true
-def register $stack[1] General true
-def register $stack[2] General true
-def register $stack[3] General true
-def register $stack[4] General true
-push 103
-pop $$pc
-push 306
-push 2
-pop $$sp
-push 400
-pop $$status
-push 5
-pop $$stackdepth
-push 12
-pop $$stack[0]
-push 45
-pop $$stack[1]
-push 146
-pop $$stack[2]
-push 215
-pop $$stack[3]
-push 251
-pop $$stack[4]
-push 306
-pop $$stack[5]
-def register $total-instructions Analysis false
-def register $add-instructions Analysis false
-def register $call-instructions Analysis false
-def register $dec-instructions Analysis false
-def register $dup-instructions Analysis false
-def register $halt-instructions Analysis false
-def register $output-instructions Analysis false
-def register $pop-instructions Analysis false
-def register $push-instructions Analysis false
-def register $return-instructions Analysis false
-def register $var-instructions Analysis false
-push 1046
-pop $$total-instructions
-push 12
-pop $$add-instructions
-push 24
-pop $$call-instructions
-push 36
-pop $$dec-instructions
-push 50
-pop $$dup-instructions
-push 62
-pop $$halt-instructions
-push 74
-pop $$output-instructions
-push 106
-pop $$pop-instructions
-push 120
-pop $$push-instructions
-push 132
-pop $$return-instructions
-push 144
-pop $$var-instructions
-halt \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/samples/stack.pda b/org.eclipse.debug.examples.core/samples/stack.pda
deleted file mode 100644
index c7fa1628b..000000000
--- a/org.eclipse.debug.examples.core/samples/stack.pda
+++ /dev/null
@@ -1,21 +0,0 @@
-push 5
-:thread_create
-exec stack
-dec
-dup
-branch_not_zero thread_create
-push finished
-output
-halt
-:stack
-push 100
-:inner
-dup
-output
-dup
-branch_not_zero descend
-return
-:descend
-dec
-call inner
-return \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/samples/structures.pda b/org.eclipse.debug.examples.core/samples/structures.pda
deleted file mode 100644
index 4cc881728..000000000
--- a/org.eclipse.debug.examples.core/samples/structures.pda
+++ /dev/null
@@ -1,29 +0,0 @@
-push a
-push b
-push c
-push x
-push y
-push z
-push one two three
-push 1 2 3
-push I II III
-var x
-var x.a
-var x.b
-var y
-var y.c
-var y.d
-var y.d.1
-var y.d.2
-var y.d.3
-pop $x
-pop $x.a
-pop $x.b
-pop $y
-pop $y.c
-pop $y.d
-pop $y.d.1
-pop $y.d.2
-pop $y.d.3
-push Done
-output \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/scripts/build.xml b/org.eclipse.debug.examples.core/scripts/build.xml
deleted file mode 100644
index df434e655..000000000
--- a/org.eclipse.debug.examples.core/scripts/build.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!-- ======================================================================
- Copyright (c) 2005, 2008 IBM Corporation and others.\
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- IBM Corporation - initial API and implementation
-
- EclipseCon
- Debug Tutorial Exercises
- ====================================================================== -->
-<project name="EclipseCon" default="generateAll">
- <description>
- Debug Tutorial Exercises
- </description>
-
- <taskdef name="preprocess" classname="org.eclipse.debug.examples.ant.tasks.PreProcessor" classpath="../bin" />
- <property name="destBase" location="c:\temp\example" />
- <property name="workspace" location="c:\eclipse-dev\dev-3.4" />
- <property name="coreSource" location="${workspace}\org.eclipse.debug.examples.core" />
- <property name="uiSource" location="${workspace}\org.eclipse.debug.examples.ui" />
-
- <!-- =================================
- target: generateAll
- ================================= -->
- <target name="generateAll" description="--> Debug Tutorial Exercises">
-
- <!-- = = = = = = = = = = = = = = = = =
- macrodef: process
- = = = = = = = = = = = = = = = = = -->
- <macrodef name="process">
- <attribute name="destdir"/>
- <attribute name="symbols"/>
- <sequential>
- <delete dir="@{destdir}"/>
- <mkdir dir="@{destdir}\org.eclipse.debug.examples.core"/>
- <mkdir dir="@{destdir}\org.eclipse.debug.examples.ui"/>
- <preprocess destdir="@{destdir}\org.eclipse.debug.examples.core" symbols="@{symbols}">
- <fileset dir="${coreSource}">
- <exclude name="**/*.class"/>
- <exclude name="**/PreProcessor.java"/>
- </fileset>
- </preprocess>
- <preprocess destdir="@{destdir}\org.eclipse.debug.examples.ui" symbols="@{symbols}">
- <fileset dir="${uiSource}">
- <exclude name="**/*.class"/>
- </fileset>
- </preprocess>
- </sequential>
- </macrodef>
-
- <process destdir="${destBase}\exercise1.1" symbols="ex1"/>
- <process destdir="${destBase}\exercise2.1" symbols="ex2"/>
- <process destdir="${destBase}\exercise3.1" symbols="ex3"/>
- <process destdir="${destBase}\exercise4.1" symbols="ex4"/>
- <process destdir="${destBase}\exercise5.1" symbols="ex5"/>
- <process destdir="${destBase}\exercise6.1" symbols="ex6"/>
- <process destdir="${destBase}\exercise7.1" symbols="ex7"/>
- <process destdir="${destBase}\answer" symbols="answer"/>
- </target>
-
-</project>
-
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java
deleted file mode 100644
index 639f1acf5..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/ClockControl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.midi.launcher;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
-
-/**
- * Controls the location of the sequencer in microseconds.
- *
- * @since 1.0
- */
-public class ClockControl extends TimeControl {
-
- /**
- * @param launch
- */
- public ClockControl(MidiLaunch launch) {
- super("Time" , launch);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.TimeControl#getTimeValue()
- */
- protected long getTimeValue() {
- return getSequencer().getMicrosecondPosition();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable()
- */
- public boolean isEditable() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String)
- */
- public IStatus setValue(String newValue) {
- try {
- long value = getLong(newValue);
- getSequencer().setMicrosecondPosition(value);
- fireEvent(new DebugEvent(this, DebugEvent.CHANGE));
- return Status.OK_STATUS;
- } catch (CoreException e) {
- return e.getStatus();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String)
- */
- public IStatus validateValue(String value) {
- try {
- getLong(value);
- return Status.OK_STATUS;
- } catch (CoreException e) {
- return e.getStatus();
- }
- }
-
- /**
- * Returns a float for the string.
- *
- * @param value string
- * @return float
- * @throws CoreException if not a valid value
- */
- protected long getLong(String value) throws CoreException {
- try {
- if (value.indexOf(':') == -1) {
- long secs = Long.parseLong(value);
- return secs * 1000000;
- }
- } catch (NumberFormatException e) {
- throw new CoreException(new Status(IStatus.ERROR, DebugCorePlugin.PLUGIN_ID, "Time must be an integer (seconds) or 00:00 (minutes:seconds) format", e));
- }
- return 0L;
- }
-
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java
deleted file mode 100644
index 3a754c91a..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/LengthControl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.midi.launcher;
-
-
-/**
- * Describes the length of the sequence in microseconds.
- *
- * @since 1.0
- */
-public class LengthControl extends TimeControl {
-
- /**
- * @param launch
- */
- public LengthControl(MidiLaunch launch) {
- super("Duration" , launch);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.TimeControl#getTimeValue()
- */
- protected long getTimeValue() {
- return getSequencer().getMicrosecondLength();
- }
-
-
-}
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
deleted file mode 100644
index 75801ecea..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunch.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.midi.launcher;
-
-import javax.sound.midi.MidiFileFormat;
-import javax.sound.midi.Sequencer;
-
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.Launch;
-import org.eclipse.debug.core.model.ISuspendResume;
-
-/**
- * A launch containing a MIDI sequencer.
- *
- * @since 1.0
- */
-public class MidiLaunch extends Launch implements ISuspendResume {
-
- /**
- * MIDI Sequencer
- */
- private Sequencer fSequencer;
-
- /**
- * MIDI file format
- */
- private MidiFileFormat fFormat;
-
- /**
- * Constructs a new MIDI launch.
- *
- * @param launchConfiguration configuration to play
- * @param mode mode to play in
- */
- public MidiLaunch(ILaunchConfiguration launchConfiguration, String mode) {
- super(launchConfiguration, mode, null);
- }
-
- /**
- * Sets the sequencer used to play MIDI files.
- *
- * @param sequencer
- */
- public void setSequencer(Sequencer sequencer) {
- fSequencer = sequencer;
- fireChanged();
- }
-
- /**
- * Sets the format of the sequence
- * @param format
- */
- public void setFormat(MidiFileFormat format) {
- fFormat = format;
- }
-
- /**
- * Returns the file format of the sequence.
- *
- * @return file format
- */
- public MidiFileFormat getFormat() {
- return fFormat;
- }
- /**
- * Returns the sequencer used to play MIDI files.
- *
- * @return the sequencer used to play MIDI files
- */
- public Sequencer getSequencer() {
- return fSequencer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.Launch#canTerminate()
- */
- public boolean canTerminate() {
- return getSequencer().isOpen();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.Launch#isTerminated()
- */
- public boolean isTerminated() {
- if (fSequencer != null) {
- return !fSequencer.isOpen();
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.Launch#terminate()
- */
- public void terminate() throws DebugException {
- getSequencer().stop();
- getSequencer().close();
- fireTerminate();
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[]{new DebugEvent(getSequencer(), DebugEvent.TERMINATE)});
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
- */
- public boolean canResume() {
- return isSuspended();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
- */
- public boolean canSuspend() {
- if (fSequencer != null) {
- return fSequencer.isRunning();
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
- */
- public boolean isSuspended() {
- if (fSequencer != null) {
- return fSequencer.isOpen() & !fSequencer.isRunning();
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#resume()
- */
- public void resume() throws DebugException {
- getSequencer().start();
- fireChanged();
- fireEvent(new DebugEvent(getSequencer(), DebugEvent.RESUME, DebugEvent.CLIENT_REQUEST));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
- */
- public void suspend() throws DebugException {
- getSequencer().stop();
- fireChanged();
- fireEvent(new DebugEvent(getSequencer(), DebugEvent.SUSPEND, DebugEvent.CLIENT_REQUEST));
- }
-
- /**
- * Fires a debug event.
- *
- * @param event debug event to fire
- */
- protected void fireEvent(DebugEvent event) {
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java
deleted file mode 100644
index b5538a787..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/MidiLaunchDelegate.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.midi.launcher;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-
-import javax.sound.midi.InvalidMidiDataException;
-import javax.sound.midi.MidiFileFormat;
-import javax.sound.midi.MidiSystem;
-import javax.sound.midi.MidiUnavailableException;
-import javax.sound.midi.Sequencer;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRoot;
-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.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
-
-/**
- * Creates and starts a MIDI sequencer.
- *
- * @since 1.0
- */
-public class MidiLaunchDelegate extends LaunchConfigurationDelegate {
-
- /**
- * Identifier for the MIDI launch configuration type
- * (value <code>midi.launchType</code>)
- */
- public static final String ID_MIDI_LAUNCH_CONFIGURATION_TYPE = "midi.launchType";
-
- /**
- * Launch configuration attribute for the MIDI file to play
- * (value <code>midi.file</code>)
- */
- public static final String ATTR_MIDI_FILE = "midi.file";
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- String fileName = configuration.getAttribute(ATTR_MIDI_FILE, (String)null);
- if (fileName == null) {
- abort("MIDI file not specified.", null);
- }
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile file = root.getFile(new Path(fileName));
- if (!file.exists()) {
- abort("MIDI file does not exist.", null);
- }
- Sequencer sequencer = null;
- MidiFileFormat fileFormat = null;
- try {
- sequencer = MidiSystem.getSequencer();
- sequencer.open();
- IPath location = file.getLocation();
- if (location != null) {
- fileFormat = MidiSystem.getMidiFileFormat(location.toFile());
- }
- } catch (MidiUnavailableException e) {
- abort("Cannot initialize sequencer.", e);
- } catch (InvalidMidiDataException e) {
- abort("Invalid MIDI file.", e);
- } catch (IOException e) {
- abort("Error reading MIDI file.", e);
- }
- BufferedInputStream stream = new BufferedInputStream(file.getContents());
- try {
- sequencer.setSequence(stream);
- } catch (IOException e) {
- abort("Error reading MIDI file", e);
- } catch (InvalidMidiDataException e) {
- abort("Inavlid MIDI file.", e);
- }
- MidiLaunch midiLaunch = (MidiLaunch)launch;
- midiLaunch.setSequencer(sequencer);
- midiLaunch.setFormat(fileFormat);
- sequencer.start();
- }
-
- /**
- * Throws an exception with a new status containing the given
- * message and optional exception.
- *
- * @param message error message
- * @param e underlying exception
- * @throws CoreException
- */
- private void abort(String message, Throwable e) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, DebugCorePlugin.PLUGIN_ID, 0, message, e));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate2#getLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
- */
- public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
- return new MidiLaunch(configuration, mode);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildForLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
- */
- public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
- return false;
- }
-
-
-
-}
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
deleted file mode 100644
index 3274582cc..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/SequencerControl.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.midi.launcher;
-
-import javax.sound.midi.Sequencer;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-
-/**
- * Controls some aspect of a MIDI sequencer.
- *
- * @since 1.0
- */
-public abstract class SequencerControl {
-
- /**
- * The launch
- */
- private MidiLaunch fLaunch;
-
- /**
- * Control name
- */
- private String fName;
-
- /**
- * Constructs a control with the given name.
- */
- public SequencerControl(String name, MidiLaunch launch) {
- fName = name;
- fLaunch = launch;
- }
-
- /**
- * Returns the launch this control is associated with.
- *
- * @return MIDI launch
- */
- public MidiLaunch getLaunch() {
- return fLaunch;
- }
-
- /**
- * Returns the sequencer associated with this control.
- *
- * @return associated sequencer
- */
- public Sequencer getSequencer() {
- return fLaunch.getSequencer();
- }
-
- /**
- * Returns the name of this control.
- *
- * @return control name
- */
- public String getName() {
- return fName;
- }
-
- /**
- * Returns this controls current value.
- *
- * @return current value
- */
- public abstract String getValue();
-
- /**
- * Whether this contol's value can be modified.
- *
- * @return Whether this contol's value can be modified
- */
- public abstract boolean isEditable();
-
- /**
- * Returns a status indicating if the given value is
- * a valid value for this control to accept.
- *
- * @param value new value
- * @return whether the value is valid
- */
- public abstract IStatus validateValue(String value);
-
- /**
- * Sets the value of this control to the given value
- * and returns a status indicating if the value was
- * successfully set.
- *
- * @param newValue value
- * @return whether successful
- */
- public abstract IStatus setValue(String newValue);
-
- /**
- * Fires a debug event.
- *
- * @param event debug event to fire
- */
- public void fireEvent(DebugEvent event) {
- DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj != null) {
- if (getClass().equals(obj.getClass())) {
- return ((SequencerControl)obj).getSequencer().equals(getSequencer());
-
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getSequencer().hashCode() + getClass().hashCode();
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
deleted file mode 100644
index feb3b32e4..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TempoControl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.midi.launcher;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
-
-/**
- * Controls the tempo of a sequencer.
- *
- * @since 1.0
- */
-public class TempoControl extends SequencerControl {
-
- /**
- * Constructs a tempo control for the given launch.
- */
- public TempoControl(MidiLaunch launch) {
- super("Tempo (BPM)", launch);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#getValue()
- */
- public String getValue() {
- float bpm = getSequencer().getTempoInBPM();
- return Float.toString(bpm);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable()
- */
- public boolean isEditable() {
- return getSequencer().isOpen();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String)
- */
- public IStatus setValue(String newValue) {
- try {
- float value = getFloat(newValue);
- getSequencer().setTempoInBPM(value);
- fireEvent(new DebugEvent(this, DebugEvent.CHANGE));
- return Status.OK_STATUS;
- } catch (CoreException e) {
- return e.getStatus();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String)
- */
- public IStatus validateValue(String value) {
- try {
- getFloat(value);
- return Status.OK_STATUS;
- } catch (CoreException e) {
- return e.getStatus();
- }
- }
-
- /**
- * Returns a float for the string.
- *
- * @param value string
- * @return float
- * @throws CoreException if not a valid value
- */
- protected float getFloat(String value) throws CoreException {
- try {
- return Float.parseFloat(value);
- } catch (NumberFormatException e) {
- throw new CoreException(new Status(IStatus.ERROR, DebugCorePlugin.PLUGIN_ID, "Tempo must be a number", e));
- }
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
deleted file mode 100644
index 93aa54df4..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/midi/launcher/TimeControl.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.midi.launcher;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Displays a time value based on underlying microsecond value
- *
- * @since 1.0
- */
-public abstract class TimeControl extends SequencerControl {
-
- /**
- * Constructs a time control with the given name for the
- * given launch.
- *
- * @param name
- * @param launch
- */
- public TimeControl(String name, MidiLaunch launch) {
- super(name, launch);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#getValue()
- */
- public String getValue() {
- long position = getTimeValue();
- int milli = (int) (position & 0x3F);
- int sec = (int) (position / 1000000);
- int min = sec / 60;
- sec = sec % 60;
- StringBuffer clock = new StringBuffer();
- clock.append(min);
- while (clock.length() < 2) {
- clock.insert(0, 0);
- }
- clock.append(':');
- clock.append(sec);
- while (clock.length() < 5) {
- clock.insert(3, 0);
- }
- clock.append(':');
- clock.append(milli);
- while (clock.length() < 8) {
- clock.insert(6, 0);
- }
- return clock.toString();
- }
-
- /**
- * Provided by subclasses for the control.
- *
- * @return time in microseconds
- */
- protected abstract long getTimeValue();
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#isEditable()
- */
- public boolean isEditable() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#setValue(java.lang.String)
- */
- public IStatus setValue(String newValue) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.midi.launcher.SequencerControl#validateValue(java.lang.String)
- */
- public IStatus validateValue(String value) {
- return null;
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java
deleted file mode 100644
index be74eb78a..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/DebugCorePlugin.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.*;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class DebugCorePlugin extends Plugin {
- //The shared instance.
- private static DebugCorePlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- /**
- * Unique identifier for the PDA debug model (value
- * <code>pda.debugModel</code>).
- */
- public static final String ID_PDA_DEBUG_MODEL = "pda.debugModel";
-
- /**
- * Name of the string substitution variable that resolves to the
- * location of a local Perl executable (value <code>perlExecutable</code>).
- */
- public static final String VARIALBE_PERL_EXECUTABLE = "perlExecutable";
- /**
- * Launch configuration attribute key. Value is a path to a perl
- * program. The path is a string representing a full path
- * to a perl program in the workspace.
- */
- public static final String ATTR_PDA_PROGRAM = ID_PDA_DEBUG_MODEL + ".ATTR_PDA_PROGRAM";
-
- /**
- * Identifier for the PDA launch configuration type
- * (value <code>pda.launchType</code>)
- */
- public static final String ID_PDA_LAUNCH_CONFIGURATION_TYPE = "pda.launchType";
-
- /**
- * Plug-in identifier.
- */
- public static final String PLUGIN_ID = "org.eclipse.debug.examples.core";
-
- /**
- * The constructor.
- */
- public DebugCorePlugin() {
- super();
- plugin = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- plugin = null;
- resourceBundle = null;
- }
-
- /**
- * Returns the shared instance.
- */
- public static DebugCorePlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = DebugCorePlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- try {
- if (resourceBundle == null)
- resourceBundle = ResourceBundle.getBundle("org.eclipse.debug.examples.core.pda.DebugCorePluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- return resourceBundle;
- }
-
- /**
- * Return a <code>java.io.File</code> object that corresponds to the specified
- * <code>IPath</code> in the plugin directory, or <code>null</code> if none.
- */
- public static File getFileInPlugin(IPath path) {
- try {
- URL installURL =
- new URL(getDefault().getDescriptor().getInstallURL(), path.toString());
- URL localURL = Platform.asLocalURL(installURL);
- return new File(localURL.getFile());
- } catch (IOException ioe) {
- return null;
- }
- }
-}
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
deleted file mode 100644
index 45f2a06b4..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDALineBreakpoint.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.breakpoints;
-
-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;
-import org.eclipse.debug.examples.core.pda.model.IPDAEventListener;
-import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
-import org.eclipse.debug.examples.core.pda.model.PDAThread;
-import org.eclipse.debug.examples.core.pda.protocol.PDAClearBreakpointCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDARunControlEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDASetBreakpointCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDASuspendedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent;
-
-
-/**
- * PDA line breakpoint
- */
-public class PDALineBreakpoint extends LineBreakpoint implements IPDAEventListener {
-
- // target currently installed in
- private PDADebugTarget fTarget;
-
- /**
- * Default constructor is required for the breakpoint manager
- * to re-create persisted breakpoints. After instantiating a breakpoint,
- * the <code>setMarker(...)</code> method is called to restore
- * this breakpoint's attributes.
- */
- public PDALineBreakpoint() {
- }
-
- /**
- * Constructs a line breakpoint on the given resource at the given
- * line number. The line number is 1-based (i.e. the first line of a
- * file is line number 1). The PDA VM uses 0-based line numbers,
- * so this line number translation is done at breakpoint install time.
- *
- * @param resource file on which to set the breakpoint
- * @param lineNumber 1-based line number of the breakpoint
- * @throws CoreException if unable to create the breakpoint
- */
- public PDALineBreakpoint(final IResource resource, final int lineNumber) throws CoreException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.lineBreakpoint");
- 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 + "]");
- }
- };
- run(getMarkerRule(resource), runnable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
- */
- public String getModelIdentifier() {
- return DebugCorePlugin.ID_PDA_DEBUG_MODEL;
- }
-
- /**
- * Returns whether this breakpoint is a run-to-line breakpoint
- *
- * @return whether this breakpoint is a run-to-line breakpoint
- */
- public boolean isRunToLineBreakpoint() {
- return false;
- }
-
- /**
- * Installs this breakpoint in the given interprettor.
- * Registeres this breakpoint as an event listener in the
- * given target and creates the breakpoint specific request.
- *
- * @param target PDA interprettor
- * @throws CoreException if installation fails
- */
- public void install(PDADebugTarget target) throws CoreException {
- fTarget = target;
- target.addEventListener(this);
- createRequest(target);
- }
-
- /**
- * Create the breakpoint specific request in the target. Subclasses
- * should override.
- *
- * @param target PDA interprettor
- * @throws CoreException if request creation fails
- */
- protected void createRequest(PDADebugTarget target) throws CoreException {
- //#ifdef ex3
-//# // TODO: Exercise 3 - create breakpoint request in interpreter
- //#else
- target.sendCommand(new PDASetBreakpointCommand((getLineNumber() - 1), false));
- //#endif
- }
-
- /**
- * Removes this breakpoint's event request from the target. Subclasses
- * should override.
- *
- * @param target PDA interprettor
- * @throws CoreException if clearing the request fails
- */
- protected void clearRequest(PDADebugTarget target) throws CoreException {
- //#ifdef ex3
-//# // TODO: Exercise 3 - clear breakpoint request in interpreter
- //#else
- target.sendCommand(new PDAClearBreakpointCommand((getLineNumber() - 1)));
- //#endif
- }
-
- /**
- * Removes this breakpoint from the given interprettor.
- * Removes this breakpoint as an event listener and clears
- * the request for the interprettor.
- *
- * @param target PDA interprettor
- * @throws CoreException if removal fails
- */
- public void remove(PDADebugTarget target) throws CoreException {
- target.removeEventListener(this);
- clearRequest(target);
- fTarget = null;
-
- }
-
- /**
- * Returns the target this breakpoint is installed in or <code>null</code>.
- *
- * @return the target this breakpoint is installed in or <code>null</code>
- */
- protected PDADebugTarget getDebugTarget() {
- return fTarget;
- }
-
- /**
- * Notify's the PDA interprettor that this breakpoint has been hit.
- */
- protected void notifyThread(int threadId) {
- if (fTarget != null) {
- PDAThread thread = fTarget.getThread(threadId);
- if (thread != null) {
- thread.suspendedBy(this);
- }
- }
- }
-
- /* (non-Javadoc)
- *
- * Subclasses should override to handle their breakpoint specific event.
- *
- * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
- */
- public void handleEvent(PDAEvent event) {
- if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
- PDARunControlEvent rcEvent = (PDARunControlEvent)event;
- if (rcEvent.fReason.equals("breakpoint")) {
- handleHit(rcEvent);
- }
- }
- }
-
- /**
- * Determines if this breakpoint was hit and notifies the thread.
- *
- * @param event breakpoint event
- */
- private void handleHit(PDARunControlEvent event) {
- int lastSpace = event.fMessage.lastIndexOf(' ');
- if (lastSpace > 0) {
- String line = event.fMessage.substring(lastSpace + 1);
- int lineNumber = Integer.parseInt(line);
- // breakpoints event line numbers are 0 based, model objects are 1 based
- lineNumber++;
- try {
- if (getLineNumber() == lineNumber) {
- notifyThread(event.fThreadId);
- }
- } catch (CoreException e) {
- }
- }
- }
-}
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
deleted file mode 100644
index b861fff20..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDARunToLineBreakpoint.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.breakpoints;
-
-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;
-
-/**
- * A run to line breakpoint.
- */
-public class PDARunToLineBreakpoint extends PDALineBreakpoint {
-
- private IFile fSourceFile;
-
- /**
- * Constructs a run-to-line breakpoint in the given PDA program.
- *
- * @param resource PDA source file
- * @param lineNumber line to run to
- * @exception DebugException if unable to create the breakpoint
- */
- public PDARunToLineBreakpoint(final IFile resource, final int lineNumber) throws DebugException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- 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");
- 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);
- }
-
- /**
- * Returns whether this breakpoint is a run-to-line breakpoint
- *
- * @return whether this breakpoint is a run-to-line breakpoint
- */
- public boolean isRunToLineBreakpoint() {
- return true;
- }
-
- /**
- * Returns the source file this breakpoint is contained in.
- *
- * @return the source file this breakpoint is contained in
- */
- public IFile getSourceFile() {
- return fSourceFile;
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
deleted file mode 100644
index f013f8327..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/breakpoints/PDAWatchpoint.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.breakpoints;
-
-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.IWatchpoint;
-import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
-import org.eclipse.debug.examples.core.pda.protocol.PDAEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDARunControlEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDASuspendedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAWatchCommand;
-
-
-/**
- * A watchpoint.
- */
-public class PDAWatchpoint extends PDALineBreakpoint implements IWatchpoint {
-
- // 'read' or 'write' depending on what caused the last suspend for this watchpoint
- private String fLastSuspendType;
-
- // marker attributes
- public static final String ACCESS = "ACCESS";
- public static final String MODIFICATION = "MODIFICATION";
- public static final String FUNCTION_NAME = "FUNCTION_NAME";
- public static final String VAR_NAME = "VAR_NAME";
-
- /**
- * Default constructor is required for the breakpoint manager
- * to re-create persisted breakpoints. After instantiating a breakpoint,
- * the <code>setMarker(...)</code> method is called to restore
- * this breakpoint's attributes.
- */
- public PDAWatchpoint() {
- }
- /**
- * Constructs a line breakpoint on the given resource at the given
- * line number. The line number is 1-based (i.e. the first line of a
- * file is line number 1). The PDA VM uses 0-based line numbers,
- * so this line number translation is done at breakpoint install time.
- *
- * @param resource file on which to set the breakpoint
- * @param lineNumber 1-based line number of the breakpoint
- * @param functionName function name the variable is defined in
- * @param varName variable name that watchpoint is set on
- * @param access whether this is an access watchpoint
- * @param modification whether this in a modification watchpoint
- * @throws CoreException if unable to create the watchpoint
- */
- public PDAWatchpoint(final IResource resource, final int lineNumber, final String functionName, final String varName, final boolean access, final boolean modification) throws CoreException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker = resource.createMarker("org.eclipse.debug.examples.core.pda.markerType.watchpoint");
- setMarker(marker);
- setEnabled(true);
- ensureMarker().setAttribute(IMarker.LINE_NUMBER, lineNumber);
- ensureMarker().setAttribute(IBreakpoint.ID, getModelIdentifier());
- setAccess(access);
- setModification(modification);
- setVariable(functionName, varName);
- marker.setAttribute(IMarker.MESSAGE, "Watchpoint: " + resource.getName() + " [line: " + lineNumber + "]");
- }
- };
- run(getMarkerRule(resource), runnable);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchpoint#isAccess()
- */
- public boolean isAccess() throws CoreException {
- return getMarker().getAttribute(ACCESS, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchpoint#setAccess(boolean)
- */
- public void setAccess(boolean access) throws CoreException {
- setAttribute(ACCESS, access);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchpoint#isModification()
- */
- public boolean isModification() throws CoreException {
- return getMarker().getAttribute(MODIFICATION, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchpoint#setModification(boolean)
- */
- public void setModification(boolean modification) throws CoreException {
- setAttribute(MODIFICATION, modification);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchpoint#supportsAccess()
- */
- public boolean supportsAccess() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IWatchpoint#supportsModification()
- */
- public boolean supportsModification() {
- return true;
- }
-
- /**
- * Sets the variable and function names the watchpoint is set on.
- *
- * @param functionName function name
- * @param variableName variable name
- * @throws CoreException if an exception occurrs setting marker attribtues
- */
- protected void setVariable(String functionName, String variableName) throws CoreException {
- setAttribute(VAR_NAME, variableName);
- setAttribute(FUNCTION_NAME, functionName);
- }
-
- /**
- * Returns the name of the variable this watchpoint is set on.
- *
- * @return the name of the variable this watchpoint is set on
- * @throws CoreException if unable to access the attribute
- */
- public String getVariableName() throws CoreException {
- return getMarker().getAttribute(VAR_NAME, (String)null);
- }
-
- /**
- * Returns the name of the function the variable associted with this watchpoint is defined in.
- *
- * @return the name of the function the variable associted with this watchpoint is defined in
- * @throws CoreException if unable to access the attribute
- */
- public String getFunctionName() throws CoreException {
- return getMarker().getAttribute(FUNCTION_NAME, (String)null);
- }
-
- /**
- * Sets the type of event that causes the last suspend event.
- *
- * @param description one of 'read' or 'write'
- */
- public void setSuspendType(String description) {
- fLastSuspendType = description;
- }
-
- /**
- * Returns the type of event that caused the last suspend.
- *
- * @return 'read', 'write', or <code>null</code> if undefined
- */
- public String getSuspendType() {
- return fLastSuspendType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint#createRequest(org.eclipse.debug.examples.core.pda.model.PDADebugTarget)
- */
- protected void createRequest(PDADebugTarget target) throws CoreException {
- int flag = 0;
- if (isAccess()) {
- flag = flag | 1;
- }
- if (isModification()) {
- flag = flag | 2;
- }
- target.sendCommand(new PDAWatchCommand(getFunctionName(), getVariableName(), flag));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint#clearRequest(org.eclipse.debug.examples.core.pda.model.PDADebugTarget)
- */
- protected void clearRequest(PDADebugTarget target) throws CoreException {
- target.sendCommand(new PDAWatchCommand(getFunctionName(), getVariableName(), 0));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
- */
- public void handleEvent(PDAEvent event) {
- if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
- PDARunControlEvent rcEvent = (PDARunControlEvent)event;
- if (rcEvent.fReason.equals("watch")) {
- handleHit(rcEvent);
- }
- }
- }
-
- /**
- * Determines if this breakpoint was hit and notifies the thread.
- *
- * @param event breakpoint event
- */
- private void handleHit(PDARunControlEvent event) {
- String[] strings = event.fMessage.split(" ");
- if (strings.length == 4) {
- String fv = strings[3];
- int j = fv.indexOf("::");
- if (j > 0) {
- String fcn = fv.substring(0, j);
- String var = fv.substring(j + 2);
- try {
- if (getVariableName().equals(var) && getFunctionName().equals(fcn)) {
- setSuspendType(strings[2]);
- notifyThread(event.fThreadId);
- }
- } catch (CoreException e) {
- }
- }
- }
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
deleted file mode 100644
index cebc2091f..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/launcher/PDALaunchDelegate.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.launcher;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-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.Path;
-import org.eclipse.core.runtime.Status;
-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.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
-import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
-
-
-/**
- * Launches PDA program on a PDA interpretter written in Perl
- */
-public class PDALaunchDelegate extends LaunchConfigurationDelegate {
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- //#ifdef ex1
-//# // TODO: Exercise 1 - Launch a command shell as a system process to echo "foo"
- //#elseif ex1_answer
-//# Process process = DebugPlugin.exec(new String[]{"cmd", "/C", "\"echo foo\""}, null);
-//# new RuntimeProcess(launch, process, "Hello", null);
- //#else
-
- List commandList = new ArrayList();
-
- // Get Java VM path
- String javaVMHome = System.getProperty("java.home");
- String javaVMExec = javaVMHome + File.separatorChar + "bin" + File.separatorChar + "java";
- if (File.separatorChar == '\\') {
- javaVMExec += ".exe";
- }
- File exe = new File(javaVMExec);
- if (!exe.exists()) {
- abort(MessageFormat.format("Specified java VM executable {0} does not exist.", new Object[]{javaVMExec}), null);
- }
- commandList.add(javaVMExec);
-
- commandList.add("-cp");
- commandList.add(File.pathSeparator + DebugCorePlugin.getFileInPlugin(new Path("bin")));
-
- commandList.add("org.eclipse.debug.examples.pdavm.PDAVirtualMachine");
-
- // program name
- String program = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
- if (program == null) {
- abort("Perl program unspecified.", null);
- }
-
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(program));
- if (!file.exists()) {
- abort(MessageFormat.format("Perl program {0} does not exist.", new String[] {file.getFullPath().toString()}), null);
- }
-
- commandList.add(file.getLocation().toOSString());
-
- // if in debug mode, add debug arguments - i.e. '-debug requestPort eventPort'
- int requestPort = -1;
- int eventPort = -1;
- if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- requestPort = findFreePort();
- eventPort = findFreePort();
- if (requestPort == -1 || eventPort == -1) {
- abort("Unable to find free port", null);
- }
- commandList.add("-debug");
- commandList.add("" + requestPort);
- commandList.add("" + eventPort);
- }
-
- String[] commandLine = (String[]) commandList.toArray(new String[commandList.size()]);
- Process process = DebugPlugin.exec(commandLine, null);
- IProcess p = DebugPlugin.newProcess(launch, process, javaVMExec);
- // if in debug mode, create a debug target
- if (mode.equals(ILaunchManager.DEBUG_MODE)) {
- IDebugTarget target = new PDADebugTarget(launch, p, requestPort, eventPort);
- launch.addDebugTarget(target);
- }
- //#endif
- }
-
- /**
- * Throws an exception with a new status containing the given
- * message and optional exception.
- *
- * @param message error message
- * @param e underlying exception
- * @throws CoreException
- */
- private void abort(String message, Throwable e) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, DebugCorePlugin.getDefault().getDescriptor().getUniqueIdentifier(), 0, message, e));
- }
-
- /**
- * Returns a free port number on localhost, or -1 if unable to find a free port.
- *
- * @return a free port number on localhost, or -1 if unable to find a free port
- */
- public static int findFreePort() {
- ServerSocket socket= null;
- try {
- socket= new ServerSocket(0);
- return socket.getLocalPort();
- } catch (IOException e) {
- } finally {
- if (socket != null) {
- try {
- socket.close();
- } catch (IOException e) {
- }
- }
- }
- return -1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#buildForLaunch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
- */
- public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
- return false;
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/IPDAEventListener.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/IPDAEventListener.java
deleted file mode 100644
index 257c4185e..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/IPDAEventListener.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.debug.examples.core.pda.protocol.PDAEvent;
-
-/**
- * Listeners are notified of events occurring in a PDA program
- * being interpreted.
- *
- * @see org.eclipse.debug.examples.core.protocol.PDAVMStarted
- * @see org.eclipse.debug.examples.core.protocol.PDAVMTerminated
- * @see org.eclipse.debug.examples.core.protocol.PDAVMSuspneded
- * @see org.eclipse.debug.examples.core.protocol.PDAVMResumed
- * @see org.eclipse.debug.examples.core.protocol.PDAStarted
- * @see org.eclipse.debug.examples.core.protocol.PDAExited
- * @see org.eclipse.debug.examples.core.protocol.PDASuspended
- * @see org.eclipse.debug.examples.core.protocol.PDAResumed
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAUnimplementedInstructionEvent
- * @see org.eclipse.debug.examples.core.pda.protocol.PDARegisterData
- * @see org.eclipse.debug.examples.core.pda.protocol.PDANoSuchLabelEvent
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAEvalResultEvent
- */
-public interface IPDAEventListener {
-
- /**
- * Notification the given event occurred in the target program
- * being interpreted.
- *
- * @param event the event
- */
- public void handleEvent(PDAEvent event);
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java
deleted file mode 100644
index bcc07ba35..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArray.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IVariable;
-
-public class PDAArray extends PDAValue {
-
- /**
- * An array splits a value into its words
- *
- * @param value existing value
- * @throws DebugException
- */
- public PDAArray(PDAValue value) throws DebugException {
- super(value.getVariable(), value.getValueString());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#hasVariables()
- */
- public boolean hasVariables() throws DebugException {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#getVariables()
- */
- public IVariable[] getVariables() throws DebugException {
- String string = getValueString();
- String[] words = string.split("\\W+");
- IVariable[] variables = new IVariable[words.length];
- for (int i = 0; i < words.length; i++) {
- String word = words[i];
- variables[i] = new PDAArrayEntry(getPDADebugTarget(), i, new PDAValue(getVariable(), word));
- }
- return variables;
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java
deleted file mode 100644
index 9ff3ca74e..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAArrayEntry.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-
-public class PDAArrayEntry extends PDADebugElement implements IVariable {
-
- private IValue fValue;
- private int fIndex;
-
- /**
- * Constructs a new array entry
- *
- * @param target debug target
- * @param index index in the array
- * @param value value of the entry
- */
- public PDAArrayEntry(IDebugTarget target, int index, IValue value) {
- super(target);
- fValue = value;
- fIndex = index;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#getValue()
- */
- public IValue getValue() throws DebugException {
- return fValue;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#getName()
- */
- public String getName() throws DebugException {
- return "[" + fIndex + "]";
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
- */
- public String getReferenceTypeName() throws DebugException {
- return "String";
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
- */
- public boolean hasValueChanged() throws DebugException {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
- */
- public void setValue(String expression) throws DebugException {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
- */
- public void setValue(IValue value) throws DebugException {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
- */
- public boolean supportsValueModification() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
- */
- public boolean verifyValue(String expression) throws DebugException {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
- */
- public boolean verifyValue(IValue value) throws DebugException {
- return false;
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
deleted file mode 100644
index fb854ba15..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugElement.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.DebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
-import org.eclipse.debug.examples.core.pda.protocol.PDACommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDACommandResult;
-
-
-/**
- * Common function for PDA debug elements.
- */
-public class PDADebugElement extends DebugElement {
-
- /**
- * Constructs a new debug element in the given target.
- *
- * @param target debug target
- */
- public PDADebugElement(IDebugTarget target) {
- super(target);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
- */
- public String getModelIdentifier() {
- return DebugCorePlugin.ID_PDA_DEBUG_MODEL;
- }
-
- /**
- * Sends a request to the PDA interpreter, waits for and returns the reply.
- *
- * @param request command
- * @return reply
- * @throws DebugException if the request fails
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDATerminateCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVMResumeCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASuspendCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAResumeCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStepCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDADropFrameCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetBreakpointCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAClearBreakpointCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAWatchCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDADataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetDataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAPopDataCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAPushDataCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAEvalCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAEventStopCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAStackDepthCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAFrameCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDASetVarCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAVarCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAChildrenCommand
- *
- * @see org.eclipse.debug.examples.core.pda.protocol.PDAGroupsCommand
- * @see org.eclipse.debug.examples.core.pda.protocol.PDARegistersCommand
- *
- * @since 3.5
- */
- public PDACommandResult sendCommand(PDACommand command) throws DebugException {
- return getPDADebugTarget().sendCommand(command);
- }
-
- /**
- * Returns the debug target as a PDA target.
- *
- * @return PDA debug target
- */
- protected PDADebugTarget getPDADebugTarget() {
- return (PDADebugTarget) getDebugTarget();
- }
-
- /**
- * Returns the breakpoint manager
- *
- * @return the breakpoint manager
- */
- protected IBreakpointManager getBreakpointManager() {
- return DebugPlugin.getDefault().getBreakpointManager();
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
deleted file mode 100644
index 92a5a9955..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDADebugTarget.java
+++ /dev/null
@@ -1,582 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.resources.IResource;
-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.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.IBreakpointManagerListener;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
-import org.eclipse.debug.examples.core.pda.breakpoints.PDALineBreakpoint;
-import org.eclipse.debug.examples.core.pda.breakpoints.PDARunToLineBreakpoint;
-import org.eclipse.debug.examples.core.pda.protocol.PDACommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDACommandResult;
-import org.eclipse.debug.examples.core.pda.protocol.PDAEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAEventStopCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAExitedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDARestartCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAStartedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDATerminateCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMResumeCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMResumedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMStartedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMTerminatedEvent;
-
-
-/**
- * PDA Debug Target
- */
-public class PDADebugTarget extends PDADebugElement implements IDebugTarget, IBreakpointManagerListener, IPDAEventListener {
-
- // associated system process (VM)
- private IProcess fProcess;
-
- // containing launch object
- private ILaunch fLaunch;
-
- // sockets to communicate with VM
- private Socket fRequestSocket;
- private PrintWriter fRequestWriter;
- private BufferedReader fRequestReader;
- private Socket fEventSocket;
- private BufferedReader fEventReader;
-
- // suspended state
- private boolean fVMSuspended = false;
-
- // terminated state
- private boolean fTerminated = false;
-
- // threads
- private Map fThreads = Collections.synchronizedMap(new LinkedHashMap());
-
- // event dispatch job
- private EventDispatchJob fEventDispatch;
-
- // event listeners
- private List fEventListeners = Collections.synchronizedList(new ArrayList());
-
- /**
- * Listens to events from the PDA VM and fires corresponding
- * debug events.
- */
- class EventDispatchJob extends Job {
-
- public EventDispatchJob() {
- super("PDA Event Dispatch");
- setSystem(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- String message = "";
- while (!isTerminated() && message != null) {
- try {
- message = fEventReader.readLine();
- if (message != null) {
- PDAEvent event = null;
- try {
- event = PDAEvent.parseEvent(message);
- }
- catch (IllegalArgumentException e) {
- DebugCorePlugin.getDefault().getLog().log(
- new Status (IStatus.ERROR, "org.eclipse.debug.examples.core", "Error parsing PDA event", e));
- continue;
- }
- Object[] listeners = fEventListeners.toArray();
- for (int i = 0; i < listeners.length; i++) {
- ((IPDAEventListener)listeners[i]).handleEvent(event);
- }
- }
- } catch (IOException e) {
- vmTerminated();
- }
- }
- return Status.OK_STATUS;
- }
-
- }
-
- /**
- * Registers the given event listener. The listener will be notified of
- * events in the program being interpretted. Has no effect if the listener
- * is already registered.
- *
- * @param listener event listener
- */
- public void addEventListener(IPDAEventListener listener) {
- synchronized(fEventListeners) {
- if (!fEventListeners.contains(listener)) {
- fEventListeners.add(listener);
- }
- }
- }
-
- /**
- * Deregisters the given event listener. Has no effect if the listener is
- * not currently registered.
- *
- * @param listener event listener
- */
- public void removeEventListener(IPDAEventListener listener) {
- fEventListeners.remove(listener);
- }
-
- /**
- * Constructs a new debug target in the given launch for the
- * associated PDA VM process.
- *
- * @param launch containing launch
- * @param process PDA VM
- * @param requestPort port to send requests to the VM
- * @param eventPort port to read events from
- * @exception CoreException if unable to connect to host
- */
- public PDADebugTarget(ILaunch launch, IProcess process, int requestPort, int eventPort) throws CoreException {
- super(null);
- fLaunch = launch;
- fProcess = process;
- addEventListener(this);
- try {
- // give interpreter a chance to start
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- fRequestSocket = new Socket("localhost", requestPort);
- fRequestWriter = new PrintWriter(fRequestSocket.getOutputStream());
- fRequestReader = new BufferedReader(new InputStreamReader(fRequestSocket.getInputStream()));
- // give interpreter a chance to open next socket
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- fEventSocket = new Socket("localhost", eventPort);
- fEventReader = new BufferedReader(new InputStreamReader(fEventSocket.getInputStream()));
- } catch (UnknownHostException e) {
- requestFailed("Unable to connect to PDA VM", e);
- } catch (IOException e) {
- requestFailed("Unable to connect to PDA VM", e);
- }
- fEventDispatch = new EventDispatchJob();
- fEventDispatch.schedule();
- IBreakpointManager breakpointManager = getBreakpointManager();
- breakpointManager.addBreakpointListener(this);
- breakpointManager.addBreakpointManagerListener(this);
- // initialize error hanlding to suspend on 'unimplemented instructions'
- // and 'no such label' errors
- sendCommand(new PDAEventStopCommand(PDAEventStopCommand.UNIMPINSTR, true));
- sendCommand(new PDAEventStopCommand(PDAEventStopCommand.NOSUCHLABEL, true));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugTarget#getProcess()
- */
- public IProcess getProcess() {
- return fProcess;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
- */
- public IThread[] getThreads() throws DebugException {
- synchronized (fThreads) {
- return (IThread[])fThreads.values().toArray(new IThread[fThreads.size()]);
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugTarget#hasThreads()
- */
- public boolean hasThreads() throws DebugException {
- return fThreads.size() > 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugTarget#getName()
- */
- public String getName() throws DebugException {
- return "PDA";
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint)
- */
- public boolean supportsBreakpoint(IBreakpoint breakpoint) {
- if (!isTerminated() && breakpoint.getModelIdentifier().equals(getModelIdentifier())) {
- try {
- String program = getLaunch().getLaunchConfiguration().getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
- if (program != null) {
- IResource resource = null;
- if (breakpoint instanceof PDARunToLineBreakpoint) {
- PDARunToLineBreakpoint rtl = (PDARunToLineBreakpoint) breakpoint;
- resource = rtl.getSourceFile();
- } else {
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- resource = marker.getResource();
- }
- }
- if (resource != null) {
- IPath p = new Path(program);
- return resource.getFullPath().equals(p);
- }
- }
- } catch (CoreException e) {
- }
- }
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
- */
- public IDebugTarget getDebugTarget() {
- return this;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
- */
- public ILaunch getLaunch() {
- return fLaunch;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
- */
- public boolean canTerminate() {
- return getProcess().canTerminate();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
- */
- public synchronized boolean isTerminated() {
- return fTerminated || getProcess().isTerminated();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#terminate()
- */
- public void terminate() throws DebugException {
-//#ifdef ex2
-//# // TODO: Exercise 2 - send termination request to interpreter
-//#else
- sendCommand(new PDATerminateCommand());
-//#endif
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
- */
- public boolean canResume() {
- return !isTerminated() && isSuspended();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
- */
- public boolean canSuspend() {
- return !isTerminated() && !isSuspended();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
- */
- public synchronized boolean isSuspended() {
- return !isTerminated() && fVMSuspended;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#resume()
- */
- public void resume() throws DebugException {
- sendCommand(new PDAVMResumeCommand());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
- */
- public void suspend() throws DebugException {
- sendCommand(new PDAVMSuspendCommand());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointListener#breakpointAdded(org.eclipse.debug.core.model.IBreakpoint)
- */
- public void breakpointAdded(IBreakpoint breakpoint) {
- if (supportsBreakpoint(breakpoint)) {
- try {
- if ((breakpoint.isEnabled() && getBreakpointManager().isEnabled()) || !breakpoint.isRegistered()) {
- PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
- pdaBreakpoint.install(this);
- }
- } catch (CoreException e) {
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointListener#breakpointRemoved(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
- */
- public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
- if (supportsBreakpoint(breakpoint)) {
- try {
- PDALineBreakpoint pdaBreakpoint = (PDALineBreakpoint)breakpoint;
- pdaBreakpoint.remove(this);
- } catch (CoreException e) {
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.resources.IMarkerDelta)
- */
- public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
- if (supportsBreakpoint(breakpoint)) {
- try {
- if (breakpoint.isEnabled() && getBreakpointManager().isEnabled()) {
- breakpointAdded(breakpoint);
- } else {
- breakpointRemoved(breakpoint, null);
- }
- } catch (CoreException e) {
- }
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDisconnect#canDisconnect()
- */
- public boolean canDisconnect() {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDisconnect#disconnect()
- */
- public void disconnect() throws DebugException {
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDisconnect#isDisconnected()
- */
- public boolean isDisconnected() {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#supportsStorageRetrieval()
- */
- public boolean supportsStorageRetrieval() {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
- */
- public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
- return null;
- }
-
- /**
- * Notification we have connected to the VM and it has started.
- * Resume the VM.
- */
- private void vmStarted(PDAVMStartedEvent event) {
- fireCreationEvent();
- installDeferredBreakpoints();
- try {
- resume();
- } catch (DebugException e) {
- }
- }
-
- /**
- * Install breakpoints that are already registered with the breakpoint
- * manager.
- */
- private void installDeferredBreakpoints() {
- IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getModelIdentifier());
- for (int i = 0; i < breakpoints.length; i++) {
- breakpointAdded(breakpoints[i]);
- }
- }
-
- /**
- * Called when this debug target terminates.
- */
- private void vmTerminated() {
- setTerminated(true);
- fThreads.clear();
- IBreakpointManager breakpointManager = getBreakpointManager();
- breakpointManager.removeBreakpointListener(this);
- breakpointManager.removeBreakpointManagerListener(this);
- fireTerminateEvent();
- removeEventListener(this);
- }
-
- private void vmResumed(PDAVMResumedEvent event) {
- setVMSuspended(false);
- fireResumeEvent(calcDetail(event.fReason));
- }
-
- private void vmSuspended(PDAVMSuspendedEvent event) {
- setVMSuspended(true);
- fireSuspendEvent(calcDetail(event.fReason));
- }
-
- private int calcDetail(String reason) {
- if (reason.equals("breakpoint") || reason.equals("watch")) {
- return DebugEvent.BREAKPOINT;
- } else if (reason.equals("step")) {
- return DebugEvent.STEP_OVER;
- } else if (reason.equals("drop")) {
- return DebugEvent.STEP_RETURN;
- } else if (reason.equals("client")) {
- return DebugEvent.CLIENT_REQUEST;
- } else if (reason.equals("event")) {
- return DebugEvent.BREAKPOINT;
- } else {
- return DebugEvent.UNSPECIFIED;
- }
- }
-
- private void started(PDAStartedEvent event) {
- PDAThread newThread = new PDAThread(this, event.fThreadId);
- fThreads.put(new Integer(event.fThreadId), newThread);
- newThread.start();
- }
-
- private void exited(PDAExitedEvent event) {
- PDAThread thread = (PDAThread)fThreads.remove(new Integer(event.fThreadId));
- if (thread != null) {
- thread.exit();
- }
- }
-
- private synchronized void setVMSuspended(boolean suspended) {
- fVMSuspended = suspended;
- }
-
- private synchronized void setTerminated(boolean terminated) {
- fTerminated = terminated;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.pda.model.PDADebugElement#sendRequest(java.lang.String)
- */
- private String sendRequest(String request) throws DebugException {
- synchronized (fRequestSocket) {
- fRequestWriter.println(request);
- fRequestWriter.flush();
- try {
- // wait for reply
- String retVal = fRequestReader.readLine();
- if (retVal == null) {
- requestFailed("Request failed: " + request + ". Debugger connection closed.", null);
- }
- return retVal;
- } catch (IOException e) {
- requestFailed("Request failed: " + request, e);
- }
- }
- // Should never reach this satement.
- return null;
- }
-
- public PDACommandResult sendCommand(PDACommand command) throws DebugException {
- String response = sendRequest(command.getRequest());
- return command.createResult(response);
- }
-
- /**
- * When the breakpoint manager disables, remove all registered breakpoints
- * requests from the VM. When it enables, reinstall them.
- */
- public void breakpointManagerEnablementChanged(boolean enabled) {
- IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getModelIdentifier());
- for (int i = 0; i < breakpoints.length; i++) {
- if (enabled) {
- breakpointAdded(breakpoints[i]);
- } else {
- breakpointRemoved(breakpoints[i], null);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
- */
- public void handleEvent(PDAEvent event) {
- if (event instanceof PDAStartedEvent) {
- started((PDAStartedEvent)event);
- } else if (event instanceof PDAExitedEvent) {
- exited((PDAExitedEvent)event);
- } else if (event instanceof PDAVMStartedEvent) {
- vmStarted((PDAVMStartedEvent)event);
- } else if (event instanceof PDAVMTerminatedEvent) {
- vmTerminated();
- } else if (event instanceof PDAVMSuspendedEvent) {
- vmSuspended((PDAVMSuspendedEvent)event);
- } else if (event instanceof PDAVMResumedEvent) {
- vmResumed((PDAVMResumedEvent)event);
- }
- }
-
- /**
- * Returns this debug target's single thread, or <code>null</code>
- * if terminated.
- *
- * @param threadId ID of the thread to return, or <code>0</code>
- * to return the first available thread
- * @return this debug target's single thread, or <code>null</code>
- * if terminated
- */
- public PDAThread getThread(int threadId) {
- if (threadId > 0) {
- return (PDAThread)fThreads.get(new Integer(threadId));
- } else {
- synchronized(fThreads) {
- if (fThreads.size() > 0) {
- return (PDAThread)fThreads.values().iterator().next();
- }
- }
- }
- return null;
- }
-
- /**
- * Restarts the current debug session
- *
- * @throws DebugException
- */
- public void restart() throws DebugException {
- sendCommand(new PDARestartCommand());
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
deleted file mode 100644
index b235690f3..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackFrame.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IRegisterGroup;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.debug.examples.core.pda.protocol.PDAFrameData;
-
-/**
- * PDA stack frame.
- */
-public class PDAStackFrame extends PDADebugElement implements IStackFrame {
-
- private PDAThread fThread;
- private String fName;
- private int fPC;
- private IPath fFilePath;
- private int fId;
-
- /**
- * Constructs a stack frame in the given thread with the given
- * frame data.
- *
- * @param thread
- * @param data frame data
- * @param id stack frame id (0 is the bottom of the stack)
- */
- public PDAStackFrame(PDAThread thread, PDAFrameData data, int id) {
- super(thread.getPDADebugTarget());
- fId = id;
- fThread = thread;
- init(data);
- }
-
- /**
- * Initializes this frame based on its data
- *
- * @param data
- */
- private void init(PDAFrameData data) {
- fFilePath = data.fFilePath;
- fPC = data.fPC + 1;
- fName = data.fFunction;
- IVariable[] vars = new IVariable[data.fVariables.length];
- for (int i = 0; i < data.fVariables.length; i++) {
- vars[i] = new PDAVariable(this, data.fVariables[i]);
- }
- fThread.setVariables(this, vars);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#getThread()
- */
- public IThread getThread() {
- return fThread;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#getVariables()
- */
- public IVariable[] getVariables() throws DebugException {
- return fThread.getVariables(this);
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#hasVariables()
- */
- public boolean hasVariables() throws DebugException {
- return getVariables().length > 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber()
- */
- public int getLineNumber() throws DebugException {
- return fPC;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#getCharStart()
- */
- public int getCharStart() throws DebugException {
- return -1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd()
- */
- public int getCharEnd() throws DebugException {
- return -1;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#getName()
- */
- public String getName() throws DebugException {
- return fName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups()
- */
- public IRegisterGroup[] getRegisterGroups() throws DebugException {
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups()
- */
- public boolean hasRegisterGroups() throws DebugException {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepInto()
- */
- public boolean canStepInto() {
- return getThread().canStepInto();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepOver()
- */
- public boolean canStepOver() {
- return getThread().canStepOver();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepReturn()
- */
- public boolean canStepReturn() {
- return getThread().canStepReturn();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#isStepping()
- */
- public boolean isStepping() {
- return getThread().isStepping();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepInto()
- */
- public void stepInto() throws DebugException {
- getThread().stepInto();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepOver()
- */
- public void stepOver() throws DebugException {
- getThread().stepOver();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepReturn()
- */
- public void stepReturn() throws DebugException {
- getThread().stepReturn();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
- */
- public boolean canResume() {
- return getThread().canResume();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
- */
- public boolean canSuspend() {
- return getThread().canSuspend();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
- */
- public boolean isSuspended() {
- return getThread().isSuspended();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#resume()
- */
- public void resume() throws DebugException {
- getThread().resume();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
- */
- public void suspend() throws DebugException {
- getThread().suspend();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
- */
- public boolean canTerminate() {
- return getThread().canTerminate();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
- */
- public boolean isTerminated() {
- return getThread().isTerminated();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#terminate()
- */
- public void terminate() throws DebugException {
- getThread().terminate();
- }
-
- /**
- * Returns the name of the source file this stack frame is associated
- * with.
- *
- * @return the name of the source file this stack frame is associated
- * with
- */
- public String getSourceName() {
- return fFilePath.lastSegment();
- }
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof PDAStackFrame) {
- PDAStackFrame sf = (PDAStackFrame)obj;
- return sf.getThread().equals(getThread()) &&
- sf.getSourceName().equals(getSourceName()) &&
- sf.fId == fId;
- }
- return false;
- }
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getSourceName().hashCode() + fId;
- }
-
- /**
- * Returns this stack frame's unique identifier within its thread
- *
- * @return this stack frame's unique identifier within its thread
- */
- protected int getIdentifier() {
- return fId;
- }
-
- /**
- * Returns the stack frame's thread's unique identifier
- *
- * @return this stack frame's thread's unique identifier
- *
- * @since 3.5
- */
- protected int getThreadIdentifier() {
- return fThread.getIdentifier();
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
deleted file mode 100644
index a7909d485..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAStackValue.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-
-/**
- * A value on the data stack
- */
-public class PDAStackValue extends PDADebugElement implements IValue {
-
- final private PDAThread fThread;
- final private String fValue;
- final private int fIndex;
-
- /**
- * Constructs a value that appears on the data stack
- *
- * @param target debug target
- * @param value value on the stack
- * @param index index on the stack
- */
- public PDAStackValue(PDAThread thread, String value, int index) {
- super(thread.getDebugTarget());
- fThread = thread;
- fValue = value;
- fIndex = index;
- }
-
- public PDAThread getThread() {
- return fThread;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#getValueString()
- */
- public String getValueString() throws DebugException {
- return fValue;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#isAllocated()
- */
- public boolean isAllocated() throws DebugException {
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#getVariables()
- */
- public IVariable[] getVariables() throws DebugException {
- return new IVariable[0];
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#hasVariables()
- */
- public boolean hasVariables() throws DebugException {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
- */
- public String getReferenceTypeName() throws DebugException {
- return null;
- }
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return obj instanceof PDAStackValue &&
- ((PDAStackValue)obj).fValue.equals(fValue) &&
- ((PDAStackValue)obj).fIndex == fIndex;
- }
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return super.hashCode() + fIndex;
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
deleted file mode 100644
index 8d92f129c..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAThread.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.debug.examples.core.pda.protocol.PDADataCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDADropFrameCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAListResult;
-import org.eclipse.debug.examples.core.pda.protocol.PDANoSuchLabelEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAPopDataCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAPushDataCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAResumeCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAResumedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDARunControlEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAStackCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAStackCommandResult;
-import org.eclipse.debug.examples.core.pda.protocol.PDAStepCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDASuspendCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDASuspendedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAUnimplementedInstructionEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMResumedEvent;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVMSuspendedEvent;
-
-/**
- * A PDA thread. A PDA VM is single threaded.
- */
-public class PDAThread extends PDADebugElement implements IThread, IPDAEventListener {
-
- /**
- * ID of this thread as reported by PDA.
- */
- private final int fThreadId;
-
- /**
- * Breakpoint this thread is suspended at or <code>null</code>
- * if none.
- */
- private IBreakpoint fBreakpoint;
-
- /**
- * Whether this thread is stepping
- */
- private boolean fStepping = false;
-
- /**
- * Whether this thread is suspended
- */
- private boolean fSuspended = false;
-
- /**
- * Most recent error event or <code>null</code>
- */
- private String fErrorEvent;
-
- /**
- * Table mapping stack frames to current variables
- */
- private Map fVariables = Collections.synchronizedMap(new HashMap());
-
- /**
- * Constructs a new thread for the given target
- *
- * @param target VM
- */
- public PDAThread(PDADebugTarget target, int threadId) {
- super(target);
- fThreadId = threadId;
- }
-
- /**
- * Called by the debug target after the thread is created.
- *
- * @since 3.5
- */
- void start() {
- fireCreationEvent();
- getPDADebugTarget().addEventListener(this);
- }
-
- /**
- * Called by the debug target before the thread is removed.
- *
- * @since 3.5
- */
- void exit() {
- getPDADebugTarget().removeEventListener(this);
- fireTerminateEvent();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getStackFrames()
- */
- public IStackFrame[] getStackFrames() throws DebugException {
- if (isSuspended()) {
- PDAStackCommandResult result = (PDAStackCommandResult)sendCommand(new PDAStackCommand(fThreadId));
- IStackFrame[] frames = new IStackFrame[result.fFrames.length];
- for (int i = 0; i < result.fFrames.length; i++) {
- frames[frames.length - i - 1] = new PDAStackFrame(this, result.fFrames[i], i);
- }
- return frames;
- }
- return new IStackFrame[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#hasStackFrames()
- */
- public boolean hasStackFrames() throws DebugException {
- return isSuspended();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getPriority()
- */
- public int getPriority() throws DebugException {
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
- */
- public IStackFrame getTopStackFrame() throws DebugException {
- IStackFrame[] frames = getStackFrames();
- if (frames.length > 0) {
- return frames[0];
- }
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getName()
- */
- public String getName() {
- return "Main thread";
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
- */
- public synchronized IBreakpoint[] getBreakpoints() {
- if (fBreakpoint == null) {
- return new IBreakpoint[0];
- }
- return new IBreakpoint[]{fBreakpoint};
- }
-
- /**
- * Notifies this thread it has been suspended by the given breakpoint.
- *
- * @param breakpoint breakpoint
- */
- public synchronized void suspendedBy(IBreakpoint breakpoint) {
- fBreakpoint = breakpoint;
- suspended(DebugEvent.BREAKPOINT);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
- */
- public boolean canResume() {
- return isSuspended() && !getDebugTarget().isSuspended();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
- */
- public boolean canSuspend() {
- return !isSuspended();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
- */
- public boolean isSuspended() {
- if (getDebugTarget().isTerminated()) {
- return false;
- }
- if (getDebugTarget().isSuspended()) {
- return true;
- }
- synchronized (this) {
- return fSuspended;
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#resume()
- */
- public void resume() throws DebugException {
- //#ifdef ex2
-//# // TODO: Exercise 2 - send resume request to interpreter
- //#else
- sendCommand(new PDAResumeCommand(fThreadId));
- //#endif
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
- */
- public void suspend() throws DebugException {
- //#ifdef ex2
-//# // TODO: Exercise 2 - send suspend request to interpreter
- //#else
- sendCommand(new PDASuspendCommand(fThreadId));
- //#endif
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepInto()
- */
- public boolean canStepInto() {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepOver()
- */
- public boolean canStepOver() {
- return isSuspended();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepReturn()
- */
- public boolean canStepReturn() {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#isStepping()
- */
- public boolean isStepping() {
- return fStepping;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepInto()
- */
- public void stepInto() throws DebugException {
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepOver()
- */
- public void stepOver() throws DebugException {
- sendCommand(new PDAStepCommand(fThreadId));
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepReturn()
- */
- public void stepReturn() throws DebugException {
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
- */
- public boolean canTerminate() {
- return !isTerminated();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
- */
- public boolean isTerminated() {
- return getDebugTarget().isTerminated();
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#terminate()
- */
- public void terminate() throws DebugException {
- getDebugTarget().terminate();
- }
-
- /**
- * Sets whether this thread is stepping
- *
- * @param stepping whether stepping
- */
- private synchronized void setStepping(boolean stepping) {
- fStepping = stepping;
- }
-
- /**
- * Sets whether this thread is suspended
- *
- * @param suspended whether suspended
- */
- private synchronized void setSuspended(boolean suspended) {
- fSuspended = suspended;
- }
-
- /**
- * Sets the most recent error event encountered, or <code>null</code>
- * to clear the most recent error
- *
- * @param event one of 'unimpinstr' or 'nosuchlabel' or <code>null</code>
- */
- private synchronized void setError(String event) {
- fErrorEvent = event;
- }
-
- /**
- * Returns the most recent error event encountered since the last
- * suspend, or <code>null</code> if none.
- *
- * @return the most recent error event encountered since the last
- * suspend, or <code>null</code> if none
- */
- public Object getError() {
- return fErrorEvent;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.examples.core.pda.model.IPDAEventListener#handleEvent(java.lang.String)
- */
- public void handleEvent(PDAEvent _event) {
- if (_event instanceof PDARunControlEvent && fThreadId == ((PDARunControlEvent)_event).fThreadId) {
- PDARunControlEvent event = (PDARunControlEvent)_event;
- // clear previous state
- fBreakpoint = null;
- setStepping(false);
-
- // handle events
- if (event instanceof PDAResumedEvent || event instanceof PDAVMResumedEvent) {
- setSuspended(false);
- if ("step".equals(event.fReason)) {
- setStepping(true);
- resumed(DebugEvent.STEP_OVER);
- //#ifdef ex2
- //# }
- //# // TODO: Exercise 2 - handle/fire "client" resume event
- //#else
- } else if ("client".equals(event.fReason)) {
- resumed(DebugEvent.CLIENT_REQUEST);
- }
- //#endif
- //#ifdef ex5
- //# // TODO: Exercise 5 - handle start of drop event
- //#else
- else if ("drop".equals(event.fReason)) {
- resumed(DebugEvent.STEP_RETURN);
- }
- //#endif
- } else if (event instanceof PDASuspendedEvent || event instanceof PDAVMSuspendedEvent) {
- setSuspended(true);
- //#ifdef ex2
- //# // TODO: Exercise 2 - handle/fire "client" suspend event
- //# if (event.endsWith("step")) {
- //# suspended(DebugEvent.STEP_END);
- //# } else if (event.startsWith("suspended event") && getError() != null) {
- //# exceptionHit();
- //# }
- //#else
- if ("client".equals(event.fReason)) {
- suspended(DebugEvent.CLIENT_REQUEST);
- } else if ("step".equals(event.fReason)) {
- suspended(DebugEvent.STEP_END);
- } else if ("event".equals(event.fReason) && getError() != null) {
- exceptionHit();
- }
- //#endif
- //#ifdef ex5
- //# // TODO: Exercise 5 - handle end of drop event
- //#else
- else if ("drop".equals(event.fReason)) {
- suspended(DebugEvent.STEP_END);
- }
- //#endif
- } else if (_event instanceof PDANoSuchLabelEvent ||
- _event instanceof PDAUnimplementedInstructionEvent)
- {
- setError(event.fMessage);
- }
- }
- }
-
- /**
- * Notification the target has resumed for the given reason.
- * Clears any error condition that was last encountered and
- * fires a resume event, and clears all cached variables
- * for stack frames.
- *
- * @param detail reason for the resume
- */
- private void resumed(int detail) {
- setError(null);
- fVariables.clear();
- fireResumeEvent(detail);
- }
-
- /**
- * Notification the target has suspended for the given reason
- *
- * @param detail reason for the suspend
- */
- private void suspended(int detail) {
- fireSuspendEvent(detail);
- }
-
- /**
- * Notification an error was encountered. Fires a breakpoint
- * suspend event.
- */
- private void exceptionHit() {
- suspended(DebugEvent.BREAKPOINT);
- }
-
- /**
- * Sets the current variables for the given stack frame. Called
- * by PDA stack frame when it is created.
- *
- * @param frame
- * @param variables
- */
- protected void setVariables(IStackFrame frame, IVariable[] variables) {
- synchronized (fVariables) {
- fVariables.put(frame, variables);
- }
- }
-
- /**
- * Returns the current variables for the given stack frame, or
- * <code>null</code> if none.
- *
- * @param frame stack frame
- * @return variables or <code>null</code>
- */
- protected IVariable[] getVariables(IStackFrame frame) {
- synchronized (fVariables) {
- IVariable[] variables = (IVariable[]) fVariables.get(frame);
- if (variables == null) {
- return new IVariable[0];
- }
- return variables;
- }
- }
-
- /**
- * Pops the top frame off the callstack.
- *
- * @throws DebugException
- *
- * @since 3.5
- */
- public void popFrame() throws DebugException {
- //#ifdef ex5
-//# // TODO: Exercise 5 - send drop request
- //#else
- sendCommand(new PDADropFrameCommand(fThreadId));
- //#endif
- }
-
- /**
- * Returns whether this thread can pop the top stack frame.
- *
- * @return whether this thread can pop the top stack frame
- *
- * @since 3.5
- */
- public boolean canPopFrame() {
- //#ifdef ex5
-//# // TODO: Exercise 5 - allow pop if there is more than 1 frame on the stack
- //#else
- try {
- return getStackFrames().length > 1;
- } catch (DebugException e) {
- }
- //#endif
- return false;
- }
-
- /**
- * Returns the values on the data stack (top down)
- *
- * @return the values on the data stack (top down)
- *
- * @since 3.5
- */
- public IValue[] getDataStack() throws DebugException {
- PDAListResult result = (PDAListResult)sendCommand(new PDADataCommand(fThreadId));
- if (result.fValues.length > 0) {
- IValue[] values = new IValue[result.fValues.length];
- for (int i = 0; i < result.fValues.length; i++) {
- values[values.length - i - 1] = new PDAStackValue(this, result.fValues[i], i);
- }
- return values;
- }
- return new IValue[0];
- }
-
- /**
- * Returns whether popping the data stack is currently permitted
- *
- * @return whether popping the data stack is currently permitted
- *
- * @since 3.5
- */
- public boolean canPopData() {
- try {
- return !isTerminated() && isSuspended() && getDataStack().length > 0;
- } catch (DebugException e) {
- }
- return false;
- }
-
- /**
- * Pops and returns the top of the data stack
- *
- * @return the top value on the stack
- * @throws DebugException if the stack is empty or the request fails
- *
- * @since 3.5
- */
- public IValue popData() throws DebugException {
- IValue[] dataStack = getDataStack();
- if (dataStack.length > 0) {
- sendCommand(new PDAPopDataCommand(fThreadId));
- return dataStack[0];
- }
- requestFailed("Empty stack", null);
- return null;
- }
-
- /**
- * Returns whether pushing a value is currently supported.
- *
- * @return whether pushing a value is currently supported
- *
- * @since 3.5
- */
- public boolean canPushData() {
- return !isTerminated() && isSuspended();
- }
-
- /**
- * Pushes a value onto the stack.
- *
- * @param value value to push
- * @throws DebugException on failure
- *
- * @since 3.5
- */
- public void pushData(String value) throws DebugException {
- sendCommand(new PDAPushDataCommand(fThreadId, value));
- }
-
- /**
- * Returns this thread's unique identifier
- *
- * @return this thread's unique identifier
- *
- * @since 3.5
- */
- public int getIdentifier() {
- return fThreadId;
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
deleted file mode 100644
index a4c6cc7e2..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAValue.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.debug.examples.core.pda.protocol.PDAChildrenCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAListResult;
-
-/**
- * Value of a PDA variable.
- */
-public class PDAValue extends PDADebugElement implements IValue {
-
- final private PDAVariable fVariable;
- final private String fValue;
-
- public PDAValue(PDAVariable variable, String value) {
- super(variable.getStackFrame().getPDADebugTarget());
- fVariable = variable;
- fValue = value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
- */
- public String getReferenceTypeName() throws DebugException {
- try {
- Integer.parseInt(fValue);
- } catch (NumberFormatException e) {
- return "text";
- }
- return "integer";
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#getValueString()
- */
- public String getValueString() throws DebugException {
- return fValue;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#isAllocated()
- */
- public boolean isAllocated() throws DebugException {
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#getVariables()
- */
- public IVariable[] getVariables() throws DebugException {
- PDAStackFrame frame = fVariable.getStackFrame();
- PDAListResult result = (PDAListResult) sendCommand(
- new PDAChildrenCommand(frame.getThreadIdentifier(), frame.getIdentifier(), fVariable.getName()) );
-
- IVariable[] children = new IVariable[result.fValues.length];
- for(int i = 0; i < result.fValues.length; i++) {
- children[i] = new PDAVariable(frame, result.fValues[i]);
- }
- return children;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValue#hasVariables()
- */
- public boolean hasVariables() throws DebugException {
- if (getVariables().length != 0) {
- return true;
- }
- // Value with multiple words can be show as an array using logical
- // structures. If the value has multiple words, it needs to indicate
- // that it has children even if logical structures are not turned on.
- return fValue.split("\\W+").length > 1;
- }
- /*
- * (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return obj instanceof PDAValue && ((PDAValue)obj).fValue.equals(fValue);
- }
- /*
- * (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fValue.hashCode();
- }
-
- /**
- * Returns the variable that this value was created for.
- *
- * @return The variable that this value was created for.
- *
- * @since 3.5
- */
- public PDAVariable getVariable() {
- return fVariable;
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
deleted file mode 100644
index 2329b584d..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/PDAVariable.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- * Wind River Systems - added support for IToggleBreakpointsTargetFactory
- * Pawel Piech (Wind River) - ported PDA Virtual Machine to Java (Bug 261400)
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.debug.examples.core.pda.protocol.PDACommandResult;
-import org.eclipse.debug.examples.core.pda.protocol.PDASetVarCommand;
-import org.eclipse.debug.examples.core.pda.protocol.PDAVarCommand;
-
-/**
- * A variable in a PDA stack frame
- */
-public class PDAVariable extends PDADebugElement implements IVariable {
-
- // name & stack frmae
- private String fName;
- private PDAStackFrame fFrame;
-
- /**
- * Constructs a variable contained in the given stack frame
- * with the given name.
- *
- * @param frame owning stack frame
- * @param name variable name
- */
- public PDAVariable(PDAStackFrame frame, String name) {
- super(frame.getPDADebugTarget());
- fFrame = frame;
- fName = name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#getValue()
- */
- public IValue getValue() throws DebugException {
- PDACommandResult result = sendCommand(new PDAVarCommand(
- fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName()));
- return new PDAValue(this, result.fResponseText);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#getName()
- */
- public String getName() throws DebugException {
- return fName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
- */
- public String getReferenceTypeName() throws DebugException {
- return "Thing";
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
- */
- public boolean hasValueChanged() throws DebugException {
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#setValue(java.lang.String)
- */
- public void setValue(String expression) throws DebugException {
- sendCommand(new PDASetVarCommand(
- fFrame.getThreadIdentifier(), getStackFrame().getIdentifier(), getName(), expression));
- fireChangeEvent(DebugEvent.CONTENT);
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
- */
- public void setValue(IValue value) throws DebugException {
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
- */
- public boolean supportsValueModification() {
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
- */
- public boolean verifyValue(String expression) throws DebugException {
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.IValueModification#verifyValue(org.eclipse.debug.core.model.IValue)
- */
- public boolean verifyValue(IValue value) throws DebugException {
- return false;
- }
-
- /**
- * Returns the stack frame owning this variable.
- *
- * @return the stack frame owning this variable
- */
- public PDAStackFrame getStackFrame() {
- return fFrame;
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java
deleted file mode 100644
index dbb06cb22..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/model/WordStructureDelegate.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate;
-import org.eclipse.debug.core.model.IValue;
-
-/**
- * Logical stucture to translate a string into its words.
- */
-public class WordStructureDelegate implements ILogicalStructureTypeDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate#providesLogicalStructure(org.eclipse.debug.core.model.IValue)
- */
- public boolean providesLogicalStructure(IValue value) {
- //#ifdef ex6
-//# // TODO: Exercise 6 - provide logical structures if the value has multiple words
- //#else
- try {
- String string = value.getValueString();
- String[] words = string.split("\\W+");
- return words.length > 1;
- } catch (DebugException e) {
- }
- //#endif
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILogicalStructureTypeDelegate#getLogicalStructure(org.eclipse.debug.core.model.IValue)
- */
- public IValue getLogicalStructure(IValue value) throws CoreException {
- //#ifdef ex6
-//# // TODO: Exercise 6 - create an array from the given value
-//# return null;
- //#else
- return new PDAArray((PDAValue)value);
- //#endif
- }
-
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
deleted file mode 100644
index a1cf5e3de..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDABitFieldData.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * Object representing a bit field in the stack command results.
- *
- * @see PDARegistersCommand
- */
-public class PDABitFieldData {
-
- final public String fName;
- final public int fOffset;
- final public int fCount;
- final public Map fMnemonics;
-
- PDABitFieldData(String bitFieldString) {
- StringTokenizer st = new StringTokenizer(bitFieldString, " ");
-
- fName = st.nextToken();
- fOffset = Integer.parseInt(st.nextToken());
- fCount = Integer.parseInt(st.nextToken());
-
- fMnemonics = new LinkedHashMap(0);
- while (st.hasMoreTokens()) {
- fMnemonics.put(st.nextToken(), st.nextToken());
- }
- }
-} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
deleted file mode 100644
index f9a3f001e..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAChildrenCommand.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Retrieves data stack information
- *
- * <pre>
- * C: children {thread_id} {frame_id} {variable_name}
- * R: {child variable 1}|{child variable 2}|{child variable 3}|...|
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-public class PDAChildrenCommand extends PDACommand {
-
- public PDAChildrenCommand(int threadId, int frameId, String name ) {
- super("children " + threadId + " " + frameId + " " + name);
- }
-
- public PDACommandResult createResult(String resultText) {
- return new PDAListResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
deleted file mode 100644
index 07dba5b96..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAClearBreakpointCommand.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Clears any breakpoint set on given line
- *
- * <pre>
- * C: clear {line}
- * R: ok
- * </pre>
- */
-public class PDAClearBreakpointCommand extends PDACommand {
-
- public PDAClearBreakpointCommand(int line) {
- super("clear " + line);
- }
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java
deleted file mode 100644
index 9aa2bfb15..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Base class for PDA commands. Sub-classes should format the request string
- * and implement the method to create the proper result object.
- */
-abstract public class PDACommand {
-
- final private String fRequest;
-
- public PDACommand(String request) {
- fRequest = request;
- }
-
- /**
- * Returns the request to be sent to PDA.
- */
- public String getRequest() {
- return fRequest;
- }
-
- /**
- * Returns the command result based on the given PDA response. This command
- * uses the class type parameter as the return type to allow the compiler to
- * enforce the correct command result. This class must be implemented by
- * each command to create the concrete result type.
- */
- abstract public PDACommandResult createResult(String resultText);
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java
deleted file mode 100644
index 9991b0115..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDACommandResult.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-
-/**
- * Basic command result object. This command result simply allows access to the
- * PDA response. Sub-classes may override to optionally parse the response text
- * and return higher-level objects.
- */
-public class PDACommandResult {
-
- final public String fResponseText;
-
- public PDACommandResult(String response) {
- fResponseText = response;
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
deleted file mode 100644
index 66ba35a35..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADataCommand.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Return the contents of the data stack; reply is the data from oldest to newest
- * as a single string
- *
- * <pre>
- * C: data {thread_id}
- * R: {value 1}|{value 2}|{value 3}|...|
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-public class PDADataCommand extends PDACommand {
-
- public PDADataCommand(int threadId) {
- super("data " + threadId);
- }
-
- public PDACommandResult createResult(String resultText) {
- return new PDAListResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
deleted file mode 100644
index 2204fa177..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDADropFrameCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Pops the top stack frame off the call stack setting the instruction pointer to
- * the calling statement in the calling frame
- *
- * <pre>
- * If VM running:
- * C: drop {thread_id}
- * R: ok
- * E: resumed {thread_id} drop
- * E: suspended {thread_id} drop
- *
- * If VM suspended:
- * C: drop {thread_id}
- * R: ok
- * E: vmresumed drop
- * E: vmsuspended {thread_id} drop
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-public class PDADropFrameCommand extends PDACommand {
-
- public PDADropFrameCommand(int threadId) {
- super("drop " + threadId);
- }
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
deleted file mode 100644
index bb0bdc6b9..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Causes the interperter to execute the given set of instructions. At the end
- * of the evaluation the top value is poped off the stack and returned in the
- * evaluation result.
- *
- * <pre>
- * C: eval {thread_id} {instruction}%20{parameter}|{instruction}%20{parameter}|...
- * R: ok
- * E: resumed {thread_id} client
- * E: evalresult result
- * E: suspended {thread_id} eval
- *
- * Errors:
- * error: invalid thread
- * error: cannot evaluate while vm is suspended
- * error: thread running
- * </pre>
- *
- * Where event_name could be <code>unimpinstr</code> or <code>nosuchlabel</code>.
- */
-public class PDAEvalCommand extends PDACommand {
-
- public PDAEvalCommand(int threadId, String operation) {
- super("eval " + threadId + " " + operation);
- }
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java
deleted file mode 100644
index 720147697..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvalResultEvent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Eval result event generated when an evaluation has completed.
- *
- * <pre>
- * E: evalresult {result}
- * </pre>
- */
-public class PDAEvalResultEvent extends PDAEvent {
-
- public final String fResult;
-
- public PDAEvalResultEvent(String message) {
- super(message);
- fResult = message.substring(getName(message).length() + 1);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("evalresult");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java
deleted file mode 100644
index ab841bf13..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEvent.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Base class for PDA events.
- */
-public class PDAEvent {
- public final String fMessage;
- public final String fName;
-
- public PDAEvent(String message) {
- fMessage = message;
- fName = getName(message);
- }
-
- protected String getName(String message) {
- int nameEnd = message.indexOf(' ');
- nameEnd = nameEnd == -1 ? message.length() : nameEnd;
- return message.substring(0, nameEnd);
- }
-
- public static PDAEvent parseEvent(String message) {
- if (PDAEvalResultEvent.isEventMessage(message)) {
- return new PDAEvalResultEvent(message);
- }
- else if (PDAExitedEvent.isEventMessage(message)) {
- return new PDAExitedEvent(message);
- }
- else if (PDANoSuchLabelEvent.isEventMessage(message)) {
- return new PDANoSuchLabelEvent(message);
- }
- else if (PDARegistersEvent.isEventMessage(message)) {
- return new PDARegistersEvent(message);
- }
- else if (PDAResumedEvent.isEventMessage(message)) {
- return new PDAResumedEvent(message);
- }
- else if (PDAStartedEvent.isEventMessage(message)) {
- return new PDAStartedEvent(message);
- }
- else if (PDASuspendedEvent.isEventMessage(message)) {
- return new PDASuspendedEvent(message);
- }
- else if (PDATerminatedEvent.isEventMessage(message)) {
- return new PDATerminatedEvent(message);
- }
- else if (PDAUnimplementedInstructionEvent.isEventMessage(message)) {
- return new PDAUnimplementedInstructionEvent(message);
- }
- else if (PDAVMResumedEvent.isEventMessage(message)) {
- return new PDAVMResumedEvent(message);
- }
- else if (PDAVMStartedEvent.isEventMessage(message)) {
- return new PDAVMStartedEvent(message);
- }
- else if (PDAVMSuspendedEvent.isEventMessage(message)) {
- return new PDAVMSuspendedEvent(message);
- }
- else if (PDAExitedEvent.isEventMessage(message)) {
- return new PDAExitedEvent(message);
- }
- else {
- return new PDAEvent(message);
- }
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
deleted file mode 100644
index f538c0d65..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAEventStopCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Optionally stop the interpreter when an error event <code>event_name</code>
- * is encountered; <code>{0|1}</code> specifies stop (<code>1</code>) or
- * continue (<code>0</code>). The possible events are <code>unimpinstr</code> and
- * <code>nosuchlabel</code>. Reply is <code>ok</code>. When an event is encountered,
- * the interpreter sends the error event (for example <code>unimlpemented instruction
- * foo</code>) and corresponding suspend event (for example <code>suspended event
- * unimpinstr</code>).
- *
- * <pre>
- * C: eventstop {event_name} {0|1}
- * R: ok
- * ...
- * E: suspended event {event_name}
- * </pre>
- *
- * Where event_name could be <code>unimpinstr</code> or <code>nosuchlabel</code>.
- */
-
-public class PDAEventStopCommand extends PDACommand {
-
- public static final int UNIMPINSTR = 0;
- public static final int NOSUCHLABEL = 1;
-
- public PDAEventStopCommand(int event, boolean enable) {
- super("eventstop " +
- (event == UNIMPINSTR ? "unimpinstr " : "nosuchlabel ") +
- (enable ? "1" : "0"));
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java
deleted file mode 100644
index f452e8138..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAExitedEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Exited event generated when a thread has exited.
- *
- * <pre>
- * E: started {thread_id}
- * </pre>
- */
-public class PDAExitedEvent extends PDARunControlEvent {
-
- public PDAExitedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("exited");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
deleted file mode 100644
index c2a83af3c..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Retrieves command stack frame information for frame <code>frame_number</code>
- * (stack frames are indexed from 0, 0 being the oldest).
- *
- * <pre>
- * C: stack {thread_id} {frame_number}
- * R: {file}|{line}|{function}|{var_1}|{var_2}|...
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-public class PDAFrameCommand extends PDACommand {
-
- public PDAFrameCommand(int threadId, int frameNum) {
- super("frame " + threadId + " " + frameNum);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDAFrameCommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java
deleted file mode 100644
index f52af48c0..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameCommandResult.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-
-/**
- * @see PDAFrameCommand
- */
-
-public class PDAFrameCommandResult extends PDACommandResult {
-
- /**
- * Frame data return by the frame command.
- */
- final public PDAFrameData fFrame;
-
- PDAFrameCommandResult(String response) {
- super(response);
- fFrame = new PDAFrameData(response);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
deleted file mode 100644
index d3f9bbc9e..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAFrameData.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-/**
- * Object representing a frame in the stack command results.
- *
- * @see PDAStackCommand
- */
-
-public class PDAFrameData {
-
- final public IPath fFilePath;
- final public int fPC;
- final public String fFunction;
- final public String[] fVariables;
-
- PDAFrameData(String frameString) {
- StringTokenizer st = new StringTokenizer(frameString, "|");
-
- fFilePath = new Path(st.nextToken());
- fPC = Integer.parseInt(st.nextToken());
- fFunction = st.nextToken();
-
- List variablesList = new ArrayList();
- while (st.hasMoreTokens()) {
- variablesList.add(st.nextToken());
- }
- fVariables = (String[])variablesList.toArray(new String[variablesList.size()]);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
deleted file mode 100644
index 4e6f1eb5b..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAGroupsCommand.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Retrieves register groups information
- *
- * <pre>
- * C: groups
- * R: {group 1}|{group 2}|{group 3}|...|
- * </pre>
- */
-
-public class PDAGroupsCommand extends PDACommand {
-
- public PDAGroupsCommand() {
- super("groups");
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDAListResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
deleted file mode 100644
index 4abab970a..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAListResult.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-
-/**
- * @see PDADataCommand
- */
-
-public class PDAListResult extends PDACommandResult {
-
- final public String[] fValues;
-
- PDAListResult(String response) {
- super(response);
- StringTokenizer st = new StringTokenizer(response, "|");
- List valuesList = new ArrayList();
-
- while (st.hasMoreTokens()) {
- String token = st.nextToken();
- if (token.length() != 0) {
- valuesList.add(token);
- }
- }
-
- fValues = new String[valuesList.size()];
- for (int i = 0; i < valuesList.size(); i++) {
- fValues[i] = (String)valuesList.get(i);
- }
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
deleted file mode 100644
index b85ca868e..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDANoSuchLabelEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * No Such Label event generated when the PDA program encounters an call to a
- * non-existant label in a PDA program.
- *
- * <pre>
- * E: no such label {label}
- * </pre>
- */
-public class PDANoSuchLabelEvent extends PDAEvent {
-
- public final String fLabel;
-
- public PDANoSuchLabelEvent(String message) {
- super(message);
- fLabel = message.substring(getName(message).length() + 1);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("no such label");
- }
-
- protected String getName(String message) {
- if (isEventMessage(message)) {
- return "no such label";
- }
- throw new IllegalArgumentException("Invalid event: " + message);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
deleted file mode 100644
index be04801e2..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPopDataCommand.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Pops the top value from the data stack
- *
- * <pre>
- * C: popdata {thread_id}
- * R: ok
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-public class PDAPopDataCommand extends PDACommand {
-
- public PDAPopDataCommand(int threadId) {
- super("popdata " + threadId);
- }
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
deleted file mode 100644
index 10837ea16..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAPushDataCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Pushes the given value on top of the data stack.
- *
- * <pre>
- * C: pushdata {thread_id} {value}
- * R: ok
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-
-public class PDAPushDataCommand extends PDACommand {
-
- public PDAPushDataCommand(int threadId, String value) {
- super("pushdata " + threadId + " " + value);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
deleted file mode 100644
index 81be71016..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegisterData.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-/**
- * Object representing a register in the registers command results.
- *
- * @see PDARCommand
- */
-
-public class PDARegisterData {
-
- final public String fName;
- final public boolean fWritable;
- final public PDABitFieldData[] fBitFields;
-
- PDARegisterData(String regString) {
- StringTokenizer st = new StringTokenizer(regString, "|");
-
- String regInfo = st.nextToken();
- StringTokenizer regSt = new StringTokenizer(regInfo, " ");
- fName = regSt.nextToken();
- fWritable = Boolean.getBoolean(regSt.nextToken());
-
- List bitFieldsList = new ArrayList();
- while (st.hasMoreTokens()) {
- bitFieldsList.add(new PDABitFieldData(st.nextToken()));
- }
- fBitFields = (PDABitFieldData[])bitFieldsList.toArray(new PDABitFieldData[bitFieldsList.size()]);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
deleted file mode 100644
index 2e766ca1d..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommand.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Retrieves registers definition information
- *
- * <pre>
- * C: registers {group name}
- * R: {register name} {true|false}|{bit field name} {start bit} {bit count} {mnemonic 1} {mnemonic 2} ...#{register name} ...
- * </pre>
- */
-
-public class PDARegistersCommand extends PDACommand {
-
- public PDARegistersCommand(String group) {
- super("registers " + group);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDARegistersCommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
deleted file mode 100644
index f5d4cd983..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersCommandResult.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-
-/**
- * @see PDARegistersCommand
- */
-
-public class PDARegistersCommandResult extends PDACommandResult {
-
- /**
- * Array of registers returned by the registers commands.
- */
- final public PDARegisterData[] fRegisters;
-
- PDARegistersCommandResult(String response) {
- super(response);
- StringTokenizer st = new StringTokenizer(response, "#");
- List regList = new ArrayList();
-
- while (st.hasMoreTokens()) {
- regList.add(new PDARegisterData(st.nextToken()));
- }
- fRegisters = (PDARegisterData[])regList.toArray(new PDARegisterData[regList.size()]);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java
deleted file mode 100644
index 9212273b5..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARegistersEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Registers event generated when the registers' definitions are changed in a
- * program.
- *
- * <pre>
- * E: registers
- * </pre>
- */
-public class PDARegistersEvent extends PDAEvent {
-
- public PDARegistersEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("registers");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
deleted file mode 100644
index 21e58c430..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARestartCommand.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Restarts the debug session. All threads exit and the main threads starts
- *
- * <pre>
- * C: restart
- * E: exited 0
- * E: started 1
- * R: ok
- * </pre>
- */
-
-public class PDARestartCommand extends PDACommand {
-
- public PDARestartCommand() {
- super("restart");
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
deleted file mode 100644
index bf65d40e5..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumeCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Resumes the execution of a single thread. Can be issued only if the virtual
- * machine is running.
- *
- * <pre>
- * C: resume {thread_id}
- * R: ok
- * E: resumed {thread_id} client
- *
- * Errors:
- * error: invalid thread
- * error: cannot resume thread when vm is suspended
- * error: thread already running
- * </pre>
- */
-
-public class PDAResumeCommand extends PDACommand {
-
- public PDAResumeCommand(int threadId) {
- super("resume " + threadId);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java
deleted file mode 100644
index 36f89ed0d..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAResumedEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Resumed event generated when a thread is resumed.
- *
- * <pre>
- * E: resumed {thread_id} [reason]
- * </pre>
- */
-public class PDAResumedEvent extends PDARunControlEvent {
-
- public PDAResumedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("resumed");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
deleted file mode 100644
index e3af4eb5e..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDARunControlEvent.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Base class for run-control events.
- */
-public class PDARunControlEvent extends PDAEvent {
-
- public final int fThreadId;
- public final String fReason;
-
- public PDARunControlEvent(String message) {
- super(message);
- fThreadId = getThreadId(message);
- fReason = getStateChangeReason(message);
- }
-
- protected int getThreadId(String message) {
- int nameEnd = getName(message).length();
- if ( Character.isDigit(message.charAt(nameEnd + 1)) ) {
- int threadIdEnd = message.indexOf(' ', nameEnd + 1);
- threadIdEnd = threadIdEnd == -1 ? message.length() : threadIdEnd;
- try {
- return Integer.parseInt(message.substring(nameEnd + 1, threadIdEnd));
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Invalid event: " + message);
- }
- } else {
- return -1;
- }
- }
-
- protected String getStateChangeReason(String message) {
- int idx = getName(message).length();
- if ( Character.isDigit(message.charAt(idx + 1)) ) {
- idx = message.indexOf(' ', idx + 1);
- idx = idx == -1 ? message.length() : idx + 1;
- } else {
- idx++;
- }
- if (idx >= message.length()) {
- return "";
- }
-
- int endIdx = message.indexOf(' ', idx);
- endIdx = endIdx == -1 ? message.length() : endIdx;
- return message.substring(idx, endIdx);
- }
-
- protected String getName(String message) {
- int nameEnd = message.indexOf(' ');
- nameEnd = nameEnd == -1 ? message.length() : nameEnd;
- return message.substring(0, nameEnd);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("started");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
deleted file mode 100644
index 1abb7fa8c..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetBreakpointCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Sets a breakpoint at given line
- *
- * <pre>
- * Suspend a single thread:
- * C: set {line_number} 0
- * R: ok
- * C: resume {thread_id}
- * E: resumed {thread_id} client
- * E: suspended {thread_id} breakpoint line_number
- *
- * Suspend the VM:
- * C: set {line_number} 1
- * R: ok
- * C: vmresume
- * E: vmresumed client
- * E: vmsuspended {thread_id} breakpoint line_number
- * </pre>
- */
-
-public class PDASetBreakpointCommand extends PDACommand {
-
- public PDASetBreakpointCommand(int line, boolean stopVM) {
- super("set " +
- line + " " +
- (stopVM ? "1" : "0"));
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
deleted file mode 100644
index e0c22db45..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetDataCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Sets a data value in the data stack at the given location (the data stack is
- * indexed from 0, 0 being the oldest).
- *
- * <pre>
- * C: setdata {thread_id} {index} {value}
- * R: ok
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-public class PDASetDataCommand extends PDACommand {
-
- public PDASetDataCommand(int threadId, int index, String value) {
- super("setdata " + threadId + " " + index + " " + value);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
deleted file mode 100644
index c5f6b090f..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASetVarCommand.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Set the contents of variable <code>variable</code> from the control stack
- * <code>frame_number</code> to value <code>value</code> (the control stack is
- * indexed from 0, 0 being the oldest).
- *
- * <pre>
- * C: setvar {thread_id} {frame_number} {variable} {value}
- * R: ok
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-
-public class PDASetVarCommand extends PDACommand {
-
- public PDASetVarCommand(int threadId, int frame, String variable, String value) {
- super("setvar " + threadId + " " + frame + " " + variable + " " + value);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
deleted file mode 100644
index 84545feb1..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Return the contents of the control stack (program counters, function and
- * variable names). The reply is control stack from oldest to newest as a single string
- * <code>frame#frame#frame...#frame</code>, where each frame is a string
- * <code>"filename|pc|function name|variable name|variable name|...|variable name"</code></li>.
- *
- * <pre>
- * C: stack {thread_id}
- * R: {file}|{line}|{function}|{var_1}|{var_2}|...#{file}|{line}|{function}|{var_1}|{var_2}|...#...
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-
-public class PDAStackCommand extends PDACommand {
-
- public PDAStackCommand(int threadId) {
- super("stack " + threadId);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDAStackCommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
deleted file mode 100644
index e22aa12b0..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackCommandResult.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-
-/**
- * @see PDAStackCommand
- */
-
-public class PDAStackCommandResult extends PDACommandResult {
-
- /**
- * Array of frames return by the stack commands. The frames are ordered
- * with the highest-level frame first.
- */
- final public PDAFrameData[] fFrames;
-
- PDAStackCommandResult(String response) {
- super(response);
- StringTokenizer st = new StringTokenizer(response, "#");
- List framesList = new ArrayList();
-
- while (st.hasMoreTokens()) {
- framesList.add(new PDAFrameData(st.nextToken()));
- }
- fFrames = (PDAFrameData[])framesList.toArray(new PDAFrameData[framesList.size()]);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
deleted file mode 100644
index 6c04530c2..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommand.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Retrieves command stack depth
- *
- * <pre>
- * C: stackdepth {thread_id}
- * R: {depth}
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-
-public class PDAStackDepthCommand extends PDACommand {
-
- public PDAStackDepthCommand(int threadId) {
- super("stackdepth " + threadId);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDAStackDepthCommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java
deleted file mode 100644
index e5ca2b969..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStackDepthCommandResult.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-
-/**
- * @see PDADataCommand
- */
-
-public class PDAStackDepthCommandResult extends PDACommandResult {
-
- final public int fDepth;
-
- PDAStackDepthCommandResult(String response) {
- super(response);
- int depth = 1; // default to something that won't cause NPEs
- try {
- depth = Integer.parseInt(response);
- } catch (NumberFormatException e) {}
- fDepth = depth;
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java
deleted file mode 100644
index 6b980e105..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStartedEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Started event generated when a new thread is started. A started event
- * is always sent for the first thread when a PDA program is started.
- *
- * <pre>
- * E: started {thread_id}
- * </pre>
- */
-public class PDAStartedEvent extends PDARunControlEvent {
-
- public PDAStartedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("started");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
deleted file mode 100644
index 3a21492ad..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Executes next instruction
- *
- * <pre>
- * If VM running:
- * C: step {thread_id}
- * R: ok
- * E: resumed {thread_id} step
- * E: suspended {thread_id} step
- *
- * If VM suspended:
- * C: step {thread_id}
- * R: ok
- * E: vmresumed step
- * E: vmsuspended {thread_id} step
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-
-public class PDAStepCommand extends PDACommand {
-
- public PDAStepCommand(int threadId) {
- super("step " + threadId);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
deleted file mode 100644
index 2a7fd9505..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAStepReturnCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Single step forward until the next <code>return</code> op code. Stop before
- * executing the <code>return</code> .
- *
- * <pre>
- * If VM running:
- * C: stepreturn {thread_id}
- * R: ok
- * E: resumed {thread_id} client
- * E: suspended {thread_id} step
- *
- * If VM suspended:
- * C: stepreturn {thread_id}
- * R: ok
- * E: vmresumed client
- * E: vmsuspended {thread_id} step
- *
- * Errors:
- * error: invalid thread
- * </pre>
- */
-
-public class PDAStepReturnCommand extends PDACommand {
-
- public PDAStepReturnCommand(int threadId) {
- super("stepreturn " + threadId);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
deleted file mode 100644
index fb124d3e0..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Suspends execution of a single thread. Can be issued only if the virtual
- * machine is running.
- *
- * <pre>
- * C: suspend {thread_id}
- * R: ok
- * E: suspended {thread_id} client
- *
- * Errors:
- * error: invalid thread
- error: vm already suspended
- * error: thread already suspended
- * </pre>
- */
-
-public class PDASuspendCommand extends PDACommand {
-
- public PDASuspendCommand(int threadId) {
- super("suspend " + threadId);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java
deleted file mode 100644
index b226347c3..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDASuspendedEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Suspended event generated when a thread is suspended.
- *
- * <pre>
- * E: suspended {thread_id} [reason]
- * </pre>
- *
- * <code>[reason]</code> is the cause of the suspension and it's optional:
- * <ul>
- * <li><code>breakpoint N</code> - a breakpoint at line <code>N</code> was hit</li>
- * <li><code>client</code> - a client request to suspend has completed</li>
- * <li><code>drop</code> - a client request to drop a frame has completed</li>
- * <li><code>event E</code> - an error was encountered, where <code>E</code> is one
- * of <code>unimpinstr</code> or <code>nosuchlabel</code></li>
- * <li><code>step</code> - a step request has completed</li>
- * <li><code>watch A F::V</code> - a watchpoint was hit for reason <code>A</code>
- * (<code>read</code> or <code>write</code>), on variable <code>V</code> in
- * function <code>F</code></li>
- * </ul>
-
- */
-public class PDASuspendedEvent extends PDARunControlEvent {
-
- public PDASuspendedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("suspended");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
deleted file mode 100644
index 3e91596f1..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminateCommand.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Instructs the debugger to terminate.
- *
- * <pre>
- * C: terminate
- * R: ok
- * E: vmterminated
- * </pre>
- */
-
-public class PDATerminateCommand extends PDACommand {
-
- public PDATerminateCommand() {
- super("terminate");
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java
deleted file mode 100644
index 648e838ab..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDATerminatedEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Terminated event generated when the PDA program has ended execution.
- *
- * <pre>
- * E: termianted
- * </pre>
- */
-public class PDATerminatedEvent extends PDAEvent {
-
- public PDATerminatedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("terminated");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
deleted file mode 100644
index 7a0ce54ba..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAUnimplementedInstructionEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Unimplemented Instruction event generated when the PDA program encounters
- * an instruction that it does not recognize. This event is usually followed
- * by a VM Suspended event.
- *
- * <pre>
- * E: unimplemented instruction {label}
- * </pre>
- */
-public class PDAUnimplementedInstructionEvent extends PDAEvent {
-
- public final String fOperation;
-
- public PDAUnimplementedInstructionEvent(String message) {
- super(message);
- fOperation = message.substring(getName(message).length() + 1);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("unimplemented instruction");
- }
-
- protected String getName(String message) {
- if (isEventMessage(message)) {
- return "unimplemented instruction";
- }
- throw new IllegalArgumentException("Invalid event: " + message);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
deleted file mode 100644
index 85ca473ab..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumeCommand.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Resumes the execution of the whole virtual machine
- *
- * <pre>
- * C: vmresume
- * R: ok
- * E: vmresumed client
- *
- * Errors:
- * error: vm already running
- * </pre>
- */
-
-public class PDAVMResumeCommand extends PDACommand {
-
- public PDAVMResumeCommand() {
- super("vmresume");
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java
deleted file mode 100644
index 74801c6c5..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMResumedEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * VM Resumed event generated when the whole virtual machine is resumed. When
- * the VM is resumed all previously suspended threads are resumed as well.
- *
- * <pre>
- * E: vmresumed [reason]
- * </pre>
- *
- * <code>[reason]</code> is the cause of the resume: and it's optional:
- * <ul>
- * <li><code>step</code> - a step request has been initiated</li>
- * <li><code>client</code> - a client request to resume has been initiated</li>
- * </ul>
- */
-public class PDAVMResumedEvent extends PDARunControlEvent {
-
- public PDAVMResumedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmresumed");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java
deleted file mode 100644
index ff5f1dc0f..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMStartedEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * VM started event generated when the the interpreter has started (guaranteed
- * to be the first event sent)
- *
- * <pre>
- * E: vmstarted
- * </pre>
- */
-public class PDAVMStartedEvent extends PDAEvent {
-
- public PDAVMStartedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmstarted");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
deleted file mode 100644
index ad62d3321..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendCommand.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Suspends the execution of the whole virtual machine
- *
- * <pre>
- * C: vmsuspend
- * R: ok
- * E: vmsuspended client
- *
- * Errors:
- * error: thread already suspended
- * </pre>
- */
-
-public class PDAVMSuspendCommand extends PDACommand {
-
- public PDAVMSuspendCommand() {
- super("vmsuspend");
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java
deleted file mode 100644
index 0e36297ec..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMSuspendedEvent.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * VM Suspended event generated when the virtual machine is suspended. If the VM
- * is suspended as a result of a thread event (e.g. thread hitting a breakpoint),
- * then the thread_id is included in the event.
- *
- * <pre>
- * E: vmsuspended [thread_id] {reason}
- * </pre>
- *
- * <code>{reason}</code> is the cause of the suspension:
- * <ul>
- * <li><code>breakpoint N</code> - a breakpoint at line <code>N</code> was hit</li>
- * <li><code>client</code> - a client request to suspend has completed</li>
- * <li><code>drop</code> - a client request to drop a frame has completed</li>
- * <li><code>event E</code> - an error was encountered, where <code>E</code> is one
- * of <code>unimpinstr</code> or <code>nosuchlabel</code></li>
- * <li><code>step</code> - a step request has completed</li>
- * <li><code>watch A F::V</code> - a watchpoint was hit for reason <code>A</code>
- * (<code>read</code> or <code>write</code>), on variable <code>V</code> in
- * function <code>F</code></li>
- * </ul>
- */
-public class PDAVMSuspendedEvent extends PDARunControlEvent {
-
- public PDAVMSuspendedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmsuspended");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java
deleted file mode 100644
index 348778625..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVMTerminatedEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-/**
- * Terminated event generated when the PDA program has ended execution.
- *
- * <pre>
- * E: termianted
- * </pre>
- */
-public class PDAVMTerminatedEvent extends PDAEvent {
-
- public PDAVMTerminatedEvent(String message) {
- super(message);
- }
-
- public static boolean isEventMessage(String message) {
- return message.startsWith("vmterminated");
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
deleted file mode 100644
index 5e2f34c03..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAVarCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Return the contents of variable <code>variable_name</code> in the control
- * stack frame <code>frame_number</code> (stack frames are indexed from 0, 0
- * being the oldest).
- *
- * <pre>
- * C: var {thread_id} {frame_number} {variable_name}
- * R: {variable_value}
- *
- * Errors:
- * error: invalid thread
- * error: variable undefined
- * </pre>
- */
-
-public class PDAVarCommand extends PDACommand {
-
- public PDAVarCommand(int threadId, int frameId, String name) {
- super("var " + threadId + " " + frameId + " " + name);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
deleted file mode 100644
index 4bd8af72c..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/PDAWatchCommand.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.protocol;
-
-
-/**
- * Set a watchpoint on variable <code>variable_name</code> in function
- * <code>function</code> to magic value <code>watch_operation</code>. The magic
- * value is a bit flag corresponding to read access (1), write access (2), or
- * both (3); the magic value 0 clears the watchpoint.
- *
- * <pre>
- * C: watch {function}::{variable_name} {watch_operation}
- * R: ok
- * C: vmresume
- * R: vmresumed client
- * E: vmsuspended {thread_id} watch {watch_operation} {function}::{variable_name}
- * </pre>
- */
-public class PDAWatchCommand extends PDACommand {
-
- public static final int READ = 1;
- public static final int WRITE = 2;
- public static final int BOTH = READ | WRITE;
- public static final int NONE = 0;
-
- public PDAWatchCommand(String function, String variable, int operation) {
- super("watch " + function+ "::" + variable + " " + operation);
- }
-
-
- public PDACommandResult createResult(String resultText) {
- return new PDACommandResult(resultText);
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/package.html b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/package.html
deleted file mode 100644
index 90bdaae51..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/protocol/package.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>PDA Interpreter Debug Protocol</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<p>Provides classes representing PDA protocol commands, command results and events</p>
-
-<h2>Package Specification</h2>
-
-<h3>Virtual Machine execution control</h3>
-<h4>Commands</h4>
-<ul>
-<li>{@link PDATerminateCommand}</li>
-<li>{@link PDAVMSuspendCommand}</li>
-<li>{@link PDAVMResumeCommand}</li>
-<li>{@link PDAEventStopCommand}</li>
-</ul>
-<h4>Events</h4>
-<ul>
-<li>{@link PDAVMStarted}</li>
-<li>{@link PDAVMTerminated}</li>
-<li>{@link PDAVMSuspneded}</li>
-<li>{@link PDAVMResumed}</li>
-<li>{@link PDAUnimplementedInstructionEvent}</li>
-<li>{@link PDANoSuchLabelEvent}</li>
-</ul>
-
-<h3>Thread execution control</h3>
-<h4>Commands</h4>
-<ul>
-<li>{@link PDASuspendCommand}</li>
-<li>{@link PDAResumeCommand}</li>
-<li>{@link PDAStepCommand}</li>
-<li>{@link PDADropFrameCommand}</li>
-</ul>
-<h4>Events</h4>
-<ul>
-<li>{@link PDAStarted}</li>
-<li>{@link PDAExited}</li>
-<li>{@link PDASuspended}</li>
-<li>{@link PDAResumed}</li>
-</ul>
-
-<h3>Breakpoints</h3>
-<h4>Commands</h4>
-<ul>
-<li>{@link PDASetBreakpointCommand}</li>
-<li>{@link PDAClearBreakpointCommand}</li>
-<li>{@link PDAWatchCommand}</li>
-</ul>
-
-<h3>Data stack</h3>
-<h4>Commands</h4>
-<ul>
-<li>{@link PDADataCommand}</li>
-<li>{@link PDASetDataCommand}</li>
-<li>{@link PDAPopDataCommand}</li>
-<li>{@link PDAPushDataCommand}</li>
-</ul>
-
-<h3>Expression evaluation</h3>
-<h4>Commands</h4>
-<ul>
-<li>{@link PDAEvalCommand}</li>
-</ul>
-<h4>Events</h4>
-<ul>
-<li>{@link PDAEvalResultEvent}</li>
-</ul>
-
-<h3>Execution control stack</h3>
-<h4>Commands</h4>
-<ul>
-<li>{@link PDAStackCommand}</li>
-<li>{@link PDAStackDepthCommand}</li>
-<li>{@link PDAFrameCommand}</li>
-<li>{@link PDAVarCommand}</li>
-<li>{@link PDASetVarCommand}</li>
-<li>{@link PDAChildrenCommand}</li>
-</ul>
-
-<h3>Registers</h3>
-<h4>Commands</h4>
-<ul>
-<li>{@link PDAGroupsCommand}</li>
-<li>{@link PDARegistersCommand}</li>
-</ul>
-<h4>Events</h4>
-<ul>
-<li>{@link PDARegistersEvent}</li>
-</ul>
-
-</body>
-</html>
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java
deleted file mode 100644
index f975cf7c3..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupDirector.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.sourcelookup;
-
-import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
-
-/**
- * PDA source lookup director. For PDA source lookup there is one source
- * lookup participant.
- */
-public class PDASourceLookupDirector extends AbstractSourceLookupDirector {
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
- */
- public void initializeParticipants() {
- //#ifdef ex4
-//# // TODO: Exercise 4 - add our participant to this director
- //#else
- addParticipants(new ISourceLookupParticipant[]{new PDASourceLookupParticipant()});
- //#endif
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java
deleted file mode 100644
index 0d07ce78d..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourceLookupParticipant.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.sourcelookup;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
-import org.eclipse.debug.examples.core.pda.model.PDAStackFrame;
-
-
-/**
- * The PDA source lookup participant knows how to translate a
- * PDA stack frame into a source file name
- */
-public class PDASourceLookupParticipant extends AbstractSourceLookupParticipant {
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object)
- */
- public String getSourceName(Object object) throws CoreException {
- //#ifdef ex4
-//# // TODO: Exercise 4 - return the name of the source file for the given stack frame
-//# return null;
- //#else
- if (object instanceof PDAStackFrame) {
- return ((PDAStackFrame)object).getSourceName();
- }
- return null;
- //#endif
- }
-}
diff --git a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java b/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java
deleted file mode 100644
index d91b3f245..000000000
--- a/org.eclipse.debug.examples.core/src/org/eclipse/debug/examples/core/pda/sourcelookup/PDASourcePathComputerDelegate.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.core.pda.sourcelookup;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
-import org.eclipse.debug.core.sourcelookup.containers.FolderSourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
-import org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer;
-import org.eclipse.debug.examples.core.pda.DebugCorePlugin;
-
-
-/**
- * Computes the default source lookup path for a PDA launch configuration.
- * The default source lookup path is the folder or project containing
- * the PDA program being launched. If the program is not specified, the workspace
- * is searched by default.
- */
-public class PDASourcePathComputerDelegate implements ISourcePathComputerDelegate {
-
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.sourcelookup.ISourcePathComputerDelegate#computeSourceContainers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.runtime.IProgressMonitor)
- */
- public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
- String path = configuration.getAttribute(DebugCorePlugin.ATTR_PDA_PROGRAM, (String)null);
- ISourceContainer sourceContainer = null;
- if (path != null) {
- IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
- if (resource != null) {
- //#ifdef ex4
-//# // TODO: Exercise 4 - seed the source lookup path
- //#else
- IContainer container = resource.getParent();
- if (container.getType() == IResource.PROJECT) {
- sourceContainer = new ProjectSourceContainer((IProject)container, false);
- } else if (container.getType() == IResource.FOLDER) {
- sourceContainer = new FolderSourceContainer(container, false);
- }
- //#endif
- }
- }
- if (sourceContainer == null) {
- sourceContainer = new WorkspaceSourceContainer();
- }
- return new ISourceContainer[]{sourceContainer};
- }
-}
diff --git a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java b/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
deleted file mode 100644
index 59baccb85..000000000
--- a/org.eclipse.debug.examples.core/src_ant/org/eclipse/debug/examples/ant/tasks/PreProcessor.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Bjorn Freeman-Benson - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.ant.tasks;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.tools.ant.util.FileUtils;
-
-/**
- * Java preprocessor for code examples. Used to export source code for
- * example plug-ins with parts of code missing/inserted etc., for
- * various exercises.
- * <p>
- * The preprocessor looks for #ifdef statements in java comments, and is
- * run with a set of symbols. For example:
- * <pre>
- * //#ifdef ex1
- * ... code to insert when 'ex1' symbol is on
- * //#else
- * ... code to insert when not 'ex1'
- * //#endif
- * </pre>
- * </p>
- */
-public class PreProcessor extends Task {
-
- private Vector fFileSets = new Vector();
- private File fDestDir = null;
- private Set fSymbols = new HashSet();
- private FileUtils fUtils = FileUtils.getFileUtils();
-
- // possible states
- private static final int STATE_OUTSIDE_CONDITION = 0;
- private static final int STATE_TRUE_CONDITION = 1;
- private static final int STATE_FALSE_CONDITION = 2;
- private static final int STATE_POST_TRUE_CONDITION = 3;
-
- // matchers
- private Matcher IF_DEF_MATCHER = Pattern.compile("#ifdef\\s+\\w+").matcher("");
- private Matcher ELSE_IF_MATCHER = Pattern.compile("#elseif\\s+\\w+").matcher("");
- private Matcher ELSE_MATCHER = Pattern.compile("#else$|#else\\W+").matcher("");
- private Matcher END_MATCHER = Pattern.compile("#endif").matcher("");
-
-
- /**
- * Constructs a new preprocessor task
- */
- public PreProcessor() {
- }
-
- /**
- * Adds a set of files to process.
- *
- * @param set a set of files to process
- */
- public void addFileset(FileSet set) {
- fFileSets.addElement(set);
- }
-
- /**
- * Sets the destination directory for processed files.
- *
- * @param destDir destination directory for processed files
- */
- public void setDestdir(File destDir) {
- fDestDir = destDir;
- }
-
- /**
- * Sets the symbols that are "on" for the preprocessing.
- *
- * @param symbols symbols that are "on" for the preprocessing
- */
- public void setSymbols(String symbols) {
- String[] strings = symbols.split(",");
- for (int i = 0; i < strings.length; i++) {
- String string = strings[i].trim();
- if (string.length() > 0) {
- fSymbols.add(string);
- }
- }
- }
-
- public void execute() throws BuildException {
- if (fSymbols.size() == 0) {
- throw new BuildException("No symbols specified for preprocessor");
- }
- if (fFileSets.isEmpty()) {
- throw new BuildException("No filesets specified for processing");
- }
- if (!fDestDir.exists()) {
- throw new BuildException("destdir does not exist: " + fDestDir.getAbsolutePath());
- }
- StringBuffer buf = new StringBuffer("Symbols: ");
- String[] symbols = (String[]) fSymbols.toArray(new String[fSymbols.size()]);
- for (int i = 0; i < symbols.length; i++) {
- String symbol = symbols[i];
- buf.append(symbol);
- if(i < (symbols.length -1)) {
- buf.append(", ");
- }
- }
- log(buf.toString());
-
- Iterator fileSets = fFileSets.iterator();
- while (fileSets.hasNext()) {
- FileSet fileSet = (FileSet) fileSets.next();
- DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
- String[] includedFiles = scanner.getIncludedFiles();
- File baseDir = fileSet.getDir(getProject());
- for (int i = 0; i < includedFiles.length; i++) {
- String fileName = includedFiles[i];
- processFile(baseDir, fileName, fDestDir);
- }
- }
-
- }
-
- /**
- * Process the file
- * @param baseDir base directory source file is relative to
- * @param fileName source file name
- * @param destDir root destination directory
- */
- private void processFile(File baseDir, String fileName, File destDir) throws BuildException {
- File destFile = new File(destDir, fileName);
- File srcFile = new File(baseDir, fileName);
- File dir = destFile.getParentFile();
- if (!dir.exists()) {
- dir.mkdirs();
- }
- String contents = null;
- if (fileName.endsWith(".java")) {
- contents = preProcessFile(srcFile, "//#");
- } else if (fileName.equals("plugin.xml")) {
- contents = preProcessFile(srcFile, null);
- }
- if (contents == null) {
- // no change, just copy file
- try {
- fUtils.copyFile(srcFile, destFile);
- } catch (IOException e) {
- throw new BuildException(e);
- }
- } else {
- // write new file
- FileWriter writer;
- try {
- writer = new FileWriter(destFile);
- writer.write(contents);
- writer.close();
- } catch (IOException e) {
- throw new BuildException(e);
- }
-
- }
- }
-
- /**
- * Preprocesses a file
- *
- * @param srcFile the file to process
- * @param strip chars to stip off lines in a true condition, or <code>null</code>
- * @return
- */
- public String preProcessFile(File srcFile, String strip) {
- try {
- FileReader fileReader = new FileReader(srcFile);
- BufferedReader reader = new BufferedReader(fileReader);
- StringBuffer buffer = new StringBuffer();
- String line = reader.readLine();
- String activeSymbol = null;
- int state = STATE_OUTSIDE_CONDITION;
- boolean changed = false;
- while (line != null) {
- boolean ifdef = IF_DEF_MATCHER.reset(line).find();
- boolean elseif = ELSE_IF_MATCHER.reset(line).find();
- boolean elze = ELSE_MATCHER.reset(line).find();
- boolean endif = END_MATCHER.reset(line).find();
- boolean commandLine = ifdef || elseif || elze || endif;
- boolean written = false;
- switch (state) {
- case STATE_OUTSIDE_CONDITION:
- if (ifdef) {
- String condition = line.substring(IF_DEF_MATCHER.start(), IF_DEF_MATCHER.end());
- String[] strings = condition.split("\\s+");
- activeSymbol = strings[1].trim();
- if (fSymbols.contains(activeSymbol)) {
- state = STATE_TRUE_CONDITION;
- } else {
- state = STATE_FALSE_CONDITION;
- }
- } else if (elseif) {
- throw new BuildException("#elseif encountered without corresponding #ifdef");
- } else if (elze) {
- throw new BuildException("#else encountered without corresponding #ifdef (" + srcFile.getPath() + ")");
- } else if (endif) {
- throw new BuildException("#endif encountered without corresponding #ifdef");
- }
- break;
- case STATE_TRUE_CONDITION:
- if (elze || elseif) {
- state = STATE_POST_TRUE_CONDITION;
- break;
- } else if (endif) {
- state = STATE_OUTSIDE_CONDITION;
- break;
- } else if (ifdef) {
- throw new BuildException("illegal nested #ifdef");
- }
- break;
- case STATE_FALSE_CONDITION:
- if (elseif) {
- String condition = line.substring(ELSE_IF_MATCHER.start(), ELSE_IF_MATCHER.end());
- String[] strings = condition.split("\\s+");
- activeSymbol = strings[1].trim();
- if (fSymbols.contains(activeSymbol)) {
- state = STATE_TRUE_CONDITION;
- } else {
- state = STATE_FALSE_CONDITION;
- }
- } else if (elze) {
- state = STATE_TRUE_CONDITION;
- break;
- } else if (endif) {
- state = STATE_OUTSIDE_CONDITION;
- break;
- } else if (ifdef) {
- throw new BuildException("illegal nested #ifdef");
- }
- break;
- case STATE_POST_TRUE_CONDITION:
- if (endif) {
- state = STATE_OUTSIDE_CONDITION;
- break;
- } else if (ifdef) {
- throw new BuildException("illegal nested #ifdef");
- }
- break;
- }
- if (!commandLine) {
- if (state == STATE_OUTSIDE_CONDITION || state == STATE_TRUE_CONDITION) {
- if (state == STATE_TRUE_CONDITION && strip != null) {
- if (line.startsWith(strip)) {
- line = line.substring(strip.length());
- }
- }
- buffer.append(line);
- buffer.append("\n");
- written = true;
- }
- }
- changed = changed || !written;
- line = reader.readLine();
- }
- if (!changed) {
- return null;
- }
- return buffer.toString();
- } catch (IOException e) {
- throw new BuildException(e);
- }
- }
-
- public static void main(String[] args) {
- PreProcessor processor = new PreProcessor();
- processor.setSymbols("ex2");
- String string = processor.preProcessFile(new File("c:\\eclipse3.1\\dev\\example.debug.core\\src\\example\\debug\\core\\launcher\\PDALaunchDelegate.java"), "//#");
- //String string = processor.preProcessFile(new File("c:\\eclipse3.1\\dev\\example.debug.core\\plugin.xml"), null);
- System.out.println(string);
- }
-}
diff --git a/org.eclipse.debug.tests/.classpath b/org.eclipse.debug.tests/.classpath
deleted file mode 100644
index 2fbb7a23e..000000000
--- a/org.eclipse.debug.tests/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/J2SE-1.4"/>
- <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.tests/.cvsignore b/org.eclipse.debug.tests/.cvsignore
deleted file mode 100644
index c5e82d745..000000000
--- a/org.eclipse.debug.tests/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin \ No newline at end of file
diff --git a/org.eclipse.debug.tests/.project b/org.eclipse.debug.tests/.project
deleted file mode 100644
index a6fb25e05..000000000
--- a/org.eclipse.debug.tests/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.debug.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.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index f0000fbc4..000000000
--- a/org.eclipse.debug.tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,98 +0,0 @@
-#Thu Sep 24 11:03:22 CDT 2009
-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.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.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-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=disabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-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=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-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.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-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.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-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.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-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.nullReference=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-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.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-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.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-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.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.debug.tests/META-INF/MANIFEST.MF b/org.eclipse.debug.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index 052406d6e..000000000
--- a/org.eclipse.debug.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.debug.tests;singleton:=true
-Bundle-Version: 3.6.0.qualifier
-Bundle-Activator: org.eclipse.debug.tests.TestsPlugin
-Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.debug.ui;bundle-version="[3.6.0,4.0.0)",
- org.junit;bundle-version="3.8.2",
- org.eclipse.core.filesystem;bundle-version="[1.3.0,2.0.0)",
- org.eclipse.test.performance;bundle-version="3.6.0"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Bundle-Vendor: %providerName
diff --git a/org.eclipse.debug.tests/about.html b/org.eclipse.debug.tests/about.html
deleted file mode 100644
index 81aacb112..000000000
--- a/org.eclipse.debug.tests/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>September 11, 2009</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 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</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.tests/build.properties b/org.eclipse.debug.tests/build.properties
deleted file mode 100644
index 9e54bd13e..000000000
--- a/org.eclipse.debug.tests/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- test.xml,\
- about.html,\
- plugin.properties,\
- plugin.xml,\
- test-import/
diff --git a/org.eclipse.debug.tests/plugin.properties b/org.eclipse.debug.tests/plugin.properties
deleted file mode 100755
index 7db3e66ef..000000000
--- a/org.eclipse.debug.tests/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - Initial implementation
-###############################################################################
-
-pluginName=Debug Test Plugin
-providerName=Eclipse.org
diff --git a/org.eclipse.debug.tests/plugin.xml b/org.eclipse.debug.tests/plugin.xml
deleted file mode 100644
index 75673ba84..000000000
--- a/org.eclipse.debug.tests/plugin.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<!--
- Copyright (c) 2009 IBM Corporation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- IBM Corporation - initial API and implementation
- -->
-
-<plugin>
-
- <extension point="org.eclipse.debug.ui.memoryRenderings">
- <renderingType
- id="rendering_type_1"
- name="Rendering One"
- class="org.eclipe.debug.tests.view.memory.RenderingTypeDelegate">
- </renderingType>
- <renderingType
- id="rendering_type_2"
- name="Rendering Two"
- class="org.eclipe.debug.tests.view.memory.RenderingTypeDelegate">
- </renderingType>
- <renderingType
- id="rendering_type_3"
- name="Rendering Default"
- class="org.eclipe.debug.tests.view.memory.RenderingTypeDelegate">
- </renderingType>
- <renderingBindings
- primaryId="rendering_type_1">
- <enablement>
- <instanceof value="org.eclipe.debug.tests.view.memory.MemoryBlockOne"/>
- </enablement>
- </renderingBindings>
- <renderingBindings
- renderingIds="rendering_type_1, rendering_type_2">
- <enablement>
- <instanceof value="org.eclipe.debug.tests.view.memory.MemoryBlockTwo"/>
- </enablement>
- </renderingBindings>
- <renderingBindings
- defaultIds="rendering_type_3">
- <enablement>
- <instanceof value="org.eclipe.debug.tests.view.memory.MemoryBlockThree"/>
- </enablement>
- </renderingBindings>
- <renderingBindings
- class="org.eclipe.debug.tests.view.memory.DynamicRenderingBindings">
- <enablement>
- <instanceof value="org.eclipe.debug.tests.view.memory.MemoryBlockDynamic"/>
- </enablement>
- </renderingBindings>
- </extension>
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- delegate="org.eclipe.debug.tests.launching.TestLaunchDelegate"
- id="org.eclipse.debug.tests.launch.type"
- modes="run, debug"
- name="Test Launch Type">
- </launchConfigurationType>
- </extension>
- <extension
- id="debugFS"
- name="Debug File System"
- point="org.eclipse.core.filesystem.filesystems">
- <filesystem
- scheme="debug">
- <run
- class="org.eclipe.debug.tests.launching.DebugFileSystem">
- </run>
- </filesystem>
- </extension>
- <extension
- point="org.eclipse.debug.core.statusHandlers">
- <statusHandler
- class="org.eclipse.debug.tests.statushandlers.StatusHandler"
- code="333"
- id="org.eclipse.debug.tests.statusHandler"
- plugin="org.eclipse.debug.tests">
- </statusHandler>
- </extension>
-</plugin>
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AbstractLaunchTest.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AbstractLaunchTest.java
deleted file mode 100644
index d3b649354..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AbstractLaunchTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-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.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
-
-import junit.framework.TestCase;
-
-/**
- * Common function for launch related tests.
- */
-public abstract class AbstractLaunchTest extends TestCase {
-
- /**
- * Constructs a test with the given name.
- *
- * @param name
- */
- public AbstractLaunchTest(String name) {
- super(name);
- }
-
- /**
- * Returns the launch manager.
- *
- * @return launch manager
- */
- protected ILaunchManager getLaunchManager() {
- return DebugPlugin.getDefault().getLaunchManager();
- }
-
- /**
- * Returns the singleton instance of the <code>LaunchConfigurationManager</code>
- *
- * @return the singleton instance of the <code>LaunchConfigurationManager</code>
- */
- protected LaunchConfigurationManager getLaunchConfigurationManager() {
- return DebugUIPlugin.getDefault().getLaunchConfigurationManager();
- }
-
- /**
- * Returns a launch configuration with the given name, creating one if required.
- *
- * @param name configuration name
- * @return launch configuration
- * @throws CoreException
- */
- 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];
- if (config.getName().equals(name)) {
- return config;
- }
- }
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(LaunchConfigurationTests.ID_TEST_LAUNCH_TYPE);
- ILaunchConfigurationWorkingCopy wc = type.newInstance(null, name);
- ILaunchConfiguration saved = wc.doSave();
- return saved;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java
deleted file mode 100644
index ddf76214e..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import junit.framework.TestCase;
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-
-/**
- * Tests accelerator adjustments for DBCS languages.
- * See bug 186921.
- *
- * @since 3.3
- */
-public class AcceleratorSubstitutionTests extends TestCase {
-
- /**
- * Constructor
- * @param name the name of the test
- */
- public AcceleratorSubstitutionTests(String name) {
- super(name);
- }
-
- /**
- * tests a string with "..."
- */
- public void testWithEllipses() {
- assertEquals("incorrect DBCS accelerator substitution",
- "Open Run Dialog(&R)...",
- DebugUIPlugin.adjustDBCSAccelerator("Open Run(&R) Dialog..."));
- }
-
- /**
- * tests a string without "..."
- */
- public void testWithoutEllipses() {
- assertEquals("incorrect DBCS accelerator substitution",
- "Open Run Dialog(&R)",
- DebugUIPlugin.adjustDBCSAccelerator("Open Run(&R) Dialog"));
- }
-
- /**
- * tests a string that should not change (no DBCS style accelerator).
- */
- public void testWithoutDBCSAcclerator() {
- assertEquals("incorrect DBCS accelerator substitution",
- "Open &Run Dialog...",
- DebugUIPlugin.adjustDBCSAccelerator("Open &Run Dialog..."));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java
deleted file mode 100644
index dfcab8ff6..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileInfo;
-import org.eclipse.core.filesystem.provider.FileStore;
-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.Path;
-import org.eclipse.core.runtime.Status;
-
-/**
- * Implementation of an in memory file store to test launch configurations on EFS
- */
-public class DebugFileStore extends FileStore {
-
- /**
- * Output steam for writing a file
- */
- class DebugOutputStream extends ByteArrayOutputStream {
-
- /* (non-Javadoc)
- * @see java.io.ByteArrayOutputStream#close()
- */
- public void close() throws IOException {
- super.close();
- DebugFileSystem.getDefault().setContents(toURI(), toByteArray());
- }
-
- }
-
- private URI uri;
-
- public DebugFileStore(URI id) {
- uri = id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#childNames(int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
- URI[] uris = DebugFileSystem.getDefault().getFileURIs();
- List children = new ArrayList();
- IPath me = getPath();
- for (int i = 0; i < uris.length; i++) {
- URI id = uris[i];
- Path path = new Path(id.getPath());
- if (path.segmentCount() > 0) {
- if (path.removeLastSegments(1).equals(me)) {
- children.add(path.lastSegment());
- }
- }
- }
- return (String[]) children.toArray(new String[children.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#fetchInfo(int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
- byte[] contents = DebugFileSystem.getDefault().getContents(toURI());
- FileInfo info = new FileInfo();
- info.setName(getName());
- info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, false);
- if (contents == null) {
- info.setExists(false);
- info.setLength(0L);
- } else {
- info.setExists(true);
- info.setLength(contents.length);
- info.setDirectory(contents == DebugFileSystem.DIRECTORY_BYTES);
- if (info.isDirectory()) {
- info.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
- }
- }
- return info;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#getChild(java.lang.String)
- */
- public IFileStore getChild(String name) {
- try {
- return new DebugFileStore(new URI(getFileSystem().getScheme(), getPath().append(name).toString(), null));
- } catch (URISyntaxException e) {
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#getName()
- */
- public String getName() {
- IPath path = getPath();
- if (path.segmentCount() > 0) {
- return path.lastSegment();
- }
- return "";
- }
-
- /**
- * @return
- */
- private IPath getPath() {
- URI me = toURI();
- IPath path = new Path(me.getPath());
- return path;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#getParent()
- */
- public IFileStore getParent() {
- IPath path = getPath();
- if (path.segmentCount() > 0) {
- try {
- return new DebugFileStore(new URI(getFileSystem().getScheme(), path.removeLastSegments(1).toString(), null));
- } catch (URISyntaxException e) {
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#openInputStream(int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
- byte[] contents = DebugFileSystem.getDefault().getContents(toURI());
- if (contents != null) {
- return new ByteArrayInputStream(contents);
- }
- throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests",
- "File does not exist: " + toURI()));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#openOutputStream(int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
- return new DebugOutputStream();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#mkdir(int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
- IFileInfo info = fetchInfo();
- if (info.exists()) {
- if (!info.isDirectory()) {
- throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests",
- "mkdir failed - file already exists with name: " + toURI()));
- }
- } else {
- 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",
- "mkdir failed - parent does not exist: " + toURI()));
- } else {
- parent.mkdir(EFS.NONE, null);
- }
- }
- }
- return this;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#toURI()
- */
- public URI toURI() {
- return uri;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileStore#delete(int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void delete(int options, IProgressMonitor monitor) throws CoreException {
- DebugFileSystem.getDefault().delete(toURI());
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java
deleted file mode 100644
index d0a7183e4..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileSystem;
-import org.eclipse.core.runtime.Path;
-
-/**
- * A simple in memory file system to test launch configurations in EFS
- */
-public class DebugFileSystem extends FileSystem {
-
- /**
- * represents a directory
- */
- public static final byte[] DIRECTORY_BYTES = new byte[] {1, 2, 3, 4};
-
- private static DebugFileSystem system;
-
- /**
- * Keys URIs to file stores for existing files
- */
- private Map files = new HashMap();
-
- /**
- * Constructs the singleton
- */
- public DebugFileSystem() {
- system = this;
- // create root of the file system
- try {
- setContents(new URI("debug", Path.ROOT.toString(), null), DIRECTORY_BYTES);
- } catch (URISyntaxException e) {}
- }
-
- /**
- * Returns the Debug files system.
- *
- * @return file system
- */
- static DebugFileSystem getDefault() {
- return system;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileSystem#getStore(java.net.URI)
- */
- public IFileStore getStore(URI uri) {
- return new DebugFileStore(uri);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileSystem#canDelete()
- */
- public boolean canDelete() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.filesystem.provider.FileSystem#canWrite()
- */
- public boolean canWrite() {
- return true;
- }
-
- /**
- * Returns whether contents of the file or <code>null</code> if none.
- *
- * @param uri
- * @return bytes or <code>null</code>
- */
- public byte[] getContents(URI uri) {
- return (byte[]) files.get(uri);
- }
-
- /**
- * Deletes the file.
- *
- * @param uri
- */
- public void delete(URI uri) {
- files.remove(uri);
- }
-
- /**
- * Sets the content of the given file.
- *
- * @param uri
- * @param bytes
- */
- public void setContents(URI uri, byte[] bytes) {
- files.put(uri, bytes);
- }
-
- /**
- * Returns URIs of all existing files.
- *
- * @return
- */
- public URI[] getFileURIs() {
- return (URI[])files.keySet().toArray(new URI[files.size()]);
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
deleted file mode 100644
index 71d9ad534..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileSystem;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
-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.internal.core.LaunchManager;
-import org.eclipse.debug.tests.TestsPlugin;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests for launch configurations
- */
-public class LaunchConfigurationTests extends AbstractLaunchTest implements ILaunchConfigurationListener {
-
- /**
- * Identifier of test launch configuration type extension
- */
- public static final String ID_TEST_LAUNCH_TYPE = "org.eclipse.debug.tests.launch.type";
-
- /**
- * The from/to handles during rename operations
- */
- protected ILaunchConfiguration fFrom;
- protected ILaunchConfiguration fTo;
-
- protected Object fLock = new Object();
- protected ILaunchConfiguration fAdded;
- protected ILaunchConfiguration fRemoved;
-
- class Listener implements ILaunchConfigurationListener {
-
- private List addedList = new ArrayList();
- private List removedList = new ArrayList();
- private List changedList = new ArrayList();
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void launchConfigurationAdded(ILaunchConfiguration configuration) {
- addedList.add(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void launchConfigurationChanged(ILaunchConfiguration configuration) {
- changedList.add(configuration);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
- removedList.add(configuration);
- }
-
- public List getAdded() {
- return addedList;
- }
- public List getChanged() {
- return changedList;
- }
- public List getRemoved() {
- return removedList;
- }
-
- }
-
- /**
- * Constructor
- * @param name
- */
- public LaunchConfigurationTests(String name) {
- super(name);
- }
-
- /**
- * Returns a scratch project for launch configurations
- *
- * @return
- */
- protected IProject getProject() throws CoreException {
- return TestsPlugin.createProject("LaunchConfigurationTests");
- }
-
- /**
- * Creates and returns a new launch config the given name, local
- * or shared, with 4 attributes:
- * - String1 = "String1"
- * - Int1 = 1
- * - Boolean1 = true
- * - Boolean2 = false
- */
- protected ILaunchConfigurationWorkingCopy newConfiguration(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- assertTrue("Should support debug mode", type.supportsMode(ILaunchManager.DEBUG_MODE)); //$NON-NLS-1$
- assertTrue("Should support run mode", type.supportsMode(ILaunchManager.RUN_MODE)); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc = type.newInstance(container, name);
- wc.setAttribute("String1", "String1"); //$NON-NLS-1$ //$NON-NLS-2$
- wc.setAttribute("Int1", 1); //$NON-NLS-1$
- wc.setAttribute("Boolean1", true); //$NON-NLS-1$
- wc.setAttribute("Boolean2", false); //$NON-NLS-1$
- assertTrue("Should need saving", wc.isDirty()); //$NON-NLS-1$
- return wc;
- }
-
- /**
- * Creates and returns a new launch configuration with the given name, local
- * or shared, with no attributes
- */
- protected ILaunchConfigurationWorkingCopy newEmptyConfiguration(IContainer container, String name) throws CoreException {
- ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
- ILaunchConfigurationWorkingCopy wc = type.newInstance(container, name);
- assertEquals("Should have no attributes", 0, wc.getAttributes().size());
- return wc;
- }
-
- /**
- * Returns whether the given handle is contained in the specified
- * array of handles.
- */
- protected boolean existsIn(ILaunchConfiguration[] configs, ILaunchConfiguration config) {
- for (int i = 0; i < configs.length; i++) {
- if (configs[i].equals(config)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Creates a local working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes.
- *
- * @throws CoreException
- */
- public void testCreateLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertEquals("String1 should be String1", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Int1 should be 1", handle.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$//$NON-NLS-2$
-
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Creates a local working copy configuration and tests its name.
- *
- * @throws CoreException
- */
- public void testLocalName() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "localName"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertEquals("Wrong name", handle.getName(), "localName"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Creates a shared working copy configuration and tests is name.
- */
- public void testSharedName() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "sharedName"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertEquals("Wrong name", handle.getName(), "sharedName"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Ensures that a launch configuration returns a complete attribute map
- * @throws CoreException
- */
- public void testGetAttributes() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- Map attributes = handle.getAttributes();
- // retrieve attributes
- assertEquals("String1 should be String1", "String1", attributes.get("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("Int1 should be 1", new Integer(1), attributes.get("Int1")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Boolean1 should be true", Boolean.valueOf(true), attributes.get("Boolean1")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Boolean2 should be false", Boolean.valueOf(false), attributes.get("Boolean2")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Ensures that set attributes works
- * @throws CoreException
- */
- public void testSetAttributes() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
- Map map = new HashMap();
- map.put("ATTR1", "ONE"); //$NON-NLS-1$ //$NON-NLS-2$
- map.put("ATTR2", "TWO"); //$NON-NLS-1$ //$NON-NLS-2$
- wc.setAttributes(map);
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- Map attributes = handle.getAttributes();
- assertEquals("should have two attributes", 2, attributes.size()); //$NON-NLS-1$
- // retrieve attributes
- assertEquals("ATTR1 should be ONE", "ONE", attributes.get("ATTR1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertEquals("ATTR2 should be TWO", "TWO", attributes.get("ATTR2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Ensures that set attributes to <code>null</code> works
- * @throws CoreException
- */
- public void testSetNullAttributes() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config1"); //$NON-NLS-1$
- wc.setAttributes(null);
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- Map attributes = handle.getAttributes();
- assertEquals("should have no attributes", 0, attributes.size()); //$NON-NLS-1$
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * 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
- */
- public void testLocalCopy() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configToCopy"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
-
- ILaunchConfigurationWorkingCopy softCopy = handle.copy("CopyOf" + handle.getName()); //$NON-NLS-1$
- assertNull("Original in copy should be null", softCopy.getOriginal()); //$NON-NLS-1$
- ILaunchConfiguration hardCopy = softCopy.doSave();
-
- // retrieve attributes
- assertTrue("String1 should be String1", hardCopy.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", hardCopy.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", hardCopy.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !hardCopy.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertTrue("Original should still exist", handle.exists()); //$NON-NLS-1$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- hardCopy.delete();
- assertTrue("Config should not exist after deletion", !hardCopy.exists()); //$NON-NLS-1$
- }
-
- /**
- * Create a config and save it twice, ensuring it only
- * ends up in the index once.
- * @throws CoreException
- */
- public void testDoubleSave() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "configDoubleSave"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
-
- String name = wc.getName();
- wc.rename("newName"); //$NON-NLS-1$
- wc.rename(name);
- assertTrue("Should be dirty", wc.isDirty()); //$NON-NLS-1$
- wc.doSave();
-
- ILaunchConfiguration[] newConfigs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Should be the same number of configs", newConfigs.length == configs.length); //$NON-NLS-1$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
-
- }
-
- /**
- * 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
- */
- public void testDeleteLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2delete"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- File file = wc.getLocation().toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // delete
- handle.delete();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
-
- // ensure handle is not in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should not exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
- }
-
- /**
- * 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
- */
- public void testRenameLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2rename"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // rename
- wc = handle.getWorkingCopy();
- wc.rename("config-2-rename"); //$NON-NLS-1$
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$//$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Moves a local configuration to a shared location
- * @throws CoreException
- */
- public void testMoveLocalToSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config2share"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // move
- wc = handle.getWorkingCopy();
- wc.setContainer(getProject());
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Moves a local configuration to a shared location
- * @throws CoreException
- */
- public void testMoveSharedToLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2local"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // move
- wc = handle.getWorkingCopy();
- wc.setContainer(null);
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Creates a shared working copy configuration, sets some attributes,
- * and saves the working copy, and retrieves the attributes.
- * @throws CoreException
- */
- public void testCreateSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * 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
- */
- public void testSharedCopy() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "config2Copy"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
-
- // copy
- ILaunchConfigurationWorkingCopy softCopy = handle.copy("CopyOf" + handle.getName()); //$NON-NLS-1$
- ILaunchConfiguration hardCopy = softCopy.doSave();
-
- // retrieve attributes
- assertTrue("String1 should be String1", hardCopy.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", hardCopy.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", hardCopy.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !hardCopy.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertTrue("Original should still exist", handle.exists()); //$NON-NLS-1$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- hardCopy.delete();
- assertTrue("Config should not exist after deletion", !hardCopy.exists()); //$NON-NLS-1$
- }
-
-
- /**
- * 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
- */
- public void testDeleteSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2delete"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // delete
- handle.delete();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
-
- // ensure handle is not in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should not exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
- }
-
- /**
- * 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
- */
- public void testRenameSharedConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "shared2rename"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // rename
- wc = handle.getWorkingCopy();
- wc.rename("shared-2-rename"); //$NON-NLS-1$
- addConfigListener();
- ILaunchConfiguration newHandle = wc.doSave();
- removeConfigListener();
- assertTrue("Config should no longer exist", !handle.exists()); //$NON-NLS-1$
- assertEquals("From should be original", handle, fFrom); //$NON-NLS-1$
- assertEquals("To should be new handle", newHandle, fTo); //$NON-NLS-1$
-
- // retrieve new attributes
- assertTrue("String1 should be String1", newHandle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", newHandle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", newHandle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !newHandle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is in the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Renamed configuration should exist in project index", existsIn(configs, newHandle)); //$NON-NLS-1$
- assertTrue("Original configuration should NOT exist in project index", !existsIn(configs, handle)); //$NON-NLS-1$
-
- // cleanup
- newHandle.delete();
- assertTrue("Config should not exist after deletion", !newHandle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Closes all editors in the active workbench page.
- */
- protected void closeAllEditors() {
- IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- activeWorkbenchWindow.getActivePage().closeAllEditors(false);
- }
-
- /**
- * Creates a few configs, closes the project and re-opens the
- * project to ensure the config index is persisted properly
- * @throws CoreException
- */
- public void testPersistIndex() throws CoreException {
- // close all editors before closing project: @see bug 204023
- closeAllEditors();
-
- ILaunchConfigurationWorkingCopy wc1 = newConfiguration(null, "persist1local"); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc2 = newConfiguration(getProject(), "persist2shared"); //$NON-NLS-1$
- ILaunchConfiguration lc1 = wc1.doSave();
- ILaunchConfiguration lc2 = wc2.doSave();
-
- IProject project = getProject();
- ILaunchConfiguration[] before = getLaunchManager().getLaunchConfigurations();
- assertTrue("config should be in index", existsIn(before, lc1)); //$NON-NLS-1$
- assertTrue("config should be in index", existsIn(before, lc2)); //$NON-NLS-1$
-
- project.close(null);
- ILaunchConfiguration[] during = getLaunchManager().getLaunchConfigurations();
- boolean local = true;
- for (int i = 0; i < during.length; i++) {
- // must be local, or not from the closed project
- local = local && (during[i].isLocal() || !during[i].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$
- }
-
- // cleanup
- lc1.delete();
- assertTrue("Config should not exist after deletion", !lc1.exists()); //$NON-NLS-1$
- lc2.delete();
- assertTrue("Config should not exist after deletion", !lc2.exists()); //$NON-NLS-1$
-
-
- }
-
-
- /**
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void launchConfigurationAdded(ILaunchConfiguration configuration) {
- fFrom = getLaunchManager().getMovedFrom(configuration);
- synchronized (fLock) {
- fAdded = configuration;
- fLock.notifyAll();
- }
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void launchConfigurationChanged(ILaunchConfiguration configuration) {
- }
-
- /**
- * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
- */
- public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
- fTo = getLaunchManager().getMovedTo(configuration);
- synchronized (fLock) {
- fRemoved = configuration;
- fLock.notifyAll();
- }
- }
-
- protected void addConfigListener() {
- getLaunchManager().addLaunchConfigurationListener(this);
- }
-
- protected void removeConfigListener() {
- getLaunchManager().removeLaunchConfigurationListener(this);
- }
-
- /**
- * Ensures that a removal notification is sent for a shared config in a project
- * that is deleted.
- *
- * @throws Exception
- */
- public void testDeleteProjectWithSharedConfig() throws Exception {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("DeleteSharedConfig"); //$NON-NLS-1$
- try {
- assertFalse("project should not exist yet", project.exists()); //$NON-NLS-1$
- project.create(null);
- assertTrue("project should now exist", project.exists()); //$NON-NLS-1$
- project.open(null);
- assertTrue("project should be open", project.isOpen()); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy wc = newConfiguration(project, "ToBeDeleted"); //$NON-NLS-1$
-
- addConfigListener();
- ILaunchConfiguration configuration = wc.doSave();
- assertEquals(configuration, fAdded);
-
- synchronized (fLock) {
- fRemoved = null;
- project.delete(true, false, null);
- if (fRemoved == null) {
- fLock.wait(10000);
- }
- }
- assertEquals(configuration, fRemoved);
- } finally {
- if (project.exists()) {
- project.delete(true, false, null);
- }
- removeConfigListener();
- }
- }
-
- /**
- * Tests a nested working copy.
- *
- * @throws CoreException
- */
- public void testNestedWorkingCopyLocalConfiguration() throws CoreException {
- ILaunchConfigurationWorkingCopy wc = newConfiguration(null, "config123"); //$NON-NLS-1$
- IPath location = wc.getLocation();
- ILaunchConfiguration handle = wc.doSave();
- File file = location.toFile();
- assertTrue("Configuration file should exist", file.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertEquals("String1 should be String1", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Int1 should be 1", handle.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // ensure new handle is the index
- ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations();
- assertTrue("Configuration should exist in project index", existsIn(configs, handle)); //$NON-NLS-1$
-
- // get a working copy
- wc = handle.getWorkingCopy();
- ILaunchConfigurationWorkingCopy nested = wc.getWorkingCopy();
-
- // verify nested is same as original
- assertEquals("String1 should be String1", nested.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Int1 should be 1", nested.getAttribute("Int1", 0), 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", nested.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !nested.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // change an attribute in the nested working copy
- nested.setAttribute("String1", "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong attribute value", nested.getAttribute("String1", "Missing"), "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong attribute value", wc.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong attribute value", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // save back to parent
- ILaunchConfigurationWorkingCopy parent = nested.getParent();
- assertEquals("Wrong parent", wc, parent); //$NON-NLS-1$
- assertNull("Should have no parent", wc.getParent()); //$NON-NLS-1$
- nested.doSave();
- assertEquals("Wrong attribute value", wc.getAttribute("String1", "Missing"), "StringOne"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
- assertEquals("Wrong attribute value", handle.getAttribute("String1", "Missing"), "String1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // check originals
- assertEquals("Wrong original config" , handle, wc.getOriginal()); //$NON-NLS-1$
- assertEquals("Wrong original config" , handle, nested.getOriginal()); //$NON-NLS-1$
-
- // cleanup
- handle.delete();
- assertTrue("Config should not exist after deletion", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Creates a configuration in an EFS linked folder. Deletes configuration directly.
- *
- * @throws CoreException
- * @throws URISyntaxException
- */
- public void testCreateDeleteEFS() throws CoreException, URISyntaxException {
- IFileSystem fileSystem = EFS.getFileSystem("debug");
- assertNotNull("Missing debug EFS", fileSystem);
-
- // create folder in EFS
- IFolder folder = getProject().getFolder("efs");
- folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null);
-
- // create configuration
- ILaunchConfigurationWorkingCopy wc = newConfiguration(folder, "efsConfig"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // delete configuration
- handle.delete();
- assertTrue("Configuration should not exist", !handle.exists()); //$NON-NLS-1$
-
- // cleanup
- folder.delete(IResource.NONE, null);
- }
-
- /**
- * Creates a configuration in an EFS linked folder. Deletes the folder to ensure the
- * configuration is also deleted.
- *
- * @throws CoreException
- * @throws URISyntaxException
- */
- public void testCreateDeleteEFSLink() throws CoreException, URISyntaxException {
- IFileSystem fileSystem = EFS.getFileSystem("debug");
- assertNotNull("Missing debug EFS", fileSystem);
-
- // create folder in EFS
- IFolder folder = getProject().getFolder("efs2");
- folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null);
-
- // create configuration
- ILaunchConfigurationWorkingCopy wc = newConfiguration(folder, "efsConfig"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // cleanup
- folder.delete(IResource.NONE, null);
- assertTrue("Configuration should not exist", !handle.exists()); //$NON-NLS-1$
- }
-
- /**
- * Test that renaming a project with a linked EFS folder containing a shared
- * launch configuration is properly updated.
- *
- * @throws Exception
- */
- public void testEFSProjectRename() throws Exception {
- // create test project
- IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("RenameEFS");
- if (pro.exists()) {
- pro.delete(true, true, null);
- }
- // create project
- IProject project = TestsPlugin.createProject("RenameEFS");
-
- IFileSystem fileSystem = EFS.getFileSystem("debug");
- assertNotNull("Missing debug EFS", fileSystem);
-
- // create folder in EFS
- IFolder folder = project.getFolder("efs2");
- folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null);
-
- // create configuration
- ILaunchConfigurationWorkingCopy wc = newConfiguration(folder, "efsConfig"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // rename project
- IProjectDescription description = project.getDescription();
- description.setName("SFEemaneR"); // reverse name
- project.move(description, false, null);
-
- // original configuration should no longer exist - handle out of date
- assertTrue("Configuration should not exist", !handle.exists()); //$NON-NLS-1$
-
- // get the new handle
- project = ResourcesPlugin.getWorkspace().getRoot().getProject("SFEemaneR");
- assertTrue("Project should exist", project.exists());
- IFile file = project.getFile(new Path("efs2/efsConfig.launch"));
- assertTrue("launch config file should exist", file.exists());
- handle = getLaunchManager().getLaunchConfiguration(file);
- assertTrue("launch config should exist", handle.exists());
-
- // retrieve attributes
- assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertTrue("Int1 should be 1", handle.getAttribute("Int1", 0) == 1); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean1 should be true", handle.getAttribute("Boolean1", false)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
-
- // validate shared location
- assertEquals("Shared location should be updated", file, handle.getFile());
-
- // cleanup
- project.delete(IResource.NONE, null);
- assertTrue("Configuration should not exist", !handle.exists()); //$NON-NLS-1$
-
- }
-
- /**
- * Tests launch configuration import.
- *
- * @throws Exception
- */
- public void testImport() throws Exception {
- // create a shared configuration "Import4" in the workspace to be overwritten on import
- ILaunchConfigurationWorkingCopy wc = newConfiguration(getProject(), "Import4"); //$NON-NLS-1$
- ILaunchConfiguration handle = wc.doSave();
- assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
-
- File dir = TestsPlugin.getDefault().getFileInPlugin(new Path("test-import"));
- assertTrue("Import directory does not exist", dir.exists());
- LaunchManager manager = (LaunchManager) getLaunchManager();
-
- Listener listener = new Listener();
- try {
- getLaunchManager().addLaunchConfigurationListener(listener);
- // import
- manager.importConfigurations(dir.listFiles(
- new FileFilter() {
- public boolean accept(File file) {
- return file.isFile() &&
- file.getName().endsWith(
- ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
- }
- }),
- null);
-
- // should be one removed
- List removed = listener.getRemoved();
- assertEquals("Should be one removed config", 1, removed.size());
- assertTrue("Import4 should be removed", removed.contains(handle));
-
- // should be 5 added
- List added = listener.getAdded();
- assertEquals("Should be 5 added configs", 5, added.size());
- Set names = new HashSet();
- Iterator iterator = added.iterator();
- while (iterator.hasNext()) {
- ILaunchConfiguration lc = (ILaunchConfiguration) iterator.next();
- names.add(lc.getName());
- }
- assertTrue("Missing Name", names.contains("Import1"));
- assertTrue("Missing Name", names.contains("Import2"));
- assertTrue("Missing Name", names.contains("Import3"));
- assertTrue("Missing Name", names.contains("Import4"));
- assertTrue("Missing Name", names.contains("Import5"));
-
- // should be one changed
- List changed = listener.getChanged();
- assertEquals("Should be 1 changed config", 1, changed.size());
- assertEquals("Wrong changed config", "Import4", ((ILaunchConfiguration)changed.get(0)).getName());
- } finally {
- manager.removeLaunchConfigurationListener(listener);
- }
-
- }
-
- /**
- * Tests the location of a local working copy.
- *
- * @throws CoreException
- */
- public void testWorkingCopyGetLocation() throws CoreException {
- ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-get-location");
- IPath location = workingCopy.getLocation();
- assertEquals("Wrong path for local working copy", LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.append("test-get-location.launch"), location);
- }
-
-}
-
-
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchHistoryTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchHistoryTests.java
deleted file mode 100644
index d7b1ed70f..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchHistoryTests.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-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;
-
-/**
- * Test the utilization of launch histories: sizing, ordering, completeness and correctness
- *
- * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory
- * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager
- * @see org.eclipse.debug.internal.ui.ILaunchHistoryChangedListener
- * @see org.eclipse.debug.ui.actions.AbstractLaunchHistoryAction
- *
- * @since 3.3
- */
-public class LaunchHistoryTests extends AbstractLaunchTest {
-
- /**
- * Constructor
- * @param name
- */
- public LaunchHistoryTests(String name) {
- super(name);
- }
-
- /**
- * Returns the run launch history
- * @return
- */
- private LaunchHistory getRunLaunchHistory() {
- return getLaunchConfigurationManager().getLaunchHistory(IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
- }
-
- /**
- * Returns the maximum allowed size of the launch histories
- * @return the maximum size of the launch histories
- */
- private int getMaxHistorySize() {
- return DebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_HISTORY_SIZE);
- }
-
- /**
- * Sets the maximum size of the launch history to the specified value
- * @param value the new maximum size for launch histories
- */
- private void setMaxHistorySize(int value) {
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_HISTORY_SIZE, value);
- }
-
- /**
- * Returns the debug launch history
- * @return
- */
- private LaunchHistory getDebugLaunchHistory() {
- return getLaunchConfigurationManager().getLaunchHistory(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
- }
-
- /**
- * This method tests that an item added to the history is added to the head of
- * history.
- */
- public void testHistoryAddition() throws CoreException {
- LaunchHistory runhistory = getRunLaunchHistory();
- assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
- ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("The run history should contain the LaunchHistoryTest config", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("The most recent launch should be LaunchHistoryTest", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- }
-
- /**
- * 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
- */
- public void testHistoriesInSync() throws CoreException {
- LaunchHistory runhistory = getRunLaunchHistory();
- assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
- LaunchHistory debughistory = getDebugLaunchHistory();
- assertNotNull("the debug launch history should not be null", debughistory); //$NON-NLS-1$
- ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("the run history should contain LaunchHistoryTest", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("the run recent launch should be LaunchHistoryTest", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- assertTrue("the debug history should contain LaunchHistoryTest", debughistory.contains(config)); //$NON-NLS-1$
- assertEquals("the debug recent launch should be LaunchHistoryTest", debughistory.getRecentLaunch(), config); //$NON-NLS-1$
- }
-
- /**
- * If we launch config A, then config B, and then config A again, A should be the most recent launch
- */
- public void testHistoryReodering() throws CoreException {
- LaunchHistory runhistory = getRunLaunchHistory();
- assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
- ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("The run history should contain the LaunchHistoryTest config", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("The most recent launch should be LaunchHistoryTest", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- config = getLaunchConfiguration("LaunchHistoryTest2"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest2 launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("The run history should contain the LaunchHistoryTest2 config", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("The most recent launch should be LaunchHistoryTest2", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("The run history should contain the LaunchHistoryTest config", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("The most recent launch should be LaunchHistoryTest", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- }
-
- /**
- * If we rename a launch configuration it should not effect the launch history if the renamed configuration
- * is present in the history.
- */
- public void testRenameConfigHistoryUpdate() throws CoreException {
- LaunchHistory runhistory = getRunLaunchHistory();
- assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
- ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("The run history should contain the LaunchHistoryTest config", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("The most recent launch should be LaunchHistoryTest", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
- copy.rename("RenamedLaunchHistoryItem"); //$NON-NLS-1$
- config = copy.doSave();
- assertEquals("the renamed config should still be the first on in the history", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
-
- //rename the configuration back to what it was
- copy = config.getWorkingCopy();
- copy.rename("LaunchHistoryTest"); //$NON-NLS-1$
- config = copy.doSave();
- }
-
- /**
- * 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.
- */
- public void testDeleteLaunchConfigurationHistoryUpdate() throws CoreException {
- LaunchHistory runhistory = getRunLaunchHistory();
- assertNotNull("The run launch history should not be null", runhistory); //$NON-NLS-1$
- ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("The run history should contain the LaunchHistoryTest config", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("The most recent launch should be LaunchHistoryTest", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- config = getLaunchConfiguration("LaunchHistoryTest2"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest2 launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- assertTrue("The run history should contain the LaunchHistoryTest2 config", runhistory.contains(config)); //$NON-NLS-1$
- assertEquals("The most recent launch should be LaunchHistoryTest2", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- config.delete();
- config = getLaunchConfiguration("LaunchHistoryTest"); //$NON-NLS-1$
- assertEquals("the run history should have LaunchHistoryTest as the recent launch after delete", runhistory.getRecentLaunch(), config); //$NON-NLS-1$
- }
-
- /**
- * Tests that setting the size of the launch history appropriately changes what will be returned
- * when the history is queried for it contents
- */
- 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$
- assertNotNull("LaunchHistoryTest launch config should not be null", config); //$NON-NLS-1$
- config.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- config = getLaunchConfiguration("LaunchHistoryTest2"); //$NON-NLS-1$
- assertNotNull("LaunchHistoryTest2 launch config should not be null", config); //$NON-NLS-1$
- 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/eclipe/debug/tests/launching/LaunchManagerTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java
deleted file mode 100644
index 842092b64..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.internal.core.LaunchManager;
-
-/**
- *
- * Variety of tests for the {@link org.eclipse.debug.internal.core.LaunchManager}
- *
- * @since 3.6
- */
-public class LaunchManagerTests extends AbstractLaunchTest {
-
- /**
- * Constructor
- * @param name
- */
- public LaunchManagerTests(String name) {
- super(name);
- }
-
- /**
- * Tests generating a valid launch configuration name
- */
- public void testGenereateConfigName() {
- String configname = "launch_configuration";
- String name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configname);
- assertTrue("the name nust be '"+configname+"'", name.equals(configname));
- }
-
- /**
- * Tests generating a launch configuration name with an unsupported char using
- * the deprecated method
- */
- public void testGenereateConfigNameBadChar() {
- String configname = "config:name";
- String name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configname);
- assertEquals("config name should be '"+configname+"'", configname, name);
- }
-
- /**
- * Tests generating a launch configuration name using a name that is an OS reserved
- * name. Win 32 test only.
- */
- public void testGenerateConfigNameReservedName() {
- if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "aux";
- String name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configname);
- assertEquals("config name should be '"+configname+"'", configname, name);
- }
- }
-
- /**
- * Tests generating a configuration name that contains an invalid character
- */
- public void testGenerateBadConfigName() {
- String configname = "config:name";
- String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'config_name'", "config_name", name);
- }
-
- /**
- * 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.
- */
- public void testGenerateConflictingName() {
- if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "aux";
- String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'launch_configuration'", "launch_configuration", name);
- }
- }
-
- /**
- * Tests generating a configuration name that contains an invalid character and where there
- * is another config with the replaced name already
- */
- public void testGenerateBadCharConflict() throws Exception {
- String configname = "config:name";
- String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'config_name'", "config_name", name);
- getLaunchConfiguration(name);
- name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'config_name (1)'", "config_name (1)", name);
- ILaunchConfiguration config = getLaunchConfiguration("config_name");
- config.delete();
- }
-
- /**
- * 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.
- */
- public void testGenerateBadNameConflict() throws Exception {
- if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "com2";
- String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'launch_configuration'", "launch_configuration", name);
- getLaunchConfiguration(name);
- name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'launch_configuration (1)'", "launch_configuration (1)", name);
- ILaunchConfiguration config = getLaunchConfiguration("launch_configuration");
- config.delete();
- }
- }
-
- /**
- * Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
- */
- public void testValidateConfigGoodName() {
- String configname = "configname";
- try {
- getLaunchManager().isValidLaunchConfigurationName(configname);
- }
- catch(IllegalArgumentException iae) {
- fail("the config name should not have thrown an exception during validation");
- }
- }
-
- /**
- * Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
- */
- public void testValidateConfigBadCharName() {
- String configname = "config:name";
- try {
- getLaunchManager().isValidLaunchConfigurationName(configname);
- }
- catch(IllegalArgumentException iae) {
- return;
- }
- fail("the config name should have thrown an exception during validation");
- }
-
- /**
- * Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
- */
- public void testValidateConfigBadName() {
- if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "com1";
- try {
- getLaunchManager().isValidLaunchConfigurationName(configname);
- }
- catch(IllegalArgumentException iae) {
- return;
- }
- fail("the config name should have thrown an exception during validation");
- }
- }
-
- /**
- * Tests that generating a configuration name when there exists a configuration with that name
- * already properly updates a '(N)' counter at the end
- */
- public void testGenerateNameExistingConfig() throws Exception {
- String configname = "x.y.z.configname";
- getLaunchConfiguration(configname);
- String name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configname);
- assertEquals("the configuration name should have been "+configname+" (1)", configname+" (1)", name);
- getLaunchConfiguration(name);
- name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(name);
- assertEquals("the configuration name should have been "+configname+" (2)", configname+" (2)", name);
- ILaunchConfiguration config = getLaunchConfiguration(configname);
- if(config != null) {
- config.delete();
- }
- config = getLaunchConfiguration(configname +" (1)");
- if(config != null) {
- config.delete();
- }
- }
-
- /**
- * Tests that removing an accelerator properly removes it without affecting the base string (readable) value
- */
- public void testRemoveAcc() {
- String text = "&Remove";
- String label = LaunchManager.removeAccelerators(text);
- assertEquals("the label should be 'Remove'", "Remove", label);
- text = "Remo&ve";
- label = LaunchManager.removeAccelerators(text);
- assertEquals("the label should be 'Remove'", "Remove", label);
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java
deleted file mode 100644
index 900e4d066..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import java.io.ByteArrayInputStream;
-
-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.IWorkspaceRoot;
-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.tests.TestsPlugin;
-import org.eclipse.debug.ui.RefreshTab;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests the refresh tab.
- */
-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
- */
- protected void setSelection(IResource resource) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- assertNotNull("The active workbench page should not be null", page);
- IViewPart part;
- try {
- part = page.showView("org.eclipse.ui.views.ResourceNavigator");
- IWorkbenchPartSite site = part.getSite();
- assertNotNull("The part site for org.eclipse.ui.views.ResourceNavigator should not be null ", site);
- ISelectionProvider provider = site.getSelectionProvider();
- assertNotNull("the selection provider should not be null for org.eclipse.ui.views.ResourceNavigator", provider);
- provider.setSelection(new StructuredSelection(resource));
- } catch (PartInitException e) {
- assertNotNull("Failed to open navigator view", null);
- }
- }
-
- /**
- * Tests a refresh scope of the selected resource
- * @throws CoreException
- */
- public void testSelectedResource() throws CoreException {
- String scope = "${resource}";
- IResource resource = getProject().getFolder("src");
- setSelection(resource);
- IResource[] result = RefreshTab.getRefreshResources(scope);
- assertNotNull(result);
- assertEquals(1, result.length);
- assertEquals(resource, result[0]);
- }
-
- /**
- * Tests a refresh scope of the selected resource's container
- * @throws CoreException
- */
- public void testSelectionsFolder() throws CoreException {
- String scope = "${container}";
- IResource resource = getProject().getFolder("src");
- setSelection(resource);
- IResource[] result = RefreshTab.getRefreshResources(scope);
- assertNotNull(result);
- assertEquals(1, result.length);
- assertEquals(resource.getParent(), result[0]);
- }
-
- /**
- * Tests a refresh scope of the selected resource's project
- * @throws CoreException
- */
- public void testSelectionsProject() throws CoreException {
- String scope = "${project}";
- IResource resource = getProject().getFolder("src");
- setSelection(resource);
- IResource[] result = RefreshTab.getRefreshResources(scope);
- assertNotNull(result);
- assertEquals(1, result.length);
- assertEquals(resource.getProject(), result[0]);
- }
-
- /**
- * Tests a refresh scope of the selected resource's project
- * @throws CoreException
- */
- public void testWorkspaceScope() throws CoreException {
- String scope = "${workspace}";
- IResource[] result = RefreshTab.getRefreshResources(scope);
- assertNotNull(result);
- assertEquals(1, result.length);
- assertEquals(ResourcesPlugin.getWorkspace().getRoot(), result[0]);
- }
-
- /**
- * Tests a refresh scope for a specific resource (old format)
- * @throws CoreException
- */
- public void testSpecificResource() throws CoreException {
- String scope = "${resource:/RefreshTabTests/some.file}";
- IResource resource = getProject().getFile("some.file");
- IResource[] result = RefreshTab.getRefreshResources(scope);
- assertNotNull(result);
- assertEquals(1, result.length);
- assertEquals(resource, result[0]);
- }
-
- /**
- * Tests a refresh scope for a working set
- * @throws CoreException
- */
- 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");
- IResource[] result = RefreshTab.getRefreshResources(scope);
- assertNotNull(result);
- assertEquals(1, result.length);
- assertEquals(resource, result[0]);
- }
-
- /**
- * Returns a scratch project for launch configurations
- *
- * @return
- */
- protected IProject getProject() throws CoreException {
- IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- IProject project= root.getProject("RefreshTabTests");
- if (!project.exists()) {
- project = TestsPlugin.createProject("RefreshTabTests");
- IFolder folder = project.getFolder("src");
- folder.create(false, true, null);
- IFile file = project.getFile("some.file");
- file.create(new ByteArrayInputStream("test file".getBytes()), false, null);
- }
- return project;
- }
-
- /**
- * Tests the launch configuration attribute comparator extension for comparing
- * old/new attribute styles.
- *
- * @throws CoreException
- */
- 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>}";
- assertEquals("Comparator should return 0", 0, new RefreshScopeComparator().compare(oldStyle, newStyle));
- }
-
- /**
- * Tests persist restore of some resources.
- *
- * @throws CoreException
- */
- public void testResourceMemento() throws CoreException {
- IResource[] resources = new IResource[]{getProject(), getProject().getFile("not.exist"), getProject().getFile("some.file")};
- String memento = RefreshUtil.toMemento(resources);
- IResource[] restore = RefreshUtil.toResources(memento);
- assertEquals(resources.length, restore.length);
- assertEquals(resources[0], restore[0]);
- assertEquals(resources[1], restore[1]);
- assertEquals(resources[2], restore[2]);
- }
-
- /**
- * Tests persist/restore of empty resource collection.
- *
- * @throws CoreException
- */
- public void testEmptyResourceSet() throws CoreException {
- String memento = RefreshUtil.toMemento(new IResource[]{});
- IResource[] resources = RefreshUtil.toResources(memento);
- assertNotNull(resources);
- assertEquals("Should be empty", 0, resources.length);
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/TestLaunchDelegate.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/TestLaunchDelegate.java
deleted file mode 100644
index 54994d369..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/TestLaunchDelegate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.launching;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-
-/**
- * An empty lauch delegate
- */
-public class TestLaunchDelegate extends LaunchConfigurationDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java
deleted file mode 100644
index 0bf6f5c5e..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.memory.AbstractMemoryRenderingBindingsProvider;
-import org.eclipse.debug.ui.memory.IMemoryRenderingType;
-
-/**
- * Contributed dynamic rendernig bindings.
- * @since 3.1
- */
-public class DynamicRenderingBindings extends AbstractMemoryRenderingBindingsProvider {
-
- //
- private static DynamicRenderingBindings fgSingleton = null;
-
- // id of rendering type bound by this provider
- private String fId = "rendering_type_1";
-
- /**
- * Constructor
- */
- public DynamicRenderingBindings() {
- fgSingleton = this;
- }
-
- /**
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getRenderingTypes(org.eclipse.debug.core.model.IMemoryBlock)
- */
- public IMemoryRenderingType[] getRenderingTypes(IMemoryBlock block) {
- return new IMemoryRenderingType[]{getPrimaryRenderingType(block)};
- }
-
- /**
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getDefaultRenderingTypes(org.eclipse.debug.core.model.IMemoryBlock)
- */
- public IMemoryRenderingType[] getDefaultRenderingTypes(IMemoryBlock block) {
- return new IMemoryRenderingType[]{getPrimaryRenderingType(block)};
- }
-
- /**
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#getPrimaryRenderingType(org.eclipse.debug.core.model.IMemoryBlock)
- */
- public IMemoryRenderingType getPrimaryRenderingType(IMemoryBlock block) {
- return DebugUITools.getMemoryRenderingManager().getRenderingType(fId);
- }
-
- /**
- * Sets the current rendering bound to this provider, and notifies
- * listeners of the change.
- *
- * @param id rendering id
- */
- public static void setBinding(String id) {
- fgSingleton.fId = id;
- fgSingleton.fireBindingsChanged();
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java
deleted file mode 100644
index d9705418f..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-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.IMemoryBlock;
-
-/**
- * Dummy memory block implementation.
- *
- * @since 3.1
- */
-public class MemoryBlock implements IMemoryBlock {
-
- /**
- * @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress()
- */
- public long getStartAddress() {
- return 0;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
- */
- public long getLength() {
- return 100;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IMemoryBlock#getBytes()
- */
- public byte[] getBytes() throws DebugException {
- byte[] bytes = new byte[(int)getLength()];
- for (int i = 0; i < bytes.length; i++) {
- bytes[i] = (byte)i;
- }
- return bytes;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IMemoryBlock#supportsValueModification()
- */
- public boolean supportsValueModification() {
- return false;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IMemoryBlock#setValue(long, byte[])
- */
- public void setValue(long offset, byte[] bytes) throws DebugException {
-
- }
-
- /**
- * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
- */
- public String getModelIdentifier() {
- return "no.debugger";
- }
-
- /**
- * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
- */
- public IDebugTarget getDebugTarget() {
- return null;
- }
-
- /**
- * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
- */
- public ILaunch getLaunch() {
- return null;
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockDynamic.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockDynamic.java
deleted file mode 100644
index 53ffe59ca..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockDynamic.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-
-/**
- * Dummy memory block
- *
- * @since 3.1
- */
-public class MemoryBlockDynamic extends MemoryBlock {
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockOne.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockOne.java
deleted file mode 100644
index 06a07fafa..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockOne.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-
-/**
- * Dummy memory block
- *
- * @since 3.1
- */
-public class MemoryBlockOne extends MemoryBlock {
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockThree.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockThree.java
deleted file mode 100644
index 81ac323c1..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockThree.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-
-/**
- * Dummy memory block
- *
- * @since 3.1
- */
-public class MemoryBlockThree extends MemoryBlock {
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockTwo.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockTwo.java
deleted file mode 100644
index 63c22c7d0..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlockTwo.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-
-/**
- * Dummy memory block
- *
- * @since 3.1
- */
-public class MemoryBlockTwo extends MemoryBlock {
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java
deleted file mode 100644
index 448c7ef68..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-import junit.framework.TestCase;
-
-import org.eclipse.debug.core.model.IMemoryBlock;
-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;
-
-/**
- * Tests memory rendering manager
- */
-public class MemoryRenderingTests extends TestCase {
-
- public MemoryRenderingTests(String name) {
- super(name);
- }
-
- public void testRenderingTypes() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryRenderingType[] types = manager.getRenderingTypes();
- assertTrue("Wrong number of rendering types contributed", types.length > 6);
- assertTrue("Missing type 1", indexOf(manager.getRenderingType("rendering_type_1"), types) >= 0);
- assertTrue("Missing type 2", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0);
- assertTrue("Missing type 3", indexOf(manager.getRenderingType("rendering_type_3"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.raw_memory"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.ascii"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.signedint"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.unsignedint"), types) >= 0);
- }
-
- public void testRenderingTypeNames() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryRenderingType type = manager.getRenderingType("rendering_type_1");
- assertEquals("Wrong name", "Rendering One", type.getLabel());
- type = manager.getRenderingType("rendering_type_2");
- assertEquals("Wrong name", "Rendering Two", type.getLabel());
- }
-
- public void testSingleBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockOne();
- IMemoryRenderingType[] types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
- }
-
- public void testDoubleBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockTwo();
- IMemoryRenderingType[] types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 2, types.length);
- assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_1"), types) >= 0);
- assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0);
- }
-
- public void testDefaultBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockOne();
- IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
- }
-
- public void testNoDefaultBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockTwo();
- IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 0, types.length);
- }
-
- public void testPrimaryBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockOne();
- IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
- assertEquals("Wrong binding", "rendering_type_1", type.getId());
- }
-
- public void testNoPrimaryBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockTwo();
- IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
- assertNull("Wrong binding", type);
- }
-
- public void testDefaultWithoutPrimaryBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockThree();
- IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_3", types[0].getId());
- }
-
- public void testDynamicBinding() {
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryBlock block = new MemoryBlockDynamic();
- IMemoryRenderingType[] types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
- types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
- IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
- assertEquals("Wrong bindings", manager.getRenderingType("rendering_type_1"), type);
- }
-
- public void testBindingChangeNotification() {
- final boolean[] changed = new boolean[1];
- IMemoryRenderingBindingsListener listener = new IMemoryRenderingBindingsListener() {
- public void memoryRenderingBindingsChanged() {
- changed[0] = true;
- }
- };
- IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- try {
- manager.addListener(listener);
- assertFalse("Renderings should not have changed yet", changed[0]);
- DynamicRenderingBindings.setBinding("rendering_type_2");
- assertTrue("Renderings should have changed", changed[0]);
- IMemoryBlock block = new MemoryBlockDynamic();
- IMemoryRenderingType[] types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_2", types[0].getId());
- } finally {
- // restore original bindings
- DynamicRenderingBindings.setBinding("rendering_type_1");
- manager.removeListener(listener);
- }
- }
-
- protected int indexOf(Object thing, Object[] list) {
- for (int i = 0; i < list.length; i++) {
- Object object2 = list[i];
- if (object2.equals(thing)) {
- return i;
- }
- }
- return -1;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/RenderingTypeDelegate.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/RenderingTypeDelegate.java
deleted file mode 100644
index b4f9a70be..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/RenderingTypeDelegate.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.view.memory;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.ui.memory.IMemoryRendering;
-import org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate;
-
-/**
- * Test memory rendering type delegate.
- *
- * @since 3.1
- */
-public class RenderingTypeDelegate implements IMemoryRenderingTypeDelegate {
-
- /**
- * @see org.eclipse.debug.ui.memory.IMemoryRenderingTypeDelegate#createRendering(java.lang.String)
- */
- public IMemoryRendering createRendering(String id) throws CoreException {
- return null;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
deleted file mode 100644
index 1d0816d3e..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests which verify the check box support. This test is very similar to the
- * content test except that the extending class should create a viewer with
- * the SWT.CHECK style enabled. <br>
- * Most of the check box verification is performed in the test model.
- *
- * @since 3.6
- */
-abstract public class CheckTests extends TestCase {
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public CheckTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(false, false);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
-
- fShell.open ();
- }
-
- abstract protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell);
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- public void testSimpleSingleLevel() {
- // Create the model with test data
- TestModel model = TestModel.simpleSingleLevel();
-
- // Make sure that all elements are expanded
- fViewer.setAutoExpandLevel(-1);
-
- // Create the agent which forces the tree to populate
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- // Create the listener which determines when the view is finished updating.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the viewer input (and trigger updates).
- fViewer.setInput(model.getRootElement());
-
- // Wait for the updates to complete.
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testSimpleMultiLevel() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
-
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- fViewer.setInput(model.getRootElement());
-
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- // TODO: no idea how to trigger a toggle event on an item
-// public void testCheckReceiver() {
-// // Initial setup
-// TestModel model = TestModel.simpleSingleLevel();
-// fViewer.setAutoExpandLevel(-1);
-// //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-// fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-// fViewer.setInput(model.getRootElement());
-//
-// // Wait for the updates to complete and validate.
-// while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-// model.validateData(fViewer, TreePath.EMPTY);
-//
-// InternalTreeModelViewer treeViewer = ((InternalTreeModelViewer)fViewer);
-// TreePath elementPath = model.findElement("1");
-// TestElement element = model.getElement(elementPath);
-// boolean initialCheckState = element.getChecked();
-// Event event = new Event();
-// event.item = treeViewer.findItem(elementPath);
-// event.detail = SWT.CHECK;
-// event.display = fDisplay;
-// event.type = SWT.Selection;
-// event.widget = treeViewer.getControl();
-// fDisplay.post(event);
-//
-// while (fDisplay.readAndDispatch ());
-//
-// Assert.assertTrue(element.getChecked() != initialCheckState);
-// }
-
- public void testUpdateCheck() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
-
- TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.setElementChecked(elementPath, false, false);
-
- fListener.reset(elementPath, element, -1, true, false);
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.LABEL_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java
deleted file mode 100644
index 63362e4a2..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.viewers.model.ChildrenUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.ILabelUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IStateUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.ViewerLabel;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Tests coalescing of children update requests.
- *
- * @since 3.3
- */
-public class ChildrenUpdateTests extends TestCase {
-
- class BogusModelContentProvider extends TreeModelContentProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#getViewer()
- */
- protected ITreeModelContentProviderTarget getViewer() {
- return new ITreeModelContentProviderTarget(){
-
- public void setSelection(ISelection selection) {}
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {}
- public void addSelectionChangedListener(ISelectionChangedListener listener) {}
- public void updateViewer(IModelDelta delta) {}
- public boolean setSelection(ISelection selection, boolean reveal, boolean force) { return true; }
- public void setInput(Object object) {}
- public void setAutoExpandLevel(int level) {}
- public boolean saveElementState(TreePath path, ModelDelta delta, int flags) { return true; }
- public void removeStateUpdateListener(IStateUpdateListener listener) {}
- public void removeViewerUpdateListener(IViewerUpdateListener listener) {}
- public void removeModelChangedListener(IModelChangedListener listener) {}
- public void removeLabelUpdateListener(ILabelUpdateListener listener) {}
- public void addViewerUpdateListener(IViewerUpdateListener listener) {}
- public void addStateUpdateListener(IStateUpdateListener listener) {}
- public void addModelChangedListener(IModelChangedListener listener) {}
- public void addLabelUpdateListener(ILabelUpdateListener listener) {}
- public void update(Object element) {}
- public void setHasChildren(Object elementOrTreePath, boolean hasChildren) {}
- public void setExpandedState(Object elementOrTreePath, boolean expanded) {}
- public void setChildCount(Object elementOrTreePath, int count) {}
- public void reveal(TreePath path, int index) {}
- public void replace(Object parentOrTreePath, int index, Object element) {}
- public void remove(Object parentOrTreePath, int index) {}
- public void remove(Object elementOrTreePath) {}
- public void refresh() {}
- public void refresh(Object element) {}
-
- public ISelection getSelection() {
- return null;
- }
-
- public IPresentationContext getPresentationContext() {
- return null;
- }
-
- public Object getInput() {
- return null;
- }
-
- public ViewerLabel getElementLabel(TreePath path, String columnId) {
- return null;
- }
-
- public Display getDisplay() {
- return DebugUIPlugin.getStandardDisplay();
- }
-
- public int getAutoExpandLevel() {
- return 0;
- }
-
-
- public boolean overrideSelection(ISelection current, ISelection candidate) {
- return false;
- }
-
- public void insert(Object parentOrTreePath, Object element, int position) {
- }
-
- public TreePath getTopElementPath() {
- return null;
- }
-
- public ViewerFilter[] getFilters() {
- return null;
- }
-
- public boolean getExpandedState(Object elementOrTreePath) {
- return false;
- }
-
- public Object getChildElement(TreePath path, int index) {
- return null;
- }
-
- public boolean getHasChildren(Object elementOrTreePath) {
- return false;
- }
-
- public int getChildCount(TreePath path) {
- return 0;
- }
-
- public int findElementIndex(TreePath parentPath, Object element) {
- return 0;
- }
-
- public void expandToLevel(Object elementOrTreePath, int level) {
- }
-
- public void autoExpand(TreePath elementPath) {
- }
-
- public boolean getElementChildrenRealized(TreePath parentPath) {
- return false;
- }
- };
- }
- }
-
- /**
- * @param name
- */
- public ChildrenUpdateTests(String name) {
- super(name);
- }
-
- protected TreeModelContentProvider getContentProvider() {
- return new BogusModelContentProvider();
- }
-
- /**
- * Tests coalescing of requests
- */
- public void testCoalesce () {
- Object element = new Object();
- TreeModelContentProvider cp = getContentProvider();
- ChildrenUpdate update1 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 1, null, null);
- ChildrenUpdate update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 2, null, null);
- assertTrue("Should coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 2, update1.getLength());
-
- update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 3, null, null);
- assertTrue("Should coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 3, update1.getLength());
-
- update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 2, null, null);
- assertTrue("Should coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 3, update1.getLength());
-
- update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 5, null, null);
- assertFalse("Should not coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 3, update1.getLength());
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java
deleted file mode 100644
index b5eb53f1a..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests that verify that the viewer property retrieves all the content
- * from the model.
- *
- * @since 3.6
- */
-abstract public class ContentTests extends TestCase {
-
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public ContentTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(true, true);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
-
- fShell.open ();
- }
-
- abstract protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell);
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- public void testSimpleSingleLevel() {
- // Create the model with test data
- TestModel model = TestModel.simpleSingleLevel();
-
- // Make sure that all elements are expanded
- fViewer.setAutoExpandLevel(-1);
-
- // Create the agent which forces the tree to populate
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- // Create the listener which determines when the view is finished updating.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
-
- // Set the viewer input (and trigger updates).
- fViewer.setInput(model.getRootElement());
-
- // Wait for the updates to complete.
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testSimpleMultiLevel() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
-
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
-
- fViewer.setInput(model.getRootElement());
-
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
deleted file mode 100644
index 5f6886270..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
+++ /dev/null
@@ -1,572 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests to verify that the viewer property retrieves and processes the
- * model deltas generated by the test model.
- */
-abstract public class DeltaTests extends TestCase {
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public DeltaTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(false, false);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
-
- fShell.open ();
- }
-
- abstract protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell);
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- public void testUpdateLabel() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.appendElementLabel(elementPath, "-modified");
-
- fListener.reset(elementPath, element, -1, true, false);
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.LABEL_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testRefreshStruct() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
- TestElement[] newChildren = new TestElement[] {
- new TestElement(model, "1.1 - new", new TestElement[0]),
- new TestElement(model, "1.2 - new", new TestElement[0]),
- new TestElement(model, "1.3 - new", new TestElement[0]),
- };
- ModelDelta delta = model.setElementChildren(elementPath, newChildren);
-
- fListener.reset(elementPath, element, -1, true, false);
- model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testRefreshStruct2() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- String prefix = "new - ";
- model.setElementChildren(TreePath.EMPTY, new TestElement[] {
- new TestElement(model, prefix + "1", new TestElement[0]),
- new TestElement(model, prefix + "2", true, false, new TestElement[] {
- new TestElement(model, prefix + "2.1", true, true, new TestElement[0]),
- new TestElement(model, prefix + "2.2", false, true, new TestElement[0]),
- new TestElement(model, prefix + "2.3", true, false, new TestElement[0]),
- }),
- new TestElement(model, prefix + "3", new TestElement[] {
- new TestElement(model, prefix + "3.1", new TestElement[] {
- new TestElement(model, prefix + "3.1.1", new TestElement[0]),
- new TestElement(model, prefix + "3.1.2", new TestElement[0]),
- new TestElement(model, prefix + "3.1.3", new TestElement[0]),
- }),
- new TestElement(model, prefix + "3.2", new TestElement[] {
- new TestElement(model, prefix + "3.2.1", new TestElement[0]),
- new TestElement(model, prefix + "3.2.2", new TestElement[0]),
- new TestElement(model, prefix + "3.2.3", new TestElement[0]),
- }),
- new TestElement(model, prefix + "3.3", new TestElement[] {
- new TestElement(model, prefix + "3.3.1", new TestElement[0]),
- new TestElement(model, prefix + "3.3.2", new TestElement[0]),
- new TestElement(model, prefix + "3.3.3", new TestElement[0]),
- }),
- })
- });
-
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
-
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testInsert() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
-
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- TestElement element = new TestElement(model, "7", new TestElement[0]);
- TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.insertElementChild(TreePath.EMPTY, 6, element);
-
- // Insert causes the update of element's data, label and children.
- // TODO: update of element's data after insert seems redundant
- // but it's probably not a big inefficiency
- fListener.reset();
- fListener.addChildreUpdate(TreePath.EMPTY, 6);
- fListener.addHasChildrenUpdate(elementPath);
- fListener.addLabelUpdate(elementPath);
- // TODO: redundant label updates on insert!
- fListener.setFailOnRedundantUpdates(false);
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- /**
- * This test checks that insert and select delta flags are processed in correct order:
- * insert then select.
- */
- public void testInsertAndSelect() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
-
- while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep();
-
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- // Insert two new elements at once
- TestElement element0 = new TestElement(model, "00", new TestElement[] {});
- TestElement element1 = new TestElement(model, "01", new TestElement[] {});
- TreePath elementPath0 = new TreePath(new Object[] { element0 });
- TreePath elementPath1 = new TreePath(new Object[] { element1 });
- ModelDelta rootDelta = model.insertElementChild(TreePath.EMPTY, 0, element0);
- rootDelta = model.insertElementChild(rootDelta, TreePath.EMPTY, 1, element1);
-
- // Set the select flag on the first added node.
- ModelDelta delta0 = rootDelta.getChildDelta(element0);
- delta0.setFlags(delta0.getFlags() | IModelDelta.SELECT);
-
- fListener.reset();
- fListener.addHasChildrenUpdate(elementPath0);
- fListener.addHasChildrenUpdate(elementPath1);
- fListener.addLabelUpdate(elementPath0);
- fListener.addLabelUpdate(elementPath1);
-
- // TODO: list full set of expected updates.
- fListener.setFailOnRedundantUpdates(false);
-
- model.postDelta(rootDelta);
- while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- /**
- * This test checks that insert and remove deltas are processed in correct order:
- * remove deltas are processed first then insert deltas.
- */
- public void testInsertAndRemove() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- fViewer.setInput(model.getRootElement());
-
- while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep();
-
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- // Remove one element then insert a new one
- IModelDelta removeDelta = model.removeElementChild(TreePath.EMPTY, 3).getChildDeltas()[0];
-
- // Insert new elements at once
- TestElement element = new TestElement(model, "00", new TestElement[] {});
- TreePath elementPath = new TreePath(new Object[] { element });
- IModelDelta insertDelta = model.insertElementChild(TreePath.EMPTY, 1, element).getChildDeltas()[0];
-
- // Create a combined delta where the insert child delta is first and the remove child delta is second.
- ModelDelta combinedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE, 0, model.getRootElement().getChildren().length);
- combinedDelta.addNode(insertDelta.getElement(), insertDelta.getIndex(), insertDelta.getFlags(), insertDelta.getChildCount());
- combinedDelta.addNode(removeDelta.getElement(), removeDelta.getIndex(), removeDelta.getFlags(), removeDelta.getChildCount());
-
- // Set the select flag on the first added node.
- fListener.reset();
- fListener.addHasChildrenUpdate(elementPath);
- fListener.addLabelUpdate(elementPath);
-
- // TODO: list full set of expected updates.
- fListener.setFailOnRedundantUpdates(false);
-
- model.postDelta(combinedDelta);
- while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
-
- public void testAddElement() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- TestElement element = new TestElement(model, "7", new TestElement[0]);
- TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.addElementChild(TreePath.EMPTY, 6, element);
-
- // Add causes the update of parent child count and element's children.
- fListener.reset(elementPath, element, -1, true, false);
- fListener.addChildreUpdate(TreePath.EMPTY, 6);
- // TODO: redundant updates on add!
- fListener.setFailOnRedundantUpdates(false);
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
-
- public void testRemove() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 5);
-
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testExpandAndSelect() {
- TestModel model = TestModel.simpleMultiLevel();
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Create the delta
- fListener.reset();
- // TODO Investigate: there seem to be unnecessary updates being issued
- // by the viewer. These include the updates that are commented out:
- // For now disable checking for extra updates.
- fListener.setFailOnRedundantUpdates(false);
- TestElement element = model.getRootElement();
- TreePath path_root = TreePath.EMPTY;
- ModelDelta delta= new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
- ModelDelta deltaRoot = delta;
- element = element.getChildren()[2];
- TreePath path_root_3 = path_root.createChildPath(element);
- delta = delta.addNode(element, 2, IModelDelta.EXPAND, element.fChildren.length);
- fListener.addChildreUpdate(path_root_3, 0);
- TreePath path_root_3_1 = path_root_3.createChildPath(element.getChildren()[0]);
- fListener.addHasChildrenUpdate(path_root_3_1);
- fListener.addLabelUpdate(path_root_3_1);
- TreePath path_root_3_3 = path_root_3.createChildPath(element.getChildren()[2]);
- fListener.addHasChildrenUpdate(path_root_3_3);
- fListener.addLabelUpdate(path_root_3_3);
- //TODO unnecessary update: fListener.addChildreUpdate(path1, 1);
- fListener.addChildreUpdate(path_root_3, 2);
- element = element.getChildren()[1];
- TreePath path_root_3_2 = path_root_3.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.EXPAND, element.fChildren.length);
- fListener.addLabelUpdate(path_root_3_2);
- TreePath path_root_3_2_1 = path_root_3_2.createChildPath(element.getChildren()[0]);
- fListener.addHasChildrenUpdate(path_root_3_2_1);
- fListener.addLabelUpdate(path_root_3_2_1);
- TreePath path_root_3_2_3 = path_root_3_2.createChildPath(element.getChildren()[2]);
- fListener.addHasChildrenUpdate(path_root_3_2_3);
- fListener.addLabelUpdate(path_root_3_2_3);
- // TODO unnecessary update: fListener.addChildreCountUpdate(path2);
- fListener.addChildreUpdate(path_root_3_2, 0);
- // TODO unnecessary update: fListener.addChildreUpdate(path2, 1);
- fListener.addChildreUpdate(path_root_3_2, 2);
- element = element.getChildren()[1];
- TreePath path_root_3_2_2 = path_root_3_2.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.SELECT, element.fChildren.length);
- fListener.addLabelUpdate(path_root_3_2_2);
- fListener.addHasChildrenUpdate(path_root_3_2_2);
-
- // Validate the expansion state BEFORE posting the delta.
-
- ITreeModelContentProviderTarget contentProviderViewer = (ITreeModelContentProviderTarget)fViewer;
- Assert.assertFalse(contentProviderViewer.getExpandedState(path_root_3));
- Assert.assertFalse(contentProviderViewer.getExpandedState(path_root_3_2));
- Assert.assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
-
- model.postDelta(deltaRoot);
- while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Validate the expansion state AFTER posting the delta.
- Assert.assertTrue(contentProviderViewer.getExpandedState(path_root_3));
- Assert.assertTrue(contentProviderViewer.getExpandedState(path_root_3_2));
- Assert.assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
-
- // Verify selection
- ISelection selection = fViewer.getSelection();
- if (selection instanceof ITreeSelection) {
- List selectionPathsList = Arrays.asList( ((ITreeSelection)selection).getPaths() );
- Assert.assertTrue(selectionPathsList.contains(path_root_3_2_2));
- } else {
- Assert.fail("Not a tree selection");
- }
- }
-
- public void testCompositeModelRefreshStruct() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.compositeMultiLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- // TODO: redundant updates on install deltas
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Update the model
- TreePath m4_2_1Path = model.findElement("m4.2.1");
- TestElement m4_2_1 = model.getElement(m4_2_1Path);
- TestModel m4 = m4_2_1.getModel();
- TestElement[] newChildren = new TestElement[] {
- new TestElement(m4, "4.2.1.new-1", new TestElement[0]),
- new TestElement(m4, "4.2.1.new-2", new TestElement[0]),
- new TestElement(m4, "4.2.1.new-3", new TestElement[0]),
- };
-
- ModelDelta delta = m4.setElementChildren(m4_2_1Path, newChildren);
-
- fListener.reset(m4_2_1Path, m4_2_1, -1, true, false);
- model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testCompositeModelAddElement() {
- TestModel model = TestModel.compositeMultiLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- // TODO: redundant updates on install deltas
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- TreePath m3_1Path = model.findElement("m3.1");
- TestElement m3_1 = model.getElement(m3_1Path);
- TestModel m3 = m3_1.getModel();
- TestElement m3_1_new = new TestElement(m3, "m3.1-new", new TestElement[0]);
- TreePath m3_1_newPath = m3_1Path.createChildPath(m3_1_new);
- ModelDelta delta = m3.addElementChild(m3_1Path, 0, m3_1_new);
-
- fListener.reset(m3_1_newPath, m3_1_new, -1, true, false);
- fListener.addChildreUpdate(m3_1Path, 0);
- fListener.setFailOnRedundantUpdates(false);
-
- m3.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE | TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testBug292322() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Update the model: remove one child of an un-expanded element, then
- // make sure that the number of children is correct.
- TreePath parentPath = model.findElement("2");
- TestElement parentElement = model.getElement(parentPath);
- ModelDelta delta = model.removeElementChild(parentPath, 0);
-
- // Update the viewer
- fListener.reset(parentPath, parentElement, 0, false, false);
- //fListener.addChildreCountUpdate(parentPath);
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE | TestModelUpdatesListener.CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate the viewer data.
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Update the model: remove the remaining children and make sure that
- // the element children are updated to false.
- model.removeElementChild(parentPath, 0);
-
- // Update the viewer
- fListener.reset(parentPath, parentElement, 0, false, false);
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE | TestModelUpdatesListener.CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate the viewer data.
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Update the model: remove the remaining children and make sure that
- // the element children are updated to false.
- model.removeElementChild(parentPath, 0);
-
- // Update the viewer
- fListener.reset(parentPath, parentElement, 0, false, false);
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE | TestModelUpdatesListener.CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate the viewer data.
- model.validateData(fViewer, TreePath.EMPTY, true);
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
deleted file mode 100644
index 67b65d111..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipse.debug.internal.ui.viewers.model.FilterTransform;
-import org.eclipse.jface.viewers.TreePath;
-
-/**
- * Tests the virtual viewer's filter transform
- * @since 3.3
- */
-public class FilterTransformTests extends TestCase {
-
- public Object root;
- public Object element0;
- public Object element1;
- public Object element2;
- public Object element3;
- public Object element4;
- public Object element5;
- public Object element6;
- public Object element7;
-
- 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.
- */
- protected void setUp() throws Exception {
- super.setUp();
- transform = new FilterTransform();
- root = new Object();
- element0 = new Object();
- element1 = new Object();
- element2 = new Object();
- element3 = new Object();
- element4 = new Object();
- element5 = new Object();
- element6 = new Object();
- element7 = new Object();
- assertTrue(transform.addFilteredIndex(TreePath.EMPTY, 0, element0));
- assertTrue(transform.addFilteredIndex(TreePath.EMPTY, 2, element2));
- assertTrue(transform.addFilteredIndex(TreePath.EMPTY, 3, element3));
- assertTrue(transform.addFilteredIndex(TreePath.EMPTY, 6, element6));
- 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;
- }
-
- public void testRemoveMiddleElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3));
- transform.removeElementFromFilters(TreePath.EMPTY, element3);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 5, 6}));
- }
-
- public void testRemoveFirstElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0));
- transform.removeElementFromFilters(TreePath.EMPTY, element0);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{1, 2, 5, 6}));
- }
-
- public void testRemoveLastFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7));
- transform.removeElementFromFilters(TreePath.EMPTY, element7);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 3, 6}));
- }
-
- public void testClearMiddleElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3));
- transform.clear(TreePath.EMPTY, 3);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 6, 7}));
- }
-
- public void testClearFirstElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0));
- transform.clear(TreePath.EMPTY, 0);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{2, 3, 6, 7}));
- }
-
- public void testClearLastFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7));
- transform.clear(TreePath.EMPTY, 7);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 3, 6}));
- }
-
- public void testViewToModelCount() {
- assertEquals("Wrong model count", 8, transform.viewToModelCount(TreePath.EMPTY, 3));
- }
-
- public void testViewToModelIndex() {
- assertEquals("Wrong model index", 1, transform.viewToModelIndex(TreePath.EMPTY, 0));
- assertEquals("Wrong model index", 4, transform.viewToModelIndex(TreePath.EMPTY, 1));
- assertEquals("Wrong model index", 5, transform.viewToModelIndex(TreePath.EMPTY, 2));
- }
-
- public void testAddAlreadyFiltered() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0));
- boolean added = transform.addFilteredIndex(TreePath.EMPTY, 0, element0);
- assertFalse("Filter should not be added - should already have been there", added);
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java
deleted file mode 100644
index 10aa25c03..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ITestModelUpdatesListenerConstants.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-/**
- * Convenience interface with constants used by the test model update listener.
- *
- * @since 3.6
- */
-public interface ITestModelUpdatesListenerConstants {
-
- public static final int LABEL_UPDATES_COMPLETE = 0X0001;
- public static final int CONTENT_UPDATES_COMPLETE = 0X0002;
- public static final int LABEL_UPDATES = 0X0004;
- public static final int HAS_CHILDREN_UPDATES = 0X0008;
- public static final int CHILDREN_COUNT_UPDATES = 0X0010;
- public static final int CHILDREN_UPDATES = 0X0020;
- public static final int MODEL_CHANGED_COMPLETE = 0X0040;
- public static final int MODEL_PROXIES_INSTALLED = 0X0080;
- public static final int STATE_SAVE_COMPLETE = 0X0100;
- public static final int STATE_RESTORE_COMPLETE = 0X0200;
- public static final int STATE_UPDATES = 0X0400;
-
- public static final int VIEWER_UPDATES_RUNNING = 0X0800;
- public static final int LABEL_UPDATES_RUNNING = 0X1000;
-
- public static final int LABEL_COMPLETE = LABEL_UPDATES_COMPLETE | LABEL_UPDATES;
- public static final int CONTENT_COMPLETE =
- CONTENT_UPDATES_COMPLETE | HAS_CHILDREN_UPDATES | CHILDREN_COUNT_UPDATES | CHILDREN_UPDATES;
-
- public static final int ALL_UPDATES_COMPLETE = LABEL_COMPLETE | CONTENT_COMPLETE | MODEL_PROXIES_INSTALLED | LABEL_UPDATES_RUNNING | VIEWER_UPDATES_RUNNING;
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java
deleted file mode 100644
index 7cb15a0ee..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-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;
-
-/**
- * @since 3.6
- */
-public class JFaceViewerCheckTests extends CheckTests {
-
- public JFaceViewerCheckTests(String name) {
- super(name);
- }
-
- protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.CHECK, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java
deleted file mode 100644
index 10213a3a3..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-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;
-
-/**
- * @since 3.6
- */
-public class JFaceViewerContentTests extends ContentTests {
-
- public JFaceViewerContentTests(String name) {
- super(name);
- }
-
- protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java
deleted file mode 100644
index ed613bd6f..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-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;
-
-/**
- * @since 3.6
- */
-public class JFaceViewerDeltaTests extends DeltaTests {
-
- public JFaceViewerDeltaTests(String name) {
- super(name);
- }
-
- protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
- }
-
- /**
- * TODO: remove this method when bug 292322 gets fixed in TreeViewer
- */
- public void testBug292322() {
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
deleted file mode 100644
index 865db9508..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-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;
-
-/**
- * @since 3.6
- */
-public class JFaceViewerPerformanceTests extends PerformanceTests {
-
- public JFaceViewerPerformanceTests(String name) {
- super(name);
- }
-
- protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
- }
-
- protected int getTestModelDepth() {
- return 5;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java
deleted file mode 100644
index 6cde1fbfc..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-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;
-
-/**
- * @since 3.6
- */
-public class JFaceViewerSelectionTests extends SelectionTests {
-
- public JFaceViewerSelectionTests(String name) {
- super(name);
- }
-
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java
deleted file mode 100644
index a462f01d0..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-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;
-
-/**
- * @since 3.6
- */
-public class JFaceViewerStateTests extends StateTests {
-
- public JFaceViewerStateTests(String name) {
- super(name);
- }
-
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java
deleted file mode 100644
index 983b8d77f..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-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;
-
-/**
- * @since 3.6
- */
-public class JFaceViewerUpdateTests extends UpdateTests {
-
- public JFaceViewerUpdateTests(String name) {
- super(name);
- }
-
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
deleted file mode 100644
index f4c0786c6..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.test.performance.Performance;
-import org.eclipse.test.performance.PerformanceMeter;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests to measure the performance of the viewer updates.
- */
-abstract public class PerformanceTests extends TestCase implements ITestModelUpdatesListenerConstants {
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public PerformanceTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(false, false);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
-
- fShell.open ();
- }
-
- abstract protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell);
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- /**
- * Depth (size) of the test model to be used in the tests. This number allows
- * the jface based tests to use a small enough model to fit on the screen, and
- * for the virtual viewer to exercise the content provider to a greater extent.
- */
- abstract protected int getTestModelDepth();
-
- public void testRefreshStruct() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, makeModelElements(model, getTestModelDepth(), "model"));
-
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 100; i++) {
- // Update the model
- model.setAllAppendix(" - pass " + i);
- //model.setElementChildren(TreePath.EMPTY, makeModelElements(model, getTestModelDepth(), "pass " + i));
-
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
-
- meter.start();
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- meter.stop();
- System.gc();
- }
-
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
- }
-
- public void testRefreshStructReplaceElements() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, makeModelElements(model, getTestModelDepth(), "model"));
-
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- Performance perf = Performance.getDefault();
- PerformanceMeter meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- try {
- for (int i = 0; i < 2000; i++) {
- // Update the model
- model.setElementChildren(TreePath.EMPTY, makeModelElements(model, getTestModelDepth(), "pass " + i));
-
- TestElement element = model.getRootElement();
- fListener.reset(TreePath.EMPTY, element, -1, false, false);
-
- meter.start();
- model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- meter.stop();
- System.gc();
- }
-
- meter.commit();
- perf.assertPerformance(meter);
- } finally {
- meter.dispose();
- }
- }
-
- private TestElement[] makeModelElements(TestModel model, int depth, String prefix) {
- TestElement[] elements = new TestElement[depth];
- for (int i = 0; i < depth; i++) {
- String name = prefix + "." + i;
- elements[i] = new TestElement(model, name, makeModelElements(model, i, name));
- }
- return elements;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java
deleted file mode 100644
index 8e5028935..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- * IBM - moved to debug platform tests from JDT
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.XMLMemento;
-
-/**
- * Test the serialization of presentation context properties.
- *
- * @since 3.4
- */
-public class PresentationContextTests extends TestCase {
-
- public PresentationContextTests(String name) {
- super(name);
- }
-
- /**
- * Tests saving and restoring presentation context properties.
- */
- public void testSaveRestore () {
- PresentationContext context = new PresentationContext("test");
- context.setProperty("string", "string");
- context.setProperty("integer", new Integer(1));
- context.setProperty("boolean", new Boolean(true));
- context.setProperty("persistable", ResourcesPlugin.getWorkspace().getRoot().getAdapter(IPersistableElement.class));
-
- final XMLMemento memento = XMLMemento.createWriteRoot("TEST");
- context.saveProperites(memento);
-
- context = new PresentationContext("test");
- context.initProperties(memento);
- assertEquals("Wrong value restored", "string", context.getProperty("string"));
- assertEquals("Wrong value restored", new Integer(1), context.getProperty("integer"));
- assertEquals("Wrong value restored", new Boolean(true), context.getProperty("boolean"));
- assertEquals("Wrong value restored", ResourcesPlugin.getWorkspace().getRoot(), context.getProperty("persistable"));
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java
deleted file mode 100644
index aa1155466..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.jface.viewers.ISelection;
-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.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests to verify that the viewer properly handles selection changes.
- */
-abstract public class SelectionTests extends TestCase {
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public SelectionTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(false, false);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
-
- fShell.open ();
- }
-
- abstract protected ITreeModelViewer createViewer(Display display, Shell shell);
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- private static class SelectionListener implements ISelectionChangedListener {
- private List fEvents = new ArrayList(1);
-
- public void selectionChanged(SelectionChangedEvent event) {
- fEvents.add(event);
- }
- }
-
- private TestModel makeMultiLevelModel() {
- TestModel model = TestModel.simpleMultiLevel();
- fViewer.setAutoExpandLevel(-1);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- return model;
- }
-
- /**
- * In this test:
- * - set selection to an element deep in the model
- * - verify that selection chagned listener is called
- * - verify that the selection is in the viewer is correct
- */
- public void testSimpleSetSelection() {
- // Create the model and populate the view.
- TestModel model = makeMultiLevelModel();
-
- // Create a selection object to the deepest part of the tree.
- SelectionListener listener = new SelectionListener();
- fViewer.addSelectionChangedListener(listener);
-
- // Set the selection and verify that the listener is called.
- TreeSelection selection = new TreeSelection(model.findElement("3.3.3"));
- fViewer.setSelection(selection, true, false);
- assertTrue(listener.fEvents.size() == 1);
-
- // Check that the new selection is what was requested.
- ISelection viewerSelection = fViewer.getSelection();
- assertEquals(selection, viewerSelection);
- }
-
- /**
- * In this test:
- * - set a seleciton to an element
- * - then remove that element
- * - update the view with remove delta
- * -> The selection should be re-set to empty.
- */
- public void testSelectRemove() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- // Create the model and populate the view.
- TestModel model = makeMultiLevelModel();
-
- // Create a selection object to the deepest part of the tree.
- TreePath elementPath = model.findElement("3.3.3");
- TreeSelection selection = new TreeSelection(elementPath);
-
- // Set the selection.
- fViewer.setSelection(selection, true, false);
-
- // Remove the element
- TreePath removePath = model.findElement("3");
- TreePath parentPath = removePath.getParentPath();
- int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
- ModelDelta delta = model.removeElementChild(removePath.getParentPath(), removeIndex);
-
- // Configure a selection listener
- SelectionListener listener = new SelectionListener();
- fViewer.addSelectionChangedListener(listener);
-
- // Reset the listener and update the viewer. With a remove
- // delta only wait for the delta to be processed.
- fListener.reset();
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Check to make sure the selection was made
- //assertTrue(listener.fEvents.size() == 1);
-
- // Check that the new selection is empty
- ISelection viewerSelection = fViewer.getSelection();
- assertTrue(viewerSelection.isEmpty());
- }
-
-
- /**
- * In this test:
- * - set a selection to an element
- * - then remove that element
- * - then refresh the view.
- * -> The selection should be re-set to empty.
- */
- public void testSelectRemoveRefreshStruct() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- // Create the model and populate the view.
- TestModel model = makeMultiLevelModel();
-
- // Create a selection object to the deepest part of the tree.
- TreePath elementPath = model.findElement("3.3.3");
- TreeSelection selection = new TreeSelection(elementPath);
-
- // Set the selection.
- fViewer.setSelection(selection, true, false);
-
- // Remove the element
- TreePath removePath = model.findElement("3");
- TreePath parentPath = removePath.getParentPath();
- int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
- model.removeElementChild(removePath.getParentPath(), removeIndex);
-
- // Configure a selection listener
- SelectionListener listener = new SelectionListener();
- fViewer.addSelectionChangedListener(listener);
-
- // Reset the listener to ignore redundant updates. When elements are removed
- // the viewer may still request updates for those elements.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
- // Refresh the viewer
- model.postDelta( new ModelDelta(model.getRootElement(), IModelDelta.CONTENT) );
- while (!fListener.isFinished(TestModelUpdatesListener.ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Check to make sure the selection was made
- // Commented out until JFace bug 219887 is fixed.
- //assertTrue(listener.fEvents.size() == 1);
-
- // Check that the new selection is empty
- ISelection viewerSelection = fViewer.getSelection();
- assertTrue(viewerSelection.isEmpty());
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
deleted file mode 100644
index d5b8dfadc..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
+++ /dev/null
@@ -1,721 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests to verify that the viewer can save and restore correctly the expansion
- * state of elements.
- *
- * @since 3.6
- */
-abstract public class StateTests extends TestCase implements ITestModelUpdatesListenerConstants {
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public StateTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(false, false);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
- fViewer.addStateUpdateListener(fListener);
-
- fShell.open ();
- }
-
- abstract protected ITreeModelViewer createViewer(Display display, Shell shell);
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
- fViewer.addStateUpdateListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- protected ITreeModelContentProviderTarget getCTargetViewer() {
- return (ITreeModelContentProviderTarget)fViewer;
- }
-
- public void testUpdateViewer() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleMultiLevel();
-
- // Create the listener
- fListener.reset();
- fListener.addChildreUpdate(TreePath.EMPTY, 0);
- fListener.addChildreUpdate(TreePath.EMPTY, 1);
- fListener.addChildreUpdate(TreePath.EMPTY, 2);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Create the update delta
- TestElement element = model.getRootElement();
- TreePath path0 = TreePath.EMPTY;
- ModelDelta delta = new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
- ModelDelta updateDelta = delta;
- element = element.getChildren()[2];
- TreePath path1 = path0.createChildPath(element);
- delta = delta.addNode(element, 2, IModelDelta.EXPAND, element.fChildren.length);
- element = element.getChildren()[1];
- TreePath path2 = path1.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.EXPAND, element.fChildren.length);
- element = element.getChildren()[1];
- TreePath path3 = path2.createChildPath(element);
- delta = delta.addNode(element, 1, IModelDelta.SELECT);
-
- fListener.reset(false, false);
-
- fListener.addChildreUpdate(path0, 2);
- fListener.addHasChildrenUpdate(path1);
- fListener.addChildreCountUpdate(path1);
- fListener.addLabelUpdate(path1);
- fListener.addChildreUpdate(path1, 1);
- fListener.addHasChildrenUpdate(path2);
- fListener.addChildreCountUpdate(path2);
- fListener.addLabelUpdate(path2);
- fListener.addHasChildrenUpdate(path2);
- fListener.addChildreCountUpdate(path2);
- fListener.addChildreUpdate(path2, 1);
- fListener.addHasChildrenUpdate(path3);
- fListener.addLabelUpdate(path3);
-
- fViewer.updateViewer(updateDelta);
- while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_UPDATES))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Extract the new state from viewer
- ModelDelta savedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(path0, savedDelta, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- Assert.assertTrue( deltaMatches(updateDelta, savedDelta) );
- }
-
- boolean deltaMatches(ModelDelta requested, ModelDelta received) {
- if ( requested.getElement().equals(received.getElement()) &&
- requested.getFlags() == received.getFlags() &&
- ( requested.getChildCount() == -1 || requested.getChildCount() == received.getChildCount() )&&
- ( requested.getIndex() == -1 || requested.getIndex() == received.getIndex()) &&
- ((requested.getReplacementElement() != null && requested.getReplacementElement().equals(received.getReplacementElement())) ||
- (requested.getReplacementElement() == null && received.getReplacementElement() == null)) &&
- requested.getChildDeltas().length == received.getChildDeltas().length)
- {
- for (int i = 0; i < requested.getChildDeltas().length; i++) {
- ModelDelta requestedChildDelta = (ModelDelta)requested.getChildDeltas()[i];
- ModelDelta receivedChildDelta = received.getChildDelta(requestedChildDelta.getElement());
- if ( receivedChildDelta == null || !deltaMatches(requestedChildDelta, receivedChildDelta) ) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- private TestModel alternatingSubsreesModel() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", new TestElement[] {
- new TestElement(model, "1.1", new TestElement[] {
- new TestElement(model, "1.1.1", new TestElement[0]),
- }),
- }),
- new TestElement(model, "2", new TestElement[] {
- new TestElement(model, "2.1", new TestElement[] {
- new TestElement(model, "2.1.1", new TestElement[0]),
- }),
- }),
- new TestElement(model, "3", new TestElement[] {
- new TestElement(model, "3.1", new TestElement[] {
- new TestElement(model, "3.1.1", new TestElement[0]),
- }),
- }),
- new TestElement(model, "4", new TestElement[] {
- new TestElement(model, "4.1", new TestElement[] {
- new TestElement(model, "4.1.1", new TestElement[0]),
- }),
- }),
- new TestElement(model, "5", new TestElement[] {
- new TestElement(model, "5.1", new TestElement[] {
- new TestElement(model, "5.1.1", new TestElement[0]),
- }),
- }),
- new TestElement(model, "6", new TestElement[] {
- new TestElement(model, "6.1", new TestElement[] {
- new TestElement(model, "6.1.1", new TestElement[0]),
- }),
- })
- }) );
- return model;
- }
-
- private void expandAlternateElements(TestModel model) {
- // Expand every other child
- fListener.reset();
- fListener.setFailOnRedundantUpdates(false);
- ITreeModelContentProviderTarget viewer = (ITreeModelContentProviderTarget)fViewer;
- TreePath path;
- fListener.addUpdates(path = model.findElement("1"), (TestElement)path.getLastSegment(), 1, CHILDREN_COUNT_UPDATES | CHILDREN_UPDATES);
- viewer.setExpandedState(path, true);
- fListener.addUpdates(path = model.findElement("3"), (TestElement)path.getLastSegment(), 1, CHILDREN_COUNT_UPDATES | CHILDREN_UPDATES);
- viewer.setExpandedState(path, true);
- fListener.addUpdates(path = model.findElement("5"), (TestElement)path.getLastSegment(), 1, CHILDREN_COUNT_UPDATES | CHILDREN_UPDATES);
- viewer.setExpandedState(path, true);
-
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Expand the sub-children as well (so that the expanded nodes go 2 levels down.
- fListener.reset();
- fListener.addUpdates(path = model.findElement("1.1"), (TestElement)path.getLastSegment(), 1, CHILDREN_COUNT_UPDATES | CHILDREN_UPDATES);
- viewer.setExpandedState(path, true);
- fListener.addUpdates(path = model.findElement("3.1"), (TestElement)path.getLastSegment(), 1, CHILDREN_COUNT_UPDATES | CHILDREN_UPDATES);
- viewer.setExpandedState(path, true);
- fListener.addUpdates(path = model.findElement("5.1"), (TestElement)path.getLastSegment(), 1, CHILDREN_COUNT_UPDATES | CHILDREN_UPDATES);
- viewer.setExpandedState(path, true);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
- }
-
- public void testPreserveExpandedOnRemove() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel();
-
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
- // 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());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- expandAlternateElements(model);
-
- // Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
- fViewer.setSelection(originalSelection);
-
- // Update the model
- ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 0);
-
- // Remove delta should not generate any new updates
- fListener.reset();
- model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("4")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("6")) == false);
- Assert.assertEquals(originalSelection, fViewer.getSelection());
- }
-
- public void testPreserveExpandedOnInsert() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel();
-
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
- // 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());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- expandAlternateElements(model);
-
- // Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
- fViewer.setSelection(originalSelection);
-
- // Update the model
- ModelDelta delta = model.insertElementChild(TreePath.EMPTY, 0, new TestElement(model, "0 - new", new TestElement[0]));
-
- // Insert delta should generate updates only for the new element
- TreePath path = model.findElement("0 - new");
- // Note: redundant label updates on insert.
- fListener.reset(path, (TestElement)path.getLastSegment(), 0, false, false);
- fListener.addChildreUpdate(TreePath.EMPTY, 0);
- model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("1.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("4")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("6")) == false);
- Assert.assertEquals(originalSelection, fViewer.getSelection());
- }
-
- public void testPreserveExpandedOnMultLevelContent() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel();
-
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
- // 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());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- expandAlternateElements(model);
-
- // Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
- fViewer.setSelection(originalSelection);
-
- // Update the model
- model.removeElementChild(TreePath.EMPTY, 0);
-
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getCTargetViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
-
- // Create the delta which has nodes with CONTENT flag set at multiple levels.
- ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
- ModelDelta elementDelta = model.getElementDelta(rootDelta, model.findElement("3.1.1"), true);
- elementDelta.setFlags(IModelDelta.CONTENT);
-
- // Post the multi-content update delta
- model.postDelta(rootDelta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("4")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("6")) == false);
- Assert.assertEquals(originalSelection, fViewer.getSelection());
- }
-
-
- public void testPreserveExpandedOnSubTreeContent() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
-
- // Expand all
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener,
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Turn off auto-expansion
- fViewer.setAutoExpandLevel(0);
-
- // Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("3.3.1"));
- fViewer.setSelection(originalSelection);
-
- // Update the model
- model.addElementChild(model.findElement("3"), 0, new TestElement(model, "3.0 - new", new TestElement[0]));
-
- // Create the delta for element "3" with content update.
- TreePath elementPath = model.findElement("3");
- ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- ModelDelta elementDelta = model.getElementDelta(rootDelta, elementPath, true);
- elementDelta.setFlags(IModelDelta.CONTENT);
-
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getCTargetViewer(), elementPath, model.getElement(elementPath), -1, ALL_UPDATES_COMPLETE);
-
- // Post the sub-tree update
- model.postDelta(rootDelta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true);
- // On windows, getExpandedState() may return true for an element with no children:
- // Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.0 - new")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.2")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.3")) == true);
- Assert.assertEquals(originalSelection, fViewer.getSelection());
- }
-
- public void testPreserveExpandedOnContentStress() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel();
-
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
- // 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());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- expandAlternateElements(model);
-
- // Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
- fViewer.setSelection(originalSelection);
- Assert.assertEquals(originalSelection, fViewer.getSelection());
-
- // Run this test ten times as we've seen intermittent failures related
- // to timing in it.
- for (int i = 0; i < 10; i++) {
- // Update the model
- model.removeElementChild(TreePath.EMPTY, 0);
-
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getCTargetViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("4")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("6")) == false);
- Assert.assertEquals(originalSelection, fViewer.getSelection());
-
- // Update the model again
- model.addElementChild(TreePath.EMPTY, 0, new TestElement(model, "1", new TestElement[0]));
-
- // Note: Re-expanding nodes causes redundant updates.
- fListener.reset(false, false);
- fListener.addUpdates(getCTargetViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Validate data
- model.validateData(fViewer, TreePath.EMPTY, true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("2")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("4")) == false);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("5.1")) == true);
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("6")) == false);
- Assert.assertEquals(originalSelection, fViewer.getSelection());
- }
- }
-
- public void testPreserveSelectionDeltaAfterContent() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
-
- // Expand all
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Set a selection in view
- fViewer.setSelection(new TreeSelection(model.findElement("3.1.1")));
-
- // Reset the listener (ignore redundant updates)
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
- // Refresh content.
- // Note: Wait only for the processing of the delta, nto for all updates
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Update the viewer with new selection delta to something new in the view
- ModelDelta selectDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.SELECT);
-
- // Wait for the second model dleta to process
- fListener.resetModelChanged();
- model.postDelta(selectDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Wait for all the updates to cimplete (note: we're not resetting the listener.
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Check to make sure that the state restore didn't change the selection.
- Assert.assertEquals(new TreeSelection(model.findElement("2.1")), fViewer.getSelection());
- }
-
- public void testPreserveCollapseDeltaAfterContent() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
-
- // Expand all
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Turn off auto-expand
- fViewer.setAutoExpandLevel(0);
-
- // Reset the listener (ignore redundant updates)
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
- // Refresh content.
- // Note: Wait only for the processing of the delta, not for all updates
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Update the viewer to collapse an element
- ModelDelta collapseDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.COLLAPSE);
-
- // Remove updates for the collapsed element from listener, because they
- // will never happen if the element remains collapsed.
- fListener.resetModelChanged();
- fListener.removeLabelUpdate(model.findElement("3.1.1"));
- fListener.removeLabelUpdate(model.findElement("3.1.2"));
- fListener.removeLabelUpdate(model.findElement("3.1.3"));
- fListener.removeHasChildrenUpdate(model.findElement("3.1.1"));
- fListener.removeHasChildrenUpdate(model.findElement("3.1.2"));
- fListener.removeHasChildrenUpdate(model.findElement("3.1.3"));
- fListener.removeChildreCountUpdate(model.findElement("3.1"));
- fListener.removeChildrenUpdate(model.findElement("3.1"), 0);
- fListener.removeChildrenUpdate(model.findElement("3.1"), 1);
- fListener.removeChildrenUpdate(model.findElement("3.1"), 2);
-
- // Wait for the second model delta to process
- model.postDelta(collapseDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Wait for all the updates to complete (note: we're not resetting the listener.
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Check to make sure that the state restore didn't change the selection.
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == false);
- }
-
- public void testPreserveExpandDeltaAfterContent() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
-
- // Note: Do not auto-expand!
-
- // Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Reset the listener (ignore redundant updates)
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
-
- // Refresh content.
- // Note: Wait only for the processing of the delta, not for all updates
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Update the viewer to expand an element
- ModelDelta expandDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.EXPAND);
-
- // Wait for the second model delta to process
- fListener.resetModelChanged();
- model.postDelta(expandDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Wait for all the updates to complete (note: we're not resetting the listener.
- model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Check to make sure that the state restore didn't change the selection.
- Assert.assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- }
-
-
- public void testSaveAndRstore1() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = alternatingSubsreesModel();
-
- // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
- // 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());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY, true);
-
- // Expand some, but not all elements
- expandAlternateElements(model);
-
- // Set a selection in view
- fViewer.setSelection(new TreeSelection(model.findElement("5.1.1")));
-
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
- fListener.addStateUpdates(getCTargetViewer(), TreePath.EMPTY, model.getRootElement());
- fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // TODO: add state updates somehow?
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Extract the restored state from viewer
- ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- Assert.assertTrue( deltaMatches(originalState, restoredState) );
- }
-
- public void testSaveAndRstore2() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
- TestModel model = TestModel.simpleMultiLevel();
-
- // expand all elements
- fViewer.setAutoExpandLevel(-1);
-
- // 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());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Set a selection in view
- fViewer.setSelection(new TreeSelection(model.findElement("3.2.3")));
-
- // Turn off the auto-expand now since we want to text the auto-expand logic
- fViewer.setAutoExpandLevel(-1);
-
- // Extract the original state from viewer
- ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- // Set the viewer input to null. This will trigger the view to save the viewer state.
- fListener.reset(true, false);
- fListener.addStateUpdates(getCTargetViewer(), TreePath.EMPTY, model.getRootElement());
-
- fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Set the viewer input back to the model. When view updates are complete
- // the viewer
- // Note: disable redundant updates because the reveal delta triggers one.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
- // TODO: add state updates somehow?
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
-
- // Extract the restored state from viewer
- ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
- fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- Assert.assertTrue( deltaMatches(originalState, restoredState) );
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java
deleted file mode 100644
index c42b83a76..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java
+++ /dev/null
@@ -1,660 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import java.util.Arrays;
-
-import junit.framework.Assert;
-
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelCheckProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCompareRequest;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoRequest;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
-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.IModelProxy;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory2;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Test model for the use in unit tests. This test model contains a set of
- * elements in a tree structure. It contains utility methods for modifying the
- * model and for verifying that the viewer content matches the model.
- *
- * @since 3.6
- */
-public class TestModel implements IElementContentProvider, IElementLabelProvider, IModelProxyFactory2 , IElementMementoProvider {
-
- public static class TestElement extends PlatformObject {
- private final TestModel fModel;
- private final String fID;
- TestElement[] fChildren;
- String fLabelAppendix = "";
- boolean fExpanded;
- boolean fChecked;
- boolean fGrayed;
-
- public TestElement(TestModel model, String text, TestElement[] children) {
- this (model, text, false, false, children);
- }
-
- public TestElement(TestModel model, String text, boolean checked, boolean grayed, TestElement[] children) {
- fModel = model;
- fID = text;
- fChildren = children;
- fChecked = checked;
- fGrayed = grayed;
- }
-
- public TestModel getModel() {
- return fModel;
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter.isInstance(fModel)) {
- return fModel;
- }
- return null;
- }
-
- public String getID() {
- return fID;
- }
-
- public void setLabelAppendix(String appendix) {
- fLabelAppendix = appendix;
- }
-
- public String getLabel() {
- return fID + fLabelAppendix;
- }
-
- public TestElement[] getChildren() {
- return fChildren;
- }
-
- public boolean isExpanded() {
- return fExpanded;
- }
-
- public boolean getGrayed() {
- return fGrayed;
- }
-
- public boolean getChecked() {
- return fChecked;
- }
-
- public void setChecked(boolean checked, boolean grayed) {
- fChecked = checked;
- fGrayed = grayed;
- }
-
- public boolean equals(Object obj) {
- return obj instanceof TestElement && fID.equals(((TestElement)obj).fID);
- }
-
- public int hashCode() {
- return fID.hashCode();
- }
-
- public String toString() {
- return getLabel();
- }
-
- public int indexOf(TestElement child) {
- return Arrays.asList(fChildren).indexOf(child);
- }
- }
-
- private class ModelProxy extends AbstractModelProxy {
- public void installed(Viewer viewer) {
- super.installed(viewer);
- ModelDelta rootDelta = TestModel.this.getBaseDelta(new ModelDelta(fInput, IModelDelta.NO_CHANGE));
- installSubModelProxies(fRootPath, rootDelta);
- fireModelChanged(rootDelta);
- }
-
- private void installSubModelProxies(TreePath path, ModelDelta delta) {
- TestElement element = getElement(path);
- if (element.fModel != TestModel.this) {
- // Found an element from a different model. Install its proxy and return.
- delta.setFlags(delta.getFlags() | IModelDelta.INSTALL);
- } else {
- TestElement[] children = element.getChildren();
-
- for (int i = 0; i < children.length; i++) {
- installSubModelProxies(path.createChildPath(children[i]), delta.addNode(children[i], IModelDelta.NO_CHANGE));
- }
- }
- }
- }
-
- private TestElement fRoot;
- private Object fInput = null;
- private TreePath fRootPath = TreePath.EMPTY;
- private ModelProxy fModelProxy;
-
- /**
- * Constructor private. Use static factory methods instead.
- */
- public TestModel() {}
-
- public TestElement getRootElement() {
- return fRoot;
- }
-
- public ModelDelta getBaseDelta(ModelDelta rootDelta) {
- ModelDelta delta = rootDelta;
- for (int i = 0; i < fRootPath.getSegmentCount(); i++) {
- ModelDelta subDelta = delta.getChildDelta(fRootPath.getSegment(i));
- if (subDelta == null) {
- subDelta = delta.addNode(fRootPath.getSegment(i), IModelDelta.NO_CHANGE);
- }
- delta = subDelta;
- }
- return delta;
- }
-
- public int getModelDepth() {
- return getDepth(getRootElement(), 0);
- }
-
- private int getDepth(TestElement element, int atDepth) {
- TestElement[] children = element.getChildren();
- if (children.length == 0) {
- return atDepth;
- }
- int depth = atDepth + 1;
- for (int i = 0; i < children.length; i++) {
- depth = Math.max(depth, getDepth(children[i], atDepth + 1));
- }
-
- return depth;
- }
-
- public void update(IHasChildrenUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- TestElement element = (TestElement)updates[i].getElement();
- updates[i].setHasChilren(element.getChildren().length > 0);
- updates[i].done();
- }
- }
-
- public void update(IChildrenCountUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- TestElement element = (TestElement)updates[i].getElement();
- updates[i].setChildCount(element.getChildren().length);
- updates[i].done();
- }
- }
-
- public void update(IChildrenUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- TestElement element = (TestElement)updates[i].getElement();
- int endOffset = updates[i].getOffset() + updates[i].getLength();
- for (int j = updates[i].getOffset(); j < endOffset; j++) {
- if (j < element.getChildren().length) {
- updates[i].setChild(element.getChildren()[j], j);
- }
- }
- updates[i].done();
- }
- }
-
- public void update(ILabelUpdate[] updates) {
- for (int i = 0; i < updates.length; i++) {
- TestElement element = (TestElement)updates[i].getElement();
- updates[i].setLabel(element.fID, 0);
- if (updates[i] instanceof ICheckUpdate &&
- Boolean.TRUE.equals(updates[i].getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
- {
- ((ICheckUpdate)updates[i]).setChecked(element.getChecked(), element.getGrayed());
- }
- updates[i].done();
- }
- }
-
- public final static String ELEMENT_MEMENTO_ID = "id";
-
- public void compareElements(IElementCompareRequest[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String elementID = ((TestElement)updates[i].getElement()).getID();
- String mementoID = updates[i].getMemento().getString(ELEMENT_MEMENTO_ID);
- updates[i].setEqual( elementID.equals(mementoID) );
- updates[i].done();
- }
-
- }
-
- public void encodeElements(IElementMementoRequest[] updates) {
- for (int i = 0; i < updates.length; i++) {
- String elementID = ((TestElement)updates[i].getElement()).getID();
- updates[i].getMemento().putString(ELEMENT_MEMENTO_ID, elementID);
- updates[i].done();
- }
- }
-
-
- public void elementChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
- TestElement element = getElement(path);
- Assert.assertFalse(element.getGrayed());
- element.setChecked(checked, false);
- }
-
- public IModelProxy createTreeModelProxy(Object input, TreePath path, IPresentationContext context) {
- fModelProxy = new ModelProxy();
- fInput = input;
- fRootPath = path;
- return fModelProxy;
- }
-
- public IModelProxy getModelProxy() {
- return fModelProxy;
- }
-
- public TestElement getElement(TreePath path) {
- if (path.getSegmentCount() == 0) {
- return getRootElement();
- } else {
- return (TestElement)path.getLastSegment();
- }
- }
-
- public void setAllExpanded() {
- doSetExpanded(fRoot);
- }
-
- private void doSetExpanded(TestElement element) {
- element.fExpanded = true;
- for (int i = 0; i < element.fChildren.length; i++) {
- doSetExpanded(element.fChildren[i]);
- }
- }
-
- public void setAllAppendix(String appendix) {
- doSetAllAppendix(fRoot, appendix);
- }
-
- private void doSetAllAppendix(TestElement element, String appendix) {
- element.setLabelAppendix(appendix);
- for (int i = 0; i < element.fChildren.length; i++) {
- doSetAllAppendix(element.fChildren[i], appendix);
- }
- }
-
- public void validateData(ITreeModelViewer viewer, TreePath path) {
-
- validateData(viewer, path, false);
- }
-
- public void validateData(ITreeModelViewer _viewer, TreePath path, boolean expandedElementsOnly) {
- ITreeModelContentProviderTarget viewer = (ITreeModelContentProviderTarget)_viewer;
- TestElement element = getElement(path);
- if ( Boolean.TRUE.equals(_viewer.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)) ) {
- ITreeModelCheckProviderTarget checkTarget = (ITreeModelCheckProviderTarget)_viewer;
- Assert.assertEquals(element.getChecked(), checkTarget.getElementChecked(path));
- Assert.assertEquals(element.getGrayed(), checkTarget.getElementGrayed(path));
- }
-
- if (!expandedElementsOnly || path.getSegmentCount() == 0 || viewer.getExpandedState(path) ) {
- TestElement[] children = element.getChildren();
- Assert.assertEquals(children.length, viewer.getChildCount(path));
-
- for (int i = 0; i < children.length; i++) {
- Assert.assertEquals(children[i], viewer.getChildElement(path, i));
- validateData(viewer, path.createChildPath(children[i]), expandedElementsOnly);
- }
- } else if (!viewer.getExpandedState(path)) {
- // If element not expanded, verify the plus sign.
- Assert.assertEquals(viewer.getHasChildren(path), element.getChildren().length > 0);
- }
- }
-
- public void setRoot(TestElement root) {
- fRoot = root;
- }
-
- public void postDelta(IModelDelta delta) {
- fModelProxy.fireModelChanged(delta);
- }
-
- /** Create or retrieve delta for given path
- * @param combine if then new deltas for the given path are created. If false existing ones are reused.
- */
- public ModelDelta getElementDelta(ModelDelta baseDelta, TreePath path, boolean combine) {
- TestElement element = getRootElement();
- ModelDelta delta = baseDelta;
-
- for (int i = 0; i < path.getSegmentCount(); i++) {
- TestElement[] children = element.getChildren();
- delta.setChildCount(children.length);
- Object segment = path.getSegment(i);
- int j;
- for (j = 0; j < children.length; j++) {
- if (segment.equals(children[j])) {
- element = children[j];
- ModelDelta nextDelta = null;
- if (combine) {
- nextDelta = delta.getChildDelta(element);
- }
- if (nextDelta == null) {
- nextDelta = delta.addNode(element, j, IModelDelta.NO_CHANGE, element.getChildren().length);
- }
- delta = nextDelta;
- break;
- }
- }
- if (j == children.length) {
- throw new IllegalArgumentException("Invalid path");
- }
- }
- return delta;
-
- }
-
- private TreePath getRelativePath(TreePath path) {
- Object[] segments = new Object[path.getSegmentCount() - fRootPath.getSegmentCount()];
- for (int i = fRootPath.getSegmentCount(), _i = 0; i < path.getSegmentCount(); i++, _i++) {
- segments[_i] = path.getSegment(i);
- }
- return new TreePath(segments);
- }
-
- public ModelDelta appendElementLabel(TreePath path, String labelAppendix) {
- Assert.assertTrue(path.startsWith(fRootPath, null));
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(path);
- TestElement element = getElement(relativePath);
- ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
- element.setLabelAppendix(labelAppendix);
- delta.setFlags(delta.getFlags() | IModelDelta.STATE);
-
- return rootDelta;
- }
-
- public ModelDelta setElementChecked(TreePath path, boolean checked, boolean grayed) {
- Assert.assertTrue(path.startsWith(fRootPath, null));
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(path);
- TestElement element = getElement(relativePath);
- ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
- element.setChecked(checked, grayed);
- delta.setFlags(delta.getFlags() | IModelDelta.STATE);
-
- return rootDelta;
- }
-
- public ModelDelta setElementChildren(TreePath path, TestElement[] children) {
- Assert.assertTrue(path.startsWith(fRootPath, null));
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(path);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(relativePath);
- ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
-
- // Set the new children array
- element.fChildren = children;
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setFlags(delta.getFlags() | IModelDelta.CONTENT);
- delta.setChildCount(children.length);
-
- return rootDelta;
- }
-
- public ModelDelta replaceElementChild(TreePath parentPath, int index, TestElement child) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(parentPath);
-
- TestElement element = getElement(relativePath);
- ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
- TestElement oldChild = element.fChildren[index];
- element.fChildren[index] = child;
- delta.addNode(oldChild, child, IModelDelta.REPLACED);
- // TODO: set replacement index!?!
-
- return rootDelta;
- }
-
- public ModelDelta addElementChild(TreePath parentPath, int index, TestElement newChild) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(parentPath);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(relativePath);
- ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
-
- // Add the new element
- element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setChildCount(element.getChildren().length);
- delta.addNode(newChild, IModelDelta.ADDED);
-
- return rootDelta;
- }
-
- public ModelDelta insertElementChild(TreePath parentPath, int index, TestElement newChild) {
- return insertElementChild(null, parentPath, index, newChild);
- }
-
- public ModelDelta insertElementChild(ModelDelta rootDelta, TreePath parentPath, int index, TestElement newChild) {
- if (rootDelta == null) {
- rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- }
- ModelDelta baseDelta = getBaseDelta(rootDelta);
- TreePath relativePath = getRelativePath(parentPath);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(relativePath);
- ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
-
- // Add the new element
- element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setChildCount(element.getChildren().length);
- delta.addNode(newChild, index, IModelDelta.INSERTED);
-
- return rootDelta;
- }
-
- private TestElement[] doInsertElementInArray(TestElement[] children, int index, TestElement newChild) {
- // Create the new children array add the element to it and set it to
- // the parent.
- TestElement[] newChildren = new TestElement[children.length + 1];
- System.arraycopy(children, 0, newChildren, 0, index);
- newChildren[index] = newChild;
- System.arraycopy(children, index, newChildren, index + 1, children.length - index);
- return newChildren;
- }
-
- public ModelDelta removeElementChild(TreePath parentPath, int index) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
-
- // Find the parent element and generate the delta node for it.
- TestElement element = getElement(parentPath);
- ModelDelta delta= getElementDelta(baseDelta, parentPath, false);
-
- // Create a new child array with the element removed
- TestElement[] children = element.getChildren();
- TestElement childToRemove = children[index];
- TestElement[] newChildren = new TestElement[children.length - 1];
- System.arraycopy(children, 0, newChildren, 0, index);
- System.arraycopy(children, index + 1, newChildren, index, children.length - index - 1);
- element.fChildren = newChildren;
-
- // Add the delta flag and update the child count in the parent delta.
- delta.setChildCount(element.getChildren().length);
- delta.addNode(childToRemove, index, IModelDelta.REMOVED);
-
- return rootDelta;
- }
-
- public ModelDelta makeElementDelta(TreePath path, int flags) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
- ModelDelta baseDelta = getBaseDelta(rootDelta);
-
- // Find the element and generate the delta node for it.
- ModelDelta delta= getElementDelta(baseDelta, path, false);
-
- delta.setFlags(flags);
- return rootDelta;
- }
-
- public TreePath findElement(String label) {
- return findElement(TreePath.EMPTY, label);
- }
-
- public TreePath findElement(TreePath startPath, String label) {
- TestElement element = getElement(startPath);
- for (int i = 0; i < element.getChildren().length; i++) {
- TestElement child = element.getChildren()[i];
- TreePath path = startPath.createChildPath(child);
- if ( label.equals(child.getLabel()) ) {
- return path;
- } else {
- TreePath subPath = findElement(path, label);
- if (subPath != null) {
- return subPath;
- }
- }
- }
- return null;
- }
-
- public String toString() {
- return getElementString(fRoot, "");
- }
-
- public String getElementString(TestElement element, String indent) {
- StringBuffer builder = new StringBuffer();
- builder.append(indent);
- builder.append(element.toString());
- builder.append('\n');
- TestElement[] children = element.getChildren();
- for (int i = 0; i < children.length; i++) {
- builder.append(getElementString(children[i], indent + " "));
- }
- return builder.toString();
- }
-
- public static TestModel simpleSingleLevel() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", true, true, new TestElement[0]),
- new TestElement(model, "2", true, false, new TestElement[0]),
- new TestElement(model, "3", false, true, new TestElement[0]),
- new TestElement(model, "4", false, false, new TestElement[0]),
- new TestElement(model, "5", new TestElement[0]),
- new TestElement(model, "6", new TestElement[0])
- }) );
- return model;
- }
-
- public static TestModel simpleMultiLevel() {
- TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", true, false, new TestElement[] {
- new TestElement(model, "2.1", true, true, new TestElement[0]),
- new TestElement(model, "2.2", false, true, new TestElement[0]),
- new TestElement(model, "2.3", true, false, new TestElement[0]),
- }),
- new TestElement(model, "3", new TestElement[] {
- new TestElement(model, "3.1", new TestElement[] {
- new TestElement(model, "3.1.1", new TestElement[0]),
- new TestElement(model, "3.1.2", new TestElement[0]),
- new TestElement(model, "3.1.3", new TestElement[0]),
- }),
- new TestElement(model, "3.2", new TestElement[] {
- new TestElement(model, "3.2.1", new TestElement[0]),
- new TestElement(model, "3.2.2", new TestElement[0]),
- new TestElement(model, "3.2.3", new TestElement[0]),
- }),
- new TestElement(model, "3.3", new TestElement[] {
- new TestElement(model, "3.3.1", new TestElement[0]),
- new TestElement(model, "3.3.2", new TestElement[0]),
- new TestElement(model, "3.3.3", new TestElement[0]),
- }),
- })
- }) );
- return model;
- }
-
- public static TestModel compositeMultiLevel() {
- TestModel m2 = new TestModel();
- m2.setRoot( new TestElement(m2, "m2.root", new TestElement[] {
- new TestElement(m2, "m2.1", new TestElement[0]),
- new TestElement(m2, "m2.2", true, false, new TestElement[] {
- new TestElement(m2, "m2.2.1", true, true, new TestElement[0]),
- new TestElement(m2, "m2.2.2", false, true, new TestElement[0]),
- new TestElement(m2, "m2.2.3", true, false, new TestElement[0]),
- }),
- }) );
-
- TestModel m3 = new TestModel();
- m3.setRoot( new TestElement(m3, "m3.root", new TestElement[] {
- new TestElement(m3, "m3.1", new TestElement[0]),
- new TestElement(m3, "m3.2", true, false, new TestElement[] {
- new TestElement(m3, "m3.2.1", true, true, new TestElement[0]),
- new TestElement(m3, "m3.2.2", false, true, new TestElement[0]),
- new TestElement(m3, "m3.2.3", true, false, new TestElement[0]),
- }),
- }) );
-
- TestModel m4 = new TestModel();
- m4.setRoot( new TestElement(m4, "m4.root", new TestElement[] {
- new TestElement(m4, "m4.1", new TestElement[0]),
- new TestElement(m4, "m4.2", true, false, new TestElement[] {
- new TestElement(m4, "m4.2.1", true, true, new TestElement[0]),
- new TestElement(m4, "m4.2.2", false, true, new TestElement[0]),
- new TestElement(m4, "m4.2.3", true, false, new TestElement[0]),
- }),
- }) );
-
- TestModel m1 = new TestModel();
- m1.setRoot( new TestElement(m1, "m1.root", new TestElement[] {
- new TestElement(m1, "m1.1", new TestElement[0]),
- new TestElement(m1, "m1.2", true, false, new TestElement[] {
- m2.fRoot,
- m3.fRoot,
- m4.fRoot,
- }),
- }) );
-
-
- return m1;
- }
-
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
deleted file mode 100644
index 8931bc7fd..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import junit.framework.Assert;
-
-import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
-import org.eclipse.debug.internal.ui.viewers.model.ILabelUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IStateUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener;
-import org.eclipse.jface.viewers.TreePath;
-
-public class TestModelUpdatesListener
- implements IViewerUpdateListener, ILabelUpdateListener, IModelChangedListener, ITestModelUpdatesListenerConstants,
- IStateUpdateListener
-{
- private boolean fFailOnRedundantUpdates;
- private boolean fFailOnMultipleModelUpdateSequences;
- private boolean fFailOnMultipleLabelUpdateSequences;
-
- private Set fHasChildrenUpdates = new HashSet();
- private Map fChildrenUpdates = new HashMap();
- private Set fChildCountUpdates = new HashSet();
- private Set fLabelUpdates = new HashSet();
- private Set fProxyModels = new HashSet();
- private Set fStateUpdates = new HashSet();
- private boolean fViewerUpdatesComplete;
- private boolean fLabelUpdatesComplete;
- private boolean fModelChangedComplete;
- private boolean fStateSaveComplete;
- private boolean fStateRestoreComplete;
- private int fViewerUpdatesRunning;
- private int fLabelUpdatesRunning;
- private int fTimeoutInterval = 60000;
- private long fTimeoutTime;
-
-
- public TestModelUpdatesListener(boolean failOnRedundantUpdates, boolean failOnMultipleModelUpdateSequences) {
- setFailOnRedundantUpdates(failOnRedundantUpdates);
- setFailOnMultipleModelUpdateSequences(failOnMultipleModelUpdateSequences);
- }
-
- public void setFailOnRedundantUpdates(boolean failOnRedundantUpdates) {
- fFailOnRedundantUpdates = failOnRedundantUpdates;
- }
-
- public void setFailOnMultipleModelUpdateSequences(boolean failOnMultipleLabelUpdateSequences) {
- fFailOnMultipleModelUpdateSequences = failOnMultipleLabelUpdateSequences;
- }
-
- public void setFailOnMultipleLabelUpdateSequences(boolean failOnMultipleLabelUpdateSequences) {
- fFailOnMultipleLabelUpdateSequences = failOnMultipleLabelUpdateSequences;
- }
-
- /**
- * Sets the the maximum amount of time (in milliseconds) that the update listener
- * is going to wait. If set to -1, the listener will wait indefinitely.
- */
- public void setTimeoutInterval(int milis) {
- fTimeoutInterval = milis;
- }
-
- public void reset(TreePath path, TestElement element, int levels, boolean failOnRedundantUpdates, boolean failOnMultipleUpdateSequences) {
- reset();
- addUpdates(path, element, levels);
- addProxies(element);
- setFailOnRedundantUpdates(failOnRedundantUpdates);
- setFailOnMultipleModelUpdateSequences(failOnMultipleUpdateSequences);
- setFailOnMultipleLabelUpdateSequences(false);
- }
-
- public void reset(boolean failOnRedundantUpdates, boolean failOnMultipleUpdateSequences) {
- reset();
- setFailOnRedundantUpdates(failOnRedundantUpdates);
- setFailOnMultipleModelUpdateSequences(failOnMultipleUpdateSequences);
- setFailOnMultipleLabelUpdateSequences(false);
- }
-
- public void reset() {
- fHasChildrenUpdates.clear();
- fChildrenUpdates.clear();
- fChildCountUpdates.clear();
- fLabelUpdates.clear();
- fProxyModels.clear();
- fViewerUpdatesComplete = false;
- fLabelUpdatesComplete = false;
- fStateSaveComplete = false;
- fStateRestoreComplete = false;
- fTimeoutTime = System.currentTimeMillis() + fTimeoutInterval;
- resetModelChanged();
- }
-
- public void resetModelChanged() {
- fModelChangedComplete = false;
- }
-
- public void addHasChildrenUpdate(TreePath path) {
- fHasChildrenUpdates.add(path);
- }
-
- public void removeHasChildrenUpdate(TreePath path) {
- fHasChildrenUpdates.remove(path);
- }
-
- public void addChildreCountUpdate(TreePath path) {
- fChildCountUpdates.add(path);
- }
-
- public void removeChildreCountUpdate(TreePath path) {
- fChildCountUpdates.remove(path);
- }
-
- public void addChildreUpdate(TreePath path, int index) {
- Set childrenIndexes = (Set)fChildrenUpdates.get(path);
- if (childrenIndexes == null) {
- childrenIndexes = new TreeSet();
- fChildrenUpdates.put(path, childrenIndexes);
- }
- childrenIndexes.add(new Integer(index));
- }
-
- public void removeChildrenUpdate(TreePath path, int index) {
- Set childrenIndexes = (Set)fChildrenUpdates.get(path);
- if (childrenIndexes != null) {
- childrenIndexes.remove(new Integer(index));
- if (childrenIndexes.isEmpty()) {
- fChildrenUpdates.remove(path);
- }
- }
- }
-
- public void addLabelUpdate(TreePath path) {
- fLabelUpdates.add(path);
- }
-
- public void removeLabelUpdate(TreePath path) {
- fLabelUpdates.remove(path);
- }
-
- public void addUpdates(TreePath path, TestElement element, int levels) {
- addUpdates(path, element, levels, ALL_UPDATES_COMPLETE);
- }
-
- public void addStateUpdates(ITreeModelContentProviderTarget viewer, TreePath path, TestElement element) {
- addUpdates(viewer, path, element, -1, STATE_UPDATES);
- }
-
- public void addUpdates(TreePath path, TestElement element, int levels, int flags) {
- addUpdates(null, path, element, levels, flags);
- }
-
- public void addUpdates(ITreeModelContentProviderTarget viewer, TreePath path, TestElement element, int levels, int flags) {
- if (!path.equals(TreePath.EMPTY)) {
- if ((flags & LABEL_UPDATES) != 0) {
- fLabelUpdates.add(path);
- }
- if ((flags & HAS_CHILDREN_UPDATES) != 0) {
- fHasChildrenUpdates.add(path);
- }
- }
-
- if (levels-- != 0) {
- TestElement[] children = element.getChildren();
- if (children.length > 0 && (viewer == null || path.getSegmentCount() == 0 || viewer.getExpandedState(path))) {
- if ((flags & CHILDREN_COUNT_UPDATES) != 0) {
- fChildCountUpdates.add(path);
- }
- if ((flags & CHILDREN_UPDATES) != 0) {
- Set childrenIndexes = new HashSet();
- for (int i = 0; i < children.length; i++) {
- childrenIndexes.add(new Integer(i));
- }
- fChildrenUpdates.put(path, childrenIndexes);
- }
-
- if ((flags & STATE_UPDATES) != 0 && viewer != null) {
- fStateUpdates.add(path);
- }
-
- for (int i = 0; i < children.length; i++) {
- addUpdates(viewer, path.createChildPath(children[i]), children[i], levels, flags);
- }
- }
-
- }
- }
-
- private void addProxies(TestElement element) {
- TestModel model = element.getModel();
- if (model.getModelProxy() == null) {
- fProxyModels.add(element.getModel());
- }
- TestElement[] children = element.getChildren();
- for (int i = 0; i < children.length; i++) {
- addProxies(children[i]);
- }
- }
-
- public boolean isFinished() {
- return isFinished(ALL_UPDATES_COMPLETE);
- }
-
- public boolean isFinished(int flags) {
- if (fTimeoutInterval > 0 && fTimeoutTime < System.currentTimeMillis()) {
- throw new RuntimeException("Timed Out: " + toString(flags));
- }
-
- if ( (flags & LABEL_UPDATES_COMPLETE) != 0) {
- if (!fLabelUpdatesComplete) return false;
- }
- if ( (flags & LABEL_UPDATES) != 0) {
- if (!fLabelUpdates.isEmpty()) return false;
- }
- if ( (flags & CONTENT_UPDATES_COMPLETE) != 0) {
- if (!fViewerUpdatesComplete) return false;
- }
- if ( (flags & HAS_CHILDREN_UPDATES) != 0) {
- if (!fHasChildrenUpdates.isEmpty()) return false;
- }
- if ( (flags & CHILDREN_COUNT_UPDATES) != 0) {
- if (!fChildCountUpdates.isEmpty()) return false;
- }
- if ( (flags & CHILDREN_UPDATES) != 0) {
- if (!fChildrenUpdates.isEmpty()) return false;
- }
- if ( (flags & MODEL_CHANGED_COMPLETE) != 0) {
- if (!fModelChangedComplete) return false;
- }
- if ( (flags & STATE_SAVE_COMPLETE) != 0) {
- if (!fStateSaveComplete) return false;
- }
- if ( (flags & STATE_RESTORE_COMPLETE) != 0) {
- if (!fStateRestoreComplete) return false;
- }
- if ( (flags & MODEL_PROXIES_INSTALLED) != 0) {
- if (fProxyModels.size() != 0) return false;
- }
- if ( (flags & VIEWER_UPDATES_RUNNING) != 0) {
- if (fViewerUpdatesRunning != 0) {
- return false;
- }
- }
- if ( (flags & LABEL_UPDATES_RUNNING) != 0) {
- if (fLabelUpdatesRunning != 0) {
- return false;
- }
- }
-
- return true;
- }
-
- public void updateStarted(IViewerUpdate update) {
- synchronized (this) {
- fViewerUpdatesRunning++;
- }
- }
-
- public void updateComplete(IViewerUpdate update) {
- synchronized (this) {
- fViewerUpdatesRunning--;
- }
-
- if (!update.isCanceled()) {
- if (update instanceof IHasChildrenUpdate) {
- if (!fHasChildrenUpdates.remove(update.getElementPath()) && fFailOnRedundantUpdates) {
- Assert.fail("Redundant update: " + update);
- }
- } if (update instanceof IChildrenCountUpdate) {
- if (!fChildCountUpdates.remove(update.getElementPath()) && fFailOnRedundantUpdates) {
- Assert.fail("Redundant update: " + update);
- }
- } else if (update instanceof IChildrenUpdate) {
- int start = ((IChildrenUpdate)update).getOffset();
- int end = start + ((IChildrenUpdate)update).getLength();
-
- Set childrenIndexes = (Set)fChildrenUpdates.get(update.getElementPath());
- if (childrenIndexes != null) {
- for (int i = start; i < end; i++) {
- childrenIndexes.remove(new Integer(i));
- }
- if (childrenIndexes.isEmpty()) {
- fChildrenUpdates.remove(update.getElementPath());
- }
- } else if (fFailOnRedundantUpdates) {
- Assert.fail("Redundant update: " + update);
- }
- }
- }
- }
-
- public void viewerUpdatesBegin() {
-
- }
-
- public void viewerUpdatesComplete() {
- if (fFailOnMultipleModelUpdateSequences && fViewerUpdatesComplete) {
- Assert.fail("Multiple viewer update sequences detected");
- }
- fViewerUpdatesComplete = true;
- }
-
- public void labelUpdateComplete(ILabelUpdate update) {
- synchronized (this) {
- fLabelUpdatesRunning--;
- }
- if (!fLabelUpdates.remove(update.getElementPath()) && fFailOnRedundantUpdates) {
- Assert.fail("Redundant update: " + update);
- }
- }
-
- public void labelUpdateStarted(ILabelUpdate update) {
- synchronized (this) {
- fLabelUpdatesRunning++;
- }
- }
-
- public void labelUpdatesBegin() {
- }
-
- public void labelUpdatesComplete() {
- if (fFailOnMultipleLabelUpdateSequences && fLabelUpdatesComplete) {
- Assert.fail("Multiple label update sequences detected");
- }
- fLabelUpdatesComplete = true;
- }
-
- public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- fModelChangedComplete = true;
-
- for (Iterator itr = fProxyModels.iterator(); itr.hasNext();) {
- TestModel model = (TestModel)itr.next();
- if (model.getModelProxy() == proxy) {
- itr.remove();
- break;
- }
- }
- }
-
- public void stateRestoreUpdatesBegin(Object input) {
- }
-
- public void stateRestoreUpdatesComplete(Object input) {
- fStateRestoreComplete = true;
- }
-
- public void stateSaveUpdatesBegin(Object input) {
- }
-
- public void stateSaveUpdatesComplete(Object input) {
- fStateSaveComplete = true;
- }
-
- public void stateUpdateComplete(Object input, IViewerUpdate update) {
- }
-
- public void stateUpdateStarted(Object input, IViewerUpdate update) {
- }
-
- private String toString(int flags) {
- StringBuffer buf = new StringBuffer("Viewer Update Listener");
-
- if ( (flags & LABEL_UPDATES_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fLabelUpdatesComplete = " + fLabelUpdatesComplete);
- }
- if ( (flags & LABEL_UPDATES_RUNNING) != 0) {
- buf.append("\n\t");
- buf.append("fLabelUpdatesRunning = " + fLabelUpdatesRunning);
- }
- if ( (flags & LABEL_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fLabelUpdates = ");
- buf.append( toString(fLabelUpdates) );
- }
- if ( (flags & CONTENT_UPDATES_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fViewerUpdatesComplete = " + fViewerUpdatesComplete);
- }
- if ( (flags & VIEWER_UPDATES_RUNNING) != 0) {
- buf.append("\n\t");
- buf.append("fViewerUpdatesRunning = " + fViewerUpdatesRunning);
- }
- if ( (flags & HAS_CHILDREN_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fHasChildrenUpdates = ");
- buf.append( toString(fHasChildrenUpdates) );
- }
- if ( (flags & CHILDREN_COUNT_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fChildCountUpdates = ");
- buf.append( toString(fChildCountUpdates) );
- }
- if ( (flags & CHILDREN_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fChildrenUpdates = ");
- buf.append( toString(fChildrenUpdates) );
- }
- if ( (flags & MODEL_CHANGED_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fModelChangedComplete = " + fModelChangedComplete);
- }
- if ( (flags & STATE_SAVE_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fStateSaveComplete = " + fStateSaveComplete);
- }
- if ( (flags & STATE_RESTORE_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fStateRestoreComplete = " + fStateRestoreComplete);
- }
- if ( (flags & MODEL_PROXIES_INSTALLED) != 0) {
- buf.append("\n\t");
- buf.append("fProxyModels = " + fProxyModels);
- }
- if (fTimeoutInterval > 0) {
- buf.append("\n\t");
- buf.append("fTimeoutInterval = " + fTimeoutInterval);
- }
- return buf.toString();
- }
-
- private String toString(Set set) {
- if (set.isEmpty()) {
- return "(EMPTY)";
- }
- StringBuffer buf = new StringBuffer();
- for (Iterator itr = set.iterator(); itr.hasNext(); ) {
- buf.append("\n\t\t");
- buf.append(toString((TreePath)itr.next()));
- }
- return buf.toString();
- }
-
- private String toString(Map map) {
- if (map.isEmpty()) {
- return "(EMPTY)";
- }
- StringBuffer buf = new StringBuffer();
- for (Iterator itr = map.keySet().iterator(); itr.hasNext(); ) {
- buf.append("\n\t\t");
- TreePath path = (TreePath)itr.next();
- buf.append(toString(path));
- Set updates = (Set)map.get(path);
- buf.append(" = ");
- buf.append(updates.toString());
- }
- return buf.toString();
- }
-
- private String toString(TreePath path) {
- if (path.getSegmentCount() == 0) {
- return "/";
- }
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < path.getSegmentCount(); i++) {
- buf.append("/");
- buf.append(path.getSegment(i));
- }
- return buf.toString();
- }
-
- public String toString() {
- return toString(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE | STATE_RESTORE_COMPLETE);
- }
-}
-
-
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
deleted file mode 100644
index 2600fbebb..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import java.util.LinkedList;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate;
-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.TreeModelViewer;
-import org.eclipse.jface.viewers.ILazyTreePathContentProvider;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- *
- */
-public class TreeModelViewerAutopopulateAgent implements IViewerUpdateListener {
-
- private TreeModelViewer fViewer;
-
-
- public TreeModelViewerAutopopulateAgent(TreeModelViewer viewer) {
- fViewer = viewer;
- fViewer.addViewerUpdateListener(this);
- }
-
- public void updateComplete(IViewerUpdate update) {
- if (update instanceof IChildrenCountUpdate) {
- TreePath path = update.getElementPath();
- ILazyTreePathContentProvider contentProvider = (ILazyTreePathContentProvider) fViewer.getContentProvider();
-
- Widget[] items = fViewer.testFindItems(update.getElement());
- for (int i = 0; i < items.length; i++) {
- if ( path.equals(getTreePath(items[i])) ) {
- int itemCount = getItemChildCount(items[i]);
- for (int j = 0; j < itemCount; j++) {
- contentProvider.updateElement(path, j);
- }
- }
- }
- }
- }
-
- public void updateStarted(IViewerUpdate update) {
- // TODO Auto-generated method stub
-
- }
-
- public void viewerUpdatesBegin() {
- // TODO Auto-generated method stub
-
- }
-
- public void viewerUpdatesComplete() {
- // TODO Auto-generated method stub
-
- }
-
- private TreePath getTreePath(Widget w) {
- if (w instanceof TreeItem) {
- TreeItem item = (TreeItem)w;
- LinkedList segments = new LinkedList();
- while (item != null) {
- Object segment = item.getData();
- Assert.isNotNull(segment);
- segments.addFirst(segment);
- item = item.getParentItem();
- }
- return new TreePath(segments.toArray());
- }
- return TreePath.EMPTY;
- }
-
- private int getItemChildCount(Widget w) {
- if (w instanceof Tree) {
- return ((Tree)w).getItemCount();
- } else if (w instanceof TreeItem) {
- return ((TreeItem)w).getItemCount();
- }
- return 0;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
deleted file mode 100644
index eff52f495..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests to verify that the viewer property updates following changes in the
- * model, following simple content update deltas from the model.
- *
- * @since 3.6
- */
-abstract public class UpdateTests extends TestCase {
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public UpdateTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(false, false);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
-
- fShell.open ();
- }
-
- abstract protected ITreeModelViewer createViewer(Display display, Shell shell);
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- /**
- * This test:
- * - creates a simple model
- * - replaces the list of elements with a shorter list of elements
- * - refreshes the viewer
- */
- public void testRemoveElements() {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- TestElement root = model.getRootElement();
- TreePath rootPath = new TreePath(new Object[] {});
- TestElement[] newElements = new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", new TestElement[0]),
- new TestElement(model, "3", new TestElement[0]),
- };
- model.setElementChildren(rootPath, newElements);
-
- // Reset the listener to NOT fail on redundant updates.
- // When elements are remvoed from the model and the model is
- // refreshed the viewer will issue an IChildrenUpdate for the
- // missing elements as an optimization.
- fListener.reset(rootPath, root, -1, false, false);
-
- model.postDelta(new ModelDelta(root, IModelDelta.CONTENT));
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- /**
- * This test:
- * - creates a simple model
- * - sets a list of children to one of the elements
- * - refreshes the viewer
- */
- public void testAddNewChildren() {
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- TestElement element = model.getRootElement().getChildren()[0];
- TreePath elementPath = new TreePath(new Object[] { element });
- TestElement[] newChildren = new TestElement[] {
- new TestElement(model, "1.1", new TestElement[0]),
- new TestElement(model, "1.2", new TestElement[0]),
- new TestElement(model, "1.3", new TestElement[0]),
- };
- model.setElementChildren(elementPath, newChildren);
-
- // Reset the viewer to ignore redundant updates. The '1' element
- // will be updated for "hasChildren" before it is expanded, which is
- // expected.
- TreePath rootPath = TreePath.EMPTY;
- TestElement rootElement = model.getRootElement();
- fListener.reset(rootPath, rootElement, -1, false, false);
-
- // Refresh the viewer
- model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
-
- private void removeElement(TestModel model, int index) {
- ModelDelta delta = model.removeElementChild(TreePath.EMPTY, index);
-
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- private void addElement(TestModel model, String label, int position) {
- ModelDelta delta = model.addElementChild(TreePath.EMPTY, position, new TestElement(model, label, new TestElement[0]));
-
- // Remove delta should generate no new updates, but we still need to wait for the event to
- // be processed.
- fListener.reset();
- model.postDelta(delta);
- while (!fListener.isFinished(TestModelUpdatesListener.MODEL_CHANGED_COMPLETE | TestModelUpdatesListener.CONTENT_UPDATES_COMPLETE | TestModelUpdatesListener.LABEL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
- }
-
- public void testRepeatedAddRemoveElement() {
- //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
- TestModel model = TestModel.simpleSingleLevel();
- fViewer.setAutoExpandLevel(-1);
-
- // Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
- // Set the input into the view and update the view.
- fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- model.validateData(fViewer, TreePath.EMPTY);
-
- // Update the model
- removeElement(model, 2);
- addElement(model, "3-new", 3);
- removeElement(model, 4);
- addElement(model, "5-new", 5);
- removeElement(model, 1);
- addElement(model, "1-new", 1);
- removeElement(model, 3);
- addElement(model, "4-new", 4);
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java
deleted file mode 100644
index 8cacbe173..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.6
- */
-public class VirtualViewerContentTests extends ContentTests {
-
- public VirtualViewerContentTests(String name) {
- super(name);
- }
-
- protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java
deleted file mode 100644
index f3101784f..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.6
- */
-public class VirtualViewerDeltaTests extends DeltaTests {
-
- public VirtualViewerDeltaTests(String name) {
- super(name);
- }
-
- protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
deleted file mode 100644
index 6afa8f6de..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import junit.framework.TestCase;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests which verify the operation of the virtual viewer in the lazy mode.
- * Note: the virtual viewer doesn't support lazy mode yet, so this class
- * is really just a big place holder.
- *
- * @since 3.6
- */
-public class VirtualViewerLazyModeTests extends TestCase {
- Display fDisplay;
- Shell fShell;
- ITreeModelViewer fViewer;
- TestModelUpdatesListener fListener;
-
- public VirtualViewerLazyModeTests(String name) {
- super(name);
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void setUp() throws Exception {
- fDisplay = PlatformUI.getWorkbench().getDisplay();
- fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
- fShell.setMaximized(true);
- fShell.setLayout(new FillLayout());
-
- fViewer = createViewer(fDisplay, fShell);
-
- fListener = new TestModelUpdatesListener(false, false);
- fViewer.addViewerUpdateListener(fListener);
- fViewer.addLabelUpdateListener(fListener);
- fViewer.addModelChangedListener(fListener);
-
- fShell.open ();
- }
-
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"));
- }
-
- /**
- * @throws java.lang.Exception
- */
- protected void tearDown() throws Exception {
- fViewer.removeLabelUpdateListener(fListener);
- fViewer.removeViewerUpdateListener(fListener);
- fViewer.removeModelChangedListener(fListener);
-
- // Close the shell and exit.
- fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
- }
-
- public void test() {
- // TODO
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
deleted file mode 100644
index 2c4e6cd6b..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.6
- */
-public class VirtualViewerPerformanceTests extends PerformanceTests {
-
- public VirtualViewerPerformanceTests(String name) {
- super(name);
- }
-
- protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
- }
-
- protected int getTestModelDepth() {
- return 7;
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java
deleted file mode 100644
index e716acf03..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.6
- */
-public class VirtualViewerSelectionTests extends SelectionTests {
-
- public VirtualViewerSelectionTests(String name) {
- super(name);
- }
-
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java
deleted file mode 100644
index 5a4e4d671..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.6
- */
-public class VirtualViewerStateTests extends StateTests {
-
- public VirtualViewerStateTests(String name) {
- super(name);
- }
-
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
- }
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java
deleted file mode 100644
index 507be5192..000000000
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipe.debug.tests.viewer.model;
-
-import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @since 3.6
- */
-public class VirtualViewerUpdateTests extends UpdateTests {
-
- public VirtualViewerUpdateTests(String name) {
- super(name);
- }
-
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
- }
-}
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
deleted file mode 100644
index 9ae9b39f8..000000000
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipe.debug.tests.launching.AcceleratorSubstitutionTests;
-import org.eclipe.debug.tests.launching.LaunchConfigurationTests;
-import org.eclipe.debug.tests.launching.LaunchHistoryTests;
-import org.eclipe.debug.tests.launching.LaunchManagerTests;
-import org.eclipe.debug.tests.launching.RefreshTabTests;
-import org.eclipe.debug.tests.view.memory.MemoryRenderingTests;
-import org.eclipe.debug.tests.viewer.model.ChildrenUpdateTests;
-import org.eclipe.debug.tests.viewer.model.FilterTransformTests;
-import org.eclipe.debug.tests.viewer.model.JFaceViewerCheckTests;
-import org.eclipe.debug.tests.viewer.model.JFaceViewerContentTests;
-import org.eclipe.debug.tests.viewer.model.JFaceViewerDeltaTests;
-import org.eclipe.debug.tests.viewer.model.JFaceViewerSelectionTests;
-import org.eclipe.debug.tests.viewer.model.JFaceViewerStateTests;
-import org.eclipe.debug.tests.viewer.model.JFaceViewerUpdateTests;
-import org.eclipe.debug.tests.viewer.model.PresentationContextTests;
-import org.eclipe.debug.tests.viewer.model.VirtualViewerContentTests;
-import org.eclipe.debug.tests.viewer.model.VirtualViewerDeltaTests;
-import org.eclipe.debug.tests.viewer.model.VirtualViewerLazyModeTests;
-import org.eclipe.debug.tests.viewer.model.VirtualViewerSelectionTests;
-import org.eclipe.debug.tests.viewer.model.VirtualViewerStateTests;
-import org.eclipe.debug.tests.viewer.model.VirtualViewerUpdateTests;
-import org.eclipse.debug.tests.statushandlers.StatusHandlerTests;
-
-/**
- * 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() {
- // 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));
-
- // 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));
-
- // Viewer neutral tests
- addTest(new TestSuite(FilterTransformTests.class));
- addTest(new TestSuite(ChildrenUpdateTests.class));
- addTest(new TestSuite(PresentationContextTests.class));
-
- // Memory view
- addTest(new TestSuite(MemoryRenderingTests.class));
-
- // Launch framework
- addTest(new TestSuite(LaunchConfigurationTests.class));
- addTest(new TestSuite(AcceleratorSubstitutionTests.class));
- addTest(new TestSuite(LaunchHistoryTests.class));
- addTest(new TestSuite(LaunchManagerTests.class));
- addTest(new TestSuite(RefreshTabTests.class));
-
- // Status handlers
- addTest(new TestSuite(StatusHandlerTests.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
deleted file mode 100644
index 98fcfaca9..000000000
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/PerformanceSuite.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipe.debug.tests.viewer.model.JFaceViewerPerformanceTests;
-import org.eclipe.debug.tests.viewer.model.VirtualViewerPerformanceTests;
-
-/**
- * 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));
- }
-
-}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
deleted file mode 100644
index 6652d3339..000000000
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- * IBM - ongoing enhancements
- *******************************************************************************/
-package org.eclipse.debug.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 3.6
- */
-public class TestsPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.debug.tests"; //$NON-NLS-1$
-
- // The shared instance
- private static TestsPlugin plugin;
-
- /**
- * The constructor
- */
- public TestsPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- 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());
- 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.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandler.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandler.java
deleted file mode 100644
index 6315b43f1..000000000
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.tests.statushandlers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.IStatusHandler;
-
-/**
- * Test status handler
- */
-public class StatusHandler implements IStatusHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
- */
- public Object handleStatus(IStatus status, Object source) throws CoreException {
- return null;
- }
-
-}
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
deleted file mode 100644
index bb002ca6e..000000000
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.tests.statushandlers;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IStatusHandler;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.core.Preferences;
-import org.eclipse.debug.tests.TestsPlugin;
-
-/**
- * Tests status handlers
- */
-public class StatusHandlerTests extends TestCase {
-
- /**
- * Status for which a handler is registered.
- */
- public static final IStatus STATUS = new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, 333,"", null);
-
- /**
- * Tests that a status handler extension exists
- */
- public void testStatusHandlerExtension() {
- IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(STATUS);
- assertNotNull("missing status handler extension", handler);
- assertTrue("Unexpected handler", handler instanceof StatusHandler);
- }
-
- /**
- * Tests that status handlers are not returned when preference is disabled
- */
- public void testDisableStatusHandlers() {
- try {
- Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false, new InstanceScope());
- IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(STATUS);
- assertNull("status handler extension should be disabled", handler);
- } finally {
- Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, true, new InstanceScope());
- }
- }
-
-}
diff --git a/org.eclipse.debug.tests/test-import/Import1.launch b/org.eclipse.debug.tests/test-import/Import1.launch
deleted file mode 100644
index cb886fecf..000000000
--- a/org.eclipse.debug.tests/test-import/Import1.launch
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="ArrayDetailTestsDef"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DebugTests"/>
-<mapAttribute key="org.eclipse.jdt.launchingVM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP">
-<mapEntry key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
-</mapAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/DebugTests/src/ArrayDetailTestsDef.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-</launchConfiguration>
diff --git a/org.eclipse.debug.tests/test-import/Import2.launch b/org.eclipse.debug.tests/test-import/Import2.launch
deleted file mode 100644
index 23065ebe7..000000000
--- a/org.eclipse.debug.tests/test-import/Import2.launch
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="ArrayTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DebugTests"/>
-<mapAttribute key="org.eclipse.jdt.launchingVM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP">
-<mapEntry key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
-</mapAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/DebugTests/src/ArrayTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-</launchConfiguration>
diff --git a/org.eclipse.debug.tests/test-import/Import3.launch b/org.eclipse.debug.tests/test-import/Import3.launch
deleted file mode 100644
index db7943d57..000000000
--- a/org.eclipse.debug.tests/test-import/Import3.launch
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/DebugTests/src/Breakpoints.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="Breakpoints"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DebugTests"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/DebugTests/src/Breakpoints.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-</launchConfiguration>
diff --git a/org.eclipse.debug.tests/test-import/Import4.launch b/org.eclipse.debug.tests/test-import/Import4.launch
deleted file mode 100644
index 687854047..000000000
--- a/org.eclipse.debug.tests/test-import/Import4.launch
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="ByteArrayTests"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DebugTests"/>
-<mapAttribute key="org.eclipse.jdt.launchingVM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP">
-<mapEntry key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
-</mapAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/DebugTests/src/ByteArrayTests.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-</launchConfiguration>
diff --git a/org.eclipse.debug.tests/test-import/Import5.launch b/org.eclipse.debug.tests/test-import/Import5.launch
deleted file mode 100644
index 61e32f5b0..000000000
--- a/org.eclipse.debug.tests/test-import/Import5.launch
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="CompileError"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="DebugTests"/>
-<mapAttribute key="org.eclipse.jdt.launchingVM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP">
-<mapEntry key="org.eclipse.jdt.launching.JAVA_COMMAND" value="java"/>
-</mapAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/DebugTests/src/CompileError.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-</launchConfiguration>
diff --git a/org.eclipse.debug.tests/test.xml b/org.eclipse.debug.tests/test.xml
deleted file mode 100644
index c23a3b109..000000000
--- a/org.eclipse.debug.tests/test.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-
-<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.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.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.ui.console/.classpath b/org.eclipse.ui.console/.classpath
deleted file mode 100644
index ce7393340..000000000
--- a/org.eclipse.ui.console/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.ui.console/.cvsignore b/org.eclipse.ui.console/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/org.eclipse.ui.console/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/org.eclipse.ui.console/.project b/org.eclipse.ui.console/.project
deleted file mode 100644
index b48657dd4..000000000
--- a/org.eclipse.ui.console/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.console</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.console/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index aa7d7641b..000000000
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,99 +0,0 @@
-#Thu Feb 26 08:17:36 CST 2009
-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.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.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-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=disabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-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=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-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.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-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.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-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.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-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=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-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.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-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.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-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.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs b/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index be21c5d8a..000000000
--- a/org.eclipse.ui.console/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,17 +0,0 @@
-#Tue Jan 30 11:39:21 CST 2007
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.deprecated=1
-compilers.p.illegal-att-value=0
-compilers.p.missing-packages=0
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=1
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=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
deleted file mode 100644
index 55ce4373d..000000000
--- a/org.eclipse.ui.console/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.ui.console; singleton:=true
-Bundle-Version: 3.5.0.qualifier
-Bundle-Activator: org.eclipse.ui.console.ConsolePlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.ui.console,
- org.eclipse.ui.console.actions,
- org.eclipse.ui.internal.console;x-internal:=true
-Require-Bundle: org.eclipse.ui;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.5.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
- org.eclipse.core.variables;bundle-version="[3.2.0,4.0.0)"
-Bundle-ActivationPolicy: lazy
-Import-Package: com.ibm.icu.text
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/org.eclipse.ui.console/about.html b/org.eclipse.ui.console/about.html
deleted file mode 100644
index 460233046..000000000
--- a/org.eclipse.ui.console/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>June 2, 2006</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 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</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.ui.console/build.properties b/org.eclipse.ui.console/build.properties
deleted file mode 100644
index 2a484ec6c..000000000
--- a/org.eclipse.ui.console/build.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = icons/,\
- plugin.xml,\
- plugin.properties,\
- .,\
- about.html,\
- META-INF/
-
-source.. src/
-src.includes = about.html,\
- schema/
diff --git a/org.eclipse.ui.console/icons/full/clcl16/clear_co.gif b/org.eclipse.ui.console/icons/full/clcl16/clear_co.gif
deleted file mode 100644
index af30a42f8..000000000
--- a/org.eclipse.ui.console/icons/full/clcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/clcl16/lock_co.gif b/org.eclipse.ui.console/icons/full/clcl16/lock_co.gif
deleted file mode 100644
index 68fd6cf39..000000000
--- a/org.eclipse.ui.console/icons/full/clcl16/lock_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/clcl16/pin.gif b/org.eclipse.ui.console/icons/full/clcl16/pin.gif
deleted file mode 100644
index ec50b70fa..000000000
--- a/org.eclipse.ui.console/icons/full/clcl16/pin.gif
+++ /dev/null
Binary files differ
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/dlcl16/clear_co.gif b/org.eclipse.ui.console/icons/full/dlcl16/clear_co.gif
deleted file mode 100644
index 6775edfab..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/dlcl16/lock_co.gif b/org.eclipse.ui.console/icons/full/dlcl16/lock_co.gif
deleted file mode 100644
index b77647893..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/lock_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/dlcl16/pin.gif b/org.eclipse.ui.console/icons/full/dlcl16/pin.gif
deleted file mode 100644
index 61615d57d..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/pin.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/dlcl16/rem_co.gif b/org.eclipse.ui.console/icons/full/dlcl16/rem_co.gif
deleted file mode 100644
index 559e46298..000000000
--- a/org.eclipse.ui.console/icons/full/dlcl16/rem_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/clear_co.gif b/org.eclipse.ui.console/icons/full/elcl16/clear_co.gif
deleted file mode 100644
index af30a42f8..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/clear_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/lock_co.gif b/org.eclipse.ui.console/icons/full/elcl16/lock_co.gif
deleted file mode 100644
index 68fd6cf39..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/lock_co.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/new_con.gif b/org.eclipse.ui.console/icons/full/elcl16/new_con.gif
deleted file mode 100644
index 7aea894d0..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/new_con.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/pin.gif b/org.eclipse.ui.console/icons/full/elcl16/pin.gif
deleted file mode 100644
index ec50b70fa..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/pin.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.ui.console/icons/full/elcl16/rem_co.gif b/org.eclipse.ui.console/icons/full/elcl16/rem_co.gif
deleted file mode 100644
index 2cd9c5444..000000000
--- a/org.eclipse.ui.console/icons/full/elcl16/rem_co.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/plugin.properties b/org.eclipse.ui.console/plugin.properties
deleted file mode 100644
index 6f6a488e5..000000000
--- a/org.eclipse.ui.console/plugin.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-pluginName=Console
-providerName=Eclipse.org
-ConsoleView.name=Console
-
-ConsolePatternMatchListenerName= Console Pattern Match Listeners
-ConsolePageParticipantName= Console Page Participants
-
-ConsoleFactoryName= Console Factories
-
-consoleViewConsoleFactory.name=New Console View
-
-context.consoleview.name=In Console View
-context.consoleview.description=In Console View \ No newline at end of file
diff --git a/org.eclipse.ui.console/plugin.xml b/org.eclipse.ui.console/plugin.xml
deleted file mode 100644
index ca30ab1f9..000000000
--- a/org.eclipse.ui.console/plugin.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?> <!--
- Copyright (c) 2005, 2008 IBM Corporation and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- IBM Corporation - initial API and implementation
- -->
-
-<plugin>
-
- <extension-point id="consolePatternMatchListeners" name="%ConsolePatternMatchListenerName" schema="schema/consolePatternMatchListeners.exsd"/>
- <extension-point id="consolePageParticipants" name="%ConsolePageParticipantName" schema="schema/consolePageParticipants.exsd"/>
- <extension-point id="consoleFactories" name="%ConsoleFactoryName" schema="schema/consoleFactories.exsd"/>
-
-
- <extension
- point="org.eclipse.ui.views">
- <view
- allowMultiple="true"
- class="org.eclipse.ui.internal.console.ConsoleView"
- icon="$nl$/icons/full/cview16/console_view.gif"
- category="org.eclipse.ui"
- name="%ConsoleView.name"
- id="org.eclipse.ui.console.ConsoleView">
- </view>
- </extension>
-<!-- commands and their bindings
-NOTE:
-M1 = CTRL/COMMAND
-M2 = SHIFT
-M3 = ALT
-M4 = Platform-specific fourth key
--->
- <extension point="org.eclipse.ui.bindings">
- <key
- commandId="org.eclipse.ui.views.showView"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+Q C">
- <parameter
- id="org.eclipse.ui.views.showView.viewId"
- value="org.eclipse.ui.console.ConsoleView">
- </parameter>
- </key>
- <key
- platform="carbon"
- sequence="M2+M3+Q C"
-
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
- <key
- commandId="org.eclipse.ui.views.showView"
- platform="carbon"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M1+M3+Q C">
- <parameter
- id="org.eclipse.ui.views.showView.viewId"
- value="org.eclipse.ui.console.ConsoleView">
- </parameter>
- </key>
- </extension>
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- namespace="org.eclipse.ui.console"
- type="org.eclipse.ui.console.IConsole"
- class="org.eclipse.ui.internal.console.ConsoleTypePropertyTester"
- properties="consoleTypeTest"
- id="org.eclipse.ui.console.ConsoleTypePropertyTester"/>
- </extension>
- <extension
- point="org.eclipse.ui.console.consoleFactories">
- <consoleFactory
- label="%consoleViewConsoleFactory.name"
- class="org.eclipse.ui.internal.console.ConsoleViewConsoleFactory"/>
- </extension>
- <extension
- point="org.eclipse.ui.contexts">
- <context
- description="%context.consoleview.description"
- id="org.eclipse.ui.console.ConsoleView"
- name="%context.consoleview.name"
- parentId="org.eclipse.ui.contexts.window">
- </context>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.ui.console/schema/consoleFactories.exsd b/org.eclipse.ui.console/schema/consoleFactories.exsd
deleted file mode 100644
index 210882f4a..000000000
--- a/org.eclipse.ui.console/schema/consoleFactories.exsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<?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.gif&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;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.console/schema/consolePageParticipants.exsd b/org.eclipse.ui.console/schema/consolePageParticipants.exsd
deleted file mode 100644
index 06b40c117..000000000
--- a/org.eclipse.ui.console/schema/consolePageParticipants.exsd
+++ /dev/null
@@ -1,122 +0,0 @@
-<?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="consolePageParticipants" name="Console Page Participants"/>
- </appInfo>
- <documentation>
- This extension point provides a mechanism for contributing a console page participant. A console page participant is notified of page lifecycle events such as creation, activation, deactivation and disposal. A page participant can also provide adapters for a page.
- </documentation>
- </annotation>
-
- <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="consolePageParticipant"/>
- </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="consolePageParticipant">
- <complexType>
- <sequence>
- <element ref="enablement"/>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- specifies a unique identifier for this Console Page Participant
- </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;IConsolePageParticipant&lt;/code&gt;
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.ui.console.IConsolePageParticipant"/>
- </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 page participant extension point:
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.eclipse.ui.console.consolePageParticipants&quot;&gt;
- &lt;consolePageParticipant
- class=&quot;com.example.ExamplePageParticipant&quot;
- id=&quot;com.example.ExamplePageParticipant&quot;&gt;
- &lt;enablement&gt;
- &lt;instanceof value=&quot;com.example.ExampleConsole&quot;/&gt;
- &lt;/enablement&gt;
- &lt;/consolePageParticipant&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-In the above example, the contributed console page participant will be used for all consoles of type &quot;com.example.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.IConsolePageParticipant&lt;/b&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd b/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd
deleted file mode 100644
index 5cb81e02e..000000000
--- a/org.eclipse.ui.console/schema/consolePatternMatchListeners.exsd
+++ /dev/null
@@ -1,153 +0,0 @@
-<?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.consolePatternMatchListener&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;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/org.eclipse.ui.console/scripts/exportplugin.xml b/org.eclipse.ui.console/scripts/exportplugin.xml
deleted file mode 100644
index af246f1b1..000000000
--- a/org.eclipse.ui.console/scripts/exportplugin.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!-- Export a jar of .class files for the org.eclipse.ui.console Eclipse plugin
- along with other important plugin files to the "plugin-export" subdirectory
- of the target Eclipse installation -->
-<project name="Export ui.console" default="export" basedir="..">
-
- <!-- Set the timestamp and important properties -->
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="dest" value="${destdir}/org.eclipse.ui.console_3.0.0" />
- </target>
-
- <!-- Create the jar of .class files, and copy other important files to export dir -->
- <target name="export" depends="init">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/console.jar"
- basedir="bin"
- />
- <!-- Create the source zip -->
- <zip zipfile="${dest}/consolesrc.zip">
- <fileset dir="src"/>
- </zip>
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy file=".classpath" todir="${dest}"/>
- <copy file=".options" todir="${dest}"/>
- <copy todir="${dest}/icons">
- <fileset dir="icons" />
- </copy>
- </target>
-
-</project>
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
deleted file mode 100644
index 99fb78418..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/AbstractConsole.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-
-/**
- * Common function for consoles.
- * <p>
- * Clients implementing consoles should subclass this class.
- * </p>
- * @since 3.0
- */
-public abstract class AbstractConsole implements IConsole {
-
- // property listeners
- private ListenerList fListeners;
-
- /**
- * Console name
- */
- private String fName = null;
-
- /**
- * Console image descriptor
- */
- private ImageDescriptor fImageDescriptor = null;
-
- /**
- * Console type identifier
- */
- private String fType = null;
-
- /**
- * Used to notify this console of lifecycle methods <code>init()</code>
- * and <code>dispose()</code>.
- */
- class Lifecycle implements IConsoleListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesAdded(org.eclipse.ui.console.IConsole[])
- */
- public void consolesAdded(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == AbstractConsole.this) {
- initialize();
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesRemoved(org.eclipse.ui.console.IConsole[])
- */
- public void consolesRemoved(IConsole[] consoles) {
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console == AbstractConsole.this) {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- destroy();
- }
- }
- }
- }
-
- /**
- * Notifies listeners of property changes, handling any exceptions
- */
- class PropertyNotifier implements ISafeRunnable {
-
- private IPropertyChangeListener fListener;
- private PropertyChangeEvent fEvent;
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
- */
- public void handleException(Throwable exception) {
- IStatus status = new Status(IStatus.ERROR, ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, ConsoleMessages.AbstractConsole_0, exception);
- ConsolePlugin.log(status);
- }
-
- /**
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- fListener.propertyChange(fEvent);
- }
-
- /**
- * Notifies listeners of the property change
- *
- * @param event the event that describes the property that has changed
- */
- public void notify(PropertyChangeEvent event) {
- if (fListeners == null) {
- return;
- }
- fEvent = event;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IPropertyChangeListener)copiedListeners[i];
- SafeRunner.run(this);
- }
- fListener = null;
- }
- }
-
- /**
- * Constructs a new console with the given name and image.
- *
- * @param name console name, cannot be <code>null</code>
- * @param imageDescriptor image descriptor, or <code>null</code> if none
- * @param autoLifecycle whether this console's lifecycle methods should be called
- * automatically when it is added (<code>initialize()</code>) and removed
- * (<code>destroy()</code>) from the console manager. When <code>false</code>,
- * clients are responsible for calling the lifecycle methods.
- * @since 3.1
- */
- public AbstractConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- this(name, null, imageDescriptor, autoLifecycle);
- }
-
- /**
- * Constructs a new console with the given name, type, image and lifecycle.
- *
- * @param name console name, cannot be <code>null</code>
- * @param type console type identifier or <code>null</code>
- * @param imageDescriptor image descriptor, or <code>null</code> if none
- * @param autoLifecycle whether this console's lifecycle methods should be called
- * automatically when it is added (<code>initialize()</code>) and removed
- * (<code>destroy()</code>) from the console manager. When <code>false</code>,
- * clients are responsible for calling the lifecycle methods.
- * @since 3.1
- */
- public AbstractConsole(String name, String type, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- setName(name);
- setType(type);
- setImageDescriptor(imageDescriptor);
- if (autoLifecycle) {
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(new Lifecycle());
- }
- }
-
- /**
- * Constructs a new console with the given name and image. The console's lifecycle
- * methods <code>init()</code> and <code>dispose()</code> will be called when the
- * console is added and removed from the console manager.
- *
- * @param name console name, cannot be <code>null</code>
- * @param imageDescriptor image descriptor, or <code>null</code> if none
- */
- public AbstractConsole(String name, ImageDescriptor imageDescriptor) {
- this(name, imageDescriptor, true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#getName()
- */
- public String getName() {
- return fName;
- }
-
- /**
- * Sets the name of this console to the specified value and notifies
- * property listeners of the change.
- *
- * @param name the new name
- */
- protected void setName(String name) {
- if (!name.equals(fName)) {
- String old = fName;
- fName = name;
- firePropertyChange(this, IBasicPropertyConstants.P_TEXT, old, name);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return fImageDescriptor;
- }
-
- /**
- * Sets the image descriptor for this console to the specified value and notifies
- * property listeners of the change.
- *
- * @param imageDescriptor the new image descriptor
- */
- protected void setImageDescriptor(ImageDescriptor imageDescriptor) {
- ImageDescriptor old = fImageDescriptor;
- fImageDescriptor =imageDescriptor;
- firePropertyChange(this, IBasicPropertyConstants.P_IMAGE, old, imageDescriptor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (fListeners == null) {
- fListeners = new ListenerList();
- }
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- if (fListeners != null) {
- fListeners.remove(listener);
- }
- }
-
- /**
- * Notify all listeners that the given property has changed.
- *
- * @param source the object on which a property has changed
- * @param property identifier of the property that has changed
- * @param oldValue the old value of the property, or <code>null</code>
- * @param newValue the new value of the property, or <code>null</code>
- */
- public void firePropertyChange(Object source, String property, Object oldValue, Object newValue) {
- if (fListeners == null) {
- return;
- }
- PropertyNotifier notifier = new PropertyNotifier();
- notifier.notify(new PropertyChangeEvent(source, property, oldValue, newValue));
- }
-
- /**
- * Initializes this console. This method should only be called by clients managing a
- * console's lifecycle, otherwise this method will be called automatically when this console
- * is added to the console manager. The method is called once to initialize this console,
- * marking the beginning of its lifecycle.
- *
- * @since 3.1
- */
- public final void initialize() {
- init();
- }
-
- /**
- * Called when this console is added to the console manager. Default
- * implementation does nothing. Subclasses may override.
- * <p>
- * Since 3.1, this method is only called automatically if this console was
- * created with an automatic lifecycle.
- * </p>
- */
- protected void init() {
- }
-
- /**
- * Disposes this console. This method should only be called by clients managing a
- * console's lifecycle, otherwise this method will be called automatically when this
- * console is removed from the console manager. The method is called once to dispose
- * this console, after which this console will no longer be used.
- *
- * @since 3.1
- */
- public final void destroy() {
- dispose();
- }
-
- /**
- * Called when this console is removed from the console manager. Default
- * implementation does nothing. Subclasses may override.
- * <p>
- * Since 3.1, this methods is only called automatically if this console was
- * created with an automatic lifecycle.
- * </p>
- */
- protected void dispose() {
- }
-
- /**
- * Shows this console in all console views. This console will be become visible
- * if another console is currently pinned.
- *
- * @since 3.1
- */
- public void activate() {
- ConsolePlugin.getDefault().getConsoleManager().showConsoleView(this);
- }
-
- /**
- * Sets this console's type identifier.
- *
- * @param typeIdentifier the type identifier for this console
- * @since 3.1
- */
- protected void setType(String typeIdentifier) {
- fType = typeIdentifier;
- }
-
- /**
- * @see org.eclipse.ui.console.IConsole#getType()
- * @since 3.1
- */
- public String getType() {
- return fType;
- }
-
- /**
- * Returns the help context identifier for this console, or <code>null</code>
- * if none. When a non-<code>null</code> value is returned the associated help
- * will be installed for this console.
- *
- * @return help context id or <code>null</code>
- * @since 3.2
- */
- public String getHelpContextId() {
- return null;
- }
-
-}
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
deleted file mode 100644
index df35a076f..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/ConsolePlugin.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.console.ConsoleManager;
-import org.eclipse.ui.internal.console.ConsolePluginImages;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The console plug-in class.
- *
- * @since 3.0
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noextend This class is not intended to be subclassed by clients.
- */
-
-public class ConsolePlugin extends AbstractUIPlugin {
-
- /**
- * Singleton console manager
- */
- private IConsoleManager fConsoleManager = null;
-
- /**
- * The singleton console plug-in instance
- */
- private static ConsolePlugin fgPlugin= null;
-
- /**
- * Unique identifier constant (value <code>"org.eclipse.ui.console"</code>)
- * for the UI Console plug-in.
- */
- private static final String PI_UI_CONSOLE = "org.eclipse.ui.console"; //$NON-NLS-1$
-
- /**
- * Returns the singleton instance of the console plug-in.
- */
- public static ConsolePlugin getDefault() {
- return fgPlugin;
- }
-
- public ConsolePlugin() {
- super();
- fgPlugin = this;
- }
-
- /**
- * Convenience method which returns the unique identifier of this plug-in.
- */
- public static String getUniqueIdentifier() {
- return PI_UI_CONSOLE;
- }
-
- /**
- * Logs the specified status with this plug-in's log.
- *
- * @param status status to log
- */
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- /**
- * Logs the specified throwable with this plug-in's log.
- *
- * @param t throwable to log
- */
- public static void log(Throwable t) {
- if (t instanceof CoreException) {
- log(((CoreException)t).getStatus());
- } else {
- log(newErrorStatus("Error logged from Console plug-in: ", t)); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns a new error status for this plug-in with the given message
- * @param message the message to be included in the status
- * @param exception the exception to be included in the status or <code>null</code> if none
- * @return a new error status
- */
- public static IStatus newErrorStatus(String message, Throwable exception) {
- return new Status(IStatus.ERROR, getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, message, exception);
- }
-
- /**
- * Returns the console manager. The manager will be created lazily on
- * the first access.
- *
- * @return IConsoleManager
- */
- public IConsoleManager getConsoleManager() {
- if (fConsoleManager == null) {
- fConsoleManager = new ConsoleManager();
- }
- return fConsoleManager;
- }
-
- /**
- * Returns the workbench display.
- */
- public static Display getStandardDisplay() {
- return PlatformUI.getWorkbench().getDisplay();
- }
-
- /**
- * Utility method with conventions
- */
- public static void errorDialog(Shell shell, String title, String message, Throwable t) {
- IStatus status;
- if (t instanceof CoreException) {
- status= ((CoreException)t).getStatus();
- // if the 'message' resource string and the IStatus' message are the same,
- // don't show both in the dialog
- if (status != null && message.equals(status.getMessage())) {
- message= null;
- }
- } else {
- status= new Status(IStatus.ERROR, getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, "Error within Debug UI: ", t); //$NON-NLS-1$
- log(status);
- }
- ErrorDialog.openError(shell, title, message, status);
- }
-
- /**
- * 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
- * @since 3.1
- */
- public static Image getImage(String key) {
- return ConsolePluginImages.getImage(key);
- }
-
- /**
- * 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
- * @since 3.1
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- return ConsolePluginImages.getImageDescriptor(key);
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- if (fConsoleManager != null) {
- IConsole[] consoles = fConsoleManager.getConsoles();
- if (consoles != null) {
- fConsoleManager.removeConsoles(consoles);
- }
- }
- super.stop(context);
- }
-
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java
deleted file mode 100644
index 7b935820d..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsole.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console. A console is commonly used to display messages such as the output
- * streams of a system process. A console can be displayed in one or more console
- * views.
- * <p>
- * The console implementations provided by this plug-in are textual
- * (<code>TextConsole</code>, <code>MessageConsole</code> and <code>IOConsole</code>).
- * However a client can provide alternate presentations since a console implementation
- * is responsible for providing is page for the page book views in which consoles are
- * displayed.
- * </p>
- * <p>
- * Subclass <code>AbstractConsole</code> when implementing this interface.
- * </p>
- * @since 3.0
- */
-public interface IConsole {
-
- /**
- * Returns the name of this console.
- *
- * @return the name of this console
- */
- public String getName();
-
- /**
- * Returns an image descriptor for this console, or <code>null</code>
- * if none.
- *
- * @return an image descriptor for this console, or <code>null</code>
- * if none
- */
- public ImageDescriptor getImageDescriptor();
-
- /**
- * Creates and returns a new page for this console. The page is displayed
- * for this console in the console given view.
- *
- * @param view the view in which the page is to be created
- * @return a page book view page representation of this console
- */
- public IPageBookViewPage createPage(IConsoleView view);
-
- /**
- * Adds a listener for changes to properties of this console.
- * Has no effect if an identical listener is already registered.
- * <p>
- * The changes supported by the console view are as follows:
- * <ul>
- * <li><code>IBasicPropertyConstants.P_TEXT</code> - indicates the name
- * of a console has changed</li>
- * <li><code>IBasicPropertyConstants.P_IMAGE</code> - indicates the image
- * of a console has changed</li>
- * </ul>
- * </p>
- * <p>
- * Consoles may define additional properties as required.
- * </p>
- *
- * @param listener a property change listener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Removes the given property listener from this console page.
- * Has no effect if an identical listener is not already registered.
- *
- * @param listener a property listener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener);
-
- /**
- * Returns a unique identifier for this console's type, or <code>null</code>
- * if unspecified.
- *
- * @return a unique identifier for this console's type, or <code>null</code>
- * @since 3.1
- */
- public String getType();
-
-}
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
deleted file mode 100644
index 06d04d14b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-/**
- * Constants relating to the console plug-in.
- *
- * @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.
- */
-public interface IConsoleConstants {
-
- /**
- * Console plug-in identifier (value <code>"org.eclipse.ui.console"</code>).
- */
- public static final String PLUGIN_ID = ConsolePlugin.getUniqueIdentifier();
-
- /**
- * Console view identifier (value <code>"org.eclipse.ui.console.ConsoleView"</code>).
- */
- public static final String ID_CONSOLE_VIEW= "org.eclipse.ui.console.ConsoleView"; //$NON-NLS-1$
-
- /**
- * Type identifier for MessageConsole
- * @since 3.1
- */
- public static final String MESSAGE_CONSOLE_TYPE = "org.eclipse.ui.MessageConsole"; //$NON-NLS-1$
-
- /**
- * The name of the font to use for the Console (value <code>"org.eclipse.ui.console.ConsoleFont"</code>).
- *
- * @deprecated When a console is created, its font is set to the default text font as specified
- * by <code>JFaceResources.TEXT_FONT</code>. Clients must provide their own infrastructure to
- * manage console specific fonts.
- */
- public static final String CONSOLE_FONT= "org.eclipse.ui.console.ConsoleFont"; //$NON-NLS-1$
-
- /**
- * Menu group identifier for the console view context menu and toolbar, for actions pertaining to
- * launching (value <code>"launchGroup"</code>).
- */
- public static final String LAUNCH_GROUP = "launchGroup"; //$NON-NLS-1$
-
- /**
- * Menu group identifier for the console view context menu and toolbar, for actions pertaining to
- * console output. (value<code>"outputGroup"</code>).
- */
- public static final String OUTPUT_GROUP = "outputGroup"; //$NON-NLS-1$
-
- /**
- * Console view image identifier.
- */
- public static final String IMG_VIEW_CONSOLE= "IMG_VIEW_CONSOLE"; //$NON-NLS-1$
-
- /**
- * Clear action image identifier.
- */
- public static final String IMG_LCL_CLEAR= "IMG_LCL_CLEAR"; //$NON-NLS-1$
-
- /**
- * Status code indicating an unexpected internal error.
- */
- public static final int INTERNAL_ERROR = 120;
-
- /**
- * Console pattern match listeners extension point identifier
- * (value <code>"consolePatternMatchListeners"</code>).
- *
- * @since 3.1
- */
- public static final String EXTENSION_POINT_CONSOLE_PATTERN_MATCH_LISTENERS = "consolePatternMatchListeners"; //$NON-NLS-1$
-
- /**
- * Console page participants extension point identifier
- * (value <code>"consolePageParticipants"</code>).
- *
- * @since 3.1
- */
- public static final String EXTENSION_POINT_CONSOLE_PAGE_PARTICIPANTS = "consolePageParticipants"; //$NON-NLS-1$
-
- /**
- * Console factories extension point identifier
- * (value <code>"consoleFactories"</code>).
- *
- * @since 3.1
- */
- public static final String EXTENSION_POINT_CONSOLE_FACTORIES = "consoleFactories"; //$NON-NLS-1$
-
- /**
- * Property constant indicating a console's font has changed.
- *
- * @since 3.1
- */
- public static final String P_FONT = ConsolePlugin.getUniqueIdentifier() + ".P_FONT"; //$NON-NLS-1$
-
- /**
- * Property constant indicating that a font style has changed
- *
- * @since 3.1
- */
- public static final String P_FONT_STYLE = ConsolePlugin.getUniqueIdentifier() + ".P_FONT_STYLE"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the color of a stream has changed.
- *
- * @since 3.1
- */
- public static final String P_STREAM_COLOR = ConsolePlugin.getUniqueIdentifier() + ".P_STREAM_COLOR"; //$NON-NLS-1$
-
- /**
- * Property constant indicating tab size has changed
- *
- * @since 3.1
- */
- public static final String P_TAB_SIZE = ConsolePlugin.getUniqueIdentifier() + ".P_TAB_SIZE"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the width of a fixed width console has changed.
- *
- * @since 3.1
- */
- public static final String P_CONSOLE_WIDTH = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_WIDTH"; //$NON-NLS-1$
-
- /**
- * Property constant indicating that all streams connected to this console have been closed
- * and that all queued output has been processed.
- *
- * @since 3.1
- */
- public static final String P_CONSOLE_OUTPUT_COMPLETE = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_STREAMS_CLOSED"; //$NON-NLS-1$
-
- /**
- * Property constant indicating the background color of a console has changed.
- *
- * @since 3.3
- */
- public static final String P_BACKGROUND_COLOR = ConsolePlugin.getUniqueIdentifier() + ".P_BACKGROUND_COLOR"; //$NON-NLS-1$
-
- /**
- * The default tab size for text consoles.
- *
- * @since 3.1
- */
- public static final int DEFAULT_TAB_SIZE = 8;
-
-}
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
deleted file mode 100644
index 0da81fe60..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleDocumentPartitioner.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import org.eclipse.jface.text.IDocumentPartitioner;
-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.
- * </p>
- * <p>
- * Clients may implement this interface.
- * </p>
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- */
-public interface IConsoleDocumentPartitioner extends IDocumentPartitioner {
-
- /**
- * Returns whether this partitioner's document is read-only at the specified
- * offset. The user is not allowed to type in read-only locations.
- *
- * @param offset document offset
- * @return whether this partitioner's document is read-only at the specified
- * offset
- */
- public boolean isReadOnly(int offset);
-
- /**
- * Returns style ranges for the specified region of this partitioner's document
- * to use when rendering, or <code>null</code> if none.
- *
- * @param offset beginning offset for which style ranges are requested
- * @param length the length of text for which style ranges are requested
- * @return style ranges for the specified region of this partitioner's document
- * to use when rendering, or <code>null</code> if none
- */
- public StyleRange[] getStyleRanges(int offset, int length);
-}
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
deleted file mode 100644
index 4e27fede6..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A console factory extension is responsible for opening a console in the console view.
- * Extensions appear on a menu in the console view, and their <code>openConsole</code>
- * method is called when the action is invoked. Implementations may choose to open a new
- * console or activate an existing console. The extension point used to contribute a
- * console factory is <code>org.eclipse.ui.console.consoleFactories</code>.
- * <p>
- * Following is an example console factory extension.
- * <pre>
- * &lt;extension point="org.eclipse.ui.console.consoleFactories"&gt;
- * &lt;consoleFactory
- * label="Command Console"
- * icon="icons\cmd_console.gif"
- * class="com.example.CommandConsoleFactory"&gt;
- * &lt;/consoleFactory&gt;
- * &lt;/extension&gt;
- * </pre>
- * An action appears in the console view's 'Open Console' drop-down menu with the
- * corresponding <code>label</code> and optional <code>icon</code>. When the action
- * is invoked, the specified <code>class</code> is instantiated and called to
- * open a console, via the method <code>openConsole()</code>.
- * </p>
- * <p>
- * Clients providing console factory extensions are intended to implement
- * this interface.
- * </p>
- * @since 3.1
- */
-public interface IConsoleFactory {
- /**
- * Opens a console in the console view. Implementations may create a new
- * console or activate an existing console.
- */
- public void openConsole();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java
deleted file mode 100644
index 41aedb236..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleListener.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A console listener is notified when consoles are added or removed from
- * the console manager.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.0
- */
-public interface IConsoleListener {
-
- /**
- * Notification the given consoles have been added to the console
- * manager.
- *
- * @param consoles added consoles
- */
- public void consolesAdded(IConsole[] consoles);
-
- /**
- * Notification the given consoles have been removed from the
- * console manager.
- *
- * @param consoles removed consoles
- */
- public void consolesRemoved(IConsole[] consoles);
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java
deleted file mode 100644
index 14ac3b8ec..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleManager.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * The console manager manages registered consoles.
- * @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.
- */
-public interface IConsoleManager {
-
- /**
- * Registers the given listener for console notifications. Has
- * no effect if an identical listener is already registered.
- *
- * @param listener listener to register
- */
- public void addConsoleListener(IConsoleListener listener);
-
- /**
- * Unregisters the given listener for console notifications. Has
- * no effect if an identical listener is not already registered.
- *
- * @param listener listener to unregister
- */
- public void removeConsoleListener(IConsoleListener listener);
-
- /**
- * Adds the given consoles to the console manager. Has no effect for
- * equivalent consoles already registered. The consoles will be added
- * to any existing console views.
- *
- * @param consoles consoles to add
- */
- public void addConsoles(IConsole[] consoles);
-
- /**
- * Removes the given consoles from the console manager. If the consoles are
- * being displayed in any console views, the associated pages will be removed
- * and disposed.
- *
- * @param consoles consoles to remove
- */
- public void removeConsoles(IConsole[] consoles);
-
- /**
- * Returns a collection of consoles registered with the console manager.
- *
- * @return a collection of consoles registered with the console manager
- */
- public IConsole[] getConsoles();
-
- /**
- * Opens the console view and displays given the console.
- * If the view is already open, it is brought to the front unless
- * the view is pinned on a console other than the given console.
- * Has no effect if the given console is not currently registered.
- *
- * @param console console to display
- */
- public void showConsoleView(IConsole console);
-
- /**
- * Warns that the content of the given console has changed in
- * all console views. Has no effect if the given console is not
- * currently registered.
- *
- * @param console the console that has changed
- */
- public void warnOfContentChange(IConsole console);
-
- /**
- * Creates and returns a collection of new pattern match listeners enabled for
- * the given console. The pattern match listeners are new instances, intended
- * to be used in a new console. No methods on the participants have been
- * called. Clients are responsible for connecting to and disconnecting from
- * the pattern match listeners.
- * <p>
- * Console pattern match listeners are contributed via the
- * <code>org.eclipse.ui.console.consolePatternMatchListeners</code> extension point.
- * </p>
- *
- * @param console the console for which pattern match listeners are requested
- * @return a collection of new pattern match listeners
- * @see IPatternMatchListener
- * @since 3.1
- */
- public IPatternMatchListener[] createPatternMatchListeners(IConsole console);
-
- /**
- * Requests a redraw of any visible console page containing the specified console.
- *
- * @param console the console to be refreshed
- * @since 3.1
- */
- public void refresh(IConsole console);
-
-}
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
deleted file mode 100644
index a2e751438..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsolePageParticipant.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console page participant is notified of page lifecycle events such as
- * creation, activation, deactivation and disposal. A page participant can
- * also provide adapters for a page. Participants are contributed via the
- * <code>org.eclispe.ui.console.consolePageParticipants</code> extension point.
- * <p>
- * Participant behavior is implementation dependent. For example, a page participant
- * could add actions to a console's toolbar by accessing a its page's action bars.
- * </p>
- * <p>
- * Following is an example extension definition.
- * <pre>
- * &lt;extension point=&quot;org.eclipse.ui.console.consolePageParticipants&quot;&gt;
- * &lt;consolePageParticipant
- * id=&quot;com.example.ExamplePageParticipant&quot;
- * class=&quot;com.example.ExamplePageParticipant&quot;&gt;
- * &lt;/consolePageParticipant&gt;
- * &lt;/extension&gt;
- * </pre>
- * </p>
- * 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.
- * <p>
- * Clients contributing console page participant extensions are intended to
- * implement this interface.
- * </p>
- * @since 3.1
- */
-public interface IConsolePageParticipant extends IAdaptable {
- /**
- * Called during page initialization. Marks the start of this
- * page participant's lifecycle.
- *
- * @param page the page corresponding to the given console
- * @param console the console for which a page has been created
- */
- public void init(IPageBookViewPage page, IConsole console);
-
- /**
- * Disposes this page participant. Marks the end of this
- * page participant's lifecycle.
- */
- public void dispose();
-
- /**
- * Notification this participant's page has been activated.
- */
- public void activated();
-
- /**
- * Notification this participant's page has been deactivated.
- */
- public void deactivated();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java
deleted file mode 100644
index e1bc354d6..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleView.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.ui.IViewPart;
-
-/**
- * A view that displays consoles registered with the console manager.
- * @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.
- */
-public interface IConsoleView extends IViewPart {
-
- /**
- * Displays the page for the given console in this console view.
- * Has no effect if this console view has a pinned console.
- *
- * @param console console to display, cannot be <code>null</code>
- */
- public void display(IConsole console);
-
- /**
- * Pins this console view. No other console page will be displayed until
- * this console view is un-pinned.
- *
- * @param pin <code>true</code> to pin the current console to the
- * top of the stack, <code>false</code> otherwise
- * @since 3.1
- */
- public void setPinned(boolean pin);
-
- /**
- * Displays and pins the given console in this console view. No
- * other console can be displayed until this console view is
- * un-pinned. Specifying <code>null</code> un-pins this console
- *
- * @param console console to pin, or <code>null</code> to un-pin
- * @deprecated rather than pinning a specific console, a console view is
- * pinned - use <code>setPinned(boolean)</code>
- */
- public void pin(IConsole console);
-
- /**
- * Returns whether this console view is currently pinned to a
- * specific console.
- *
- * @return whether this console view is currently pinned to a
- * specific console
- */
- public boolean isPinned();
-
- /**
- * Returns the console currently being displayed, or <code>null</code>
- * if none
- *
- * @return the console currently being displayed, or <code>null</code>
- * if none
- */
- public IConsole getConsole();
-
- /**
- * Warns that the content of the given console has changed.
- *
- * @param console the console that has changed
- */
- public void warnOfContentChange(IConsole console);
-
- /**
- * Sets the scroll lock state of the currently active console.
- *
- * @param scrollLock <code>true</code> to turn scroll lock on, otherwise <code>false</code>
- * @since 3.1
- */
- public void setScrollLock(boolean scrollLock);
-
- /**
- * Returns the scroll lock state of the currently active console.
- *
- * @return <code>true</code> if scroll lock is on, <code>false</code> otherwise
- * @since 3.1
- */
- public boolean getScrollLock();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java
deleted file mode 100644
index 38aa4994c..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A hyperlink in a console. Link behavior is implementation dependent.
- * <p>
- * Clients may implement this interface.
- * </p>
- * @since 3.1
- */
-public interface IHyperlink {
-
- /**
- * Notification that the mouse has entered this link's region.
- */
- public void linkEntered();
-
- /**
- * Notification that the mouse has exited this link's region
- */
- public void linkExited();
-
- /**
- * Notification that this link has been activated. Performs
- * context specific linking.
- */
- public void linkActivated();
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink2.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink2.java
deleted file mode 100644
index 3895f1583..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IHyperlink2.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.swt.widgets.Event;
-
-/**
- * Optional extension to {@link IHyperlink}.
- * <p>
- * Clients implementing {@link IHyperlink} may also implement this interface.
- * When implemented, the method <code>linkActivated(Event)</code> is called instead of
- * <code>linkActivated()</code>.
- * </p>
- * @since 3.2
- */
-public interface IHyperlink2 extends IHyperlink {
-
- /**
- * Notification that this link has been activated. Performs
- * context specific linking.
- *
- * @param event the SWT event which triggered this hyperlink
- */
- public void linkActivated(Event event);
-}
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
deleted file mode 100644
index 883332866..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsole.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Remy Chi Jian Suen <remy.suen@gmail.com> - Bug 214424 IOConsole(String, String, ImageDescriptor, String, boolean) constructor is missing api javadoc
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.eclipse.ui.internal.console.IOConsolePage;
-import org.eclipse.ui.internal.console.IOConsolePartitioner;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console that displays text from I/O streams. An I/O console can have multiple
- * output streams connected to it and provides one input stream connected to the
- * keyboard.
- * <p>
- * Clients may instantiate and subclass this class.
- * </p>
- * @since 3.1
- */
-public class IOConsole extends TextConsole {
- /**
- * The document partitioner
- */
- private IOConsolePartitioner partitioner;
-
- /**
- * The stream from which user input may be read
- */
- private IOConsoleInputStream inputStream;
-
- /**
- * A collection of open streams connected to this console.
- */
- private List openStreams;
-
- /**
- * The encoding used to for displaying console output.
- */
- private String fEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
-
-
- /**
- * Constructs a console with the given name, type, image, and lifecycle, with the
- * workbench's default encoding.
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when this console is added/removed from the console manager
- */
- public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- this(name, consoleType, imageDescriptor, null, autoLifecycle);
- }
-
- /**
- * Constructs a console with the given name, type, image, encoding and lifecycle.
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- * @param encoding the encoding that should be used to render the text, or <code>null</code>
- * if the system default encoding should be used
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when this console is added/removed from the console manager
- */
- public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle) {
- super(name, consoleType, imageDescriptor, autoLifecycle);
- if (encoding != null) {
- fEncoding = encoding;
- }
- openStreams = new ArrayList();
- inputStream = new IOConsoleInputStream(this);
- synchronized (openStreams) {
- openStreams.add(inputStream);
- }
-
- partitioner = new IOConsolePartitioner(inputStream, this);
- partitioner.connect(getDocument());
- }
-
- /**
- * Constructs a console with the given name, type, and image with the workbench's
- * default encoding. Lifecycle methods will be called when this console is
- * added/removed from the console manager.
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- */
- public IOConsole(String name, String consoleType, ImageDescriptor imageDescriptor) {
- this(name, consoleType, imageDescriptor, true);
- }
-
- /**
- * Constructs a console with the given name and image. Lifecycle methods
- * will be called when this console is added/removed from the console manager.
- * This console will have an unspecified (<code>null</code>) type.
- *
- * @param name name to display for this console
- * @param imageDescriptor image to display for this console or <code>null</code>
- */
- public IOConsole(String name, ImageDescriptor imageDescriptor) {
- this(name, null, imageDescriptor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
- */
- public IPageBookViewPage createPage(IConsoleView view) {
- return new IOConsolePage(this, view);
- }
-
- /**
- * Creates and returns a new output stream which may be used to write to this console.
- * A console may be connected to more than one output stream at once. Clients are
- * responsible for closing any output streams created on this console.
- * <p>
- * Clients should avoid writing large amounts of output to this stream in the UI
- * thread. The console needs to process the output in the UI thread and if the client
- * hogs the UI thread writing output to the console, the console will not be able
- * to process the output.
- * </p>
- * @return a new output stream connected to this console
- */
- public IOConsoleOutputStream newOutputStream() {
- IOConsoleOutputStream outputStream = new IOConsoleOutputStream(this);
- outputStream.setEncoding(fEncoding);
- synchronized(openStreams) {
- openStreams.add(outputStream);
- }
- return outputStream;
- }
-
- /**
- * Returns the input stream connected to the keyboard.
- *
- * @return the input stream connected to the keyboard.
- */
- public IOConsoleInputStream getInputStream() {
- return inputStream;
- }
-
- /**
- * Returns this console's document partitioner.
- *
- * @return this console's document partitioner
- */
- protected IConsoleDocumentPartitioner getPartitioner() {
- return partitioner;
- }
-
- /**
- * Returns the maximum number of characters that the console will display at
- * once. This is analogous to the size of the text buffer this console
- * maintains.
- *
- * @return the maximum number of characters that the console will display
- */
- public int getHighWaterMark() {
- return partitioner.getHighWaterMark();
- }
-
- /**
- * Returns the number of characters that will remain in this console
- * when its high water mark is exceeded.
- *
- * @return the number of characters that will remain in this console
- * when its high water mark is exceeded
- */
- public int getLowWaterMark() {
- return partitioner.getLowWaterMark();
- }
-
- /**
- * Sets the text buffer size for this console. The high water mark indicates
- * the maximum number of characters stored in the buffer. The low water mark
- * indicates the number of characters remaining in the buffer when the high
- * water mark is exceeded.
- *
- * @param low the number of characters remaining in the buffer when the high
- * water mark is exceeded (if -1 the console does not limit output)
- * @param high the maximum number of characters this console will cache in
- * its text buffer (if -1 the console does not limit output)
- * @exception IllegalArgumentException if low >= high & low != -1
- */
- public void setWaterMarks(int low, int high) {
- if (low >= 0) {
- if (low >= high) {
- throw new IllegalArgumentException("High water mark must be greater than low water mark"); //$NON-NLS-1$
- }
- }
- partitioner.setWaterMarks(low, high);
- }
-
- /**
- * Check if all streams connected to this console are closed. If so,
- * notify the partitioner that this console is finished.
- */
- private void checkFinished() {
- if (openStreams.isEmpty()) {
- partitioner.streamsClosed();
- }
- }
-
- /**
- * Notification that an output stream connected to this console has been closed.
- *
- * @param stream stream that closed
- */
- void streamClosed(IOConsoleOutputStream stream) {
- synchronized (openStreams) {
- openStreams.remove(stream);
- checkFinished();
- }
- }
-
- /**
- * Notification that the input stream connected to this console has been closed.
- *
- * @param stream stream that closed
- */
- void streamClosed(IOConsoleInputStream stream) {
- synchronized (openStreams) {
- openStreams.remove(stream);
- checkFinished();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.TextConsole#clearConsole()
- */
- public void clearConsole() {
- if (partitioner != null) {
- partitioner.clearBuffer();
- }
- }
-
- /**
- * Disposes this console.
- */
- 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)
- Object[] allStreams= openStreams.toArray();
- for (int i = 0; i < allStreams.length; i++) {
- Object stream = allStreams[i];
- if (stream instanceof IOConsoleInputStream) {
- IOConsoleInputStream is = (IOConsoleInputStream) stream;
- try {
- is.close();
- } catch (IOException e) {
- }
- } else if (stream instanceof IOConsoleOutputStream) {
- IOConsoleOutputStream os = (IOConsoleOutputStream) stream;
- try {
- os.close();
- } catch (IOException e) {
- }
- }
- }
- inputStream = null;
- }
-
- /**
- * Returns the encoding for this console, or <code>null</code> to indicate
- * default encoding.
- *
- * @return the encoding set for this console, or <code>null</code> to indicate
- * default encoding
- * @since 3.3
- */
- public String getEncoding() {
- return fEncoding;
- }
-}
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
deleted file mode 100644
index f6933856b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleInputStream.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * InputStream used to read input from an {@link IOConsole}.
- * This stream will buffer input that it receives until it has been read.
- * An input stream is available from its {@link IOConsole}.
- * @since 3.1
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noextend This class is not intended to be subclassed by clients.
- *
- */
-public class IOConsoleInputStream extends InputStream {
- /**
- * Buffer to hold data from console until it is read.
- */
- private byte[] input = new byte[100];
-
- /**
- * Location in the buffer that the next byte of data from the
- * console should be stored.
- */
- private int inPointer = 0;
-
- /**
- * Location in the buffer that the next byte of data read from
- * this stream should come from.
- */
- private int outPointer = 0;
-
- /**
- * The number of bytes of real data currently in the buffer.
- */
- private int size = 0;
-
- /**
- * Flag to indicate that EOF has been sent already.
- */
- private boolean eofSent = false;
-
- /**
- * Flag to indicate that the stream has been closed.
- */
- private boolean closed = false;
-
- /**
- * The console that this stream is connected to.
- */
- private IOConsole console;
-
- /**
- * The color used to display input in the console.
- */
- private Color color;
-
- /**
- * The font style used to decorate input in the console.
- */
- private int fontStyle = SWT.NORMAL;
-
-
- /**
- * Constructs a new input stream on the given console.
- *
- * @param console I/O console
- */
- IOConsoleInputStream(IOConsole console) {
- this.console = console;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.InputStream#read(byte[], int, int)
- */
- public synchronized int read(byte[] b, int off, int len) throws IOException {
- waitForData();
- if (available() == -1) {
- return -1;
- }
-
- int toCopy = Math.min(len, size);
- if(input.length-outPointer > toCopy) {
- System.arraycopy(input, outPointer, b, off, toCopy);
- outPointer += toCopy;
- size -= toCopy;
- } else {
- int bytesToEnd = input.length-outPointer;
- System.arraycopy(input, outPointer, b, off, bytesToEnd);
- System.arraycopy(input, 0, b, off+bytesToEnd, toCopy-bytesToEnd);
- outPointer = toCopy-bytesToEnd;
- size -=toCopy;
- }
- return toCopy;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.InputStream#read(byte[])
- */
- public int read(byte[] b) throws IOException {
- return read(b, 0, b.length);
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.InputStream#read()
- */
- public synchronized int read() throws IOException {
- waitForData();
- if (available() == -1) {
- return -1;
- }
-
- byte b = input[outPointer];
- outPointer++;
- if (outPointer == input.length) {
- outPointer = 0;
- }
- size -= 1;
- return b;
- }
-
- /**
- * Blocks until data is available to be read.
- * Ensure that the monitor for this object is obtained before
- * calling this method.
- */
- private void waitForData() {
- while (size == 0 && !closed) {
- try {
- wait();
- } catch (InterruptedException e) {
- }
- }
- }
-
- /**
- * Appends text to this input stream's buffer.
- *
- * @param text the text to append to the buffer.
- */
- public synchronized void appendData(String text) {
- String encoding = console.getEncoding();
- byte[] newData;
- if (encoding!=null)
- try {
- newData = text.getBytes(encoding);
- } catch (UnsupportedEncodingException e) {
- newData = text.getBytes();
- }
- else
- newData = text.getBytes();
-
- while(input.length-size < newData.length) {
- growArray();
- }
-
- if (size == 0) { //inPointer == outPointer
- System.arraycopy(newData, 0, input, 0, newData.length);
- inPointer = newData.length;
- size = newData.length;
- outPointer = 0;
- } else if (inPointer < outPointer || input.length - inPointer > newData.length) {
- System.arraycopy(newData, 0, input, inPointer, newData.length);
- inPointer += newData.length;
- size += newData.length;
- } else {
- System.arraycopy(newData, 0, input, inPointer, input.length-inPointer);
- System.arraycopy(newData, input.length-inPointer, input, 0, newData.length-(input.length-inPointer));
- inPointer = newData.length-(input.length-inPointer);
- size += newData.length;
- }
-
- if (inPointer == input.length) {
- inPointer = 0;
- }
- notifyAll();
- }
-
- /**
- * Enlarges the buffer.
- */
- private void growArray() {
- byte[] newInput = new byte[input.length+1024];
- if (outPointer < inPointer) {
- System.arraycopy(input, outPointer, newInput, 0, size);
- } else {
- System.arraycopy(input, outPointer, newInput, 0, input.length-outPointer);
- System.arraycopy(input, 0, newInput, input.length-outPointer, inPointer);
- }
- outPointer = 0;
- inPointer = size;
- input = newInput;
- newInput = null;
- }
-
- /**
- * Returns this stream's font style.
- *
- * @return the font style used to decorate input in the associated console
- */
- public int getFontStyle() {
- return fontStyle;
- }
-
- /**
- * Sets this stream's font style.
- *
- * @param newFontStyle the font style to be used to decorate input in the associated console
- */
- public void setFontStyle(int newFontStyle) {
- if (newFontStyle != fontStyle) {
- int old = fontStyle;
- fontStyle = newFontStyle;
- console.firePropertyChange(this, IConsoleConstants.P_FONT_STYLE, new Integer(old), new Integer(fontStyle));
- }
- }
-
- /**
- * Sets the color to used to decorate input in the associated console.
- *
- * @param newColor the color to used to decorate input in the associated console.
- */
- public void setColor(Color newColor) {
- Color old = color;
- if (old == null || !old.equals(newColor)) {
- color = newColor;
- console.firePropertyChange(this, IConsoleConstants.P_STREAM_COLOR, old, newColor);
- }
- }
-
- /**
- * Returns the color used to decorate input in the associated console
- *
- * @return the color used to decorate input in the associated console
- */
- public Color getColor() {
- return color;
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#available()
- */
- public int available() throws IOException {
- if (closed && eofSent) {
- throw new IOException("Input Stream Closed"); //$NON-NLS-1$
- } else if (size == 0) {
- if (!eofSent) {
- eofSent = true;
- return -1;
- }
- throw new IOException("Input Stream Closed"); //$NON-NLS-1$
- }
-
- return size;
- }
-
- /* (non-Javadoc)
- * @see java.io.InputStream#close()
- */
- public synchronized void close() throws IOException {
- if(closed) {
- throw new IOException("Input Stream Closed"); //$NON-NLS-1$
- }
- closed = true;
- notifyAll();
- 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
deleted file mode 100644
index c035e1a6f..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IOConsoleOutputStream.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.ui.WorkbenchEncoding;
-import org.eclipse.ui.internal.console.IOConsolePartitioner;
-
-/**
- * OutputStream used to write to an IOConsole.
- * <p>
- * Clients are not intended to instantiate this class directly, instead
- * use <code>IOConsole.newOutputStream()</code>.
- * </p>
- * <p>
- * Clients should avoid writing large amounts of output to this stream in the UI
- * thread. The console needs to process the output in the UI thread and if the client
- * hogs the UI thread writing output to the console, the console will not be able
- * to process the output.
- * </p>
- * @since 3.1
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class IOConsoleOutputStream extends OutputStream {
- /**
- * Flag indicating whether this stream has been closed.
- */
- private boolean closed = false;
-
- /**
- * The console's document partitioner.
- */
- private IOConsolePartitioner partitioner;
-
- /**
- * The console this stream is attached to.
- */
- private IOConsole console;
-
- /**
- * Flag indicating that the console should be activated when data
- * is written to this stream.
- */
- private boolean activateOnWrite = false;
-
- /**
- * The color used to decorate data written to this stream.
- */
- private Color color;
-
- /**
- * The font style used to decorate data written to this stream.
- */
- private int fontStyle;
-
- private String fEncoding;
- private String fDefaultEncoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
-
- private boolean fNeedsEncoding = false;
-
- private boolean prependCR;
-
- /**
- * Constructs a new output stream on the given console.
- *
- * @param console I/O console
- */
- IOConsoleOutputStream(IOConsole console) {
- this.console = console;
- this.partitioner = (IOConsolePartitioner) console.getPartitioner();
- }
-
- /**
- * Returns the font style used to decorate data written to this stream.
- *
- * @return the font style used to decorate data written to this stream
- */
- public int getFontStyle() {
- return fontStyle;
- }
-
- /**
- * Sets the font style to be used to decorate data written to this stream.
- *
- * @param newFontStyle the font style to be used to decorate data written to this stream
- */
- public void setFontStyle(int newFontStyle) {
- if (newFontStyle != fontStyle) {
- int old = fontStyle;
- fontStyle = newFontStyle;
- console.firePropertyChange(this, IConsoleConstants.P_FONT_STYLE, new Integer(old), new Integer(fontStyle));
- }
- }
-
- /**
- * Returns whether the console this stream is writing to will be activated when this stream
- * is written to.
- *
- * @return whether the console this stream is writing to will be activated when this stream
- * is written to.
- */
- public boolean isActivateOnWrite() {
- return activateOnWrite;
- }
-
- /**
- * Sets whether to activate the console this stream is writing to when this stream
- * is written to.
- *
- * @param activateOnWrite whether the console this stream is writing to will be activated when this stream
- * is written to.
- */
- public void setActivateOnWrite(boolean activateOnWrite) {
- this.activateOnWrite = activateOnWrite;
- }
-
- /**
- * Sets the color of this stream. Use <code>null</code> to indicate
- * the default color.
- *
- * @param newColor color of this stream, or <code>null</code>
- */
- public void setColor(Color newColor) {
- Color old = color;
- if (old == null || !old.equals(newColor)) {
- color = newColor;
- console.firePropertyChange(this, IConsoleConstants.P_STREAM_COLOR, old, newColor);
- }
- }
-
- /**
- * Returns the color of this stream, or <code>null</code>
- * if default.
- *
- * @return the color of this stream, or <code>null</code>
- */
- public Color getColor() {
- return color;
- }
-
- /**
- * Returns true if the stream has been closed
- * @return true is the stream has been closed, false otherwise.
- */
- public synchronized boolean isClosed() {
- return closed;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#close()
- */
- public synchronized void close() throws IOException {
- if(closed) {
- throw new IOException("Output Stream is closed"); //$NON-NLS-1$
- }
- if (prependCR) { // force writing of last /r
- prependCR = false;
- notifyParitioner("\r"); //$NON-NLS-1$
- }
- console.streamClosed(this);
- closed = true;
- partitioner = null;
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#flush()
- */
- public void flush() throws IOException {
- if(closed) {
- throw new IOException("Output Stream is closed"); //$NON-NLS-1$
- }
- }
-
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#write(byte[], int, int)
- */
- public void write(byte[] b, int off, int len) throws IOException {
- if (fNeedsEncoding) {
- encodedWrite(new String(b, off, len, fEncoding));
- } else {
- encodedWrite(new String(b, off, len));
- }
- }
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#write(byte[])
- */
- public void write(byte[] b) throws IOException {
- write(b, 0, b.length);
- }
- /*
- * (non-Javadoc)
- * @see java.io.OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- write(new byte[] {(byte)b}, 0, 1);
- }
-
- /**
- * Writes a string to the attached console.
- *
- * @param str the string to write to the attached console.
- * @throws IOException if the stream is closed.
- */
- public synchronized void write(String str) throws IOException {
- if (fNeedsEncoding) {
- byte[] defaultBytes = str.getBytes();
- str = new String(defaultBytes, fEncoding);
- }
- encodedWrite(str);
- }
-
- private void encodedWrite(String encodedString) throws IOException {
- if(closed) {
- throw new IOException("Output Stream is closed"); //$NON-NLS-1$
- }
- if (prependCR){
- encodedString="\r"+encodedString; //$NON-NLS-1$
- prependCR=false;
- }
- if (encodedString.endsWith("\r")) { //$NON-NLS-1$
- prependCR = true;
- encodedString = new String(encodedString.substring(0, encodedString.length()-1));
- }
- notifyParitioner(encodedString);
- }
-
- private void notifyParitioner(String encodedString) throws IOException {
- try {
- partitioner.streamAppended(this, encodedString);
-
- if (activateOnWrite) {
- console.activate();
- } else {
- ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(console);
- }
- } catch (IOException e) {
- if (!closed) {
- close();
- }
- throw e;
- }
- }
-
- /**
- * Sets the character encoding used to interpret characters written to this steam.
- *
- * @param encoding encoding identifier
- */
- public void setEncoding(String encoding) {
- fEncoding = encoding;
- fNeedsEncoding = (fEncoding!=null) && (!fEncoding.equals(fDefaultEncoding));
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java
deleted file mode 100644
index d3042ead2..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListener.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A pattern match listener is registered with a <code>TextConsole</code>,
- * and is notified when its pattern has been matched to contents in
- * that console. A pattern match listener can be registered with a console
- * programmatically or via the <code>consolePatternMatchListeners</code> extension
- * point.
- * <p>
- * Following is an example console pattern match listener extension definition.
- * </pre>
- * &lt;extension point="org.eclipse.ui.console.consolePatternMatchListeners"&gt;
- * &lt;consolePatternMatchListener
- * id="com.example.ConsolePatternMatcher"
- * regex=".*foo.*"
- * class="com.example.ConsolePatternMatcher"&gt;
- * &lt;/consolePatternMatchListener&gt;
- * &lt;/extension&gt;
- * </pre>
- * Attributes are specified as follows:
- * <ul>
- * <li><code>id</code> - a unique identifier for the pattern match listener</li>
- * <li><code>regex</code> - regular expression to match</li>
- * <li><code>class</code> - fully qualified name of the Java class implementing
- * <code>org.eclipse.ui.console.IPatternMatchListenerDelegate</code></li>
- * </ul>
- * </p>
- * <p>
- * Optionally a <code>qualifier</code> attribute may be specified to improve performance
- * of regular expression matching. A qualifier specifies a simple regular expression used to
- * qualify lines for the search. Lines that do not contain the qualifier are not considered.
- * </p>
- * <p>
- * Optionally an <code>enablement</code> expression may be provided to specify
- * which console(s) a pattern matcher should be contributed to.
- * </p>
- * <p>
- * Clients may implement this interface directly if registering a pattern match listener with
- * a text console programmatically. Clients contributing a pattern match listener via an
- * extension implement <code>IPatternMatchListenerDelegate</code> instead.
- * </p>
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- */
-public interface IPatternMatchListener extends IPatternMatchListenerDelegate {
- /**
- * Returns the pattern to be used for matching. The pattern is
- * a string representing a regular expression.
- *
- * @return the regular expression to be used for matching
- */
- public String getPattern();
-
- /**
- * Returns the flags to use when compiling this pattern match listener's
- * regular expression, as defined by by <code>Pattern.compile(String regex, int flags)</code>
- *
- * @return the flags to use when compiling this pattern match listener's
- * regular expression
- * @see java.util.regex.Pattern#compile(java.lang.String, int)
- */
- public int getCompilerFlags();
-
- /**
- * Returns a simple regular expression used to identify lines that may
- * match this pattern matcher's complete pattern, or <code>null</code>.
- * Use of this attribute can improve performance by disqualifying lines
- * from the search. When a line is found containing a match for this expression,
- * the line is searched from the beginning for this pattern matcher's
- * complete pattern. Lines not containing this pattern are discarded.
- *
- * @return a simple regular expression used to identify lines that may
- * match this pattern matcher's complete pattern, or <code>null</code>
- */
- public String getLineQualifier();
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java
deleted file mode 100644
index a3e60dd87..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IPatternMatchListenerDelegate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-/**
- * A pattern match listener delegate is notified of regular expression matches
- * in a text console. A delegate is contributed via the
- * <code>consolePatternMatcherListeners</code> extension point.
- * <p>
- * Clients contributing a console pattern match listener extension are intended
- * to implement this interface.
- * </p>
- * @see org.eclipse.ui.console.IPatternMatchListener
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- */
-public interface IPatternMatchListenerDelegate {
- /**
- * Notification that pattern matching will begin in the specified console.
- * A pattern matcher is connected to only one console at a time.
- *
- * @param console the console in which pattern matching will be performed
- */
- public void connect(TextConsole console);
-
- /**
- * Notification that pattern matching has been completed in the console
- * this delegate was last connected to.
- */
- public void disconnect();
-
- /**
- * Notification that a match has been found.
- *
- * @param event event describing where the match was found
- */
- public void matchFound(PatternMatchEvent event);
-}
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
deleted file mode 100644
index b9f3071bf..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsole.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.internal.console.IOConsolePage;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * A console that displays messages. A message console may have one or
- * more streams connected to it (<code>MessageConsoleStream</code>).
- * Text written to streams is buffered and processed in a Job by the
- * console's document partitioner.
- * <p>
- * Clients may instantiate this class.
- * </p>
- * @since 3.0
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class MessageConsole extends IOConsole {
-
- /**
- * Property constant indicating the font of this console has changed.
- *
- * @deprecated use {@link IConsoleConstants#P_FONT}
- */
- public static final String P_FONT = IConsoleConstants.P_FONT;
-
- /**
- * Property constant indicating the color of a stream has changed.
- *
- * @deprecated use {@link IConsoleConstants#P_STREAM_COLOR}
- */
- public static final String P_STREAM_COLOR = IConsoleConstants.P_STREAM_COLOR;
-
- /**
- * Property constant indicating tab size has changed
- *
- * @deprecated use {@link IConsoleConstants#P_TAB_SIZE}
- */
- public static final String P_TAB_SIZE = IConsoleConstants.P_TAB_SIZE;
-
- /**
- * The default tab size
- *
- * @deprecated use {@link IConsoleConstants#DEFAULT_TAB_SIZE}
- */
- public static final int DEFAULT_TAB_SIZE = IConsoleConstants.DEFAULT_TAB_SIZE;
-
- /**
- * Constructs a message console with the given name and image.
- *
- * @param name console name
- * @param imageDescriptor console image descriptor or <code>null</code>
- */
- public MessageConsole(String name, ImageDescriptor imageDescriptor) {
- this(name, imageDescriptor, true);
- }
-
- /**
- * Constructs a message console.
- *
- * @param name console name
- * @param imageDescriptor console image descriptor or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when added and removed from the console manager
- * @since 3.1
- */
- public MessageConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- this(name, IConsoleConstants.MESSAGE_CONSOLE_TYPE, imageDescriptor, autoLifecycle);
- }
-
- /**
- * Constructs a message console with the given name, type, image, and lifecycle.
- *
- * @param name console name
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor console image descriptor or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when added and removed from the console manager
- *
- * @since 3.4
- */
- public MessageConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- this(name, consoleType, imageDescriptor, null, autoLifecycle);
- }
-
- /**
- * Constructs a message console with the given name, type, image, encoding, and lifecycle specification.
- *
- * @param name the name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor console image descriptor or <code>null</code>
- * @param encoding the encoding that should be used to render the text, or <code>null</code>
- * if the system default encoding should be used
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when added and removed from the console manager
- * @since 3.5
- */
- public MessageConsole(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle) {
- super(name, consoleType, imageDescriptor, encoding, autoLifecycle);
- }
-
- /**
- * Returns a new message stream connected to this console.
- * <p>
- * Clients should avoid writing large amounts of output to this stream in the UI
- * thread. The console needs to process the output in the UI thread and if the client
- * hogs the UI thread writing output to the console, the console will not be able
- * to process the output.
- * </p>
- * @return a new message stream connected to this console
- */
- public MessageConsoleStream newMessageStream() {
- return new MessageConsoleStream(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
- */
- public IPageBookViewPage createPage(IConsoleView view) {
- IOConsolePage page = (IOConsolePage) super.createPage(view);
- page.setReadOnly();
- return page;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IOConsole#getInputStream()
- */
- public IOConsoleInputStream getInputStream() {
- throw new UnsupportedOperationException("Message Console does not support user input"); //$NON-NLS-1$
- }
-
-
- /**
- * Appends the given message to this console, from the specified stream.
- *
- * @param text message
- * @param stream stream the message belongs to
- * @deprecated since 3.1, this method should no longer be called, and has no effect.
- * Writing to a message console stream updates the document
- */
- protected void appendToDocument(String text, MessageConsoleStream stream) {
- }
-}
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
deleted file mode 100644
index 274e8a8f2..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/MessageConsoleStream.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.io.IOException;
-
-/**
- * Used to write messages to a message console. A message console may have more
- * than one stream connected to it. Each stream may be displayed in a different
- * color.
- * <p>
- * Instances are created via a {@link org.eclipse.ui.console.MessageConsole}.
- * </p>
- * <p>
- * Clients should avoid writing large amounts of output to this stream in the UI
- * thread. The console needs to process the output in the UI thread and if the client
- * hogs the UI thread writing output to the console, the console will not be able
- * to process the output.
- * </p>
- * <p>
- * Since 3.1, this class extends {@link org.eclipse.ui.console.IOConsoleOutputStream}.
- * </p>
- * @since 3.0
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class MessageConsoleStream extends IOConsoleOutputStream {
-
- private MessageConsole fMessageConsole;
-
- /**
- * Constructs a new stream connected to the given console.
- *
- * @param console the console to write messages to
- */
- public MessageConsoleStream(MessageConsole console) {
- super(console);
- fMessageConsole = console;
- }
-
- /**
- * Appends the specified message to this stream.
- *
- * @param message message to append
- */
- public void print(String message) {
- try {
- write(message);
- } catch (IOException e) {
- ConsolePlugin.log(e);
- }
- }
-
-
- /**
- * Appends a line separator string to this stream.
- */
- public void println() {
- try {
- write("\n"); //$NON-NLS-1$
- } catch (IOException e) {
- ConsolePlugin.log(e);
- }
- }
-
- /**
- * Appends the specified message to this stream, followed by a line
- * separator string.
- *
- * @param message message to print
- */
- public void println(String message) {
- print(message + "\n"); //$NON-NLS-1$
- }
-
- /**
- * Returns the console this stream is connected to.
- *
- * @return the console this stream is connected to
- */
- public MessageConsole getConsole() {
- return fMessageConsole;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java
deleted file mode 100644
index c4c00ff6f..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/PatternMatchEvent.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console;
-
-import java.util.EventObject;
-
-/**
- * An event describing a pattern match in a text console. The source of the event
- * is a <code>TextConsole</code>.
- * <p>
- * Clients may instantiate this class.
- * </p>
- * @see org.eclipse.ui.console.IPatternMatchListener
- * @see org.eclipse.ui.console.TextConsole
- * @since 3.1
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class PatternMatchEvent extends EventObject {
- /*
- * required by EventObject for ObjectSerialization.
- */
- private static final long serialVersionUID = 876890383326854537L;
-
- /**
- * The offset of the match within the console's document.
- */
- private int offset;
-
- /**
- * The length of the matched string
- */
- private int length;
-
- /**
- * Constructs a new pattern match event.
- *
- * @param console the console in which the match was found
- * @param matchOffset the offset at which the match was found
- * @param matchLength the length of the text that matched
- */
- public PatternMatchEvent(TextConsole console, int matchOffset, int matchLength) {
- super(console);
- offset = matchOffset;
- length = matchLength;
- }
-
- /**
- * Returns the length of the matched string.
- *
- * @return the length of the matched string
- */
- public int getLength() {
- return length;
- }
-
- /**
- * Returns the offset of the match within the document.
- *
- * @return the offset of the match within the document
- */
- public int getOffset() {
- return offset;
- }
-
-}
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
deleted file mode 100644
index 81561f9ff..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
+++ /dev/null
@@ -1,554 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.ui.internal.console.ConsoleDocument;
-import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
-import org.eclipse.ui.internal.console.ConsolePatternMatcher;
-import org.eclipse.ui.part.IPageBookViewPage;
-
-/**
- * An abstract text console that supports regular expression matching and
- * hyperlinks.
- * <p>
- * Pattern match listeners can be registered with a console programmatically
- * or via the <code>org.eclipse.ui.console.consolePatternMatchListeners</code>
- * extension point.
- * </p>
- * <p>
- * Clients may subclass this class. Subclasses must provide a document partitioner.
- * </p>
- * @since 3.1
- */
-public abstract class TextConsole extends AbstractConsole {
-
- /**
- * The current width of the console. Used for fixed width consoles.
- * A value of <=0 means does not have a fixed width.
- */
- private int fConsoleWidth;
- /**
- * The current tab width
- */
- private int fTabWidth;
- /**
- * The font used by this console
- */
- private Font fFont;
-
- /**
- * The background color used by this console or <code>null</code> if default
- */
- private Color fBackground;
-
- /**
- * The Console's regular expression pattern matcher
- */
- private ConsolePatternMatcher fPatternMatcher;
-
- /**
- * The Console's document
- */
- private ConsoleDocument fDocument;
-
- /**
- * indication that the console's partitioner is not expecting more input
- */
- private boolean fPartitionerFinished = false;
-
- /**
- * Indication that the console's pattern matcher has finished.
- * (all matches have been found and all listeners notified)
- */
- private boolean fMatcherFinished = false;
-
- /**
- * indication that the console output complete property has been fired
- */
- private boolean fCompleteFired = false;
-
-
- /**
- * Map of client defined attributes
- */
- private HashMap fAttributes = new HashMap();
-
- private IConsoleManager fConsoleManager = ConsolePlugin.getDefault().getConsoleManager();
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.AbstractConsole#dispose()
- */
- protected void dispose() {
- super.dispose();
- fFont = null;
- synchronized(fAttributes) {
- fAttributes.clear();
- }
- }
- /**
- * Constructs a console with the given name, image descriptor, and lifecycle
- *
- * @param name name to display for this console
- * @param consoleType console type identifier or <code>null</code>
- * @param imageDescriptor image to display for this console or <code>null</code>
- * @param autoLifecycle whether lifecycle methods should be called automatically
- * when this console is added/removed from the console manager
- */
- public TextConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
- super(name, consoleType, imageDescriptor, autoLifecycle);
- fDocument = new ConsoleDocument();
- fDocument.addPositionCategory(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- fPatternMatcher = new ConsolePatternMatcher(this);
- fDocument.addDocumentListener(fPatternMatcher);
- fTabWidth = IConsoleConstants.DEFAULT_TAB_SIZE;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
- */
- public IPageBookViewPage createPage(IConsoleView view) {
- return new TextConsolePage(this, view);
- }
-
- /**
- * Returns this console's document.
- * <p>
- * Note that a console may or may not support direct manipulation of its document.
- * For example, an I/O console document and its partitions are produced from the
- * streams connected to it, and clients are not intended to modify the document's
- * contents.
- * </p>
- *
- * @return this console's document
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * Returns the current width of this console. A value of zero of less
- * indicates this console has no fixed width.
- *
- * @return the current width of this console
- */
- public int getConsoleWidth() {
- return fConsoleWidth;
- }
-
- /**
- * Sets the width of this console in characters. Any value greater than zero
- * will cause this console to have a fixed width.
- *
- * @param width the width to make this console. Values of 0 or less imply
- * the console does not have any fixed width.
- */
- public void setConsoleWidth(int width) {
- if (fConsoleWidth != width) {
- int old = fConsoleWidth;
- fConsoleWidth = width;
-
- firePropertyChange(this, IConsoleConstants.P_CONSOLE_WIDTH, new Integer(old), new Integer(fConsoleWidth));
- }
- }
-
- /**
- * Sets the tab width used in this console.
- *
- * @param newTabWidth the tab width
- */
- public void setTabWidth(final int newTabWidth) {
- if (fTabWidth != newTabWidth) {
- final int oldTabWidth = fTabWidth;
- fTabWidth = newTabWidth;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- firePropertyChange(TextConsole.this, IConsoleConstants.P_TAB_SIZE, new Integer(oldTabWidth), new Integer(fTabWidth));
- }
- });
- }
- }
-
- /**
- * Returns the tab width used in this console.
- *
- * @return tab width used in this console
- */
- public int getTabWidth() {
- return fTabWidth;
- }
-
- /**
- * Returns the font used by this console. Must be called in the UI thread.
- *
- * @return font used by this console
- */
- public Font getFont() {
- if (fFont == null) {
- fFont = getDefaultFont();
- }
- return fFont;
- }
-
- /**
- * Returns the default text font.
- *
- * @return the default text font
- */
- private Font getDefaultFont() {
- return JFaceResources.getFont(JFaceResources.TEXT_FONT);
- }
-
- /**
- * Sets the font used by this console. Specify <code>null</code> to use
- * the default text font.
- *
- * @param newFont font, or <code>null</code> to indicate the default font
- */
- public void setFont(Font newFont) {
- // ensure font is initialized
- getFont();
- // translate null to default font
- if (newFont == null) {
- newFont = getDefaultFont();
- }
- // fire property change if required
- if (!fFont.equals(newFont)) {
- Font old = fFont;
- fFont = newFont;
- firePropertyChange(this, IConsoleConstants.P_FONT, old, fFont);
- }
- }
-
- /**
- * Sets the background color used by this console. Specify <code>null</code> to use
- * the default background color.
- *
- * @param background background color or <code>null</code> for default
- * @since 3.3
- * @deprecated use setBackground(Color) instead
- */
- public void setBackgrond(Color background) {
- setBackground(background);
- }
-
- /**
- * Sets the background color used by this console. Specify <code>null</code> to use
- * the default background color.
- *
- * @param background background color or <code>null</code> for default
- * @since 3.3
- */
- public void setBackground(Color background) {
- if (fBackground == null) {
- if (background == null) {
- return;
- }
- } else if (fBackground.equals(background)){
- return;
- }
- Color old = fBackground;
- fBackground = background;
- firePropertyChange(this, IConsoleConstants.P_BACKGROUND_COLOR, old, fBackground);
- }
-
- /**
- * Returns the background color to use for this console or <code>null</code> for the
- * default background color.
- *
- * @return background color or <code>null</code> for default
- * @since 3.3
- */
- public Color getBackground() {
- return fBackground;
- }
-
- /**
- * Clears the console.
- * <p>
- * Since a console may or may not support direct manipulation
- * of its document's contents, this method should be called to clear a text console's
- * document. The default implementation sets this console's document content
- * to the empty string directly. Subclasses should override as required.
- * </p>
- */
- public void clearConsole() {
- IDocument document = getDocument();
- if (document != null) {
- document.set(""); //$NON-NLS-1$
- }
- }
-
- /**
- * Returns the console's document partitioner.
- * @return The console's document partitioner
- */
- protected abstract IConsoleDocumentPartitioner getPartitioner();
-
- /**
- * Returns all hyperlinks in this console.
- *
- * @return all hyperlinks in this console
- */
- public IHyperlink[] getHyperlinks() {
- try {
- Position[] positions = getDocument().getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- IHyperlink[] hyperlinks = new IHyperlink[positions.length];
- for (int i = 0; i < positions.length; i++) {
- ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition) positions[i];
- hyperlinks[i] = position.getHyperLink();
- }
- return hyperlinks;
- } catch (BadPositionCategoryException e) {
- return new IHyperlink[0];
- }
- }
-
- /**
- * Returns the hyperlink at the given offset of <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
- */
- public IHyperlink getHyperlink(int offset) {
- try {
- IDocument document = getDocument();
- if (document != null) {
- Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- Position position = findPosition(offset, positions);
- if (position instanceof ConsoleHyperlinkPosition) {
- return ((ConsoleHyperlinkPosition) position).getHyperLink();
- }
- }
- } catch (BadPositionCategoryException e) {
- }
- return null;
- }
-
- /**
- * Binary search for the position at a given offset.
- *
- * @param offset the offset whose position should be found
- * @return the position containing the offset, or <code>null</code>
- */
- private Position findPosition(int offset, Position[] positions) {
-
- if (positions.length == 0)
- return null;
-
- int left= 0;
- int right= positions.length -1;
- int mid= 0;
- Position position= null;
-
- while (left < right) {
-
- mid= (left + right) / 2;
-
- position= positions[mid];
- if (offset < position.getOffset()) {
- if (left == mid)
- right= left;
- else
- right= mid -1;
- } else if (offset > (position.getOffset() + position.getLength() - 1)) {
- if (right == mid)
- left= right;
- else
- left= mid +1;
- } else {
- left= right= mid;
- }
- }
-
- position= positions[left];
- if (offset >= position.getOffset() && (offset < (position.getOffset() + position.getLength()))) {
- return position;
- }
- return null;
- }
-
- /**
- * Adds the given pattern match listener to this console. The listener will
- * be connected and receive match notifications. Has no effect if an identical
- * listener has already been added.
- *
- * @param listener the listener to add
- */
- public void addPatternMatchListener(IPatternMatchListener listener) {
- fPatternMatcher.addPatternMatchListener(listener);
- }
-
- /**
- * Removes the given pattern match listener from this console. The listener will be
- * disconnected and will no longer receive match notifications. Has no effect
- * if the listener was not previously added.
- *
- * @param listener the pattern match listener to remove
- */
- public void removePatternMatchListener(IPatternMatchListener listener) {
- fPatternMatcher.removePatternMatchListener(listener);
- }
-
-
- /**
- * Job scheduling rule that prevent the job from running if the console's PatternMatcher
- * is active.
- */
- private class MatcherSchedulingRule implements ISchedulingRule {
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- public boolean isConflicting(ISchedulingRule rule) {
- if (contains(rule)) {
- return true;
- }
- if (rule != this && rule instanceof MatcherSchedulingRule) {
- return (((MatcherSchedulingRule)rule).getConsole() == TextConsole.this);
- }
- return false;
- }
-
- public TextConsole getConsole() {
- return TextConsole.this;
- }
- }
-
- /**
- * Returns a scheduling rule which can be used to prevent jobs from running
- * while this console's pattern matcher is active.
- * <p>
- * Although this scheduling rule prevents jobs from running at the same time as
- * pattern matching jobs for this console, it does not enforce any ordering of jobs.
- * Since 3.2, pattern matching jobs belong to the job family identified by the console
- * object that matching is occurring on. To ensure a job runs after all scheduled pattern
- * matching is complete, clients must join on this console's job family.
- * </p>
- * @return a scheduling rule which can be used to prevent jobs from running
- * while this console's pattern matcher is active
- */
- public ISchedulingRule getSchedulingRule() {
- return new MatcherSchedulingRule();
- }
-
- /**
- * This console's partitioner should call this method when it is not expecting any new data
- * to be appended to the document.
- */
- public void partitionerFinished() {
- fPatternMatcher.forceFinalMatching();
- fPartitionerFinished = true;
- checkFinished();
- }
-
- /**
- * Called by this console's pattern matcher when matching is complete.
- * <p>
- * Clients should not call this method.
- * <p>
- */
- public void matcherFinished() {
- fMatcherFinished = true;
- fDocument.removeDocumentListener(fPatternMatcher);
- checkFinished();
- }
-
- /**
- * Fires the console output complete property change event.
- */
- private synchronized void checkFinished() {
- if (!fCompleteFired && fPartitionerFinished && fMatcherFinished ) {
- fCompleteFired = true;
- firePropertyChange(this, IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE, null, null);
- }
- }
-
- /**
- * Adds a hyperlink to this console.
- *
- * @param hyperlink the hyperlink to add
- * @param offset the offset in the console document at which the hyperlink should be added
- * @param length the length of the text which should be hyperlinked
- * @throws BadLocationException if the specified location is not valid.
- */
- public void addHyperlink(IHyperlink hyperlink, int offset, int length) throws BadLocationException {
- IDocument document = getDocument();
- ConsoleHyperlinkPosition hyperlinkPosition = new ConsoleHyperlinkPosition(hyperlink, offset, length);
- try {
- document.addPosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, hyperlinkPosition);
- fConsoleManager.refresh(this);
- } catch (BadPositionCategoryException e) {
- ConsolePlugin.log(e);
- }
- }
-
- /**
- * Returns the region associated with the given hyperlink.
- *
- * @param link hyperlink
- * @return the region associated with the hyperlink or null if the hyperlink is not found.
- */
- public IRegion getRegion(IHyperlink link) {
- try {
- 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];
- if (position.getHyperLink().equals(link)) {
- return new Region(position.getOffset(), position.getLength());
- }
- }
- }
- } catch (BadPositionCategoryException e) {
- }
- return null;
- }
-
- /**
- * Returns the attribute associated with the specified key.
- *
- * @param key attribute key
- * @return the attribute associated with the specified key
- */
- public Object getAttribute(String key) {
- synchronized (fAttributes) {
- return fAttributes.get(key);
- }
- }
-
- /**
- * Sets an attribute value. Intended for client data.
- *
- * @param key attribute key
- * @param value attribute value
- */
- public void setAttribute(String key, Object value) {
- synchronized(fAttributes) {
- fAttributes.put(key, value);
- }
- }
-}
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
deleted file mode 100644
index ae76fec0a..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Livar Cunha (livarcocc@gmail.com) - Bug 236049
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Widget;
-
-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;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.JFaceResources;
-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.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.ui.IActionBars;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.console.actions.ClearOutputAction;
-import org.eclipse.ui.console.actions.TextViewerAction;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-import org.eclipse.ui.internal.console.ConsoleResourceBundleMessages;
-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.FindReplaceAction;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * A page for a text console.
- * <p>
- * Clients may contribute actions to the context menu of a text console page
- * using the <code>org.eclipse.ui.popupMenus</code> extension point. The context
- * menu identifier for a text console page is the associated console's type
- * suffixed with <code>.#ContextMenu</code>. When a console does not specify
- * a type, the context menu id is <code>#ContextMenu</code>.
- * </p>
- * <p>
- * Clients may subclass this class.
- * </p>
- * @since 3.1
- */
-public class TextConsolePage implements IPageBookViewPage, IPropertyChangeListener, IAdaptable {
- private IPageSite fSite;
- private TextConsole fConsole;
- private IConsoleView fConsoleView;
- private TextConsoleViewer fViewer;
- private MenuManager fMenuManager;
- protected Map fGlobalActions = new HashMap();
- protected ArrayList fSelectionActions = new ArrayList();
- protected ClearOutputAction fClearOutputAction;
-
- // text selection listener, used to update selection dependent actions on selection changes
- private ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
- 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() {
- 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);
- }
- }
- }
- };
-
- /**
- * Constructs a text console page for the given console in the given view.
- *
- * @param console text console
- * @param view console view the page is contained in
- */
- public TextConsolePage(TextConsole console, IConsoleView view) {
- fConsole = console;
- fConsoleView = view;
- }
-
- /**
- * Returns a viewer used to display the contents of this page's console.
- *
- * @param parent container for the viewer
- * @return a viewer used to display the contents of this page's console
- */
- protected TextConsoleViewer createViewer(Composite parent) {
- return new TextConsoleViewer(parent, fConsole);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPageBookViewPage#getSite()
- */
- public IPageSite getSite() {
- return fSite;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite)
- */
- public void init(IPageSite pageSite) throws PartInitException {
- fSite = pageSite;
- }
-
- /**
- * Updates selection dependent actions.
- */
- protected void updateSelectionDependentActions() {
- Iterator iterator= fSelectionActions.iterator();
- while (iterator.hasNext()) {
- updateAction((String)iterator.next());
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- fViewer = createViewer(parent);
- fViewer.setConsoleWidth(fConsole.getConsoleWidth());
- fViewer.setTabWidth(fConsole.getTabWidth());
- fConsole.addPropertyChangeListener(this);
- JFaceResources.getFontRegistry().addListener(this);
-
- String id = "#ContextMenu"; //$NON-NLS-1$
- if (getConsole().getType() != null) {
- id = getConsole().getType() + "." + id; //$NON-NLS-1$
- }
- fMenuManager= new MenuManager("#ContextMenu", id); //$NON-NLS-1$
- fMenuManager.setRemoveAllWhenShown(true);
- fMenuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager m) {
- contextMenuAboutToShow(m);
- }
- });
- Menu menu = fMenuManager.createContextMenu(getControl());
- getControl().setMenu(menu);
-
- createActions();
- configureToolBar(getSite().getActionBars().getToolBarManager());
-
- getSite().registerContextMenu(id, fMenuManager, fViewer);
- getSite().setSelectionProvider(fViewer);
-
- fViewer.getSelectionProvider().addSelectionChangedListener(selectionChangedListener);
- fViewer.addTextListener(textListener);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#dispose()
- */
- public void dispose() {
- fConsole.removePropertyChangeListener(this);
- JFaceResources.getFontRegistry().removeListener(this);
-
- if (fMenuManager != null) {
- fMenuManager.dispose();
- }
- fClearOutputAction = null;
- fSelectionActions.clear();
- fGlobalActions.clear();
-
- fViewer.getSelectionProvider().removeSelectionChangedListener(selectionChangedListener);
- fViewer.removeTextListener(textListener);
- fViewer = null;
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#getControl()
- */
- public Control getControl() {
- return fViewer != null ? fViewer.getControl() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
- */
- public void setActionBars(IActionBars actionBars) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#setFocus()
- */
- public void setFocus() {
- if (fViewer != null) {
- fViewer.getTextWidget().setFocus();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (fViewer != null) {
- Object source = event.getSource();
- String property = event.getProperty();
-
- if (source.equals(fConsole) && IConsoleConstants.P_FONT.equals(property)) {
- fViewer.setFont(fConsole.getFont());
- } else if (IConsoleConstants.P_FONT_STYLE.equals(property)) {
- fViewer.getTextWidget().redraw();
- } else if (property.equals(IConsoleConstants.P_STREAM_COLOR)) {
- fViewer.getTextWidget().redraw();
- } else if (source.equals(fConsole) && property.equals(IConsoleConstants.P_TAB_SIZE)) {
- Integer tabSize = (Integer)event.getNewValue();
- fViewer.setTabWidth(tabSize.intValue());
- } else if (source.equals(fConsole) && property.equals(IConsoleConstants.P_CONSOLE_WIDTH)) {
- fViewer.setConsoleWidth(fConsole.getConsoleWidth());
- } else if (IConsoleConstants.P_BACKGROUND_COLOR.equals(property)) {
- fViewer.getTextWidget().setBackground(fConsole.getBackground());
- }
- }
- }
-
- /**
- * Creates actions.
- */
- protected void createActions() {
- IActionBars actionBars= getSite().getActionBars();
- TextViewerAction action= new TextViewerAction(fViewer, ITextOperationTarget.SELECT_ALL);
- action.configureAction(ConsoleMessages.TextConsolePage_SelectAllText, ConsoleMessages.TextConsolePage_SelectAllDescrip, ConsoleMessages.TextConsolePage_SelectAllDescrip);
- action.setActionDefinitionId(ActionFactory.SELECT_ALL.getCommandId());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IConsoleHelpContextIds.CONSOLE_SELECT_ALL_ACTION);
- setGlobalAction(actionBars, ActionFactory.SELECT_ALL.getId(), action);
-
- action= new TextViewerAction(fViewer, ITextOperationTarget.CUT);
- action.configureAction(ConsoleMessages.TextConsolePage_CutText, ConsoleMessages.TextConsolePage_CutDescrip, ConsoleMessages.TextConsolePage_CutDescrip);
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
- action.setActionDefinitionId(ActionFactory.CUT.getCommandId());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IConsoleHelpContextIds.CONSOLE_CUT_ACTION);
- setGlobalAction(actionBars, ActionFactory.CUT.getId(), action);
-
- action= new TextViewerAction(fViewer, ITextOperationTarget.COPY);
- action.configureAction(ConsoleMessages.TextConsolePage_CopyText, ConsoleMessages.TextConsolePage_CopyDescrip, ConsoleMessages.TextConsolePage_CopyDescrip);
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- action.setActionDefinitionId(ActionFactory.COPY.getCommandId());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IConsoleHelpContextIds.CONSOLE_COPY_ACTION);
- setGlobalAction(actionBars, ActionFactory.COPY.getId(), action);
-
- action= new TextViewerAction(fViewer, ITextOperationTarget.PASTE);
- action.configureAction(ConsoleMessages.TextConsolePage_PasteText, ConsoleMessages.TextConsolePage_PasteDescrip, ConsoleMessages.TextConsolePage_PasteDescrip);
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- action.setActionDefinitionId(ActionFactory.PASTE.getCommandId());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IConsoleHelpContextIds.CONSOLE_PASTE_ACTION);
- setGlobalAction(actionBars, ActionFactory.PASTE.getId(), action);
-
- fClearOutputAction = new ClearOutputAction(fConsole);
-
- ResourceBundle bundle = ConsoleResourceBundleMessages.getBundle();
- FindReplaceAction fraction = new FindReplaceAction(bundle, "find_replace_action_", fConsoleView); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fraction, IConsoleHelpContextIds.CONSOLE_FIND_REPLACE_ACTION);
- setGlobalAction(actionBars, ActionFactory.FIND.getId(), fraction);
-
- fSelectionActions.add(ActionFactory.CUT.getId());
- fSelectionActions.add(ActionFactory.COPY.getId());
- fSelectionActions.add(ActionFactory.PASTE.getId());
- fSelectionActions.add(ActionFactory.FIND.getId());
-
- actionBars.updateActionBars();
- }
-
- /**
- * Configures an action for key bindings.
- *
- * @param actionBars action bars for this page
- * @param actionID action definition id
- * @param action associated action
- */
- protected void setGlobalAction(IActionBars actionBars, String actionID, IAction action) {
- fGlobalActions.put(actionID, action);
- actionBars.setGlobalActionHandler(actionID, action);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class required) {
- if (IFindReplaceTarget.class.equals(required)) {
- return fViewer.getFindReplaceTarget();
- }
- if (Widget.class.equals(required)) {
- return fViewer.getTextWidget();
- }
- return null;
- }
-
- /**
- * Returns the view this page is contained in.
- *
- * @return the view this page is contained in
- */
- protected IConsoleView getConsoleView() {
- return fConsoleView;
- }
-
- /**
- * Returns the console this page is displaying.
- *
- * @return the console this page is displaying
- */
- protected IConsole getConsole() {
- return fConsole;
- }
-
- /**
- * Updates the global action with the given id
- *
- * @param actionId action definition id
- */
- protected void updateAction(String actionId) {
- IAction action= (IAction)fGlobalActions.get(actionId);
- if (action instanceof IUpdate) {
- ((IUpdate) action).update();
- }
- }
-
-
- /**
- * Fill the context menu
- *
- * @param menuManager menu
- */
- protected void contextMenuAboutToShow(IMenuManager menuManager) {
- IDocument doc= fViewer.getDocument();
- if (doc == null) {
- return;
- }
-
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.CUT.getId()));
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.COPY.getId()));
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.PASTE.getId()));
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.SELECT_ALL.getId()));
-
- menuManager.add(new Separator("FIND")); //$NON-NLS-1$
- menuManager.add((IAction)fGlobalActions.get(ActionFactory.FIND.getId()));
- menuManager.add(new FollowHyperlinkAction(fViewer));
- menuManager.add(fClearOutputAction);
-
- menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- protected void configureToolBar(IToolBarManager mgr) {
- mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fClearOutputAction);
- }
-
-
- /**
- * Returns the viewer contained in this page.
- *
- * @return the viewer contained in this page
- */
- public TextConsoleViewer getViewer() {
- return fViewer;
- }
-
- /**
- * Sets the viewer contained in this page.
- *
- * @param viewer text viewer
- */
- public void setViewer(TextConsoleViewer viewer) {
- this.fViewer = viewer;
- }
-}
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
deleted file mode 100644
index 50c1a8e2d..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
+++ /dev/null
@@ -1,699 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.console;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.JFacePreferences;
-import org.eclipse.jface.resource.ColorRegistry;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.BadPositionCategoryException;
-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.IPositionUpdater;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.LineBackgroundEvent;
-import org.eclipse.swt.custom.LineBackgroundListener;
-import org.eclipse.swt.custom.LineStyleEvent;
-import org.eclipse.swt.custom.LineStyleListener;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
-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.ui.internal.console.ConsoleDocumentAdapter;
-import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * Default viewer used to display a <code>TextConsole</code>.
- * <p>
- * Clients may subclass this class.
- * </p>
- *
- * @since 3.1
- */
-public class TextConsoleViewer extends SourceViewer implements LineStyleListener, LineBackgroundListener, MouseTrackListener, MouseMoveListener, MouseListener {
- /**
- * Adapts document to the text widget.
- */
- private ConsoleDocumentAdapter documentAdapter;
-
- private IHyperlink hyperlink;
-
- private Cursor handCursor;
-
- private Cursor textCursor;
-
- private int consoleWidth = -1;
-
- private TextConsole console;
-
- private IPropertyChangeListener propertyChangeListener;
-
- private IDocumentListener documentListener = new IDocumentListener() {
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- public void documentChanged(DocumentEvent event) {
- updateLinks(event.fOffset);
- }
- };
- // event listener used to send event to hyperlink for IHyperlink2
- private Listener mouseUpListener = new Listener() {
- public void handleEvent(Event event) {
- if (hyperlink != null) {
- String selection = getTextWidget().getSelectionText();
- if (selection.length() <= 0) {
- if (event.button == 1) {
- if (hyperlink instanceof IHyperlink2) {
- ((IHyperlink2) hyperlink).linkActivated(event);
- } else {
- hyperlink.linkActivated();
- }
- }
- }
- }
- }
- };
-
- WorkbenchJob revealJob = new WorkbenchJob("Reveal End of Document") {//$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- StyledText textWidget = getTextWidget();
- if (textWidget != null && !textWidget.isDisposed()) {
- int lineCount = textWidget.getLineCount();
- textWidget.setTopIndex(lineCount - 1);
- }
- return Status.OK_STATUS;
- }
- };
-
- private IPositionUpdater positionUpdater = new IPositionUpdater() {
- public void update(DocumentEvent event) {
- 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];
- if (position.offset == event.fOffset && position.length<=event.fLength) {
- position.delete();
- }
- if (position.isDeleted) {
- document.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, position);
- }
- }
- }
- } catch (BadPositionCategoryException e) {
- }
- }
- };
-
- /**
- * Constructs a new viewer in the given parent for the specified console.
- *
- * @param parent
- * containing widget
- * @param console
- * text console
- */
- public TextConsoleViewer(Composite parent, TextConsole console) {
- super(parent, null, SWT.V_SCROLL | SWT.H_SCROLL);
- this.console = console;
-
- IDocument document = console.getDocument();
- setDocument(document);
-
- StyledText styledText = getTextWidget();
- styledText.setDoubleClickEnabled(true);
- styledText.addLineStyleListener(this);
- styledText.addLineBackgroundListener(this);
- styledText.setEditable(true);
- setFont(console.getFont());
- styledText.addMouseTrackListener(this);
- styledText.addListener(SWT.MouseUp, mouseUpListener);
-
- ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
- propertyChangeListener = new HyperlinkColorChangeListener();
- colorRegistry.addListener(propertyChangeListener);
-
- revealJob.setSystem(true);
- document.addDocumentListener(documentListener);
- document.addPositionUpdater(positionUpdater);
- }
-
- /**
- * Sets the tab width used by this viewer.
- *
- * @param tabWidth
- * the tab width used by this viewer
- */
- public void setTabWidth(int tabWidth) {
- StyledText styledText = getTextWidget();
- int oldWidth = styledText.getTabs();
- if (tabWidth != oldWidth) {
- styledText.setTabs(tabWidth);
- }
- }
-
- /**
- * Sets the font used by this viewer.
- *
- * @param font
- * the font used by this viewer
- */
- public void setFont(Font font) {
- StyledText styledText = getTextWidget();
- Font oldFont = styledText.getFont();
- if (oldFont == font) {
- return;
- }
- if (font == null || !(font.equals(oldFont))) {
- styledText.setFont(font);
- }
- }
-
- /**
- * Positions the cursor at the end of the document.
- */
- protected void revealEndOfDocument() {
- revealJob.schedule(50);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.custom.LineStyleListener#lineGetStyle(org.eclipse.swt.custom.LineStyleEvent)
- */
- public void lineGetStyle(LineStyleEvent event) {
- IDocument document = getDocument();
- if (document != null && document.getLength() > 0) {
- ArrayList ranges = new ArrayList();
- int offset = event.lineOffset;
- int length = event.lineText.length();
-
- StyleRange[] partitionerStyles = ((IConsoleDocumentPartitioner) document.getDocumentPartitioner()).getStyleRanges(event.lineOffset, event.lineText.length());
- if (partitionerStyles != null) {
- for (int i = 0; i < partitionerStyles.length; i++) {
- ranges.add(partitionerStyles[i]);
- }
- } else {
- ranges.add(new StyleRange(offset, length, null, null));
- }
-
- try {
- Position[] positions = getDocument().getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- 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];
- StyleRange linkRange = new StyleRange(position.offset, position.length, color, null);
- linkRange.underline = true;
- override(ranges, linkRange);
- }
- }
- } catch (BadPositionCategoryException e) {
- }
-
- if (ranges.size() > 0) {
- event.styles = (StyleRange[]) ranges.toArray(new StyleRange[ranges.size()]);
- }
- }
- }
-
- private void override(List 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 = (StyleRange) 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;
- }
-
- 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));
- }
- 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));
- }
- }
- }
-
- /**
- * 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
- * @return the positions overlapping the given range, or <code>null</code>
- */
- private Position[] findPosition(int offset, int length, Position[] positions) {
-
- if (positions.length == 0)
- return null;
-
- int rangeEnd = offset + length;
- int left = 0;
- int right = positions.length - 1;
- int mid = 0;
- Position position = null;
-
- while (left < right) {
-
- mid = (left + right) / 2;
-
- position = positions[mid];
- if (rangeEnd < position.getOffset()) {
- if (left == mid)
- right = left;
- else
- right = mid - 1;
- } else if (offset > (position.getOffset() + position.getLength() - 1)) {
- if (right == mid)
- left = right;
- else
- left = mid + 1;
- } else {
- left = right = mid;
- }
- }
-
- List list = new ArrayList();
- int index = left - 1;
- if (index >= 0) {
- position = positions[index];
- while (index >= 0 && (position.getOffset() + position.getLength()) > offset) {
- index--;
- if (index > 0) {
- position = positions[index];
- }
- }
- }
- index++;
- position = positions[index];
- while (index < positions.length && (position.getOffset() < rangeEnd)) {
- list.add(position);
- index++;
- if (index < positions.length) {
- position = positions[index];
- }
- }
-
- if (list.isEmpty()) {
- return null;
- }
- return (Position[]) list.toArray(new Position[list.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.custom.LineBackgroundListener#lineGetBackground(org.eclipse.swt.custom.LineBackgroundEvent)
- */
- public void lineGetBackground(LineBackgroundEvent event) {
- event.lineBackground = null;
- }
-
- /**
- * Returns the hand cursor.
- *
- * @return the hand cursor
- */
- protected Cursor getHandCursor() {
- if (handCursor == null) {
- handCursor = new Cursor(ConsolePlugin.getStandardDisplay(), SWT.CURSOR_HAND);
- }
- return handCursor;
- }
-
- /**
- * Returns the text cursor.
- *
- * @return the text cursor
- */
- protected Cursor getTextCursor() {
- if (textCursor == null) {
- textCursor = new Cursor(ConsolePlugin.getStandardDisplay(), SWT.CURSOR_IBEAM);
- }
- return textCursor;
- }
-
- /**
- * Notification a hyperlink has been entered.
- *
- * @param link
- * the link that was entered
- */
- protected void linkEntered(IHyperlink link) {
- Control control = getTextWidget();
- if (hyperlink != null) {
- linkExited(hyperlink);
- }
- hyperlink = link;
- hyperlink.linkEntered();
- control.setCursor(getHandCursor());
- control.redraw();
- control.addMouseListener(this);
- }
-
- /**
- * Notification a link was exited.
- *
- * @param link
- * the link that was exited
- */
- protected void linkExited(IHyperlink link) {
- link.linkExited();
- hyperlink = null;
- Control control = getTextWidget();
- control.setCursor(getTextCursor());
- control.redraw();
- control.removeMouseListener(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseEnter(MouseEvent e) {
- getTextWidget().addMouseMoveListener(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseTrackListener#mouseExit(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseExit(MouseEvent e) {
- getTextWidget().removeMouseMoveListener(this);
- if (hyperlink != null) {
- linkExited(hyperlink);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseTrackListener#mouseHover(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseHover(MouseEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseMove(MouseEvent e) {
- int offset = -1;
- try {
- Point p = new Point(e.x, e.y);
- offset = getTextWidget().getOffsetAtLocation(p);
- } catch (IllegalArgumentException ex) {
- // out of the document range
- }
- updateLinks(offset);
- }
-
- /**
- * The cursor has just be moved to the given offset, the mouse has hovered
- * over the given offset. Update link rendering.
- *
- * @param offset
- */
- protected void updateLinks(int offset) {
- if (offset >= 0) {
- IHyperlink link = getHyperlink(offset);
- if (link != null) {
- if (link.equals(hyperlink)) {
- return;
- }
- linkEntered(link);
- return;
- }
- }
- if (hyperlink != null) {
- linkExited(hyperlink);
- }
- }
-
- /**
- * Returns the currently active hyperlink or <code>null</code> if none.
- *
- * @return the currently active hyperlink or <code>null</code> if none
- */
- public IHyperlink getHyperlink() {
- return hyperlink;
- }
-
- /**
- * Returns the hyperlink at the specified offset, or <code>null</code> if
- * none.
- *
- * @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) {
- if (offset >= 0 && console != null) {
- return console.getHyperlink(offset);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.TextViewer#createDocumentAdapter()
- */
- protected IDocumentAdapter createDocumentAdapter() {
- if (documentAdapter == null) {
- documentAdapter = new ConsoleDocumentAdapter(consoleWidth = -1);
- }
- return documentAdapter;
- }
-
- /**
- * Sets the console to have a fixed character width. Use -1 to indicate that
- * a fixed width should not be used.
- *
- * @param width
- * fixed character width of the console, or -1
- */
- public void setConsoleWidth(int width) {
- if (consoleWidth != width) {
- consoleWidth = width;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- if (documentAdapter != null) {
- documentAdapter.setWidth(consoleWidth);
- }
- }
- });
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.TextViewer#handleDispose()
- */
- protected void handleDispose() {
- IDocument document = getDocument();
- if (document != null) {
- document.removeDocumentListener(documentListener);
- document.removePositionUpdater(positionUpdater);
- }
-
- StyledText styledText = getTextWidget();
- styledText.removeLineStyleListener(this);
- styledText.removeLineBackgroundListener(this);
- styledText.removeMouseTrackListener(this);
-
- if(handCursor != null) {
- handCursor.dispose();
- }
- handCursor = null;
- if(textCursor != null) {
- textCursor.dispose();
- }
- textCursor = null;
- hyperlink = null;
- console = null;
-
- ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
- colorRegistry.removeListener(propertyChangeListener);
-
- super.handleDispose();
- }
-
- class HyperlinkColorChangeListener implements IPropertyChangeListener {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(JFacePreferences.ACTIVE_HYPERLINK_COLOR) || event.getProperty().equals(JFacePreferences.HYPERLINK_COLOR)) {
- getTextWidget().redraw();
- }
- }
-
- }
-
- /*
- * work around to memory leak in TextViewer$WidgetCommand
- */
- protected void updateTextListeners(WidgetCommand cmd) {
- super.updateTextListeners(cmd);
- cmd.preservedText = null;
- cmd.event = null;
- cmd.text = null;
- }
-
- protected void internalRevealRange(int start, int end) {
- StyledText textWidget = getTextWidget();
- int startLine = documentAdapter.getLineAtOffset(start);
- int endLine = documentAdapter.getLineAtOffset(end);
-
- int top = textWidget.getTopIndex();
- if (top > -1) {
- // scroll vertically
- int lines = getVisibleLinesInViewport();
- int bottom = top + lines;
-
- // two lines at the top and the bottom should always be left
- // if window is smaller than 5 lines, always center position is
- // chosen
- int bufferZone = 2;
- if (startLine >= top + bufferZone && startLine <= bottom - bufferZone && endLine >= top + bufferZone && endLine <= bottom - bufferZone) {
-
- // do not scroll at all as it is already visible
- } else {
- int delta = Math.max(0, lines - (endLine - startLine));
- textWidget.setTopIndex(startLine - delta / 3);
- updateViewportListeners(INTERNAL);
- }
-
- // scroll horizontally
- if (endLine < startLine) {
- endLine += startLine;
- startLine = endLine - startLine;
- endLine -= startLine;
- }
-
- int startPixel = -1;
- int endPixel = -1;
-
- if (endLine > startLine) {
- // reveal the beginning of the range in the start line
- IRegion extent = getExtent(start, start);
- startPixel = extent.getOffset() + textWidget.getHorizontalPixel();
- endPixel = startPixel;
- } else {
- IRegion extent = getExtent(start, end);
- startPixel = extent.getOffset() + textWidget.getHorizontalPixel();
- endPixel = startPixel + extent.getLength();
- }
-
- int visibleStart = textWidget.getHorizontalPixel();
- int visibleEnd = visibleStart + textWidget.getClientArea().width;
-
- // scroll only if not yet visible
- if (startPixel < visibleStart || visibleEnd < endPixel) {
- // set buffer zone to 10 pixels
- bufferZone = 10;
- int newOffset = visibleStart;
- int visibleWidth = visibleEnd - visibleStart;
- int selectionPixelWidth = endPixel - startPixel;
-
- if (startPixel < visibleStart)
- newOffset = startPixel;
- else if (selectionPixelWidth + bufferZone < visibleWidth)
- newOffset = endPixel + bufferZone - visibleWidth;
- else
- newOffset = startPixel;
-
- float index = ((float) newOffset) / ((float) getAverageCharWidth());
-
- textWidget.setHorizontalIndex(Math.round(index));
- }
-
- }
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
deleted file mode 100644
index a1de229b5..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-import org.eclipse.ui.internal.console.ConsolePluginImages;
-import org.eclipse.ui.internal.console.IConsoleHelpContextIds;
-import org.eclipse.ui.internal.console.IInternalConsoleConstants;
-
-/**
- * Clears the output in a text console.
- * <p>
- * Clients may instantiate this class.
- * </p>
- * @since 3.0
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class ClearOutputAction extends Action {
-
- private ITextViewer fViewer;
- private TextConsole fIOConsole;
-
- /**
- * Constructs a clear output action.
- *
- * @since 3.1
- */
- private ClearOutputAction() {
- super(ConsoleMessages.ClearOutputAction_title);
- setToolTipText(ConsoleMessages.ClearOutputAction_toolTipText);
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IConsoleConstants.IMG_LCL_CLEAR));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_CLEAR));
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_CLEAR));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CLEAR_CONSOLE_ACTION);
- }
-
- /**
- * Constructs a clear output action for an I/O console. Clearing an I/O console
- * is performed via API on the <code>IOConsole</code>, rather than clearing
- * its document directly.
- *
- * @param ioConsole I/O console the action is associated with
- * @since 3.1
- */
- public ClearOutputAction(TextConsole ioConsole) {
- this();
- fIOConsole = ioConsole;
- }
-
- /**
- * Constructs an action to clear the document associated with a text viewer.
- *
- * @param viewer viewer whose document this action is associated with
- */
- public ClearOutputAction(ITextViewer viewer) {
- this();
- fViewer = viewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- BusyIndicator.showWhile(ConsolePlugin.getStandardDisplay(), new Runnable() {
- public void run() {
- if (fIOConsole == null) {
- IDocument document = fViewer.getDocument();
- if (document != null) {
- document.set(""); //$NON-NLS-1$
- }
- fViewer.setSelectedRange(0, 0);
- } else {
- fIOConsole.clearConsole();
- }
- }
- });
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java
deleted file mode 100644
index 8691ac226..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/CloseConsoleAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-import org.eclipse.ui.internal.console.ConsolePluginImages;
-import org.eclipse.ui.internal.console.IInternalConsoleConstants;
-
-/**
- * Removes a console from the console manager.
- * <p>
- * Clients may instantiate this class.
- * </p>
- * @since 3.1
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class CloseConsoleAction extends Action {
-
- private IConsole fConsole;
-
- public CloseConsoleAction(IConsole console) {
- super(ConsoleMessages.CloseConsoleAction_0, ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_CLOSE));
- setToolTipText(ConsoleMessages.CloseConsoleAction_1);
- fConsole = console;
- }
-
- public void run() {
- ConsolePlugin.getDefault().getConsoleManager().removeConsoles(new IConsole[]{fConsole});
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java
deleted file mode 100644
index b3809ea13..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Common function for actions that operate on a text viewer.
- * <p>
- * Clients may subclass this class.
- * </p>
- * @since 3.0
- */
-public class TextViewerAction extends Action implements IUpdate {
-
- private int fOperationCode= -1;
- private ITextOperationTarget fOperationTarget;
-
- /**
- * Constructs a new action in the given text viewer with
- * the specified operation code.
- *
- * @param viewer
- * @param operationCode
- */
- public TextViewerAction(ITextViewer viewer, int operationCode) {
- fOperationCode= operationCode;
- fOperationTarget= viewer.getTextOperationTarget();
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- *
- * Updates the enabled state of the action.
- * Fires a property change if the enabled state changes.
- *
- * @see org.eclipse.jface.action.Action#firePropertyChange(String, Object, Object)
- */
- public void update() {
-
- boolean wasEnabled= isEnabled();
- boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
- setEnabled(isEnabled);
-
- if (wasEnabled != isEnabled) {
- firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- if (fOperationCode != -1 && fOperationTarget != null) {
- fOperationTarget.doOperation(fOperationCode);
- }
- }
-
- /**
- * Configures this action with a label, tool tip, and description.
- *
- * @param text action label
- * @param toolTipText action tool tip
- * @param description action description
- */
- public void configureAction(String text, String toolTipText, String description) {
- setText(text);
- setToolTipText(toolTipText);
- setDescription(description);
- }
-}
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
deleted file mode 100644
index b029804f5..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/TextViewerGotoLineAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.console.actions;
-
-
-import com.ibm.icu.text.MessageFormat;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.internal.console.ConsoleMessages;
-
-/**
- * Action to position a text viewer to a specific line.
- * <p>
- * Clients may instantiate this class.
- * </p>
- * @since 3.0
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class TextViewerGotoLineAction extends TextViewerAction {
-
- /**
- * Validates whether the text found in the input field of the
- * dialog forms a valid line number, i.e. one to which can be
- * jumped.
- */
- class NumberValidator implements IInputValidator {
-
- public String isValid(String input) {
- try {
- int i= Integer.parseInt(input);
- if (i <= 0 || fLastLine < i)
- return ConsoleMessages.TextViewerGotoLineAction_Line_number_out_of_range_1;
-
- } catch (NumberFormatException x) {
- return ConsoleMessages.TextViewerGotoLineAction_Not_a_number_2;
- }
-
- return null;
- }
- }
-
- protected int fLastLine;
- protected ITextViewer fTextViewer;
-
- /**
- * Constructs a goto line action for the viewer using the provided resource bundle
- */
- public TextViewerGotoLineAction(ITextViewer viewer) {
- super(viewer, -1);
- fTextViewer= viewer;
- setText(ConsoleMessages.TextViewerGotoLineAction_Go_to__Line____Ctrl_L_4);
- setToolTipText(ConsoleMessages.TextViewerGotoLineAction_Go_To_Line_1);
- setDescription(ConsoleMessages.TextViewerGotoLineAction_Go_To_Line_1);
- }
-
- /**
- * @see TextViewerAction#update()
- */
- public void update() {
- }
-
- /**
- * Jumps to the line.
- */
- protected void gotoLine(int line) {
-
- IDocument document= fTextViewer.getDocument();
- try {
- int start= document.getLineOffset(line);
- int length= document.getLineLength(line);
- fTextViewer.getTextWidget().setSelection(start, start + length);
- fTextViewer.revealRange(start, length);
- } catch (BadLocationException x) {
- ConsolePlugin.errorDialog(fTextViewer.getTextWidget().getShell(), ConsoleMessages.TextViewerGotoLineAction_Go_To_Line_1, ConsoleMessages.TextViewerGotoLineAction_Exceptions_occurred_attempt_to_go_to_line_2, x); //
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- try {
- Point selection= fTextViewer.getTextWidget().getSelection();
- IDocument document= fTextViewer.getDocument();
- fLastLine= document.getLineOfOffset(document.getLength()) + 1;
- int startLine= selection == null ? 1 : fTextViewer.getTextWidget().getLineAtOffset(selection.x) + 1;
- String title= ConsoleMessages.TextViewerGotoLineAction_Go_To_Line_1;
- String message= MessageFormat.format(ConsoleMessages.TextViewerGotoLineAction_Enter_line_number__8, new Object[] {new Integer(fLastLine)});
- String value= Integer.toString(startLine);
- Shell activeShell= fTextViewer.getTextWidget().getShell();
- InputDialog d= new InputDialog(activeShell, title, message, value, new NumberValidator());
- if (d.open() == Window.OK) {
- try {
- int line= Integer.parseInt(d.getValue());
- gotoLine(line - 1);
- } catch (NumberFormatException x) {
- ConsolePlugin.errorDialog(activeShell, ConsoleMessages.TextViewerGotoLineAction_Go_To_Line_1, ConsoleMessages.TextViewerGotoLineAction_Exceptions_occurred_attempt_to_go_to_line_2, x); //
- }
- }
- } catch (BadLocationException x) {
- ConsolePlugin.errorDialog(fTextViewer.getTextWidget().getShell(), ConsoleMessages.TextViewerGotoLineAction_Go_To_Line_1, ConsoleMessages.TextViewerGotoLineAction_Exceptions_occurred_attempt_to_go_to_line_2, x); //
- return;
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html
deleted file mode 100644
index cfb538c69..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/package.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Console Actions</title>
-</head>
-
-<body link="#0000FF" vlink="#800080">
-
-<p align="left"> Application programming interfaces for Eclipse console specific
- actions.</p>
-
-<h2 align="left">Package Specification</h2>
-
-<p>This package provides a set of actions related to the Eclipse console.</p>
-<p>Clients are allowed to instantiate classes from this package. The classes are
- not intended to be subclassed.</p>
-</body>
-</html>
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/package.html b/org.eclipse.ui.console/src/org/eclipse/ui/console/package.html
deleted file mode 100644
index f6debb148..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/package.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Eclipse Console</title>
-</head>
-
-<body bgcolor="#FFFFFF">
-
-<p>Application programming interfaces for interaction
-with the Eclipse console.</p>
-
-<h2>Package Specification</h2>
-
-<p>The Eclipse platform UI console plug-in provides a set of classes and interfaces to
-facilitate the creation and display of consoles in the <b>ConsoleView</b>. This package
-contains a generic abstract console (<b>AbstractConsole</b>) that provides some basic
-functionality as well as two complete implementations of consoles that may be subclassed.
- <p> The class <b>TextConsole</b> supports regular expression matching and hyperlinks.
- Clients must provide their own document partitioner.
- </p>
-<p><b>IOConsole</b> extends <b>TextConsole</b> and provides support for creating consoles based upon
-input and output streams via the use of <b>IOConsoleOutputStream</b> and
-<b>IOConsoleInputStream</b>. IOConsole is not an abstract class, it may be used as is or
-subclassed.
- </p>
-<p>A console manager (<b>IConsoleManager</b>) manages all active consoles, and
- provides notification of consoles which are added and removed. Consoles are
- displayed in a page book view. Each console implementation is reponsible for
- creating its page (<b>IPageBookView</b>), which provides freedom of presentation
- to the console implementation. A single console may be displayed simultaneously
- in multiple console views, in different workbench windows.
-</p>
-</body>
-</html>
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
deleted file mode 100644
index ddf2491c6..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocument.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-
-/**
- * A console document. Requires synchronization for multi-threaded access.
- */
-public class ConsoleDocument extends Document {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#get(int, int)
- */
- public synchronized String get(int pos, int length) throws BadLocationException {
- return super.get(pos, length);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLength()
- */
- public synchronized int getLength() {
- return super.getLength();
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineDelimiter(int)
- */
- public synchronized String getLineDelimiter(int line) throws BadLocationException {
- return super.getLineDelimiter(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineInformation(int)
- */
- public synchronized IRegion getLineInformation(int line) throws BadLocationException {
- return super.getLineInformation(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineInformationOfOffset(int)
- */
- public synchronized IRegion getLineInformationOfOffset(int offset) throws BadLocationException {
- return super.getLineInformationOfOffset(offset);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineLength(int)
- */
- public synchronized int getLineLength(int line) throws BadLocationException {
- return super.getLineLength(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineOffset(int)
- */
- public synchronized int getLineOffset(int line) throws BadLocationException {
- return super.getLineOffset(line);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getLineOfOffset(int)
- */
- public int getLineOfOffset(int pos) throws BadLocationException {
- return super.getLineOfOffset(pos);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getNumberOfLines()
- */
- public synchronized int getNumberOfLines() {
- return super.getNumberOfLines();
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#replace(int, int, java.lang.String)
- */
- public synchronized void replace(int pos, int length, String text) throws BadLocationException {
- super.replace(pos, length, text);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#set(java.lang.String)
- */
- public synchronized void set(String text) {
- super.set(text);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.AbstractDocument#completeInitialization()
- */
- protected void completeInitialization() {
- super.completeInitialization();
- addPositionUpdater(new HyperlinkUpdater());
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#addPosition(java.lang.String, org.eclipse.jface.text.Position)
- */
- public synchronized void addPosition(String category, Position position) throws BadLocationException, BadPositionCategoryException {
- super.addPosition(category, position);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#removePosition(java.lang.String, org.eclipse.jface.text.Position)
- */
- public synchronized void removePosition(String category, Position position) throws BadPositionCategoryException {
- super.removePosition(category, position);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocument#getPositions(java.lang.String)
- */
- public synchronized Position[] getPositions(String category) throws BadPositionCategoryException {
- return super.getPositions(category);
- }
-}
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
deleted file mode 100644
index 2b00475d4..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.swt.custom.TextChangeListener;
-import org.eclipse.swt.custom.TextChangedEvent;
-import org.eclipse.swt.custom.TextChangingEvent;
-
-import org.eclipse.core.runtime.Assert;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentAdapter;
-import org.eclipse.jface.text.IDocumentListener;
-
-/**
- * Adapts a Console's document to the viewer StyledText widget. Allows proper line
- * wrapping of fixed width consoles without having to add line delimiters to the StyledText.
- *
- * By using this adapter, the offset of any character is the same in both the widget and the
- * document.
- *
- * @since 3.1
- */
-public class ConsoleDocumentAdapter implements IDocumentAdapter, IDocumentListener {
-
- private int consoleWidth = -1;
- private List textChangeListeners;
- private IDocument document;
-
- int[] offsets = new int[5000];
- int[] lengths = new int[5000];
- private int regionCount = 1;
- private Pattern pattern = Pattern.compile("$", Pattern.MULTILINE); //$NON-NLS-1$
-
-
- public ConsoleDocumentAdapter(int width) {
- textChangeListeners = new ArrayList();
- consoleWidth = width;
- }
-
- /*
- * repairs lines list from the beginning of the line containing the offset of any
- * DocumentEvent, to the end of the Document.
- */
- private void repairLines(int eventOffset) {
- if (document == null) {
- return;
- }
- try {
- int docLine = document.getLineOfOffset(eventOffset);
- int docLineOffset = document.getLineOffset(docLine);
- int widgetLine = getLineAtOffset(docLineOffset);
-
- for (int i=regionCount-1; i>=widgetLine; i--) {
- regionCount--;
- }
-
- int numLinesInDoc = document.getNumberOfLines();
-
- int nextOffset = document.getLineOffset(docLine);
- for (int i = docLine; i<numLinesInDoc; i++) {
- int offset = nextOffset;
- int length = document.getLineLength(i);
- nextOffset += length;
-
- if (length == 0) {
- addRegion(offset, 0);
- } else {
- while (length > 0) {
- int trimmedLength = length;
- String lineDelimiter = document.getLineDelimiter(i);
- int lineDelimiterLength = 0;
- if (lineDelimiter != null) {
- lineDelimiterLength = lineDelimiter.length();
- trimmedLength -= lineDelimiterLength;
- }
-
- if (consoleWidth > 0 && consoleWidth < trimmedLength) {
- addRegion(offset, consoleWidth);
- offset += consoleWidth;
- length -= consoleWidth;
- } else {
- addRegion(offset, length);
- offset += length;
- length -= length;
- }
- }
- }
- }
- } catch (BadLocationException e) {
- }
-
- if (regionCount == 0) {
- addRegion(0, document.getLength());
- }
- }
-
- private void addRegion(int offset, int length) {
- if (regionCount == 0) {
- offsets[0] = offset;
- lengths[0] = length;
- } else {
- if (regionCount == offsets.length) {
- growRegionArray(regionCount * 2);
- }
- offsets[regionCount] = offset;
- lengths[regionCount] = length;
- }
- regionCount++;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentAdapter#setDocument(org.eclipse.jface.text.IDocument)
- */
- public void setDocument(IDocument doc) {
- if (document != null) {
- document.removeDocumentListener(this);
- }
-
- document = doc;
-
- if (document != null) {
- document.addDocumentListener(this);
- repairLines(0);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#addTextChangeListener(org.eclipse.swt.custom.TextChangeListener)
- */
- public synchronized void addTextChangeListener(TextChangeListener listener) {
- Assert.isNotNull(listener);
- if (!textChangeListeners.contains(listener)) {
- textChangeListeners.add(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#removeTextChangeListener(org.eclipse.swt.custom.TextChangeListener)
- */
- public synchronized void removeTextChangeListener(TextChangeListener listener) {
- if(textChangeListeners != null) {
- Assert.isNotNull(listener);
- textChangeListeners.remove(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getCharCount()
- */
- public int getCharCount() {
- return document.getLength();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLine(int)
- */
- public String getLine(int lineIndex) {
- try {
- StringBuffer line = new StringBuffer(document.get(offsets[lineIndex], lengths[lineIndex]));
- int index = line.length() - 1;
- while(index > -1 && (line.charAt(index)=='\n' || line.charAt(index)=='\r')) {
- index--;
- }
- return new String(line.substring(0, index+1));
- } catch (BadLocationException e) {
- }
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLineAtOffset(int)
- */
- public int getLineAtOffset(int offset) {
- if (offset == 0 || regionCount <= 1) {
- return 0;
- }
-
- if (offset == document.getLength()) {
- return regionCount-1;
- }
-
- int left= 0;
- int right= regionCount-1;
- int midIndex = 0;
-
- while (left <= right) {
- if(left == right) {
- return right;
- }
- midIndex = (left + right) / 2;
-
- if (offset < offsets[midIndex]) {
- right = midIndex;
- } else if (offset >= offsets[midIndex] + lengths[midIndex]) {
- left = midIndex + 1;
- } else {
- return midIndex;
- }
- }
-
- return midIndex;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLineCount()
- */
- public int getLineCount() {
- return regionCount;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getLineDelimiter()
- */
- public String getLineDelimiter() {
- return System.getProperty("line.separator"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getOffsetAtLine(int)
- */
- public int getOffsetAtLine(int lineIndex) {
- return offsets[lineIndex];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#getTextRange(int, int)
- */
- public String getTextRange(int start, int length) {
- try {
- return document.get(start, length);
- } catch (BadLocationException e) {
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#replaceTextRange(int, int, java.lang.String)
- */
- public void replaceTextRange(int start, int replaceLength, String text) {
- try {
- document.replace(start, replaceLength, text);
- } catch (BadLocationException e) {
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.custom.StyledTextContent#setText(java.lang.String)
- */
- public synchronized void setText(String text) {
- TextChangedEvent changeEvent = new TextChangedEvent(this);
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textSet(changeEvent);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public synchronized void documentAboutToBeChanged(DocumentEvent event) {
- if (document == null) {
- return;
- }
-
- TextChangingEvent changeEvent = new TextChangingEvent(this);
- changeEvent.start = event.fOffset;
- changeEvent.newText = (event.fText == null ? "" : event.fText); //$NON-NLS-1$
- changeEvent.replaceCharCount = event.fLength;
- changeEvent.newCharCount = (event.fText == null ? 0 : event.fText.length());
-
- int first = getLineAtOffset(event.fOffset);
- int lOffset = Math.max(event.fOffset + event.fLength - 1, 0);
- int last = getLineAtOffset(lOffset);
- changeEvent.replaceLineCount = Math.max(last - first, 0);
-
- int newLineCount = countNewLines(event.fText);
- changeEvent.newLineCount = newLineCount >= 0 ? newLineCount : 0;
-
- if (changeEvent.newLineCount > offsets.length-regionCount) {
- growRegionArray(changeEvent.newLineCount);
- }
-
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textChanging(changeEvent);
- }
- }
-
- private void growRegionArray(int minSize) {
- int size = Math.max(offsets.length*2, minSize*2);
- int[] newOffsets = new int[size];
- System.arraycopy(offsets, 0, newOffsets, 0, regionCount);
- offsets = newOffsets;
- int[] newLengths = new int[size];
- System.arraycopy(lengths, 0, newLengths, 0, regionCount);
- lengths = newLengths;
- }
-
- private int countNewLines(String string) {
- int count = 0;
-
- if (string.length() == 0) return 0;
-
- // work around to
- // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4994840
- // see bug 84641
- int offset = string.length() - 1;
- while (offset > -1 && string.charAt(offset) == '\r') {
- offset--;
- count++;
- }
- // if offset == -1, the line was all '\r' and there is no string to search for matches (bug 207743)
- if (offset > -1) {
- if (offset < (string.length() - 1)) {
- string = string.substring(0, offset);
- }
-
- int lastIndex = 0;
- int index = 0;
-
- Matcher matcher = pattern.matcher(string);
-
- while (matcher.find()) {
- index = matcher.start();
-
- if (index == 0)
- count++;
- else if (index!=string.length())
- count++;
-
- if (consoleWidth > 0) {
- int lineLen = index - lastIndex + 1;
- if (index == 0) lineLen += lengths[regionCount-1];
- count += lineLen/consoleWidth;
- }
-
- lastIndex = index;
- }
- }
- return count;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public synchronized void documentChanged(DocumentEvent event) {
- if (document == null) {
- return;
- }
-
- repairLines(event.fOffset);
-
- TextChangedEvent changeEvent = new TextChangedEvent(this);
-
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textChanged(changeEvent);
- }
- }
-
- /**
- * sets consoleWidth, repairs line information, then fires event to the viewer text widget.
- * @param width The console's width
- */
- public void setWidth(int width) {
- if (width != consoleWidth) {
- consoleWidth = width;
- repairLines(0);
- TextChangedEvent changeEvent = new TextChangedEvent(this);
- for (Iterator iter = textChangeListeners.iterator(); iter.hasNext();) {
- TextChangeListener element = (TextChangeListener) iter.next();
- element.textSet(changeEvent);
- }
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java
deleted file mode 100644
index ab3b388ee..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDropDownAction.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-
-import java.util.List;
-
-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.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-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.IConsoleListener;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Drop down action in the console to select the console to display.
- */
-class ConsoleDropDownAction extends Action implements IMenuCreator, IConsoleListener, IUpdate {
-
- private IConsoleView fView;
- private Menu fMenu;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
- setEnabled(consoles.length > 1);
- }
-
- public ConsoleDropDownAction(IConsoleView view) {
- fView= view;
- setText(ConsoleMessages.ConsoleDropDownAction_0);
- setToolTipText(ConsoleMessages.ConsoleDropDownAction_1);
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IConsoleConstants.IMG_VIEW_CONSOLE));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_DISPLAY_CONSOLE_ACTION);
- setMenuCreator(this);
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(this);
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fView= null;
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu= new Menu(parent);
- IConsole[] consoles= ConsolePlugin.getDefault().getConsoleManager().getConsoles();
- IConsole current = fView.getConsole();
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- Action action = new ShowConsoleAction(fView, console);
- action.setChecked(console.equals(current));
- addActionToMenu(fMenu, action, i + 1);
- }
- return fMenu;
- }
-
- private void addActionToMenu(Menu parent, Action action, int accelerator) {
- if (accelerator < 10) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- label.append(action.getText());
- action.setText(label.toString());
- }
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ConsoleView consoleView = (ConsoleView) fView;
- boolean pinned = consoleView.isPinned();
- if (pinned) {
- consoleView.setPinned(false);
- }
- List stack = consoleView.getConsoleStack();
- if (stack.size() > 1) {
- IConsole console = (IConsole) stack.get(1);
- fView.display(console);
- }
- if (pinned) {
- consoleView.setPinned(true);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesAdded(org.eclipse.ui.console.IConsole[])
- */
- public void consolesAdded(IConsole[] consoles) {
- UIJob job = new UIJob("") { //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- update();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- }
-
- /* (non-Javadoc)
- *
- * Dispose the menu when a launch is removed, such that the actions in this
- * menu do not hang on to associated resources.
- *
- * @see org.eclipse.ui.console.IConsoleListener#consolesRemoved(org.eclipse.ui.console.IConsole[])
- */
- public void consolesRemoved(IConsole[] consoles) {
- UIJob job = new UIJob("") { //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (fMenu != null) {
- fMenu.dispose();
- }
- update();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java
deleted file mode 100644
index 377d3d56d..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleFactoryExtension.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.net.URL;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.ExpressionTagNames;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleFactory;
-import org.osgi.framework.Bundle;
-
-/**
- * @since 3.1
- */
-public class ConsoleFactoryExtension implements IPluginContribution {
-
- private IConfigurationElement fConfig;
- private Expression fEnablementExpression;
- private String fLabel;
- private ImageDescriptor fImageDescriptor;
- private IConsoleFactory fFactory;
-
- ConsoleFactoryExtension(IConfigurationElement config) {
- fConfig = config;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getLocalId()
- */
- public String getLocalId() {
- return fConfig.getAttribute("id"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getPluginId()
- */
- public String getPluginId() {
- return fConfig.getContributor().getName();
- }
-
- public boolean isEnabled() {
- try {
- Expression enablementExpression = getEnablementExpression();
- if (enablementExpression == null) {
- return true;
- }
- EvaluationContext context = new EvaluationContext(null, this);
- EvaluationResult evaluationResult = enablementExpression.evaluate(context);
- return evaluationResult != EvaluationResult.FALSE;
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- return false;
- }
- }
-
- public Expression getEnablementExpression() throws CoreException {
- if (fEnablementExpression == null) {
- IConfigurationElement[] elements = fConfig.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null) {
- fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
- }
- }
- return fEnablementExpression;
- }
-
- public String getLabel() {
- if (fLabel == null) {
- fLabel = fConfig.getAttribute("label"); //$NON-NLS-1$
- }
- return fLabel;
- }
-
- /**
- * @return
- */
- public ImageDescriptor getImageDescriptor() {
- if (fImageDescriptor == null) {
- String path = fConfig.getAttribute("icon"); //$NON-NLS-1$
- if (path != null) {
- Bundle bundle = Platform.getBundle(getPluginId());
- URL url = FileLocator.find(bundle, new Path(path), null);
- if (url != null) {
- fImageDescriptor = ImageDescriptor.createFromURL(url);
- }
- }
- }
- return fImageDescriptor;
- }
-
- /**
- * @return
- * @throws CoreException
- */
- public IConsoleFactory createFactory() throws CoreException {
- if (fFactory == null) {
- fFactory = (IConsoleFactory) fConfig.createExecutableExtension("class"); //$NON-NLS-1$
- }
- return fFactory;
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java
deleted file mode 100644
index b98df7300..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleHyperlinkPosition.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IHyperlink;
-
-/**
- * Describes the postition of a hyperlink within the Console's document.
- *
- * @since 3.1
- */
-public class ConsoleHyperlinkPosition extends Position {
-
- public static final String HYPER_LINK_CATEGORY = ConsolePlugin.getUniqueIdentifier() + ".CONSOLE_HYPERLINK_POSITION"; //$NON-NLS-1$
-
- private IHyperlink fLink = null;
-
- public ConsoleHyperlinkPosition(IHyperlink link, int offset, int length) {
- super(offset, length);
- fLink = link;
- }
-
- public IHyperlink getHyperLink() {
- return fLink;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object arg) {
- return arg instanceof ConsoleHyperlinkPosition && super.equals(arg) && getHyperLink().equals(((ConsoleHyperlinkPosition)arg).getHyperLink());
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return super.hashCode() + getHyperLink().hashCode();
- }
-
-}
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
deleted file mode 100644
index df883e24a..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.PatternSyntaxException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-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.IConsoleListener;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.IConsolePageParticipant;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * The singleton console manager.
- *
- * @since 3.0
- */
-public class ConsoleManager implements IConsoleManager {
-
- /**
- * Console listeners
- */
- private ListenerList fListeners = null;
-
- /**
- * List of registered consoles
- */
- private List fConsoles = new ArrayList(10);
-
-
- // change notification constants
- private final static int ADDED = 1;
- private final static int REMOVED = 2;
-
- private List fPatternMatchListeners;
-
- private List fPageParticipants;
-
- private List fConsoleFactoryExtensions;
-
- private List fConsoleViews = new ArrayList();
-
- private boolean fWarnQueued = false;
-
- private RepaintJob fRepaintJob = new RepaintJob();
-
- private class RepaintJob extends WorkbenchJob {
- private Set list = new HashSet();
-
- public RepaintJob() {
- super("schedule redraw() of viewers"); //$NON-NLS-1$
- setSystem(true);
- }
-
- void addConsole(IConsole console) {
- synchronized (list) {
- list.add(console);
- }
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- synchronized (list) {
- if (list.isEmpty()) {
- return Status.OK_STATUS;
- }
-
- IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IViewPart part = page.findView(IConsoleConstants.ID_CONSOLE_VIEW);
- if (part != null && part instanceof IConsoleView) {
- ConsoleView view = (ConsoleView) part;
- if (list.contains(view.getConsole())) {
- Control control = view.getCurrentPage().getControl();
- if (!control.isDisposed()) {
- control.redraw();
- }
- }
- }
-
- }
- }
- }
- list.clear();
- }
- return Status.OK_STATUS;
- }
- }
-
- /**
- * Notifies a console listener of additions or removals
- */
- class ConsoleNotifier implements ISafeRunnable {
-
- private IConsoleListener fListener;
- private int fType;
- private IConsole[] fChanged;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
- */
- public void handleException(Throwable exception) {
- IStatus status = new Status(IStatus.ERROR, ConsolePlugin.getUniqueIdentifier(), IConsoleConstants.INTERNAL_ERROR, ConsoleMessages.ConsoleManager_0, exception);
- ConsolePlugin.log(status);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.ISafeRunnable#run()
- */
- public void run() throws Exception {
- switch (fType) {
- case ADDED:
- fListener.consolesAdded(fChanged);
- break;
- case REMOVED:
- fListener.consolesRemoved(fChanged);
- break;
- }
- }
-
- /**
- * Notifies the given listener of the adds/removes
- *
- * @param consoles the consoles that changed
- * @param update the type of change
- */
- public void notify(IConsole[] consoles, int update) {
- if (fListeners == null) {
- return;
- }
- fChanged = consoles;
- fType = update;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IConsoleListener)copiedListeners[i];
- SafeRunner.run(this);
- }
- fChanged = null;
- fListener = null;
- }
- }
-
- public void registerConsoleView(ConsoleView view) {
- synchronized (fConsoleViews) {
- fConsoleViews.add(view);
- }
- }
- public void unregisterConsoleView(ConsoleView view) {
- synchronized (fConsoleViews) {
- fConsoleViews.remove(view);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#addConsoleListener(org.eclipse.ui.console.IConsoleListener)
- */
- public void addConsoleListener(IConsoleListener listener) {
- if (fListeners == null) {
- fListeners = new ListenerList();
- }
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#removeConsoleListener(org.eclipse.ui.console.IConsoleListener)
- */
- public void removeConsoleListener(IConsoleListener listener) {
- if (fListeners != null) {
- fListeners.remove(listener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#addConsoles(org.eclipse.ui.console.IConsole[])
- */
- public synchronized void addConsoles(IConsole[] consoles) {
- List added = new ArrayList(consoles.length);
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if(console instanceof TextConsole) {
- TextConsole ioconsole = (TextConsole)console;
- createPatternMatchListeners(ioconsole);
- }
- if (!fConsoles.contains(console)) {
- fConsoles.add(console);
- added.add(console);
- }
- }
- if (!added.isEmpty()) {
- fireUpdate((IConsole[])added.toArray(new IConsole[added.size()]), ADDED);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#removeConsoles(org.eclipse.ui.console.IConsole[])
- */
- public synchronized void removeConsoles(IConsole[] consoles) {
- List removed = new ArrayList(consoles.length);
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (fConsoles.remove(console)) {
- removed.add(console);
- }
- }
- if (!removed.isEmpty()) {
- fireUpdate((IConsole[])removed.toArray(new IConsole[removed.size()]), REMOVED);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getConsoles()
- */
- public synchronized IConsole[] getConsoles() {
- return (IConsole[])fConsoles.toArray(new IConsole[fConsoles.size()]);
- }
-
- /**
- * Fires notification.
- *
- * @param consoles consoles added/removed
- * @param type ADD or REMOVE
- */
- private void fireUpdate(IConsole[] consoles, int type) {
- new ConsoleNotifier().notify(consoles, type);
- }
-
-
- private class ShowConsoleViewJob extends WorkbenchJob {
- private IConsole console;
-
- ShowConsoleViewJob() {
- super("Show Console View"); //$NON-NLS-1$
- setSystem(true);
- setPriority(Job.SHORT);
- }
-
- void setConsole(IConsole console) {
- this.console = console;
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- boolean consoleFound = false;
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null && console != null) {
- IWorkbenchPage page= window.getActivePage();
- if (page != null) {
- synchronized (fConsoleViews) {
- for (Iterator iter = fConsoleViews.iterator(); iter.hasNext();) {
- ConsoleView consoleView = (ConsoleView) iter.next();
- if (consoleView.getSite().getPage().equals(page)) {
- boolean consoleVisible = page.isPartVisible(consoleView);
- if (consoleVisible) {
- consoleFound = true;
- boolean bringToTop = shouldBringToTop(console, consoleView);
- if (bringToTop) {
- page.bringToTop(consoleView);
- }
- consoleView.display(console);
- }
- }
- }
- }
-
- if (!consoleFound) {
- try {
- IConsoleView consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null, IWorkbenchPage.VIEW_CREATE);
- boolean bringToTop = shouldBringToTop(console, consoleView);
- if (bringToTop) {
- page.bringToTop(consoleView);
- }
- consoleView.display(console);
- } catch (PartInitException pie) {
- ConsolePlugin.log(pie);
- }
- }
- }
- }
- console = null;
- return Status.OK_STATUS;
- }
- }
-
- private ShowConsoleViewJob showJob = new ShowConsoleViewJob();
- /**
- * @see IConsoleManager#showConsoleView(IConsole)
- */
- public void showConsoleView(final IConsole console) {
- showJob.setConsole(console);
- showJob.schedule(100);
- }
-
- /**
- * 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.
- */
- private boolean shouldBringToTop(IConsole console, IViewPart consoleView) {
- boolean bringToTop= true;
- if (consoleView instanceof IConsoleView) {
- IConsoleView cView= (IConsoleView)consoleView;
- if (cView.isPinned()) {
- IConsole pinnedConsole= cView.getConsole();
- bringToTop = console.equals(pinnedConsole);
- }
- }
- return bringToTop;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#warnOfContentChange(org.eclipse.ui.console.IConsole)
- */
- public void warnOfContentChange(final IConsole console) {
- if (!fWarnQueued) {
- fWarnQueued = true;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable(){
- public void run() {
- IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page= window.getActivePage();
- if (page != null) {
- IConsoleView consoleView= (IConsoleView)page.findView(IConsoleConstants.ID_CONSOLE_VIEW);
- if (consoleView != null) {
- consoleView.warnOfContentChange(console);
- }
- }
- }
- fWarnQueued = false;
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getPatternMatchListenerDelegates(org.eclipse.ui.console.IConsole)
- */
- public IPatternMatchListener[] createPatternMatchListeners(IConsole console) {
- if (fPatternMatchListeners == null) {
- 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];
- PatternMatchListenerExtension extension = new PatternMatchListenerExtension(config);
- fPatternMatchListeners.add(extension);
- }
- }
- ArrayList list = new ArrayList();
- for(Iterator i = fPatternMatchListeners.iterator(); i.hasNext(); ) {
- PatternMatchListenerExtension extension = (PatternMatchListenerExtension) i.next();
- try {
- if (extension.getEnablementExpression() == null) {
- i.remove();
- continue;
- }
-
- if (console instanceof TextConsole && extension.isEnabledFor(console)) {
- TextConsole textConsole = (TextConsole) console;
- PatternMatchListener patternMatchListener = new PatternMatchListener(extension);
- try {
- textConsole.addPatternMatchListener(patternMatchListener);
- list.add(patternMatchListener);
- } catch (PatternSyntaxException e) {
- ConsolePlugin.log(e);
- i.remove();
- }
- }
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return (PatternMatchListener[])list.toArray(new PatternMatchListener[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getPageParticipants(org.eclipse.ui.console.IConsole)
- */
- public IConsolePageParticipant[] getPageParticipants(IConsole console) {
- if(fPageParticipants == null) {
- 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];
- ConsolePageParticipantExtension extension = new ConsolePageParticipantExtension(config);
- fPageParticipants.add(extension);
- }
- }
- ArrayList list = new ArrayList();
- for(Iterator i = fPageParticipants.iterator(); i.hasNext(); ) {
- ConsolePageParticipantExtension extension = (ConsolePageParticipantExtension) i.next();
- try {
- if (extension.isEnabledFor(console)) {
- list.add(extension.createDelegate());
- }
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return (IConsolePageParticipant[]) list.toArray(new IConsolePageParticipant[0]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleManager#getConsoleFactories()
- */
- public ConsoleFactoryExtension[] getConsoleFactoryExtensions() {
- if (fConsoleFactoryExtensions == null) {
- 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]));
- }
- }
- return (ConsoleFactoryExtension[]) fConsoleFactoryExtensions.toArray(new ConsoleFactoryExtension[0]);
- }
-
-
- public void refresh(final IConsole console) {
- fRepaintJob.addConsole(console);
- fRepaintJob.schedule(50);
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
deleted file mode 100644
index eaf17b16b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ConsoleMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.ui.internal.console.ConsoleMessages";//$NON-NLS-1$
-
- public static String AbstractConsole_0;
-
- public static String ConsoleDropDownAction_0;
- public static String ConsoleDropDownAction_1;
-
- public static String ConsoleManager_0;
-
- public static String ConsoleView_0;
-
- public static String PinConsoleAction_0;
- public static String PinConsoleAction_1;
-
- public static String ClearOutputAction_title;
- public static String ClearOutputAction_toolTipText;
-
- public static String TextViewerGotoLineAction_Enter_line_number__8;
- public static String TextViewerGotoLineAction_Exceptions_occurred_attempt_to_go_to_line_2;
- public static String TextViewerGotoLineAction_Go_to__Line____Ctrl_L_4;
- public static String TextViewerGotoLineAction_Go_To_Line_1;
- public static String TextViewerGotoLineAction_Line_number_out_of_range_1;
- public static String TextViewerGotoLineAction_Not_a_number_2;
-
- public static String ScrollLockAction_0;
- public static String ScrollLockAction_1;
- public static String FollowHyperlinkAction_0;
- public static String FollowHyperlinkAction_1;
- public static String OpenConsoleAction_0;
- public static String OpenConsoleAction_1;
- public static String CloseConsoleAction_0;
- public static String CloseConsoleAction_1;
-
- public static String TextConsolePage_SelectAllDescrip;
- public static String TextConsolePage_SelectAllText;
- public static String TextConsolePage_CutText;
- public static String TextConsolePage_CutDescrip;
- public static String TextConsolePage_CopyText;
- public static String TextConsolePage_CopyDescrip;
- public static String TextConsolePage_PasteText;
- public static String TextConsolePage_PasteDescrip;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
- }
-
- public static String PatternMatchListenerExtension_3;
-
- public static String PatternMatchListenerExtension_4;
-
- public static String PatternMatchListenerExtension_5;
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
deleted file mode 100644
index 3d835a439..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleMessages.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-AbstractConsole_0=Exception occurred during console property change notification.
-
-ConsoleDropDownAction_0=Select Console
-ConsoleDropDownAction_1=Display Selected Console
-
-ConsoleManager_0=An exception occurred during console notification
-
-ConsoleView_0=No consoles to display at this time.
-
-PinConsoleAction_0=Pi&n Console
-PinConsoleAction_1=Pin Console
-
-ClearOutputAction_title=Clea&r
-ClearOutputAction_toolTipText=Clear Console
-
-TextViewerGotoLineAction_Enter_line_number__8=Enter line number (1...{0}):
-TextViewerGotoLineAction_Exceptions_occurred_attempt_to_go_to_line_2=Exceptions occurred attempt to go to line
-TextViewerGotoLineAction_Go_to__Line____Ctrl_L_4=Go to &Line...@Ctrl+L
-TextViewerGotoLineAction_Go_To_Line_1=Go to Line
-TextViewerGotoLineAction_Line_number_out_of_range_1=Line number out of range
-TextViewerGotoLineAction_Not_a_number_2=Not a number
-
-ScrollLockAction_0=&Scroll Lock
-ScrollLockAction_1=Scroll Lock
-FollowHyperlinkAction_0=&Open Link
-FollowHyperlinkAction_1=Follow the selected hyperlink
-OpenConsoleAction_0=Open Console
-OpenConsoleAction_1=Open Console
-CloseConsoleAction_0=&Close Console
-CloseConsoleAction_1=Close Console
-
-TextConsolePage_SelectAllDescrip=Select All
-TextConsolePage_SelectAllText=Select &All
-TextConsolePage_CutText=C&ut
-TextConsolePage_CutDescrip=Cut
-TextConsolePage_CopyText=&Copy
-TextConsolePage_CopyDescrip=Copy
-TextConsolePage_PasteText=&Paste
-TextConsolePage_PasteDescrip=Paste
-PatternMatchListenerExtension_3=Console Pattern Match Listener
-PatternMatchListenerExtension_4=contributed by
-PatternMatchListenerExtension_5=is missing required enablement expression and will be removed
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java
deleted file mode 100644
index 37a522f51..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePageParticipantExtension.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.ExpressionTagNames;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsolePageParticipant;
-
-public class ConsolePageParticipantExtension implements IPluginContribution {
-
- private IConfigurationElement fConfig;
- private Expression fEnablementExpression;
-
- public ConsolePageParticipantExtension(IConfigurationElement config) {
- fConfig = config;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getLocalId()
- */
- public String getLocalId() {
- return fConfig.getAttribute("id"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getPluginId()
- */
- public String getPluginId() {
- return fConfig.getContributor().getName();
- }
-
- public boolean isEnabledFor(IConsole console) throws CoreException {
- EvaluationContext context = new EvaluationContext(null, console);
- Expression expression = getEnablementExpression();
- if (expression != null){
- EvaluationResult evaluationResult = expression.evaluate(context);
- return evaluationResult == EvaluationResult.TRUE;
- }
- return true;
- }
-
- public Expression getEnablementExpression() throws CoreException {
- if (fEnablementExpression == null) {
- IConfigurationElement[] elements = fConfig.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null) {
- fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
- }
- }
- return fEnablementExpression;
- }
-
- public IConsolePageParticipant createDelegate() throws CoreException {
- return (IConsolePageParticipant) fConfig.createExecutableExtension("class"); //$NON-NLS-1$;
- }
-
-}
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
deleted file mode 100644
index e1d9abe3d..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePatternMatcher.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-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.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.PatternMatchEvent;
-import org.eclipse.ui.console.TextConsole;
-
-public class ConsolePatternMatcher implements IDocumentListener {
-
- private MatchJob fMatchJob = new MatchJob();
-
- /**
- * Collection of compiled pattern match listeners
- */
- private ArrayList fPatterns = new ArrayList();
-
- private TextConsole fConsole;
-
- private boolean fFinalMatch;
-
- private boolean fScheduleFinal;
-
- public ConsolePatternMatcher(TextConsole console) {
- fConsole = console;
- }
-
- private class MatchJob extends Job {
- MatchJob() {
- super("Match Job"); //$NON-NLS-1$
- setSystem(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- IDocument doc = fConsole.getDocument();
- String text = null;
- int prevBaseOffset = -1;
- if (doc != null && !monitor.isCanceled()) {
- int endOfSearch = doc.getLength();
- int indexOfLastChar = endOfSearch;
- if (indexOfLastChar > 0) {
- indexOfLastChar--;
- }
- int lastLineToSearch = 0;
- int offsetOfLastLineToSearch = 0;
- try {
- lastLineToSearch = doc.getLineOfOffset(indexOfLastChar);
- offsetOfLastLineToSearch = doc.getLineOffset(lastLineToSearch);
- } catch (BadLocationException e) {
- // perhaps the buffer was re-set
- return Status.OK_STATUS;
- }
- Object[] patterns = null;
- synchronized (fPatterns) {
- patterns = fPatterns.toArray();
- }
- for (int i = 0; i < patterns.length; i++) {
- if (monitor.isCanceled()) {
- break;
- }
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) patterns[i];
- int baseOffset = notifier.end;
- int lengthToSearch = endOfSearch - baseOffset;
- if (lengthToSearch > 0) {
- try {
- if (prevBaseOffset != baseOffset) {
- // reuse the text string if possible
- text = doc.get(baseOffset, lengthToSearch);
- }
- Matcher reg = notifier.pattern.matcher(text);
- Matcher quick = null;
- if (notifier.qualifier != null) {
- quick = notifier.qualifier.matcher(text);
- }
- int startOfNextSearch = 0;
- int endOfLastMatch = -1;
- int lineOfLastMatch = -1;
- while ((startOfNextSearch < lengthToSearch) && !monitor.isCanceled()) {
- if (quick != null) {
- if (quick.find(startOfNextSearch)) {
- // start searching on the beginning
- // of the line where the potential
- // match was found, or after the
- // last match on the same line
- int matchLine = doc.getLineOfOffset(baseOffset + quick.start());
- if (lineOfLastMatch == matchLine) {
- startOfNextSearch = endOfLastMatch;
- } else {
- startOfNextSearch = doc.getLineOffset(matchLine) - baseOffset;
- }
- } else {
- startOfNextSearch = lengthToSearch;
- }
- }
- if (startOfNextSearch < 0) {
- startOfNextSearch = 0;
- }
- if (startOfNextSearch < lengthToSearch) {
- if (reg.find(startOfNextSearch)) {
- endOfLastMatch = reg.end();
- lineOfLastMatch = doc.getLineOfOffset(baseOffset + endOfLastMatch - 1);
- int regStart = reg.start();
- IPatternMatchListener listener = notifier.listener;
- if (listener != null && !monitor.isCanceled()) {
- listener.matchFound(new PatternMatchEvent(fConsole, baseOffset + regStart, endOfLastMatch - regStart));
- }
- startOfNextSearch = endOfLastMatch;
- } else {
- startOfNextSearch = lengthToSearch;
- }
- }
- }
- // update start of next search to the last line
- // searched
- // or the end of the last match if it was on the
- // line that
- // was last searched
- if (lastLineToSearch == lineOfLastMatch) {
- notifier.end = baseOffset + endOfLastMatch;
- } else {
- notifier.end = offsetOfLastLineToSearch;
- }
- } catch (BadLocationException e) {
- ConsolePlugin.log(e);
- }
- }
- prevBaseOffset = baseOffset;
- }
- }
-
- if (fFinalMatch) {
- disconnect();
- fConsole.matcherFinished();
- } else if (fScheduleFinal) {
- fFinalMatch = true;
- schedule();
- }
-
- return Status.OK_STATUS;
- }
-
- public boolean belongsTo(Object family) {
- return family == fConsole;
- }
-
-
- }
-
- private class CompiledPatternMatchListener {
- Pattern pattern;
-
- Pattern qualifier;
-
- IPatternMatchListener listener;
-
- int end = 0;
-
- CompiledPatternMatchListener(Pattern pattern, Pattern qualifier, IPatternMatchListener matchListener) {
- this.pattern = pattern;
- this.listener = matchListener;
- this.qualifier = qualifier;
- }
-
- public void dispose() {
- listener.disconnect();
- pattern = null;
- qualifier = null;
- listener = null;
- }
- }
-
- /**
- * Adds the given pattern match listener to this console. The listener will
- * be connected and receive match notifications.
- *
- * @param matchListener
- * the pattern match listener to add
- */
- public void addPatternMatchListener(IPatternMatchListener matchListener) {
- synchronized (fPatterns) {
-
- // check for dups
- for (Iterator iter = fPatterns.iterator(); iter.hasNext();) {
- CompiledPatternMatchListener element = (CompiledPatternMatchListener) iter.next();
- if (element.listener == matchListener) {
- return;
- }
- }
-
- if (matchListener == null || matchListener.getPattern() == null) {
- throw new IllegalArgumentException("Pattern cannot be null"); //$NON-NLS-1$
- }
-
- Pattern pattern = Pattern.compile(matchListener.getPattern(), matchListener.getCompilerFlags());
- String qualifier = matchListener.getLineQualifier();
- Pattern qPattern = null;
- if (qualifier != null) {
- qPattern = Pattern.compile(qualifier, matchListener.getCompilerFlags());
- }
- CompiledPatternMatchListener notifier = new CompiledPatternMatchListener(pattern, qPattern, matchListener);
- fPatterns.add(notifier);
- matchListener.connect(fConsole);
- fMatchJob.schedule();
- }
- }
-
- /**
- * Removes the given pattern match listener from this console. The listener
- * will be disconnected and will no longer receive match notifications.
- *
- * @param matchListener
- * the pattern match listener to remove.
- */
- public void removePatternMatchListener(IPatternMatchListener matchListener) {
- synchronized (fPatterns) {
- for (Iterator iter = fPatterns.iterator(); iter.hasNext();) {
- CompiledPatternMatchListener element = (CompiledPatternMatchListener) iter.next();
- if (element.listener == matchListener) {
- iter.remove();
- matchListener.disconnect();
- }
- }
- }
- }
-
- public void disconnect() {
- fMatchJob.cancel();
- synchronized (fPatterns) {
- Iterator iterator = fPatterns.iterator();
- while (iterator.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iterator.next();
- notifier.dispose();
- }
- fPatterns.clear();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- if (event.fLength > 0) {
- synchronized (fPatterns) {
- if (event.fDocument.getLength() == 0) {
- // document has been cleared, reset match listeners
- Iterator iter = fPatterns.iterator();
- while (iter.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iter.next();
- notifier.end = 0;
- }
- } else {
- if (event.fOffset == 0) {
- //document was trimmed
- Iterator iter = fPatterns.iterator();
- while (iter.hasNext()) {
- CompiledPatternMatchListener notifier = (CompiledPatternMatchListener) iter.next();
- notifier.end = notifier.end > event.fLength ? notifier.end-event.fLength : 0;
- }
- }
- }
- }
- }
- fMatchJob.schedule();
- }
-
-
- public void forceFinalMatching() {
- fScheduleFinal = true;
- fMatchJob.schedule();
- }
-
-}
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
deleted file mode 100644
index c5abc8c6f..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsolePluginImages.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleConstants;
-
-/**
- * The images provided by the debug plugin.
- */
-public class ConsolePluginImages {
-
- /**
- * The image registry containing <code>Image</code>s and the <code>ImageDescriptor</code>s.
- */
- private static ImageRegistry imageRegistry;
-
- /* Declare Common paths */
- private static URL ICON_BASE_URL= null;
-
- static {
- String pathSuffix = "icons/full/"; //$NON-NLS-1$
- ICON_BASE_URL= ConsolePlugin.getDefault().getBundle().getEntry(pathSuffix);
- }
-
- // Use IPath and toOSString to build the names to ensure they have the slashes correct
- private final static String LOCALTOOL= "clcl16/"; //basic colors - size 16x16 //$NON-NLS-1$
- private final static String DLCL= "dlcl16/"; //disabled - size 16x16 //$NON-NLS-1$
- private final static String ELCL= "elcl16/"; //enabled - size 16x16 //$NON-NLS-1$
- private final static String VIEW= "cview16/"; // views //$NON-NLS-1$
-
- /**
- * Declare all images
- */
- private static void declareImages() {
- // Actions
-
- //local toolbars
- declareRegistryImage(IConsoleConstants.IMG_LCL_CLEAR, LOCALTOOL + "clear_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_LCL_PIN, LOCALTOOL + "pin.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_LCL_LOCK, LOCALTOOL + "lock_co.gif"); //$NON-NLS-1$
-
- // disabled local toolbars
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_CLEAR, DLCL + "clear_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_PIN, DLCL + "pin.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_LOCK, DLCL + "lock_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_DLCL_CLOSE, DLCL + "rem_co.gif"); //$NON-NLS-1$
-
- // enabled local toolbars
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_CLEAR, ELCL + "clear_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_PIN, ELCL + "pin.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_LOCK, ELCL + "lock_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_CLOSE, ELCL + "rem_co.gif"); //$NON-NLS-1$
- declareRegistryImage(IInternalConsoleConstants.IMG_ELCL_NEW_CON, ELCL + "new_con.gif"); //$NON-NLS-1$
-
- // Views
- declareRegistryImage(IConsoleConstants.IMG_VIEW_CONSOLE, VIEW + "console_view.gif"); //$NON-NLS-1$
- }
-
- /**
- * Declare an Image in the registry table.
- * @param key The key to use when registering the image
- * @param path The path where the image can be found. This path is relative to where
- * this plugin class is found (i.e. typically the packages directory)
- */
- private final static void declareRegistryImage(String key, String path) {
- ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
- try {
- desc= ImageDescriptor.createFromURL(makeIconFileURL(path));
- } catch (MalformedURLException me) {
- ConsolePlugin.log(me);
- }
- imageRegistry.put(key, desc);
- }
-
- /**
- * Returns the ImageRegistry.
- */
- public static ImageRegistry getImageRegistry() {
- if (imageRegistry == null) {
- initializeImageRegistry();
- }
- return imageRegistry;
- }
-
- /**
- * 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.
- *
- * Prefix conventions
- * Wizard Banners WIZBAN_
- * Preference Banners PREF_BAN_
- * Property Page Banners PROPBAN_
- * Color toolbar CTOOL_
- * Enable toolbar ETOOL_
- * Disable toolbar DTOOL_
- * Local enabled toolbar ELCL_
- * Local Disable toolbar DLCL_
- * Object large OBJL_
- * Object small OBJS_
- * View VIEW_
- * Product images PROD_
- * Misc images MISC_
- *
- * Where are the images?
- * The images (typically gifs) are found in the same location as this plugin class.
- * 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
- */
- public static ImageRegistry initializeImageRegistry() {
- 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.
- */
- 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.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- return getImageRegistry().getDescriptor(key);
- }
-
- private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
- if (ICON_BASE_URL == null) {
- throw new MalformedURLException();
- }
-
- return new URL(ICON_BASE_URL, iconPath);
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java
deleted file mode 100644
index 33b7d8568..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ConsoleResourceBundleMessages {
- private static final String BUNDLE_NAME = "org.eclipse.ui.internal.console.ConsoleResourceBundleMessages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private ConsoleResourceBundleMessages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-
- public static ResourceBundle getBundle() {
- return RESOURCE_BUNDLE;
- }
-}
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
deleted file mode 100644
index 9aeb0ef43..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleResourceBundleMessages.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-
-# These strings are used by the Find Replace Action and loaded as a Resource Bundle.
-# See TextConsolePage.createActions()
-
-find_replace_action_label=&Find/Replace...
-find_replace_action_tooltip=Find/Replace
-find_replace_action_image=
-find_replace_action_description=Find/Replace
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java
deleted file mode 100644
index 46dc213fe..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleTypePropertyTester.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.ui.console.IConsole;
-
-/**
- * Tests if an IOConsole's type matches the expected value
- *
- * @since 3.1
- */
-public class ConsoleTypePropertyTester extends PropertyTester {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- IConsole console = (IConsole) receiver;
- String type = console.getType();
- return type != null ? type.equals(expectedValue) : 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
deleted file mode 100644
index 3289a1b61..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ /dev/null
@@ -1,807 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
-
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.AbstractConsole;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IConsoleListener;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.IConsolePageParticipant;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.MessagePage;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.PageBookView;
-import org.eclipse.ui.part.PageSwitcher;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-
-/**
- * Page book console view.
- *
- * @since 3.0
- */
-public class ConsoleView extends PageBookView implements IConsoleView, IConsoleListener, IPropertyChangeListener, IPartListener2 {
-
- /**
- * Whether this console is pinned.
- */
- private boolean fPinned = false;
-
- /**
- * Stack of consoles in MRU order
- */
- private List fStack = new ArrayList();
-
- /**
- * The console being displayed, or <code>null</code> if none
- */
- private IConsole fActiveConsole = null;
-
- /**
- * Map of consoles to dummy console parts (used to close pages)
- */
- private Map fConsoleToPart;
-
- /**
- * Map of consoles to array of page participants
- */
- private Map fConsoleToPageParticipants;
-
- /**
- * Map of parts to consoles
- */
- private Map fPartToConsole;
-
- /**
- * Whether this view is active
- */
- private boolean fActive = false;
-
- /**
- * 'In Console View' context
- */
- private IContextActivation fActivatedContext;
-
- // actions
- private PinConsoleAction fPinAction = null;
- private ConsoleDropDownAction fDisplayConsoleAction = null;
-
- private OpenConsoleAction fOpenConsoleAction = null;
-
- private boolean fScrollLock;
-
- private boolean isAvailable() {
- return getPageBook() != null && !getPageBook().isDisposed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- Object source = event.getSource();
- if (source instanceof IConsole && event.getProperty().equals(IBasicPropertyConstants.P_TEXT)) {
- if (source.equals(getConsole())) {
- updateTitle();
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- fPinAction.update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.console.IConsoleView#getConsole()
- */
- public IConsole getConsole() {
- return fActiveConsole;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#showPageRec(org.eclipse.ui.part.PageBookView.PageRec)
- */
- protected void showPageRec(PageRec pageRec) {
- // don't show the page when pinned, unless this is the first console to be added
- // or its the default page
- if (fActiveConsole != null && pageRec.page != getDefaultPage() && fPinned && fConsoleToPart.size() > 1) {
- IConsole console = (IConsole)fPartToConsole.get(pageRec.part);
- if (!fStack.contains(console)) {
- fStack.add(console);
- }
- return;
- }
-
- IConsole recConsole = (IConsole)fPartToConsole.get(pageRec.part);
- if (recConsole!=null && recConsole.equals(fActiveConsole)) {
- return;
- }
-
- super.showPageRec(pageRec);
- fActiveConsole = recConsole;
- IConsole tos = null;
- if (!fStack.isEmpty()) {
- tos = (IConsole) fStack.get(0);
- }
- if (tos != null && !tos.equals(fActiveConsole)) {
- deactivateParticipants(tos);
- }
- if (fActiveConsole != null && !fActiveConsole.equals(tos)) {
- fStack.remove(fActiveConsole);
- fStack.add(0,fActiveConsole);
- activateParticipants(fActiveConsole);
- }
- updateTitle();
- updateHelp();
- // update console actions
- if (fPinAction != null) {
- fPinAction.update();
- }
- IPage page = getCurrentPage();
- if (page instanceof IOConsolePage) {
- ((IOConsolePage)page).setAutoScroll(!fScrollLock);
- }
- }
-
- /**
- * Activates the participants for the given console, if any.
- *
- * @param console
- */
- private void activateParticipants(IConsole console) {
- // activate
- if (console != null && fActive) {
- final ListenerList listeners = getParticipants(console);
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.activated();
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- listeners.remove(participant);
- }
- });
- }
- }
- }
- }
-
- /**
- * Returns a stack of consoles in the view in MRU order.
- *
- * @return a stack of consoles in the view in MRU order
- */
- protected List getConsoleStack() {
- return fStack;
- }
-
- /**
- * Updates the view title based on the active console
- */
- protected void updateTitle() {
- IConsole console = getConsole();
- if (console == null) {
- setContentDescription(ConsoleMessages.ConsoleView_0);
- } else {
- String newName = console.getName();
- String oldName = getContentDescription();
- if (newName!=null && !(newName.equals(oldName))) {
- setContentDescription(console.getName());
- }
- }
- }
-
- protected void updateHelp() {
- IConsole console = getConsole();
- String helpContextId = null;
- if (console instanceof AbstractConsole) {
- AbstractConsole abs = (AbstractConsole) console;
- helpContextId = abs.getHelpContextId();
- }
- if (helpContextId == null) {
- helpContextId = IConsoleHelpContextIds.CONSOLE_VIEW;
- }
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getPageBook().getParent(), helpContextId);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
- */
- protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
- IConsole console = (IConsole)fPartToConsole.get(part);
-
- // dispose page participants
- ListenerList listeners = (ListenerList) fConsoleToPageParticipants.remove(console);
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.dispose();
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- }
- });
- }
- }
-
- IPage page = pageRecord.page;
- page.dispose();
- pageRecord.dispose();
- console.removePropertyChangeListener(this);
-
- // empty cross-reference cache
- fPartToConsole.remove(part);
- fConsoleToPart.remove(console);
- if (fPartToConsole.isEmpty()) {
- fActiveConsole = null;
- }
-
- // update console actions
- fPinAction.update();
- }
-
- /**
- * Returns the page participants registered for the given console, or <code>null</code>
- *
- * @param console
- * @return registered page participants or <code>null</code>
- */
- private ListenerList getParticipants(IConsole console) {
- return (ListenerList) fConsoleToPageParticipants.get(console);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
- */
- protected PageRec doCreatePage(IWorkbenchPart dummyPart) {
- ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)dummyPart;
- final IConsole console = part.getConsole();
- final IPageBookViewPage page = console.createPage(this);
- initPage(page);
- page.createControl(getPageBook());
- console.addPropertyChangeListener(this);
-
- // initialize page participants
- IConsolePageParticipant[] consoleParticipants = ((ConsoleManager)getConsoleManager()).getPageParticipants(console);
- final ListenerList participants = new ListenerList();
- for (int i = 0; i < consoleParticipants.length; i++) {
- participants.add(consoleParticipants[i]);
- }
- fConsoleToPageParticipants.put(console, participants);
- Object[] listeners = participants.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) listeners[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.init(page, console);
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- participants.remove(participant);
- }
- });
- }
-
- PageRec rec = new PageRec(dummyPart, page);
- return rec;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
- */
- protected boolean isImportant(IWorkbenchPart part) {
- return part instanceof ConsoleWorkbenchPart;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- IViewSite site = getViewSite();
- if(site != null) {
- site.getPage().removePartListener((IPartListener2)this);
- }
- super.dispose();
- ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager();
- consoleManager.removeConsoleListener(this);
- consoleManager.unregisterConsoleView(this);
- }
-
- /**
- * Returns the console manager.
- *
- * @return the console manager
- */
- private IConsoleManager getConsoleManager() {
- return ConsolePlugin.getDefault().getConsoleManager();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
- */
- protected IPage createDefaultPage(PageBook book) {
- MessagePage page = new MessagePage();
- page.createControl(getPageBook());
- initPage(page);
- return page;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesAdded(org.eclipse.ui.console.IConsole[])
- */
- public void consolesAdded(final IConsole[] consoles) {
- if (isAvailable()) {
- Runnable r = new Runnable() {
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- 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];
- if (registered.equals(console)) {
- ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
- fConsoleToPart.put(console, part);
- fPartToConsole.put(part, console);
- partActivated(part);
- break;
- }
- }
-
- }
- }
- }
- };
- asyncExec(r);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleListener#consolesRemoved(org.eclipse.ui.console.IConsole[])
- */
- public void consolesRemoved(final IConsole[] consoles) {
- if (isAvailable()) {
- Runnable r = new Runnable() {
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- IConsole console = consoles[i];
- fStack.remove(console);
- ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)fConsoleToPart.get(console);
- if (part != null) {
- partClosed(part);
- }
- if (getConsole() == null) {
- IConsole[] available = getConsoleManager().getConsoles();
- if (available.length > 0) {
- display(available[available.length - 1]);
- }
- }
- }
- }
- }
- };
- asyncExec(r);
- }
- }
-
- /**
- * Constructs a console view
- */
- public ConsoleView() {
- super();
- fConsoleToPart = new HashMap();
- fPartToConsole = new HashMap();
- fConsoleToPageParticipants = new HashMap();
-
- ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager();
- consoleManager.registerConsoleView(this);
- }
-
- protected void createActions() {
- fPinAction = new PinConsoleAction(this);
- fDisplayConsoleAction = new ConsoleDropDownAction(this);
- ConsoleFactoryExtension[] extensions = ((ConsoleManager)ConsolePlugin.getDefault().getConsoleManager()).getConsoleFactoryExtensions();
- if (extensions.length > 0) {
- fOpenConsoleAction = new OpenConsoleAction();
- }
- }
-
- protected void configureToolBar(IToolBarManager mgr) {
- mgr.add(new Separator(IConsoleConstants.LAUNCH_GROUP));
- mgr.add(new Separator(IConsoleConstants.OUTPUT_GROUP));
- mgr.add(new Separator("fixedGroup")); //$NON-NLS-1$
- mgr.add(fPinAction);
- mgr.add(fDisplayConsoleAction);
- if (fOpenConsoleAction != null) {
- mgr.add(fOpenConsoleAction);
- if (mgr instanceof ToolBarManager) {
- ToolBarManager tbm= (ToolBarManager) mgr;
- final ToolBar tb= tbm.getControl();
- tb.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- ToolItem ti= tb.getItem(new Point(e.x, e.y));
- if (ti.getData() instanceof ActionContributionItem) {
- ActionContributionItem actionContributionItem= (ActionContributionItem) ti.getData();
- IAction action= actionContributionItem.getAction();
- if (action == fOpenConsoleAction) {
- Event event= new Event();
- event.widget= ti;
- event.x= e.x;
- event.y= e.y;
- action.runWithEvent(event);
- }
- }
- }
- });
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#display(org.eclipse.ui.console.IConsole)
- */
- public void display(IConsole console) {
- if (fPinned && fActiveConsole != null) {
- return;
- }
- if (console.equals(fActiveConsole)) {
- return;
- }
- ConsoleWorkbenchPart part = (ConsoleWorkbenchPart)fConsoleToPart.get(console);
- if (part != null) {
- partActivated(part);
- }
- }
-
- /*/* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#pin(org.eclipse.ui.console.IConsole)
- */
- public void setPinned(boolean pin) {
- fPinned = pin;
- if (fPinAction != null) {
- fPinAction.update();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#isPinned()
- */
- public boolean isPinned() {
- return fPinned;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
- */
- protected IWorkbenchPart getBootstrapPart() {
- return null;
- }
-
- /**
- * Registers the given runnable with the display
- * associated with this view's control, if any.
- *
- * @see org.eclipse.swt.widgets.Display#asyncExec(java.lang.Runnable)
- */
- public void asyncExec(Runnable r) {
- if (isAvailable()) {
- getPageBook().getDisplay().asyncExec(r);
- }
- }
-
- /**
- * Creates this view's underlying viewer and actions.
- * Hooks a pop-up menu to the underlying viewer's control,
- * as well as a key listener. When the delete key is pressed,
- * the <code>REMOVE_ACTION</code> is invoked. Hooks help to
- * this view. Subclasses must implement the following methods
- * which are called in the following order when a view is
- * created:<ul>
- * <li><code>createViewer(Composite)</code> - the context
- * menu is hooked to the viewer's control.</li>
- * <li><code>createActions()</code></li>
- * <li><code>configureToolBar(IToolBarManager)</code></li>
- * <li><code>getHelpContextId()</code></li>
- * </ul>
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- createActions();
- IToolBarManager tbm= getViewSite().getActionBars().getToolBarManager();
- configureToolBar(tbm);
- updateForExistingConsoles();
- getViewSite().getActionBars().updateActionBars();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IConsoleHelpContextIds.CONSOLE_VIEW);
- getViewSite().getPage().addPartListener((IPartListener2)this);
- initPageSwitcher();
- }
-
- /**
- * Initialize the PageSwitcher.
- */
- private void initPageSwitcher() {
- new PageSwitcher(this) {
- public void activatePage(Object page) {
- ShowConsoleAction.showConsole((IConsole) page, ConsoleView.this);
- }
-
- public ImageDescriptor getImageDescriptor(Object page) {
- return ((IConsole) page).getImageDescriptor();
- }
-
- public String getName(Object page) {
- return ((IConsole) page).getName();
- }
-
- public Object[] getPages() {
- return getConsoleManager().getConsoles();
- }
-
- public int getCurrentPageIndex() {
- IConsole currentConsole= getConsole();
- IConsole[] consoles= getConsoleManager().getConsoles();
- for (int i= 0; i < consoles.length; i++) {
- if (consoles[i].equals(currentConsole))
- return i;
- }
- return super.getCurrentPageIndex();
- }
- };
- }
-
- /**
- * Initialize for existing consoles
- */
- private void updateForExistingConsoles() {
- IConsoleManager manager = getConsoleManager();
- // create pages for consoles
- IConsole[] consoles = manager.getConsoles();
- consolesAdded(consoles);
- // add as a listener
- manager.addConsoleListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#warnOfContentChange(org.eclipse.ui.console.IConsole)
- */
- public void warnOfContentChange(IConsole console) {
- IWorkbenchPart part = (IWorkbenchPart)fConsoleToPart.get(console);
- if (part != null) {
- IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) part.getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (service != null) {
- service.warnOfContentChange();
- }
- }
- }
-
- public Object getAdapter(Class key) {
- Object adpater = super.getAdapter(key);
- if (adpater == null) {
- IConsole console = getConsole();
- if (console != null) {
- ListenerList listeners = getParticipants(console);
- // an adapter can be asked for before the console participants are created
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- adpater = participant.getAdapter(key);
- if (adpater != null) {
- return adpater;
- }
- }
- }
- }
- }
- return adpater;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partActivated(IWorkbenchPartReference partRef) {
- if (isThisPart(partRef)) {
- fActive = true;
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- if(contextService != null) {
- fActivatedContext = contextService.activateContext(IConsoleConstants.ID_CONSOLE_VIEW);
- activateParticipants(fActiveConsole);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partClosed(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partDeactivated(IWorkbenchPartReference partRef) {
- if (isThisPart(partRef)) {
- fActive = false;
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- if(contextService != null) {
- contextService.deactivateContext(fActivatedContext);
- deactivateParticipants(fActiveConsole);
- }
- }
- }
-
- /**
- * Returns if the specified part reference is to this view part (if the part
- * reference is the console view or not)
- * @param partRef
- * @return true if the specified part reference is the console view
- */
- protected boolean isThisPart(IWorkbenchPartReference partRef) {
- if (partRef instanceof IViewReference) {
- IViewReference viewRef = (IViewReference) partRef;
- if (getViewSite() != null && viewRef.getId().equals(getViewSite().getId())) {
- String secId = viewRef.getSecondaryId();
- String mySec = null;
- if (getSite() instanceof IViewSite) {
- mySec = ((IViewSite)getSite()).getSecondaryId();
- }
- if (mySec == null) {
- return secId == null;
- }
- return mySec.equals(secId);
- }
- }
- return false;
- }
-
- /**
- * Deactivates participants for the given console, if any.
- *
- * @param console console to deactivate
- */
- private void deactivateParticipants(IConsole console) {
- // deactivate
- if (console != null) {
- final ListenerList listeners = getParticipants(console);
- if (listeners != null) {
- Object[] participants = listeners.getListeners();
- for (int i = 0; i < participants.length; i++) {
- final IConsolePageParticipant participant = (IConsolePageParticipant) participants[i];
- SafeRunner.run(new ISafeRunnable() {
- public void run() throws Exception {
- participant.deactivated();
- }
- public void handleException(Throwable exception) {
- ConsolePlugin.log(exception);
- listeners.remove(participant);
- }
- });
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partOpened(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partHidden(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partHidden(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partVisible(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partInputChanged(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#setScrollLock(boolean)
- */
- public void setScrollLock(boolean scrollLock) {
- fScrollLock = scrollLock;
-
- IPage page = getCurrentPage();
- if (page instanceof IOConsolePage) {
- ((IOConsolePage)page).setAutoScroll(!scrollLock);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#getScrollLock()
- */
- public boolean getScrollLock() {
- return fScrollLock;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleView#pin(org.eclipse.ui.console.IConsole)
- */
- public void pin(IConsole console) {
- if (console == null) {
- setPinned(false);
- } else {
- if (isPinned()) {
- setPinned(false);
- }
- display(console);
- setPinned(true);
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
deleted file mode 100644
index 8a32fc8c1..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleViewConsoleFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IConsoleFactory;
-
-public class ConsoleViewConsoleFactory implements IConsoleFactory {
-
- int counter = 1;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.IConsoleFactory#openConsole()
- */
- public void openConsole() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- try {
- String secondaryId = "Console View #" + counter; //$NON-NLS-1$
- page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1);
- counter++;
- } catch (PartInitException e) {
- ConsolePlugin.log(e);
- }
- }
- }
- }
-
-}
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
deleted file mode 100644
index e3377a4dc..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleWorkbenchPart.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.console.IConsole;
-
-/**
- * Fake part to use as keys in page book for console pages
- */
-public class ConsoleWorkbenchPart implements IWorkbenchPart {
-
- private IConsole fConsole = null;
- private IWorkbenchPartSite fSite = null;
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return (obj instanceof ConsoleWorkbenchPart) &&
- fConsole.equals(((ConsoleWorkbenchPart)obj).fConsole);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fConsole.hashCode();
- }
-
- /**
- * Constructs a part for the given console that binds to the given
- * site
- */
- public ConsoleWorkbenchPart(IConsole console, IWorkbenchPartSite site) {
- fConsole = console;
- fSite = site;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void addPropertyListener(IPropertyListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getSite()
- */
- public IWorkbenchPartSite getSite() {
- return fSite;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitle()
- */
- public String getTitle() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleImage()
- */
- public Image getTitleImage() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#getTitleToolTip()
- */
- public String getTitleToolTip() {
- return ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
- */
- public void removePropertyListener(IPropertyListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- /**
- * Returns the console associated with this part.
- *
- * @return console associated with this part
- */
- protected IConsole getConsole() {
- return fConsole;
- }
-}
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
deleted file mode 100644
index 492dfd552..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/FollowHyperlinkAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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
- *
- * @since 3.1
- */
-public class FollowHyperlinkAction extends Action {
-
- private TextConsoleViewer viewer;
-
- /**
- * Constructs a follow link action
- */
- public FollowHyperlinkAction(TextConsoleViewer consoleViewer) {
- super(ConsoleMessages.FollowHyperlinkAction_0);
- setToolTipText(ConsoleMessages.FollowHyperlinkAction_1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_OPEN_LINK_ACTION);
- this.viewer = consoleViewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#isEnabled()
- */
- public boolean isEnabled() {
- return viewer.getHyperlink() != null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- IHyperlink link = viewer.getHyperlink();
- if (link != null) {
- link.linkActivated();
- }
- }
-
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java
deleted file mode 100644
index 3ed6aa714..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/HyperlinkUpdater.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
-
-/**
- * When any region of a hyperlink is replaced, the hyperlink needs to be deleted.
- *
- * @since 3.3
- */
-public class HyperlinkUpdater extends DefaultPositionUpdater {
-
- /**
- * @param category
- */
- public HyperlinkUpdater() {
- super(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- }
- /**
- * When any region of a hyperlink is replaced, the hyperlink needs to be deleted.
- *
- * @return <code>true</code> if position has NOT been deleted
- */
- protected boolean notDeleted() {
-
- int positionEnd = fPosition.offset + fPosition.length - 1;
- int editEnd = fOffset + fLength - 1;
- if ((fOffset <= fPosition.offset && (editEnd > fPosition.offset)) ||
- (fOffset < positionEnd && (editEnd > positionEnd)) ||
- (fOffset >= fPosition.offset && fOffset <= positionEnd) ||
- (editEnd >= fPosition.offset && editEnd <= positionEnd)) {
-
- fPosition.delete();
-
- try {
- fDocument.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, fPosition);
- } catch (BadPositionCategoryException x) {
- }
-
- return false;
- }
-
- return true;
- }
-}
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
deleted file mode 100644
index 85a4e69b2..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IConsoleHelpContextIds.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.ui.console.IConsoleConstants;
-
-/**
- * Help context ids for the console plugin.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-public interface IConsoleHelpContextIds {
-
- public static final String PREFIX = IConsoleConstants.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String CLEAR_CONSOLE_ACTION = PREFIX + "clear_console_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_SCROLL_LOCK_ACTION = PREFIX + "console_scroll_lock_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_SELECT_ALL_ACTION = PREFIX + "console_select_all_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_COPY_ACTION = PREFIX + "copy_to_clipboard_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_CUT_ACTION = PREFIX + "console_cut_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_PASTE_ACTION = PREFIX + "console_paste_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_FIND_REPLACE_ACTION = PREFIX + "console_find_replace_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_OPEN_LINK_ACTION = PREFIX + "console_open_link_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_OPEN_CONSOLE_ACTION = PREFIX + "console_open_console_action_context"; //$NON-NLS-1$
- public static final String CONSOLE_DISPLAY_CONSOLE_ACTION = PREFIX + "console_display_console_action"; //$NON-NLS-1$
- public static final String CONSOLE_PIN_CONSOLE_ACITON = PREFIX + "console_pin_console_action"; //$NON-NLS-1$
-
- // Views
- public static final String CONSOLE_VIEW = PREFIX + "console_view_context"; //$NON-NLS-1$
-
- // Preference pages
- public static final String CONSOLE_PREFERENCE_PAGE = PREFIX + "console_preference_page_context"; //$NON-NLS-1$
-}
-
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java
deleted file mode 100644
index 00f5cbc3b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IInternalConsoleConstants.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-public interface IInternalConsoleConstants {
-
- // tool images
- public static final String IMG_LCL_PIN = "IMG_LCL_PIN"; //$NON-NLS-1$
- public static final String IMG_LCL_LOCK = "IMG_LCL_LOCK"; //$NON-NLS-1$
-
- // disabled local tool images
- public static final String IMG_DLCL_PIN = "IMG_DLCL_PIN"; //$NON-NLS-1$
- public static final String IMG_DLCL_CLEAR= "IMG_DLCL_CLEAR"; //$NON-NLS-1$
- public static final String IMG_DLCL_LOCK = "IMG_DLCL_LOCK"; //$NON-NLS-1$
- public static final String IMG_DLCL_CLOSE = "IMG_DLCL_CLOSE"; //$NON-NLS-1$
-
- // enabled local tool images
- public static final String IMG_ELCL_PIN = "IMG_ELCL_PIN"; //$NON-NLS-1$
- public static final String IMG_ELCL_CLEAR= "IMG_ELCL_CLEAR"; //$NON-NLS-1$
- public static final String IMG_ELCL_LOCK = "IMG_ELCL_LOCK"; //$NON-NLS-1$
- public static final String IMG_ELCL_CLOSE = "IMG_ELCL_CLOSE"; //$NON-NLS-1$
- public static final String IMG_ELCL_NEW_CON = "IMG_ELCL_NEW_CON"; //$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
deleted file mode 100644
index 3f8d72fe9..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePage.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.console.TextConsolePage;
-import org.eclipse.ui.console.TextConsoleViewer;
-
-/**
- * A page for an IOConsole
- *
- * @since 3.1
- *
- */
-public class IOConsolePage extends TextConsolePage {
-
- private ScrollLockAction fScrollLockAction;
-
- private boolean fReadOnly;
-
- private IPropertyChangeListener fPropertyChangeListener;
-
- public IOConsolePage(TextConsole console, IConsoleView view) {
- super(console, view);
-
- fPropertyChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
- setReadOnly();
- }
- }
- };
- console.addPropertyChangeListener(fPropertyChangeListener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- if (fReadOnly) {
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- viewer.setReadOnly();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.TextConsolePage#createViewer(org.eclipse.swt.widgets.Composite,
- * org.eclipse.ui.console.TextConsole)
- */
- protected TextConsoleViewer createViewer(Composite parent) {
- return new IOConsoleViewer(parent, (TextConsole)getConsole());
- }
-
- public void setAutoScroll(boolean scroll) {
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- if (viewer != null) {
- viewer.setAutoScroll(scroll);
- fScrollLockAction.setChecked(!scroll);
- }
- }
-
- /**
- * Informs the viewer that it's text widget should not be editable.
- */
- public void setReadOnly() {
- fReadOnly = true;
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- if (viewer != null) {
- viewer.setReadOnly();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.TextConsolePage#createActions()
- */
- protected void createActions() {
- super.createActions();
- fScrollLockAction = new ScrollLockAction(getConsoleView());
- setAutoScroll(!fScrollLockAction.isChecked());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.TextConsolePage#contextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- protected void contextMenuAboutToShow(IMenuManager menuManager) {
- super.contextMenuAboutToShow(menuManager);
- menuManager.add(fScrollLockAction);
- IOConsoleViewer viewer = (IOConsoleViewer) getViewer();
- if (!viewer.isReadOnly()) {
- menuManager.remove(ActionFactory.CUT.getId());
- menuManager.remove(ActionFactory.PASTE.getId());
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.TextConsolePage#configureToolBar(org.eclipse.jface.action.IToolBarManager)
- */
- protected void configureToolBar(IToolBarManager mgr) {
- super.configureToolBar(mgr);
- mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fScrollLockAction);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.IPage#dispose()
- */
- public void dispose() {
- if (fScrollLockAction != null) {
- fScrollLockAction.dispose();
- fScrollLockAction = null;
- }
- getConsole().removePropertyChangeListener(fPropertyChangeListener);
- super.dispose();
- }
-
-}
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
deleted file mode 100644
index 519cbc76b..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartition.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IOConsoleInputStream;
-import org.eclipse.ui.console.IOConsoleOutputStream;
-
-/**
- * A region in an IOConsole's document.
- *
- * @since 3.1
- */
-public class IOConsolePartition implements ITypedRegion {
- public static final String OUTPUT_PARTITION_TYPE = ConsolePlugin.getUniqueIdentifier() + ".io_console_output_partition_type"; //$NON-NLS-1$
- public static final String INPUT_PARTITION_TYPE = ConsolePlugin.getUniqueIdentifier() + ".io_console_input_partition_type"; //$NON-NLS-1$
-
- /**
- * The data contained by this partition.
- */
- private StringBuffer buffer;
- private String type;
- private int offset;
- /**
- * Output partitions are all read only.
- * Input partitions are read only once they have been appended to the console's input stream.
- */
- private boolean readOnly;
-
- /**
- * Only one of inputStream or outputStream will be null depending on the partitions type.
- */
- private IOConsoleOutputStream outputStream;
- private IOConsoleInputStream inputStream;
- private int length;
-
- /**
- * Creates a new partition to contain output to console.
- */
- public IOConsolePartition(IOConsoleOutputStream outputStream, int length) {
- this.outputStream = outputStream;
- this.length = length;
- this.type = OUTPUT_PARTITION_TYPE;
- this.readOnly = true;
- }
-
- /**
- * Creates a new partition to contain input from a console
- */
- public IOConsolePartition(IOConsoleInputStream inputStream, String text) {
- this.inputStream = inputStream;
- buffer = new StringBuffer(text);
- length = text.length();
- this.type = INPUT_PARTITION_TYPE;
- this.readOnly = false;
- }
-
- /**
- * Inserts a string into this partition.
- * @param s The string to insert
- * @param offset the offset in the partition
- */
- public void insert(String s, int insertOffset) {
- buffer.insert(insertOffset, s);
- length += s.length();
- }
-
- /**
- * Deletes data from this partition.
- * @param delOffset
- * @param delLength
- */
- public void delete(int delOffset, int delLength) {
- buffer.delete(delOffset, delOffset+delLength);
- length -= delLength;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.ITypedRegion#getType()
- */
- public String getType() {
- return type;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IRegion#getLength()
- */
- public int getLength() {
- return length;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IRegion#getOffset()
- */
- public int getOffset() {
- return offset;
- }
-
- /**
- * Sets this partitions offset in the document.
- *
- * @param offset This partitions offset in the document.
- */
- public void setOffset(int offset) {
- this.offset = offset;
- }
-
- /**
- * Sets this partition's length.
- *
- * @param length
- */
- public void setLength(int length) {
- this.length = length;
- }
-
- /**
- * Returns the data contained in this partition.
- * @return The data contained in this partition.
- */
- public String getString() {
- return buffer.toString();
- }
-
- /**
- * Returns a StyleRange object which may be used for setting the style
- * of this partition in a viewer.
- */
- public StyleRange getStyleRange(int rangeOffset, int rangeLength) {
- return new StyleRange(rangeOffset, rangeLength, getColor(), null, getFontStyle());
- }
-
- /**
- * Returns the font of the input stream if the type of the partition
- * is <code>INPUT_PARTITION_TYPE</code>, otherwise it returns the output
- * stream font
- *
- * @return the font of one of the backing streams
- */
- private int getFontStyle() {
- if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getFontStyle();
- }
- return outputStream.getFontStyle();
- }
-
- /**
- * Returns the colour of the input stream if the type of the partition
- * is <code>INPUT_PARTITION_TYPE</code>, otherwise it returns the output
- * stream colour
- *
- * @return the colour of one of the backing streams
- */
- public Color getColor() {
- if (type.equals(INPUT_PARTITION_TYPE)) {
- return inputStream.getColor();
- }
- return outputStream.getColor();
- }
-
- /**
- * Returns if this partition is read-only.
- *
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#isReadOnly(int)
- * @return if this partition is read-only
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /**
- * Sets the read-only state of this partition to <code>true</code>.
- *
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#isReadOnly(int)
- */
- public void setReadOnly() {
- readOnly = true;
- }
-
- /**
- * Clears the contents of the buffer
- */
- public void clearBuffer() {
- buffer.setLength(0);
- }
-
- /**
- * Returns the underlying output stream
- *
- * @return the underlying output stream
- */
- IOConsoleOutputStream getStream() {
- return outputStream;
- }
-}
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
deleted file mode 100644
index 5a74807b2..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ /dev/null
@@ -1,699 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobManager;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-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.Region;
-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.IOConsole;
-import org.eclipse.ui.console.IOConsoleInputStream;
-import org.eclipse.ui.console.IOConsoleOutputStream;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * Partitions an IOConsole's document
- * @since 3.1
- *
- */
-public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocumentPartitionerExtension {
- private PendingPartition consoleClosedPartition;
- private IDocument document;
- private ArrayList partitions;
- /**
- * Blocks of data that have not yet been appended to the document.
- */
- private ArrayList pendingPartitions;
- /**
- * A list of PendingPartitions to be appended by the updateJob
- */
- private ArrayList updatePartitions;
- /**
- * The last partition appended to the document
- */
- private IOConsolePartition lastPartition;
- /**
- * Job that appends pending partitions to the document.
- */
- private QueueProcessingJob queueJob;
- /**
- * The input stream attached to this document.
- */
- private IOConsoleInputStream inputStream;
- /**
- * Flag to indicate that the updateJob is updating the document.
- */
- private boolean updateInProgress;
- /**
- * A list of partitions containing input from the console, that have
- * not been appended to the input stream yet.
- */
- private ArrayList inputPartitions;
- /**
- * offset used by updateJob
- */
- private int firstOffset;
- /**
- * An array of legal line delimiters
- */
- private String[] lld;
- private int highWaterMark = -1;
- private int lowWaterMark = -1;
- private boolean connected = false;
-
- private IOConsole console;
-
- private TrimJob trimJob = new TrimJob();
- /**
- * 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.
- */
- private Object overflowLock = new Object();
-
-
- private int fBuffer;
-
- public IOConsolePartitioner(IOConsoleInputStream inputStream, IOConsole console) {
- this.inputStream = inputStream;
- this.console = console;
- trimJob.setRule(console.getSchedulingRule());
- }
-
- public IDocument getDocument() {
- return document;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#connect(org.eclipse.jface.text.IDocument)
- */
- 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;
- }
-
- public int getHighWaterMark() {
- return highWaterMark;
- }
-
- public int getLowWaterMark() {
- return lowWaterMark;
- }
-
- public void setWaterMarks(int low, int high) {
- lowWaterMark = low;
- highWaterMark = high;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- checkBufferSize();
- }
- });
- }
-
- /**
- * 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);
- }
- queueJob.schedule(); //ensure that all pending partitions are processed.
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#disconnect()
- */
- public void disconnect() {
- synchronized (overflowLock) {
- document = null;
- partitions.clear();
- connected = false;
- try {
- inputStream.close();
- } catch (IOException e) {
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public boolean documentChanged(DocumentEvent event) {
- return documentChanged2(event) != null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#getLegalContentTypes()
- */
- public String[] getLegalContentTypes() {
- return new String[] { IOConsolePartition.OUTPUT_PARTITION_TYPE, IOConsolePartition.INPUT_PARTITION_TYPE };
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#getContentType(int)
- */
- public String getContentType(int offset) {
- return getPartition(offset).getType();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#computePartitioning(int, int)
- */
- public ITypedRegion[] computePartitioning(int offset, int length) {
- int rangeEnd = offset + length;
- int left= 0;
- int right= partitions.size() - 1;
- int mid= 0;
- IOConsolePartition position= null;
-
- if (left == right) {
- return new IOConsolePartition[]{(IOConsolePartition) partitions.get(0)};
- }
- while (left < right) {
-
- mid= (left + right) / 2;
-
- position= (IOConsolePartition) partitions.get(mid);
- if (rangeEnd < position.getOffset()) {
- if (left == mid)
- right= left;
- else
- right= mid -1;
- } else if (offset > (position.getOffset() + position.getLength() - 1)) {
- if (right == mid)
- left= right;
- else
- left= mid +1;
- } else {
- left= right= mid;
- }
- }
-
-
- List list = new ArrayList();
- int index = left - 1;
- if (index >= 0) {
- position= (IOConsolePartition) partitions.get(index);
- while (index >= 0 && (position.getOffset() + position.getLength()) > offset) {
- index--;
- if (index >= 0) {
- position= (IOConsolePartition) partitions.get(index);
- }
- }
- }
- index++;
- position= (IOConsolePartition) partitions.get(index);
- while (index < partitions.size() && (position.getOffset() < rangeEnd)) {
- list.add(position);
- index++;
- if (index < partitions.size()) {
- position= (IOConsolePartition) partitions.get(index);
- }
- }
-
- return (ITypedRegion[]) list.toArray(new IOConsolePartition[list.size()]);
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.text.IDocumentPartitioner#getPartition(int)
- */
- public ITypedRegion getPartition(int offset) {
- for (int i = 0; i < partitions.size(); i++) {
- ITypedRegion partition = (ITypedRegion) partitions.get(i);
- int start = partition.getOffset();
- int end = start + partition.getLength();
- if (offset >= start && offset < end) {
- return partition;
- }
- }
-
- if (lastPartition == null) {
- synchronized(partitions) {
- lastPartition = new IOConsolePartition(inputStream, ""); //$NON-NLS-1$
- lastPartition.setOffset(offset);
- partitions.add(lastPartition);
- inputPartitions.add(lastPartition);
- }
- }
- return lastPartition;
- }
-
- /**
- * 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.
- */
- 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();
- }
- }
- }
- }
-
- /**
- * Clears the console
- */
- public void clearBuffer() {
- synchronized (overflowLock) {
- trimJob.setOffset(-1);
- trimJob.schedule();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IDocumentPartitionerExtension#documentChanged2(org.eclipse.jface.text.DocumentEvent)
- */
- public IRegion documentChanged2(DocumentEvent event) {
- if (document == null) {
- return null; //another thread disconnected the partitioner
- }
- if (document.getLength() == 0) { //document cleared
- if (lastPartition != null && lastPartition.getType().equals(IOConsolePartition.INPUT_PARTITION_TYPE)) {
- synchronized (partitions) {
- partitions.remove(lastPartition);
- inputPartitions.remove(lastPartition);
- }
- }
- lastPartition = null;
- return new Region(0, 0);
- }
-
-
- if (updateInProgress) {
- synchronized(partitions) {
- if (updatePartitions != null) {
- for (Iterator i = updatePartitions.iterator(); i.hasNext(); ) {
- PendingPartition pp = (PendingPartition) i.next();
- if (pp == consoleClosedPartition) {
- continue;
- }
-
- int ppLen = pp.text.length();
- if (lastPartition != null && lastPartition.getStream() == pp.stream) {
- int len = lastPartition.getLength();
- lastPartition.setLength(len + ppLen);
- } else {
- IOConsolePartition partition = new IOConsolePartition(pp.stream, ppLen);
- partition.setOffset(firstOffset);
- lastPartition = partition;
- partitions.add(partition);
- }
- firstOffset += ppLen;
- }
- }
- }
- } else {// user input.
- int amountDeleted = event.getLength() ;
-
- if (amountDeleted > 0) {
- int offset = event.fOffset;
- IOConsolePartition partition = (IOConsolePartition) getPartition(offset);
- if(partition == lastPartition) {
- partition.delete(event.fOffset-partition.getOffset(), amountDeleted);
- }
- }
-
- synchronized(partitions) {
- if (lastPartition == null || lastPartition.isReadOnly()) {
- lastPartition = new IOConsolePartition(inputStream, event.fText);
- lastPartition.setOffset(event.fOffset);
- partitions.add(lastPartition);
- inputPartitions.add(lastPartition);
- } else {
- lastPartition.insert(event.fText, (event.fOffset-lastPartition.getOffset()));
- }
-
- int lastLineDelimiter = -1;
- String partitionText = lastPartition.getString();
- for (int i = 0; i < lld.length; i++) {
- String ld = lld[i];
- int index = partitionText.lastIndexOf(ld);
- if (index != -1) {
- index += ld.length();
- }
- if (index > lastLineDelimiter) {
- lastLineDelimiter = index;
- }
- }
- if (lastLineDelimiter != -1) {
- StringBuffer input = new StringBuffer();
- Iterator it = inputPartitions.iterator();
- while (it.hasNext()) {
- IOConsolePartition partition = (IOConsolePartition) it.next();
- if (partition.getOffset() + partition.getLength() <= event.fOffset + lastLineDelimiter) {
- if (partition == lastPartition) {
- lastPartition = null;
- }
- input.append(partition.getString());
- partition.clearBuffer();
- partition.setReadOnly();
- it.remove();
- } else {
- //create a new partition containing everything up to the line delimiter
- //and append that to the string buffer.
- String contentBefore = partitionText.substring(0, lastLineDelimiter);
- IOConsolePartition newPartition = new IOConsolePartition(inputStream, contentBefore);
- newPartition.setOffset(partition.getOffset());
- newPartition.setReadOnly();
- newPartition.clearBuffer();
- int index = partitions.indexOf(partition);
- partitions.add(index, newPartition);
- input.append(contentBefore);
- //delete everything that has been appended to the buffer.
- partition.delete(0, lastLineDelimiter);
- partition.setOffset(lastLineDelimiter + partition.getOffset());
- lastLineDelimiter = 0;
- }
- }
- if (input.length() > 0) {
- inputStream.appendData(input.toString());
- }
-
- }
- }
- }
-
- return new Region(event.fOffset, event.fText.length());
- }
-
- 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
- * @param stream The stream that was written to.
- * @param s The string that should be appended to the document.
- */
- public void streamAppended(IOConsoleOutputStream stream, String s) throws IOException {
- if (document == null) {
- throw new IOException("Document is closed"); //$NON-NLS-1$
- }
- synchronized(pendingPartitions) {
- PendingPartition last = (PendingPartition) (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 (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();
- }
- }
- }
- }
-
- /**
- * Holds data until updateJob can be run and the document can be updated.
- */
- private class PendingPartition {
- StringBuffer text = new StringBuffer(8192);
- IOConsoleOutputStream stream;
-
- PendingPartition(IOConsoleOutputStream stream, String text) {
- this.stream = stream;
- if (text != null) {
- append(text);
- }
- }
-
- void append(String moreText) {
- text.append(moreText);
- fBuffer += moreText.length();
- }
- }
-
- /**
- * Updates the document. Will append everything that is available before
- * finishing.
- */
- private class QueueProcessingJob extends UIJob {
-
- QueueProcessingJob() {
- super("IOConsole Updater"); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus runInUIThread(IProgressMonitor monitor) {
- processQueue();
- return Status.OK_STATUS;
- }
-
- /*
- * 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.
- */
- public boolean shouldRun() {
- boolean shouldRun = connected && pendingPartitions != null && pendingPartitions.size() > 0;
- return shouldRun;
- }
- }
-
- void processQueue() {
- synchronized (overflowLock) {
- ArrayList pendingCopy = new ArrayList();
- StringBuffer buffer = null;
- boolean consoleClosed = false;
- synchronized(pendingPartitions) {
- pendingCopy.addAll(pendingPartitions);
- pendingPartitions.clear();
- fBuffer = 0;
- pendingPartitions.notifyAll();
- }
- // determine buffer size
- int size = 0;
- for (Iterator i = pendingCopy.iterator(); i.hasNext(); ) {
- PendingPartition pp = (PendingPartition) i.next();
- if (pp != consoleClosedPartition) {
- size+= pp.text.length();
- }
- }
- buffer = new StringBuffer(size);
- for (Iterator i = pendingCopy.iterator(); i.hasNext(); ) {
- PendingPartition pp = (PendingPartition) i.next();
- if (pp != consoleClosedPartition) {
- buffer.append(pp.text);
- } else {
- consoleClosed = true;
- }
- }
-
- if (connected) {
- setUpdateInProgress(true);
- updatePartitions = pendingCopy;
- firstOffset = document.getLength();
- try {
- if (buffer != null) {
- document.replace(firstOffset, 0, buffer.toString());
- }
- } catch (BadLocationException e) {
- }
- updatePartitions = null;
- setUpdateInProgress(false);
- }
- if (consoleClosed) {
- console.partitionerFinished();
- }
- checkBufferSize();
- }
-
- }
-
- /**
- * Job to trim the console document, runs in the UI thread.
- */
- private class TrimJob extends WorkbenchJob {
-
- /**
- * trims output up to the line containing the given offset,
- * or all output if -1.
- */
- private int truncateOffset;
-
- /**
- * Creates a new job to trim the buffer.
- */
- TrimJob() {
- super("Trim Job"); //$NON-NLS-1$
- setSystem(true);
- }
-
- /**
- * Sets the trim offset.
- *
- * @param offset trims output up to the line containing the given offset
- */
- public void setOffset(int offset) {
- truncateOffset = offset;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus runInUIThread(IProgressMonitor monitor) {
- IJobManager jobManager = Job.getJobManager();
- try {
- jobManager.join(console, monitor);
- } catch (OperationCanceledException e1) {
- return Status.CANCEL_STATUS;
- } catch (InterruptedException e1) {
- return Status.CANCEL_STATUS;
- }
- if (document == null) {
- 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);
- partitions.clear();
- } 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 (Iterator i = partitions.iterator(); i.hasNext(); ) {
- IOConsolePartition p = (IOConsolePartition) i.next();
- p.setOffset(offset);
- offset += p.getLength();
- }
- }
- } catch (BadLocationException e) {
- }
- }
- }
- return Status.OK_STATUS;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#isReadOnly(int)
- */
- public boolean isReadOnly(int offset) {
- return ((IOConsolePartition)getPartition(offset)).isReadOnly();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsoleDocumentPartitioner#computeStyleRange(int, int)
- */
- public StyleRange[] getStyleRanges(int offset, int length) {
- if (!connected) {
- return new StyleRange[0];
- }
- IOConsolePartition[] computedPartitions = (IOConsolePartition[])computePartitioning(offset, length);
- StyleRange[] styles = new StyleRange[computedPartitions.length];
- for (int i = 0; i < computedPartitions.length; i++) {
- int rangeStart = Math.max(computedPartitions[i].getOffset(), offset);
- int rangeLength = computedPartitions[i].getLength();
- styles[i] = computedPartitions[i].getStyleRange(rangeStart, rangeLength);
- }
- return styles;
- }
-}
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
deleted file mode 100644
index e686955f0..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-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.swt.custom.StyledText;
-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.TextConsole;
-import org.eclipse.ui.console.TextConsoleViewer;
-
-/**
- * Viewer used to display an IOConsole
- *
- * @since 3.1
- */
-public class IOConsoleViewer extends TextConsoleViewer {
- /**
- * will always scroll with output if value is true.
- */
- private boolean fAutoScroll = true;
-
- private IDocumentListener fDocumentListener;
-
- public IOConsoleViewer(Composite parent, TextConsole console) {
- super(parent, console);
- }
-
- public boolean isAutoScroll() {
- return fAutoScroll;
- }
-
- public void setAutoScroll(boolean scroll) {
- fAutoScroll = scroll;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.TextViewer#handleVerifyEvent(org.eclipse.swt.events.VerifyEvent)
- */
- 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;
- }
- }
-
- if (!isCarriageReturn) {
- super.handleVerifyEvent(e);
- return;
- }
- }
-
- int length = doc.getLength();
- if (e.start == length) {
- super.handleVerifyEvent(e);
- } else {
- try {
- doc.replace(length, 0, eventString);
- } catch (BadLocationException e1) {
- }
- e.doit = false;
- }
- } finally {
- StyledText text = (StyledText) e.widget;
- text.setCaretOffset(text.getCharCount());
- }
- }
-
- /**
- * makes the associated text widget uneditable.
- */
- public void setReadOnly() {
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- StyledText text = getTextWidget();
- if (text != null && !text.isDisposed()) {
- text.setEditable(false);
- }
- }
- });
- }
-
- /**
- * @return <code>false</code> if text is editable
- */
- public boolean isReadOnly() {
- return !getTextWidget().getEditable();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.ITextViewer#setDocument(org.eclipse.jface.text.IDocument)
- */
- public void setDocument(IDocument document) {
- IDocument oldDocument= getDocument();
-
- super.setDocument(document);
-
- if (oldDocument != null) {
- oldDocument.removeDocumentListener(getDocumentListener());
- }
- if (document != null) {
- document.addDocumentListener(getDocumentListener());
- }
- }
-
- private IDocumentListener getDocumentListener() {
- if (fDocumentListener == null) {
- fDocumentListener= new IDocumentListener() {
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- public void documentChanged(DocumentEvent event) {
- if (fAutoScroll) {
- revealEndOfDocument();
- }
- }
- };
- }
- return fDocumentListener;
- }
-}
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
deleted file mode 100644
index ab8d900a7..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/OpenConsoleAction.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ToolItem;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.activities.WorkbenchActivityHelper;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsoleFactory;
-
-/**
- * @since 3.1
- */
-public class OpenConsoleAction extends Action implements IMenuCreator {
-
- private ConsoleFactoryExtension[] fFactoryExtensions;
- private Menu fMenu;
-
- public OpenConsoleAction() {
- fFactoryExtensions = ((ConsoleManager)ConsolePlugin.getDefault().getConsoleManager()).getConsoleFactoryExtensions();
- setText(ConsoleMessages.OpenConsoleAction_0);
- setToolTipText(ConsoleMessages.OpenConsoleAction_1);
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_NEW_CON));
- setMenuCreator(this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_OPEN_CONSOLE_ACTION);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- fFactoryExtensions = null;
- }
-
- /*
- * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
- * @since 3.5
- */
- public void runWithEvent(Event event) {
- if (event.widget instanceof ToolItem) {
- ToolItem toolItem= (ToolItem) event.widget;
- Control control= toolItem.getParent();
- Menu menu= getMenu(control);
-
- Rectangle bounds= toolItem.getBounds();
- Point topLeft= new Point(bounds.x, bounds.y + bounds.height);
- menu.setLocation(control.toDisplay(topLeft));
- menu.setVisible(true);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu= new Menu(parent);
- int accel = 1;
- for (int i = 0; i < fFactoryExtensions.length; i++) {
- ConsoleFactoryExtension extension = fFactoryExtensions[i];
- if (!WorkbenchActivityHelper.filterItem(extension) && extension.isEnabled()) {
- String label = extension.getLabel();
- ImageDescriptor image = extension.getImageDescriptor();
- addActionToMenu(fMenu, new ConsoleFactoryAction(label, image, extension), accel);
- accel++;
- }
- }
- return fMenu;
- }
-
- private void addActionToMenu(Menu parent, Action action, int accelerator) {
- if (accelerator < 10) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- label.append(action.getText());
- action.setText(label.toString());
- }
-
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- private class ConsoleFactoryAction extends Action {
-
- private ConsoleFactoryExtension fConfig;
- private IConsoleFactory fFactory;
-
- public ConsoleFactoryAction(String label, ImageDescriptor image, ConsoleFactoryExtension extension) {
- setText(label);
- if (image != null) {
- setImageDescriptor(image);
- }
- fConfig = extension;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- try {
- if (fFactory == null) {
- fFactory = fConfig.createFactory();
- }
-
- fFactory.openConsole();
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event)
- */
- public void runWithEvent(Event event) {
- run();
- }
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java
deleted file mode 100644
index eab75136a..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListener.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.IPatternMatchListenerDelegate;
-import org.eclipse.ui.console.PatternMatchEvent;
-import org.eclipse.ui.console.TextConsole;
-
-public class PatternMatchListener implements IPatternMatchListener {
-
- private PatternMatchListenerExtension fExtension;
- private IPatternMatchListenerDelegate fDelegate;
-
- public PatternMatchListener(PatternMatchListenerExtension extension) throws CoreException {
- fExtension = extension;
- fDelegate = fExtension.createDelegate();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getPattern()
- */
- public String getPattern() {
- return fExtension.getPattern();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getCompilerFlags()
- */
- public int getCompilerFlags() {
- return fExtension.getCompilerFlags();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#matchFound(org.eclipse.ui.console.PatternMatchEvent)
- */
- public void matchFound(PatternMatchEvent event) {
- fDelegate.matchFound(event);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListenerDelegate#connect(org.eclipse.ui.console.TextConsole)
- */
- public void connect(TextConsole console) {
- fDelegate.connect(console);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#disconnect()
- */
- public void disconnect() {
- fDelegate.disconnect();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getQuickPattern()
- */
- public String getLineQualifier() {
- return fExtension.getQuickPattern();
- }
-
-}
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
deleted file mode 100644
index b4081dfe6..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PatternMatchListenerExtension.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import java.lang.reflect.Field;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.Expression;
-import org.eclipse.core.expressions.ExpressionConverter;
-import org.eclipse.core.expressions.ExpressionTagNames;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.ui.IPluginContribution;
-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 {
-
- private IConfigurationElement fConfig;
- private Expression fEnablementExpression;
- private String fPattern;
- private String fQualifier;
- private int fFlags = -1;
-
- public PatternMatchListenerExtension(IConfigurationElement extension) {
- fConfig = extension;
- }
-
- /*
- * returns the integer value of the flags defined in java.util.regex.Pattern.
- * Both <code>Pattern.MULTILINE</code> and <code>MULTILINE</code> will return
- * the same value.
- */
- public int parseFlags(String flagsElement) {
- int val = 0;
- if (flagsElement == null) {
- return val;
- }
-
- try {
- flagsElement = flagsElement.replaceAll("Pattern.", ""); //$NON-NLS-1$ //$NON-NLS-2$
- String[] tokens = flagsElement.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]);
- val |= field.getInt(null);
- }
- } catch (ClassNotFoundException e) {
- ConsolePlugin.log(e);
- } catch (NoSuchFieldException e) {
- ConsolePlugin.log(e);
- } catch (IllegalAccessException e) {
- ConsolePlugin.log(e);
- }
- return val;
- }
-
- public boolean isEnabledFor(IConsole console) throws CoreException {
- EvaluationContext context = new EvaluationContext(null, console);
- EvaluationResult evaluationResult = getEnablementExpression().evaluate(context);
- return evaluationResult == EvaluationResult.TRUE;
- }
-
- public IPatternMatchListenerDelegate createDelegate() throws CoreException {
- return (IPatternMatchListenerDelegate) fConfig.createExecutableExtension("class"); //$NON-NLS-1$
- }
-
- public Expression getEnablementExpression() throws CoreException {
- if (fEnablementExpression == null) {
- IConfigurationElement[] elements = fConfig.getChildren(ExpressionTagNames.ENABLEMENT);
- if (elements.length == 0) {
- String message = MessageFormat.format("{0} " +getLocalId() + " {1} " + getPluginId() + " {2}", new String[] {ConsoleMessages.PatternMatchListenerExtension_3,ConsoleMessages.PatternMatchListenerExtension_4,ConsoleMessages.PatternMatchListenerExtension_5}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ConsolePlugin.log(new Status(IStatus.WARNING, ConsolePlugin.getUniqueIdentifier(), IStatus.OK, message, null));
- }
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null) {
- fEnablementExpression = ExpressionConverter.getDefault().perform(enablement);
- }
- }
- return fEnablementExpression;
- }
-
- /*
- * returns the regular expression to be matched.
- */
- public String getPattern() {
- if (fPattern == null) {
- fPattern = fConfig.getAttribute("regex"); //$NON-NLS-1$
- try {
- fPattern = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fPattern, false);
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return fPattern;
- }
-
- /*
- * returns the flags to be used by <code>Pattern.compile(pattern, flags)</code>
- */
- public int getCompilerFlags() {
- if(fFlags < 0) {
- String flagsAttribute = fConfig.getAttribute("flags"); //$NON-NLS-1$
- fFlags = parseFlags(flagsAttribute);
- }
- return fFlags;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getLocalId()
- */
- public String getLocalId() {
- return fConfig.getAttribute("id"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPluginContribution#getPluginId()
- */
- public String getPluginId() {
- return fConfig.getContributor().getName();
- }
-
- public String getQuickPattern() {
- if (fQualifier == null) {
- fQualifier = fConfig.getAttribute("qualifier"); //$NON-NLS-1$
- try {
- if (fQualifier != null) {
- fQualifier = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(fQualifier, false);
- }
- } catch (CoreException e) {
- ConsolePlugin.log(e);
- }
- }
- return fQualifier;
- }
-}
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
deleted file mode 100644
index 61d307407..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/PinConsoleAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Pins the currently visible console in a console view.
- */
-public class PinConsoleAction extends Action implements IUpdate {
-
- private IConsoleView fView = null;
-
- /**
- * Constructs a 'pin console' action
- */
- public PinConsoleAction(IConsoleView view) {
- super(ConsoleMessages.PinConsoleAction_0, IAction.AS_CHECK_BOX);
- setToolTipText(ConsoleMessages.PinConsoleAction_1);
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_PIN));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_PIN));
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_PIN));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_PIN_CONSOLE_ACITON);
- fView = view;
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- fView.setPinned(isChecked());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- setEnabled(fView.getConsole() != null);
- setChecked(fView.isPinned());
- }
-}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java
deleted file mode 100644
index e0b2ad268..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ScrollLockAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.IConsoleView;
-
-/**
- * Toggles console auto-scroll
- *
- * @since 3.1
- */
-public class ScrollLockAction extends Action {
-
- private IConsoleView fConsoleView;
-
- public ScrollLockAction(IConsoleView consoleView) {
- super(ConsoleMessages.ScrollLockAction_0);
- fConsoleView = consoleView;
-
- setToolTipText(ConsoleMessages.ScrollLockAction_1);
- setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_LOCK));
- setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_LOCK));
- setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_LOCK));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_SCROLL_LOCK_ACTION);
- boolean checked = fConsoleView.getScrollLock();
- setChecked(checked);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- fConsoleView.setScrollLock(isChecked());
- }
-
- public void dispose() {
- fConsoleView = null;
- }
-
-}
-
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java
deleted file mode 100644
index ed846b0cf..000000000
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ShowConsoleAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.console;
-
-import org.eclipse.jface.action.Action;
-
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleView;
-
-/**
- * Shows a specific console in the console view
- */
-public class ShowConsoleAction extends Action {
-
- private IConsole fConsole;
- private IConsoleView fView;
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- showConsole(fConsole, fView);
- }
-
- /**
- * Shows the given console in the given console view.
- *
- * @param console the console to show
- * @param consoleView the console view
- */
- public static void showConsole(IConsole console, IConsoleView consoleView) {
- if (!console.equals(consoleView.getConsole())) {
- boolean pinned = consoleView.isPinned();
- if (pinned) {
- consoleView.setPinned(false);
- }
- consoleView.display(console);
- if (pinned) {
- consoleView.setPinned(true);
- }
- }
- }
-
- /**
- * Constructs an action to display the given console.
- *
- * @param view the console view in which the given console is contained
- * @param console the console
- */
- public ShowConsoleAction(IConsoleView view, IConsole console) {
- super(console.getName(), AS_RADIO_BUTTON);
- fConsole = console;
- fView = view;
- setImageDescriptor(console.getImageDescriptor());
- }
-}

Back to the top