Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugModelPresentationContext.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties45
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/IDebugExceptionHandler.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java103
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java1122
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java201
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java118
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java198
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java156
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java63
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java456
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java108
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java60
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java210
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java135
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java269
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java83
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java109
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java791
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java186
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java447
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizer.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/OtherBreakpointCategory.java95
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java99
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java137
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java161
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java96
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java139
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java52
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java105
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java828
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java331
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java269
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardErrorAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardOutAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java86
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java511
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java272
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java117
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java287
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java239
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java78
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/Decoration.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DecorationManager.java95
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/ImageImageDescriptor.java51
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java1392
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java518
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java53
-rwxr-xr-xorg.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java39
-rwxr-xr-xorg.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties27
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditor.java109
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java95
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/StandardDecoration.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java430
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java430
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingAction.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java89
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java586
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java92
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryView.java38
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewPane.java97
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewTab.java65
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/LinkRenderingPanesAction.java76
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java570
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java857
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewIdRegistry.java63
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewPrefAction.java62
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewSynchronizationService.java429
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTab.java255
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeModelContentProvider.java104
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewTreeViewer.java47
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryViewUtil.java265
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MonitorMemoryBlockDialog.java167
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/NewMemoryViewAction.java107
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/PinMemoryBlockAction.java47
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/PropertyChangeNotifier.java49
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RemoveMemoryRenderingAction.java77
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RemoveRenderingContextAction.java88
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RenderingViewPane.java1276
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockAction.java92
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ResetMemoryBlockPreferencePage.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/RetargetAddMemoryBlockAction.java115
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SetPaddedStringPreferencePage.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SwitchMemoryBlockAction.java410
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/SynchronizeInfo.java115
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleMemoryMonitorsAction.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleSplitPaneAction.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ToggleViewPaneAction.java101
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneOrientationAction.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneRenderingMgr.java407
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewPaneSelectionProvider.java77
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/ViewTabEnablementManager.java103
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/ASCIIRendering.java123
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/ASCIIRenderingTypeDelegate.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractBaseTableRendering.java175
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractIntegerRendering.java79
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractTableRenderingLabelProvider.java107
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AbstractVirtualContentTableModel.java85
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncCopyTableRenderingAction.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncPrintTableRenderingAction.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingCellModifier.java283
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingUpdatePolicy.java195
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncTableRenderingViewer.java1041
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/AsyncVirtualContentTableViewer.java483
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BasicDebugViewContentProvider.java123
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/BigEndianAction.java101
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CopyTableRenderingToClipboardAction.java189
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/CreateRendering.java362
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/DefaultEndianessAction.java70
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/ErrorRendering.java90
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingAction.java47
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/FormatTableRenderingDialog.java563
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressAction.java206
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressComposite.java174
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/GoToAddressDialog.java148
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRendering.java105
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexIntegerRenderingDelegate.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexRendering.java71
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/HexRenderingTypeDelegate.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/IContentChangeComputer.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/IPresentationErrorListener.java20
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/IVirtualContentListener.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/LittleEndianAction.java104
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/MemorySegment.java84
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PendingPropertyChanges.java79
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/PrintTableRenderingAction.java196
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/ReformatAction.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/RenderingsUtil.java580
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/ResetToBaseAddressAction.java87
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRendering.java213
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/SignedIntegerRenderingTypeDelegate.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingCellModifier.java260
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentDescriptor.java212
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentInput.java205
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingContentProvider.java989
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProvider.java101
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLabelProviderEx.java158
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingLine.java305
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingModel.java484
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPrefAction.java60
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPreferencePage.java219
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/TableRenderingPropertiesPage.java175
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRendering.java241
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/renderings/UnsignedIntegerRenderingTypeDelegate.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/IHelpContextIdProvider.java35
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesView.java195
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesViewMessages.java30
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/modules/ModulesViewMessages.properties15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersView.java62
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.java25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/registers/RegistersViewMessages.properties11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/AvailableLogicalStructuresAction.java172
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/IndexedValuePartition.java138
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/IndexedVariablePartition.java181
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/LogicalStructureCache.java153
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectLogicalStructureAction.java77
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/SelectionDragAdapter.java80
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleLogicalStructureAction.java73
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/ToggleShowColumnsAction.java66
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariableViewToggleAction.java129
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java1218
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewMessages.properties25
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesViewResourceBundleMessages.properties14
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AbstractDetailPane.java175
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/AvailableDetailPanesAction.java157
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java984
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPaneFactory.java77
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.properties28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java510
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java229
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/IDetailPaneContainer.java69
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/IDetailPaneContainer2.java29
184 files changed, 0 insertions, 34933 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugModelPresentationContext.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugModelPresentationContext.java
deleted file mode 100644
index 5b4f63d85..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugModelPresentationContext.java
+++ /dev/null
@@ -1,41 +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.debug.internal.ui.views;
-
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-
-/**
- * A presentation context that has a debug model presentation.
- *
- * @since 3.3
- */
-public class DebugModelPresentationContext extends PresentationContext {
-
- private IDebugModelPresentation fPresentation;
-
- /**
- * Constructs a presentation context for the given id using the
- * specified model presentation.
- *
- * @param id context id
- * @param presentation debug model presentation
- */
- public DebugModelPresentationContext(String id, IDebugModelPresentation presentation) {
- super(id);
- fPresentation = presentation;
- }
-
- public IDebugModelPresentation getModelPresentation() {
- return fPresentation;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
deleted file mode 100644
index 5de6573a6..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
+++ /dev/null
@@ -1,59 +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.debug.internal.ui.views;
-
-import org.eclipse.osgi.util.NLS;
-
-public class DebugUIViewsMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.DebugUIViewsMessages";//$NON-NLS-1$
-
- public static String LaunchView_Error_1;
- public static String LaunchView_Exception_occurred_opening_editor_for_debugger__2;
- public static String LaunchView_Terminate_and_Remove_1;
- public static String LaunchView_Terminate_and_remove_selected__2;
- public static String LaunchView_Exceptions_occurred_attempting_to_terminate_and_remove_3;
- public static String LaunchView_Terminate_and_Remove_4;
- public static String LaunchView_Terminate_and_remove_failed_5;
-
- public static String SourceNotFoundEditorInput_Source_Not_Found_1;
- public static String SourceNotFoundEditorInput_Source_not_found_for__0__2;
-
- public static String BreakpointsView_6;
- public static String BreakpointsView_7;
- public static String BreakpointsView_8;
- public static String BreakpointsView_9;
- public static String BreakpointsView_0;
- public static String BreakpointsView_10;
- public static String BreakpointsView_11;
- public static String BreakpointsView_1;
- public static String BreakpointWorkingSetPage_0;
- public static String BreakpointWorkingSetPage_1;
- public static String BreakpointWorkingSetPage_2;
- public static String BreakpointWorkingSetPage_3;
- public static String BreakpointWorkingSetPage_4;
- public static String BreakpointWorkingSetPage_5;
- public static String BreakpointWorkingSetPage_6;
- public static String BreakpointWorkingSetPage_selectAll_label;
- public static String BreakpointWorkingSetPage_selectAll_toolTip;
- public static String BreakpointWorkingSetPage_deselectAll_label;
- public static String BreakpointWorkingSetPage_deselectAll_toolTip;
- public static String OtherBreakpointOrganizer_0;
- public static String WorkingSetCategory_0;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, DebugUIViewsMessages.class);
- }
-
- public static String InspectPopupDialog_0;
-
- public static String InspectPopupDialog_1;
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties
deleted file mode 100644
index dfbf22b8d..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties
+++ /dev/null
@@ -1,45 +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
-###############################################################################
-
-LaunchView_Error_1=Error
-LaunchView_Exception_occurred_opening_editor_for_debugger__2=Exception occurred opening editor for debugger.
-LaunchView_Terminate_and_Remove_1=Terminate and Remove
-LaunchView_Terminate_and_remove_selected__2=Terminate and remove selected?
-LaunchView_Exceptions_occurred_attempting_to_terminate_and_remove_3=Exceptions occurred attempting to terminate and remove
-LaunchView_Terminate_and_Remove_4=Terminate and Remove
-LaunchView_Terminate_and_remove_failed_5=Terminate and remove failed
-
-SourceNotFoundEditorInput_Source_Not_Found_1=Source Not Found
-SourceNotFoundEditorInput_Source_not_found_for__0__2=Source not found for {0}
-
-BreakpointsView_6=Enabling
-BreakpointsView_7=Disabling
-BreakpointsView_8=enable
-BreakpointsView_9=disable
-BreakpointsView_0=Enable Breakpoint
-BreakpointsView_10=Error {0} Breakpoint
-BreakpointsView_11=An exception occurred while attempting to {0} the breakpoint.
-BreakpointsView_1=Disable Breakpoint
-BreakpointWorkingSetPage_0=Breakpoint Working Set
-BreakpointWorkingSetPage_1=Enter a working set name and select breakpoints.
-BreakpointWorkingSetPage_2=&Working set name:
-BreakpointWorkingSetPage_3=Brea&kpoints:
-BreakpointWorkingSetPage_4=The name must not have leading or trailing whitespace
-BreakpointWorkingSetPage_5=The name must not be empty
-BreakpointWorkingSetPage_6=A working set with that name already exists
-BreakpointWorkingSetPage_selectAll_label=Select &All
-BreakpointWorkingSetPage_selectAll_toolTip=Select all of the breakpoints for this working set.
-BreakpointWorkingSetPage_deselectAll_label=Dese&lect All
-BreakpointWorkingSetPage_deselectAll_toolTip=Deselect all of the breakpoints for this working set.
-OtherBreakpointOrganizer_0=Others
-WorkingSetCategory_0=\ (default)
-InspectPopupDialog_0=Move to Expressions View
-InspectPopupDialog_1=Press {0} to {1}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/IDebugExceptionHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/IDebugExceptionHandler.java
deleted file mode 100644
index 4bc7087b0..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/IDebugExceptionHandler.java
+++ /dev/null
@@ -1,28 +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.debug.internal.ui.views;
-
-
-import org.eclipse.debug.core.DebugException;
-
-/**
- * A plugable exception handler.
- */
-public interface IDebugExceptionHandler {
-
- /**
- * Handles the given debug exception.
- *
- * @param e debug exception
- */
- public abstract void handleException(DebugException e);
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java
deleted file mode 100644
index 06d46048e..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextManager.java
+++ /dev/null
@@ -1,103 +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
- * Wind River - Pawel Piech - Fixed debug context service usage (Bug 258189)
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Manages the view context services for each window.
- *
- * @since 3.2
- */
-public class ViewContextManager implements IWindowListener {
-
- /**
- * Map of services
- */
- private Map fWindowToService = new HashMap();
-
- // singleton manager
- private static ViewContextManager fgManager;
-
- /**
- * Returns the singleton view context manager.
- *
- * @return view manager
- */
- public static ViewContextManager getDefault() {
- if (fgManager == null) {
- fgManager = new ViewContextManager();
- }
- return fgManager;
- }
-
-
- private ViewContextManager() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchWindow window = workbenchWindows[i];
- windowOpened(window);
- }
- workbench.addWindowListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
- */
- public void windowActivated(IWorkbenchWindow window) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
- */
- public void windowDeactivated(IWorkbenchWindow window) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
- */
- public void windowClosed(IWorkbenchWindow window) {
- ViewContextService service = (ViewContextService) fWindowToService.get(window);
- if (service != null) {
- service.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
- */
- public void windowOpened(IWorkbenchWindow window) {
- ViewContextService service = (ViewContextService) fWindowToService.get(window);
- if (service == null) {
- service = new ViewContextService(window);
- fWindowToService.put(window, service);
- }
- }
-
- /**
- * Returns the service for the given window, or <code>null</code> if none.
- *
- * @param window
- * @return view context service or <code>null</code>
- */
- public ViewContextService getService(IWorkbenchWindow window) {
- return (ViewContextService) fWindowToService.get(window);
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
deleted file mode 100644
index ce6e77d89..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java
+++ /dev/null
@@ -1,1122 +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
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views;
-
-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 java.util.StringTokenizer;
-import java.util.Map.Entry;
-
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.core.commands.contexts.Context;
-import org.eclipse.core.commands.contexts.ContextManagerEvent;
-import org.eclipse.core.commands.contexts.IContextManagerListener;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.contexts.DebugModelContextBindingManager;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.debug.ui.contexts.IDebugContextService;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener4;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.contexts.IContextService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Performs view management for a window.
- *
- * @since 3.2
- */
-public class ViewContextService implements IDebugContextListener, IPerspectiveListener4, IPropertyChangeListener, IContextManagerListener {
-
- /**
- * Maps the perspectives in this window to its last activated workbench context
- */
- private Map fPerspectiveToActiveContext = new HashMap();
-
- /**
- * Map of the perspectives to all workbench contexts activated in that perspective
- */
- private Map fPerspectiveToActivatedContexts = new HashMap();
-
- /**
- * Map of context id's to context view bindings
- */
- private Map fContextIdsToBindings;
-
- /**
- * List of perspectives that debugging is allowed in
- */
- private Set fEnabledPerspectives = new HashSet();
-
- /**
- * Whether to ignore perspective change call backs (set to
- * true when this class is modifying views).
- */
- private boolean fIgnoreChanges = false;
-
- /**
- * The window this service is working for
- */
- private IWorkbenchWindow fWindow;
-
- private IContextService fContextService;
-
- private IDebugContextService fDebugContextService;
-
- // base debug context
- public static final String DEBUG_CONTEXT= "org.eclipse.debug.ui.debugging"; //$NON-NLS-1$
-
- // extension points
- private static final String ID_CONTEXT_VIEW_BINDINGS= "contextViewBindings"; //$NON-NLS-1$
-
- // extension elements
- private static final String ELEM_CONTEXT_VIEW_BINDING= "contextViewBinding"; //$NON-NLS-1$
- private static final String ELEM_PERSPECTIVE= "perspective"; //$NON-NLS-1$
-
- // extension attributes
- private static final String ATTR_CONTEXT_ID= "contextId"; //$NON-NLS-1$
- private static final String ATTR_VIEW_ID= "viewId"; //$NON-NLS-1$
- private static final String ATTR_AUTO_OPEN= "autoOpen"; //$NON-NLS-1$
- private static final String ATTR_AUTO_CLOSE= "autoClose"; //$NON-NLS-1$
- private static final String ATTR_PERSPECTIVE_ID= "perspectiveId"; //$NON-NLS-1$
-
- // XML tags
- private static final String XML_ELEMENT_VIEW_BINDINGS ="viewBindings"; //$NON-NLS-1$
- private static final String XML_ELEMENT_PERSPECTIVE ="perspective"; //$NON-NLS-1$
- private static final String XML_ELEMENT_VIEW = "view"; //$NON-NLS-1$
- private static final String XML_ATTR_ID = "id"; //$NON-NLS-1$
- private static final String XML_ATTR_USER_ACTION = "userAction"; //$NON-NLS-1$
- private static final String XML_VALUE_OPENED = "opened"; //$NON-NLS-1$
- private static final String XML_VALUE_CLOSED = "closed"; //$NON-NLS-1$
-
- // ids of base debug views in debug perspective that should not be auto-closed
- private static Set fgBaseDebugViewIds = null;
-
- static {
- fgBaseDebugViewIds = new HashSet();
- fgBaseDebugViewIds.add(IDebugUIConstants.ID_DEBUG_VIEW);
- fgBaseDebugViewIds.add(IDebugUIConstants.ID_VARIABLE_VIEW);
- fgBaseDebugViewIds.add(IDebugUIConstants.ID_BREAKPOINT_VIEW);
- fgBaseDebugViewIds.add(IConsoleConstants.ID_CONSOLE_VIEW);
- }
-
- private static String[] EMPTY_IDS = new String[0];
-
- /**
- * View bindings for a debug context
- */
- private class DebugContextViewBindings {
-
- // context id
- private String fId;
-
- // list of view bindings id's specific to this context
- private String[] fViewBindingIds = EMPTY_IDS;
-
- // all bindings including inherited bindings, top down in activation order
- private String[] fAllViewBindingIds = null;
- // associated binding to activate
- private Map fAllViewIdToBindings = new HashMap();
- // all context id's in this context hierarchy (top down order)
- private String[] fAllConetxtIds = null;
-
- // id of parent context
- private String fParentId;
-
- /**
- * Constructs an empty view binding for the given context.
- *
- * @param id context id
- */
- public DebugContextViewBindings(String id) {
- fId = id;
- }
-
- /**
- * Returns the context id for these view bindings
- *
- * @return context id
- */
- public String getId() {
- return fId;
- }
-
- /**
- * Adds the given view binding to this context
- *
- * @param binding view binding to add
- */
- public void addBinding(ViewBinding binding) {
- String[] newBindings = new String[fViewBindingIds.length + 1];
- System.arraycopy(fViewBindingIds, 0, newBindings, 0, fViewBindingIds.length);
- newBindings[fViewBindingIds.length] = binding.getViewId();
- fAllViewIdToBindings.put(binding.getViewId(), binding);
- fViewBindingIds = newBindings;
- }
-
- /**
- * Sets the parent id of this view bindings
- *
- * @param id parent context id
- */
- protected void setParentId(String id) {
- fParentId = id;
- }
-
- /**
- * Returns the id of parent context
- *
- * @return parent context id
- */
- public DebugContextViewBindings getParentContext() {
- if (fParentId == null) {
- return null;
- }
- return (DebugContextViewBindings) fContextIdsToBindings.get(fParentId);
- }
-
- /**
- * Activates the views in this context hierarchy. Views are activated top down, allowing
- * sub-contexts to override settings in a parent context.
- */
- public void activateChain(IWorkbenchPage page) {
- initializeChain();
- doActivation(page, fAllViewBindingIds, fAllConetxtIds);
- }
-
- /**
- * Activates the view bindings for the specified views and the
- * specified contexts in the given page.
- *
- * @param page page to activate views in
- * @param viewIds id's of views to activate
- * @param contextIds associated contexts that are activated
- */
- private void doActivation(IWorkbenchPage page, String[] viewIds, String[] contextIds) {
- // note activation of all the relevant contexts
- for (int i = 0; i < contextIds.length; i++) {
- addActivated(contextIds[i]);
- }
- // set the active context to be this
- setActive(page.getPerspective(), getId());
- // activate the view bindings
- for (int i = 0; i < viewIds.length; i++) {
- String viewId = viewIds[i];
- ViewBinding binding = (ViewBinding) fAllViewIdToBindings.get(viewId);
- binding.activated(page);
- }
- // bring most relevant views to top
- for (int i = 0; i < viewIds.length; i++) {
- String viewId = viewIds[i];
- ViewBinding binding = (ViewBinding) fAllViewIdToBindings.get(viewId);
- binding.checkZOrder(page, fAllViewBindingIds);
- }
- }
-
- /**
- * Builds the top down ordered list of bindings for this context allowing sub-contexts
- * to override parent settings.
- */
- private synchronized void initializeChain() {
- if (fAllViewBindingIds == null) {
- List orderedIds = new ArrayList();
- List contexts = new ArrayList();
- DebugContextViewBindings context = this;
- while (context != null) {
- contexts.add(0, context);
- context = context.getParentContext();
- }
- Iterator iterator = contexts.iterator();
- fAllConetxtIds = new String[contexts.size()];
- int pos = 0;
- while (iterator.hasNext()) {
- DebugContextViewBindings bindings = (DebugContextViewBindings) iterator.next();
- fAllConetxtIds[pos] = bindings.getId();
- pos++;
- for (int i = 0; i < bindings.fViewBindingIds.length; i++) {
- String viewId = bindings.fViewBindingIds[i];
- if (bindings == this) {
- orderedIds.add(viewId);
- }
- if (!fAllViewIdToBindings.containsKey(viewId)) {
- orderedIds.add(viewId);
- fAllViewIdToBindings.put(viewId, bindings.fAllViewIdToBindings.get(viewId));
- }
- }
- }
- fAllViewBindingIds = (String[]) orderedIds.toArray(new String[orderedIds.size()]);
- }
- }
-
- /**
- * Deactivates this context only (not parents)
- *
- * @param page workbench page
- */
- public void deactivate(IWorkbenchPage page) {
- removeActivated(getId());
- if (isActiveContext(getId())) {
- setActive(page.getPerspective(), null);
- }
- for (int i = 0; i < fViewBindingIds.length; i++) {
- String viewId = fViewBindingIds[i];
- ViewBinding binding = (ViewBinding) fAllViewIdToBindings.get(viewId);
- binding.deactivated(page);
- }
- }
-
- /**
- * Notes when a view is opened/closed manually.
- *
- * @param opened opened or closed
- * @param viewId
- */
- public void setViewOpened(boolean opened, String viewId) {
- initializeChain();
- ViewBinding binding = (ViewBinding)fAllViewIdToBindings.get(viewId);
- if (binding != null) {
- if (opened) {
- binding.userOpened();
- } else {
- binding.userClosed();
- }
- }
- }
-
- public void applyUserSettings(String viewId, Element viewElement) {
- initializeChain();
- ViewBinding binding = (ViewBinding) fAllViewIdToBindings.get(viewId);
- if (binding != null) {
- binding.applyUserSettings(viewElement);
- }
- }
-
- /**
- * Save view binding settings into XML document.
- *
- * @param document
- * @param root
- * @param alreadyDone views already done
- */
- public void saveBindings(Document document, Element root, Set alreadyDone) {
- for (int i = 0; i < fViewBindingIds.length; i++) {
- String viewId = fViewBindingIds[i];
- if (!alreadyDone.contains(viewId)) {
- alreadyDone.add(viewId);
- ViewBinding binding = (ViewBinding) fAllViewIdToBindings.get(viewId);
- binding.saveBindings(document, root);
- }
- }
- }
- }
-
- /**
- * Information for a view
- */
- private class ViewBinding {
- private IConfigurationElement fElement;
- /**
- * Set of perspectives this view was opened in by the user
- */
- private Set fUserOpened = new HashSet();
- /**
- * Set of perspectives this view was closed in by the user
- */
- private Set fUserClosed = new HashSet();
-
- public ViewBinding(IConfigurationElement element) {
- fElement = element;
- }
-
- /**
- * Returns the id of the view this binding pertains to.
- *
- * @return
- */
- public String getViewId() {
- return fElement.getAttribute(ATTR_VIEW_ID);
- }
-
- /**
- * Returns whether this view binding is set for auto-open.
- *
- * @return
- */
- public boolean isAutoOpen() {
- String autoopen = fElement.getAttribute(ATTR_AUTO_OPEN);
- return autoopen == null || "true".equals(autoopen); //$NON-NLS-1$
- }
-
- /**
- * Returns whether this view binding is set for auto-close.
- *
- * @return
- */
- public boolean isAutoClose() {
- String autoclose = fElement.getAttribute(ATTR_AUTO_CLOSE);
- return autoclose == null || "true".equals(autoclose); //$NON-NLS-1$
- }
-
- /**
- * Returns whether this view was opened by the user in the active perspective.
- * @return
- */
- public boolean isUserOpened() {
- return fUserOpened.contains(getActivePerspective().getId());
- }
-
- /**
- * Returns whether this view was closed by the user in the active perspective
- * @return
- */
- public boolean isUserClosed() {
- return fUserClosed.contains(getActivePerspective().getId());
- }
-
- /**
- * Returns whether this view is part of the active perspective by default
- *
- * TODO: we really need an API to determine which views are
- * in a perspective by default, but it does not seem to exist.
- *
- * @return
- */
- public boolean isDefault() {
- String id = getActivePerspective().getId();
- if (IDebugUIConstants.ID_DEBUG_PERSPECTIVE.equals(id)) {
- return fgBaseDebugViewIds.contains(getViewId());
- }
- return false;
- }
-
- protected void userOpened() {
- if (isTrackingViews()) {
- String id = getActivePerspective().getId();
- fUserOpened.add(id);
- fUserClosed.remove(id);
- saveViewBindings();
- }
- }
-
- protected void userClosed() {
- if (isTrackingViews()) {
- String id = getActivePerspective().getId();
- fUserClosed.add(id);
- fUserOpened.remove(id);
- saveViewBindings();
- }
- }
-
- /**
- * Returns whether the preference is set to track user view open/close.
- *
- * @return
- */
- protected boolean isTrackingViews() {
- return DebugUITools.getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TRACK_VIEWS);
- }
-
- /**
- * Context has been activated, open/show as required.
- *
- * @param page
- */
- public void activated(IWorkbenchPage page) {
- if (!isUserClosed()) {
- if (isAutoOpen()) {
- try {
- fIgnoreChanges = true;
- page.showView(getViewId(), null, IWorkbenchPage.VIEW_CREATE);
- } catch (PartInitException e) {
- DebugUIPlugin.log(e);
- } finally {
- fIgnoreChanges = false;
- }
- }
- }
- }
-
- /**
- * Context has been activated. Check the view stack to see if this view
- * should be made visible.
- *
- * @param page
- */
- public void checkZOrder(IWorkbenchPage page, String[] relevantViews) {
- // see if view is open already
- IViewPart part = page.findView(getViewId());
- if (part != null) {
- IViewPart[] viewStack = page.getViewStack(part);
- if (viewStack != null && viewStack.length > 0) {
- String top = viewStack[0].getSite().getId();
- for (int i = 0; i < relevantViews.length; i++) {
- if (relevantViews[i].equals(top)) {
- // a relevant view is visible
- return;
- }
- }
- // an irrelevant view is visible
- try {
- fIgnoreChanges = true;
- page.bringToTop(part);
- } finally {
- fIgnoreChanges = false;
- }
- }
- }
- }
-
- /**
- * Context has been deactivated, close as required.
- *
- * @param page
- */
- public void deactivated(IWorkbenchPage page) {
- if (!isUserOpened()) {
- if (isAutoClose() && !isDefault()) {
- IViewReference reference = page.findViewReference(getViewId());
- if (reference != null) {
- try {
- fIgnoreChanges = true;
- page.hideView(reference);
- } finally {
- fIgnoreChanges = false;
- }
- }
- }
- }
- }
-
- /**
- * Save view binding settings into XML document.
- *
- * @param document
- * @param root
- */
- public void saveBindings(Document document, Element root) {
- Element viewElement = document.createElement(XML_ELEMENT_VIEW);
- viewElement.setAttribute(XML_ATTR_ID, getViewId());
- appendPerspectives(document, viewElement, fUserOpened, XML_VALUE_OPENED);
- appendPerspectives(document, viewElement, fUserClosed, XML_VALUE_CLOSED);
- if (viewElement.hasChildNodes()) {
- root.appendChild(viewElement);
- }
- }
-
- private void appendPerspectives(Document document, Element parent, Set perpectives, String xmlValue) {
- String[] ids = (String[]) perpectives.toArray(new String[perpectives.size()]);
- for (int i = 0; i < ids.length; i++) {
- String id = ids[i];
- Element element = document.createElement(XML_ELEMENT_PERSPECTIVE);
- element.setAttribute(XML_ATTR_ID, id);
- element.setAttribute(XML_ATTR_USER_ACTION, xmlValue);
- parent.appendChild(element);
- }
- }
-
- public void applyUserSettings(Element viewElement) {
- NodeList list = viewElement.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- if(entry.getNodeName().equalsIgnoreCase(XML_ELEMENT_PERSPECTIVE)){
- String id = entry.getAttribute(XML_ATTR_ID);
- String setting = entry.getAttribute(XML_ATTR_USER_ACTION);
- if (id != null) {
- if (XML_VALUE_CLOSED.equals(setting)) {
- fUserClosed.add(id);
- } else if (XML_VALUE_OPENED.equals(setting)) {
- fUserOpened.add(id);
- }
- }
- }
- }
- }
- }
- }
-
- private IDebugContextService getDebugContextService() {
- return fDebugContextService;
- }
-
- /**
- * Creates a service for the given window
- *
- * @param window
- */
- ViewContextService(IWorkbenchWindow window) {
- fWindow = window;
- fContextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
- fDebugContextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
- loadContextToViewExtensions();
- applyUserViewBindings();
- loadPerspectives();
- window.addPerspectiveListener(this);
- getDebugContextService().addDebugContextListener(this);
- DebugUIPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(this);
- fContextService.addContextManagerListener(this);
- }
-
- public void dispose() {
- fWindow.removePerspectiveListener(this);
- getDebugContextService().removeDebugContextListener(this);
- DebugUIPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(this);
- fContextService.removeContextManagerListener(this);
- }
-
- /**
- * Loads extensions which map context id's to view bindings.
- */
- private void loadContextToViewExtensions() {
- fContextIdsToBindings = new HashMap();
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_CONTEXT_VIEW_BINDINGS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
- if ( ELEM_CONTEXT_VIEW_BINDING.equals(element.getName()) ) {
- String viewId = element.getAttribute(ATTR_VIEW_ID);
- String contextId = element.getAttribute(ATTR_CONTEXT_ID);
- if (contextId == null || viewId == null) {
- continue;
- }
- ViewBinding info = new ViewBinding(element);
- DebugContextViewBindings bindings = (DebugContextViewBindings) fContextIdsToBindings.get(contextId);
- if (bindings == null) {
- bindings = new DebugContextViewBindings(contextId);
- fContextIdsToBindings.put(contextId, bindings);
- }
- bindings.addBinding(info);
- }
- }
- linkParentContexts();
- }
-
- /**
- * Applies user settings that modify view binding extensions.
- */
- private void applyUserViewBindings() {
- String xml = DebugUITools.getPreferenceStore().getString(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS);
- if (xml.length() > 0) {
- try {
- Element root = DebugPlugin.parseDocument(xml);
- NodeList list = root.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short type = node.getNodeType();
- if (type == Node.ELEMENT_NODE) {
- Element entry = (Element) node;
- if(entry.getNodeName().equalsIgnoreCase(XML_ELEMENT_VIEW)){
- String id = entry.getAttribute(XML_ATTR_ID);
- Iterator bindings = fContextIdsToBindings.values().iterator();
- while (bindings.hasNext()) {
- DebugContextViewBindings binding = (DebugContextViewBindings) bindings.next();
- binding.applyUserSettings(id, entry);
- }
- }
- }
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
-
- /**
- * Load the collection of perspectives in which view management will occur from the preference store.
- */
- private void loadPerspectives() {
- String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString(
- IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
- if (IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT.equals(preference)) {
- fEnabledPerspectives = getDefaultEnabledPerspectives();
- } else {
- fEnabledPerspectives = parseList(preference);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (!fIgnoreChanges) {
- if (IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES.equals(event.getProperty())) {
- loadPerspectives();
- } else if (IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS.equals(event.getProperty())) {
- loadContextToViewExtensions();
- applyUserViewBindings();
- // clear activations to re-enable activation based on new settings
- fPerspectiveToActivatedContexts.clear();
- ISelection selection = getDebugContextService().getActiveContext();
- contextActivated(selection);
- }
- }
- }
-
- /**
- * Returns whether this service's window's active perspective supports view management.
- *
- * @return whether this service's window's active perspective supports view management
- */
- private boolean isEnabledPerspective() {
- IPerspectiveDescriptor perspective = getActivePerspective();
- if (perspective != null) {
- return fEnabledPerspectives.contains(perspective.getId());
- }
- return false;
- }
-
- /**
- * Returns the active perspective in this service's window, or <code>null</code>
- *
- * @return active perspective or <code>null</code>
- */
- private IPerspectiveDescriptor getActivePerspective() {
- IWorkbenchPage activePage = fWindow.getActivePage();
- if (activePage != null) {
- return activePage.getPerspective();
- }
- return null;
- }
-
- /**
- * Parses the comma separated string into a list of strings
- *
- * @return list
- */
- public static Set parseList(String listString) {
- Set list = new HashSet(10);
- StringTokenizer tokenizer = new StringTokenizer(listString, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken();
- list.add(token);
- }
- return list;
- }
-
- /**
- * Calculates the default set of perspectives enabled for view management
- * based on the contextViewBindings extension point.
- *
- * @return set of enabled perspectives.
- *
- * @since 3.5
- */
- public static Set getDefaultEnabledPerspectives() {
- Set perspectives = new HashSet(4);
-
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), ID_CONTEXT_VIEW_BINDINGS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element = configurationElements[i];
- if ( ELEM_PERSPECTIVE.equals(element.getName()) ) {
- String perspectiveId = element.getAttribute(ATTR_PERSPECTIVE_ID);
- if (perspectiveId != null) {
- perspectives.add(perspectiveId);
- }
- }
- }
-
- return perspectives;
- }
-
- public void contextActivated(ISelection selection) {
- if (isEnabledPerspective()) {
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Iterator iterator = ss.iterator();
- while (iterator.hasNext()) {
- Object target = iterator.next();
- ILaunch launch = DebugModelContextBindingManager.getLaunch(target);
- if (launch != null) {
- ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
- if (launchConfiguration != null) {
- try {
- ILaunchConfigurationType type = launchConfiguration.getType();
- // check if this perspective is enabled for the launch type
- // Include the word '.internal.' so the context is filtered from the key binding pref page (Bug 144019) also see PerspectiveManager.handleBreakpointHit()
- if (fContextService.getActiveContextIds().contains(type.getIdentifier() + ".internal." + getActivePerspective().getId())) { //$NON-NLS-1$
- // get the leaf contexts to be activated
- List workbenchContexts = DebugModelContextBindingManager.getDefault().getWorkbenchContextsForDebugContext(target);
- // TODO: do we need to check if contexts are actually enabled in workbench first?
- if (!workbenchContexts.isEmpty()) {
- // if all contexts already activate and last context is already active context == done
- Iterator contexts = workbenchContexts.iterator();
- while (contexts.hasNext()) {
- String contextId = (String)contexts.next();
- if (!isActivated(contextId)) {
- activateChain(contextId);
- }
- // ensure last context gets top priority
- if (!contexts.hasNext()) {
- if (!isActiveContext(contextId)) {
- activateChain(contextId);
- }
- }
- }
- }
-
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Returns whether the given context is the active context in the active perspective.
- *
- * @param contextId
- * @return
- */
- private boolean isActiveContext(String contextId) {
- IPerspectiveDescriptor activePerspective = getActivePerspective();
- if (activePerspective != null) {
- String activeId = (String) fPerspectiveToActiveContext.get(activePerspective);
- return contextId.equals(activeId);
- }
- return false;
- }
-
- /**
- * Returns whether the given context is activated in the active perspective.
- *
- * @param contextId
- * @return
- */
- private boolean isActivated(String contextId) {
- IPerspectiveDescriptor activePerspective = getActivePerspective();
- if (activePerspective != null) {
- Set contexts = (Set) fPerspectiveToActivatedContexts.get(activePerspective);
- if (contexts != null) {
- return contexts.contains(contextId);
- }
- }
- return false;
- }
-
- private void addActivated(String contextId) {
- IPerspectiveDescriptor activePerspective = getActivePerspective();
- if (activePerspective != null) {
- Set contexts = (Set) fPerspectiveToActivatedContexts.get(activePerspective);
- if (contexts == null) {
- contexts = new HashSet();
- fPerspectiveToActivatedContexts.put(activePerspective, contexts);
- }
- contexts.add(contextId);
- }
- }
-
- private void removeActivated(String contextId) {
- IPerspectiveDescriptor activePerspective = getActivePerspective();
- if (activePerspective != null) {
- Set contexts = (Set) fPerspectiveToActivatedContexts.get(activePerspective);
- if (contexts != null) {
- contexts.remove(contextId);
- }
- }
- }
-
- public void debugContextChanged(DebugContextEvent event) {
- if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
- contextActivated(event.getContext());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener3#perspectiveOpened(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener3#perspectiveClosed(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener3#perspectiveDeactivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- }
-
- /**
- * Closes all auto-opened views.
- *
- * @param page
- * @param perspective
- */
- private void clean(IPerspectiveDescriptor perspective) {
- Set contexts = (Set) fPerspectiveToActivatedContexts.remove(perspective);
- fPerspectiveToActiveContext.remove(perspective);
- if (contexts != null) {
- Iterator iterator = contexts.iterator();
- while (iterator.hasNext()) {
- String id = (String) iterator.next();
- deactivate(id);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener3#perspectiveSavedAs(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveSavedAs(IWorkbenchPage page, IPerspectiveDescriptor oldPerspective, IPerspectiveDescriptor newPerspective) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener2#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, org.eclipse.ui.IWorkbenchPartReference, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) {
- if (!fIgnoreChanges && page.getWorkbenchWindow().equals(fWindow)) {
- if(partRef != null) {
- if (IWorkbenchPage.CHANGE_VIEW_SHOW == changeId || IWorkbenchPage.CHANGE_VIEW_HIDE == changeId) {
- Iterator iterator = fContextIdsToBindings.values().iterator();
- while (iterator.hasNext()) {
- DebugContextViewBindings bindings = (DebugContextViewBindings) iterator.next();
- bindings.setViewOpened(IWorkbenchPage.CHANGE_VIEW_SHOW == changeId, partRef.getId());
- }
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- if (page.getWorkbenchWindow().equals(fWindow)) {
- ISelection activeContext = getDebugContextService().getActiveContext();
- if (activeContext != null) {
- contextActivated(activeContext);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- }
-
- /**
- * Activates all parent contexts of the given context, top down.
- *
- * @param contextId
- */
- private void activateChain(String contextId) {
- IWorkbenchPage page = fWindow.getActivePage();
- if (page != null) {
- DebugContextViewBindings bindings= (DebugContextViewBindings) fContextIdsToBindings.get(contextId);
- if (bindings != null) {
- bindings.activateChain(page);
- }
- }
- }
-
- /**
- * Links each debug context view bindings with its parent context bindings
- */
- private void linkParentContexts() {
- Iterator iterator = fContextIdsToBindings.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry)iterator.next();
- String contextId = (String) entry.getKey();
- DebugContextViewBindings bindings = (DebugContextViewBindings) entry.getValue();
- if (!bindings.getId().equals(DEBUG_CONTEXT)) {
- Context context = fContextService.getContext(contextId);
- try {
- bindings.setParentId(context.getParentId());
- } catch (NotDefinedException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
- }
-
- /**
- * Sets the active context in the given perspective, or removes
- * when <code>null</code>.
- *
- * @param perspective
- * @param contextId
- */
- private void setActive(IPerspectiveDescriptor perspective, String contextId) {
- if (contextId == null) {
- fPerspectiveToActiveContext.remove(perspective);
- } else {
- fPerspectiveToActiveContext.put(perspective, contextId);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.contexts.IContextManagerListener#contextManagerChanged(org.eclipse.core.commands.contexts.ContextManagerEvent)
- */
- public void contextManagerChanged(ContextManagerEvent event) {
- if (event.isActiveContextsChanged()) {
- Set disabledContexts = getDisabledContexts(event);
- if (!disabledContexts.isEmpty()) {
- Iterator contexts = disabledContexts.iterator();
- while (contexts.hasNext()) {
- String contextId = (String)contexts.next();
- if (isViewConetxt(contextId)) {
- if (isActivated(contextId)) {
- deactivate(contextId);
- }
- }
- }
- }
- }
- }
-
- private void deactivate(String contextId) {
- IWorkbenchPage page = fWindow.getActivePage();
- if (page != null) {
- DebugContextViewBindings bindings = (DebugContextViewBindings) fContextIdsToBindings.get(contextId);
- if (bindings != null) {
- bindings.deactivate(page);
- }
- }
- }
-
- /**
- * Returns a set of contexts disabled in the given event, possibly empty.
- *
- * @param event
- * @return disabled context id's
- */
- private Set getDisabledContexts(ContextManagerEvent event) {
- Set prev = new HashSet(event.getPreviouslyActiveContextIds());
- Set activeContextIds = event.getContextManager().getActiveContextIds();
- if (activeContextIds != null) {
- prev.removeAll(activeContextIds);
- }
- return prev;
- }
-
- /**
- * Returns whether the given context has view bindings.
- *
- * @param id
- * @return whether the given context has view bindings
- */
- private boolean isViewConetxt(String id) {
- return fContextIdsToBindings.containsKey(id);
- }
-
- /**
- * Save view binding settings that differ from extension settings
- */
- private void saveViewBindings() {
- try {
- Document document = DebugPlugin.newDocument();
- Element root = document.createElement(XML_ELEMENT_VIEW_BINDINGS);
- document.appendChild(root);
- Set done = new HashSet();
- Iterator bindings = fContextIdsToBindings.values().iterator();
- while (bindings.hasNext()) {
- DebugContextViewBindings binding = (DebugContextViewBindings) bindings.next();
- binding.saveBindings(document, root, done);
- }
- String prefValue = IInternalDebugCoreConstants.EMPTY_STRING;
- if (root.hasChildNodes()) {
- prefValue = DebugPlugin.serializeDocument(document);
- }
- fIgnoreChanges = true;
- DebugUITools.getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, prefValue);
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- } finally {
- fIgnoreChanges = false;
- }
-
- }
-
- /**
- * Returns the perspectives in which debugging is enabled.
- *
- * @return
- */
- public String[] getEnabledPerspectives() {
- return (String[]) fEnabledPerspectives.toArray(new String[fEnabledPerspectives.size()]);
- }
-
- /**
- * Show the view without effecting user preferences
- *
- * @param viewId
- */
- public void showViewQuiet(String viewId) {
- IWorkbenchPage page = fWindow.getActivePage();
- if (page != null) {
- try {
- fIgnoreChanges = true;
- IViewPart part = page.showView(viewId, null, IWorkbenchPage.VIEW_VISIBLE);
- if (!page.isPartVisible(part)) {
- page.bringToTop(part);
- }
- } catch (PartInitException e) {
- DebugUIPlugin.log(e);
- } finally {
- fIgnoreChanges = false;
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener4#perspectivePreDeactivate(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectivePreDeactivate(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- if (page.getWorkbenchWindow().equals(fWindow)) {
- clean(perspective);
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
deleted file mode 100644
index 9e20fb5ce..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
+++ /dev/null
@@ -1,201 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * A container of breakpoints, based on a category.
- */
-public class BreakpointContainer extends PlatformObject {
-
- private IAdaptable fCategory;
- private IBreakpointOrganizer fOrganizer;
- private List fBreakpoints;
- private Map fCategoriesToContainers;
- private IBreakpointOrganizer[] fNesting;
-
- /**
- * Constructs a container of breakpoints for the given category,
- * created by the given organizer.
- *
- * @param category breakpoint category
- * @param organizer breakpoint organizer
- * @param nesting nested organizers or <code>null</code> if none
- */
- public BreakpointContainer(IAdaptable category, IBreakpointOrganizer organizer, IBreakpointOrganizer[] nesting) {
- fCategory = category;
- fOrganizer = organizer;
- fBreakpoints = new ArrayList();
- fNesting = nesting;
- fCategoriesToContainers = new HashMap();
- // seed with all nested categories
- if (nesting != null && nesting.length > 0) {
- IAdaptable[] emptyCategories = nesting[0].getCategories();
- if (emptyCategories != null) {
- for (int i = 0; i < emptyCategories.length; i++) {
- IAdaptable empty = emptyCategories[i];
- BreakpointContainer container = (BreakpointContainer) fCategoriesToContainers.get(empty);
- if (container == null) {
- IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[nesting.length - 1];
- System.arraycopy(nesting, 1, siblings, 0, siblings.length);
- container = new BreakpointContainer(empty, nesting[0], siblings);
- fCategoriesToContainers.put(empty, container);
- }
- }
- }
- }
- }
-
- /**
- * Adds a breakpoint to this container and its nested containers.
- *
- * @param breakpoint breakpoint to add
- */
- public void addBreakpoint(IBreakpoint breakpoint) {
- fBreakpoints.add(breakpoint);
- if (fNesting != null && fNesting.length > 0) {
- IBreakpointOrganizer organizer = fNesting[0];
- IAdaptable[] categories = organizer.getCategories(breakpoint);
- if (categories== null || categories.length == 0) {
- categories = OtherBreakpointCategory.getCategories(organizer);
- }
- for (int i = 0; i < categories.length; i++) {
- IAdaptable category = categories[i];
- BreakpointContainer container = (BreakpointContainer) fCategoriesToContainers.get(category);
- if (container == null) {
- IBreakpointOrganizer[] nesting = null;
- if (fNesting.length > 1) {
- nesting = new IBreakpointOrganizer[fNesting.length - 1];
- System.arraycopy(fNesting, 1, nesting, 0, nesting.length);
- }
- container = new BreakpointContainer(category, organizer, nesting);
- fCategoriesToContainers.put(category, container);
- }
- container.addBreakpoint(breakpoint);
- }
- }
- }
-
- /**
- * Returns the breakpoints in this container
- *
- * @return the breakpoints in this container
- */
- public IBreakpoint[] getBreakpoints() {
- return (IBreakpoint[]) fBreakpoints.toArray(new IBreakpoint[fBreakpoints.size()]);
- }
-
- /**
- * Returns this container's category.
- *
- * @return container category
- */
- public IAdaptable getCategory() {
- return fCategory;
- }
-
- /**
- * Returns children as breakpoints or nested containers.
- *
- * @return children as breakpoints or nested containers
- */
- public Object[] getChildren() {
- if (fCategoriesToContainers.isEmpty()) {
- return getBreakpoints();
- }
- return getContainers();
- }
-
- /**
- * Returns the containers nested in this container, possibly empty.
- *
- * @return the containers nested in this container, possibly empty
- */
- public BreakpointContainer[] getContainers() {
- Collection collection = fCategoriesToContainers.values();
- return (BreakpointContainer[]) collection.toArray(new BreakpointContainer[collection.size()]);
- }
-
- /**
- * Returns this container's organizer.
- *
- * @return this container's organizer
- */
- public IBreakpointOrganizer getOrganizer() {
- return fOrganizer;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) obj;
- return getCategory().equals(container.getCategory());
- }
- return super.equals(obj);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getCategory().hashCode();
- }
-
- /**
- * Returns whether this container contains the given breakpoint.
- *
- * @param breakpoint
- * @return whether this container contains the given breakpoint
- */
- public boolean contains(IBreakpoint breakpoint) {
- return fBreakpoints.contains(breakpoint);
- }
-
- /**
- * Returns the leaf containers the given breakpoint is contained in, or <code>null</code>
- * if none.
- *
- * @param breakpoint
- * @return leaf containers the given breakpoint is contained in, or <code>null</code>
- * if none
- */
- public BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
- if (contains(breakpoint)) {
- BreakpointContainer[] containers = getContainers();
- if (containers.length == 0) {
- return new BreakpointContainer[]{this};
- }
- List list = new ArrayList();
- for (int i = 0; i < containers.length; i++) {
- BreakpointContainer container = containers[i];
- BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
- if (subcontainers != null) {
- for (int j = 0; j < subcontainers.length; j++) {
- list.add(subcontainers[j]);
- }
- }
- }
- return (BreakpointContainer[]) list.toArray(new BreakpointContainer[list.size()]);
- }
- return null;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
deleted file mode 100644
index 2c009db99..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
+++ /dev/null
@@ -1,118 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-
-/**
- * BreakpointContainerWorkbenchAdapter
- */
-public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2{
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- // not used
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getImageDescriptor(category);
- }
- return container.getOrganizer().getImageDescriptor();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getLabel(category);
- }
- return container.getOrganizer().getLabel();
- }
- return IInternalDebugCoreConstants.EMPTY_STRING;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter2#getForeground(java.lang.Object)
- */
- public RGB getForeground(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- return adapter.getForeground(category);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter2#getBackground(java.lang.Object)
- */
- public RGB getBackground(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- return adapter.getBackground(category);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter2#getFont(java.lang.Object)
- */
- public FontData getFont(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
- IAdaptable category = container.getCategory();
- IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
- if (adapter != null) {
- return adapter.getFont(category);
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java
deleted file mode 100644
index 221587fd2..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointFactory.java
+++ /dev/null
@@ -1,54 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Factory to restore breakpoints from mementos for breakpoint working sets.
- */
-public class BreakpointFactory implements IElementFactory {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
- */
- public IAdaptable createElement(IMemento memento) {
- String longString = memento.getString(BreakpointPersistableElementAdapter.TAG_MARKER_ID);
- String factoryId = memento.getString(BreakpointPersistableElementAdapter.TAG_RESOURCE_FACTORY_ID);
- if (factoryId != null && longString != null) {
- IElementFactory elementFactory = PlatformUI.getWorkbench().getElementFactory(factoryId);
- if (elementFactory != null) {
- IAdaptable adaptable = elementFactory.createElement(memento);
- if (adaptable instanceof IResource) {
- IResource resource = (IResource) adaptable;
- try {
- long id = Long.parseLong(longString);
- IMarker marker = resource.findMarker(id);
- if (marker != null) {
- return DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
- }
- } catch (NumberFormatException e) {
- } catch (CoreException e) {
- }
- }
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
deleted file mode 100644
index 3108687a3..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
+++ /dev/null
@@ -1,198 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
-import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
-import org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-
-/**
- * A contributed breakpoint organizer.
- */
-public class BreakpointOrganizerExtension implements IBreakpointOrganizer, IBreakpointOrganizerDelegateExtension {
-
- private IConfigurationElement fElement;
- private IBreakpointOrganizerDelegate fDelegate;
- private ImageDescriptor fDescriptor;
-
- // attributes
- public static final String ATTR_LABEL = "label"; //$NON-NLS-1$
- public static final String ATTR_CLASS = "class"; //$NON-NLS-1$
- public static final String ATTR_ID = "id"; //$NON-NLS-1$
- public static final String ATTR_ICON = "icon"; //$NON-NLS-1$
- public static final String ATTR_OTHERS_LABEL = "othersLabel"; //$NON-NLS-1$
-
- public BreakpointOrganizerExtension(IConfigurationElement element) {
- fElement = element;
- }
-
- /**
- * Returns the image descriptor for this organizer.
- *
- * @return image descriptor
- */
- public ImageDescriptor getImageDescriptor() {
- if (fDescriptor == null) {
- fDescriptor = DebugUIPlugin.getImageDescriptor(fElement, ATTR_ICON);
- if (fDescriptor == null) {
- fDescriptor = ImageDescriptor.getMissingImageDescriptor();
- }
- }
- return fDescriptor;
- }
-
- /**
- * Returns this organizer's label.
- *
- * @return this organizer's label
- */
- public String getLabel() {
- return fElement.getAttribute(ATTR_LABEL);
- }
-
- /**
- * Returns this organizer's identifier.
- *
- * @return this organizer's identifier
- */
- public String getIdentifier() {
- return fElement.getAttribute(ATTR_ID);
- }
-
- /**
- * Returns this organizer's delegate, instantiating it if required.
- *
- * @return this organizer's delegate
- */
- protected IBreakpointOrganizerDelegate getOrganizer() {
- if (fDelegate == null) {
- try {
- fDelegate = (IBreakpointOrganizerDelegate) fElement.createExecutableExtension(ATTR_CLASS);
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- return fDelegate;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories(org.eclipse.debug.core.model.IBreakpoint)
- */
- public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- return getOrganizer().getCategories(breakpoint);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- getOrganizer().addPropertyChangeListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- getOrganizer().removePropertyChangeListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#addBreakpoint(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable)
- */
- public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- getOrganizer().addBreakpoint(breakpoint, category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#removeBreakpoint(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable)
- */
- public void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- getOrganizer().removeBreakpoint(breakpoint, category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#canAdd(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable)
- */
- public boolean canAdd(IBreakpoint breakpoint, IAdaptable category) {
- return getOrganizer().canAdd(breakpoint, category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#canRemove(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable)
- */
- public boolean canRemove(IBreakpoint breakpoint, IAdaptable category) {
- return getOrganizer().canRemove(breakpoint, category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#dispose()
- */
- public void dispose() {
- // don't instantiate the delegate if it has not been used
- if (fDelegate != null) {
- fDelegate.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer#getOthersLabel()
- */
- public String getOthersLabel() {
- String attribute = fElement.getAttribute(ATTR_OTHERS_LABEL);
- if (attribute == null) {
- return DebugUIViewsMessages.OtherBreakpointOrganizer_0;
- }
- return attribute;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories()
- */
- public IAdaptable[] getCategories() {
- return getOrganizer().getCategories();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension#addBreakpoints(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.runtime.IAdaptable)
- */
- public void addBreakpoints(IBreakpoint[] breakpoints, IAdaptable category) {
- IBreakpointOrganizerDelegate organizer = getOrganizer();
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
- ((IBreakpointOrganizerDelegateExtension)organizer).addBreakpoints(breakpoints, category);
- } else {
- for (int i = 0; i < breakpoints.length; i++) {
- addBreakpoint(breakpoints[i], category);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension#removeBreakpoints(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.runtime.IAdaptable)
- */
- public void removeBreakpoints(IBreakpoint[] breakpoints, IAdaptable category) {
- IBreakpointOrganizerDelegate organizer = getOrganizer();
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
- ((IBreakpointOrganizerDelegateExtension)organizer).removeBreakpoints(breakpoints, category);
- } else {
- for (int i = 0; i < breakpoints.length; i++) {
- removeBreakpoint(breakpoints[i], category);
- }
- }
-
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
deleted file mode 100644
index 617ff70c3..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.debug.internal.ui.views.breakpoints;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * Manager which provides access to the breakpoint organizers
- * contributed via the org.eclipse.debug.ui.breakpointOrganizers
- * extension point.
- * <p>
- * Manages the default breakpoint working set and places newly
- * create breakpoints in to that set.
- * </p>
- * @since 3.1
- */
-public class BreakpointOrganizerManager {
-
- private static BreakpointOrganizerManager fgManager;
-
- // map for lookup by id
- private Map fOrganizers = new HashMap();
- // cached sorted list by label
- private List fSorted = null;
-
- /**
- * Returns the singleton instance of the breakpoint container
- * factory manager.
- */
- public static BreakpointOrganizerManager getDefault() {
- if (fgManager == null) {
- fgManager= new BreakpointOrganizerManager();
- }
- return fgManager;
- }
-
- /**
- * Creates and initializes a new breakpoint container factory.
- */
- private BreakpointOrganizerManager() {
- loadOrganizers();
- // force the working set organizers to initialize their listeners
- start("org.eclipse.debug.ui.workingSetOrganizer"); //$NON-NLS-1$
- start("org.eclipse.debug.ui.breakpointWorkingSetOrganizer"); //$NON-NLS-1$
- }
-
- /**
- * Forces instantiation of orgranizer delegate.
- *
- * @param organizerId organizer to start
- */
- private void start(String organizerId) {
- IBreakpointOrganizer organizer = getOrganizer(organizerId);
- IPropertyChangeListener listener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- }
- };
- organizer.addPropertyChangeListener(listener);
- organizer.removePropertyChangeListener(listener);
- }
-
- /**
- * Loads all contributed breakpoint organizers.
- */
- private void loadOrganizers() {
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- IConfigurationElement[] configurationElements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < configurationElements.length; i++) {
- IConfigurationElement element= configurationElements[i];
- IBreakpointOrganizer organizer = new BreakpointOrganizerExtension(element);
- if (validateOrganizer(organizer)) {
- fOrganizers.put(organizer.getIdentifier(), organizer);
- }
- }
- }
-
- /**
- * Validates the given organizer. Checks that certain required attributes
- * are available.
- * @param extension the organizer to validate
- * @return whether the given organizer is valid
- */
- protected static boolean validateOrganizer(IBreakpointOrganizer organizer) {
- String id = organizer.getIdentifier();
- String label = organizer.getLabel();
- return id != null && id.length() > 0 && label != null && label.length() > 0;
- }
-
- /**
- * Returns all contributed breakpoint organizers.
- *
- * @return all contributed breakpoint organizers
- */
- public IBreakpointOrganizer[] getOrganizers() {
- if (fSorted == null) {
- Collection collection = fOrganizers.values();
- fSorted = new ArrayList();
- fSorted.addAll(collection);
- Collections.sort(fSorted, new Comparator() {
- public int compare(Object o1, Object o2) {
- IBreakpointOrganizer b1 = (IBreakpointOrganizer)o1;
- IBreakpointOrganizer b2 = (IBreakpointOrganizer)o2;
- return b1.getLabel().compareTo(b2.getLabel());
- }
-
- public boolean equals(Object obj) {
- return this == obj;
- }
- });
- }
- return (IBreakpointOrganizer[]) fSorted.toArray(new IBreakpointOrganizer[fSorted.size()]);
- }
-
- /**
- * Returns the specified breakpoint organizer or <code>null</code>
- * @param id organizer identifier
- * @return breakpoint organizer or <code>null</code>
- */
- public IBreakpointOrganizer getOrganizer(String id) {
- return (IBreakpointOrganizer) fOrganizers.get(id);
- }
-
- /**
- * Shuts down the organizer manager, disposing organizers.
- */
- public void shutdown() {
- IBreakpointOrganizer[] organizers = getOrganizers();
- for (int i = 0; i < organizers.length; i++) {
- IBreakpointOrganizer organizer = organizers[i];
- organizer.dispose();
- }
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
deleted file mode 100644
index d0c83615e..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointPersistableElementAdapter.java
+++ /dev/null
@@ -1,63 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * Adapter to save and restore breakpoints for a working set.
- */
-public class BreakpointPersistableElementAdapter implements IPersistableElement {
-
- private IBreakpoint fBreakpoint;
-
- public static final String TAG_MARKER_ID = "TAG_MARKER_ID"; //$NON-NLS-1$
- public static final String TAG_RESOURCE_FACTORY_ID = "TAG_RESOURCE_FACTORY_ID"; //$NON-NLS-1$
-
- /**
- * Constructs a new persitable element adapter for the given breakpoint.
- *
- * @param breakpoint
- */
- public BreakpointPersistableElementAdapter(IBreakpoint breakpoint) {
- fBreakpoint = breakpoint;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPersistableElement#getFactoryId()
- */
- public String getFactoryId() {
- return "org.eclipse.debug.ui.elementFactory.breakpoints"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPersistableElement#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- IMarker marker = fBreakpoint.getMarker();
- if (marker != null) {
- IResource resource = marker.getResource();
- IPersistableElement pe = (IPersistableElement) resource.getAdapter(IPersistableElement.class);
- if (pe != null) {
- long id = marker.getId();
- String longString = Long.toString(id);
- memento.putString(TAG_MARKER_ID, longString);
- memento.putString(TAG_RESOURCE_FACTORY_ID, pe.getFactoryId());
- pe.saveState(memento);
- }
- }
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
deleted file mode 100644
index ef4a7c265..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
+++ /dev/null
@@ -1,456 +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.debug.internal.ui.views.breakpoints;
-
-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 java.util.Map.Entry;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.IBreakpointsListener;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.importexport.breakpoints.IImportExportConstants;
-import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
-import org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Breakpoint organizers for breakpoint working sets.
- *
- * @since 3.1
- */
-public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate implements IBreakpointOrganizerDelegateExtension, IPropertyChangeListener, IBreakpointsListener {
-
- private IWorkingSetManager fWorkingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
-
- /**
- * A cache for mapping markers to the working set they belong to
- * @since 3.2
- */
- private BreakpointWorkingSetCache fCache = null;
-
- // Cache of the default working set, so we can know when it changes name
- private static IWorkingSet fDefaultWorkingSet = null;
-
-
- /**
- * Constructs a working set breakpoint organizer. Listens for changes in
- * working sets and fires property change notification.
- */
- public BreakpointSetOrganizer() {
- fWorkingSetManager.addPropertyChangeListener(this);
- fCache = new BreakpointWorkingSetCache();
- DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
- fDefaultWorkingSet = getDefaultWorkingSet();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories(org.eclipse.debug.core.model.IBreakpoint)
- */
- public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- List result = new ArrayList();
- IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- IWorkingSet set = workingSets[i];
- if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
- IAdaptable[] elements = set.getElements();
- for (int j = 0; j < elements.length; j++) {
- IAdaptable adaptable = elements[j];
- if (adaptable.equals(breakpoint)) {
- result.add(new WorkingSetCategory(set));
- break;
- }
- }
- }
- }
- return (IAdaptable[]) result.toArray(new IAdaptable[result.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#dispose()
- */
- public void dispose() {
- fWorkingSetManager.removePropertyChangeListener(this);
- fWorkingSetManager = null;
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
- DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
- super.dispose();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- IWorkingSet set = null;
- Object newValue = event.getNewValue();
- if (newValue instanceof IWorkingSet) {
- set = (IWorkingSet) newValue;
- }
- else if (event.getOldValue() instanceof IWorkingSet) {
- set = (IWorkingSet) event.getOldValue();
- }
- if(set == null) {
- return;
- }
- String property = event.getProperty();
- //fix for bug 103731
- if (property.equals(IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE)) {
- if (newValue.equals(fDefaultWorkingSet)) {
- setDefaultWorkingSet((IWorkingSet) newValue);
- }
- }
- if (property.equals(IWorkingSetManager.CHANGE_WORKING_SET_REMOVE)) {
- if (event.getOldValue().equals(fDefaultWorkingSet)) {
- setDefaultWorkingSet(null);
- }
- }
- if(property.equals(IWorkingSetManager.CHANGE_WORKING_SET_ADD)) {
- IAdaptable[] breakpoints = set.getElements();
- for (int i = 0; i < breakpoints.length; i++) {
- if (breakpoints[i] instanceof IBreakpoint) {
- IMarker marker = ((IBreakpoint)breakpoints[i]).getMarker();
- fCache.addEntry(marker, set.getName());
- fCache.flushMarkerCache(marker);
- }
- }
- }
- if (set != null && IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
- fireCategoryChanged(new WorkingSetCategory(set));
- }
- if (property.equals(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME)) {
- IWorkingSet defaultWorkingSet = getDefaultWorkingSet();
- if (defaultWorkingSet != null) {
- fireCategoryChanged(new WorkingSetCategory(defaultWorkingSet));
- } else {
- fireCategoryChanged(null);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsAdded(org.eclipse.debug.core.model.IBreakpoint[])
- */
- public void breakpointsAdded(IBreakpoint[] breakpoints) {
- Map setToBreakpoints = new HashMap();
- for (int i = 0; i < breakpoints.length; i++) {
- IMarker marker = breakpoints[i].getMarker();
- String[] names = getWorkingsetAttributeFromMarker(marker, IInternalDebugUIConstants.WORKING_SET_NAME);
- //add it to the default set if the listing is empty
- if (names.length == 0) {
- queueToSet(breakpoints[i], getDefaultWorkingSet(), setToBreakpoints);
- } else {
- for (int j = 1; j < names.length; j++) {
- IWorkingSet set = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(names[j]);
- // if we cannot find the one we want, try to get the default
- if (set == null) {
- set = getDefaultWorkingSet();
- }
- queueToSet(breakpoints[i], set, setToBreakpoints);
- }
- }
- }
- Iterator iterator = setToBreakpoints.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
- IWorkingSet set = (IWorkingSet) entry.getKey();
- List list = (List) entry.getValue();
- addBreakpointsToSet((IBreakpoint[]) list.toArray(new IBreakpoint[list.size()]), set);
- }
- }
-
- private void queueToSet(IBreakpoint breakpoint, IWorkingSet set, Map queue) {
- List list = (List) queue.get(set);
- if (list == null) {
- list = new ArrayList();
- queue.put(set, list);
- }
- list.add(breakpoint);
- }
-
- /**
- * Adds a breakpoint to a working set
- * @param breakpoint the breakpoint to add
- * @param set the set to add it to or <code>null</code> if none
- *
- * @since 3.2
- */
- private void addBreakpointsToSet(IBreakpoint[] breakpoints, IWorkingSet set) {
- if (set != null) {
- IAdaptable[] elements = set.getElements();
- Set collection = new HashSet(elements.length);
- List list = new ArrayList(elements.length + breakpoints.length);
- for(int i = 0; i < elements.length; i++) {
- collection.add(elements[i]);
- list.add(elements[i]);
- }
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- if (!collection.contains(breakpoint)) {
- list.add(breakpoint);
- fCache.addEntry(breakpoint.getMarker(), set.getName()); //fix for bug 103731
- fCache.flushMarkerCache(breakpoint.getMarker());
- }
- }
- set.setElements((IAdaptable[]) list.toArray(new IAdaptable[list.size()]));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsRemoved(org.eclipse.debug.core.model.IBreakpoint[],
- * org.eclipse.core.resources.IMarkerDelta[])
- */
- public void breakpointsRemoved(IBreakpoint[] breakpoints,
- IMarkerDelta[] deltas) {
- IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- IWorkingSet set = null;
- for (int i = 0; i < workingSets.length; i++) {
- set = workingSets[i];
- if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
- clean(set);
- }
- }
- }
-
- /**
- * Removes deleted breakpoints from the given working set.
- *
- * @param workingSet
- * breakpoint working set
- */
- private void clean(IWorkingSet workingSet) {
- IAdaptable[] elements = workingSet.getElements();
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- boolean update = false;
- for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
- if (adaptable instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint) adaptable;
- if (!manager.isRegistered(breakpoint)) {
- update = true;
- elements[i] = null;
- }
- }
- }
- if (update) {
- List newElements = new ArrayList(elements.length);
- for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
- if (adaptable != null) {
- newElements.add(adaptable);
- }
- }
- workingSet.setElements((IAdaptable[]) newElements.toArray(new IAdaptable[newElements.size()]));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsChanged(org.eclipse.debug.core.model.IBreakpoint[],
- * org.eclipse.core.resources.IMarkerDelta[])
- */
- public void breakpointsChanged(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- }
-
- /**
- * Returns the active default breakpoint working set, or <code>null</code>
- * if none.
- *
- * @return the active default breakpoint working set, or <code>null</code>
- */
- public static IWorkingSet getDefaultWorkingSet() {
- IPreferenceStore preferenceStore = DebugUIPlugin.getDefault().getPreferenceStore();
- String name = preferenceStore.getString(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME);
- if (name != null) {
- return PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(name);
- }
- return null;
- }
-
- /**
- * Sets the active default breakpoint working set, or <code>null</code> if
- * none.
- *
- * @param set
- * default working set or <code>null</code>
- */
- public static void setDefaultWorkingSet(IWorkingSet set) {
- String name = IInternalDebugCoreConstants.EMPTY_STRING;
- if (set != null) {
- // only consider breakpoint working sets
- if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
- name = set.getName();
- }
- }
- fDefaultWorkingSet = set;
- DebugUIPlugin.getDefault().getPluginPreferences().setValue(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME, name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#canRemove(org.eclipse.debug.core.model.IBreakpoint,
- * org.eclipse.core.runtime.IAdaptable)
- */
- public boolean canRemove(IBreakpoint breakpoint, IAdaptable category) {
- if (category instanceof WorkingSetCategory) {
- WorkingSetCategory wsc = (WorkingSetCategory) category;
- return IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(wsc.getWorkingSet().getId());
- }
- return super.canRemove(breakpoint, category);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#canAdd(org.eclipse.debug.core.model.IBreakpoint,
- * org.eclipse.core.runtime.IAdaptable)
- */
- public boolean canAdd(IBreakpoint breakpoint, IAdaptable category) {
- if (category instanceof WorkingSetCategory) {
- WorkingSetCategory wsc = (WorkingSetCategory) category;
- return IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(wsc.getWorkingSet().getId());
- }
- return super.canAdd(breakpoint, category);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#addBreakpoint(org.eclipse.debug.core.model.IBreakpoint,
- * org.eclipse.core.runtime.IAdaptable)
- */
- public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- addBreakpoints(new IBreakpoint[]{breakpoint}, category);
- }
-
- /**
- * Gets the working set names from the marker
- *
- * @param marker
- * them marker to get the names from
- * @return the listing of markers or an empty String array, never null
- *
- * @since 3.2
- */
- private String[] getWorkingsetAttributeFromMarker(IMarker marker, String type) {
- try {
- String name = (String) marker.getAttribute(type);
- if (name != null) {
- return name.split("\\" + IImportExportConstants.DELIMITER); //$NON-NLS-1$
- }
- }
- catch (CoreException e) {DebugPlugin.log(e);}
- return new String[] {};
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#removeBreakpoint(org.eclipse.debug.core.model.IBreakpoint,
- * org.eclipse.core.runtime.IAdaptable)
- */
- public void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
- if (category instanceof WorkingSetCategory) {
- IWorkingSet set = ((WorkingSetCategory) category).getWorkingSet();
- IAdaptable[] elements = set.getElements();
- List list = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
- if (!adaptable.equals(breakpoint)) {
- list.add(adaptable);
- }
- }
- fCache.removeMappedEntry(breakpoint.getMarker(), set.getName());
- fCache.flushMarkerCache(breakpoint.getMarker());
- set.setElements((IAdaptable[]) list.toArray(new IAdaptable[list.size()]));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories()
- */
- public IAdaptable[] getCategories() {
- IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- List all = new ArrayList();
- for (int i = 0; i < workingSets.length; i++) {
- IWorkingSet set = workingSets[i];
- if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set
- .getId())) {
- all.add(new WorkingSetCategory(set));
- }
- }
- return (IAdaptable[]) all.toArray(new IAdaptable[all.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension#addBreakpoints(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.runtime.IAdaptable)
- */
- public void addBreakpoints(IBreakpoint[] breakpoints, IAdaptable category) {
- if (category instanceof WorkingSetCategory) {
- IWorkingSet set = ((WorkingSetCategory) category).getWorkingSet();
- addBreakpointsToSet(breakpoints, set);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension#removeBreakpoints(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.runtime.IAdaptable)
- */
- public void removeBreakpoints(IBreakpoint[] breakpoints, IAdaptable category) {
- if (category instanceof WorkingSetCategory) {
- IWorkingSet set = ((WorkingSetCategory) category).getWorkingSet();
- IAdaptable[] elements = set.getElements();
- List list = new ArrayList(elements.length);
- for (int i = 0; i < elements.length; i++) {
- list.add(elements[i]);
- }
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- fCache.removeMappedEntry(breakpoint.getMarker(), set.getName());
- fCache.flushMarkerCache(breakpoint.getMarker());
- list.remove(breakpoint);
- }
- set.setElements((IAdaptable[]) list.toArray(new IAdaptable[list.size()]));
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
deleted file mode 100644
index 613072513..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointTypeOrganizer.java
+++ /dev/null
@@ -1,59 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
-import org.eclipse.debug.ui.BreakpointTypeCategory;
-import org.eclipse.debug.ui.IBreakpointTypeCategory;
-
-/**
- * Breakpoint organizers for breakpoint types.
- *
- * @since 3.1
- */
-public class BreakpointTypeOrganizer extends AbstractBreakpointOrganizerDelegate {
-
- private Map fTypes = new HashMap();
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories(org.eclipse.debug.core.model.IBreakpoint)
- */
- public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- IBreakpointTypeCategory category = (IBreakpointTypeCategory) breakpoint.getAdapter(IBreakpointTypeCategory.class);
- if (category != null) {
- return new IAdaptable[]{category};
- }
- String name = DebugPlugin.getDefault().getBreakpointManager().getTypeName(breakpoint);
- if (name != null) {
- IAdaptable[] categories = (IAdaptable[]) fTypes.get(name);
- if (categories == null) {
- categories = new IAdaptable[]{new BreakpointTypeCategory(name)};
- fTypes.put(name, categories);
- }
- return categories;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#dispose()
- */
- public void dispose() {
- fTypes.clear();
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java
deleted file mode 100644
index 85682f4ed..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java
+++ /dev/null
@@ -1,108 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.importexport.breakpoints.IImportExportConstants;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Class to cache the breakpoint to workingset information in its underlying
- * marker as breakpoints are moved between breakpoint working sets.
- * It resolves the need for constant attribute lookup and parsing to
- * fix bug 103731
- *
- * @since 3.2
- */
-public class BreakpointWorkingSetCache {
-
- /**
- * the entire cache
- * key: marker
- * value: vector of workingsets the marker belongs to
- */
- HashMap fCache = null;
-
- /**
- * Default constructor
- * @param organizer the oprganizer that owns this cache
- */
- public BreakpointWorkingSetCache() {
- fCache = new HashMap(15);
- }
-
- /**
- * Adds an entry into the cache
- * @param marker the marker to add the workingset information about
- * @param entry the entry to add to the cache
- */
- public void addEntry(IMarker marker, Object entry) {
- Vector list = (Vector)fCache.get(marker);
- if (list == null) {
- list = new Vector();
- list.addElement(entry);
- fCache.put(marker, list);
- }
- else {
- if(!list.contains(entry)) {
- list.addElement(entry);
- }
- }
- }
-
- /**
- * Removes an item from the list contained under the marker key, not the marker entry
- * @param marker the marker key to remove the item from
- * @param entry the entry to remove
- */
- public void removeMappedEntry(IMarker marker, Object entry) {
- Vector list = (Vector)fCache.get(marker);
- if(list != null) {
- list.remove(entry);
- }
- }
-
- /**
- * Flushes the cache of only the specified marker
- * @param marker the marker whose cache is to be flushed
- */
- public void flushMarkerCache(IMarker marker) {
- IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
- Vector list = (Vector)fCache.get(marker);
- if(list != null) {
- String names = IImportExportConstants.DELIMITER;
- String ids = IImportExportConstants.DELIMITER;
- for(int i = 0; i < list.size(); i++) {
- String name = (String)list.elementAt(i);
- IWorkingSet ws = manager.getWorkingSet(name);
- if(ws != null) {
- names += name+IImportExportConstants.DELIMITER;
- ids += ws.getId()+IImportExportConstants.DELIMITER;
- }
- }
- try {
- marker.setAttribute(IInternalDebugUIConstants.WORKING_SET_NAME, names);
- marker.setAttribute(IInternalDebugUIConstants.WORKING_SET_ID, ids);
- }
- catch(CoreException e) {DebugPlugin.log(e);}
- }
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
deleted file mode 100644
index bc7e5fbc0..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
+++ /dev/null
@@ -1,60 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetElementAdapter;
-
-/**
- * Consulted by workbench pull down actions that add/remove selected elements to/from
- * working sets. Allows breakpoint working sets to select which elements are applicable
- * for adding/removing.
- *
- * @since 3.3
- */
-public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAdapter {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkingSetElementAdapter#adaptElements(org.eclipse.ui.IWorkingSet, org.eclipse.core.runtime.IAdaptable[])
- */
- public IAdaptable[] adaptElements(IWorkingSet ws, IAdaptable[] elements) {
- for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
- if (!(adaptable instanceof IBreakpoint)) {
- return selectBreakpoints(elements);
- }
- }
- return elements;
- }
-
- private IAdaptable[] selectBreakpoints(IAdaptable[] elements) {
- List breakpoints = new ArrayList(elements.length);
- for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
- if (adaptable instanceof IBreakpoint) {
- breakpoints.add(adaptable);
- }
- }
- return (IAdaptable[]) breakpoints.toArray(new IAdaptable[breakpoints.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkingSetElementAdapter#dispose()
- */
- public void dispose() {
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
deleted file mode 100644
index aa8f8a789..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
+++ /dev/null
@@ -1,210 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.SWTFactory;
-import org.eclipse.debug.internal.ui.importexport.breakpoints.EmbeddedBreakpointsViewer;
-import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-
-/**
- * The Breakpoint working set page allows the user to create
- * and edit a Breakpoint working set.
- *
- * @since 3.1
- */
-public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetPage {
-
- final private static String PAGE_TITLE= DebugUIViewsMessages.BreakpointWorkingSetPage_0;
- final private static String PAGE_ID= "breakpointWorkingSetPage"; //$NON-NLS-1$
-
- private Text fWorkingSetName;
- private EmbeddedBreakpointsViewer fTViewer;
- private boolean fFirstCheck;
- private IWorkingSet fWorkingSet;
-
- /**
- * Default constructor.
- */
- public BreakpointWorkingSetPage() {
- super(PAGE_ID, PAGE_TITLE, DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_WIZBAN_DEBUG));
- setDescription(DebugUIViewsMessages.BreakpointWorkingSetPage_1);
- fFirstCheck= true;
- }
-
- /*
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- initializeDialogUnits(parent);
- Composite composite= new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
- Label label= new Label(composite, SWT.WRAP);
- label.setText(DebugUIViewsMessages.BreakpointWorkingSetPage_2);
- GridData gd= new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(gd);
- fWorkingSetName= new Text(composite, SWT.SINGLE | SWT.BORDER);
- fWorkingSetName.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- fWorkingSetName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- }
- );
- fWorkingSetName.setFocus();
- label= new Label(composite, SWT.WRAP);
- label.setText(DebugUIViewsMessages.BreakpointWorkingSetPage_3);
- gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(gd);
- IViewPart viewpart = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().findView(IDebugUIConstants.ID_BREAKPOINT_VIEW);
- IStructuredSelection selection;
- if (viewpart == null) {
- selection = new StructuredSelection();
- } else {
- selection = (IStructuredSelection)viewpart.getViewSite().getSelectionProvider().getSelection();
- }
- fTViewer = new EmbeddedBreakpointsViewer(composite, DebugPlugin.getDefault().getBreakpointManager(), selection);
- // Add select / deselect all buttons for bug 46669
- Composite buttonComposite = new Composite(composite, SWT.NONE);
- buttonComposite.setLayout(new GridLayout(2, false));
- buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- Button selectAllButton = SWTFactory.createPushButton(buttonComposite, DebugUIViewsMessages.BreakpointWorkingSetPage_selectAll_label, null);
- selectAllButton.setToolTipText(DebugUIViewsMessages.BreakpointWorkingSetPage_selectAll_toolTip);
- selectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent selectionEvent) {
- BreakpointsViewer viewer = fTViewer.getViewer();
- viewer.getTree().selectAll();
- viewer.setCheckedElements(((IStructuredSelection)viewer.getSelection()).toArray());
- viewer.setGrayedElements(new Object[] {});
- viewer.getTree().deselectAll();
- validateInput();
- }
- });
- Button deselectAllButton = SWTFactory.createPushButton(buttonComposite, DebugUIViewsMessages.BreakpointWorkingSetPage_deselectAll_label, null);
- deselectAllButton.setToolTipText(DebugUIViewsMessages.BreakpointWorkingSetPage_deselectAll_toolTip);
- deselectAllButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent selectionEvent) {
- BreakpointsViewer viewer = fTViewer.getViewer();
- viewer.setCheckedElements(new Object[] {});
- validateInput();
- }
- });
- if (fWorkingSet != null)
- fWorkingSetName.setText(fWorkingSet.getName());
- validateInput();
- Dialog.applyDialogFont(composite);
- }
-
- /*
- * Implements method from IWorkingSetPage
- */
- public IWorkingSet getSelection() {
- return fWorkingSet;
- }
-
- /*
- * Implements method from IWorkingSetPage
- */
- public void setSelection(IWorkingSet workingSet) {
- Assert.isNotNull(workingSet, "Working set must not be null"); //$NON-NLS-1$
- fWorkingSet= workingSet;
- if (getContainer() != null && getShell() != null && fWorkingSetName != null) {
- fFirstCheck= false;
- fWorkingSetName.setText(fWorkingSet.getName());
- validateInput();
- }
- }
-
- /*
- * Implements method from IWorkingSetPage
- */
- public void finish() {
- String workingSetName = fWorkingSetName.getText();
- Object[] adaptable = fTViewer.getCheckedElements().toArray();
- ArrayList elements = new ArrayList();
- //weed out non-breakpoint elements since 3.2
- for(int i = 0; i < adaptable.length; i++) {
- if(adaptable[i] instanceof IBreakpoint) {
- elements.add(adaptable[i]);
- }//end if
- }//end for
- if (fWorkingSet == null) {
- IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager();
- fWorkingSet = workingSetManager.createWorkingSet(workingSetName, (IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
- } else {
- fWorkingSet.setName(workingSetName);
- fWorkingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
- }
- }
-
- /**
- * validates the current input of the page to determine if the finish button can be enabled
- */
- private void validateInput() {
- String errorMessage= null;
- String newText= fWorkingSetName.getText();
-
- if (newText.equals(newText.trim()) == false)
- errorMessage = DebugUIViewsMessages.BreakpointWorkingSetPage_4;
- if (newText.equals(IInternalDebugCoreConstants.EMPTY_STRING)) {
- if (fFirstCheck) {
- setPageComplete(false);
- fFirstCheck= false;
- return;
- }
- errorMessage= DebugUIViewsMessages.BreakpointWorkingSetPage_5;
- }
- fFirstCheck= false;
- if (errorMessage == null && (fWorkingSet == null || newText.equals(fWorkingSet.getName()) == false)) {
- IWorkingSet[] workingSets= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
- for (int i= 0; i < workingSets.length; i++) {
- if (newText.equals(workingSets[i].getName())) {
- errorMessage= DebugUIViewsMessages.BreakpointWorkingSetPage_6;
- }
- }
- }
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage == null);
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
deleted file mode 100644
index 96f5741ef..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
+++ /dev/null
@@ -1,135 +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.debug.internal.ui.views.breakpoints;
-
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.ILineBreakpoint;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-/**
- * @since 3.3
- */
-public class BreakpointsComparator extends ViewerComparator {
- /**
- * @see ViewerSorter#isSorterProperty(Object, String)
- */
- public boolean isSorterProperty(Object element,String propertyId) {
- return propertyId.equals(IBasicPropertyConstants.P_TEXT);
- }
-
- /**
- * Returns a negative, zero, or positive number depending on whether
- * the first element is less than, equal to, or greater than
- * the second element.
- * <p>
- * Group breakpoints by debug model
- * within debug model, group breakpoints by type
- * within type groups, sort by line number (if applicable) and then
- * alphabetically by label
- *
- * @param viewer the viewer
- * @param e1 the first element
- * @param e2 the second element
- * @return a negative number if the first element is less than the
- * second element; the value <code>0</code> if the first element is
- * equal to the second element; and a positive number if the first
- * element is greater than the second element
- */
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (!(e1 instanceof IBreakpoint)) {
- return super.compare(viewer, e1, e2);
- }
-
- IBreakpoint b1= (IBreakpoint)e1;
- IBreakpoint b2= (IBreakpoint)e2;
- String modelId1= b1.getModelIdentifier();
- String modelId2= b2.getModelIdentifier();
- int result= modelId1.compareTo(modelId2);
- if (result != 0) {
- return result;
- }
- String type1= IInternalDebugCoreConstants.EMPTY_STRING;
- String type2= IInternalDebugCoreConstants.EMPTY_STRING;
- IMarker marker1= b1.getMarker();
- if (!marker1.exists()) {
- return 0;
- }
- try {
- type1= marker1.getType();
- } catch (CoreException ce) {
- DebugUIPlugin.log(ce);
- }
- try {
- IMarker marker2= b2.getMarker();
- if (!marker2.exists()) {
- return 0;
- }
- type2= marker2.getType();
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
-
- result= type1.compareTo(type2);
- if (result != 0) {
- return result;
- }
- // model and type are the same
-
- ILabelProvider lprov = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider();
- String name1= lprov.getText(e1);
- String name2= lprov.getText(e2);
-
- boolean lineBreakpoint= false;
- try {
- lineBreakpoint= marker1.isSubtypeOf(IBreakpoint.LINE_BREAKPOINT_MARKER);
- } catch (CoreException ce) {
- }
- if (lineBreakpoint) {
- return compareLineBreakpoints(b1, b2, name1,name2);
- }
-
- return name1.compareTo(name2);
- }
-
- protected int compareLineBreakpoints(IBreakpoint b1, IBreakpoint b2, String name1, String name2) {
- int colon1= name1.indexOf(':');
- if (colon1 != -1) {
- int colon2= name2.indexOf(':');
- if (colon2 != -1) {
- String upToColon1= name1.substring(0, colon1);
- if (name2.startsWith(upToColon1)) {
- int l1= 0;
- int l2= 0;
- try {
- l1= ((ILineBreakpoint)b1).getLineNumber();
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- try {
- l2= ((ILineBreakpoint)b2).getLineNumber();
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- return l1 - l2;
- }
- }
- }
- return name1.compareTo(name2);
- }
- }
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
deleted file mode 100644
index 88644a7a7..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
+++ /dev/null
@@ -1,269 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Content provider for the breakpoints view
- */
-public class BreakpointsContentProvider implements ITreeContentProvider, IPropertyChangeListener {
-
- private IBreakpointOrganizer[] fOrganizers = null;
- private BreakpointsViewer fViewer;
- private Object[] fElements;
- private boolean fDisposed = false;
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object parentElement) {
- if (parentElement.equals(DebugPlugin.getDefault().getBreakpointManager())) {
- return fElements;
- } else if (parentElement instanceof BreakpointContainer) {
- return ((BreakpointContainer)parentElement).getChildren();
- }
- return new Object[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object element) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- fDisposed = true;
- fElements = null;
- setOrganizers(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- fViewer = (BreakpointsViewer)viewer;
- if (newInput != null) {
- reorganize();
- }
- }
-
- /**
- * Sets the nested order of breakpoint organizers, or <code>null</code>
- * if none.
- *
- * @param organizers the nested order of breakpoint organizers, or <code>null</code>
- * if none
- */
- public void setOrganizers(IBreakpointOrganizer[] organizers) {
- if (organizers != null && organizers.length == 0) {
- organizers = null;
- }
- // remove previous listeners
- if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].removePropertyChangeListener(this);
- }
- }
- fOrganizers = organizers;
- // add listeners
- if (fOrganizers != null) {
- for (int i = 0; i < fOrganizers.length; i++) {
- fOrganizers[i].addPropertyChangeListener(this);
- }
- }
- if (!fDisposed) {
- fViewer.getControl().setRedraw(false);
- // maintain expansion based on visible breakpoints
- IBreakpoint[] breakpoints = null;
- if (isShowingGroups()) {
- breakpoints = fViewer.getVisibleBreakpoints();
- }
- reorganize();
- if (isShowingGroups()) {
- // restore expansion
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer) fElements[i];
- for (int j = 0; j < breakpoints.length; j++) {
- if (container.contains(breakpoints[j])) {
- fViewer.expandToLevel(container, AbstractTreeViewer.ALL_LEVELS);
- fViewer.updateCheckedState(container);
- break;
- }
- }
-
- }
- }
- fViewer.getControl().setRedraw(true);
- }
- }
-
- /**
- * Returns the root containers containing the given breakpoint, or <code>null</code>
- * if none
- *
- * @param breakpoint
- * @return root containers containing the given breakpoint or <code>null</code>
- */
- public BreakpointContainer[] getRoots(IBreakpoint breakpoint) {
- if (isShowingGroups()) {
- List list = new ArrayList();
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer) fElements[i];
- if (container.contains(breakpoint)) {
- list.add(container);
- }
- }
- return (BreakpointContainer[]) list.toArray(new BreakpointContainer[list.size()]);
- }
- return null;
- }
-
- /**
- * Returns the nested order of breakpoint organizers being used, or <code>null</code>
- * if none.
- *
- * @return the nested order of breakpoint organizers being used, or <code>null</code>
- * if none
- */
- IBreakpointOrganizer[] getOrganizers() {
- return fOrganizers;
- }
-
- /**
- * Organizes the breakpoints based on nested categories, if any.
- */
- protected void reorganize() {
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
- if (fOrganizers == null) {
- fElements = breakpoints;
- } else {
- IBreakpointOrganizer organizer = fOrganizers[0];
- Map categoriesToContainers = new HashMap();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- IAdaptable[] categories = organizer.getCategories(breakpoint);
- if (categories == null || categories.length == 0) {
- categories = OtherBreakpointCategory.getCategories(organizer);
- }
- for (int j = 0; j < categories.length; j++) {
- IAdaptable category = categories[j];
- BreakpointContainer container = (BreakpointContainer) categoriesToContainers.get(category);
- if (container == null) {
- IBreakpointOrganizer[] nesting = null;
- if (fOrganizers.length > 1) {
- nesting = new IBreakpointOrganizer[fOrganizers.length - 1];
- System.arraycopy(fOrganizers, 1, nesting, 0, nesting.length);
- }
- container = new BreakpointContainer(category, organizer, nesting);
- categoriesToContainers.put(category, container);
- }
- container.addBreakpoint(breakpoint);
- }
- }
- // add empty categories
- IAdaptable[] emptyCategories = organizer.getCategories();
- if (emptyCategories != null) {
- for (int i = 0; i < emptyCategories.length; i++) {
- IAdaptable category = emptyCategories[i];
- BreakpointContainer container = (BreakpointContainer) categoriesToContainers.get(category);
- if (container == null) {
- container = new BreakpointContainer(category, organizer, null);
- categoriesToContainers.put(category, container);
- }
- }
- }
- fElements = categoriesToContainers.values().toArray();
- }
- fViewer.getControl().setRedraw(false);
- fViewer.refresh();
- fViewer.getControl().setRedraw(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IBreakpointOrganizerDelegate.P_CATEGORY_CHANGED)) {
- // TODO: only re-organize if showing the changed category
- reorganize();
- }
- }
-
- /**
- * Returns the existing containers the given breakpoint is contained in, or <code>null</code>.
- *
- * @param breakpoint
- * @return the existing containers the given breakpoint is contained in, or <code>null</code>
- */
- protected BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
- if (isShowingGroups()) {
- IAdaptable[] categories = fOrganizers[0].getCategories(breakpoint);
- if (categories == null || categories.length == 0) {
- categories = OtherBreakpointCategory.getCategories(fOrganizers[0]);
- }
- BreakpointContainer[] containers = new BreakpointContainer[categories.length];
- int index = 0;
- for (int i = 0; i < fElements.length; i++) {
- BreakpointContainer container = (BreakpointContainer)fElements[i];
- for (int j = 0; j < categories.length; j++) {
- IAdaptable category = categories[j];
- if (container.getCategory().equals(category)) {
- containers[index] = container;
- index++;
- }
- }
- }
- return containers;
- }
- return null;
- }
-
- /**
- * Returns whether content is grouped by categories.
- *
- * @return whether content is grouped by categories
- */
- protected boolean isShowingGroups() {
- return fOrganizers != null;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
deleted file mode 100644
index 8b547e7ee..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
+++ /dev/null
@@ -1,83 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.util.TransferDragSourceListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
-
-/**
- * A drag adapter for the breakpoints viewer
- */
-public class BreakpointsDragAdapter extends DragSourceAdapter implements TransferDragSourceListener {
-
- /**
- * the associated viewer for the adapter
- */
- private BreakpointsViewer fViewer;
- private Item[] fItems = null;
-
- /**
- * Constructor
- * @param view the associated view, which acts as the selection provider and therefore <b>must</b> implement <code>ISelectionProvider</code>
- */
- public BreakpointsDragAdapter(BreakpointsViewer viewer) {
- Assert.isNotNull(viewer);
- fViewer = viewer;
- }
-
- /**
- * @see TransferDragSourceListener#getTransfer
- */
- public Transfer getTransfer() {
- return LocalSelectionTransfer.getInstance();
- }
-
- /* non Java-doc
- * @see org.eclipse.swt.dnd.DragSourceListener#dragStart
- */
- public void dragStart(DragSourceEvent event) {
- ISelection selection = fViewer.getSelection();
- LocalSelectionTransfer.getInstance().setSelection(selection);
- LocalSelectionTransfer.getInstance().setSelectionSetTime(event.time & 0xFFFFFFFFL);
- event.doit = fViewer.canDrag(fViewer.getSelectedItems());
- fItems = fViewer.getSelectedItems();
- }
-
- /* non Java-doc
- * @see org.eclipse.swt.dnd.DragSourceListener#dragSetData
- */
- public void dragSetData(DragSourceEvent event) {
- // For consistency set the data to the selection even though
- // the selection is provided by the LocalSelectionTransfer
- // to the drop target adapter.
- event.data = LocalSelectionTransfer.getInstance().getSelection();
- }
-
- /* non Java-doc
- * @see org.eclipse.swt.dnd.DragSourceListener#dragFinished
- */
- public void dragFinished(DragSourceEvent event) {
- if (event.detail == DND.DROP_MOVE) {
- // remove from source on move operation
- fViewer.performDrag(fItems);
- }
- fItems = null;
- LocalSelectionTransfer.getInstance().setSelection(null);
- LocalSelectionTransfer.getInstance().setSelectionSetTime(0);
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
deleted file mode 100644
index cd4096d9e..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
+++ /dev/null
@@ -1,56 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
-
-/**
- * BreakpointsDropAdapter
- */
-public class BreakpointsDropAdapter extends ViewerDropAdapter {
-
- private Item fTarget = null;
-
- /**
- * @param viewer
- */
- protected BreakpointsDropAdapter(BreakpointsViewer viewer) {
- super(viewer);
- setFeedbackEnabled(false);
- }
-
- /**
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
- */
- public boolean performDrop(Object data) {
- return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
- }
-
- /**
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#determineTarget(org.eclipse.swt.dnd.DropTargetEvent)
- */
- protected Object determineTarget(DropTargetEvent event) {
- fTarget = (Item) event.item;
- return fTarget;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
- */
- public boolean validateDrop(Object target, int operation, TransferData transferType) {
- return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java
deleted file mode 100644
index 65ba74cd8..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsLabelProvider.java
+++ /dev/null
@@ -1,109 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.ui.CompositeDebugImageDescriptor;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Label provider for the breakpoints view
- */
-public class BreakpointsLabelProvider extends LabelProvider implements IFontProvider {
-
- private WorkbenchLabelProvider fWorkbenchLabelProvider;
- private IDebugModelPresentation fPresentation;
-
- /**
- * Constructs a new label provide for the breakpoints view.
- */
- public BreakpointsLabelProvider() {
- fWorkbenchLabelProvider = new WorkbenchLabelProvider();
- fPresentation = DebugUITools.newDebugModelPresentation();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- fWorkbenchLabelProvider.dispose();
- fPresentation.dispose();
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- if (element instanceof IBreakpoint) {
- return fPresentation.getImage(element);
- }
- Image image = fWorkbenchLabelProvider.getImage(element);
- if (image != null) {
- int flags= computeAdornmentFlags();
- if (flags > 0) {
- CompositeDebugImageDescriptor descriptor= new CompositeDebugImageDescriptor(image, flags);
- return DebugUIPlugin.getImageDescriptorRegistry().get(descriptor);
- }
- }
- return image;
- }
-
- /**
- * Computes and return common adornment flags for the given category.
- *
- * @param element breakpoint category
- * @return adornment flags defined in CompositeDebugImageDescriptor
- */
- private int computeAdornmentFlags() {
- if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
- return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if (element instanceof IBreakpoint) {
- return fPresentation.getText(element);
- }
- return fWorkbenchLabelProvider.getText(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
- */
- public Font getFont(Object element) {
- if (element instanceof IBreakpoint) {
- return null;
- }
- return fWorkbenchLabelProvider.getFont(element);
- }
-
- /**
- * Returns the debug model presentation used by this label provider.
- *
- * @return the debug model presentation used by this label provider
- */
- public IDebugModelPresentation getPresentation() {
- return fPresentation;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
deleted file mode 100644
index 17e8cf0b8..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
+++ /dev/null
@@ -1,791 +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
- * Brock Janiczak - bug 78494
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.breakpoints;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import com.ibm.icu.text.MessageFormat;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-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.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener2;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchCommandConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.XMLMemento;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.progress.IProgressService;
-import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManagerListener;
-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.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.LazyModelPresentation;
-import org.eclipse.debug.internal.ui.actions.breakpointGroups.CopyBreakpointsAction;
-import org.eclipse.debug.internal.ui.actions.breakpointGroups.PasteBreakpointsAction;
-import org.eclipse.debug.internal.ui.actions.breakpointGroups.RemoveFromWorkingSetAction;
-import org.eclipse.debug.internal.ui.actions.breakpoints.OpenBreakpointMarkerAction;
-import org.eclipse.debug.internal.ui.actions.breakpoints.ShowSupportedBreakpointsAction;
-import org.eclipse.debug.internal.ui.actions.breakpoints.SkipAllBreakpointsAction;
-import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
-
-import org.eclipse.debug.ui.AbstractDebugView;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.debug.ui.IDebugUIConstants;
-
-/**
- * This view shows the breakpoints registered with the breakpoint manager
- */
-public class BreakpointsView extends AbstractDebugView implements ISelectionListener, IBreakpointManagerListener, IPerspectiveListener2 {
-
- private BreakpointsViewEventHandler fEventHandler;
- private ICheckStateListener fCheckListener= new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object source = event.getElement();
- if (source instanceof BreakpointContainer) {
- handleContainerChecked(event, (BreakpointContainer) source);
- } else if (source instanceof IBreakpoint) {
- handleBreakpointChecked(event, (IBreakpoint) source);
- }
- }
- };
- private boolean fIsTrackingSelection= false;
- // Persistence constants
- private static String KEY_IS_TRACKING_SELECTION= "isTrackingSelection"; //$NON-NLS-1$
- private static String KEY_VALUE="value"; //$NON-NLS-1$
- private static final String ACTION_REMOVE_FROM_GROUP = "RemoveFromGroup"; //$NON-NLS-1$
- private BreakpointsContentProvider fContentProvider;
- private Clipboard fClipboard;
- private IContextActivation fActivatedContext;
-
- /**
- * This memento allows the Breakpoints view to save and restore state
- * when it is closed and opened within a session. A different
- * memento is supplied by the platform for persistence at
- * workbench shutdown.
- */
- private static IMemento fgMemento;
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this);
- getSite().getWorkbenchWindow().addPerspectiveListener(this);
- }
-
- /**
- * @see AbstractDebugView#createViewer(Composite)
- */
- protected Viewer createViewer(Composite parent) {
- fContentProvider= new BreakpointsContentProvider();
- CheckboxTreeViewer viewer = new BreakpointsViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK));
- setViewer(viewer);
- viewer.setUseHashlookup(true);
- viewer.setContentProvider(fContentProvider);
- viewer.setComparator(new BreakpointsComparator());
- viewer.setInput(DebugPlugin.getDefault().getBreakpointManager());
- viewer.addCheckStateListener(fCheckListener);
- viewer.addTreeListener(new ITreeViewerListener() {
- public void treeExpanded(TreeExpansionEvent event) {
- ((BreakpointsViewer)getViewer()).updateCheckedState(event.getElement());
- }
- public void treeCollapsed(TreeExpansionEvent event) {
- }
- });
- viewer.setLabelProvider(new BreakpointsLabelProvider());
- // Necessary so that the PropertySheetView hears about selections in this view
- getSite().setSelectionProvider(viewer);
- initIsTrackingSelection();
- initBreakpointOrganizers();
- setEventHandler(new BreakpointsViewEventHandler(this));
- initDragAndDrop();
- return viewer;
- }
-
- /**
- * Initializes drag and drop for the breakpoints viewer
- */
- private void initDragAndDrop() {
- BreakpointsViewer viewer = (BreakpointsViewer) getViewer();
- int ops = DND.DROP_MOVE | DND.DROP_COPY;
- // drop
- viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDropAdapter(viewer));
- // Drag
- viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDragAdapter(viewer));
- }
-
- /**
- * Initializes whether this view tracks selection in the
- * debug view from the persisted state.
- */
- private void initIsTrackingSelection() {
- IMemento memento= getMemento();
- if (memento != null) {
- IMemento node= memento.getChild(KEY_IS_TRACKING_SELECTION);
- if (node != null) {
- setTrackSelection(Boolean.valueOf(node.getString(KEY_VALUE)).booleanValue());
- return;
- }
- }
- setTrackSelection(false);
- }
-
- /**
- * Initializes the persisted breakpoints organizers
- */
- private void initBreakpointOrganizers() {
- IMemento memento = getMemento();
- if (memento != null) {
- IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- if (node == null) {
- fContentProvider.setOrganizers(null);
- } else {
- String value = node.getString(KEY_VALUE);
- if (value != null) {
- String[] ids = value.split(","); //$NON-NLS-1$
- BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault();
- List organziers= new ArrayList();
- for (int i = 0; i < ids.length; i++) {
- IBreakpointOrganizer organizer = manager.getOrganizer(ids[i]);
- if (organizer != null) {
- organziers.add(organizer);
- }
- }
- fContentProvider.setOrganizers((IBreakpointOrganizer[]) organziers.toArray(new IBreakpointOrganizer[organziers.size()]));
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#getMemento()
- */
- protected IMemento getMemento() {
- if (fgMemento != null) {
- return fgMemento;
- }
- return super.getMemento();
- }
-
- /**
- * Update the checked state up the given element and all of its children.
- *
- * @param element
- */
- public void updateCheckedState(Object element) {
- ((BreakpointsViewer)getViewer()).updateCheckedState(element);
- }
-
- /**
- * Returns this view's viewer as a checkbox tree viewer.
- * @return this view's viewer as a checkbox tree viewer
- */
- public CheckboxTreeViewer getCheckboxViewer() {
- return (CheckboxTreeViewer) getViewer();
- }
-
- /**
- * Returns this view's content provider as a tree content provider.
- * @return this view's content provider as a tree content provider
- */
- public ITreeContentProvider getTreeContentProvider() {
- return fContentProvider;
- }
-
- /**
- * A breakpoint has been checked/unchecked. Update the group
- * element's checked/grayed state as appropriate.
- */
- private void handleBreakpointChecked(final CheckStateChangedEvent event, final IBreakpoint breakpoint) {
- final boolean enable= event.getChecked();
- String jobName = enable ? DebugUIViewsMessages.BreakpointsView_0 : DebugUIViewsMessages.BreakpointsView_1; //
- new Job(jobName) {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- breakpoint.setEnabled(enable);
- return Status.OK_STATUS;
- } catch (final CoreException e) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- String titleState= enable ? DebugUIViewsMessages.BreakpointsView_6 : DebugUIViewsMessages.BreakpointsView_7; //
- String messageState= enable ? DebugUIViewsMessages.BreakpointsView_8 : DebugUIViewsMessages.BreakpointsView_9; //
- DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), MessageFormat.format(DebugUIViewsMessages.BreakpointsView_10, new String[] { titleState }), MessageFormat.format(DebugUIViewsMessages.BreakpointsView_11, new String[] { messageState }), e); //
- // If the breakpoint fails to update, reset its check state.
- getCheckboxViewer().removeCheckStateListener(fCheckListener);
- event.getCheckable().setChecked(breakpoint, !event.getChecked());
- getCheckboxViewer().addCheckStateListener(fCheckListener);
- }
- });
- }
- return Status.CANCEL_STATUS;
- }
- }.schedule();
- }
-
- /**
- * A group has been checked or unchecked. Enable/disable all of the
- * breakpoints in that group to match.
- */
- private void handleContainerChecked(CheckStateChangedEvent event, BreakpointContainer container) {
- final IBreakpoint[] breakpoints = container.getBreakpoints();
- final boolean enable= event.getChecked();
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- breakpoint.setEnabled(enable);
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- };
- // TODO: should use scheduling rule
- IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
- try {
- progressService.busyCursorWhile(runnable);
- }
- catch (InvocationTargetException e) {}
- catch (InterruptedException e) {}
- }
-
- /**
- * @see AbstractDebugView#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IDebugHelpContextIds.BREAKPOINT_VIEW;
- }
-
- /**
- * @see IWorkbenchPart#dispose()
- */
- public void dispose() {
- disposeAction(IWorkbenchCommandConstants.EDIT_COPY);
- disposeAction(IWorkbenchCommandConstants.EDIT_PASTE);
- disposeAction(ACTION_REMOVE_FROM_GROUP);
-
- if (getCheckboxViewer() != null) {
- getCheckboxViewer().removeCheckStateListener(fCheckListener);
- }
- IAction action= getAction("ShowBreakpointsForModel"); //$NON-NLS-1$
- if (action != null) {
- ((ShowSupportedBreakpointsAction)action).dispose();
- }
- getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener(this);
- super.dispose();
-
- if (getEventHandler() != null) {
- getEventHandler().dispose();
- }
-
- if (fClipboard != null) {
- fClipboard.dispose();
- }
-
- getSite().getWorkbenchWindow().removePerspectiveListener(this);
- }
-
- /**
- * @see AbstractDebugView#createActions()
- */
- protected void createActions() {
- IAction action = new OpenBreakpointMarkerAction(getViewer());
- setAction("GotoMarker", action); //$NON-NLS-1$
- setAction(DOUBLE_CLICK_ACTION, action);
- setAction("ShowBreakpointsForModel", new ShowSupportedBreakpointsAction(getStructuredViewer(),this)); //$NON-NLS-1$
- setAction("SkipBreakpoints", new SkipAllBreakpointsAction(this)); //$NON-NLS-1$
-
- fClipboard= new Clipboard(getSite().getShell().getDisplay());
-
- PasteBreakpointsAction paste = new PasteBreakpointsAction(this);
- configure(paste, ActionFactory.PASTE.getCommandId(), ActionFactory.PASTE.getId(), ISharedImages.IMG_TOOL_PASTE);
- SelectionListenerAction copy = new CopyBreakpointsAction(this, fClipboard, paste);
- configure(copy, ActionFactory.COPY.getCommandId(), ActionFactory.COPY.getId(), ISharedImages.IMG_TOOL_COPY);
-
- SelectionListenerAction remove = new RemoveFromWorkingSetAction(this);
- setAction(ACTION_REMOVE_FROM_GROUP, remove);
- getViewer().addSelectionChangedListener(remove);
- }
-
- /**
- * Configures the action to override the global action, registers
- * the action for selection change notification, and registers
- * the action with this view.
- *
- * @param sla action
- * @param defId action definition id
- * @param globalId global action id
- * @param imgId image identifier
- */
- private void configure(SelectionListenerAction action, String defId, String globalId, String imgId) {
- setAction(defId, action);
- action.setActionDefinitionId(defId);
- getViewSite().getActionBars().setGlobalActionHandler(globalId, action);
- getViewer().addSelectionChangedListener(action);
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imgId));
- }
-
- /**
- * Cleans up selection listener action
- *
- * @param id action id
- */
- private void disposeAction(String id) {
- IAction action = getAction(id);
- if (action instanceof SelectionListenerAction) {
- SelectionListenerAction sla = (SelectionListenerAction) action;
- if (getViewer() != null) {
- getViewer().removeSelectionChangedListener(sla);
- }
- }
- }
-
- /**
- * Adds items to the context menu.
- *
- * @param menu The menu to contribute to
- */
- protected void fillContextMenu(IMenuManager menu) {
- updateObjects();
- menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
- menu.add(new Separator(IDebugUIConstants.NAVIGATION_GROUP));
- menu.add(getAction("GotoMarker")); //$NON-NLS-1$
- menu.add(new Separator(IDebugUIConstants.EMPTY_BREAKPOINT_GROUP));
- menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
- menu.add(getAction(IWorkbenchCommandConstants.EDIT_COPY));
- menu.add(getAction(IWorkbenchCommandConstants.EDIT_PASTE));
- IAction action = getAction(ACTION_REMOVE_FROM_GROUP);
- if (action.isEnabled()) {
- menu.add(action);
- }
- menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
- menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP_GROUP));
-
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /**
- * @see AbstractDebugView#configureToolBar(IToolBarManager)
- */
- protected void configureToolBar(IToolBarManager tbm) {
- tbm.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
- tbm.add(getAction("ShowBreakpointsForModel")); //$NON-NLS-1$
- tbm.add(getAction("GotoMarker")); //$NON-NLS-1$
- tbm.add(getAction("SkipBreakpoints")); //$NON-NLS-1$
- tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
- }
-
- /**
- * Returns this view's event handler
- *
- * @return a breakpoint view event handler
- */
- protected BreakpointsViewEventHandler getEventHandler() {
- return fEventHandler;
- }
-
- /**
- * Sets this view's event handler.
- *
- * @param eventHandler a breakpoint view event handler
- */
- private void setEventHandler(BreakpointsViewEventHandler eventHandler) {
- fEventHandler = eventHandler;
- }
- /**
- * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
- */
- protected void becomesVisible() {
- super.becomesVisible();
- CheckboxTreeViewer viewer = getCheckboxViewer();
- ISelection selection = viewer.getSelection();
- viewer.getControl().setRedraw(false);
- ((BreakpointsContentProvider)viewer.getContentProvider()).reorganize();
- viewer.setSelection(new StructuredSelection(selection));
- viewer.getControl().setRedraw(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection sel) {
- if (sel.isEmpty() || !isTrackingSelection()) {
- return;
- }
- IStructuredSelection selection= (IStructuredSelection) sel;
- Iterator iter= selection.iterator();
- Object firstElement= iter.next();
- if (firstElement == null || iter.hasNext()) {
- return;
- }
- IThread thread= null;
- if (firstElement instanceof IStackFrame) {
- thread= ((IStackFrame) firstElement).getThread();
- } else if (firstElement instanceof IThread) {
- thread= (IThread) firstElement;
- } else {
- return;
- }
- IBreakpoint[] breakpoints= thread.getBreakpoints();
- getViewer().setSelection(new StructuredSelection(breakpoints), true);
- }
-
- /**
- * Returns whether this view is currently tracking the
- * selection from the debug view.
- *
- * @return whether this view is currently tracking the
- * debug view's selection
- */
- public boolean isTrackingSelection() {
- return fIsTrackingSelection;
- }
-
- /**
- * Sets whether this view should track the selection from
- * the debug view.
- *
- * @param trackSelection whether or not this view should
- * track the debug view's selection.
- */
- public void setTrackSelection(boolean trackSelection) {
- fIsTrackingSelection= trackSelection;
- if (trackSelection) {
- getSite().getPage().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
- } else {
- getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- super.saveState(memento);
- IMemento node= memento.createChild(KEY_IS_TRACKING_SELECTION);
- node.putString(KEY_VALUE, String.valueOf(fIsTrackingSelection));
-
- StringBuffer buffer= new StringBuffer();
- IBreakpointOrganizer[] organizers = fContentProvider.getOrganizers();
- if (organizers != null) {
- for (int i = 0; i < organizers.length; i++) {
- IBreakpointOrganizer organizer = organizers[i];
- buffer.append(organizer.getIdentifier());
- if (i < (organizers.length - 1)) {
- buffer.append(',');
- }
- }
- node = memento.createChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- node.putString(KEY_VALUE, buffer.toString());
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
- */
- public void breakpointManagerEnablementChanged(boolean enabled) {
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- IAction action = getAction("SkipBreakpoints"); //$NON-NLS-1$
- if (action != null) {
- ((SkipAllBreakpointsAction) action).updateActionCheckedState();
- }
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- */
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection= (IStructuredSelection) event.getSelection();
- if (selection.size() == 1) {
- Object element = selection.getFirstElement();
- if (element instanceof BreakpointContainer) {
- getCheckboxViewer().setExpandedState(element, !getCheckboxViewer().getExpandedState(element));
- return;
- }
- }
- super.doubleClick(event);
- }
-
- /**
- * @param selectedContainers
- */
- public void setBreakpointOrganizers(IBreakpointOrganizer[] organizers) {
- Viewer viewer = getViewer();
- ISelection selection = viewer.getSelection();
- fContentProvider.setOrganizers(organizers);
- viewer.setSelection(selection);
- }
-
- /**
- * returns the complete listing of breakpoints organizers
- * @return the complete listing of breakpoint organizers
- */
- public IBreakpointOrganizer[] getBreakpointOrganizers() {
- return fContentProvider.getOrganizers();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener2#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, org.eclipse.ui.IWorkbenchPartReference, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) {
- if (partRef instanceof IViewReference && changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE)) {
- String id = ((IViewReference) partRef).getId();
- if (id.equals(getViewSite().getId())) {
- // BreakpointsView closed. Persist settings.
- fgMemento= XMLMemento.createWriteRoot("BreakpointsViewMemento"); //$NON-NLS-1$
- saveState(fgMemento);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDebugView#getPresentation(java.lang.String)
- */
- public IDebugModelPresentation getPresentation(String id) {
- if (getViewer() instanceof StructuredViewer) {
- IBaseLabelProvider lp = ((StructuredViewer)getViewer()).getLabelProvider();
- if (lp instanceof BreakpointsLabelProvider) {
- BreakpointsLabelProvider blp = (BreakpointsLabelProvider) lp;
- lp = blp.getPresentation();
- }
- if (lp instanceof DelegatingModelPresentation) {
- return ((DelegatingModelPresentation)lp).getPresentation(id);
- }
- if (lp instanceof LazyModelPresentation) {
- if (((LazyModelPresentation)lp).getDebugModelIdentifier().equals(id)) {
- return (IDebugModelPresentation)lp;
- }
- }
- }
- return null;
- }
-
- /**
- * This method is used solely to preserve the selection state of the viewer in the event that the current selection is to be removed
- * @param selection the selection to be removed
- *
- * @since 3.3
- */
- public void preserveSelection(IStructuredSelection selection) {
- if(selection != null && !selection.isEmpty()) {
- TreeItem item = (TreeItem) ((BreakpointsViewer)getCheckboxViewer()).searchItem(selection.getFirstElement());
- Object toselect = null;
- if(item != null) {
- TreeItem parent = item.getParentItem();
- if(parent != null) {
- int idx = 0;
- if(parent.getItemCount() == 1) {
- toselect = parent.getData();
- }
- idx = parent.indexOf(item);
- if(idx == 0) {
- if(parent.getItemCount() > 1) {
- toselect = parent.getItem(1).getData();
- }
- else {
- toselect = parent.getItem(0).getData();
- }
- }
- if(idx > 0) {
- toselect = parent.getItem(idx-1).getData();
- }
- }
- else {
- Tree tree = item.getParent();
- TreeItem[] items = tree.getItems();
- if (items.length > 1){
- for(int i = 0; i < items.length; i++) {
- if(item.equals(items[i])) {
- if(i+1 >= items.length){
- toselect = items[i-1].getData();
- break;
- } else {
- toselect = items[i+1].getData();
- break;
- }
-
- }
- }
- }
- }
- }
- if(toselect != null) {
- getViewer().setSelection(new StructuredSelection(toselect), true);
- }
- }
- }
-
- /**
- * Returns whether the given selection can be pasted into the given target.
- * <p>
- * Scheme:
- * <ul>
- * <li>Breakpoints can only be pasted into allowable containers (i..e. like workings sets)</li>
- * <li>Breakpoints can only be pasted into containers that they do not already reside in</li>
- * <li>Breakpoints can only be pasted into containers, not other breakpoints</li>
- * </ul>
- * </p>
- *
- * @param target target of the paste
- * @param selection the selection to paste
- * @return whether the given selection can be pasted into the given target
- *
- * TODO Remove in favour of using <code>TreeItem</code>s and <code>TreePath</code>s to determine paste targets
- */
- public boolean canPaste(Object target, ISelection selection) {
- if(!(target instanceof BreakpointContainer)) {
- return false;
- }
- if(selection.isEmpty()) {
- return false;
- }
- IStructuredSelection ss = (IStructuredSelection) selection;
- BreakpointContainer container = (BreakpointContainer) target;
- IBreakpoint breakpoint = null;
- Object element = null;
- for(Iterator iter = ss.iterator(); iter.hasNext();) {
- element = iter.next();
- if(!(element instanceof IBreakpoint)) {
- return false;
- }
- breakpoint = (IBreakpoint) element;
- if (container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Pastes the selection into the given target
- *
- * @param target target of the paste, either a BreakpointContainer,
- * or a Breakpoint within a BreakpointContainer
- * @param selection breakpoints
- * @return whether successful
- *
- * TODO remove in favour of using <code>TreeItem</code> as paste target
- */
- public boolean performPaste(Object target, ISelection selection) {
- if (target instanceof BreakpointContainer && selection instanceof IStructuredSelection) {
- BreakpointContainer container = (BreakpointContainer) target;
- Object[] objects = ((IStructuredSelection)selection).toArray();
- for (int i = 0; i < objects.length; i++) {
- container.getOrganizer().addBreakpoint((IBreakpoint)objects[i], container.getCategory());
- }
- return true;
- }
- return false;
- }
-
- /**
- * Returns if the breakpoints view is currently showing groups or not
- * @return true of the breakpoints view showing groups, false otherwise
- */
- public boolean isShowingGroups() {
- return fContentProvider.isShowingGroups();
- }
-
- /**
- * @see org.eclipse.ui.part.PageBookView#partActivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part) {
- if (part.equals(this)) {
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- fActivatedContext = contextService.activateContext(IDebugUIConstants.ID_BREAKPOINT_VIEW);
- }
- super.partActivated(part);
- }
-
- /**
- * @see org.eclipse.ui.part.PageBookView#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- if (part.equals(this)) {
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- contextService.deactivateContext(fActivatedContext);
- }
- super.partDeactivated(part);
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java
deleted file mode 100644
index 300bc1a55..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java
+++ /dev/null
@@ -1,186 +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
- * Brock Janiczak - bug 57999
- * Michael Fraenkel - bug 84385
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.breakpoints;
-
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.IBreakpointManagerListener;
-import org.eclipse.debug.core.IBreakpointsListener;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.activities.ActivityManagerEvent;
-import org.eclipse.ui.activities.IActivityManagerListener;
-import org.eclipse.ui.activities.IWorkbenchActivitySupport;
-
-/**
- * Handles breakpoint events and activity manager events (which can affect grouping),
- * updating the breakpoints view and viewer.
- */
-public class BreakpointsViewEventHandler implements IBreakpointsListener, IActivityManagerListener, IBreakpointManagerListener {
-
- private BreakpointsView fView;
-
- /**
- * Constructs an event handler for the breakpoints view.
- */
- public BreakpointsViewEventHandler(BreakpointsView view) {
- fView= view;
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- breakpointManager.addBreakpointListener(this);
- breakpointManager.addBreakpointManagerListener(this);
- IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench().getActivitySupport();
- if (activitySupport != null) {
- activitySupport.getActivityManager().addActivityManagerListener(this);
- }
- }
-
- /**
- * When this event handler is disposed, remove it as a listener.
- */
- public void dispose() {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- breakpointManager.removeBreakpointListener(this);
- breakpointManager.removeBreakpointManagerListener(this);
- IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench().getActivitySupport();
- if (activitySupport != null) {
- activitySupport.getActivityManager().removeActivityManagerListener(this);
- }
- }
-
- /**
- * @see IBreakpointsListener#breakpointsAdded(IBreakpoint[])
- */
- public void breakpointsAdded(final IBreakpoint[] breakpoints) {
- if (fView.isAvailable() && fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- if (fView.isAvailable()) {
- CheckboxTreeViewer viewer = fView.getCheckboxViewer();
- viewer.getControl().setRedraw(false);
- BreakpointsContentProvider provider = (BreakpointsContentProvider)viewer.getContentProvider();
- provider.reorganize();
-
- // This code is left in as a test case for platform bug 77075
- //for (int i = 0; i < breakpoints.length; i++) {
- //viewer.expandToLevel(breakpoints[i], AbstractTreeViewer.ALL_LEVELS);
- //}
- // expand as required
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- BreakpointContainer[] roots = provider.getRoots(breakpoint);
- if (roots != null) {
- for (int j = 0; j < roots.length; j++) {
- viewer.expandToLevel(roots[j], AbstractTreeViewer.ALL_LEVELS);
- }
- }
- }
- fView.getViewer().refresh();
- viewer.setSelection(new StructuredSelection(breakpoints));
- viewer.getControl().setRedraw(true);
- fView.updateObjects();
- }
- }
- });
- }
- }
-
- /**
- * @see IBreakpointsListener#breakpointsRemoved(IBreakpoint[], IMarkerDelta[])
- */
- public void breakpointsRemoved(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- if (fView.isAvailable() && fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- if (fView.isAvailable()) {
- CheckboxTreeViewer viewer= (CheckboxTreeViewer)fView.getViewer();
- viewer.getControl().setRedraw(false);
- ((BreakpointsContentProvider)viewer.getContentProvider()).reorganize();
- viewer.getControl().setRedraw(true);
- fView.updateObjects();
- }
- }
- });
- }
- }
-
- /**
- * @see IBreakpointsListener#breakpointsChanged(IBreakpoint[], IMarkerDelta[])
- */
- public void breakpointsChanged(final IBreakpoint[] breakpoints, final IMarkerDelta[] deltas) {
- if (fView.isAvailable() & fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- if (fView.isAvailable()) {
- CheckboxTreeViewer viewer = (CheckboxTreeViewer)fView.getViewer();
- viewer.getControl().setRedraw(false);
- BreakpointsContentProvider provider = (BreakpointsContentProvider) viewer.getContentProvider();
- Set updates = new HashSet();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- viewer.update(breakpoint, null);
- BreakpointContainer[] containers = provider.getContainers(breakpoint);
- if (containers != null) {
- for (int j = 0; j < containers.length; j++ ) {
- updates.add(containers[j]);
- }
- } else {
- updates.add(breakpoint);
- }
- }
- Object[] objects = updates.toArray();
- for (int i = 0; i < objects.length; i++) {
- fView.updateCheckedState(objects[i]);
- }
- viewer.getControl().setRedraw(true);
- fView.updateObjects();
- }
- }
- });
- }
- }
-
- /**
- * When new activities are added or enabled, refresh the view contents to add/remove
- * breakpoints related to the affected activities.
- */
- public void activityManagerChanged(final ActivityManagerEvent activityManagerEvent) {
- if (fView.isAvailable() & fView.isVisible() && activityManagerEvent.haveEnabledActivityIdsChanged()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- fView.getViewer().refresh();
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
- */
- public void breakpointManagerEnablementChanged(boolean enabled) {
- if (fView.isAvailable() & fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- fView.getViewer().refresh();
- }
- });
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
deleted file mode 100644
index 97604e2d2..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
+++ /dev/null
@@ -1,447 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * Breakpoints viewer.
- */
-public class BreakpointsViewer extends CheckboxTreeViewer {
-
- /**
- * Constructs a new breakpoints viewer with the given tree.
- *
- * @param tree
- */
- public BreakpointsViewer(Tree tree) {
- super(tree);
- }
-
- /**
- * Returns the selected items.
- *
- * @return selected items
- */
- public Item[] getSelectedItems() {
- return getSelection(getControl());
- }
-
- /**
- * Returns the item associated with the given element, or <code>null</code>.
- *
- * @param element element in breakpoints view
- * @return item associated with the given element, or <code>null</code>
- */
- public Widget searchItem(Object element) {
- return findItem(element);
- }
-
- /**
- * Refreshes the given item in the tree.
- *
- * @param item item to refresh
- */
- public void refreshItem(TreeItem item) {
- updateItem(item, item.getData());
- }
-
- /**
- * Returns a collection of currently visible breakpoints.
- *
- * @return collection of currently visible breakpoints
- */
- public IBreakpoint[] getVisibleBreakpoints() {
- IBreakpointManager manager= DebugPlugin.getDefault().getBreakpointManager();
- Object[] elements= ((ITreeContentProvider)getContentProvider()).getElements(manager);
- List list = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
- TreeItem item = (TreeItem) searchItem(elements[i]);
- if (item != null) {
- collectExpandedBreakpoints(item, list);
- }
- }
- return (IBreakpoint[]) list.toArray(new IBreakpoint[list.size()]);
- }
-
- /**
- * Adds expanded breakpoints to the list. Traverses children of the given
- * tree item if any.
- *
- * @param item
- * @param list collection of visible breakpoints
- */
- private void collectExpandedBreakpoints(TreeItem item, List list) {
- Object data = item.getData();
- if (data instanceof IBreakpoint) {
- list.add(data);
- return;
- }
- if (item.getExpanded()) {
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- collectExpandedBreakpoints(items[i], list);
- }
- }
- }
-
- /**
- * Sets the selection to a specific tree item
- *
- * @param item
- */
- protected void setSelection(TreeItem item) {
- getTree().setSelection(new TreeItem[]{item});
- updateSelection(getSelection());
- }
-
- /**
- * Returns the container from within the specified path that is the container the breakpoint can be removed from
- * @param breakpoint the breakpoint to get the container for
- * @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
- * @since 3.3
- */
- public BreakpointContainer getRemovableContainer(Item item) {
- if(item == null) {
- return null;
- }
- if(item.getData() instanceof IBreakpoint) {
- TreePath path = getTreePathFromItem(item);
- if(path != null) {
- IBreakpoint breakpoint = (IBreakpoint) path.getLastSegment();
- BreakpointContainer container = null;
- for(int i = path.getSegmentCount()-2; i > -1; i--) {
- container = (BreakpointContainer) path.getSegment(i);
- if(container.contains(breakpoint) && container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
- return container;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the addable breakpoint container of the specified breakpoint
- * @param breakpoint the breakpoint to get the container for
- * @return the first found addable container for the specified breakpoint or <code>null</code> if none found
- * @since 3.3
- */
- public BreakpointContainer getAddableContainer(Item item) {
- TreePath path = getTreePathFromItem(item);
- if(path != null) {
- Object element = path.getLastSegment();
- if(element instanceof IBreakpoint) {
- BreakpointContainer container = null;
- IBreakpoint breakpoint = (IBreakpoint) element;
- for(int i = path.getSegmentCount()-2; i > -1; i--) {
- container = (BreakpointContainer) path.getSegment(i);
- if(container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return container;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns if the selected item in the tree can be dragged
- * <p>
- * Scheme:
- * <ul>
- * <li>breakpoint containers cannot be dragged</li>
- * <li>breakpoints can be dragged iff the container they reside in supports the removal of breakpoints</li>
- * </ul>
- * </p>
- * @param element the element to test if it can be dragged
- * @return true if the selected element can be dragged, false otherwise
- * @since 3.3
- */
- public boolean canDrag(Item[] items) {
- if(items == null) {
- return false;
- }
- if(items.length == 0) {
- return false;
- }
- for(int i = 0; i < items.length; i++) {
- if(getRemovableContainer(items[i]) == null) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Performs the actual removal of breakpoints from their respective (removable) containers on a successful drag operation
- * @param selection the selection of breakpoints involved in the drag
- * @since 3.3
- */
- public void performDrag(Item[] items) {
- if(items == null) {
- return;
- }
- Map containersToBreakpoints = new HashMap();
- BreakpointContainer container = null;
- IBreakpoint breakpoint = null;
- for(int i = 0; i < items.length; i++) {
- if(!items[i].isDisposed()) {
- breakpoint = (IBreakpoint)items[i].getData();
- container = getRemovableContainer(items[i]);
- if(container != null) {
- List list = (List) containersToBreakpoints.get(container);
- if (list == null) {
- list = new ArrayList();
- containersToBreakpoints.put(container, list);
- }
- list.add(breakpoint);
- }
- }
- }
- Iterator iterator = containersToBreakpoints.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry entry = (Entry) iterator.next();
- container = (BreakpointContainer) entry.getKey();
- List list = (List) entry.getValue();
- IBreakpointOrganizer organizer = container.getOrganizer();
- IBreakpoint[] breakpoints = (IBreakpoint[]) list.toArray(new IBreakpoint[list.size()]);
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
- IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
- extension.removeBreakpoints(breakpoints, container.getCategory());
- } else {
- for (int i = 0; i < breakpoints.length; i++) {
- organizer.removeBreakpoint(breakpoints[i], container.getCategory());
- }
- }
- }
- }
-
- /**
- * Determines if the specified element can be dropped into the specified target
- * <p>
- * Scheme:
- * <ul>
- * <li>Breakpoints can be dropped into working sets</li>
- * <li>Breakpoints can be dropped into breakpoints, provided there is a droppable parent of the target breakpoint</li>
- * </ul>
- * </p>
- * @param target the target for the drop
- * @param element the element we want to drop
- * @return true if the specified element can be dropped into the specified target, false otherwise
- * @since 3.3
- */
- public boolean canDrop(Item target, IStructuredSelection selection) {
- if(selection == null || target == null) {
- return false;
- }
- for(Iterator iter = selection.iterator(); iter.hasNext();) {
- Object currentObject = iter.next();
- if (!(currentObject instanceof IBreakpoint) || !checkAddableParentContainers(target, (IBreakpoint)currentObject)){
- return false;
- }
- }
- return true;
- }
-
- /**
- * This method is used to determine if there is an addable parent container available for the specified drop target.
- * <p>
- * A drop target can be either a <code>BreakpointContainer</code> or an <code>IBreakpoint</code>. This method always checks the entire heirarchy
- * of the tree path for the specified target in the event one of the parent element does not support dropping.
- * </p>
- * @param target
- * @param breakpoint
- * @return
- */
- private boolean checkAddableParentContainers(Item target, IBreakpoint breakpoint) {
- BreakpointContainer container = null;
- TreePath path = getTreePathFromItem(target);
- if(path != null) {
- Object element = null;
- for(int i = path.getSegmentCount()-1; i > -1; i--) {
- element = path.getSegment(i);
- if(element instanceof BreakpointContainer) {
- container = (BreakpointContainer) element;
- if(container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Performs the actual addition of the selected breakpoints to the specified target
- * @param target the target to add the selection of breakpoints to
- * @param selection the selection of breakpoints
- * @return true if the drop occurred, false otherwise
- * @since 3.3
- */
- public boolean performDrop(Item target, IStructuredSelection selection) {
- if(target == null || selection == null) {
- return false;
- }
- IBreakpoint breakpoint = null;
- Object element = target.getData();
- BreakpointContainer container = (element instanceof BreakpointContainer ? (BreakpointContainer)element : getAddableContainer(target));
- if(container == null) {
- return false;
- }
- IBreakpointOrganizer organizer = container.getOrganizer();
- if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
- IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
- Object[] array = selection.toArray();
- IBreakpoint[] breakpoints = new IBreakpoint[array.length];
- System.arraycopy(array, 0, breakpoints, 0, array.length);
- extension.addBreakpoints(breakpoints, container.getCategory());
- } else {
- for(Iterator iter = selection.iterator(); iter.hasNext();) {
- breakpoint = (IBreakpoint) iter.next();
- organizer.addBreakpoint(breakpoint, container.getCategory());
- }
- }
- expandToLevel(target.getData(), ALL_LEVELS);
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.Viewer#refresh()
- */
- public void refresh() {
- super.refresh();
- initializeCheckedState();
- }
-
- /**
- * Sets the initial checked state of the items in the viewer.
- */
- private void initializeCheckedState() {
- TreeItem[] items = getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- updateCheckedState(items[i]);
- }
- }
-
- /**
- * Update the checked state up the given element and all of its children.
- *
- * @param element
- */
- public void updateCheckedState(Object element) {
- Widget[] widgets = searchItems(element);
- for (int i = 0; i < widgets.length; i++) {
- Widget widget = widgets[i];
- if (widget != null) {
- updateCheckedState((TreeItem)widget);
- }
- }
- }
-
- /**
- * finds all occurrences of a widget to update
- * @param element the element to search for when finding occurrences
- * @return a list of widget occurrences to update or an empty list
- */
- private Widget[] searchItems(Object element) {
- ArrayList list = new ArrayList();
- TreeItem[] items = getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
- }
- return (Widget[]) list.toArray(new Widget[0]);
- }
-
- /**
- * performs the actual search for items in the tree
- * @param list the list to add matches to
- * @param item the item in the tree
- * @param element the element to compare
- */
- private void findAllOccurrences(TreeItem item, Object element, ArrayList list) {
- if (element.equals(item.getData())) {
- list.add(item);
- }
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- findAllOccurrences(items[i], element, list);
- }
- }
-
- /**
- * Update the checked state up the given element and all of its children.
- *
- * @param element
- */
- public void updateCheckedState(TreeItem item) {
- Object element = item.getData();
- if (element instanceof IBreakpoint) {
- try {
- item.setChecked(((IBreakpoint) element).isEnabled());
- refreshItem(item);
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- } else if (element instanceof BreakpointContainer) {
- IBreakpoint[] breakpoints = ((BreakpointContainer) element).getBreakpoints();
- int enabledChildren= 0;
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- try {
- if (breakpoint.isEnabled()) {
- enabledChildren++;
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- if (enabledChildren == 0) {
- // Uncheck the container node if no children are enabled
- item.setGrayed(false);
- item.setChecked(false);
- } else if (enabledChildren == breakpoints.length) {
- // Check the container if all children are enabled
- item.setGrayed(false);
- item.setChecked(true);
- } else {
- // If some but not all children are enabled, gray the container node
- item.setGrayed(true);
- item.setChecked(true);
- }
- // Update any children (breakpoints and containers)
- TreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- updateCheckedState(items[i]);
- }
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java
deleted file mode 100644
index bf2a4b316..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/FileBreakpointOrganizer.java
+++ /dev/null
@@ -1,41 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
-
-/**
- * Breakpoint organizers for files.
- *
- * @since 3.1
- */
-public class FileBreakpointOrganizer extends AbstractBreakpointOrganizerDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories(org.eclipse.debug.core.model.IBreakpoint)
- */
- public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- IResource resource = marker.getResource();
- if (resource.getType() == IResource.FILE) {
- return new IAdaptable[]{(IFile)resource};
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizer.java
deleted file mode 100644
index eefe1f7f5..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizer.java
+++ /dev/null
@@ -1,58 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A breakpoint organizer is used to categorize breakpoints and provides
- * change notification when categorization has changed. Breakpoint organizers
- * are contributed via the <code>breakpointOrganizers</code> extension point.
- * <p>
- * This interface is not intended to be implemented. Clients contributing a breakpoint
- * organizer are intended to implement <code>IBreakpointOrganizerDelegate</code>.
- * </p>
- * @since 3.1
- */
-public interface IBreakpointOrganizer extends IBreakpointOrganizerDelegate {
-
- /**
- * Returns a label for this breakpoint organizer.
- *
- * @return a label for this breakpoint organizer
- */
- public String getLabel();
-
- /**
- * Returns an image descriptor for this breakpoint organizer or <code>null</code>.
- *
- * @return an image descriptor for this breakpoint organizer or <code>null</code>
- */
- public ImageDescriptor getImageDescriptor();
-
- /**
- * Returns a unique identifier for this breakpoint organizer.
- *
- * @return a unique identifier for this breakpoint organizer
- */
- public String getIdentifier();
-
- /**
- * Returns the label for breakpoints that do not fall into a category
- * for this organizer.
- *
- * @return label for breakpoints that do not fall into a category
- * for this organizer
- */
- public String getOthersLabel();
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/OtherBreakpointCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/OtherBreakpointCategory.java
deleted file mode 100644
index 388bb547c..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/OtherBreakpointCategory.java
+++ /dev/null
@@ -1,95 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Category for breakpoints in "other" categories.
- */
-public class OtherBreakpointCategory extends PlatformObject implements IWorkbenchAdapter {
-
- private static Map fOthers = new HashMap();
- private IBreakpointOrganizer fOrganizer;
-
-
- public static IAdaptable[] getCategories(IBreakpointOrganizer organizer) {
- IAdaptable[] others = (IAdaptable[]) fOthers.get(organizer);
- if (others == null) {
- others = new IAdaptable[]{new OtherBreakpointCategory(organizer)};
- fOthers.put(organizer, others);
- }
- return others;
- }
-
- /**
- * Constructs an 'other' category for the given organizer.
- *
- * @param organizer breakpoint organizer
- */
- private OtherBreakpointCategory(IBreakpointOrganizer organizer) {
- fOrganizer = organizer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return fOrganizer.getOthersLabel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof OtherBreakpointCategory) {
- OtherBreakpointCategory category = (OtherBreakpointCategory) obj;
- return fOrganizer.equals(category.fOrganizer);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fOrganizer.hashCode();
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java
deleted file mode 100644
index 03d8ebdda..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ProjectBreakpointOrganizer.java
+++ /dev/null
@@ -1,40 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
-
-/**
- * Breakpoint organizers for projects.
- *
- * @since 3.1
- */
-public class ProjectBreakpointOrganizer extends AbstractBreakpointOrganizerDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories(org.eclipse.debug.core.model.IBreakpoint)
- */
- public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- IProject project = marker.getResource().getProject();
- if (project != null) {
- return new IAdaptable[]{project};
- }
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
deleted file mode 100644
index 14125fcd2..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetBreakpointOrganizer.java
+++ /dev/null
@@ -1,99 +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.debug.internal.ui.views.breakpoints;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Breakpoint organizers for resource working sets.
- *
- * @since 3.1
- */
-public class WorkingSetBreakpointOrganizer extends AbstractBreakpointOrganizerDelegate implements IPropertyChangeListener {
-
- IWorkingSetManager fWorkingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
-
- /**
- * Constructs a working set breakpoint organizer. Listens for changes in
- * working sets and fires property change notification.
- */
- public WorkingSetBreakpointOrganizer() {
- fWorkingSetManager.addPropertyChangeListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories(org.eclipse.debug.core.model.IBreakpoint)
- */
- public IAdaptable[] getCategories(IBreakpoint breakpoint) {
- List result = new ArrayList();
- List parents = new ArrayList();
- IResource res = breakpoint.getMarker().getResource();
- parents.add(res);
- while (res != null) {
- res = res.getParent();
- if (res != null) {
- parents.add(res);
- }
- }
- IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- if (!IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(workingSets[i].getId())) {
- IAdaptable[] elements = workingSets[i].getElements();
- for (int j = 0; j < elements.length; j++) {
- IResource resource = (IResource) elements[j].getAdapter(IResource.class);
- if (resource != null) {
- if (parents.contains(resource)) {
- result.add(new WorkingSetCategory(workingSets[i]));
- break;
- }
- }
- }
- }
- }
- return (IAdaptable[]) result.toArray(new IAdaptable[result.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#dispose()
- */
- public void dispose() {
- fWorkingSetManager.removePropertyChangeListener(this);
- fWorkingSetManager = null;
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- IWorkingSet set = null;
- if (event.getNewValue() instanceof IWorkingSet) {
- set = (IWorkingSet) event.getNewValue();
- } else if (event.getOldValue() instanceof IWorkingSet) {
- set = (IWorkingSet) event.getOldValue();
- }
- if (set != null && !IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
- fireCategoryChanged(new WorkingSetCategory(set));
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
deleted file mode 100644
index 99293d41f..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
+++ /dev/null
@@ -1,137 +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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-
-/**
- * Represents a breakpoint category for a specific working set.
- */
-public class WorkingSetCategory extends PlatformObject implements IWorkbenchAdapter, IWorkbenchAdapter2 {
-
- private IWorkingSet fWorkingSet;
-
- /**
- * Constructs a new workings set category for the given working set.
- *
- * @param workingSet
- */
- public WorkingSetCategory(IWorkingSet workingSet) {
- fWorkingSet = workingSet;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return fWorkingSet.getImageDescriptor();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- StringBuffer name = new StringBuffer(fWorkingSet.getName());
- if (isDefault()) {
- name.append(DebugUIViewsMessages.WorkingSetCategory_0);
- }
- return name.toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /**
- * Returns the working set for this category.
- *
- * @return
- */
- public IWorkingSet getWorkingSet() {
- return fWorkingSet;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof WorkingSetCategory) {
- WorkingSetCategory category = (WorkingSetCategory) obj;
- return category.getWorkingSet().equals(fWorkingSet);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fWorkingSet.hashCode();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter2#getForeground(java.lang.Object)
- */
- public RGB getForeground(Object element) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter2#getBackground(java.lang.Object)
- */
- public RGB getBackground(Object element) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter2#getFont(java.lang.Object)
- */
- public FontData getFont(Object element) {
- if (isDefault()) {
- FontData[] fontData = JFaceResources.getDefaultFont().getFontData();
- if (fontData != null && fontData.length > 0) {
- FontData data = fontData[0];
- data.setStyle(SWT.BOLD);
- return data;
- }
- }
- return null;
- }
-
- /**
- * Whether this is the default breakpoint working set.
- *
- * @return whether this is the default breakpoint working set
- */
- private boolean isDefault() {
- return fWorkingSet.equals(BreakpointSetOrganizer.getDefaultWorkingSet());
- }
-}
-
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
deleted file mode 100644
index a51c68d14..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleLineNotifier.java
+++ /dev/null
@@ -1,161 +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.debug.internal.ui.views.console;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.console.IConsoleLineTracker;
-import org.eclipse.debug.ui.console.IConsoleLineTrackerExtension;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.PatternMatchEvent;
-import org.eclipse.ui.console.TextConsole;
-
-/**
- * Tracks text appended to the console and notifies listeners in terms of whole
- * lines.
- */
-public class ConsoleLineNotifier implements IPatternMatchListener, IPropertyChangeListener {
- /**
- * Console listeners
- */
- private List fListeners = new ArrayList(2);
-
- /**
- * The console this notifier is tracking
- */
- private ProcessConsole fConsole = null;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListenerDelegate#connect(org.eclipse.ui.console.TextConsole)
- */
- public void connect(TextConsole console) {
- if (console instanceof ProcessConsole) {
- fConsole = (ProcessConsole)console;
-
- IConsoleLineTracker[] lineTrackers = DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(fConsole.getProcess());
- for (int i = 0; i < lineTrackers.length; i++) {
- lineTrackers[i].init(fConsole);
- addConsoleListener(lineTrackers[i]);
- }
-
- fConsole.addPropertyChangeListener(this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#disconnect()
- */
- public synchronized void disconnect() {
- try {
- IDocument document = fConsole.getDocument();
- if (document != null) {
- int lastLine = document.getNumberOfLines() - 1;
- if (document.getLineDelimiter(lastLine) == null) {
- IRegion lineInformation = document.getLineInformation(lastLine);
- lineAppended(lineInformation);
- }
- }
- } catch (BadLocationException e) {
- }
- }
-
- /**
- * Notification the console's streams have been closed
- */
- public synchronized void consoleClosed() {
- int size = fListeners.size();
- for (int i = 0; i < size; i++) {
- IConsoleLineTracker tracker = (IConsoleLineTracker) fListeners.get(i);
- if (tracker instanceof IConsoleLineTrackerExtension) {
- ((IConsoleLineTrackerExtension) tracker).consoleClosed();
- }
- tracker.dispose();
- }
-
- fConsole = null;
- fListeners = null;
- }
-
- /**
- * Adds the given listener to the list of listeners notified when a line of
- * text is appended to the console.
- *
- * @param listener
- */
- public void addConsoleListener(IConsoleLineTracker listener) {
- if (!fListeners.contains(listener))
- fListeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#matchFound(org.eclipse.ui.console.PatternMatchEvent)
- */
- public void matchFound(PatternMatchEvent event) {
- try {
- IDocument document = fConsole.getDocument();
- int lineOfOffset = document.getLineOfOffset(event.getOffset());
- String delimiter = document.getLineDelimiter(lineOfOffset);
- int strip = delimiter==null ? 0 : delimiter.length();
- Region region = new Region(event.getOffset(), event.getLength()-strip);
- lineAppended(region);
- } catch (BadLocationException e) {}
- }
-
- public void lineAppended(IRegion region) {
- int size = fListeners.size();
- for (int i=0; i<size; i++) {
- IConsoleLineTracker tracker = (IConsoleLineTracker) fListeners.get(i);
- tracker.lineAppended(region);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if(event.getProperty().equals(IConsoleConstants.P_CONSOLE_OUTPUT_COMPLETE)) {
- fConsole.removePropertyChangeListener(this);
- consoleClosed();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getPattern()
- */
- public String getPattern() {
- return ".*\\r(\\n?)|.*\\n"; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getCompilerFlags()
- */
- public int getCompilerFlags() {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IPatternMatchListener#getLineQualifier()
- */
- public String getLineQualifier() {
- return "\\n|\\r"; //$NON-NLS-1$
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java
deleted file mode 100644
index 935439620..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.java
+++ /dev/null
@@ -1,41 +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.debug.internal.ui.views.console;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ConsoleMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.console.ConsoleMessages";//$NON-NLS-1$
-
- public static String ConsoleRemoveAllTerminatedAction_0;
- public static String ConsoleRemoveAllTerminatedAction_1;
-
- public static String ConsoleTerminateAction_0;
- public static String ConsoleTerminateAction_1;
-
- public static String ProcessConsole_0;
-
- public static String ProcessConsole_1;
- public static String ProcessConsole_2;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, ConsoleMessages.class);
- }
-
- public static String ConsoleRemoveTerminatedAction_0;
-
- public static String ConsoleRemoveTerminatedAction_1;
-
- public static String ShowStandardErrorAction_0;
-
- public static String ShowStandardOutAction_0;
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties
deleted file mode 100644
index 9c441dc1a..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleMessages.properties
+++ /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 Corporation - initial API and implementation
-###############################################################################
-
-ConsoleRemoveAllTerminatedAction_0=&Remove All Terminated
-ConsoleRemoveAllTerminatedAction_1=Remove All Terminated Launches
-ConsoleRemoveTerminatedAction_0=Remove Launch
-ConsoleRemoveTerminatedAction_1=Remove Launch
-
-ConsoleTerminateAction_0=&Terminate
-ConsoleTerminateAction_1=Terminate
-
-ProcessConsole_0=<terminated> {0}
-
-ProcessConsole_1=[Console output redirected to file:{0}]\n
-ProcessConsole_2=[Invalid file specified for console output: {0}]\n
-ShowStandardErrorAction_0=Show Console When Standard Error Changes
-ShowStandardOutAction_0=Show Console When Standard Out Changes
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java
deleted file mode 100644
index 9d3a049bc..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveAllTerminatedAction.java
+++ /dev/null
@@ -1,96 +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.debug.internal.ui.views.console;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchesListener2;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.actions.RemoveAllTerminatedAction;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * ConsoleRemoveAllTerminatedAction
- */
-public class ConsoleRemoveAllTerminatedAction extends Action implements IUpdate, ILaunchesListener2 {
-
- public void dispose() {
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- if (launch.isTerminated()) {
- setEnabled(true);
- return;
- }
- }
- setEnabled(false);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- RemoveAllTerminatedAction.removeTerminatedLaunches(launches);
- }
-
- public ConsoleRemoveAllTerminatedAction() {
- super(ConsoleMessages.ConsoleRemoveAllTerminatedAction_0);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CONSOLE_REMOVE_ALL_TERMINATED);
- setToolTipText(ConsoleMessages.ConsoleRemoveAllTerminatedAction_1);
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE_ALL));
- setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_ALL));
- setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE_ALL));
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener#launchesRemoved(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesRemoved(ILaunch[] launches) {
- if (isEnabled()) {
- update();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener#launchesAdded(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesAdded(ILaunch[] launches) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener#launchesChanged(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesChanged(ILaunch[] launches) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener2#launchesTerminated(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesTerminated(ILaunch[] launches) {
- update();
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java
deleted file mode 100644
index dcd6847c0..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleRemoveLaunchAction.java
+++ /dev/null
@@ -1,139 +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.debug.internal.ui.views.console;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.ILaunchesListener2;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleListener;
-import org.eclipse.ui.console.IConsoleView;
-
-/**
- * ConsoleRemoveTerminatedAction
- */
-public class ConsoleRemoveLaunchAction extends Action implements IViewActionDelegate, IConsoleListener, ILaunchesListener2 {
-
- private ILaunch fLaunch;
-
- // only used when a view action delegate
- private IConsoleView fConsoleView;
-
- public ConsoleRemoveLaunchAction() {
- super(ConsoleMessages.ConsoleRemoveTerminatedAction_0);
- setToolTipText(ConsoleMessages.ConsoleRemoveTerminatedAction_1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CONSOLE_REMOVE_LAUNCH);
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_REMOVE));
- setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE));
- setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE));
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
- ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(this);
- }
-
- public ConsoleRemoveLaunchAction(ILaunch launch) {
- this();
- fLaunch = launch;
- update();
- }
-
- public void dispose() {
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
- ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
- }
-
- public synchronized void update() {
- ILaunch launch = getLaunch();
- if (launch != null) {
- setEnabled(launch.isTerminated());
- } else {
- setEnabled(false);
- }
- }
-
- public synchronized void run() {
- ILaunch launch = getLaunch();
- if (launch != null) {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- launchManager.removeLaunch(launch);
- }
- }
-
- public void init(IViewPart view) {
- if (view instanceof IConsoleView) {
- fConsoleView = (IConsoleView) view;
- }
- update();
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void consolesAdded(IConsole[] consoles) {
- }
-
- public void consolesRemoved(IConsole[] consoles) {
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener2#launchesTerminated(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesTerminated(ILaunch[] launches) {
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener#launchesRemoved(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesRemoved(ILaunch[] launches) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener#launchesAdded(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesAdded(ILaunch[] launches) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.ILaunchesListener#launchesChanged(org.eclipse.debug.core.ILaunch[])
- */
- public void launchesChanged(ILaunch[] launches) {
- }
-
- protected ILaunch getLaunch() {
- if (fConsoleView == null) {
- return fLaunch;
- }
- // else get dynmically, as this action was created via plug-in XML view contribution
- IConsole console = fConsoleView.getConsole();
- if (console instanceof ProcessConsole) {
- ProcessConsole pconsole = (ProcessConsole) console;
- return pconsole.getProcess().getLaunch();
- }
- return null;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java
deleted file mode 100644
index 7ff97a24d..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java
+++ /dev/null
@@ -1,52 +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.debug.internal.ui.views.console;
-
-import org.eclipse.debug.internal.ui.SWTFactory;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * ConsoleShowPreferencesAction Displays the Console's Preference page
- *
- * @since 3.2
- */
-public class ConsoleShowPreferencesAction extends Action implements IViewActionDelegate {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {}
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- SWTFactory.showPreferencePage("org.eclipse.debug.ui.ConsolePreferencePage"); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
deleted file mode 100644
index e562612ce..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleTerminateAction.java
+++ /dev/null
@@ -1,105 +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.debug.internal.ui.views.console;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.commands.ITerminateHandler;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.commands.actions.DebugCommandService;
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * ConsoleTerminateAction
- */
-public class ConsoleTerminateAction extends Action implements IUpdate {
-
- private ProcessConsole fConsole;
- private IWorkbenchWindow fWindow;
-
- /**
- * Creates a terminate action for the console
- */
- public ConsoleTerminateAction(IWorkbenchWindow window, ProcessConsole console) {
- super(ConsoleMessages.ConsoleTerminateAction_0);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CONSOLE_TERMINATE_ACTION);
- fConsole = console;
- fWindow = window;
- setToolTipText(ConsoleMessages.ConsoleTerminateAction_1);
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE));
- setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_TERMINATE));
- setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_TERMINATE));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CONSOLE_TERMINATE_ACTION);
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- IProcess process = fConsole.getProcess();
- setEnabled(process.canTerminate());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- IProcess process = fConsole.getProcess();
- List targets = collectTargets(process);
- targets.add(process);
- DebugCommandService service = DebugCommandService.getService(fWindow);
- service.executeCommand(ITerminateHandler.class, targets.toArray(), null);
- }
-
- /**
- * Collects targets associated with a process.
- *
- * @param process
- * @return associated targets
- */
- private List collectTargets(IProcess process) {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
- List targets = new ArrayList();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- IProcess[] processes = launch.getProcesses();
- for (int j = 0; j < processes.length; j++) {
- IProcess process2 = processes[j];
- if (process2.equals(process)) {
- IDebugTarget[] debugTargets = launch.getDebugTargets();
- for (int k = 0; k < debugTargets.length; k++) {
- targets.add(debugTargets[k]);
- }
- return targets; // all possible targets have been terminated for the launch.
- }
- }
- }
- return targets;
- }
-
- public void dispose() {
- fConsole = null;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
deleted file mode 100644
index 6e382e940..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java
+++ /dev/null
@@ -1,828 +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.debug.internal.ui.views.console;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-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.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.variables.IStringVariableManager;
-import org.eclipse.core.variables.VariablesPlugin;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.IStreamListener;
-import org.eclipse.debug.core.model.IFlushableStreamMonitor;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamMonitor;
-import org.eclipse.debug.core.model.IStreamsProxy;
-import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.console.IConsole;
-import org.eclipse.debug.ui.console.IConsoleColorProvider;
-import org.eclipse.debug.ui.console.IConsoleHyperlink;
-import org.eclipse.debug.ui.console.IConsoleLineTracker;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IHyperlink;
-import org.eclipse.ui.console.IOConsole;
-import org.eclipse.ui.console.IOConsoleInputStream;
-import org.eclipse.ui.console.IOConsoleOutputStream;
-import org.eclipse.ui.console.IPatternMatchListener;
-import org.eclipse.ui.console.PatternMatchEvent;
-import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.progress.UIJob;
-
-import com.ibm.icu.text.MessageFormat;
-
-/**
- * A console for a system process with standard I/O streams.
- *
- * @since 3.0
- */
-public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSetListener, IPropertyChangeListener {
- private IProcess fProcess = null;
-
- private List fStreamListeners = new ArrayList();
-
- private IConsoleColorProvider fColorProvider;
-
- private IOConsoleInputStream fInput;
-
- private FileOutputStream fFileOutputStream;
-
- private boolean fAllocateConsole = true;
-
- private boolean fStreamsClosed = false;
-
- /**
- * Proxy to a console document
- */
- public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider) {
- this(process, colorProvider, null);
- }
-
- /**
- * Constructor
- * @param process the process to associate with this console
- * @param colorProvider the colour provider for this console
- * @param encoding the desired encoding for this console
- */
- public ProcessConsole(IProcess process, IConsoleColorProvider colorProvider, String encoding) {
- super(IInternalDebugCoreConstants.EMPTY_STRING, IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE, null, encoding, true);
- fProcess = process;
-
- ILaunchConfiguration configuration = process.getLaunch().getLaunchConfiguration();
- String file = null;
- boolean append = false;
- if (configuration != null) {
- try {
- file = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE, (String) null);
- if (file != null) {
- IStringVariableManager stringVariableManager = VariablesPlugin.getDefault().getStringVariableManager();
- file = stringVariableManager.performStringSubstitution(file);
- append = configuration.getAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, false);
- }
- } catch (CoreException e) {
- }
- }
-
- if (file != null) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- Path path = new Path(file);
- IFile ifile = root.getFileForLocation(path);
- String message = null;
-
- try {
- String fileLoc = null;
- if (ifile != null) {
- if (append && ifile.exists()) {
- ifile.appendContents(new ByteArrayInputStream(new byte[0]), true, true, new NullProgressMonitor());
- } else {
- if (ifile.exists()) {
- ifile.delete(true, new NullProgressMonitor());
- }
- ifile.create(new ByteArrayInputStream(new byte[0]), true, new NullProgressMonitor());
- }
- }
-
- File outputFile = new File(file);
- fFileOutputStream = new FileOutputStream(outputFile, append);
- fileLoc = outputFile.getAbsolutePath();
-
- message = MessageFormat.format(ConsoleMessages.ProcessConsole_1, new String[] {fileLoc});
- addPatternMatchListener(new ConsoleLogFilePatternMatcher(fileLoc));
- } catch (FileNotFoundException e) {
- message = MessageFormat.format(ConsoleMessages.ProcessConsole_2, new String[] {file});
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- if (message != null) {
- try {
- IOConsoleOutputStream stream = newOutputStream();
- stream.write(message);
- stream.close();
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- }
- try {
- fAllocateConsole = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
- } catch (CoreException e) {
- }
- }
-
- fColorProvider = colorProvider;
- fInput = getInputStream();
- colorProvider.connect(fProcess, this);
-
- setName(computeName());
-
- Color color = fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_INPUT_STREAM);
- fInput.setColor(color);
-
- IConsoleLineTracker[] lineTrackers = DebugUIPlugin.getDefault().getProcessConsoleManager().getLineTrackers(process);
- if (lineTrackers.length > 0) {
- addPatternMatchListener(new ConsoleLineNotifier());
- }
- }
-
- /**
- * Computes and returns the image descriptor for this console.
- *
- * @return an image descriptor for this console or <code>null</code>
- */
- protected ImageDescriptor computeImageDescriptor() {
- ILaunchConfiguration configuration = getProcess().getLaunch().getLaunchConfiguration();
- if (configuration != null) {
- ILaunchConfigurationType type;
- try {
- type = configuration.getType();
- return DebugPluginImages.getImageDescriptor(type.getIdentifier());
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- return null;
- }
-
- /**
- * Computes and returns the current name of this console.
- *
- * @return a name for this console
- */
- protected String computeName() {
- String label = null;
- IProcess process = getProcess();
- ILaunchConfiguration config = process.getLaunch().getLaunchConfiguration();
-
- label = process.getAttribute(IProcess.ATTR_PROCESS_LABEL);
- if (label == null) {
- if (config == null) {
- label = process.getLabel();
- } else {
- // check if PRIVATE config
- if (DebugUITools.isPrivate(config)) {
- label = process.getLabel();
- } else {
- String type = null;
- try {
- type = config.getType().getName();
- } catch (CoreException e) {
- }
- StringBuffer buffer = new StringBuffer();
- buffer.append(config.getName());
- if (type != null) {
- buffer.append(" ["); //$NON-NLS-1$
- buffer.append(type);
- buffer.append("] "); //$NON-NLS-1$
- }
- buffer.append(process.getLabel());
- label = buffer.toString();
- }
- }
- }
-
- if (process.isTerminated()) {
- return MessageFormat.format(ConsoleMessages.ProcessConsole_0, new String[] { label });
- }
- return label;
- }
-
- /**
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent evt) {
- String property = evt.getProperty();
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- if (property.equals(IDebugPreferenceConstants.CONSOLE_WRAP) || property.equals(IDebugPreferenceConstants.CONSOLE_WIDTH)) {
- boolean fixedWidth = store.getBoolean(IDebugPreferenceConstants.CONSOLE_WRAP);
- if (fixedWidth) {
- int width = store.getInt(IDebugPreferenceConstants.CONSOLE_WIDTH);
- setConsoleWidth(width);
- } else {
- setConsoleWidth(-1);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT) || property.equals(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK) || property.equals(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK)) {
- boolean limitBufferSize = store.getBoolean(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT);
- if (limitBufferSize) {
- int highWater = store.getInt(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK);
- int lowWater = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK);
- if (highWater > lowWater) {
- setWaterMarks(lowWater, highWater);
- }
- } else {
- setWaterMarks(-1, -1);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH)) {
- int tabWidth = store.getInt(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH);
- setTabWidth(tabWidth);
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT)) {
- boolean activateOnOut = store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT);
- IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM);
- if (stream != null) {
- stream.setActivateOnWrite(activateOnOut);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR)) {
- boolean activateOnErr = store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR);
- IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_ERROR_STREAM);
- if (stream != null) {
- stream.setActivateOnWrite(activateOnErr);
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR)) {
- IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM);
- if (stream != null) {
- stream.setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM));
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR)) {
- IOConsoleOutputStream stream = getStream(IDebugUIConstants.ID_STANDARD_ERROR_STREAM);
- if (stream != null) {
- stream.setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM));
- }
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR)) {
- if (fInput != null) {
- fInput.setColor(fColorProvider.getColor(IDebugUIConstants.ID_STANDARD_INPUT_STREAM));
- }
- } else if (property.equals(IDebugUIConstants.PREF_CONSOLE_FONT)) {
- setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
- } else if (property.equals(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)) {
- setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#getStream(java.lang.String)
- */
- public IOConsoleOutputStream getStream(String streamIdentifier) {
- for (Iterator i = fStreamListeners.iterator(); i.hasNext();) {
- StreamListener listener = (StreamListener) i.next();
- if (listener.fStreamId.equals(streamIdentifier)) {
- return listener.fStream;
- }
- }
- return null;
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#getProcess()
- */
- public IProcess getProcess() {
- return fProcess;
- }
-
- /**
- * @see org.eclipse.ui.console.IOConsole#dispose()
- */
- protected void dispose() {
- super.dispose();
- fColorProvider.disconnect();
- closeStreams();
- disposeStreams();
- DebugPlugin.getDefault().removeDebugEventListener(this);
- DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
- JFaceResources.getFontRegistry().removeListener(this);
- }
-
- /**
- * cleanup method to clsoe all of the open stream to this console
- */
- private synchronized void closeStreams() {
- if (fStreamsClosed) {
- return;
- }
- for (Iterator i = fStreamListeners.iterator(); i.hasNext();) {
- StreamListener listener = (StreamListener) i.next();
- listener.closeStream();
- }
- if (fFileOutputStream != null) {
- synchronized (fFileOutputStream) {
- try {
- fFileOutputStream.flush();
- fFileOutputStream.close();
- } catch (IOException e) {
- }
- }
- }
- try {
- fInput.close();
- } catch (IOException e) {
- }
- fStreamsClosed = true;
- }
-
- /**
- * disposes ofthe listeners for each of the stream associated with this console
- */
- private synchronized void disposeStreams() {
- for (Iterator i = fStreamListeners.iterator(); i.hasNext();) {
- StreamListener listener = (StreamListener) i.next();
- listener.dispose();
- }
- fFileOutputStream = null;
- fInput = null;
- }
-
- /**
- * @see org.eclipse.ui.console.AbstractConsole#init()
- */
- protected void init() {
- super.init();
- if (fProcess.isTerminated()) {
- closeStreams();
- resetName();
- } else {
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- store.addPropertyChangeListener(this);
- JFaceResources.getFontRegistry().addListener(this);
- if (store.getBoolean(IDebugPreferenceConstants.CONSOLE_WRAP)) {
- setConsoleWidth(store.getInt(IDebugPreferenceConstants.CONSOLE_WIDTH));
- }
- setTabWidth(store.getInt(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH));
-
- if (store.getBoolean(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT)) {
- int highWater = store.getInt(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK);
- int lowWater = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK);
- setWaterMarks(lowWater, highWater);
- }
-
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));
- setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR));
- }
- });
- }
-
- /**
- * Notify listeners when name changes.
- *
- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[])
- */
- public void handleDebugEvents(DebugEvent[] events) {
- for (int i = 0; i < events.length; i++) {
- DebugEvent event = events[i];
- if (event.getSource().equals(getProcess())) {
-
- if (event.getKind() == DebugEvent.TERMINATE) {
- closeStreams();
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
-
- resetName();
- }
- }
- }
-
- /**
- * resets the name of this console to the original computed name
- */
- private void resetName() {
- final String newName = computeName();
- String name = getName();
- if (!name.equals(newName)) {
- UIJob job = new UIJob("Update console title") { //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- ProcessConsole.this.setName(newName);
- warnOfContentChange();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.schedule();
- }
- }
-
- /**
- * send notification of a change of content in this console
- */
- private void warnOfContentChange() {
- ConsolePlugin.getDefault().getConsoleManager().warnOfContentChange(DebugUITools.getConsole(fProcess));
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#connect(org.eclipse.debug.core.model.IStreamsProxy)
- */
- public void connect(IStreamsProxy streamsProxy) {
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- IStreamMonitor streamMonitor = streamsProxy.getErrorStreamMonitor();
- if (streamMonitor != null) {
- connect(streamMonitor, IDebugUIConstants.ID_STANDARD_ERROR_STREAM,
- store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR));
- }
- streamMonitor = streamsProxy.getOutputStreamMonitor();
- if (streamMonitor != null) {
- connect(streamMonitor, IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM,
- store.getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT));
- }
- InputReadJob readJob = new InputReadJob(streamsProxy);
- readJob.setSystem(true);
- readJob.schedule();
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#connect(org.eclipse.debug.core.model.IStreamMonitor, java.lang.String)
- */
- public void connect(IStreamMonitor streamMonitor, String streamIdentifier) {
- connect(streamMonitor, streamIdentifier, false);
- }
-
- /**
- * Connects the given stream monitor to a new output stream with the given identifier.
- *
- * @param streamMonitor stream monitor
- * @param streamIdentifier stream identifier
- * @param activateOnWrite whether the stream should displayed when written to
- */
- private void connect(IStreamMonitor streamMonitor, String streamIdentifier, boolean activateOnWrite) {
- IOConsoleOutputStream stream = null;
- if (fAllocateConsole) {
- stream = newOutputStream();
- Color color = fColorProvider.getColor(streamIdentifier);
- stream.setColor(color);
- stream.setActivateOnWrite(activateOnWrite);
- }
- synchronized (streamMonitor) {
- StreamListener listener = new StreamListener(streamIdentifier, streamMonitor, stream);
- fStreamListeners.add(listener);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#addLink(org.eclipse.debug.ui.console.IConsoleHyperlink, int, int)
- */
- public void addLink(IConsoleHyperlink link, int offset, int length) {
- try {
- addHyperlink(link, offset, length);
- } catch (BadLocationException e) {
- DebugUIPlugin.log(e);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#addLink(org.eclipse.ui.console.IHyperlink, int, int)
- */
- public void addLink(IHyperlink link, int offset, int length) {
- try {
- addHyperlink(link, offset, length);
- } catch (BadLocationException e) {
- DebugUIPlugin.log(e);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.console.IConsole#getRegion(org.eclipse.debug.ui.console.IConsoleHyperlink)
- */
- public IRegion getRegion(IConsoleHyperlink link) {
- return super.getRegion(link);
- }
-
- /**
- * This class listens to a specified IO stream
- */
- private class StreamListener implements IStreamListener {
-
- private IOConsoleOutputStream fStream;
-
- private IStreamMonitor fStreamMonitor;
-
- private String fStreamId;
-
- private boolean fFlushed = false;
-
- private boolean fListenerRemoved = false;
-
- public StreamListener(String streamIdentifier, IStreamMonitor monitor, IOConsoleOutputStream stream) {
- this.fStreamId = streamIdentifier;
- this.fStreamMonitor = monitor;
- this.fStream = stream;
- fStreamMonitor.addListener(this);
- //fix to bug 121454. Ensure that output to fast processes is processed.
- streamAppended(null, monitor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.core.IStreamListener#streamAppended(java.lang.String,
- * org.eclipse.debug.core.model.IStreamMonitor)
- */
- public void streamAppended(String text, IStreamMonitor monitor) {
- String encoding = getEncoding();
- if (fFlushed) {
- try {
- if (fStream != null) {
- if (encoding == null)
- fStream.write(text);
- else
- fStream.write(text.getBytes(encoding));
- }
- if (fFileOutputStream != null) {
- synchronized (fFileOutputStream) {
- if (encoding == null)
- fFileOutputStream.write(text.getBytes());
- else
- fFileOutputStream.write(text.getBytes(encoding));
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- } else {
- String contents = null;
- synchronized (fStreamMonitor) {
- fFlushed = true;
- contents = fStreamMonitor.getContents();
- if (fStreamMonitor instanceof IFlushableStreamMonitor) {
- IFlushableStreamMonitor m = (IFlushableStreamMonitor) fStreamMonitor;
- m.flushContents();
- m.setBuffered(false);
- }
- }
- try {
- if (contents != null && contents.length() > 0) {
- if (fStream != null) {
- fStream.write(contents);
- }
- if (fFileOutputStream != null) {
- synchronized (fFileOutputStream) {
- fFileOutputStream.write(contents.getBytes());
- }
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
-
- public void closeStream() {
- if (fStreamMonitor == null) {
- return;
- }
- synchronized (fStreamMonitor) {
- fStreamMonitor.removeListener(this);
- if (!fFlushed) {
- String contents = fStreamMonitor.getContents();
- streamAppended(contents, fStreamMonitor);
- }
- fListenerRemoved = true;
- try {
- if (fStream != null) {
- fStream.close();
- }
- } catch (IOException e) {
- }
- }
- }
-
- public void dispose() {
- if (!fListenerRemoved) {
- closeStream();
- }
- fStream = null;
- fStreamMonitor = null;
- fStreamId = null;
- }
- }
-
- private class InputReadJob extends Job {
-
- private IStreamsProxy streamsProxy;
-
- InputReadJob(IStreamsProxy streamsProxy) {
- super("Process Console Input Job"); //$NON-NLS-1$
- this.streamsProxy = streamsProxy;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- try {
- byte[] b = new byte[1024];
- int read = 0;
- while (fInput != null && read >= 0) {
- read = fInput.read(b);
- if (read > 0) {
- String s = new String(b, 0, read);
- streamsProxy.write(s);
- }
- }
- } catch (IOException e) {
- DebugUIPlugin.log(e);
- }
- return Status.OK_STATUS;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.console.IConsole#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- if (super.getImageDescriptor() == null) {
- setImageDescriptor(computeImageDescriptor());
- }
- return super.getImageDescriptor();
- }
-
- private class ConsoleLogFilePatternMatcher implements IPatternMatchListener {
- String fFilePath;
-
- public ConsoleLogFilePatternMatcher(String filePath) {
- fFilePath = escape(filePath);
- }
-
- private String escape(String path) {
- StringBuffer buffer = new StringBuffer(path);
- int index = buffer.indexOf("\\"); //$NON-NLS-1$
- while (index >= 0) {
- buffer.insert(index, '\\');
- index = buffer.indexOf("\\", index+2); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-
- public String getPattern() {
- return fFilePath;
- }
-
- public void matchFound(PatternMatchEvent event) {
- try {
- addHyperlink(new ConsoleLogFileHyperlink(fFilePath), event.getOffset(), event.getLength());
- removePatternMatchListener(this);
- } catch (BadLocationException e) {
- }
- }
-
- public int getCompilerFlags() {
- return 0;
- }
-
- public String getLineQualifier() {
- return null;
- }
-
- public void connect(TextConsole console) {
- }
-
- public void disconnect() {
- }
- }
-
- private class ConsoleLogFileHyperlink implements IHyperlink {
- String fFilePath;
- ConsoleLogFileHyperlink(String filePath) {
- fFilePath = filePath;
- }
-
- public void linkActivated() {
- IEditorInput input;
- Path path = new Path(fFilePath);
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile ifile = root.getFileForLocation(path);
- if (ifile == null) { // The file is not in the workspace
- File file = new File(fFilePath);
- LocalFileStorage lfs = new LocalFileStorage(file);
- input = new StorageEditorInput(lfs, file);
-
- } else {
- input = new FileEditorInput(ifile);
- }
-
- IWorkbenchPage activePage = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
- try {
- activePage.openEditor(input, EditorsUI.DEFAULT_TEXT_EDITOR_ID, true);
- } catch (PartInitException e) {
- }
- }
- public void linkEntered() {
- }
- public void linkExited() {
- }
- }
-
- class StorageEditorInput extends PlatformObject implements IStorageEditorInput {
- private File fFile;
- private IStorage fStorage;
-
- public StorageEditorInput(IStorage storage, File file) {
- fStorage = storage;
- fFile = file;
- }
-
- public IStorage getStorage() {
- return fStorage;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public String getName() {
- return getStorage().getName();
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- return getStorage().getFullPath().toOSString();
- }
-
- public boolean equals(Object object) {
- return object instanceof StorageEditorInput &&
- getStorage().equals(((StorageEditorInput)object).getStorage());
- }
-
- public int hashCode() {
- return getStorage().hashCode();
- }
-
- public boolean exists() {
- return fFile.exists();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.AbstractConsole#getHelpContextId()
- */
- public String getHelpContextId() {
- return IDebugHelpContextIds.PROCESS_CONSOLE;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
deleted file mode 100644
index df8479fe7..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsoleManager.java
+++ /dev/null
@@ -1,331 +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.debug.internal.ui.views.console;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchListener;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.console.ConsoleColorProvider;
-import org.eclipse.debug.ui.console.IConsoleColorProvider;
-import org.eclipse.debug.ui.console.IConsoleLineTracker;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleManager;
-
-import com.ibm.icu.text.MessageFormat;
-
-/**
- * Creates documents for processes as they are registered with a launch.
- * The singleton manager is accessible from the debug UI plugin.
- */
-public class ProcessConsoleManager implements ILaunchListener {
-
- /**
- * Console document content provider extensions, keyed by extension id
- */
- private Map fColorProviders;
-
- /**
- * The default color provider. Used if no color provider is contributed
- * for the given process type.
- */
- private IConsoleColorProvider fDefaultColorProvider;
-
- /**
- * Console line trackers; keyed by process type to list of trackers (1:N)
- */
- private Map fLineTrackers;
-
- /**
- * Map of processes for a launch to compute removed processes
- */
- private Map fProcesses;
-
-
-
- /**
- * @see ILaunchListener#launchRemoved(ILaunch)
- */
- public void launchRemoved(ILaunch launch) {
- removeLaunch(launch);
- }
-
- protected void removeLaunch(ILaunch launch) {
- IProcess[] processes= launch.getProcesses();
- for (int i= 0; i < processes.length; i++) {
- IProcess iProcess = processes[i];
- removeProcess(iProcess);
- }
- if (fProcesses != null) {
- fProcesses.remove(launch);
- }
- }
-
- /**
- * Removes the console and document associated with the given process.
- *
- * @param iProcess process to clean up
- */
- private void removeProcess(IProcess iProcess) {
- IConsole console = getConsole(iProcess);
-
- if (console != null) {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- manager.removeConsoles(new IConsole[]{console});
- }
- }
-
- /**
- * Returns the console for the given process, or <code>null</code> if none.
- *
- * @param process
- * @return the console for the given process, or <code>null</code> if none
- */
- public IConsole getConsole(IProcess process) {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] consoles = manager.getConsoles();
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (console instanceof ProcessConsole) {
- ProcessConsole pc = (ProcessConsole)console;
- if (pc.getProcess().equals(process)) {
- return pc;
- }
- }
- }
- return null;
- }
-
- /**
- * @see ILaunchListener#launchAdded(ILaunch)
- */
- public void launchAdded(ILaunch launch) {
- launchChanged(launch);
- }
-
- /**
- * @see ILaunchListener#launchChanged(ILaunch)
- */
- public void launchChanged(final ILaunch launch) {
- IProcess[] processes= launch.getProcesses();
- for (int i= 0; i < processes.length; i++) {
- if (getConsoleDocument(processes[i]) == null) {
- IProcess process = processes[i];
- if (process.getStreamsProxy() == null) {
- continue;
- }
-
- //create a new console.
- IConsoleColorProvider colorProvider = getColorProvider(process.getAttribute(IProcess.ATTR_PROCESS_TYPE));
- String encoding = launch.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING);
- ProcessConsole pc = new ProcessConsole(process, colorProvider, encoding);
- pc.setAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS, process);
-
- //add new console to console manager.
- ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[]{pc});
- }
- }
- List removed = getRemovedProcesses(launch);
- if (removed != null) {
- Iterator iterator = removed.iterator();
- while (iterator.hasNext()) {
- IProcess p = (IProcess) iterator.next();
- removeProcess(p);
- }
- }
- }
-
- /**
- * Returns the document for the process, or <code>null</code>
- * if none.
- */
- public IDocument getConsoleDocument(IProcess process) {
- ProcessConsole console = (ProcessConsole) getConsole(process);
- return (console != null ? console.getDocument() : null);
- }
-
- /**
- * Called by the debug ui plug-in on startup.
- * The console document manager starts listening for
- * launches to be registered and initializes if any launches
- * already exist.
- */
- public void startup() {
- ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
- launchManager.addLaunchListener(this);
-
- //set up the docs for launches already registered
- ILaunch[] launches= launchManager.getLaunches();
- for (int i = 0; i < launches.length; i++) {
- launchAdded(launches[i]);
- }
- }
-
- /**
- * Called by the debug ui plug-in on shutdown.
- * The console document manager de-registers as a
- * launch listener and kills all existing console documents.
- */
- public void shutdown() {
- ILaunchManager launchManager= DebugPlugin.getDefault().getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- removeLaunch(launch);
- }
- launchManager.removeLaunchListener(this);
- if (fProcesses != null) {
- fProcesses.clear();
- }
- }
-
- /**
- * Returns a new console document color provider extension for the given
- * process type, or <code>null</code> if none.
- *
- * @param type corresponds to <code>IProcess.ATTR_PROCESS_TYPE</code>
- * @return IConsoleColorProvider
- */
- public IConsoleColorProvider getColorProvider(String type) {
- if (fColorProviders == null) {
- fColorProviders = new HashMap();
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_COLOR_PROVIDERS);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement extension = elements[i];
- fColorProviders.put(extension.getAttribute("processType"), extension); //$NON-NLS-1$
- }
- }
- IConfigurationElement extension = (IConfigurationElement)fColorProviders.get(type);
- if (extension != null) {
- try {
- Object colorProvider = extension.createExecutableExtension("class"); //$NON-NLS-1$
- if (colorProvider instanceof IConsoleColorProvider) {
- return (IConsoleColorProvider)colorProvider;
- }
- DebugUIPlugin.logErrorMessage(MessageFormat.format(
- "Extension {0} must specify an instanceof IConsoleColorProvider for class attribute.", //$NON-NLS-1$
- new String[]{extension.getDeclaringExtension().getUniqueIdentifier()}));
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- //no color provider found of specified type, return default color provider.
- if (fDefaultColorProvider == null) {
- fDefaultColorProvider = new ConsoleColorProvider();
- }
- return fDefaultColorProvider;
- }
-
- /**
- * Returns the Line Trackers for a given process type.
- * @param process The process for which line trackers are required.
- * @return An array of line trackers which match the given process type.
- */
- public IConsoleLineTracker[] getLineTrackers(IProcess process) {
- String type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE);
-
- if (fLineTrackers == null) {
- fLineTrackers = new HashMap();
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONSOLE_LINE_TRACKERS);
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement extension = elements[i];
- String processType = extension.getAttribute("processType"); //$NON-NLS-1$
- List list = (List)fLineTrackers.get(processType);
- if (list == null) {
- list = new ArrayList();
- fLineTrackers.put(processType, list);
- }
- list.add(extension);
- }
- }
-
- ArrayList trackers = new ArrayList();
- if (type != null) {
- List lineTrackerExtensions = (List) fLineTrackers.get(type);
- if(lineTrackerExtensions != null) {
- for(Iterator i = lineTrackerExtensions.iterator(); i.hasNext(); ) {
- IConfigurationElement element = (IConfigurationElement) i.next();
- try {
- trackers.add(element.createExecutableExtension("class")); //$NON-NLS-1$
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
- }
- return (IConsoleLineTracker[]) trackers.toArray(new IConsoleLineTracker[0]);
- }
-
- /**
- * Returns the processes that have been removed from the given
- * launch, or <code>null</code> if none.
- *
- * @param launch launch that has changed
- * @return removed processes or <code>null</code>
- */
- private List getRemovedProcesses(ILaunch launch) {
- List removed = null;
- if (fProcesses == null) {
- fProcesses = new HashMap();
- }
- IProcess[] old = (IProcess[]) fProcesses.get(launch);
- IProcess[] curr = launch.getProcesses();
- if (old != null) {
- for (int i = 0; i < old.length; i++) {
- IProcess process = old[i];
- if (!contains(curr, process)) {
- if (removed == null) {
- removed = new ArrayList();
- }
- removed.add(process);
- }
- }
- }
- // update cache with current processes
- fProcesses.put(launch, curr);
- return removed;
- }
-
- /**
- * Returns whether the given object is contained in the list.
- *
- * @param list list to search
- * @param object object to search for
- * @return whether the given object is contained in the list
- */
- private boolean contains(Object[] list, Object object) {
- for (int i = 0; i < list.length; i++) {
- Object object2 = list[i];
- if (object2.equals(object)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
deleted file mode 100644
index e61655643..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsolePageParticipant.java
+++ /dev/null
@@ -1,269 +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.debug.internal.ui.views.console;
-
-import java.io.IOException;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamsProxy;
-import org.eclipse.debug.core.model.IStreamsProxy2;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.console.IConsolePageParticipant;
-import org.eclipse.ui.console.IConsoleView;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.handlers.IHandlerActivation;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.part.ShowInContext;
-
-/**
- * Creates and manages process console specific actions
- *
- * @since 3.1
- */
-public class ProcessConsolePageParticipant implements IConsolePageParticipant, IShowInSource, IShowInTargetList, IDebugEventSetListener, IDebugContextListener {
-
- // actions
- private ConsoleTerminateAction fTerminate;
- private ConsoleRemoveLaunchAction fRemoveTerminated;
- private ConsoleRemoveAllTerminatedAction fRemoveAllTerminated;
- private ShowWhenContentChangesAction fStdOut;
- private ShowWhenContentChangesAction fStdErr;
-
- private ProcessConsole fConsole;
-
- private IPageBookViewPage fPage;
-
- private IConsoleView fView;
-
- private EOFHandler fEOFHandler;
- private String fContextId = "org.eclipse.debug.ui.console"; //$NON-NLS-1$;
- private IContextActivation fActivatedContext;
- private IHandlerActivation fActivatedHandler;
- /**
- * Handler to send EOF
- */
- private class EOFHandler extends AbstractHandler {
- public Object execute(ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
- IStreamsProxy proxy = getProcess().getStreamsProxy();
- if (proxy instanceof IStreamsProxy2) {
- IStreamsProxy2 proxy2 = (IStreamsProxy2) proxy;
- try {
- proxy2.closeInputStream();
- } catch (IOException e1) {
- }
- }
- return null;
- }
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsolePageParticipant#init(IPageBookViewPage, IConsole)
- */
- public void init(IPageBookViewPage page, IConsole console) {
- fPage = page;
- fConsole = (ProcessConsole) console;
-
- fRemoveTerminated = new ConsoleRemoveLaunchAction(fConsole.getProcess().getLaunch());
- fRemoveAllTerminated = new ConsoleRemoveAllTerminatedAction();
- fTerminate = new ConsoleTerminateAction(page.getSite().getWorkbenchWindow(), fConsole);
- fStdOut = new ShowStandardOutAction();
- fStdErr = new ShowStandardErrorAction();
-
- fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
-
- DebugPlugin.getDefault().addDebugEventListener(this);
- DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
-
- // contribute to toolbar
- IActionBars actionBars = fPage.getSite().getActionBars();
- configureToolBar(actionBars.getToolBarManager());
-
- // create handler and submissions for EOF
- fEOFHandler = new EOFHandler();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsolePageParticipant#dispose()
- */
- public void dispose() {
- DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
- DebugPlugin.getDefault().removeDebugEventListener(this);
- if (fRemoveTerminated != null) {
- fRemoveTerminated.dispose();
- fRemoveTerminated = null;
- }
- if (fRemoveAllTerminated != null) {
- fRemoveAllTerminated.dispose();
- fRemoveAllTerminated = null;
- }
- if (fTerminate != null) {
- fTerminate.dispose();
- fTerminate = null;
- }
- if (fStdOut != null) {
- fStdOut.dispose();
- fStdOut = null;
- }
- if (fStdErr != null) {
- fStdErr.dispose();
- fStdErr = null;
- }
- fConsole = null;
- }
-
- /**
- * Contribute actions to the toolbar
- */
- protected void configureToolBar(IToolBarManager mgr) {
- mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTerminate);
- mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveTerminated);
- mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveAllTerminated);
- mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut);
- mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdErr);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class required) {
- if (IShowInSource.class.equals(required)) {
- return this;
- }
- if (IShowInTargetList.class.equals(required)) {
- return this;
- }
- //CONTEXTLAUNCHING
- if(ILaunchConfiguration.class.equals(required)) {
- ILaunch launch = getProcess().getLaunch();
- if(launch != null) {
- return launch.getLaunchConfiguration();
- }
- return null;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IShowInSource#getShowInContext()
- */
- public ShowInContext getShowInContext() {
- IProcess process = getProcess();
- if (process == null) {
- return null;
- }
- IDebugTarget target = (IDebugTarget)process.getAdapter(IDebugTarget.class);
- ISelection selection = null;
- if (target == null) {
- selection = new TreeSelection(new TreePath(new Object[]{
- DebugPlugin.getDefault().getLaunchManager(),
- process.getLaunch(),
- process}));
- } else {
- selection = new TreeSelection(new TreePath(new Object[]{
- DebugPlugin.getDefault().getLaunchManager(),
- target.getLaunch(),
- target}));
- }
- return new ShowInContext(null, selection);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IShowInTargetList#getShowInTargetIds()
- */
- public String[] getShowInTargetIds() {
- return new String[] {IDebugUIConstants.ID_DEBUG_VIEW};
- }
-
- /* (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().equals(getProcess())) {
- Runnable r = new Runnable() {
- public void run() {
- if (fTerminate != null) {
- fTerminate.update();
- }
- }
- };
-
- DebugUIPlugin.getStandardDisplay().asyncExec(r);
- }
- }
- }
-
- protected IProcess getProcess() {
- return fConsole != null ? fConsole.getProcess() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsolePageParticipant#activated()
- */
- public void activated() {
- // add EOF submissions
- IPageSite site = fPage.getSite();
- IHandlerService handlerService = (IHandlerService)site.getService(IHandlerService.class);
- IContextService contextService = (IContextService)site.getService(IContextService.class);
- fActivatedContext = contextService.activateContext(fContextId);
- fActivatedHandler = handlerService.activateHandler("org.eclipse.debug.ui.commands.eof", fEOFHandler); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.console.IConsolePageParticipant#deactivated()
- */
- public void deactivated() {
- // remove EOF submissions
- IPageSite site = fPage.getSite();
- IHandlerService handlerService = (IHandlerService)site.getService(IHandlerService.class);
- IContextService contextService = (IContextService)site.getService(IContextService.class);
- handlerService.deactivateHandler(fActivatedHandler);
- contextService.deactivateContext(fActivatedContext);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
- */
- public void debugContextChanged(DebugContextEvent event) {
- if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
- if (fView != null && getProcess().equals(DebugUITools.getCurrentProcess())) {
- fView.display(fConsole);
- }
- }
-
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java
deleted file mode 100644
index a525977d0..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessTypePropertyTester.java
+++ /dev/null
@@ -1,40 +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.debug.internal.ui.views.console;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.ui.console.TextConsole;
-
-/**
- * Tests if a process type matches the expected value.
- *
- * @since 3.1
- */
-public class ProcessTypePropertyTester 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) {
- if (receiver instanceof TextConsole) {
- TextConsole console = (TextConsole) receiver;
- IProcess process = (IProcess) console.getAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS);
- if (process != null) {
- String type = process.getAttribute(IProcess.ATTR_PROCESS_TYPE);
- return (type != null && type.equals(expectedValue));
- }//end if
- }//end if
- return false;
- }//end test
-
-}//end class
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardErrorAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardErrorAction.java
deleted file mode 100644
index ff2f6a064..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardErrorAction.java
+++ /dev/null
@@ -1,42 +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.debug.internal.ui.views.console;
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Toggles preference show the console when output is written
- * to standard error stream.
- *
- * @since 3.3
- */
-public class ShowStandardErrorAction extends ShowWhenContentChangesAction {
-
- /**
- * Constructs an action to toggle console auto activation preferences
- */
- public ShowStandardErrorAction() {
- super(ConsoleMessages.ShowStandardErrorAction_0);
- setId(DebugUIPlugin.getUniqueIdentifier() + ".ShowWhenStderrChangesAction"); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.SHOW_WHEN_STDERR_CHANGES_ACTION);
- setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STANDARD_ERR));
- }
-
- protected String getKey() {
- return IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardOutAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardOutAction.java
deleted file mode 100644
index 0bd2b96dd..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowStandardOutAction.java
+++ /dev/null
@@ -1,42 +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.debug.internal.ui.views.console;
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Toggles preference show the console when output is written
- * to standard output stream.
- *
- * @since 3.3
- */
-public class ShowStandardOutAction extends ShowWhenContentChangesAction {
-
- /**
- * Constructs an action to toggle console auto activation preferences
- */
- public ShowStandardOutAction() {
- super(ConsoleMessages.ShowStandardOutAction_0);
- setId(DebugUIPlugin.getUniqueIdentifier() + ".ShowWhenStdoutChangesAction"); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.SHOW_WHEN_STDOUT_CHANGES_ACTION);
- setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_STANDARD_OUT));
- }
-
- protected String getKey() {
- return IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java
deleted file mode 100644
index bfe1825b7..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ShowWhenContentChangesAction.java
+++ /dev/null
@@ -1,86 +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.debug.internal.ui.views.console;
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * Abstract action for toggling preference to automatically show
- * the console when a streams content changes.
- *
- * @since 3.3
- */
-public abstract class ShowWhenContentChangesAction extends Action implements IPropertyChangeListener{
-
- /**
- * Constructs an action to toggle console auto activation preferences
- */
- public ShowWhenContentChangesAction(String name) {
- super(name, IAction.AS_CHECK_BOX);
- setToolTipText(name);
- getPreferenceStore().addPropertyChangeListener(this);
- update();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (property.equals(getKey())) {
- update();
- }
- }
-
- protected abstract String getKey();
-
- private void update() {
- IPreferenceStore store = getPreferenceStore();
- if (store.getBoolean(getKey())) {
- // on
- setChecked(true);
- } else {
- // off
- setChecked(false);
- }
- }
-
- /**
- * @return
- */
- private IPreferenceStore getPreferenceStore() {
- return DebugUIPlugin.getDefault().getPreferenceStore();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- IPreferenceStore store = getPreferenceStore();
- boolean show = isChecked();
- store.removePropertyChangeListener(this);
- store.setValue(getKey(), show);
- store.addPropertyChangeListener(this);
- }
-
- /**
- * Must be called to dispose this action.
- */
- public void dispose() {
- getPreferenceStore().removePropertyChangeListener(this);
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
deleted file mode 100644
index cbaced58f..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionDropAdapter.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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:
- * Wind River Systems - Pawel Piech - Initial Implementation - Drag/Drop to Expressions View (Bug 184057), Integration with non-standard debug models (Bug 209883)
- * IBM Corporation - further implementation and documentation
- * Wind River Systems - integration with non-standard debug models
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.expression;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IExpressionManager;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IExpression;
-import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.debug.core.model.IWatchExpression;
-import org.eclipse.debug.internal.core.ExpressionManager;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
-import org.eclipse.debug.internal.ui.views.variables.IndexedVariablePartition;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter;
-import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapter2;
-import org.eclipse.debug.ui.actions.IWatchExpressionFactoryAdapterExtension;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.TransferData;
-
-/**
- * Drop Adapter allowing expressions, variables and text to be dropped in the Expression View.
- * When IVariables or text is dropped new watch expressions are created at the drop location.
- * When IExpressions are dropped, they are moved to the drop location
- *
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesDragAdapter
- * @see ExpressionManager
- * @since 3.4
- */
-public class ExpressionDropAdapter extends ViewerDropAdapter {
-
- private TransferData fCurrentTransferType = null;
- private boolean fInsertBefore;
- private int fDropType;
-
- private static final int DROP_TYPE_DEFAULT = 0;
- private static final int DROP_TYPE_VARIABLE = 1;
- private static final int DROP_TYPE_EXPRESSION = 2;
- private static final int DROP_TYPE_WATCH_ADAPTABLE_ELEMENT = 3;
-
- /**
- * Constructor takes the viewer this drop adapter applies to.
- * @param viewer the viewer to add drop to
- */
- protected ExpressionDropAdapter(TreeModelViewer viewer) {
- super(viewer);
- setFeedbackEnabled(true);
- setSelectionFeedbackEnabled(false);
- setScrollExpandEnabled(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
- */
- public void dragEnter(DropTargetEvent event) {
- fDropType = DROP_TYPE_DEFAULT;
- event.detail = DND.DROP_NONE;
-
- for (int i = 0; i < event.dataTypes.length; i++) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataTypes[i])) {
- if (isExpressionDrop()){
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_MOVE;
- fDropType = DROP_TYPE_EXPRESSION;
- break;
- } else if (isVariableDrop()){
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_COPY;
- fDropType = DROP_TYPE_VARIABLE;
- break;
- } else if (isWatchAdaptableElementDrop()){
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_COPY;
- fDropType = DROP_TYPE_WATCH_ADAPTABLE_ELEMENT;
- break;
- }
- } else if (TextTransfer.getInstance().isSupportedType(event.dataTypes[i])) {
- event.currentDataType = event.dataTypes[i];
- event.detail = DND.DROP_COPY;
- fDropType = DROP_TYPE_DEFAULT;
- break;
- }
- }
-
- super.dragEnter(event);
- }
-
- /**
- * @return whether the selection transfer contains only IExpressions
- */
- private boolean isExpressionDrop() {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- Iterator iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (getTargetExpression(element) == null){
- return false;
- }
- }
- return true;
- }
-
- /**
- * @return whether the selection transfer contains only IVariables
- */
- private boolean isVariableDrop() {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- Iterator iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (!(element instanceof IVariable)){
- return false;
- }
- }
- return true;
- }
-
- /**
- * @return whether the selection transfer contains only objects adaptable
- * to IWatchExpressionFactoryAdapter2
- */
- private boolean isWatchAdaptableElementDrop() {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- Iterator iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (!(element instanceof IAdaptable &&
- ((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class) != null))
- {
- return false;
- }
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
- */
- public void dragOver(DropTargetEvent event) {
- super.dragOver(event);
- // Allow scrolling (but not expansion)
- event.feedback |= DND.FEEDBACK_SCROLL;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
- */
- public boolean validateDrop(Object target, int operation, TransferData transferType) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) {
- if (fDropType == DROP_TYPE_EXPRESSION){
- return validateExpressionDrop(target);
- } else if (fDropType == DROP_TYPE_VARIABLE){
- return validateVariableDrop(target);
- } else if (fDropType == DROP_TYPE_WATCH_ADAPTABLE_ELEMENT){
- return validateWatchAdaptableDrop(target);
- }
- } else if (TextTransfer.getInstance().isSupportedType(transferType)) {
- return validateTextDrop(target);
- }
- return false;
- }
-
- /**
- * Validates if an IExpression drop is valid by checking if the target
- * is an IExpression.
- * @param target target of the drop
- * @return whether the drop is valid
- */
- private boolean validateExpressionDrop(Object target){
- return target instanceof IExpression ||
- ((target instanceof IAdaptable) && ((IAdaptable)target).getAdapter(IExpression.class) != null);
- }
-
- private IExpression getTargetExpression(Object target) {
- if (target instanceof IExpression) {
- return (IExpression)target;
- } else if (target instanceof IAdaptable) {
- return (IExpression)((IAdaptable)target).getAdapter(IExpression.class);
- }
- return null;
- }
-
- /**
- * Validates if the drop is valid by validating the local selection transfer
- * to ensure that a watch expression can be created for each contained IVariable.
- * @param target target of the drop
- * @return whether the drop is valid
- */
- private boolean validateVariableDrop(Object target) {
- // Target must be null or an IExpression, you cannot add a new watch expression inside another
- if (target != null && getTargetExpression(target) == null) {
- return false;
- }
-
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- int enabled = 0;
- int size = -1;
- if (selection != null) {
- size = selection.size();
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
- Iterator iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (element instanceof IVariable){
- IVariable variable = (IVariable) element;
- if (variable instanceof IndexedVariablePartition) {
- break;
- } else if (manager.hasWatchExpressionDelegate(variable.getModelIdentifier()) && isFactoryEnabled(variable)) {
- enabled++;
- } else {
- break;
- }
- }
- }
- }
- return enabled == size;
- }
-
- /**
- * Validates if the drop is valid by validating the local selection transfer
- * to ensure that a watch expression can be created for each contained element.
- * @param target target of the drop
- * @return whether the drop is valid
- */
- private boolean validateWatchAdaptableDrop(Object target) {
- // Target must be null or an IExpression, you cannot add a new watch expression inside another
- if (target != null && getTargetExpression(target) == null) {
- return false;
- }
-
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- int enabled = 0;
- int size = -1;
- if (selection != null) {
- size = selection.size();
- Iterator iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
- if (isFactory2Enabled(element)) {
- enabled++;
- } else {
- break;
- }
- }
- }
- return enabled == size;
- }
-
- /**
- * Validates if the drop is valid by validating the drop location.
- * Only valid if the target is <code>null</code> or an <code>IExpression</code>.
- * You cannot add a new watch expression inside another.
- * @param target target of the drop
- * @return whether the drop is valid
- */
- private boolean validateTextDrop(Object target){
- return target == null || getTargetExpression(target) != null;
- }
-
- /**
- * Returns whether the factory adapter for the given variable is currently enabled.
- *
- * @param variable the variable to ask for the adapter
- * @return whether the factory is enabled
- */
- private boolean isFactoryEnabled(IVariable variable) {
- IWatchExpressionFactoryAdapter factory = getFactory(variable);
- if (factory instanceof IWatchExpressionFactoryAdapterExtension) {
- IWatchExpressionFactoryAdapterExtension ext = (IWatchExpressionFactoryAdapterExtension) factory;
- return ext.canCreateWatchExpression(variable);
- }
- return true;
- }
-
- /**
- * Returns whether the factory adapter for the given element is currently enabled.
- *
- * @param element the element to ask for the adapter
- * @return whether the factory is enabled
- */
- private boolean isFactory2Enabled(Object element) {
- IWatchExpressionFactoryAdapter2 factory = getFactory2(element);
- if (factory != null) {
- return factory.canCreateWatchExpression(element);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#drop(org.eclipse.swt.dnd.DropTargetEvent)
- */
- public void drop(DropTargetEvent event) {
- fCurrentTransferType = event.currentDataType;
- // Unless insert after is explicitly set, insert before
- fInsertBefore = getCurrentLocation() != LOCATION_AFTER;
- super.drop(event);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
- */
- public boolean performDrop(Object data) {
- if (LocalSelectionTransfer.getTransfer().isSupportedType(fCurrentTransferType)) {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- if (fDropType == DROP_TYPE_EXPRESSION){
- return performExpressionDrop(selection);
- } else if (fDropType == DROP_TYPE_VARIABLE || fDropType == DROP_TYPE_WATCH_ADAPTABLE_ELEMENT){
- return performVariableOrWatchAdaptableDrop(selection);
- }
- } else if (TextTransfer.getInstance().isSupportedType(fCurrentTransferType)) {
- if (data != null) {
- return performTextDrop((String)data);
- }
- }
- return false;
- }
-
- /**
- * Performs the drop when the selection is a collection of IExpressions.
- * Moves the given expressions from their original locations to the
- * location of the current target.
- * @param selection the dragged selection
- * @return whether the drop could be completed
- */
- private boolean performExpressionDrop(IStructuredSelection selection) {
- IExpression targetExpression = getTargetExpression(getCurrentTarget());
- if (targetExpression != null){
- IExpression[] expressions = new IExpression[selection.size()];
- Object[] selectionElements = selection.toArray();
- for (int i = 0; i < selectionElements.length; i++) {
- expressions[i] = getTargetExpression(selectionElements[i]);
- }
-
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
- if (manager instanceof ExpressionManager){
- ((ExpressionManager)manager).moveExpressions(expressions, targetExpression, fInsertBefore);
- }
- return true;
- }
- return false;
-
- }
-
- /**
- * If the dragged data is a structured selection, get any IVariables in it
- * and create expressions for each of them. Insert the created expressions
- * at the currently selected target or add them to the end of the collection
- * if no target is selected.
- *
- * @param selection Structured selection containing IVariables
- * @return whether the drop was successful
- */
- private boolean performVariableOrWatchAdaptableDrop(IStructuredSelection selection) {
- List expressions = new ArrayList(selection.size());
- for (Iterator itr = selection.iterator(); itr.hasNext(); ) {
- Object element = itr.next();
- String expressionText = createExpressionString(element);
- if (expressionText != null){
- IExpression expression = createExpression(expressionText);
- if (expression != null){
- expressions.add(expression);
- } else {
- DebugUIPlugin.log(new Status(IStatus.ERROR,DebugUIPlugin.getUniqueIdentifier(),"Drop failed. Watch expression could not be created for the text " + expressionText)); //$NON-NLS-1$
- return false;
- }
- } else {
- return false;
- }
- }
- if (expressions.size() == selection.size()){
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
- if (manager instanceof ExpressionManager){
- IExpression targetExpression = getTargetExpression(getCurrentTarget());
- if (targetExpression != null){
- ((ExpressionManager)manager).insertExpressions((IExpression[])expressions.toArray(new IExpression[expressions.size()]), targetExpression, fInsertBefore);
- } else {
- ((ExpressionManager)manager).addExpressions((IExpression[])expressions.toArray(new IExpression[expressions.size()]));
- }
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * Performs the drop when text was dragged. Creates a new watch expression from
- * the text. Inserts the expression at the currently selected target or adds it
- * to the end of the collection if no target is selected.
- *
- * @param text string to use to create the expression
- * @return whether the drop was successful
- */
- private boolean performTextDrop(String text){
- IExpression expression = createExpression(text);
- if (expression != null){
- IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
- if (manager instanceof ExpressionManager){
- IExpression targetExpression = getTargetExpression(getCurrentTarget());
- if (targetExpression != null){
- ((ExpressionManager)manager).insertExpressions(new IExpression[]{expression}, targetExpression, fInsertBefore);
- } else {
- ((ExpressionManager)manager).addExpression(expression);
- }
- return true;
- }
- }
- DebugUIPlugin.log(new Status(IStatus.ERROR,DebugUIPlugin.getUniqueIdentifier(),"Drop failed. Watch expression could not be created for the text " + text)); //$NON-NLS-1$
- return false;
- }
-
- /**
- * Creates a new watch expression from an IVariable using the watch expression factory
- * adapter for that variable.
- *
- * @param variable the variable to use to create the watch expression
- * @return the string to be used to create expression, return <code>null</code>
- * if no expression is to be created
- */
- private String createExpressionString(Object element) {
- try {
- if (element instanceof IVariable) {
- IVariable variable = (IVariable)element;
- IWatchExpressionFactoryAdapter factory = getFactory(variable);
- String exp = variable.getName();
- if (factory != null) {
- //if a factory exists, use it to create expression,
- //otherwise just use variable name
- exp = factory.createWatchExpression(variable);
- }
- return exp;
- } else {
- IWatchExpressionFactoryAdapter2 factory2 = getFactory2(element);
- if (factory2 != null) {
- return factory2.createWatchExpression(element);
- }
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e.getStatus());
- }
- return null;
- }
-
- /**
- * Creates a new watch expression from a string using the default expression manager.
- *
- * @param exp the string to use to create the expression
- */
- private IExpression createExpression(String exp) {
- IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(exp);
- IAdaptable object = DebugUITools.getDebugContext();
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- expression.setExpressionContext(context);
- return expression;
- }
-
-
- /**
- * Returns the factory adapter for the given variable or <code>null</code> if none.
- *
- * @param variable
- * @return factory or <code>null</code>
- */
- private IWatchExpressionFactoryAdapter getFactory(IVariable variable) {
- return (IWatchExpressionFactoryAdapter) variable.getAdapter(IWatchExpressionFactoryAdapter.class);
- }
-
- /**
- * Returns the factory adapter for the given element or <code>null</code> if none.
- *
- * @param element
- * @return factory or <code>null</code>
- */
- private IWatchExpressionFactoryAdapter2 getFactory2(Object element) {
- if (element instanceof IAdaptable) {
- return (IWatchExpressionFactoryAdapter2)((IAdaptable)element).getAdapter(IWatchExpressionFactoryAdapter2.class);
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
deleted file mode 100644
index bdd9de2b0..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
+++ /dev/null
@@ -1,272 +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
- * Wind River - Pawel Piech - Drag/Drop to Expressions View (Bug 184057)
- * Wind River - Pawel Piech - Fix viewer input race condition (Bug 234908)
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.expression;
-
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IExpressionManager;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IWatchExpression;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.actions.expressions.PasteWatchExpressionsAction;
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
-import org.eclipse.debug.internal.ui.views.variables.AvailableLogicalStructuresAction;
-import org.eclipse.debug.internal.ui.views.variables.SelectionDragAdapter;
-import org.eclipse.debug.internal.ui.views.variables.VariablesView;
-import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages;
-import org.eclipse.debug.internal.ui.views.variables.details.AvailableDetailPanesAction;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-
-/**
- * Displays expressions and their values with a detail
- * pane.
- */
-public class ExpressionView extends VariablesView {
-
- private PasteWatchExpressionsAction fPasteAction;
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IDebugHelpContextIds.EXPRESSION_VIEW;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
- */
- protected void configureToolBar(IToolBarManager tbm) {
- super.configureToolBar(tbm);
- tbm.add(new Separator(IDebugUIConstants.EMPTY_EXPRESSION_GROUP));
- tbm.add(new Separator(IDebugUIConstants.EXPRESSION_GROUP));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- protected void fillContextMenu(IMenuManager menu) {
- menu.add(new Separator(IDebugUIConstants.EMPTY_EXPRESSION_GROUP));
- menu.add(new Separator(IDebugUIConstants.EXPRESSION_GROUP));
- menu.add(getAction(VARIABLES_FIND_ELEMENT_ACTION));
- menu.add(getAction("ChangeVariableValue")); //$NON-NLS-1$
- menu.add(new Separator());
- IAction action = new AvailableLogicalStructuresAction(this);
- if (action.isEnabled()) {
- menu.add(action);
- }
- action = new AvailableDetailPanesAction(this);
- if (isDetailPaneVisible() && action.isEnabled()) {
- menu.add(action);
- }
- menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#contextActivated(org.eclipse.jface.viewers.ISelection)
- */
- protected void contextActivated(ISelection selection) {
- if (selection == null || selection.isEmpty()) {
- setViewerInput(DebugPlugin.getDefault().getExpressionManager());
- } else {
- super.contextActivated(selection);
- }
- if (isAvailable() && isVisible()) {
- updateAction("ContentAssist"); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#viewerInputUpdateComplete(IViewerInputUpdate)
- */
- protected void viewerInputUpdateComplete(IViewerInputUpdate update) {
- if (update.getElement() != null) {
- setViewerInput(update.getInputElement());
- } else {
- setViewerInput(DebugPlugin.getDefault().getExpressionManager());
- }
- updateAction(VARIABLES_FIND_ELEMENT_ACTION);
- updateAction(FIND_ACTION);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getDetailPanePreferenceKey()
- */
- protected String getDetailPanePreferenceKey() {
- return IDebugPreferenceConstants.EXPRESSIONS_DETAIL_PANE_ORIENTATION;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getToggleActionLabel()
- */
- protected String getToggleActionLabel() {
- return VariablesViewMessages.ExpressionView_4;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getViewerStyle()
- */
- protected int getViewerStyle() {
- return SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getPresentationContextId()
- */
- protected String getPresentationContextId() {
- return IDebugUIConstants.ID_EXPRESSION_VIEW;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#initDragAndDrop(org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer)
- */
- protected void initDragAndDrop(TreeModelViewer viewer) {
- viewer.addDragSupport(DND.DROP_MOVE, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer));
- viewer.addDropSupport(DND.DROP_MOVE|DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance()}, new ExpressionDropAdapter(viewer));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#createActions()
- */
- protected void createActions() {
- super.createActions();
- fPasteAction = new PasteWatchExpressionsAction(this);
- configure(fPasteAction, IWorkbenchActionDefinitionIds.PASTE, PASTE_ACTION, ISharedImages.IMG_TOOL_PASTE);
- }
-
- /**
- * Configures the action to override the global action, and registers the
- * action with this view.
- *
- * @param action
- * action
- * @param defId
- * action definition id
- * @param globalId
- * global action id
- * @param imgId
- * image identifier
- */
- private void configure(IAction action, String defId, String globalId,
- String imgId) {
- setAction(defId, action);
- action.setActionDefinitionId(defId);
- getViewSite().getActionBars().setGlobalActionHandler(globalId, action);
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imgId));
- }
-
- /**
- * Returns whether the given selection can be pasted into the expressions
- * view.
- *
- * @param selection
- * the selection to paste
- * @return whether the given selection can be pasted into the given target
- */
- public boolean canPaste() {
- String clipboardText = getClipboardText();
- if (clipboardText != null && clipboardText.length() > 0) {
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#createTreeViewer(org.eclipse.swt.widgets.Composite)
- */
- protected TreeModelViewer createTreeViewer(Composite parent) {
- TreeModelViewer viewer = super.createTreeViewer(parent);
- viewer.getTree().addFocusListener(new FocusListener() {
- public void focusLost(FocusEvent e) {
- if (fPasteAction != null) {
- getViewSite().getActionBars().setGlobalActionHandler(PASTE_ACTION, null);
- }
- }
-
- public void focusGained(FocusEvent e) {
- if (fPasteAction != null) {
- getViewSite().getActionBars().setGlobalActionHandler(PASTE_ACTION, fPasteAction);
- }
- }
- });
- return viewer;
- }
-
- /**
- * Pastes the selection into the given target
- *
- * @param selection
- * breakpoints
- * @return whether successful
- */
- public boolean performPaste() {
- String clipboardText = getClipboardText();
- if (clipboardText != null && clipboardText.length() > 0) {
- IExpressionManager expressionManager = DebugPlugin.getDefault().getExpressionManager();
- IWatchExpression watchExpression = expressionManager
- .newWatchExpression(clipboardText);
- expressionManager.addExpression(watchExpression);
- watchExpression.setExpressionContext(getContext());
- return true;
- }
- return false;
- }
-
- // TODO: duplicate code from WatchExpressionAction
- protected IDebugElement getContext() {
- IAdaptable object = DebugUITools.getDebugContext();
- IDebugElement context = null;
- if (object instanceof IDebugElement) {
- context = (IDebugElement) object;
- } else if (object instanceof ILaunch) {
- context = ((ILaunch) object).getDebugTarget();
- }
- return context;
- }
-
- protected String getClipboardText() {
- Clipboard clipboard = new Clipboard(Display.getDefault());
- try {
- TextTransfer textTransfer = TextTransfer.getInstance();
- return (String) clipboard.getContents(textTransfer);
- } finally {
- clipboard.dispose();
- }
- }
-
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java
deleted file mode 100644
index 94083c91a..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbDropDownAutoExpandAction.java
+++ /dev/null
@@ -1,55 +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.debug.internal.ui.views.launch;
-
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Action that controls the preference for whether elements should be
- * automatically expanded in the breadcrumb drop down viewers.
- *
- * @since 3.5
- */
-class BreadcrumbDropDownAutoExpandAction extends Action {
-
- private final LaunchView fLaunchView;
-
- /**
- * Creates a new action to set the debug view mode.
- *
- * @param view Reference to the debug view.
- * @param mode The mode to be set by this action.
- * @param parent The view's parent control used to calculate view size
- * in auto mode.
- */
- public BreadcrumbDropDownAutoExpandAction(LaunchView view) {
- super(IInternalDebugCoreConstants.EMPTY_STRING, AS_CHECK_BOX);
- fLaunchView = view;
-
- setText(LaunchViewMessages.BreadcrumbDropDownAutoExpandAction_label);
- setToolTipText(LaunchViewMessages.BreadcrumbDropDownAutoExpandAction_tooltip);
- setDescription(LaunchViewMessages.BreadcrumbDropDownAutoExpandAction_description);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_VIEW_DROP_DOWN_AUTOEXPAND_ACTION);
-
- setChecked(fLaunchView.getBreadcrumbDropDownAutoExpand());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- fLaunchView.setBreadcrumbDropDownAutoExpand(isChecked());
- }
-}
-
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
deleted file mode 100644
index ca87e7de3..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/BreadcrumbWorkbenchPart.java
+++ /dev/null
@@ -1,117 +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
- * Pawel Piech - Wind River - adapted to use in Debug view
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.launch;
-
-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;
-
-/**
- * Fake part to used to create the breadcrumb page.
- *
- * @since 3.5
- * @see LaunchView#fDefaultPageRec
- */
-class BreadcrumbWorkbenchPart implements IWorkbenchPart {
-
- private IWorkbenchPartSite fSite = null;
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return (obj instanceof BreadcrumbWorkbenchPart);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getClass().hashCode();
- }
-
- /**
- * Constructs a part for the given console that binds to the given
- * site
- */
- public BreadcrumbWorkbenchPart(IWorkbenchPartSite site) {
- 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;
- }
-}
-
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
deleted file mode 100644
index 00620344c..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
+++ /dev/null
@@ -1,287 +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
- * Wind River Systems - support for alternative expression view content providers
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.launch;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.debug.core.IExpressionManager;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IExpression;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
-import org.eclipse.debug.core.model.IProcess;
-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.internal.ui.elements.adapters.AsynchronousDebugLabelAdapter;
-import org.eclipse.debug.internal.ui.elements.adapters.DefaultViewerInputProvider;
-import org.eclipse.debug.internal.ui.elements.adapters.MemoryBlockContentAdapter;
-import org.eclipse.debug.internal.ui.elements.adapters.MemoryBlockLabelAdapter;
-import org.eclipse.debug.internal.ui.elements.adapters.MemoryRetrievalContentAdapter;
-import org.eclipse.debug.internal.ui.elements.adapters.MemorySegmentLabelAdapter;
-import org.eclipse.debug.internal.ui.elements.adapters.StackFrameSourceDisplayAdapter;
-import org.eclipse.debug.internal.ui.elements.adapters.StackFrameViewerInputProvider;
-import org.eclipse.debug.internal.ui.elements.adapters.VariableColumnFactoryAdapter;
-import org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider;
-import org.eclipse.debug.internal.ui.model.elements.DebugTargetContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.ExpressionContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.ExpressionLabelProvider;
-import org.eclipse.debug.internal.ui.model.elements.ExpressionManagerContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.ExpressionManagerMementoProvider;
-import org.eclipse.debug.internal.ui.model.elements.ExpressionMementoProvider;
-import org.eclipse.debug.internal.ui.model.elements.LaunchContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.LaunchManagerContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.MemoryBlockContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.MemoryBlockLabelProvider;
-import org.eclipse.debug.internal.ui.model.elements.MemoryRetrievalContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.MemoryViewElementMementoProvider;
-import org.eclipse.debug.internal.ui.model.elements.RegisterGroupContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.RegisterGroupLabelProvider;
-import org.eclipse.debug.internal.ui.model.elements.RegisterGroupMementoProvider;
-import org.eclipse.debug.internal.ui.model.elements.StackFrameContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.StackFrameMementoProvider;
-import org.eclipse.debug.internal.ui.model.elements.ThreadContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.VariableContentProvider;
-import org.eclipse.debug.internal.ui.model.elements.VariableEditor;
-import org.eclipse.debug.internal.ui.model.elements.VariableLabelProvider;
-import org.eclipse.debug.internal.ui.model.elements.VariableMementoProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor;
-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.IModelProxyFactory;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicyFactory;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputProvider;
-import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousContentAdapter;
-import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousLabelAdapter;
-import org.eclipse.debug.internal.ui.viewers.update.DefaultModelProxyFactory;
-import org.eclipse.debug.internal.ui.viewers.update.DefaultModelSelectionPolicyFactory;
-import org.eclipse.debug.internal.ui.views.memory.renderings.MemorySegment;
-import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
-
-/**
- * DebugElementAdapterFactory
- */
-public class DebugElementAdapterFactory implements IAdapterFactory {
-
- private static IModelProxyFactory fgModelProxyFactoryAdapter = new DefaultModelProxyFactory();
- private static ISourceDisplay fgStackFrameSourceDisplayAdapter = new StackFrameSourceDisplayAdapter();
- private static IModelSelectionPolicyFactory fgModelSelectionPolicyFactoryAdapter = new DefaultModelSelectionPolicyFactory();
-
- private static IAsynchronousLabelAdapter fgDebugLabelAdapter = new AsynchronousDebugLabelAdapter();
- private static IAsynchronousLabelAdapter fgMemoryBlockLabelAdapter = new MemoryBlockLabelAdapter();
- private static IAsynchronousLabelAdapter fgTableRenderingLineLabelAdapter = new MemorySegmentLabelAdapter();
-
- private static IElementLabelProvider fgLPDebugElement = new DebugElementLabelProvider();
- private static IElementLabelProvider fgLPVariable = new VariableLabelProvider();
- private static IElementLabelProvider fgLPExpression = new ExpressionLabelProvider();
- private static IElementLabelProvider fgLPRegisterGroup = new RegisterGroupLabelProvider();
- private static IElementLabelProvider fgLPMemoryBlock = new MemoryBlockLabelProvider();
-
- private static IElementEditor fgEEVariable = new VariableEditor();
-
- private static IAsynchronousContentAdapter fgAsyncMemoryRetrieval = new MemoryRetrievalContentAdapter();
- private static IAsynchronousContentAdapter fgAsyncMemoryBlock = new MemoryBlockContentAdapter();
-
- private static IElementContentProvider fgCPLaunchManger = new LaunchManagerContentProvider();
- private static IElementContentProvider fgCPLaunch = new LaunchContentProvider();
- private static IElementContentProvider fgCPTarget = new DebugTargetContentProvider();
- private static IElementContentProvider fgCPThread = new ThreadContentProvider();
- private static IElementContentProvider fgCPFrame = new StackFrameContentProvider();
- private static IElementContentProvider fgCPVariable = new VariableContentProvider();
- private static IElementContentProvider fgCPExpressionManager = new ExpressionManagerContentProvider();
- private static IElementContentProvider fgCPExpression = new ExpressionContentProvider();
- private static IElementContentProvider fgCPRegisterGroup = new RegisterGroupContentProvider();
- private static IElementContentProvider fgCPMemoryRetrieval = new MemoryRetrievalContentProvider();
- private static IElementContentProvider fgCPMemoryBlock = new MemoryBlockContentProvider();
-
- private static IElementMementoProvider fgMPFrame = new StackFrameMementoProvider();
- private static IElementMementoProvider fgMPVariable = new VariableMementoProvider();
- private static IElementMementoProvider fgMPExpression = new ExpressionMementoProvider();
- private static IElementMementoProvider fgMPRegisterGroup = new RegisterGroupMementoProvider();
- private static IElementMementoProvider fgMPExpressionManager = new ExpressionManagerMementoProvider();
- private static IElementMementoProvider fgMPMemory = new MemoryViewElementMementoProvider();
-
- private static IColumnPresentationFactory fgVariableColumnFactory = new VariableColumnFactoryAdapter();
-
- private static IViewerInputProvider fgDefaultViewerInputProvider = new DefaultViewerInputProvider();
- private static IViewerInputProvider fgStackFrameViewerInputProvider = new StackFrameViewerInputProvider();
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType.isInstance(adaptableObject)) {
- return adaptableObject;
- }
-
- if (adapterType.equals(IAsynchronousContentAdapter.class)) {
- if (adaptableObject instanceof IMemoryBlockRetrieval) {
- return fgAsyncMemoryRetrieval;
- }
- if (adaptableObject instanceof IMemoryBlock) {
- return fgAsyncMemoryBlock;
- }
- }
-
- if (adapterType.equals(IElementContentProvider.class)) {
- if (adaptableObject instanceof ILaunchManager) {
- return fgCPLaunchManger;
- }
- if (adaptableObject instanceof ILaunch) {
- return fgCPLaunch;
- }
- if (adaptableObject instanceof IDebugTarget) {
- return fgCPTarget;
- }
- if (adaptableObject instanceof IMemoryBlockRetrieval)
- {
- return fgCPMemoryRetrieval;
- }
- if (adaptableObject instanceof IThread) {
- return fgCPThread;
- }
- if (adaptableObject instanceof IStackFrame) {
- return fgCPFrame;
- }
- if (adaptableObject instanceof IVariable) {
- return fgCPVariable;
- }
- if (adaptableObject instanceof IExpressionManager) {
- return fgCPExpressionManager;
- }
- if (adaptableObject instanceof IExpression) {
- return fgCPExpression;
- }
- if (adaptableObject instanceof IRegisterGroup) {
- return fgCPRegisterGroup;
- }
- if (adaptableObject instanceof IMemoryBlock) {
- return fgCPMemoryBlock;
- }
- }
-
- if (adapterType.equals(IAsynchronousLabelAdapter.class)) {
- if (adaptableObject instanceof IMemoryBlock) {
- return fgMemoryBlockLabelAdapter;
- }
-
- if (adaptableObject instanceof MemorySegment) {
- return fgTableRenderingLineLabelAdapter;
- }
- return fgDebugLabelAdapter;
- }
-
- if (adapterType.equals(IElementLabelProvider.class)) {
- if (adaptableObject instanceof IVariable) {
- return fgLPVariable;
- }
- if (adaptableObject instanceof IExpression) {
- return fgLPExpression;
- }
- if (adaptableObject instanceof IRegisterGroup) {
- return fgLPRegisterGroup;
- }
- if (adaptableObject instanceof IMemoryBlock) {
- return fgLPMemoryBlock;
- }
- return fgLPDebugElement;
- }
-
- if (adapterType.equals(IModelProxyFactory.class)) {
- if (adaptableObject instanceof ILaunch || adaptableObject instanceof IDebugTarget ||
- adaptableObject instanceof IProcess || adaptableObject instanceof ILaunchManager ||
- adaptableObject instanceof IStackFrame || adaptableObject instanceof IExpressionManager ||
- adaptableObject instanceof IExpression || adaptableObject instanceof IMemoryBlockRetrieval ||
- adaptableObject instanceof IMemoryBlock)
- return fgModelProxyFactoryAdapter;
- }
-
- if (adapterType.equals(ISourceDisplay.class)) {
- if (adaptableObject instanceof IStackFrame) {
- return fgStackFrameSourceDisplayAdapter;
- }
- }
-
- if (adapterType.equals(IModelSelectionPolicyFactory.class)) {
- if (adaptableObject instanceof IDebugElement) {
- return fgModelSelectionPolicyFactoryAdapter;
- }
- }
-
- if (adapterType.equals(IColumnPresentationFactory.class)) {
- if (adaptableObject instanceof IStackFrame) {
- return fgVariableColumnFactory;
- }
- }
-
- if (adapterType.equals(IElementMementoProvider.class)) {
- if (adaptableObject instanceof IStackFrame) {
- return fgMPFrame;
- }
- if (adaptableObject instanceof IVariable) {
- return fgMPVariable;
- }
- if (adaptableObject instanceof IRegisterGroup) {
- return fgMPRegisterGroup;
- }
- if (adaptableObject instanceof IExpression) {
- return fgMPExpression;
- }
- if (adaptableObject instanceof IExpressionManager) {
- return fgMPExpressionManager;
- }
- if (adaptableObject instanceof IMemoryBlockRetrieval) {
- return fgMPMemory;
- }
- }
-
- if (adapterType.equals(IElementEditor.class)) {
- if (adaptableObject instanceof IVariable) {
- return fgEEVariable;
- }
- }
-
- if (adapterType.equals(IViewerInputProvider.class)) {
- if (adaptableObject instanceof IStackFrame) {
- return fgStackFrameViewerInputProvider;
- } else {
- return fgDefaultViewerInputProvider;
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- return new Class[] {
- IAsynchronousLabelAdapter.class,
- IAsynchronousContentAdapter.class,
- IModelProxyFactory.class,
- ISourceDisplay.class,
- IModelSelectionPolicyFactory.class,
- IColumnPresentationFactory.class,
- IElementContentProvider.class,
- IElementLabelProvider.class,
- IElementMementoProvider.class,
- IElementEditor.class,
- IViewerInputProvider.class};
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java
deleted file mode 100644
index efafa7b7c..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java
+++ /dev/null
@@ -1,239 +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.debug.internal.ui.views.launch;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-
-/**
- * Translates images, colors, and fonts into image descriptors, RGBs, and font
- * datas for workbench adapaters. Also provides labels.
- *
- * @since 3.1
- */
-public class DebugElementHelper {
-
- // a model presentation that can provide images & labels for debug elements
- private static DelegatingModelPresentation fgPresenetation;
-
- // map of images to image descriptors
- private static Map fgImages = new HashMap();
-
- /**
- * Disposes this adapater
- */
- public static void dispose() {
- fgImages.clear();
- if (fgPresenetation != null) {
- fgPresenetation.dispose();
- fgPresenetation = null;
- }
- }
-
- /**
- * Returns an image descriptor for the given debug element.
- *
- * @param object object for which an image descriptor is required
- */
- public static ImageDescriptor getImageDescriptor(Object object) {
- Image image = getPresentation().getImage(object);
- return getImageDescriptor(image);
- }
-
- /**
- * Returns an image descriptor for the given debug element.
- *
- * @param presentation presentation to obtain image from
- * @param object object for which an image descriptor is required
- * @since 3.3
- */
- public static ImageDescriptor getImageDescriptor(Object object, IDebugModelPresentation presentation) {
- Image image = presentation.getImage(object);
- return getImageDescriptor(image);
- }
-
- public static ImageDescriptor getImageDescriptor(Image image)
- {
- if (image != null) {
- ImageDescriptor descriptor = (ImageDescriptor) fgImages.get(image);
- if (descriptor == null) {
- descriptor = new ImageImageDescriptor(image);
- fgImages.put(image, descriptor);
- }
- return descriptor;
- }
- return null;
- }
-
- /**
- * Returns a label for the given debug element.
- *
- * @param o object for which a label is required
- */
- public static String getLabel(Object o) {
- return getPresentation().getText(o);
- }
-
- /**
- * Returns a model presentation to use to retrieve lables & images.
- *
- * @return a model presentation to use to retrieve lables & images
- */
- public static DelegatingModelPresentation getPresentation() {
- if (fgPresenetation == null) {
- fgPresenetation = new DelegatingModelPresentation();
- }
- return fgPresenetation;
- }
-
- /**
- * Returns the RGB of the foreground color for the given element, or
- * <code>null</code> if none.
- *
- * @param element object for which a foreground color is required
- * @return the RGB of the foreground color for the given element, or
- * <code>null</code> if none
- */
- public static RGB getForeground(Object element) {
- Color color = getPresentation().getForeground(element);
- if (color != null) {
- return color.getRGB();
- }
- return null;
- }
-
- /**
- * Returns the RGB of the foreground color for the given element, or
- * <code>null</code> if none.
- *
- * @param element object for which a foreground color is required
- * @param presentation presentation to obtain color from
- * @return the RGB of the foreground color for the given element, or
- * <code>null</code> if none
- * @since 3.3
- */
- public static RGB getForeground(Object element, IDebugModelPresentation presentation) {
- Color color = null;
- if (presentation instanceof IColorProvider) {
- IColorProvider colorProvider = (IColorProvider) presentation;
- color = colorProvider.getForeground(element);
- } else {
- color = getPresentation().getForeground(element);
- }
- if (color != null) {
- return color.getRGB();
- }
- return null;
- }
-
- /**
- * Returns the RGB of the background color for the given element, or
- * <code>null</code> if none.
- *
- * @param element object for which a background color is required
- * @return the RGB of the background color for the given element, or
- * <code>null</code> if none
- */
- public static RGB getBackground(Object element) {
- Color color = getPresentation().getBackground(element);
- if (color != null) {
- return color.getRGB();
- }
- return null;
- }
-
- /**
- * Returns the RGB of the background color for the given element, or
- * <code>null</code> if none.
- *
- * @param element object for which a background color is required
- * @param presentation presentation to use to retrieve color
- * @return the RGB of the background color for the given element, or
- * <code>null</code> if none
- * @since 3.3
- */
- public static RGB getBackground(Object element, IDebugModelPresentation presentation) {
- Color color = null;
- if (presentation instanceof IColorProvider) {
- IColorProvider colorProvider = (IColorProvider) presentation;
- color = colorProvider.getBackground(element);
- } else {
- color = getPresentation().getBackground(element);
- }
- if (color != null) {
- return color.getRGB();
- }
- return null;
- }
-
- /**
- * Returns the font data for the given element, or
- * <code>null</code> if none.
- *
- * @param element object for which font data is required
- * @return the font data for the given element, or
- * <code>null</code> if none
- */
- public static FontData getFont(Object element) {
- Font font = getPresentation().getFont(element);
- if (font != null) {
- return font.getFontData()[0];
- }
- return null;
- }
-
- /**
- * Returns the font data for the given element, or
- * <code>null</code> if none.
- *
- * @param element object for which font data is required
- * @param presentation presentation to obtain font from
- * @return the font data for the given element, or
- * <code>null</code> if none
- * @since 3.3
- */
- public static FontData getFont(Object element, IDebugModelPresentation presentation) {
- Font font = null;
- if (presentation instanceof IFontProvider) {
- IFontProvider provider = (IFontProvider) presentation;
- font = provider.getFont(element);
- } else {
- font = getPresentation().getFont(element);
- }
- if (font != null) {
- return font.getFontData()[0];
- }
- return null;
- }
-
- /**
- * Returns whether the UI thread is required for computing the label for the
- * given object.
- *
- * @param object object a label is being computed for
- * @return whether the UI thread is required
- */
- public static boolean requiresUIThread(Object object) {
- DelegatingModelPresentation presentation = getPresentation();
- return presentation.requiresUIThread(object);
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java
deleted file mode 100644
index 5a014ddb6..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugViewModeAction.java
+++ /dev/null
@@ -1,78 +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.debug.internal.ui.views.launch;
-
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Action that controls the view mode for Debug view (auto vs. breadcrumb, vs.
- * tree view).
- *
- * @since 3.5
- */
-class DebugViewModeAction extends Action {
-
- private final LaunchView fLaunchView;
- private final Composite fParent;
- private final String fMode;
-
- /**
- * Creates a new action to set the debug view mode.
- *
- * @param view Reference to the debug view.
- * @param mode The mode to be set by this action.
- * @param parent The view's parent control used to calculate view size
- * in auto mode.
- */
- public DebugViewModeAction(LaunchView view, String mode, Composite parent) {
- super(IInternalDebugCoreConstants.EMPTY_STRING, AS_RADIO_BUTTON);
- fLaunchView = view;
- fParent = parent;
- fMode = mode;
-
- if (mode == IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO) {
- setText(LaunchViewMessages.DebugViewModeAction_Auto_label);
- setToolTipText(LaunchViewMessages.DebugViewModeAction_Auto_tooltip);
- setDescription(LaunchViewMessages.DebugViewModeAction_Auto_description);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_VIEW_MODE_AUTO_ACTION);
- } else if (mode == IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL) {
- setText(LaunchViewMessages.DebugViewModeAction_Full_label);
- setToolTipText(LaunchViewMessages.DebugViewModeAction_Full_tooltip);
- setDescription(LaunchViewMessages.DebugViewModeAction_Full_description);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_VIEW_MODE_FULL_ACTION);
- } else {
- setText(LaunchViewMessages.DebugViewModeAction_Compact_label);
- setToolTipText(LaunchViewMessages.DebugViewModeAction_Compact_tooltip);
- setDescription(LaunchViewMessages.DebugViewModeAction_Compact_description);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.DEBUG_VIEW_MODE_COMPACT_ACTION);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- fLaunchView.setViewMode(fMode, fParent);
- }
-
- /**
- * Returns the view mode set by this action.
- */
- public String getMode() {
- return fMode;
- }
-}
-
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/Decoration.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/Decoration.java
deleted file mode 100644
index 6f5cc4c71..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/Decoration.java
+++ /dev/null
@@ -1,32 +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.debug.internal.ui.views.launch;
-
-import org.eclipse.debug.core.model.IThread;
-
-/**
- * A decoration in an editor, created by the debugger.
- */
-public abstract class Decoration {
-
- /**
- * Removes this decoration
- */
- public abstract void remove();
-
- /**
- * Returns the thread this decoration decorates.
- *
- * @return thread associated with this decoration
- */
- public abstract IThread getThread();
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DecorationManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DecorationManager.java
deleted file mode 100644
index 49938fd68..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DecorationManager.java
+++ /dev/null
@@ -1,95 +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.debug.internal.ui.views.launch;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IThread;
-
-/**
- * Manages source selections and decorated editors for launch views.
- */
-public class DecorationManager {
-
- // map of targets to lists of active decorations
- private static Map fDecorations = new HashMap(10);
-
- /**
- * Adds the given decoration for the given stack frame.
- *
- * @param decoration
- * @param frame
- */
- public static void addDecoration(Decoration decoration) {
- synchronized (fDecorations) {
- IDebugTarget target = decoration.getThread().getDebugTarget();
- List list = (List) fDecorations.get(target);
- if (list == null) {
- list = new ArrayList();
- fDecorations.put(target, list);
- }
- list.add(decoration);
- }
- }
-
- /**
- * Removes any decorations for the given debug target.
- *
- * @param target
- * to remove editor decorations for
- */
- public static void removeDecorations(IDebugTarget target) {
- doRemoveDecorations(target, null);
- }
-
- /**
- * Removes any decorations for the given thread
- *
- * @param thread
- * thread to remove decorations for
- */
- public static void removeDecorations(IThread thread) {
- doRemoveDecorations(thread.getDebugTarget(), thread);
- }
-
- private static void doRemoveDecorations(IDebugTarget target, IThread thread) {
- ArrayList decorationsToRemove = new ArrayList();
- synchronized (fDecorations) {
- List list = (List) fDecorations.get(target);
- if (list != null) {
- ListIterator iterator = list.listIterator();
- while (iterator.hasNext()) {
- Decoration decoration = (Decoration) iterator.next();
- if (thread == null || thread.equals(decoration.getThread())) {
- decorationsToRemove.add(decoration);
- iterator.remove();
- }
- }
- if (list.isEmpty()) {
- fDecorations.remove(target);
- }
- }
- }
- Iterator iter = decorationsToRemove.iterator();
- while (iter.hasNext())
- {
- Decoration decoration = (Decoration)iter.next();
- decoration.remove();
- }
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/ImageImageDescriptor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/ImageImageDescriptor.java
deleted file mode 100644
index 57f8fb646..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/ImageImageDescriptor.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.debug.internal.ui.views.launch;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-
-/**
- * Image descriptor for an image.
- */
-public class ImageImageDescriptor extends ImageDescriptor {
- private Image fImage;
-
- /**
- * Constructor for ImagImageDescriptor.
- */
- public ImageImageDescriptor(Image image) {
- super();
- fImage= image;
- }
-
- /* (non-Javadoc)
- * @see ImageDescriptor#getImageData()
- */
- public ImageData getImageData() {
- return fImage.getImageData();
- }
-
- /* (non-Javadoc)
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- return (obj != null) && getClass().equals(obj.getClass()) && fImage.equals(((ImageImageDescriptor)obj).fImage);
- }
-
- /* (non-Javadoc)
- * @see Object#hashCode()
- */
- public int hashCode() {
- return fImage.hashCode();
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
deleted file mode 100644
index 327dfc817..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
+++ /dev/null
@@ -1,1392 +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
- * Wind River - Pawel Piech - Busy status while updates in progress (Bug 206822)
- * Pawel Piech (Wind River) - added a breadcrumb mode to Debug view (Bug 252677)
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.launch;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.commands.IRestartHandler;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.ITerminate;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.actions.AddToFavoritesAction;
-import org.eclipse.debug.internal.ui.actions.EditLaunchConfigurationAction;
-import org.eclipse.debug.internal.ui.commands.actions.DisconnectCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.DropToFrameCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.RestartCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.ResumeCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.StepIntoCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.StepOverCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.StepReturnCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.SuspendCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.TerminateAllAction;
-import org.eclipse.debug.internal.ui.commands.actions.TerminateAndRelaunchAction;
-import org.eclipse.debug.internal.ui.commands.actions.TerminateAndRemoveAction;
-import org.eclipse.debug.internal.ui.commands.actions.TerminateCommandAction;
-import org.eclipse.debug.internal.ui.commands.actions.ToggleStepFiltersAction;
-import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.debug.internal.ui.sourcelookup.EditSourceLookupPathAction;
-import org.eclipse.debug.internal.ui.sourcelookup.LookupSourceAction;
-import org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.VirtualFindAction;
-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.IModelDeltaVisitor;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
-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.debug.internal.ui.views.DebugModelPresentationContext;
-import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
-import org.eclipse.debug.ui.AbstractDebugView;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.actions.DebugCommandAction;
-import org.eclipse.debug.ui.contexts.AbstractDebugContextProvider;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.debug.ui.contexts.IDebugContextProvider;
-import org.eclipse.jface.action.GroupMarker;
-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.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener2;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.XMLMemento;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.IShowInTarget;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.part.Page;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-import org.eclipse.ui.progress.UIJob;
-
-public class LaunchView extends AbstractDebugView implements ISelectionChangedListener, IPerspectiveListener2, IPageListener, IShowInTarget, IShowInSource, IShowInTargetList, IPartListener2, IViewerUpdateListener {
-
- public static final String ID_CONTEXT_ACTIVITY_BINDINGS = "contextActivityBindings"; //$NON-NLS-1$
-
- private static final String TERMINATE = "terminate"; //$NON-NLS-1$
-
- private static final String DISCONNECT = "disconnect"; //$NON-NLS-1$
-
- private static final String SUSPEND = "suspend"; //$NON-NLS-1$
-
- private static final String RESUME = "resume"; //$NON-NLS-1$
-
- private static final String STEP_RETURN = "step_return"; //$NON-NLS-1$
-
- private static final String STEP_OVER = "step_over"; //$NON-NLS-1$
-
- private static final String DROP_TO_FRAME = "drop_to_frame"; //$NON-NLS-1$
-
- private static final String STEP_INTO = "step_into"; //$NON-NLS-1$
-
- private static final String TERMINATE_AND_REMOVE = "terminate_and_remove"; //$NON-NLS-1$
-
- private static final String TERMINATE_ALL = "terminate_all"; //$NON-NLS-1$
-
- private static final String TERMINATE_AND_RELAUNCH = "terminate_relaunch"; //$NON-NLS-1$
-
- private static final String TOGGLE_STEP_FILTERS = "toggle_step_filters"; //$NON-NLS-1$
-
- private static final String RESTART = "restart"; //$NON-NLS-1$
-
- private static final int BREADCRUMB_TRIGGER_RANGE = 5; // pixels
-
- private static final int BREADCRUMB_STICKY_RANGE = 20; // pixels
-
- /**
- * Whether this view is in the active page of a perspective.
- */
- private boolean fIsActive = true;
-
- /**
- * Model presentation or <code>null</code> if none
- */
- private IDebugModelPresentation fPresentation = null;
-
- private EditLaunchConfigurationAction fEditConfigAction = null;
- private AddToFavoritesAction fAddToFavoritesAction = null;
- private EditSourceLookupPathAction fEditSourceAction = null;
- private LookupSourceAction fLookupAction = null;
-
- /**
- * Current view mode (auto vs. breadcrumb, vs. tree view).
- *
- * @since 3.5
- */
- private String fCurrentViewMode = IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO;
-
- /**
- * Actions for selecting the view mode (auto vs. breadcrumb, vs. tree view).
- *
- * @since 3.5
- */
- private DebugViewModeAction[] fDebugViewModeActions;
-
- /**
- * Action that controls the breadcrumb drop-down auto-expand behavior.
- *
- * @since 3.5
- */
- private BreadcrumbDropDownAutoExpandAction fBreadcrumbDropDownAutoExpandAction;
-
- /**
- * Preference name for the view's memento.
- *
- * @since 3.5
- */
- private String PREF_STATE_MEMENTO = "pref_state_memento."; //$NON-NLS-1$
-
- /**
- * Key for a view preference for whether the elements in breadcrumb's
- * drop-down viewer should be automatically expanded.
- *
- * @since 3.5
- */
- private static final String BREADCRUMB_DROPDOWN_AUTO_EXPAND = DebugUIPlugin.getUniqueIdentifier() + ".BREADCRUMB_DROPDOWN_AUTO_EXPAND"; //$NON-NLS-1$
-
- /**
- * Preference for whether the elements in breadcrumb's
- * drop-down viewer should be automatically expanded.
- *
- * @since 3.5
- */
- private boolean fBreadcrumbDropDownAutoExpand = false;
-
- /**
- * Page-book page for the breadcrumb viewer. This page is activated in
- * Debug view when the height of the view is reduced to just one line.
- *
- * @since 3.5
- */
- private class BreadcrumbPage extends Page {
-
- LaunchViewBreadcrumb fCrumb;
- Control fControl;
-
- public void createControl(Composite parent) {
- fCrumb = new LaunchViewBreadcrumb(LaunchView.this, (TreeModelViewer)getViewer(), fTreeViewerDebugContextProvider);
- fControl = fCrumb.createContent(parent);
- }
-
- public void init(IPageSite pageSite) {
- super.init(pageSite);
- pageSite.setSelectionProvider(fCrumb.getSelectionProvider());
- }
-
- public Control getControl() {
- return fControl;
- }
-
- public void setFocus() {
- fCrumb.activate();
- }
-
- IDebugContextProvider getContextProvider() {
- return fCrumb.getContextProvider();
- }
-
- int getHeight() {
- return fCrumb.getHeight();
- }
- }
-
- private BreadcrumbPage fBreadcrumbPage;
-
- class TreeViewerContextProvider extends AbstractDebugContextProvider implements IModelChangedListener {
-
- private ISelection fContext = null;
- private TreeModelViewer fViewer = null;
- private Visitor fVisitor = new Visitor();
-
- class Visitor implements IModelDeltaVisitor {
- public boolean visit(IModelDelta delta, int depth) {
- if ((delta.getFlags() & (IModelDelta.STATE | IModelDelta.CONTENT)) > 0) {
- // state and/or content change
- if ((delta.getFlags() & IModelDelta.SELECT) == 0) {
- // no select flag
- if ((delta.getFlags() & IModelDelta.CONTENT) > 0) {
- // content has changed without select >> possible re-activation
- possibleChange(getViewerTreePath(delta), DebugContextEvent.ACTIVATED);
- } else if ((delta.getFlags() & IModelDelta.STATE) > 0) {
- // state has changed without select >> possible state change of active context
- possibleChange(getViewerTreePath(delta), DebugContextEvent.STATE);
- }
- }
- }
- return true;
- }
- }
-
- /**
- * Returns a tree path for the node, *not* including the root element.
- *
- * @param node
- * model delta
- * @return corresponding tree path
- */
- private TreePath getViewerTreePath(IModelDelta node) {
- ArrayList list = new ArrayList();
- IModelDelta parentDelta = node.getParentDelta();
- while (parentDelta != null) {
- list.add(0, node.getElement());
- node = parentDelta;
- parentDelta = node.getParentDelta();
- }
- return new TreePath(list.toArray());
- }
-
- public TreeViewerContextProvider(TreeModelViewer viewer) {
- super(LaunchView.this);
- fViewer = viewer;
- fViewer.addModelChangedListener(this);
- }
-
- protected void dispose() {
- fContext = null;
- fViewer.removeModelChangedListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextProvider#getActiveContext()
- */
- public synchronized ISelection getActiveContext() {
- return fContext;
- }
-
- protected void activate(ISelection selection) {
- synchronized (this) {
- fContext = selection;
- }
- fire(new DebugContextEvent(this, selection, DebugContextEvent.ACTIVATED));
- }
-
- protected void possibleChange(TreePath element, int type) {
- DebugContextEvent event = null;
- synchronized (this) {
- if (fContext instanceof ITreeSelection) {
- ITreeSelection ss = (ITreeSelection) fContext;
- if (ss.size() == 1) {
- TreePath current = ss.getPaths()[0];
- if (current.startsWith(element, null)) {
- if (current.getSegmentCount() == element.getSegmentCount()) {
- event = new DebugContextEvent(this, fContext, type);
- } else {
- // if parent of the currently selected element
- // changes, issue event to update STATE only
- event = new DebugContextEvent(this, fContext, DebugContextEvent.STATE);
- }
- }
- }
- }
- }
- if (event == null) {
- return;
- }
- if (getControl().getDisplay().getThread() == Thread.currentThread()) {
- fire(event);
- } else {
- final DebugContextEvent finalEvent = event;
- Job job = new UIJob("context change") { //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- // verify selection is still the same context since job was scheduled
- synchronized (TreeViewerContextProvider.this) {
- if (fContext instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) fContext;
- Object changed = ((IStructuredSelection)finalEvent.getContext()).getFirstElement();
- if (!(ss.size() == 1 && ss.getFirstElement().equals(changed))) {
- return Status.OK_STATUS;
- }
- }
- }
- fire(finalEvent);
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.schedule();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener#modelChanged(org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta)
- */
- public void modelChanged(IModelDelta delta, IModelProxy proxy) {
- delta.accept(fVisitor);
- }
-
- }
-
- /**
- * Context provider
- */
- private TreeViewerContextProvider fTreeViewerDebugContextProvider;
-
- /**
- * The PageBookView, which is a base class of this class does not make it
- * easy to control which page is currently active. It is intended that the
- * page book pages are associated with workbench parts, and the parts are
- * in turn associated with PageRec records.
- * <p>
- * PageRec is needed in order to properly active a page book page, by
- * calling showPageRec(), so in this class we need to add some hooks in
- * order to obtain the page record for the tree viewer page and the
- * breadcrumb page.</p><p>
- * For the default page, we override the showPageRec()
- * to determine if the default page is being shown and if it is, we save
- * its record for later use. showPageRec() is always called for the default
- * page after it is created. For the breadcrumb page, we use the page book
- * view mechanism to create the page based on a workbench part, but we have
- * to create a dummy part in order for this to work.
- * </p>
- * <p>
- * See bug 262845 and 262870.
- * </p>
- *
- * @see #createPartControl(Composite)
- * @see BreadcrumbWorkbenchPart
- * @eee #doCreatePage(IWorkbenchPart)
- * @see #isImportant(IWorkbenchPart)
- * @see #autoSelectViewPage(Composite)
- * @see #showTreeViewerPage()
- * @see #showBreadcrumbPage()
- */
- private PageRec fDefaultPageRec = null;
-
- private ISelectionChangedListener fTreeViewerSelectionChangedListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- fTreeViewerDebugContextProvider.activate(event.getSelection());
- }
- };
-
- private class ContextProviderProxy extends AbstractDebugContextProvider implements IDebugContextListener {
- private IDebugContextProvider fActiveProvider;
- private IDebugContextProvider[] fProviders;
-
- ContextProviderProxy(IDebugContextProvider[] providers) {
- super(LaunchView.this);
- fProviders = providers;
- fActiveProvider = providers[0];
- for (int i = 0; i < fProviders.length; i++) {
- fProviders[i].addDebugContextListener(this);
- }
- }
-
- void setActiveProvider(IDebugContextProvider provider) {
- if (!provider.equals(fActiveProvider)) {
- ISelection activeContext = getActiveContext();
- fActiveProvider = provider;
- ISelection newActiveContext = getActiveContext();
- if (!activeContext.equals(newActiveContext)) {
- fire(new DebugContextEvent(this, getActiveContext(), DebugContextEvent.ACTIVATED));
- }
- }
- }
-
- public ISelection getActiveContext() {
- ISelection activeContext = fActiveProvider.getActiveContext();
- if (activeContext != null) {
- return activeContext;
- }
- return TreeSelection.EMPTY;
- }
-
- public void debugContextChanged(DebugContextEvent event) {
- if (event.getSource().equals(fActiveProvider)) {
- fire(new DebugContextEvent(this, event.getContext(), event.getFlags()));
- }
- }
-
- void dispose() {
- for (int i = 0; i < fProviders.length; i++) {
- fProviders[i].removeDebugContextListener(this);
- }
- fProviders = null;
- fActiveProvider = null;
- }
- }
-
- private ContextProviderProxy fContextProviderProxy;
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
- */
- protected String getHelpContextId() {
- return IDebugHelpContextIds.DEBUG_VIEW;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#createActions()
- */
- protected void createActions() {
- setAction("Properties", new PropertyDialogAction(getSite(), getSite().getSelectionProvider())); //$NON-NLS-1$
- fEditConfigAction = new EditLaunchConfigurationAction();
- fAddToFavoritesAction = new AddToFavoritesAction();
- fEditSourceAction = new EditSourceLookupPathAction(this);
- fLookupAction = new LookupSourceAction(this);
- setAction(FIND_ACTION, new VirtualFindAction((InternalTreeModelViewer) getViewer()));
-
- addCapabilityAction(new TerminateCommandAction(), TERMINATE);
- addCapabilityAction(new DisconnectCommandAction(), DISCONNECT);
- addCapabilityAction(new SuspendCommandAction(), SUSPEND);
- addCapabilityAction(new ResumeCommandAction(), RESUME);
- addCapabilityAction(new StepReturnCommandAction(), STEP_RETURN);
- addCapabilityAction(new StepOverCommandAction(), STEP_OVER);
- addCapabilityAction(new StepIntoCommandAction(), STEP_INTO);
- addCapabilityAction(new DropToFrameCommandAction(), DROP_TO_FRAME);
- addCapabilityAction(new TerminateAndRemoveAction(), TERMINATE_AND_REMOVE);
- addCapabilityAction(new TerminateAndRelaunchAction(), TERMINATE_AND_RELAUNCH);
- addCapabilityAction(new RestartCommandAction(), RESTART);
- addCapabilityAction(new TerminateAllAction(), TERMINATE_ALL);
- addCapabilityAction(new ToggleStepFiltersAction(), TOGGLE_STEP_FILTERS);
- }
-
-
- /**
- * Initializes the action and associates it with the given id.
- *
- * @param capability
- * @param actionID
- */
- private void addCapabilityAction(DebugCommandAction capability, String actionID) {
- capability.init(this);
- setAction(actionID, capability);
- }
-
- /**
- * Disposes the given action.
- *
- * @param actionID
- */
- private void disposeCommandAction(String actionID) {
- DebugCommandAction action = (DebugCommandAction) getAction(actionID);
- action.dispose();
- }
-
- /**
- * Override the default implementation to create the breadcrumb page.
- *
- * @since 3.5
- * @see #fDefaultPageRec
- */
- public void createPartControl(final Composite parent) {
- super.createPartControl(parent);
-
- // Copy the global action handlers to the default page.
- setGlobalActionBarsToPage((IPageBookViewPage)getDefaultPage());
-
- // Add view as a selection listener to the site.
- getSite().getSelectionProvider().addSelectionChangedListener(this);
-
- // Set the tree viewer as the selection provider to the default page.
- // The page book view handles switching the between page selection
- // providers as needed.
- ((IPageBookViewPage)getDefaultPage()).getSite().setSelectionProvider(getViewer());
-
- // Call the PageBookView part listener to indirectly create the breadcrumb page.
- // This call eventually calls doCreatePage() implemented below.
- partActivated(new BreadcrumbWorkbenchPart(getSite()));
-
- fContextProviderProxy = new ContextProviderProxy(
- new IDebugContextProvider[] {fTreeViewerDebugContextProvider, fBreadcrumbPage.getContextProvider()});
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextProvider(fContextProviderProxy);
-
- // Create and configure actions for selecting view mode.
- createViewModeActions(parent);
- IPreferenceStore prefStore = DebugUIPlugin.getDefault().getPreferenceStore();
- String mode = prefStore.getString(IDebugPreferenceConstants.DEBUG_VIEW_MODE);
- setViewMode(mode, parent);
- for (int i = 0; i < fDebugViewModeActions.length; i++) {
- fDebugViewModeActions[i].setChecked(fDebugViewModeActions[i].getMode().equals(mode));
- }
-
- // Add a resize listener for the view to activate breadcrumb as needed.
- parent.addControlListener(new ControlListener() {
- public void controlMoved(ControlEvent e) {
- }
- public void controlResized(ControlEvent e) {
- if (parent.isDisposed()) {
- return;
- }
- if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO.equals(fCurrentViewMode)) {
- autoSelectViewPage(parent);
- }
- }
- });
- }
-
- /**
- * Copies the view's global action handlers created by createActions(),
- * into the page site's action bars. This is necessary because the page
- * book view resets the view site's global actions after each page switch
- * (see bug 264618).
- *
- * @param page Page to copy the global actions into.
- *
- * @since 3.5
- */
- private void setGlobalActionBarsToPage(IPageBookViewPage page) {
- IActionBars pageActionBars = page.getSite().getActionBars();
- // Set the view site action bars created by createActions() to the
- // default page site.
- IActionBars bars = getViewSite().getActionBars();
- pageActionBars.setGlobalActionHandler(FIND_ACTION, bars.getGlobalActionHandler(FIND_ACTION));
- pageActionBars.setGlobalActionHandler(COPY_ACTION, bars.getGlobalActionHandler(COPY_ACTION));
- }
-
- /**
- * Override the default implementation to create the breadcrumb page.
- *
- * @since 3.5
- * @see #fDefaultPageRec
- */
- protected PageRec doCreatePage(IWorkbenchPart part) {
- if (part instanceof BreadcrumbWorkbenchPart) {
- fBreadcrumbPage = new BreadcrumbPage();
- fBreadcrumbPage.createControl(getPageBook());
- initPage(fBreadcrumbPage);
- setGlobalActionBarsToPage(fBreadcrumbPage);
- return new PageRec(part, fBreadcrumbPage);
- }
- return null;
- }
-
- /**
- * Override the default implementation to create the breadcrumb page.
- *
- * @since 3.5
- * @see #fDefaultPageRec
- */
- protected boolean isImportant(IWorkbenchPart part) {
- return part instanceof BreadcrumbWorkbenchPart;
- }
-
- /**
- * Override the default implementation to gain access at the default
- * page record.
- *
- * @since 3.5
- * @see #fDefaultPageRec
- */
- protected void showPageRec(PageRec pageRec) {
- if (pageRec.page == getDefaultPage()) {
- fDefaultPageRec = pageRec;
- }
-
- super.showPageRec(pageRec);
- }
-
- /**
- * Creates actions for controlling view mode.
- *
- * @param parent The view's parent control used to calculate view size
- * in auto mode.
- */
- private void createViewModeActions(final Composite parent) {
- IActionBars actionBars = getViewSite().getActionBars();
- IMenuManager viewMenu = actionBars.getMenuManager();
-
- fDebugViewModeActions = new DebugViewModeAction[3];
- fDebugViewModeActions[0] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_AUTO, parent);
- fDebugViewModeActions[1] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL, parent);
- fDebugViewModeActions[2] = new DebugViewModeAction(this, IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT, parent);
- fBreadcrumbDropDownAutoExpandAction = new BreadcrumbDropDownAutoExpandAction(this);
-
- viewMenu.add(new Separator());
- final MenuManager modeSubmenu = new MenuManager(LaunchViewMessages.LaunchView_ViewModeMenu_label);
- modeSubmenu.setRemoveAllWhenShown(true);
- modeSubmenu.add(fDebugViewModeActions[0]);
- modeSubmenu.add(fDebugViewModeActions[1]);
- modeSubmenu.add(fDebugViewModeActions[2]);
- modeSubmenu.add(new Separator());
- modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
- viewMenu.add(modeSubmenu);
- viewMenu.add(new Separator());
-
- modeSubmenu.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- modeSubmenu.add(fDebugViewModeActions[0]);
- modeSubmenu.add(fDebugViewModeActions[1]);
- modeSubmenu.add(fDebugViewModeActions[2]);
- modeSubmenu.add(new Separator());
- modeSubmenu.add(fBreadcrumbDropDownAutoExpandAction);
- }
- });
-
- }
-
-
- /**
- * Sets the current view mode. If needed, the active view page is changed.
- *
- * @param mode New mode to set.
- * @param parent The view's parent control used to calculate view size
- * in auto mode.
- *
- * @since 3.5
- */
- void setViewMode(String mode, Composite parent) {
- if (fCurrentViewMode.equals(mode)) {
- return;
- }
-
- fCurrentViewMode = mode;
- if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_COMPACT.equals(mode)) {
- showBreadcrumbPage();
- } else if (IDebugPreferenceConstants.DEBUG_VIEW_MODE_FULL.equals(mode)) {
- showTreeViewerPage();
- } else {
- autoSelectViewPage(parent);
- }
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugPreferenceConstants.DEBUG_VIEW_MODE, mode);
- }
-
- /**
- * Based on the current view size, select the active view page
- * (tree viewer vs. breadcrumb).
- *
- * @param parent View pane control.
- *
- * @since 3.5
- */
- private void autoSelectViewPage(Composite parent) {
- int breadcrumbHeight = fBreadcrumbPage.getHeight();
- if (parent.getClientArea().height < breadcrumbHeight + BREADCRUMB_TRIGGER_RANGE) {
- showBreadcrumbPage();
- }
- else if (parent.getClientArea().height > breadcrumbHeight + BREADCRUMB_STICKY_RANGE)
- {
- showTreeViewerPage();
- }
- }
-
-
- /**
- * Shows the tree viewer in the Debug view.
- *
- * @since 3.5
- */
- void showTreeViewerPage() {
- if (fDefaultPageRec != null && !getDefaultPage().equals(getCurrentPage())) {
- showPageRec(fDefaultPageRec);
- fContextProviderProxy.setActiveProvider(fTreeViewerDebugContextProvider);
- // Clear the selection in the breadcrumb to avoid having it re-selected
- // when the breadcrumb is activated again (bug 268124).
- fBreadcrumbPage.fCrumb.clearSelection();
- }
- }
-
- /**
- * Shows the breadcrumb in the Debug view.
- *
- * @since 3.5
- */
- void showBreadcrumbPage() {
- PageRec rec = getPageRec(fBreadcrumbPage);
- if (rec != null && !fBreadcrumbPage.equals(getCurrentPage())) {
- showPageRec(rec);
- // Ask the breadcrumb to take focus if we're the active part.
- if (getSite().getPage().getActivePart() == this) {
- setFocus();
- }
- fBreadcrumbPage.fCrumb.debugContextChanged(new DebugContextEvent(
- fTreeViewerDebugContextProvider,
- fTreeViewerDebugContextProvider.getActiveContext(),
- DebugContextEvent.ACTIVATED));
- fContextProviderProxy.setActiveProvider(fBreadcrumbPage.getContextProvider());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite)
- */
- protected Viewer createViewer(Composite parent) {
- fPresentation = new DelegatingModelPresentation();
- TreeModelViewer viewer = new TreeModelViewer(parent,
- SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL,
- new DebugModelPresentationContext(IDebugUIConstants.ID_DEBUG_VIEW, fPresentation));
-
- viewer.addSelectionChangedListener(fTreeViewerSelectionChangedListener);
- viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- handleDeleteKeyPressed();
- }
- }
- });
- viewer.addViewerUpdateListener(this);
-
- viewer.setInput(DebugPlugin.getDefault().getLaunchManager());
- //setEventHandler(new LaunchViewEventHandler(this));
- fTreeViewerDebugContextProvider = new TreeViewerContextProvider(viewer);
-
- return viewer;
- }
-
- private void handleDeleteKeyPressed() {
- IStructuredSelection selection= (IStructuredSelection) getViewer().getSelection();
- Iterator iter= selection.iterator();
- Object item;
- boolean itemsToTerminate= false;
- ITerminate terminable;
- while (iter.hasNext()) {
- item= iter.next();
- if (item instanceof ITerminate) {
- terminable= (ITerminate) item;
- if (terminable.canTerminate() && !terminable.isTerminated()) {
- itemsToTerminate= true;
- break;
- }
- }
- }
- if (itemsToTerminate) {
- // Prompt the user to proceed with termination
- if (!MessageDialog.openQuestion(getSite().getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_1, DebugUIViewsMessages.LaunchView_Terminate_and_remove_selected__2)) {
- return;
- }
- }
- MultiStatus status= new MultiStatus(DebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, DebugUIViewsMessages.LaunchView_Exceptions_occurred_attempting_to_terminate_and_remove_3, null);
- iter= selection.iterator();
- while (iter.hasNext()) {
- try {
- terminateAndRemove(iter.next());
- } catch (DebugException exception) {
- status.merge(exception.getStatus());
- }
- }
- if (!status.isOK()) {
- IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
- if (window != null) {
- DebugUIPlugin.errorDialog(window.getShell(), DebugUIViewsMessages.LaunchView_Terminate_and_Remove_4, DebugUIViewsMessages.LaunchView_Terminate_and_remove_failed_5, status);
- } else {
- DebugUIPlugin.log(status);
- }
- }
- }
-
- /**
- * Terminates and removes the given element from the launch manager
- */
- public static void terminateAndRemove(Object element) throws DebugException {
- ILaunch launch = DebugUIPlugin.getLaunch(element);
- ITerminate terminable = launch;
- if (terminable == null) {
- if (element instanceof ITerminate) {
- terminable = (ITerminate) element;
- }
- }
- if (terminable == null) {
- return;
- }
- if (!(terminable.canTerminate() || terminable.isTerminated())) {
- // Don't try to terminate or remove attached launches
- return;
- }
- try {
- if (!terminable.isTerminated()) {
- terminable.terminate();
- }
- } finally {
- if (launch != null) {
- ILaunchManager lManager= DebugPlugin.getDefault().getLaunchManager();
- lManager.removeLaunch(launch);
- }
- }
- }
-
- private void commonInit(IViewSite site) {
- site.getPage().addPartListener((IPartListener2) this);
- site.getWorkbenchWindow().addPageListener(this);
- site.getWorkbenchWindow().addPerspectiveListener(this);
- }
-
- private void preferenceInit(IViewSite site) {
- PREF_STATE_MEMENTO = PREF_STATE_MEMENTO + site.getId();
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- String string = store.getString(PREF_STATE_MEMENTO);
- if(string.length() > 0) {
- ByteArrayInputStream bin = new ByteArrayInputStream(string.getBytes());
- InputStreamReader reader = new InputStreamReader(bin);
- try {
- XMLMemento stateMemento = XMLMemento.createReadRoot(reader);
- setMemento(stateMemento);
- } catch (WorkbenchException e) {
- } finally {
- try {
- reader.close();
- bin.close();
- } catch (IOException e){}
- }
- }
- IMemento mem = getMemento();
-
- if (mem != null) {
- Boolean auto = mem.getBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND);
- if(auto != null) {
- setBreadcrumbDropDownAutoExpand(auto.booleanValue());
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite)
- */
- public void init(IViewSite site) throws PartInitException {
- super.init(site);
- commonInit(site);
- preferenceInit(site);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- commonInit(site);
- preferenceInit(site);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.PageBookView#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- String id = part.getSite().getId();
- if (id.equals(getSite().getId())) {
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- OutputStreamWriter writer = new OutputStreamWriter(bout);
-
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("DebugViewMemento"); //$NON-NLS-1$
- saveViewerState(memento);
- memento.save(writer);
-
- IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
- String xmlString = bout.toString();
- store.putValue(PREF_STATE_MEMENTO, xmlString);
- } catch (IOException e) {
- } finally {
- try {
- writer.close();
- bout.close();
- } catch (IOException e) {
- }
- }
- }
- super.partDeactivated(part);
- }
-
- /**
- * Saves the current state of the viewer
- * @param memento the memento to write the viewer state into
- */
- public void saveViewerState(IMemento memento) {
- memento.putBoolean(BREADCRUMB_DROPDOWN_AUTO_EXPAND, getBreadcrumbDropDownAutoExpand());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
- */
- protected void configureToolBar(IToolBarManager tbm) {
- tbm.add(new Separator(IDebugUIConstants.THREAD_GROUP));
- tbm.add(new Separator(IDebugUIConstants.STEP_GROUP));
- tbm.add(new GroupMarker(IDebugUIConstants.STEP_INTO_GROUP));
- tbm.add(new GroupMarker(IDebugUIConstants.STEP_OVER_GROUP));
- tbm.add(new GroupMarker(IDebugUIConstants.STEP_RETURN_GROUP));
- tbm.add(new GroupMarker(IDebugUIConstants.EMPTY_STEP_GROUP));
- tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
-
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME));
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND));
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE));
- tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT));
-
- tbm.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO));
- tbm.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER));
- tbm.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN));
-
- tbm.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME));
-
- tbm.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- getSite().getSelectionProvider().removeSelectionChangedListener(this);
- DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).removeDebugContextProvider(fContextProviderProxy);
- fContextProviderProxy.dispose();
- fTreeViewerDebugContextProvider.dispose();
- disposeActions();
- Viewer viewer = getViewer();
- if (viewer != null) {
- viewer.removeSelectionChangedListener(fTreeViewerSelectionChangedListener);
- ((TreeModelViewer)viewer).removeViewerUpdateListener(this);
- }
- IWorkbenchPage page = getSite().getPage();
- page.removePartListener((IPartListener2) this);
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.removePerspectiveListener(this);
- window.removePageListener(this);
-
- super.dispose();
- }
-
- private void disposeActions() {
- PropertyDialogAction properties = (PropertyDialogAction) getAction("Properties"); //$NON-NLS-1$
- properties.dispose();
-
- disposeCommandAction(TERMINATE);
- disposeCommandAction(DISCONNECT);
- disposeCommandAction(SUSPEND);
- disposeCommandAction(RESUME);
- disposeCommandAction(STEP_RETURN);
- disposeCommandAction(STEP_OVER);
- disposeCommandAction(STEP_INTO);
- disposeCommandAction(DROP_TO_FRAME);
- disposeCommandAction(TERMINATE_AND_REMOVE);
- disposeCommandAction(TERMINATE_AND_RELAUNCH);
- disposeCommandAction(RESTART);
- disposeCommandAction(TERMINATE_ALL);
- }
-
- /**
- * The selection has changed in the viewer. Show the
- * associated source code if it is a stack frame.
- *
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- updateObjects();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- */
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection= event.getSelection();
- if (!(selection instanceof IStructuredSelection)) {
- return;
- }
- IStructuredSelection ss= (IStructuredSelection)selection;
- Object o= ss.getFirstElement();
- if (o == null || o instanceof IStackFrame) {
- return;
- }
- StructuredViewer viewer = (StructuredViewer) getViewer();
- viewer.refresh(o);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- setActive(page.findView(getSite().getId()) != null);
- updateObjects();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- setActive(page.findView(getSite().getId()) != null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener2#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, org.eclipse.ui.IWorkbenchPartReference, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPageListener#pageActivated(org.eclipse.ui.IWorkbenchPage)
- */
- public void pageActivated(IWorkbenchPage page) {
- if (getSite().getPage().equals(page)) {
- setActive(true);
- updateObjects();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPageListener#pageClosed(org.eclipse.ui.IWorkbenchPage)
- */
- public void pageClosed(IWorkbenchPage page) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPageListener#pageOpened(org.eclipse.ui.IWorkbenchPage)
- */
- public void pageOpened(IWorkbenchPage page) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDebugView#getPresentation(java.lang.String)
- */
- public IDebugModelPresentation getPresentation(String id) {
- return ((DelegatingModelPresentation)fPresentation).getPresentation(id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- protected void fillContextMenu(IMenuManager menu) {
- TreeSelection sel = (TreeSelection) fTreeViewerDebugContextProvider.getActiveContext();
- Object element = sel != null && sel.size() > 0 ? sel.getFirstElement() : null;
-
- menu.add(new Separator(IDebugUIConstants.EMPTY_EDIT_GROUP));
- menu.add(new Separator(IDebugUIConstants.EDIT_GROUP));
- menu.add(getAction(FIND_ACTION));
- menu.add(new Separator(IDebugUIConstants.EMPTY_STEP_GROUP));
- menu.add(new Separator(IDebugUIConstants.STEP_GROUP));
- menu.add(new GroupMarker(IDebugUIConstants.STEP_INTO_GROUP));
- menu.add(new GroupMarker(IDebugUIConstants.STEP_OVER_GROUP));
- menu.add(new GroupMarker(IDebugUIConstants.STEP_RETURN_GROUP));
- menu.add(new Separator(IDebugUIConstants.RENDER_GROUP));
- menu.add(new Separator(IDebugUIConstants.EMPTY_THREAD_GROUP));
- menu.add(new Separator(IDebugUIConstants.THREAD_GROUP));
- menu.add(new Separator(IDebugUIConstants.EMPTY_LAUNCH_GROUP));
- menu.add(new Separator(IDebugUIConstants.LAUNCH_GROUP));
- IStructuredSelection selection = (IStructuredSelection) getSite().getSelectionProvider().getSelection();
- updateAndAdd(menu, fEditConfigAction, selection);
- updateAndAdd(menu, fAddToFavoritesAction, selection);
- updateAndAdd(menu, fEditSourceAction, selection);
- updateAndAdd(menu, fLookupAction, selection);
- menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
- menu.add(new Separator(IDebugUIConstants.RENDER_GROUP));
- menu.add(new Separator(IDebugUIConstants.PROPERTY_GROUP));
- PropertyDialogAction action = (PropertyDialogAction)getAction("Properties"); //$NON-NLS-1$
- /**
- * TODO hack to get around bug 148424, remove if UI ever fixes the PropertyDialogAction to respect enablesWhen conditions
- */
- action.setEnabled(action.isApplicableForSelection() && !(element instanceof ILaunch));
- menu.add(action);
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- menu.appendToGroup(IDebugUIConstants.LAUNCH_GROUP, getAction(TERMINATE_AND_REMOVE));
- menu.appendToGroup(IDebugUIConstants.LAUNCH_GROUP, getAction(TERMINATE_ALL));
-
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME));
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND));
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE));
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE_AND_RELAUNCH));
- if (element instanceof IAdaptable && ((IAdaptable)element).getAdapter(IRestartHandler.class) != null) {
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESTART));
- }
- menu.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT));
-
- menu.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO));
- menu.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER));
- menu.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN));
-
- menu.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME));
-
- menu.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS));
- }
-
- /**
- * Updates the enabled state of the given action based on the selection
- * and adds to the menu if enabled.
- *
- * @param menu menu to add the action to
- * @param action action to add if enabled
- * @param selection selection to update enabled state for
- */
- private void updateAndAdd(IMenuManager menu, SelectionListenerAction action, IStructuredSelection selection) {
- action.selectionChanged(selection);
- if (action.isEnabled()) {
- menu.add(action);
- }
- }
-
- /**
- * Sets whether this view is in the active page of a
- * perspective. Since a page can have more than one
- * perspective, this view only show's source when in
- * the active perspective/page.
- *
- * @param active whether this view is in the active page of a
- * perspective
- */
- protected void setActive(boolean active) {
- fIsActive = active;
- }
-
- /**
- * Returns whether this view is in the active page of
- * the active perspective and has been fully created.
- *
- * @return whether this view is in the active page of
- * the active perspective and has been fully created.
- */
- protected boolean isActive() {
- return fIsActive && getViewer() != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
- */
- public boolean show(ShowInContext context) {
- ISelection selection = context.getSelection();
- if (selection != null) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() == 1) {
- Object obj = ss.getFirstElement();
- if (obj instanceof IDebugTarget || obj instanceof IProcess) {
- Viewer viewer = getViewer();
- if (viewer instanceof InternalTreeModelViewer) {
- InternalTreeModelViewer tv = (InternalTreeModelViewer) viewer;
- tv.setSelection(selection, true, true);
- } else {
- viewer.setSelection(selection, true);
- }
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IShowInSource#getShowInContext()
- */
- public ShowInContext getShowInContext() {
- if (isActive()) {
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
- if (selection.size() == 1) {
- Object object = selection.getFirstElement();
- if (object instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) object;
- IShowInSource show = (IShowInSource) adaptable.getAdapter(IShowInSource.class);
- if (show != null) {
- return show.getShowInContext();
- }
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IShowInTargetList#getShowInTargetIds()
- */
- public String[] getShowInTargetIds() {
- if (isActive()) {
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
- if (selection.size() == 1) {
- Object object = selection.getFirstElement();
- if (object instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) object;
- IShowInTargetList show = (IShowInTargetList) adaptable.getAdapter(IShowInTargetList.class);
- if (show != null) {
- return show.getShowInTargetIds();
- }
- }
- }
- }
- return new String[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partClosed(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partVisible(IWorkbenchPartReference partRef) {
- IWorkbenchPart part = partRef.getPart(false);
- if (part == this) {
- setActive(true);
-// TODO: Workaround for Bug #63332. Reexamine after M9.
-// updateContextListener();
- // When the launch view becomes visible, turn on the
- // debug action set. Note that the workbench will handle the
- // case where the user really doesn't want the action set
- // enabled - showActionSet(String) will do nothing for an
- // action set that's been manually disabled.
- getSite().getPage().showActionSet(IDebugUIConstants.DEBUG_ACTION_SET);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partOpened(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partActivated(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partDeactivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partDeactivated(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#partInputChanged(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partInputChanged(IWorkbenchPartReference partRef) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
- */
- protected void becomesVisible() {
- super.becomesVisible();
- getViewer().refresh();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.viewers.IViewerUpdateListener#updateComplete(org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor)
- */
- public void updateComplete(IViewerUpdate update) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.viewers.IViewerUpdateListener#updateStarted(org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousRequestMonitor)
- */
- public void updateStarted(IViewerUpdate update) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.viewers.IViewerUpdateListener#viewerUpdatesBegin()
- */
- public synchronized void viewerUpdatesBegin() {
- IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (progressService != null) {
- progressService.incrementBusy();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.viewers.model.provisional.viewers.IViewerUpdateListener#viewerUpdatesComplete()
- */
- public synchronized void viewerUpdatesComplete() {
- IWorkbenchSiteProgressService progressService =
- (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (progressService != null) {
- progressService.decrementBusy();
- }
- }
-
- /**
- * Returns whether the breadcrumb viewer is currently visible in the view.
- *
- * @since 3.5
- */
- boolean isBreadcrumbVisible() {
- return fBreadcrumbPage.equals(getCurrentPage());
- }
-
- /**
- * Returns whether the elements in breadcrumb's drop-down viewer should be
- * automatically expanded.
- *
- * @since 3.5
- */
- boolean getBreadcrumbDropDownAutoExpand() {
- return fBreadcrumbDropDownAutoExpand;
- }
-
- /**
- * Sets whether the elements in breadcrumb's drop-down viewer should be
- * automatically expanded.
- *
- * @since 3.5
- */
- void setBreadcrumbDropDownAutoExpand(boolean expand) {
- fBreadcrumbDropDownAutoExpand = expand;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java
deleted file mode 100644
index 6542fab63..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewBreadcrumb.java
+++ /dev/null
@@ -1,518 +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.internal.ui.views.launch;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.internal.ui.viewers.breadcrumb.AbstractBreadcrumb;
-import org.eclipse.debug.internal.ui.viewers.breadcrumb.BreadcrumbViewer;
-import org.eclipse.debug.internal.ui.viewers.breadcrumb.IBreadcrumbDropDownSite;
-import org.eclipse.debug.internal.ui.viewers.breadcrumb.TreeViewerDropDown;
-import org.eclipse.debug.internal.ui.viewers.model.ILabelUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.SubTreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDeltaVisitor;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
-import org.eclipse.debug.ui.contexts.AbstractDebugContextProvider;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.debug.ui.contexts.IDebugContextProvider;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITreePathContentProvider;
-import org.eclipse.jface.viewers.ITreePathLabelProvider;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.ViewerLabel;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MenuDetectEvent;
-import org.eclipse.swt.events.MenuDetectListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.progress.UIJob;
-
-/**
- * @since 3.5
- */
-public class LaunchViewBreadcrumb extends AbstractBreadcrumb implements IDebugContextListener, ILabelUpdateListener {
-
- private static class Input {
- final TreePath fPath;
-
- Input(TreePath path) {
- fPath = path;
- }
-
- public boolean equals(Object obj) {
- return obj instanceof Input &&
- ((fPath == null && ((Input)obj).fPath == null) ||
- (fPath != null && fPath.equals( ((Input)obj).fPath )));
- }
-
- public int hashCode() {
- return fPath == null ? 0 : fPath.hashCode();
- }
- }
-
- private static class ContentProvider implements ITreePathContentProvider {
-
- private static final Object[] EMPTY_ELEMENTS_ARRAY = new Object[0];
-
- public Input fInput;
-
- public Object[] getChildren(TreePath parentPath) {
- if (hasChildren(parentPath)) {
- return new Object[] { fInput.fPath.getSegment(parentPath.getSegmentCount()) };
- }
- return EMPTY_ELEMENTS_ARRAY;
- }
-
- public TreePath[] getParents(Object element) {
- // Not supported
- return new TreePath[] { TreePath.EMPTY };
- }
-
- public boolean hasChildren(TreePath parentPath) {
- if ( parentPath.getSegmentCount() == 0) {
- return fInput != null;
- } else if (fInput != null &&
- fInput.fPath != null &&
- fInput.fPath.getSegmentCount() > parentPath.getSegmentCount())
- {
- for (int i = 0; i < parentPath.getSegmentCount(); i++) {
- if (i >= fInput.fPath.getSegmentCount()) {
- return false;
- } else {
- Object parentElement = parentPath.getSegment(i);
- Object contextElement = fInput.fPath.getSegment(i);
- if (!parentElement.equals(contextElement)) {
- return false;
- }
- }
- }
- return true;
- }
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- if (fInput != null &&
- fInput.fPath != null)
- {
- return getChildren(TreePath.EMPTY);
- } else {
- return new Object[] { fgEmptyDebugContextElement };
- }
- }
-
- public void dispose() {
- fInput = null;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof Input) {
- fInput = ((Input)newInput);
- } else {
- fInput = null;
- }
- }
- }
-
- private class LabelProvider extends BaseLabelProvider implements ITreePathLabelProvider {
- public void updateLabel(ViewerLabel label, TreePath elementPath) {
- if (fgEmptyDebugContextElement.equals(elementPath.getLastSegment())) {
- label.setText(LaunchViewMessages.Breadcrumb_NoActiveContext);
- label.setImage(null);
- } else {
- ViewerLabel treeViewerLabel = fTreeViewer.getElementLabel(elementPath, null);
- if (treeViewerLabel == null) {
- label.setText(LaunchViewMessages.Breadcrumb_NoActiveContext);
- label.setImage(null);
- } else {
- label.setText(treeViewerLabel.getText());
- label.setTooltipText(treeViewerLabel.getText());
- label.setImage(treeViewerLabel.getImage());
- label.setFont(treeViewerLabel.getFont());
- label.setForeground(treeViewerLabel.getForeground());
- label.setBackground(treeViewerLabel.getBackground());
-
- }
- }
- }
- }
-
- private final LaunchView fView;
- private final TreeModelViewer fTreeViewer;
- private final IDebugContextProvider fTreeViewerContextProvider;
- private Input fBreadcrumbInput;
- static final private Object fgEmptyDebugContextElement = new Object();
- private BreadcrumbViewer fViewer;
- private boolean fRefreshBreadcrumb = false;
-
- private class BreadcrumbContextProvider extends AbstractDebugContextProvider implements IDebugContextListener, ISelectionChangedListener {
-
- private ISelection fBreadcrumbSelection = null;
-
- BreadcrumbContextProvider() {
- super(fView);
- fViewer.addSelectionChangedListener(this);
- fBreadcrumbSelection = fViewer.getSelection();
- fTreeViewerContextProvider.addDebugContextListener(this);
- }
-
- public ISelection getActiveContext() {
- if (fBreadcrumbSelection != null && !fBreadcrumbSelection.isEmpty()) {
- return fBreadcrumbSelection;
- } else {
- ISelection treeViewerSelection = fTreeViewerContextProvider.getActiveContext();
- return treeViewerSelection != null ? treeViewerSelection : StructuredSelection.EMPTY;
- }
- }
-
- void dispose() {
- fViewer.removeSelectionChangedListener(this);
- fTreeViewerContextProvider.removeDebugContextListener(this);
- }
-
- public void debugContextChanged(DebugContextEvent event) {
- fire(new DebugContextEvent(this, getActiveContext(), event.getFlags()));
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection oldContext = getActiveContext();
- fBreadcrumbSelection = event.getSelection();
- if (!getActiveContext().equals(oldContext)) {
- fire(new DebugContextEvent(this, getActiveContext(), DebugContextEvent.ACTIVATED));
- }
- }
- }
-
- private BreadcrumbContextProvider fBreadcrumbContextProvider;
-
- public LaunchViewBreadcrumb(LaunchView view, TreeModelViewer treeViewer, IDebugContextProvider contextProvider) {
- fView = view;
- fTreeViewer = treeViewer;
- fTreeViewer.addLabelUpdateListener(this);
- fTreeViewerContextProvider = contextProvider;
- fBreadcrumbInput = new Input( getPathForSelection(fTreeViewerContextProvider.getActiveContext()) );
- fTreeViewerContextProvider.addDebugContextListener(this);
- }
-
- protected void activateBreadcrumb() {
- }
-
- protected void deactivateBreadcrumb() {
- if (fViewer.isDropDownOpen()) {
- Shell shell = fViewer.getDropDownShell();
- if (shell != null && !shell.isDisposed()) {
- shell.close();
- }
- }
- }
-
- protected BreadcrumbViewer createViewer(Composite parent) {
- fViewer = new BreadcrumbViewer(parent, SWT.NONE) {
- protected Control createDropDown(Composite dropDownParent, IBreadcrumbDropDownSite site, TreePath path) {
- return createDropDownControl(dropDownParent, site, path);
- }
- };
-
- // Force the layout of the breadcrumb viewer so that we may calcualte
- // its proper size.
- parent.pack(true);
-
- fViewer.setContentProvider(new ContentProvider());
- fViewer.setLabelProvider(new LabelProvider());
-
- createMenuManager();
-
- fViewer.setInput(getCurrentInput());
-
- fBreadcrumbContextProvider = new BreadcrumbContextProvider();
-
- return fViewer;
- }
-
- protected void createMenuManager() {
- MenuManager menuMgr = new MenuManager("#PopUp"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fView.fillContextMenu(mgr);
- }
- });
- final Menu menu= menuMgr.createContextMenu(fViewer.getControl());
-
- // register the context menu such that other plug-ins may contribute to it
- if (fView.getSite() != null) {
- fView.getSite().registerContextMenu(menuMgr, fViewer);
- }
- fView.addContextMenuManager(menuMgr);
-
- fViewer.addMenuDetectListener(new MenuDetectListener() {
- public void menuDetected(MenuDetectEvent event) {
- menu.setLocation(event.x + 10, event.y + 10);
- menu.setVisible(true);
- while (!menu.isDisposed() && menu.isVisible()) {
- if (!menu.getDisplay().readAndDispatch())
- menu.getDisplay().sleep();
- }
- }
- });
- }
-
- protected Object getCurrentInput() {
- return fBreadcrumbInput;
- }
-
- protected boolean open(ISelection selection) {
- // Let the drop-down control implementation itself handle activating a new context.
- return false;
- }
-
- public void dispose() {
- fBreadcrumbContextProvider = null;
- fTreeViewerContextProvider.removeDebugContextListener(this);
- fTreeViewer.removeLabelUpdateListener(this);
- fBreadcrumbContextProvider.dispose();
- fViewer = null;
- super.dispose();
- }
-
- public void debugContextChanged(DebugContextEvent event) {
- if (fView.isBreadcrumbVisible()) {
- fBreadcrumbInput = new Input(getPathForSelection(event.getContext()));
- if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
- setInput(getCurrentInput());
-
- // If the context was activated, then clear the selection in breadcrumb
- // so that the activated context will become the active context for the
- // window.
- fViewer.setSelection(StructuredSelection.EMPTY);
- } else {
- refresh();
- }
- }
- }
-
- public void labelUpdateStarted(ILabelUpdate update) {
- }
-
- public void labelUpdateComplete(ILabelUpdate update) {
- if (fBreadcrumbInput != null && fBreadcrumbInput.fPath != null) {
- if (fBreadcrumbInput.fPath.startsWith(update.getElementPath(), null)) {
- synchronized (this) {
- fRefreshBreadcrumb = true;
- }
- }
- }
- }
-
- public void labelUpdatesBegin() {
- }
-
- public void labelUpdatesComplete() {
- boolean refresh = false;
- synchronized(this) {
- refresh = fRefreshBreadcrumb;
- fRefreshBreadcrumb = false;
- }
- if (fView.isBreadcrumbVisible() && refresh) {
- new UIJob(fViewer.getControl().getDisplay(), "refresh breadcrumb") { //$NON-NLS-1$
- { setSystem(true); }
- public IStatus runInUIThread(IProgressMonitor monitor) {
- refresh();
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- }
-
- IDebugContextProvider getContextProvider() {
- return fBreadcrumbContextProvider;
- }
-
- int getHeight() {
- return fViewer.getControl().getSize().y;
- }
-
- void clearSelection() {
- fViewer.setSelection(StructuredSelection.EMPTY);
- }
-
- private TreePath getPathForSelection(ISelection selection) {
- if (selection instanceof ITreeSelection && !selection.isEmpty()) {
- return ((ITreeSelection)selection).getPaths()[0];
- }
- return null;
- }
-
- public Control createDropDownControl(Composite parent, final IBreadcrumbDropDownSite site, TreePath paramPath) {
-
- TreeViewerDropDown dropDownTreeViewer = new TreeViewerDropDown() {
-
- SubTreeModelViewer fDropDownViewer;
-
- protected TreeViewer createTreeViewer(Composite composite, int style, final TreePath path) {
- fDropDownViewer = new SubTreeModelViewer(
- composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL | SWT.POP_UP,
- fTreeViewer.getPresentationContext());
-
- Object launchViewInput = fTreeViewer.getInput();
- fDropDownViewer.setInput(launchViewInput, path.getParentPath());
-
- ViewerFilter[] filters = fTreeViewer.getFilters();
- fDropDownViewer.setFilters(filters);
-
- ModelDelta stateDelta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
- fTreeViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- // If we do not want to expand the elements in the drop-down.
- // Prune the delta to only select the element in the
- // top-most list.
- if (!fView.getBreadcrumbDropDownAutoExpand()) {
- final ModelDelta prunedDelta = new ModelDelta(launchViewInput, IModelDelta.NO_CHANGE);
- stateDelta.accept(new IModelDeltaVisitor() {
- ModelDelta copy = prunedDelta;
- public boolean visit(IModelDelta delta, int depth) {
- TreePath deltaPath = getViewerTreePath(delta);
- if (deltaPath.getSegmentCount() == 0) {
- // skip copying the root element, only copy it's child count
- copy.setChildCount(delta.getChildCount());
- } else if (deltaPath.getSegmentCount() != 0 && path.startsWith(deltaPath, null) ) {
- // Build up the delta copy along the path of the drop-down element.
- copy = copy.addNode(
- delta.getElement(), delta.getIndex(), delta.getFlags(), delta.getChildCount());
- }
-
- // If the delta is for the drop-down element, set its select flag and stop traversing
- // the delta..
- if (deltaPath.equals(path)) {
- copy.setFlags(IModelDelta.SELECT | IModelDelta.REVEAL);
- return false;
- }
-
- // Continue traversing the delta.
- return true;
- }
-
- private TreePath getViewerTreePath(IModelDelta node) {
- ArrayList list = new ArrayList();
- IModelDelta parentDelta = node.getParentDelta();
- while (parentDelta != null) {
- list.add(0, node.getElement());
- node = parentDelta;
- parentDelta = node.getParentDelta();
- }
- return new TreePath(list.toArray());
- }
- });
- stateDelta = prunedDelta;
- }
-
- fDropDownViewer.updateViewer(stateDelta);
-
- fDropDownViewer.addLabelUpdateListener(new ILabelUpdateListener() {
- public void labelUpdateComplete(ILabelUpdate update) {}
- public void labelUpdatesBegin() {}
- public void labelUpdateStarted(ILabelUpdate update) {}
- public void labelUpdatesComplete() {
- new UIJob(fViewer.getControl().getDisplay(), "resize breadcrub dropdown") { //$NON-NLS-1$
- { setSystem(true); }
- public IStatus runInUIThread(IProgressMonitor monitor) {
- site.updateSize();
- return Status.OK_STATUS;
- }
- }.schedule();
- }
- });
-
- return fDropDownViewer;
- }
-
- protected void openElement(ISelection selection) {
- if (fTreeViewer.getControl().isDisposed()) {
- return;
- }
-
- if (selection != null && (selection instanceof ITreeSelection) && !selection.isEmpty()) {
- // Create the path to the root element of the drop-down viewer. Need to calcualte
- // indexes and counts for the delta in order for the selection from the drop-down
- // viewer to work properly.
- TreeModelContentProvider contentProvider = (TreeModelContentProvider)fTreeViewer.getContentProvider();
- TreePath path = TreePath.EMPTY;
- int count = fTreeViewer.getChildCount(path);
- count = contentProvider.viewToModelCount(path, count);
- ModelDelta rootDelta =
- new ModelDelta(fTreeViewer.getInput(), -1, IModelDelta.NO_CHANGE, count);
- TreePath rootPath = fDropDownViewer.getRootPath();
- ModelDelta delta = rootDelta;
- for (int i = 0; i < rootPath.getSegmentCount(); i++) {
- Object element = rootPath.getSegment(i);
- int index = fTreeViewer.findElementIndex(path, element);
- index = contentProvider.viewToModelIndex(path, index);
- path = path.createChildPath(element);
- count = fTreeViewer.getChildCount(path);
- count = contentProvider.viewToModelCount(path, count);
- delta = delta.addNode(rootPath.getSegment(i), index, IModelDelta.NO_CHANGE, count);
- }
-
- // Create the delta and save the drop-down viewer's state to it.
- fDropDownViewer.saveElementState(TreePath.EMPTY, delta, IModelDelta.EXPAND | IModelDelta.SELECT);
-
- // Add the IModelDelta.FORCE flag to override the current selection in view.
- rootDelta.accept(new IModelDeltaVisitor(){
- public boolean visit(IModelDelta paramDelta, int depth) {
- if ((paramDelta.getFlags() & IModelDelta.SELECT) != 0) {
- ((ModelDelta)paramDelta).setFlags(paramDelta.getFlags() | IModelDelta.FORCE);
- }
- return true;
- }
- });
-
- // If elements in the drop-down were auto-expanded, then collapse the drop-down's sub tree in the
- // full viewer. After the drop-down's full expansion state is saved out to the tree viewer, the
- // tree viewer will accurately reflect the state changes made by the user.
- if (fView.getBreadcrumbDropDownAutoExpand()) {
- fTreeViewer.collapseToLevel(rootPath, TreeViewer.ALL_LEVELS);
- }
-
- // Save the state of the drop-down out into the tree viewer.
- fTreeViewer.updateViewer(rootDelta);
- fViewer.setSelection(StructuredSelection.EMPTY);
- site.close();
- }
-
- super.openElement(selection);
- }
- };
-
-
- return dropDownTreeViewer.createDropDown(parent, site, paramPath);
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java
deleted file mode 100644
index 424c88b06..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewCopyToClipboardActionDelegate.java
+++ /dev/null
@@ -1,53 +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.internal.ui.views.launch;
-
-import org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.VirtualCopyToClipboardActionDelegate;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * @since 3.5
- */
-public class LaunchViewCopyToClipboardActionDelegate extends VirtualCopyToClipboardActionDelegate {
-
- protected TreeItem[] getPrunedSelection() {
- LaunchView view = (LaunchView)getView();
- if (view.isBreadcrumbVisible()) {
- ISelection selection = getSelection();
- if (selection instanceof ITreeSelection && getViewer() instanceof InternalTreeModelViewer) {
- if (selection.isEmpty()) {
- selection = new TreeSelection(TreePath.EMPTY);
- }
- return getSelectedItems((InternalTreeModelViewer)getViewer(), ((ITreeSelection)selection).getPaths()[0]);
- }
- return new TreeItem[0];
- } else {
- return super.getPrunedSelection();
- }
- }
-
- private TreeItem[] getSelectedItems(InternalTreeModelViewer viewer, TreePath path) {
- Widget item = viewer.findItem(path);
- if (item instanceof TreeItem) {
- return new TreeItem[] { (TreeItem)item };
- } else if (item instanceof Tree) {
- return ((Tree)item).getItems();
- }
- return new TreeItem[0];
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java
deleted file mode 100755
index a33ae0f8a..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.java
+++ /dev/null
@@ -1,39 +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
- * Pawel Piech - Wind River - adapted to use in Debug view
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.launch;
-
-import org.eclipse.osgi.util.NLS;
-
-public class LaunchViewMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.views.launch.LaunchViewMessages";//$NON-NLS-1$
-
- public static String Breadcrumb_NoActiveContext;
- public static String LaunchView_ViewModeMenu_label;
- public static String DebugViewModeAction_Auto_label;
- public static String DebugViewModeAction_Auto_tooltip;
- public static String DebugViewModeAction_Auto_description;
- public static String DebugViewModeAction_Full_label;
- public static String DebugViewModeAction_Full_tooltip;
- public static String DebugViewModeAction_Full_description;
- public static String DebugViewModeAction_Compact_label;
- public static String DebugViewModeAction_Compact_tooltip;
- public static String DebugViewModeAction_Compact_description;
-
- public static String BreadcrumbDropDownAutoExpandAction_label;
- public static String BreadcrumbDropDownAutoExpandAction_tooltip;
- public static String BreadcrumbDropDownAutoExpandAction_description;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, LaunchViewMessages.class);
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties
deleted file mode 100755
index 839f9b775..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchViewMessages.properties
+++ /dev/null
@@ -1,27 +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
-# Pawel Piech - Wind River - adapted to use in Debug view
-###############################################################################
-
-Breadcrumb_NoActiveContext=No Active Context
-LaunchView_ViewModeMenu_label=&Layout
-DebugViewModeAction_Auto_label=&Automatic
-DebugViewModeAction_Auto_tooltip=Automatic
-DebugViewModeAction_Auto_description=Switch layout automatically when the view is resized
-DebugViewModeAction_Full_label=&Tree
-DebugViewModeAction_Full_tooltip=Tree
-DebugViewModeAction_Full_description=Always show the tree viewer
-DebugViewModeAction_Compact_label=&Breadcrumb
-DebugViewModeAction_Compact_tooltip=Breadcrumb
-DebugViewModeAction_Compact_description=Always show the breadcrumb viewer
-
-BreadcrumbDropDownAutoExpandAction_label=Auto-&Expand Breadcrumb
-BreadcrumbDropDownAutoExpandAction_tooltip=Auto-Expand Breadcrumb
-BreadcrumbDropDownAutoExpandAction_description=In the breadcrumb drop-down, automatically expand elements to reveal full selection in view.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditor.java
deleted file mode 100644
index b25295f2e..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditor.java
+++ /dev/null
@@ -1,109 +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.debug.internal.ui.views.launch;
-
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.part.EditorPart;
-
-/**
- * Editor used when no source if found for a stack frame.
- *
- * @since 2.1
- */
-public class SourceNotFoundEditor extends EditorPart implements IReusableEditor {
-
- /**
- * Text widget used for this editor
- */
- private Text fText;
-
- /**
- * @see org.eclipse.ui.IEditorPart#doSave(IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor) {
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#doSaveAs()
- */
- public void doSaveAs() {
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#gotoMarker(IMarker)
- */
- public void gotoMarker(IMarker marker) {
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#init(IEditorSite, IEditorInput)
- */
- public void init(IEditorSite site, IEditorInput input) {
- setSite(site);
- setInput(input);
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#isDirty()
- */
- public boolean isDirty() {
- return false;
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- fText = new Text(parent,SWT.MULTI|SWT.READ_ONLY|SWT.WRAP);
- fText.setForeground(JFaceColors.getErrorText(fText.getDisplay()));
- fText.setBackground(fText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- if (getEditorInput() != null) {
- setInput(getEditorInput());
- }
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- if (fText != null) {
- fText.setFocus();
- }
- }
-
- /**
- * @see IReusableEditor#setInput(org.eclipse.ui.IEditorInput)
- */
- public void setInput(IEditorInput input) {
- super.setInput(input);
- setPartName(input.getName());
- if (fText != null) {
- fText.setText(input.getToolTipText());
- }
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java
deleted file mode 100644
index daa0f90ef..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/SourceNotFoundEditorInput.java
+++ /dev/null
@@ -1,95 +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.debug.internal.ui.views.launch;
-
-
-import com.ibm.icu.text.MessageFormat;
-
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * Editor input for a stack frame for which source could not be located.
- *
- * @since 2.1
- */
-public class SourceNotFoundEditorInput extends PlatformObject implements IEditorInput {
-
- /**
- * Associated stack frame
- */
- private IStackFrame fFrame;
-
- /**
- * Stack frame text (cached on creation)
- */
- private String fFrameText;
-
- /**
- * Constructs an editor input for the given stack frame,
- * to indicate source could not be found.
- *
- * @param frame stack frame
- */
- public SourceNotFoundEditorInput(IStackFrame frame) {
- fFrame = frame;
- IDebugModelPresentation pres = DebugUITools.newDebugModelPresentation(frame.getModelIdentifier());
- fFrameText = pres.getText(frame);
- pres.dispose();
- }
-
- /**
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- public boolean exists() {
- return false;
- }
-
- /**
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return DebugUITools.getDefaultImageDescriptor(fFrame);
- }
-
- /**
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- public String getName() {
- try {
- return fFrame.getName();
- } catch (DebugException e) {
- return DebugUIViewsMessages.SourceNotFoundEditorInput_Source_Not_Found_1;
- }
- }
-
- /**
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /**
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- public String getToolTipText() {
- return MessageFormat.format(DebugUIViewsMessages.SourceNotFoundEditorInput_Source_not_found_for__0__2,new String[] {fFrameText});
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/StandardDecoration.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/StandardDecoration.java
deleted file mode 100644
index ea33cf20d..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/StandardDecoration.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.debug.internal.ui.views.launch;
-
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.ui.IDebugEditorPresentation;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * A reminder to remove any annotations created by an editor presentation
- */
-public class StandardDecoration extends Decoration {
-
- private IThread fThread;
- private IEditorPart fEditor;
- private IDebugEditorPresentation fPresentation;
-
- public StandardDecoration(IDebugEditorPresentation presentation, IEditorPart editorPart, IThread thread) {
- fThread = thread;
- fEditor = editorPart;
- fPresentation = presentation;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.launch.Decoration#remove()
- */
- public void remove() {
- fPresentation.removeAnnotations(fEditor, fThread);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.launch.Decoration#getThread()
- */
- public IThread getThread() {
- return fThread;
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
deleted file mode 100644
index 6d2b6d689..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AbstractMemoryViewPane.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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
- * Wind River Systems - Ted Williams - [Memory View] Memory View: Workflow Enhancements (Bug 215432)
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.memory;
-
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.IMemoryBlockListener;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class AbstractMemoryViewPane implements IMemoryBlockListener, ISelectionListener, SelectionListener, IMemoryView, ISelectionChangedListener, IMemoryViewPane, IDebugContextListener, IDebugEventSetListener{
-
- public static final String BEGINNING_POPUP = "popUpBegin"; //$NON-NLS-1$
- protected static final StructuredSelection EMPTY = new StructuredSelection();
-
- protected Composite fViewPaneCanvas;
- protected StackLayout fStackLayout;
- protected ViewTabEnablementManager fViewTabEnablementManager;
- protected CTabFolder fEmptyTabFolder;
- protected Hashtable fTabFolderForDebugView = new Hashtable();
- protected boolean fVisible;
- protected Hashtable fRenderingInfoTable;
- protected IMemoryBlockRetrieval fKey; // store the key for current tab folder
- protected ViewPaneSelectionProvider fSelectionProvider;
- protected IViewPart fParent;
- protected String fPaneId;
- private Composite fCanvas;
- protected String fLabel;
-
- public AbstractMemoryViewPane(IViewPart parent)
- {
- super();
- fParent = parent;
- fSelectionProvider = new ViewPaneSelectionProvider();
- }
-
- /**
- * Create the content of the view pane
- * @param parent
- * @return the control of the view pane
- */
- public Control createViewPane(Composite parent, String paneId, String label)
- {
- fPaneId = paneId;
- fLabel = label;
- fCanvas = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.makeColumnsEqualWidth = false;
- layout.numColumns = 1;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.verticalAlignment = SWT.BEGINNING;
- data.horizontalAlignment = SWT.BEGINNING;
- fCanvas.setLayout(layout);
- fCanvas.setLayoutData(data);
-
- // memory view area
- Composite memoryViewAreaParent = fCanvas;
- Composite subCanvas = new Composite(memoryViewAreaParent, SWT.NONE);
- fViewPaneCanvas = subCanvas;
- fStackLayout = new StackLayout();
- GridData memoryAreaData = new GridData();
- memoryAreaData.grabExcessHorizontalSpace = true;
- memoryAreaData.grabExcessVerticalSpace = true;
- memoryAreaData.verticalAlignment = SWT.FILL;
- memoryAreaData.horizontalAlignment = SWT.FILL;
- fViewPaneCanvas.setLayout(fStackLayout);
- fViewPaneCanvas.setLayoutData(memoryAreaData);
-
- fViewTabEnablementManager = new ViewTabEnablementManager();
-
- fEmptyTabFolder = new CTabFolder(fViewPaneCanvas, SWT.NULL);
- setTabFolder(fEmptyTabFolder);
-
- addListeners();
-
- Object context = DebugUITools.getDebugContext();
- if (context != null)
- {
- IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
- if (retrieval != null)
- createFolder(retrieval);
- }
-
- fVisible = true;
-
- return fCanvas;
- }
-
- protected void addListeners()
- {
- MemoryViewUtil.getMemoryBlockManager().addListener(this);
- fParent.getViewSite().getPage().addSelectionListener(this);
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(this);
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
-
- protected void removeListeners()
- {
- MemoryViewUtil.getMemoryBlockManager().removeListener(this);
- fParent.getViewSite().getPage().removeSelectionListener(this);
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
-
- if (fStackLayout.topControl != null)
- {
- CTabFolder old = (CTabFolder)fStackLayout.topControl;
-
- if (!old.isDisposed())
- {
- old.removeSelectionListener(this);
- old.removeSelectionListener(fViewTabEnablementManager);
- }
- }
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
-
- protected void setTabFolder(CTabFolder folder)
- {
- if (fStackLayout.topControl != null)
- {
- CTabFolder old = (CTabFolder)fStackLayout.topControl;
-
- if (!old.isDisposed())
- {
- old.removeSelectionListener(this);
- old.removeSelectionListener(fViewTabEnablementManager);
- }
- }
-
- fStackLayout.topControl = folder;
-
- if (folder.getItemCount() > 0)
- {
- CTabItem selectedItem = folder.getSelection();
-
- if (selectedItem != null)
- {
- Object selected = getCurrentSelection();
- if (selected != null)
- {
- fSelectionProvider.setSelection(new StructuredSelection(selected));
- }
- else
- {
- fSelectionProvider.setSelection(AbstractMemoryViewPane.EMPTY);
- }
- }
- }
- else
- {
- fSelectionProvider.setSelection(AbstractMemoryViewPane.EMPTY);
- }
-
- folder.addSelectionListener(this);
- folder.addSelectionListener(fViewTabEnablementManager);
- }
-
-
- private void createFolder(IMemoryBlockRetrieval memRetrieval)
- {
- //if we've got a tabfolder to go with the IMemoryBlockRetrieval, display it
- Integer key = MemoryViewUtil.getHashCode(memRetrieval);
- if (fTabFolderForDebugView.containsKey(key)) {
- if (fStackLayout.topControl != (CTabFolder)fTabFolderForDebugView.get(key)) {
- setTabFolder((CTabFolder)fTabFolderForDebugView.get(key));
- fViewPaneCanvas.layout();
- }
- } else { //otherwise, add a new one
- fTabFolderForDebugView.put(key, new CTabFolder(fViewPaneCanvas, SWT.NULL));
- setTabFolder((CTabFolder)fTabFolderForDebugView.get(key));
- fViewPaneCanvas.layout();
- }
- }
-
- public IMemoryViewTab getTopMemoryTab() {
-
- if (fStackLayout.topControl instanceof CTabFolder)
- {
- CTabFolder folder = (CTabFolder)fStackLayout.topControl;
- if (!folder.isDisposed())
- {
- int index = folder.getSelectionIndex();
- if (index >= 0) {
- CTabItem tab = folder.getItem(index);
- return (IMemoryViewTab)tab.getData();
- }
- }
- }
- return null;
- }
-
- protected void disposeTab(CTabItem tabItem)
- {
- if (tabItem == null)
- return;
-
- // dispose the tab item in case the view tab has not
- // cleaned up the tab item
- if (!tabItem.isDisposed())
- {
- tabItem.dispose();
- }
- }
-
- protected void emptyFolder()
- {
- setTabFolder(fEmptyTabFolder);
- if (!fViewPaneCanvas.isDisposed()) {
- fViewPaneCanvas.layout();
- }
- }
-
- public void addSelectionListener(ISelectionChangedListener listener)
- {
- if (fSelectionProvider == null)
- fSelectionProvider = new ViewPaneSelectionProvider();
-
- fSelectionProvider.addSelectionChangedListener(listener);
- }
-
- public void removeSelctionListener(ISelectionChangedListener listener)
- {
- if (fSelectionProvider == null)
- return;
-
- fSelectionProvider.removeSelectionChangedListener(listener);
- }
-
- public ISelectionProvider getSelectionProvider()
- {
- return fSelectionProvider;
- }
-
- public void handleDebugEvents(DebugEvent[] events)
- {
- for (int i = 0; i < events.length; i++)
- {
- Object source = events[i].getSource();
- if (events[i].getKind() == DebugEvent.TERMINATE && source instanceof IMemoryBlockRetrieval)
- {
- //When a memory block retrieval terminates, it and its
- //tab folders should be removed from our map.
- IMemoryBlockRetrieval ret = (IMemoryBlockRetrieval)source;
- if (ret != null)
- {
- final Integer key = MemoryViewUtil.getHashCode(ret);
- final Object folder = fTabFolderForDebugView.get(key);
- if (folder != null && folder != fEmptyTabFolder && (!((CTabFolder)folder).isDisposed()))
- {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- //remove the tab folder , and all contained tab items
- disposeOfFolder((CTabFolder) folder);
- if (fTabFolderForDebugView != null)
- fTabFolderForDebugView.remove(key);
- }
- });
- }
- }
- }
- }
-
- }
-
-
-
- public void dispose()
- {
- removeListeners();
-
- // dispose empty folders
- fEmptyTabFolder.dispose();
-
- // dispose all other folders
- try {
-
- if (fTabFolderForDebugView != null) {
- Enumeration enumeration = fTabFolderForDebugView.elements();
-
- while (enumeration.hasMoreElements())
- {
- CTabFolder tabFolder = (CTabFolder)enumeration.nextElement();
- disposeOfFolder(tabFolder);
- }
-
- // set to null so that clean up is only done once
- fTabFolderForDebugView.clear();
- fTabFolderForDebugView = null;
- }
- } catch (Exception e) {
-
- DebugUIPlugin.logErrorMessage("Exception occurred when the Memory View is disposed."); //$NON-NLS-1$
- }
- }
-
- /**
- * Helper method to dispose of a tab folder,
- * and of any tab items it contains.
- * Must be called from the UI thread.
- * */
- private void disposeOfFolder(CTabFolder tabFolder)
- {
- if (!tabFolder.isDisposed())
- {
-
- // if tab folder is not empty, dipose view tabs
- CTabItem[] tabs = tabFolder.getItems();
-
- for (int i=0; i<tabs.length; i++)
- {
- disposeTab(tabs[i]);
- }
-
- tabFolder.dispose();
- }
- }
-
- public void setVisible(boolean visible)
- {
- fVisible = visible;
-
- IMemoryViewTab currentTab = getTopMemoryTab();
- if (currentTab != null)
- currentTab.setEnabled(visible);
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- selectionChanged(fParent,selection);
-
- fSelectionProvider.setSelection(selection);
- }
-
- /**
- * @return the unique identifier of the view pane
- */
- public String getPaneId()
- {
- return fPaneId;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#getControl()
- */
- public Control getControl() {
- return fCanvas;
- }
-
- public boolean isVisible()
- {
- return fVisible;
- }
-
- public String getLabel()
- {
- return fLabel;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.memory.IMemoryBlockListener#MemoryBlockAdded(org.eclipse.debug.core.model.IMemoryBlock)
- */
- abstract public void memoryBlocksAdded(IMemoryBlock[] memoryBlocks);
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.memory.IMemoryBlockListener#MemoryBlockRemoved(org.eclipse.debug.core.model.IMemoryBlock)
- */
- abstract public void memoryBlocksRemoved(final IMemoryBlock[] memoryBlocks);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- abstract public void selectionChanged(IWorkbenchPart part, ISelection selection);
-
- /**
- * @return current selection from the view pane
- */
- abstract public Object getCurrentSelection();
-
- /**
- * retore the view pane based on current selection from the debug view
- * and the memory blocks and renderings currently exist
- */
- abstract public void restoreViewPane();
-
- /**
- * @return actions to be contributed to the view pane's toolbar
- */
- abstract public IAction[] getActions();
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
deleted file mode 100644
index c0188450b..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryBlockAction.java
+++ /dev/null
@@ -1,430 +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.debug.internal.ui.views.memory;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.model.IDebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IMemoryBlockExtension;
-import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
-import org.eclipse.debug.core.model.IMemoryBlockRetrievalExtension;
-import org.eclipse.debug.core.model.ITerminate;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.DebugUIMessages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.debug.ui.memory.IMemoryRendering;
-import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
-import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
-import org.eclipse.debug.ui.memory.IMemoryRenderingType;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * Action for adding memory block.
- *
- * @since 3.0
- */
-public class AddMemoryBlockAction extends Action implements IDebugContextListener, IDebugEventSetListener{
-
- protected IAdaptable fCurrentContext = null;
- protected IMemoryBlock fLastMemoryBlock;
- private boolean fAddDefaultRenderings = true;
- protected IMemoryRenderingSite fSite;
-
- public AddMemoryBlockAction(IMemoryRenderingSite site)
- {
- initialize(site);
- }
-
- /**
- * @param addDefaultRenderings - specify if the action should add
- * default renderings for the new memory block when it is run
- */
- AddMemoryBlockAction(IMemoryRenderingSite site, boolean addDefaultRenderings)
- {
- initialize(site);
- fAddDefaultRenderings = addDefaultRenderings;
- }
-
- /**
- *
- */
- private void initialize(IMemoryRenderingSite site) {
- setText(DebugUIMessages.AddMemoryBlockAction_title);
- doInitialization(site);
- }
-
-
- public AddMemoryBlockAction(String text, int style, IMemoryRenderingSite site)
- {
- super(text, style);
- doInitialization(site);
- }
-
- /**
- *
- */
- private void doInitialization(IMemoryRenderingSite site) {
- fSite = site;
- setToolTipText(DebugUIMessages.AddMemoryBlockAction_tooltip);
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_MONITOR_EXPRESSION));
- setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_MONITOR_EXPRESSION));
- setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_MONITOR_EXPRESSION));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".addMemoryMonitorAction_context"); //$NON-NLS-1$
-
- // listen for context changed
- DebugUITools.getDebugContextManager().getContextService(site.getSite().getWorkbenchWindow()).addDebugContextListener(this);
-
- // get current context
- fCurrentContext = DebugUITools.getDebugContext();
-
- // set up enablement based on current selection
- updateAction(fCurrentContext);
-
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- boolean exit = false;
- String prefillExp = null;
- String prefillLength = null;
- while (!exit)
- {
- exit = true;
-
- Object elem = DebugUITools.getDebugContext();
-
- IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(elem);
-
- if (retrieval == null)
- return;
-
- Shell shell= DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
- // create dialog to ask for expression/address to block
- MonitorMemoryBlockDialog dialog = new MonitorMemoryBlockDialog(shell, retrieval, prefillExp, prefillLength);
- dialog.open();
- int returnCode = dialog.getReturnCode();
- if (returnCode == Window.CANCEL)
- {
- return;
- }
- // get expression entered in dialog
- String input = dialog.getExpression();
-
- // remember expression and length
- prefillExp = input;
- prefillLength = dialog.getLength();
-
- ArrayList expressions = new ArrayList();
-
- if (input.length() == 0)
- {
- expressions.add(IInternalDebugCoreConstants.EMPTY_STRING);
- }
- else
- {
- StringTokenizer tokenizer = new StringTokenizer(input, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens())
- {
- expressions.add(tokenizer.nextToken());
- }
- }
- final String[] expressionsArray = (String[])expressions.toArray(new String[expressions.size()]);
- exit = true;
-
- final boolean finalExit = exit;
- final Object finalElement = elem;
- final IMemoryBlockRetrieval finalRetrieval = retrieval;
- final MonitorMemoryBlockDialog finalDialog = dialog;
- Job job = new Job("Add Memory Block") { //$NON-NLS-1$
- protected IStatus run(IProgressMonitor monitor) {
- addMemoryBlocks(finalExit, finalElement, finalRetrieval, finalDialog, expressionsArray);
- return Status.OK_STATUS;
- }};
- job.setSystem(true);
- job.schedule();
- }
- }
-
- /**
- * @param exit
- * @param elem
- * @param standardMemRetrieval
- * @param dialog
- * @param expressionsArray
- * @return
- */
- private boolean addMemoryBlocks(boolean exit, Object elem, IMemoryBlockRetrieval standardMemRetrieval, MonitorMemoryBlockDialog dialog, final String[] expressionsArray) {
- for (int i=0; i<expressionsArray.length; i++)
- {
- String expression = expressionsArray[i].trim();
- try {
- if (standardMemRetrieval instanceof IMemoryBlockRetrievalExtension)
- {
- // if the debug session supports IMemoryBlockExtensionRetrieval
- IMemoryBlockRetrievalExtension memRetrieval = (IMemoryBlockRetrievalExtension)standardMemRetrieval;
-
- // get extended memory block with the expression entered
- IMemoryBlockExtension memBlock = memRetrieval.getExtendedMemoryBlock(expression, elem);
-
- // add block to memory block manager
- if (memBlock != null)
- {
- fLastMemoryBlock = memBlock;
-
- IMemoryBlock[] memArray = new IMemoryBlock[]{memBlock};
-
- MemoryViewUtil.getMemoryBlockManager().addMemoryBlocks(memArray);
- if (fAddDefaultRenderings)
- addDefaultRenderings(memBlock);
- }
- else
- {
- // open error if it failed to retrieve a memory block
- MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_noMemoryBlock, null);
- exit = false;
- }
- }
- else
- {
- // if the debug session does not support IMemoryBlockExtensionRetrieval
- expression = expression.toUpperCase();
- String hexPrefix = "0X"; //$NON-NLS-1$
- if (expression.startsWith(hexPrefix))
- {
- expression = expression.substring(hexPrefix.length());
- }
-
- // convert the expression to an address
- BigInteger address = new BigInteger(expression, 16);
-
- long longAddress = address.longValue();
-
- // get the length of memory to block
- String strLength = dialog.getLength();
-
- long length = Long.parseLong(strLength);
-
- // must monitor at least one line
- if (length <= 0)
- {
- String message = DebugUIMessages.AddMemoryBlockAction_failed + "\n" + DebugUIMessages.AddMemoryBlockAction_input_invalid; //$NON-NLS-1$
- MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, message, null);
- exit = false;
- continue;
- }
-
- // get standard memory block
- IMemoryBlock memBlock = standardMemRetrieval.getMemoryBlock(longAddress, length);
-
- // make sure the memory block returned is not an instance of IMemoryBlockExtension
- if (memBlock instanceof IMemoryBlockExtension)
- {
- Status status = new Status(IStatus.WARNING, DebugUIPlugin.getUniqueIdentifier(), 0,
- "IMemoryBlockRetrieval returns IMemoryBlockExtension. This may result in unexpected behavior.", null); //$NON-NLS-1$
- DebugUIPlugin.log(status);
- }
-
- if (memBlock != null)
- {
- // add memory block to memory block manager
- fLastMemoryBlock = memBlock;
- IMemoryBlock[] memArray = new IMemoryBlock[]{memBlock};
-
- MemoryViewUtil.getMemoryBlockManager().addMemoryBlocks(memArray);
- if (fAddDefaultRenderings)
- addDefaultRenderings(memBlock);
- }
- else
- {
- // otherwise open up an error doalog
- MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_noMemoryBlock, null);
- exit = false;
- }
- }
- } catch (DebugException e1) {
- MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, DebugUIMessages.AddMemoryBlockAction_failed, e1);
- exit = false;
- }
- catch(NumberFormatException e2)
- {
- String message = DebugUIMessages.AddMemoryBlockAction_failed + "\n" + DebugUIMessages.AddMemoryBlockAction_input_invalid; //$NON-NLS-1$
- MemoryViewUtil.openError(DebugUIMessages.AddMemoryBlockAction_title, message, null);
- exit = false;
- }
- }
- return exit;
- }
-
-
- /* (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++)
- handleDebugEvent(events[i]);
- }
-
- private void handleDebugEvent(DebugEvent event)
- {
- // update action enablement based on debug event
- Object src = event.getSource();
- IDebugTarget srcDT = null;
- IDebugTarget selectionDT = null;
-
- if (event.getKind() == DebugEvent.TERMINATE)
- {
- if (src instanceof ITerminate && src instanceof IDebugElement)
- {
- srcDT = ((IDebugElement)src).getDebugTarget();
- }
-
- if (fCurrentContext instanceof IDebugElement)
- {
- selectionDT = ((IDebugElement)fCurrentContext).getDebugTarget();
- }
-
- // disable action if the debug target is terminated.
- if (srcDT == selectionDT)
- {
- setEnabled(false);
- }
- }
- // handle change event from memory block retrieval object
- // to allow non-standard debug models to update the action
- else if (event.getKind() == DebugEvent.CHANGE && event.getDetail() == DebugEvent.STATE)
- {
- Object evtSrc = event.getSource();
- if (evtSrc == MemoryViewUtil.getMemoryBlockRetrieval(fCurrentContext))
- updateAction(fCurrentContext);
- }
- }
-
- /**
- * Return the last memory block added to memory block manager via this action.
- * @return Returns the fLastMemoryBlock.
- */
- public IMemoryBlock getLastMemoryBlock() {
- return fLastMemoryBlock;
- }
-
- protected void dispose() {
-
- // remove listeners
- DebugPlugin.getDefault().removeDebugEventListener(this);
- DebugUITools.getDebugContextManager().getContextService(fSite.getSite().getWorkbenchWindow()).removeDebugContextListener(this);
- }
-
- private void addDefaultRenderings(IMemoryBlock memoryBlock)
- {
- IMemoryRenderingType primaryType = DebugUITools.getMemoryRenderingManager().getPrimaryRenderingType(memoryBlock);
- IMemoryRenderingType renderingTypes[] = DebugUITools.getMemoryRenderingManager().getDefaultRenderingTypes(memoryBlock);
-
- // create primary rendering
- try {
- if (primaryType != null)
- {
- createRenderingInContainer(memoryBlock, primaryType, IDebugUIConstants.ID_RENDERING_VIEW_PANE_1);
- }
- else if (renderingTypes.length > 0)
- {
- primaryType = renderingTypes[0];
- createRenderingInContainer(memoryBlock, renderingTypes[0], IDebugUIConstants.ID_RENDERING_VIEW_PANE_1);
- }
- } catch (CoreException e1) {
- DebugUIPlugin.log(e1);
- }
-
- for (int i = 0; i<renderingTypes.length; i++)
- {
- try {
- boolean create = true;
- if (primaryType != null)
- {
- if (primaryType.getId().equals(renderingTypes[i].getId()))
- create = false;
- }
- if (create)
- createRenderingInContainer(memoryBlock, renderingTypes[i], IDebugUIConstants.ID_RENDERING_VIEW_PANE_2);
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- }
-
- /**
- * @param memoryBlock
- * @param primaryType
- * @throws CoreException
- */
- private void createRenderingInContainer(IMemoryBlock memoryBlock, IMemoryRenderingType primaryType, String paneId) throws CoreException {
- IMemoryRendering rendering = primaryType.createRendering();
- IMemoryRenderingContainer container = fSite.getContainer(paneId);
- rendering.init(container, memoryBlock);
- container.addMemoryRendering(rendering);
- }
-
- protected MemoryView getMemoryView()
- {
- if (fSite instanceof MemoryView)
- return (MemoryView)fSite;
- return null;
- }
-
- protected void updateAction(final Object debugContext)
- {
- Job job = new Job("Update Add Memory Block Action") { //$NON-NLS-1$
- protected IStatus run(IProgressMonitor monitor) {
- setEnabled(MemoryViewUtil.isValidContext(debugContext));
- return Status.OK_STATUS;
- }};
- job.setSystem(true);
- job.schedule();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
- */
- public void debugContextChanged(DebugContextEvent event) {
- if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
- IAdaptable context = DebugUITools.getDebugContext();
- updateAction(context);
- fCurrentContext = context;
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingAction.java
deleted file mode 100644
index ab9fe9825..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingAction.java
+++ /dev/null
@@ -1,44 +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
- * WindRiver - Bug 192028 [Memory View] Memory view does not
- * display memory blocks that do not reference IDebugTarget
- * Ted Williams - WindRiver - Bug 215432 - [Memory View] Memory View: Workflow Enhancements
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.memory;
-
-import org.eclipse.debug.internal.ui.DebugUIMessages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Toolbar "Add Memory Rendering Action" from Memory Rendering Pane
- */
-public class AddMemoryRenderingAction extends AddMemoryBlockAction {
-
- private IMemoryRenderingContainer fContainer;
-
- public AddMemoryRenderingAction(IMemoryRenderingContainer container)
- {
- super(DebugUIMessages.AddMemoryRenderingAction_Add_renderings, AS_PUSH_BUTTON, container.getMemoryRenderingSite());
- setToolTipText(DebugUIMessages.AddMemoryRenderingAction_Add_renderings);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, DebugUIPlugin.getUniqueIdentifier() + ".AddRenderingContextAction_context"); //$NON-NLS-1$
- fContainer = container;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- if (fContainer instanceof RenderingViewPane)
- ((RenderingViewPane) fContainer).showCreateRenderingTab();
- }
-}
-
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java
deleted file mode 100644
index 77393eb3f..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingContextAction.java
+++ /dev/null
@@ -1,89 +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.debug.internal.ui.views.memory;
-
-import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
-import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-
-public class AddMemoryRenderingContextAction implements IViewActionDelegate {
-
- private IMemoryRenderingSite fMemoryView;
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {
-
- if (view instanceof IMemoryRenderingSite)
- {
- fMemoryView = (IMemoryRenderingSite)view;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
-
- if (fMemoryView == null)
- return;
-
- IMemoryRenderingContainer container = getRenderingContainer(action);
- if (container != null)
- {
- AddMemoryRenderingAction addAction = new AddMemoryRenderingAction(container);
- addAction.run();
- addAction.dispose();
- }
- }
-
- /**
- * @param action
- * @return
- */
- private IMemoryRenderingContainer getRenderingContainer(IAction action) {
- IMemoryRenderingContainer[] viewPanes = fMemoryView.getMemoryRenderingContainers();
- String actionId = action.getId();
- IMemoryRenderingContainer selectedPane = null;
-
- for (int i=0; i<viewPanes.length; i++)
- {
- if (actionId.indexOf(viewPanes[i].getId()) != -1)
- {
- selectedPane = viewPanes[i];
- break;
- }
- }
-
- return selectedPane;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- IMemoryRenderingContainer container = getRenderingContainer(action);
- if (container instanceof RenderingViewPane)
- {
- if (!((RenderingViewPane)container).canAddRendering())
- action.setEnabled(false);
- else
- action.setEnabled(true);
- }
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
deleted file mode 100644
index 3eef011ab..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/AddMemoryRenderingDialog.java
+++ /dev/null
@@ -1,586 +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
- * WindRiver - Bug 192028 [Memory View] Memory view does not
- * display memory blocks that do not reference IDebugTarget
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.memory;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IMemoryBlockListener;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IMemoryBlockExtension;
-import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
-import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
-import org.eclipse.debug.internal.ui.DebugUIMessages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.memory.IMemoryRendering;
-import org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener;
-import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
-import org.eclipse.debug.ui.memory.IMemoryRenderingType;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * Dialog allowing user to add a memory rendering
- */
-public class AddMemoryRenderingDialog extends SelectionDialog {
-
- private IMemoryBlock[] fMemoryBlocks;
- private Combo memoryBlock;
- private ListViewer fViewer;
- private IMemoryBlock fSelectedMemoryBlock;
- private Button addNew;
-
- private ISelectionChangedListener fSelectionChangedListener;
- private SelectionListener fSelectionListener;
- private SelectionAdapter fAddNewSelectionAdapter;
- private IMemoryRenderingSite fSite;
-
- private IMemoryBlockListener fMemoryBlockListener = new IMemoryBlockListener(){
-
- public void memoryBlocksAdded(final IMemoryBlock[] memory)
- {
- if (memory.length > 0)
- {
- IMemoryBlock currentBlock = getMemoryBlockToSelect(memory[0]);
- if (currentBlock == null)
- {
- addNew();
- }
- else
- {
- populateDialog(currentBlock);
- }
- }
- }
- public void memoryBlocksRemoved(IMemoryBlock[] memory)
- {
- }
- };
-
- private IMemoryRenderingBindingsListener fBindingListener = new IMemoryRenderingBindingsListener()
- {
- public void memoryRenderingBindingsChanged() {
- UIJob job = new UIJob("refresh"){ //$NON-NLS-1$
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- fViewer.refresh();
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.schedule();
- }
-
- };
-
- class MemoryRenderingLabelProvider implements ILabelProvider
- {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- if (element instanceof IMemoryRenderingType)
- {
- String label = ((IMemoryRenderingType)element).getLabel();
- return label;
- }
- return element.toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
- }
-
- class MemoryRenderingContentProvider implements IStructuredContentProvider
- {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- IMemoryRenderingType[] renderings = DebugUITools.getMemoryRenderingManager().getRenderingTypes((IMemoryBlock)inputElement);
- return renderings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#close()
- */
- public boolean close() {
-
- fViewer.removeSelectionChangedListener(fSelectionChangedListener);
- memoryBlock.removeSelectionListener(fSelectionListener);
- addNew.removeSelectionListener(fAddNewSelectionAdapter);
- DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fMemoryBlockListener);
- DebugUITools.getMemoryRenderingManager().removeListener(fBindingListener);
-
- return super.close();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
- protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
- */
- public Object[] getResult() {
-
- Object[] results = super.getResult();
-
- if (results != null)
- {
- Object[] renderings = ((IStructuredSelection)results[0]).toArray();
- return renderings;
- }
- return new Object[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
- */
- protected void cancelPressed() {
-
- setResult(null);
-
- super.cancelPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
-
- ISelection select = fViewer.getSelection();
- setSelectionResult(new Object[]{select});
-
- super.okPressed();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, DebugUIPlugin.getUniqueIdentifier() + ".AddMemoryRenderingDialog_context"); //$NON-NLS-1$
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout compositeLayout = new GridLayout();
- compositeLayout.numColumns = 3;
- compositeLayout.makeColumnsEqualWidth = true;
- composite.setLayout(compositeLayout);
-
- GridData comositeSpec= new GridData();
- comositeSpec.grabExcessVerticalSpace= true;
- comositeSpec.grabExcessHorizontalSpace= true;
- comositeSpec.horizontalAlignment= GridData.FILL;
- comositeSpec.verticalAlignment= GridData.CENTER;
- composite.setLayoutData(comositeSpec);
-
- Label textLabel = new Label(composite, SWT.NONE);
- textLabel.setText(DebugUIMessages.AddMemoryRenderingDialog_Memory_Monitor);
- GridData textLayout = new GridData();
- textLayout.verticalAlignment=GridData.CENTER;
- textLayout.horizontalAlignment=GridData.BEGINNING;
- textLabel.setLayoutData(textLayout);
-
- memoryBlock = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
- GridData spec= new GridData(GridData.FILL_HORIZONTAL);
- spec.grabExcessVerticalSpace= false;
- spec.grabExcessHorizontalSpace= false;
- spec.horizontalAlignment= GridData.FILL;
- spec.verticalAlignment= GridData.FILL;
- spec.horizontalSpan = 4;
- memoryBlock.setLayoutData(spec);
-
- Label filler = new Label(composite, SWT.NONE);
- filler.setText(" "); //$NON-NLS-1$
- GridData fillerData = new GridData(GridData.FILL_HORIZONTAL);
- fillerData.horizontalSpan = 2;
- filler.setLayoutData(fillerData);
-
- addNew = new Button(composite, SWT.NONE);
- addNew.setText(DebugUIMessages.AddMemoryRenderingDialog_Add_New);
- GridData specButton= new GridData();
- specButton.horizontalAlignment= GridData.END;
- specButton.verticalAlignment= GridData.CENTER;
- addNew.setLayoutData(specButton);
-
- fAddNewSelectionAdapter = new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- RetargetAddMemoryBlockAction action = new RetargetAddMemoryBlockAction(fSite, false);
- action.run();
- action.dispose();
- }};
-
- addNew.addSelectionListener(fAddNewSelectionAdapter);
-
- fSelectionListener = new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
-
- int idx = memoryBlock.getSelectionIndex();
-
- // avoid null pointer exception
- if (fMemoryBlocks == null)
- return;
-
- fSelectedMemoryBlock = fMemoryBlocks[idx];
-
- fViewer.setInput(fSelectedMemoryBlock);
-
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }};
-
- memoryBlock.addSelectionListener(fSelectionListener);
-
- Label renderingLabel = new Label(composite, SWT.NONE);
- renderingLabel.setText(DebugUIMessages.AddMemoryRenderingDialog_Memory_renderings);
- GridData renderingLayout = new GridData();
- renderingLayout.horizontalAlignment = GridData.BEGINNING;
- renderingLayout.verticalAlignment = GridData.CENTER;
- renderingLayout.horizontalSpan = 3;
- renderingLabel.setLayoutData(renderingLayout);
-
- fViewer = new ListViewer(composite);
- fViewer.setContentProvider(new MemoryRenderingContentProvider());
- fViewer.setLabelProvider(new MemoryRenderingLabelProvider());
-
- GridData listLayout = new GridData(GridData.FILL_BOTH);
- listLayout.horizontalSpan = 3;
- listLayout.heightHint =140;
- fViewer.getControl().setLayoutData(listLayout);
-
- fViewer.addDoubleClickListener(new IDoubleClickListener (){
-
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }});
-
- IMemoryBlock currentBlock = getMemoryBlockToSelect(null);
- if (currentBlock == null)
- {
- addNew();
- }
- else
- {
- populateDialog(currentBlock);
- }
-
-
- fSelectionChangedListener = new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = fViewer.getSelection();
-
- if (selection.isEmpty())
- {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- }
- else
- {
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- }
- }};
-
- fViewer.addSelectionChangedListener(fSelectionChangedListener);
-
- DebugPlugin.getDefault().getMemoryBlockManager().addListener(fMemoryBlockListener);
- DebugUITools.getMemoryRenderingManager().addListener(fBindingListener);
-
- return composite;
- }
-
- public AddMemoryRenderingDialog(Shell parent, IMemoryRenderingSite site) {
- super(parent);
- super.setTitle(DebugUIMessages.AddMemoryRenderingDialog_Add_memory_rendering);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- fSite = site;
- }
-
-
- private void doPopulateDialog(Combo combo, ListViewer viewer, String[] labels, int selectionIdx, IMemoryBlock currentBlock)
- {
- // clean up
- combo.removeAll();
-
- for (int i=0; i<labels.length; i++)
- {
- combo.add(labels[i]);
- }
-
- combo.select(selectionIdx);
- fSelectedMemoryBlock = currentBlock;
-
- viewer.setInput(currentBlock);
- }
-
- private IMemoryBlock getMemoryBlockToSelect(IMemoryBlock lastAdded)
- {
- IMemoryBlock currentBlock = null;
-
- if (lastAdded != null)
- currentBlock = lastAdded;
- else
- {
- // take Memory View's selection if possible
- ISelectionProvider selectionProvider = fSite.getSite().getSelectionProvider();
- ISelection selection = null;
-
- if (selectionProvider != null)
- selection = selectionProvider.getSelection();
- else // otherwise, take selection from selection service
- selection = DebugUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(IDebugUIConstants.ID_MEMORY_VIEW);
-
- IMemoryBlock element = getMemoryBlock(selection);
-
- if (element == null)
- {
- IAdaptable context = DebugUITools.getDebugContext();
-
- if (context != null)
- {
- IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
-
- if (retrieval == null)
- return currentBlock;
-
- IMemoryBlock[] blocks = new IMemoryBlock[0];
-
- if (retrieval != null)
- blocks = MemoryViewUtil.getMemoryBlockManager().getMemoryBlocks(retrieval);
-
- if (blocks.length > 0)
- currentBlock = blocks[0];
- }
- }
- else
- {
- currentBlock = element;
- }
- }
- return currentBlock;
- }
-
- private String[] getLabels(IMemoryBlock[] memoryBlocks)
- {
- String[] labels = new String[memoryBlocks.length];
- for (int i=0; i<memoryBlocks.length; i++)
- {
- String text = IInternalDebugCoreConstants.EMPTY_STRING;
- if (memoryBlocks[i] instanceof IMemoryBlockExtension)
- {
- try {
- text = ((IMemoryBlockExtension)memoryBlocks[i]).getExpression();
-
- if (text == null)
- text = DebugUIMessages.AddMemoryRenderingDialog_Unknown;
-
- if (((IMemoryBlockExtension)memoryBlocks[i]).getBigBaseAddress() != null)
- {
- text += " : 0x"; //$NON-NLS-1$
- text += ((IMemoryBlockExtension)memoryBlocks[i]).getBigBaseAddress().toString(16);
- }
- } catch (DebugException e) {
- long address = memoryBlocks[i].getStartAddress();
- text = Long.toHexString(address);
- }
- }
- else
- {
- long address = memoryBlocks[i].getStartAddress();
- text = Long.toHexString(address);
- }
-
- // ask decorator to decorate to ensure consistent label
- ILabelDecorator decorator = (ILabelDecorator)fMemoryBlocks[i].getAdapter(ILabelDecorator.class);
- if (decorator != null)
- text = decorator.decorateText(text, fMemoryBlocks[i]);
-
- labels[i] = text;
- }
- return labels;
- }
-
- private IMemoryBlock getMemoryBlock(ISelection selection)
- {
- if (!(selection instanceof IStructuredSelection))
- return null;
-
- //only single selection of debug element is allowed for this action
- if (selection.isEmpty() || ((IStructuredSelection)selection).size() > 1)
- {
- return null;
- }
-
- Object elem = ((IStructuredSelection)selection).getFirstElement();
-
- if (elem instanceof IMemoryBlock)
- return (IMemoryBlock)elem;
- else if (elem instanceof IMemoryRendering)
- return ((IMemoryRendering)elem).getMemoryBlock();
- else
- return null;
- }
-
- public IMemoryBlock getMemoryBlock()
- {
- return fSelectedMemoryBlock;
- }
-
- /**
- * @param currentBlock
- */
- private void populateDialog(IMemoryBlock currentBlock) {
- final IMemoryBlock selectMB = currentBlock;
- Job job = new Job("Populate dialog") //$NON-NLS-1$
- {
- protected IStatus run(IProgressMonitor monitor) {
- IMemoryBlockRetrieval mbRetrieval = MemoryViewUtil.getMemoryBlockRetrieval(selectMB);
-
- if (mbRetrieval != null)
- {
- fMemoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(mbRetrieval);
- int selectionIdx = 0;
- for (int i=0; i<fMemoryBlocks.length; i++)
- {
- if (fMemoryBlocks[i] == selectMB)
- {
- selectionIdx = i;
- break;
- }
- }
-
- final String[] labels = getLabels(fMemoryBlocks);
- final int idx = selectionIdx;
- final IMemoryBlock selectedBlk = selectMB;
- WorkbenchJob wbJob = new WorkbenchJob("populate dialog"){ //$NON-NLS-1$
-
- public IStatus runInUIThread(IProgressMonitor wbMonitor) {
- doPopulateDialog(memoryBlock, fViewer, labels, idx, selectedBlk);
- return Status.OK_STATUS;
- }};
- wbJob.setSystem(true);
- wbJob.schedule();
- }
- else
- {
- DebugUIPlugin.logErrorMessage("Unable to obtain memory block retrieval."); //$NON-NLS-1$
- }
- return Status.OK_STATUS;
- }};
- job.setSystem(true);
- job.schedule();
- }
-
- /**
- *
- */
- private void addNew() {
- WorkbenchJob job = new WorkbenchJob("populate dialog"){ //$NON-NLS-1$
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- memoryBlock.add(DebugUIMessages.AddMemoryRenderingDialog_Add_New);
- memoryBlock.select(0);
- return Status.OK_STATUS;
- }};
- job.setSystem(true);
- job.schedule();
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java
deleted file mode 100644
index 0e9a10395..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/CodePagesPreferencePage.java
+++ /dev/null
@@ -1,92 +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.debug.internal.ui.views.memory;
-
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.internal.ui.DebugUIMessages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-public class CodePagesPreferencePage extends FieldEditorPreferencePage {
-
- private StringFieldEditor fEbcdicCodePage;
- private StringFieldEditor fAsciiCodePage;
-
- protected CodePagesPreferencePage() {
- super(FieldEditorPreferencePage.GRID);
- setPreferenceStore(DebugUITools.getPreferenceStore());
- setTitle(DebugUIMessages.CodePagesPrefDialog_1);
- }
-
- protected void createFieldEditors() {
- fAsciiCodePage = new StringFieldEditor(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE, DebugUIMessages.CodePagesPrefDialog_2, getFieldEditorParent());
- fAsciiCodePage.setEmptyStringAllowed(false);
- addField(fAsciiCodePage);
-
- fEbcdicCodePage = new StringFieldEditor(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, DebugUIMessages.CodePagesPrefDialog_4, getFieldEditorParent());
- fEbcdicCodePage.setEmptyStringAllowed(false);
- addField(fEbcdicCodePage);
- }
-
- public boolean performOk() {
-
- if (fAsciiCodePage == null || fEbcdicCodePage == null)
- return super.performOk();
-
- // check that the codepages are supported
- String asciiCodePage = fAsciiCodePage.getStringValue();
- asciiCodePage = asciiCodePage.trim();
- try {
- new String(new byte[]{1}, asciiCodePage);
- } catch (UnsupportedEncodingException e) {
- Shell shell = DebugUIPlugin.getShell();
- if (shell != null)
- {
- IStatus status = DebugUIPlugin.newErrorStatus(DebugUIMessages.CodePagesPrefDialog_0, e);
- ErrorDialog.openError(shell, DebugUIMessages.CodePagesPrefDialog_6, DebugUIMessages.CodePagesPrefDialog_7, status); //
- }
- return false;
- }
-
- String ebcdicCodePage = fEbcdicCodePage.getStringValue();
- ebcdicCodePage = ebcdicCodePage.trim();
- try {
- new String(new byte[]{1}, ebcdicCodePage);
- } catch (UnsupportedEncodingException e) {
- Shell shell = DebugUIPlugin.getShell();
- if (shell != null)
- {
- IStatus status = DebugUIPlugin.newErrorStatus(DebugUIMessages.CodePagesPrefDialog_0, e);
- ErrorDialog.openError(shell, DebugUIMessages.CodePagesPrefDialog_8, DebugUIMessages.CodePagesPrefDialog_9, status); //
- }
- return false;
- }
- return super.performOk();
- }
-
- protected Control createContents(Composite parent) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, DebugUIPlugin.getUniqueIdentifier() + ".CodePagesPrefDialog_context"); //$NON-NLS-1$
- return super.createContents(parent);
- }
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryView.java
deleted file mode 100644
index aa0ae6580..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryView.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.debug.internal.ui.views.memory;
-
-
-/**
- * Functions to allow user to control the Memory View or the Memory Rendering View
- *
- * @since 3.0
- */
-public interface IMemoryView
-{
- /**
- * @return the top view tab from the Memory View
- */
- public IMemoryViewTab getTopMemoryTab( );
-
- /**
- * @return all view tabs from current tab folder
- */
- public IMemoryViewTab[] getAllViewTabs();
-
- /**
- * Move specified view tab to the top
- * @param viewTab
- */
- public void moveToTop(IMemoryViewTab viewTab);
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewPane.java
deleted file mode 100644
index e7329f13d..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewPane.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.debug.internal.ui.views.memory;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * Represent a view pane in the memory view.
- *
- * This is an internal interface for mananging the view panes within the Memory View
- * @since 3.1
- */
-public interface IMemoryViewPane {
-
- /**
- * Create the view pane with the given parent composite, and pane
- * id.
- * @param parent
- * @param paneId
- * @param label
- * @return the control of the view pane
- */
- public Control createViewPane(Composite parent, String paneId, String label);
-
- /**
- * Restore view pane based on current selection from the debug view.
- * Create memory blocks or renderings that currently exist in the debug
- * session.
- */
- public void restoreViewPane();
-
- /**
- * Dispose the view pane
- */
- public void dispose();
-
- /**
- * @return unique identifier of the view pane
- */
- public String getId();
-
- /**
- * @return array of actions to be contributed to the view pane's
- * acition bar.
- */
- public IAction[] getActions();
-
- /**
- * Add the given selection listener to the view pane. The selection
- * listener gets notified when the selection from the view pane
- * has changed.
- * @param listener
- */
- public void addSelectionListener(ISelectionChangedListener listener);
-
- /**
- * Remove the selection listener from the view pane. The listener
- * will no longer get notified when selection is changed.
- * @param listener
- */
- public void removeSelctionListener(ISelectionChangedListener listener);
-
- /**
- * @return the selection provider of the view pane
- */
- public ISelectionProvider getSelectionProvider();
-
- /**
- * @return the control for ths memory view pane
- */
- public Control getControl();
-
- /**
- * Called when the view pane becomes visible or hidden
- * @param visible visibility state of teh view pane
- */
- public void setVisible(boolean visible);
-
- /**
- * @return if the view pane is currently visible
- */
- public boolean isVisible();
-
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewTab.java
deleted file mode 100644
index c9dab6a24..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/IMemoryViewTab.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.debug.internal.ui.views.memory;
-
-import org.eclipse.debug.ui.memory.IMemoryRendering;
-
-
-/**
- * Represent a view tab in the Memory View or Memory Rendering View
- *
- * Refer to AbstractMemoryViewTab.
- * This is an internal interface. This class is not intended to be implemented by clients.
- *
- * @since 3.0
- */
-public interface IMemoryViewTab
-{
- /**
- * Remove the view tab.
- */
- public void dispose();
-
- /**
- * @return if the view tab is disposed
- */
- public boolean isDisposed();
-
- /**
- * @return enablement state of the view tab.
- */
- public boolean isEnabled();
-
-
- /**
- * Sets the enablament state of the view tab.
- * @param enabled
- */
- public void setEnabled(boolean enabled);
-
- /**
- * Set view tab's label
- * @param label
- */
- public void setTabLabel(String label);
-
- /**
- * @return view tab's label, null if the label is not available
- */
- public String getTabLabel();
-
- /**
- * @return the rendering of this view tab
- */
- public IMemoryRendering getRendering();
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/LinkRenderingPanesAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/LinkRenderingPanesAction.java
deleted file mode 100644
index 767f3c588..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/LinkRenderingPanesAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.debug.internal.ui.views.memory;
-
-import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
-import org.eclipse.debug.ui.memory.IMemoryRenderingSynchronizationService;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * Action to link/unlink rendering view panes
- */
-public class LinkRenderingPanesAction implements IViewActionDelegate{
-
- IMemoryRenderingSite fRenderingSite;
- private MemoryViewSynchronizationService fMemSyncService;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- public void init(IViewPart view) {
-
- if (view instanceof IMemoryRenderingSite)
- {
- fRenderingSite = (IMemoryRenderingSite)view;
-
- IMemoryRenderingSynchronizationService syncService = fRenderingSite.getSynchronizationService();
-
- if (syncService instanceof MemoryViewSynchronizationService)
- fMemSyncService = (MemoryViewSynchronizationService)syncService;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
-
- if (fMemSyncService == null)
- return;
-
- fMemSyncService.setEnabled(!fMemSyncService.isEnabled());
- updateActionState(action);
- }
-
- /**
- * @param action
- */
- private void updateActionState(IAction action) {
-
- if (fMemSyncService == null)
- return;
-
- if (fMemSyncService.isEnabled())
- action.setChecked(true);
- else
- action.setChecked(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- updateActionState(action);
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
deleted file mode 100644
index 4862fdeb2..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryBlocksTreeViewPane.java
+++ /dev/null
@@ -1,570 +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
- * WindRiver - Bug 192028 [Memory View] Memory view does not
- * display memory blocks that do not reference IDebugTarget
-
- *******************************************************************************/
-
-package org.eclipse.debug.internal.ui.views.memory;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.IMemoryBlockListener;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.DebugUIMessages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.contexts.DebugContextEvent;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.debug.ui.memory.IMemoryRendering;
-import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
-import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.UIJob;
-
-
-/**
- * Tree viewer for memory blocks
- */
-public class MemoryBlocksTreeViewPane implements ISelectionListener, ISelectionChangedListener, IMemoryViewPane, IMemoryRenderingContainer{
-
- public static final String PANE_ID = DebugUIPlugin.getUniqueIdentifier() + ".MemoryView.MemoryBlocksTreeViewPane"; //$NON-NLS-1$
-
- private IViewPart fParent;
- private MemoryViewTreeViewer fTreeViewer;
- protected IMemoryBlockRetrieval fRetrieval;
- private ViewPaneSelectionProvider fSelectionProvider;
- private AddMemoryBlockAction fAddMemoryBlockAction;
- private IAction fRemoveMemoryBlockAction;
- private IAction fRemoveAllMemoryBlocksAction;
- private String fPaneId;
- private boolean fVisible = true;
- private TreeViewPaneContextListener fDebugContextListener;
- private ViewPaneEventHandler fEvtHandler;
- private String fLabel;
-
- class TreeViewerRemoveMemoryBlocksAction extends Action
- {
- TreeViewerRemoveMemoryBlocksAction()
- {
- super();
- setText(DebugUIMessages.RemoveMemoryBlockAction_title);
-
- setToolTipText(DebugUIMessages.RemoveMemoryBlockAction_tooltip);
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_MEMORY));
- setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_REMOVE_MEMORY));
- setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_MEMORY));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".RemoveMemoryBlockAction_context"); //$NON-NLS-1$
- setEnabled(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ISelection selected = fTreeViewer.getSelection();
-
- if (selected != null && selected instanceof IStructuredSelection)
- {
- Object[] selectedMemBlks = ((IStructuredSelection)selected).toArray();
- ArrayList memoryBlocks = new ArrayList();
- for (int i=0; i<selectedMemBlks.length; i++)
- {
- if (selectedMemBlks[i] instanceof IMemoryBlock)
- memoryBlocks.add(selectedMemBlks[i]);
- }
-
- DebugPlugin.getDefault().getMemoryBlockManager().removeMemoryBlocks((IMemoryBlock[])memoryBlocks.toArray(new IMemoryBlock[memoryBlocks.size()]));
- }
- }
- }
-
- class TreeViewerRemoveAllMemoryBlocksAction extends Action
- {
- TreeViewerRemoveAllMemoryBlocksAction()
- {
- super();
- setText(DebugUIMessages.MemoryBlocksTreeViewPane_2);
-
- setToolTipText(DebugUIMessages.MemoryBlocksTreeViewPane_2);
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL));
- setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_REMOVE_ALL));
- setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_REMOVE_ALL));
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".RemoveAllMemoryBlocksAction_context"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
-
- IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
- if (window == null) {
- return;
- }
- boolean proceed = MessageDialog.openQuestion(window.getShell(), DebugUIMessages.MemoryBlocksTreeViewPane_0, DebugUIMessages.MemoryBlocksTreeViewPane_1); //
- if (proceed) {
- IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval);
- DebugPlugin.getDefault().getMemoryBlockManager().removeMemoryBlocks(memoryBlocks);
- }
- }
- }
-
- class ViewPaneEventHandler implements IMemoryBlockListener, IDebugEventSetListener
- {
- private boolean fDisposed = false;
-
- public ViewPaneEventHandler()
- {
- DebugPlugin.getDefault().getMemoryBlockManager().addListener(this);
- DebugPlugin.getDefault().addDebugEventListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- fDisposed = true;
- DebugPlugin.getDefault().getMemoryBlockManager().removeListener(this);
- DebugPlugin.getDefault().removeDebugEventListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.memory.IMemoryBlockListener#MemoryBlockAdded(org.eclipse.debug.core.model.IMemoryBlock)
- */
- public void memoryBlocksAdded(final IMemoryBlock[] memory) {
- // if the content provider is disposed, do not handle event
- if (fDisposed)
- return;
- updateActionsEnablement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.core.memory.IMemoryBlockListener#MemoryBlockRemoved(org.eclipse.debug.core.model.IMemoryBlock)
- */
- public void memoryBlocksRemoved(final IMemoryBlock[] memory) {
- if (fDisposed)
- return;
- updateActionsEnablement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.BasicDebugViewContentProvider#doHandleDebugEvent(org.eclipse.debug.core.DebugEvent)
- */
- protected void doHandleDebugEvent(DebugEvent event) {
-
- // if the view is disposed, do not handle event
- if (fDisposed)
- return;
-
- if (event.getKind() == DebugEvent.TERMINATE)
- {
- // should only handle the terminate event if the target is terminated
- if (event.getSource() instanceof IDebugTarget)
- {
- IMemoryBlockRetrieval srcRetrieval = MemoryViewUtil.getMemoryBlockRetrieval(event.getSource());
- if (srcRetrieval == fRetrieval)
- {
- // #setInput must be done on the UI thread
- UIJob job = new UIJob("setInput"){ //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
-
- // if viewpane is disposed, do not handle event
- if (fTreeViewer.getContentProvider() == null)
- return Status.OK_STATUS;
-
- fTreeViewer.setInput(null);
- return Status.OK_STATUS;
- }};
-
- job.setSystem(true);
- job.schedule();
- }
- }
- }
- }
-
- public void handleDebugEvents(DebugEvent[] events) {
- for (int i=0; i<events.length; i++)
- {
- doHandleDebugEvent(events[i]);
- }
- }
- }
-
- class TreeViewPaneContextListener implements IDebugContextListener
- {
- public void contextActivated(ISelection selection) {
-
- if (selection.isEmpty() && fRetrieval != null)
- {
- fRetrieval = null;
- if (fTreeViewer != null && fTreeViewer.getContentProvider() != null)
- fTreeViewer.setInput(fRetrieval);
- updateActionsEnablement();
- return;
- }
-
- if (selection instanceof IStructuredSelection)
- {
- Object obj = ((IStructuredSelection)selection).getFirstElement();
- if (obj instanceof IAdaptable)
- {
- IAdaptable context = (IAdaptable)obj;
- IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
- if (retrieval != null && retrieval != fRetrieval &&
- fTreeViewer != null && fTreeViewer.getContentProvider() != null)
- {
- // set new setting
- fRetrieval = retrieval;
- fTreeViewer.setInput(fRetrieval);
- }
- updateActionsEnablement();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener#contextEvent(org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
- */
- public void debugContextChanged(DebugContextEvent event) {
- if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
- contextActivated(event.getContext());
- }
- }
- }
-
- public MemoryBlocksTreeViewPane(IViewPart parent)
- {
- fParent = parent;
- fSelectionProvider = new ViewPaneSelectionProvider();
- }
-
- public Control createViewPane(Composite parent, String paneId, String label)
- {
- fPaneId = paneId;
- int style = SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL;
-
- fLabel = label;
-
- IMemoryRenderingSite site = getMemoryRenderingSite();
- MemoryViewPresentationContext presentationContext = new MemoryViewPresentationContext(site, this, null);
- fTreeViewer = new MemoryViewTreeViewer(parent, style, presentationContext);
-
- IAdaptable context = DebugUITools.getDebugContext();
- IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
- if (retrieval != null)
- fTreeViewer.setInput(retrieval);
-
- fRetrieval = retrieval;
-
- fParent.getViewSite().getSelectionProvider().addSelectionChangedListener(this);
- fParent.getViewSite().getPage().addSelectionListener(this);
-
- fDebugContextListener = new TreeViewPaneContextListener();
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener);
-
- fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection treeSelected = event.getSelection();
- fSelectionProvider.setSelection(treeSelected);
- }});
-
- updateRetrieval();
- fEvtHandler = new ViewPaneEventHandler();
-
- // create context menu
- MenuManager mgr = createContextMenuManager();
- Menu menu = mgr.createContextMenu(fTreeViewer.getControl());
- fTreeViewer.getControl().setMenu(menu);
-
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.horizontalAlignment = SWT.FILL;
- data.verticalAlignment = SWT.FILL;
- fTreeViewer.getControl().setLayoutData(data);
-
- updateActionsEnablement();
-
- return fTreeViewer.getControl();
- }
-
-
- /**
- *
- */
- private void updateRetrieval() {
-
- Object context = DebugUITools.getDebugContext();
- fRetrieval = MemoryViewUtil.getMemoryBlockRetrieval(context);
- }
-
- protected MenuManager createContextMenuManager() {
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- manager.add(fAddMemoryBlockAction);
- manager.add(fRemoveMemoryBlockAction);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
- });
-
- // register a context menu manager, use its pane id as the menu id
- fParent.getSite().registerContextMenu(getId(), menuMgr, fSelectionProvider);
- return menuMgr;
- }
-
- public void dispose()
- {
- fParent.getViewSite().getSelectionProvider().removeSelectionChangedListener(this);
- fParent.getViewSite().getPage().removeSelectionListener(this);
- fAddMemoryBlockAction.dispose();
- DebugUITools.getDebugContextManager().getContextService(fParent.getSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener);
- fEvtHandler.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-
-
-
- if (selection instanceof IStructuredSelection)
- {
- Object obj = ((IStructuredSelection)selection).getFirstElement();
-
- if (obj instanceof IMemoryBlock)
- {
- // if the selection event comes from this view
- if (part == fParent)
- {
- // do not change selection if the selection is already correct
- ISelection treeSel = fTreeViewer.getSelection();
- if (treeSel instanceof IStructuredSelection)
- {
- if (((IStructuredSelection)treeSel).getFirstElement() == obj)
- return;
- }
- // remove itself as selection listener when handling selection changed event
- removeSelctionListener(this);
- fTreeViewer.setSelection(selection);
- // remove itself as selection listener when handling selection changed event
- addSelectionListener(this);
- }
- }
- }
-
- }
-
-
-
- public String getId()
- {
- return fPaneId;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#getActions()
- */
- public IAction[] getActions() {
-
- if (fAddMemoryBlockAction == null)
- fAddMemoryBlockAction = new RetargetAddMemoryBlockAction((IMemoryRenderingSite)fParent);
-
- if (fRemoveMemoryBlockAction == null)
- {
- fRemoveMemoryBlockAction = new TreeViewerRemoveMemoryBlocksAction();
- }
-
- if (fRemoveAllMemoryBlocksAction == null)
- {
- fRemoveAllMemoryBlocksAction = new TreeViewerRemoveAllMemoryBlocksAction();
- }
-
- updateActionsEnablement();
-
- return new IAction[]{fAddMemoryBlockAction, fRemoveMemoryBlockAction, fRemoveAllMemoryBlocksAction};
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#addSelectionListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionListener(ISelectionChangedListener listener)
- {
- if (fSelectionProvider == null)
- fSelectionProvider = new ViewPaneSelectionProvider();
-
- fSelectionProvider.addSelectionChangedListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#removeSelctionListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelctionListener(ISelectionChangedListener listener)
- {
- if (fSelectionProvider == null)
- return;
-
- fSelectionProvider.removeSelectionChangedListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#getSelectionProvider()
- */
- public ISelectionProvider getSelectionProvider() {
- return fSelectionProvider;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#restoreViewPane()
- */
- public void restoreViewPane() {
- updateRetrieval();
- updateActionsEnablement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#getControl()
- */
- public Control getControl() {
- return fTreeViewer.getControl();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- if (fVisible != visible)
- {
- fVisible = visible;
-
- if(fVisible)
- {
- fTreeViewer.refresh();
- fTreeViewer.getControl().setFocus();
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.memory.IMemoryViewPane#isVisible()
- */
- public boolean isVisible() {
- return fVisible;
- }
-
- private void updateActionsEnablement()
- {
- if (fRemoveMemoryBlockAction == null)
- return;
-
- if (fRemoveAllMemoryBlocksAction == null)
- return;
-
- if (fRetrieval != null)
- {
- IMemoryBlock[] memBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval);
- if(memBlocks.length > 0)
- {
- fRemoveMemoryBlockAction.setEnabled(true);
- fRemoveAllMemoryBlocksAction.setEnabled(true);
- }
- else
- {
- fRemoveMemoryBlockAction.setEnabled(false);
- fRemoveAllMemoryBlocksAction.setEnabled(false);
- }
- }
- else
- {
- fRemoveMemoryBlockAction.setEnabled(false);
- fRemoveAllMemoryBlocksAction.setEnabled(false);
- }
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- // only handle selection changed from parent's selection provider
- if (event.getSource() == fParent.getSite().getSelectionProvider())
- {
- MemoryBlocksTreeViewPane.this.selectionChanged(fParent, event.getSelection());
- }
- }
-
- public StructuredViewer getViewer()
- {
- return fTreeViewer;
- }
-
- public IMemoryRenderingSite getMemoryRenderingSite() {
- if (fParent instanceof IMemoryRenderingSite)
- return (IMemoryRenderingSite)fParent;
- return null;
- }
-
- public void addMemoryRendering(IMemoryRendering rendering) {
- // do nothing
- }
-
- public void removeMemoryRendering(IMemoryRendering rendering) {
- // do nothing
- }
-
- public IMemoryRendering[] getRenderings() {
- return new IMemoryRendering[0];
- }
-
- public IMemoryRendering getActiveRendering() {
- return null;
- }
-
- public String getLabel() {
- return fLabel;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
deleted file mode 100644
index 5e8333be2..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/memory/MemoryView.java
+++ /dev/null
@@ -1,857 +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
- * Wind River Systems - Ted Williams - [Memory View] Memory View: Workflow Enhancements (Bug 215432)
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.memory;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.debug.internal.ui.DebugUIMessages;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.views.variables.VariablesViewMessages;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.memory.IMemoryRendering;
-import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
-import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
-import org.eclipse.debug.ui.memory.IMemoryRenderingSynchronizationService;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ViewForm;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.IActionBars;
-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.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- *
- * @since 3.0
- */
-public class MemoryView extends ViewPart implements IMemoryRenderingSite {
-
- protected MemoryViewSelectionProvider fSelectionProvider;
- private MemoryViewPartListener fPartListener;
-
- private SashForm fSashForm;
- private Hashtable fViewPanes = new Hashtable();
- private Hashtable fViewPaneControls = new Hashtable();
- private ArrayList fVisibleViewPanes = new ArrayList();
- private boolean fVisible;
-
- private ArrayList fWeights = new ArrayList();
-
- private static final String VISIBILITY_PREF = IDebugUIConstants.ID_MEMORY_VIEW+".viewPanesVisibility"; //$NON-NLS-1$
- private static final String ID_MEMORY_VIEW_CONTEXT = "org.eclipse.debug.ui.memoryview"; //$NON-NLS-1$
- private static final String ID_ADD_MEMORY_BLOCK_COMMAND = "org.eclipse.debug.ui.commands.addMemoryMonitor"; //$NON-NLS-1$
- private static final String ID_TOGGLE_MEMORY_MONITORS_PANE_COMMAND = "org.eclipse.debug.ui.commands.toggleMemoryMonitorsPane"; //$NON-NLS-1$
- private static final String ID_NEXT_MEMORY_BLOCK_COMMAND = "org.eclipse.debug.ui.commands.nextMemoryBlock"; //$NON-NLS-1$
- private static final String ID_NEW_RENDERING_COMMAND = "org.eclipse.debug.ui.commands.newRendering"; //$NON-NLS-1$
- private static final String ID_CLOSE_RENDERING_COMMAND = "org.eclipse.debug.ui.commands.closeRendering"; //$NON-NLS-1$
-
- public static final String VIEW_PANE_ORIENTATION_PREF = IDebugUIConstants.ID_MEMORY_VIEW+".orientation"; //$NON-NLS-1$
- public static final int HORIZONTAL_VIEW_ORIENTATION = 0;
- public static final int VERTICAL_VIEW_ORIENTATION =1;
-
- private String[] defaultVisiblePaneIds ={MemoryBlocksTreeViewPane.PANE_ID, IDebugUIConstants.ID_RENDERING_VIEW_PANE_1};
-
- private MemoryBlocksTreeViewPane fMemBlkViewer;
-
- private MemoryViewSynchronizationService fSyncService;
-
- private boolean fPinMBDisplay = false; // pin memory block display, on by default
- private static int fViewCnt = 0;
-
- private AbstractHandler fAddHandler;
- private AbstractHandler fToggleMonitorsHandler;
- private AbstractHandler fNextMemoryBlockHandler;
- private AbstractHandler fNewRenderingHandler;
- private AbstractHandler fCloseRenderingHandler;
-
- private ViewPaneOrientationAction[] fOrientationActions;
- private int fViewOrientation = HORIZONTAL_VIEW_ORIENTATION;
-
- private String fActivePaneId;
-
- class MemoryViewSelectionProvider implements ISelectionProvider, ISelectionChangedListener
- {
- ArrayList fListeners = new ArrayList();
-
- IStructuredSelection fSelections = new StructuredSelection();
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (!fListeners.contains(listener))
- fListeners.add(listener);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection()
- {
- return fSelections;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (fListeners.contains(listener))
- fListeners.remove(listener);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection)
- {
- if (selection instanceof IStructuredSelection)
- {
- boolean fireChanged = false;
-
- // only fire change event if the selection has really changed
- if (fSelections.getFirstElement() != ((IStructuredSelection)selection).getFirstElement())
- fireChanged = true;
-
- fSelections = (IStructuredSelection)selection;
-
- if (fireChanged)
- fireChanged();
- }
- }
-
- public void fireChanged()
- {
- SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection());
- for (int i=0; i<fListeners.size(); i++)
- {
- ((ISelectionChangedListener)fListeners.get(i)).selectionChanged(evt);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection viewPaneSelection = event.getSelection();
-
- if (viewPaneSelection instanceof IStructuredSelection)
- {
- Object selected = ((IStructuredSelection)viewPaneSelection).getFirstElement();
-
- if (selected != null)
- {
- StructuredSelection strucSelection = new StructuredSelection(new Object[]{selected});
- setSelection(strucSelection);
- }
- else
- {
- setSelection(viewPaneSelection);
- }
- }
- }
- }
-
- class MemoryViewPartListener implements IPartListener2
- {
- IMemoryRenderingSite fView = null;
-
- public MemoryViewPartListener(IMemoryRenderingSite view)
- {
- fView = view;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partActivated(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partActivated(IWorkbenchPartReference ref) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPartListener2#partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference)
- */
- public void partBroughtToTop(IWorkben