Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 16:20:42 +0000
committerJonah Graham2018-11-22 21:47:02 +0000
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/CSourceNotFoundDescriptionFactory.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java50
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java48
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/EvaluationContextManager.java84
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java287
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IDsfDebugHelpContextIds.java24
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IInternalDsfDebugUIConstants.java14
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java4
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/PreferenceInitializer.java6
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java133
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java60
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/AbstractDsfRegisterGroupActions.java631
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java45
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java45
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java34
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfAddRegisterGroupCommand.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfEditRegisterGroupCommand.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRemoveRegisterGroupsCommand.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRestoreRegisterGroupsCommand.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java7
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java290
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java288
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java14
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java306
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/DebugViewLayoutTester.java30
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfDebugViewLayoutCommand.java167
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfGroupDebugContextsCommand.java9
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfUngroupDebugContextsCommand.java13
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java86
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java37
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java808
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsfFactory.java7
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java45
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyDropAdapter.java9
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyEditor.java8
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyHyperlinkDetector.java17
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyImageRegistry.java79
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java11
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java1024
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java7
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java20
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyToggleBreakpointTester.java42
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyView.java40
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewerConfiguration.java31
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/EditionFinderJob.java12
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java12
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/IDisassemblyHelpContextIds.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourceColorerJob.java13
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourcePosition.java12
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyAction.java15
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyBreakpointRulerAction.java7
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerAction.java10
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerActionDelegate.java39
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoAddress.java5
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoProgramCounter.java1
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionOpenPreferences.java4
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddBreakpointRulerAction.java153
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddressBarContributionItem.java64
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/BreakpointPropertiesRulerAction.java101
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/JumpToAddressAction.java42
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointActionDelegate.java5
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointHandler.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/TextOperationAction.java73
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/Addr2Line.java19
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java78
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java275
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyWithSourcePosition.java11
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceDocumentProvider.java16
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceEditorInput.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceFileInfo.java30
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceReadingJob.java5
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java6
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java79
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourcePresentationCreator.java73
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTag.java28
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java18
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/DisassemblyIPAnnotation.java24
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourcePresentationCreator.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceRange.java6
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTag.java64
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagListener.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagProvider.java4
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourcePresentationCreatorFactory.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourceTagDamagerRepairer.java164
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java234
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java10
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java27
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java16
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java30
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java10
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/IFileRider.java2
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDDocument.java4
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFile.java8
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFileRider.java9
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDRun.java3
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDTextStore.java94
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringRider.java6
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringTextStore.java4
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/HSL.java32
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/StorageEditorInput.java5
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingIntegerFieldEditor.java47
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingStringFieldEditor.java77
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java38
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/IntegerWithBooleanFieldEditor.java81
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java90
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/sourcelookup/DsfSourceSelectionResolver.java34
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java210
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/VMViewerUpdateTracing.java38
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/DsfViewMemoryHandler.java102
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/MessagesForVMActions.java27
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshActionDelegate.java58
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshAllRetargetAction.java28
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshHandler.java22
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RetargetDebugContextAction.java232
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesContribution.java146
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesPropertyTester.java80
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java16
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java180
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java23
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java26
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/TextViewerAction.java110
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java27
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java1441
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java92
126 files changed, 5236 insertions, 4957 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/CSourceNotFoundDescriptionFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/CSourceNotFoundDescriptionFactory.java
index 57fc7705fdc..75a4cc3cd42 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/CSourceNotFoundDescriptionFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/CSourceNotFoundDescriptionFactory.java
@@ -85,7 +85,7 @@ public class CSourceNotFoundDescriptionFactory implements IAdapterFactory {
/**
* Creates a brief description of stack frame data. Based on code in
* StackFrameVMNode.
- *
+ *
* @param frame
* @return the frame description
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java
index 2c183fb1c3b..70f0d5a674a 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DebugTextHoverAdapterFactory.java
@@ -23,36 +23,36 @@ import org.eclipse.core.runtime.IAdapterFactory;
/**
* Adapter factory adapting an {@link IDMVMContext} to an {@link ICEditorTextHover}.
- *
+ *
* @since 2.1
*/
public class DebugTextHoverAdapterFactory implements IAdapterFactory {
- private static final Class<?>[] TYPES = { ICEditorTextHover.class };
- private static final Object fDebugTextHover= new DsfDebugTextHover();
-
- @SuppressWarnings("unchecked")
+ private static final Class<?>[] TYPES = { ICEditorTextHover.class };
+ private static final Object fDebugTextHover = new DsfDebugTextHover();
+
+ @SuppressWarnings("unchecked")
@Override
- public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (adaptableObject instanceof IDMVMContext) {
- IDMContext dmc = ((IDMVMContext) adaptableObject).getDMContext();
- // try session specific hover
- T sessionHover = dmc.getAdapter(adapterType);
- if (sessionHover != null) {
- return sessionHover;
- }
- // use default
- IFrameDMContext frameDmc = DMContexts.getAncestorOfType(dmc, IFrameDMContext.class);
- if (frameDmc != null) {
- return (T)fDebugTextHover;
- }
- }
- return null;
- }
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
+ if (adaptableObject instanceof IDMVMContext) {
+ IDMContext dmc = ((IDMVMContext) adaptableObject).getDMContext();
+ // try session specific hover
+ T sessionHover = dmc.getAdapter(adapterType);
+ if (sessionHover != null) {
+ return sessionHover;
+ }
+ // use default
+ IFrameDMContext frameDmc = DMContexts.getAncestorOfType(dmc, IFrameDMContext.class);
+ if (frameDmc != null) {
+ return (T) fDebugTextHover;
+ }
+ }
+ return null;
+ }
- @Override
- public Class<?>[] getAdapterList() {
- return TYPES;
- }
+ @Override
+ public Class<?>[] getAdapterList() {
+ return TYPES;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java
index e785db96408..0d54e8c153c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/DisassemblyToggleBreakpointsTarget.java
@@ -34,39 +34,37 @@ public class DisassemblyToggleBreakpointsTarget extends AbstractDisassemblyBreak
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.AbstractDisassemblyBreakpointsTarget#createLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
*/
@Override
- protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- CDIDebugModel.createLineBreakpoint( sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true ); //$NON-NLS-1$
+ protected void createLineBreakpoint(String sourceHandle, IResource resource, int lineNumber) throws CoreException {
+ CDIDebugModel.createLineBreakpoint(sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource,
+ int lineNumber) throws CoreException {
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setLineBreakpointAttributes(attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0,
+ ""); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
}
- @Override
- protected void createLineBreakpointInteractive(IWorkbenchPart part, String sourceHandle, IResource resource,
- int lineNumber) throws CoreException
- {
- ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setLineBreakpointAttributes(
- attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
- openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
- }
-
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.AbstractDisassemblyBreakpointsTarget#createAddressBreakpoint(org.eclipse.core.resources.IResource, org.eclipse.cdt.core.IAddress)
*/
@Override
- protected void createAddressBreakpoint( IResource resource, IAddress address ) throws CoreException {
- CDIDebugModel.createAddressBreakpoint( null, null, resource, getBreakpointType(), address, true, 0, "", true ); //$NON-NLS-1$
+ protected void createAddressBreakpoint(IResource resource, IAddress address) throws CoreException {
+ CDIDebugModel.createAddressBreakpoint(null, null, resource, getBreakpointType(), address, true, 0, "", true); //$NON-NLS-1$
}
- @Override
- protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address)
- throws CoreException
- {
- ICLineBreakpoint lineBp = CDIDebugModel.createBlankAddressBreakpoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setAddressBreakpointAttributes(
- attributes, null, null, getBreakpointType(), -1, address, true, 0, "" ); //$NON-NLS-1$
- openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
- }
+ @Override
+ protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address)
+ throws CoreException {
+ ICLineBreakpoint lineBp = CDIDebugModel.createBlankAddressBreakpoint();
+ Map<String, Object> attributes = new HashMap<String, Object>();
+ CDIDebugModel.setAddressBreakpointAttributes(attributes, null, null, getBreakpointType(), -1, address, true, 0,
+ ""); //$NON-NLS-1$
+ openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
+ }
protected int getBreakpointType() {
return ICBreakpointType.REGULAR;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/EvaluationContextManager.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/EvaluationContextManager.java
index ed71b276ce9..6b84831d599 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/EvaluationContextManager.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/EvaluationContextManager.java
@@ -13,7 +13,7 @@
* Ericsson - DSF-GDB version
* Nokia - Made generic to DSF
*******************************************************************************/
-package org.eclipse.cdt.dsf.debug.internal.ui;
+package org.eclipse.cdt.dsf.debug.internal.ui;
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.debug.ui.DebugUITools;
@@ -27,23 +27,23 @@ import org.eclipse.ui.IWindowListener;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-
+
/**
* Manages the current evaluation context (stack frame) for evaluation actions.
* In each page, the selection is tracked in each debug view (if any). When a debug
* target selection exists, the "debuggerActive" System property is set to true.
* This property is used to make the "Run to Line", "Resume at Line",
* "Move to Line" and "Add Watch Expression" actions
- * visible in editors only if there is a running debug session.
+ * visible in editors only if there is a running debug session.
*/
public class EvaluationContextManager implements IWindowListener, IDebugContextListener {
- // Avoid referencing the cdt.debug.ui plugin for this constnat so that the
- // cdt.debug.ui is not automatically activated
- // Bug 343867.
- private static final String CDT_DEBUG_UI_PLUGIN_ID = "org.eclipse.cdt.debug.ui"; //$NON-NLS-1$
-
- // Must use the same ID than the base CDT uses since we want to enable actions that are registered by base CDT.
+ // Avoid referencing the cdt.debug.ui plugin for this constnat so that the
+ // cdt.debug.ui is not automatically activated
+ // Bug 343867.
+ private static final String CDT_DEBUG_UI_PLUGIN_ID = "org.eclipse.cdt.debug.ui"; //$NON-NLS-1$
+
+ // Must use the same ID than the base CDT uses since we want to enable actions that are registered by base CDT.
private final static String DEBUGGER_ACTIVE = CDT_DEBUG_UI_PLUGIN_ID + ".debuggerActive"; //$NON-NLS-1$
protected static EvaluationContextManager fgManager;
@@ -56,91 +56,91 @@ public class EvaluationContextManager implements IWindowListener, IDebugContextL
@Override
public void run() {
- if ( fgManager == null ) {
+ if (fgManager == null) {
// FindBugs reported that it is unsafe to set s_resources
// before we finish to initialize the object, because of
// multi-threading. This is why we use a temporary variable.
EvaluationContextManager manager = new EvaluationContextManager();
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
- for( int i = 0; i < windows.length; i++ ) {
- manager.windowOpened( windows[i] );
+ for (int i = 0; i < windows.length; i++) {
+ manager.windowOpened(windows[i]);
}
- workbench.addWindowListener( manager );
-
+ workbench.addWindowListener(manager);
+
fgManager = manager;
}
}
};
Display display = Display.getCurrent();
- if ( display == null )
+ if (display == null)
display = Display.getDefault();
- display.asyncExec( r );
+ display.asyncExec(r);
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
*/
@Override
- public void windowActivated( IWorkbenchWindow window ) {
- IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(window);
- service.addDebugContextListener(this);
- selectionChanged( service.getActiveContext() );
+ public void windowActivated(IWorkbenchWindow window) {
+ IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(window);
+ service.addDebugContextListener(this);
+ selectionChanged(service.getActiveContext());
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
*/
@Override
- public void windowDeactivated( IWorkbenchWindow window ) {
- DebugUITools.getDebugContextManager().getContextService(window).removeDebugContextListener(this);
+ public void windowDeactivated(IWorkbenchWindow window) {
+ DebugUITools.getDebugContextManager().getContextService(window).removeDebugContextListener(this);
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
*/
@Override
- public void windowClosed( IWorkbenchWindow window ) {
+ public void windowClosed(IWorkbenchWindow window) {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
*/
@Override
- public void windowOpened( IWorkbenchWindow window ) {
+ public void windowOpened(IWorkbenchWindow window) {
}
@Override
public void debugContextChanged(DebugContextEvent event) {
- selectionChanged(event.getContext());
+ selectionChanged(event.getContext());
}
-
- private void selectionChanged(ISelection selection ) {
- if ( selection instanceof IStructuredSelection ) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if ( ss.size() == 1 ) {
- Object element = ss.getFirstElement();
- if ( element instanceof IDMVMContext ) {
- setContext( (IDMVMContext)element );
- return;
- }
- }
- }
- // no context in the given view
- removeContext();
+
+ private void selectionChanged(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ if (ss.size() == 1) {
+ Object element = ss.getFirstElement();
+ if (element instanceof IDMVMContext) {
+ setContext((IDMVMContext) element);
+ return;
+ }
+ }
+ }
+ // no context in the given view
+ removeContext();
}
/**
* Sets the evaluation context.
*/
- private void setContext( IDMVMContext target ) {
- System.setProperty( DEBUGGER_ACTIVE, Boolean.TRUE.toString() );
+ private void setContext(IDMVMContext target) {
+ System.setProperty(DEBUGGER_ACTIVE, Boolean.TRUE.toString());
}
/**
* Removes an evaluation context.
*/
private void removeContext() {
- System.setProperty( DEBUGGER_ACTIVE, Boolean.FALSE.toString() );
+ System.setProperty(DEBUGGER_ACTIVE, Boolean.FALSE.toString());
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java
index 1dd13b82c16..76477e9124c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ExpressionInformationControlCreator.java
@@ -59,44 +59,45 @@ import org.eclipse.ui.IWorkbenchPartSite;
/**
* Creates an information control to display an expression in a hover control.
* <br/> This class is derivative work from JDT's <code>ExpressionInformationControlCreator</code>.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
- *
+ *
* @since 2.1
*/
@SuppressWarnings("restriction")
public class ExpressionInformationControlCreator implements IInformationControlCreator {
- /**
- * A presentation context for the expression hover control.
- * Implements equals and hashCode based on id comparison.
- */
- private static final class ExpressionHoverPresentationContext extends PresentationContext {
-
- private ExpressionHoverPresentationContext(String id) {
- super(id);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof ExpressionHoverPresentationContext) {
- if (getId().equals(((PresentationContext) obj).getId())) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return getId().hashCode();
- }
- }
-
- class ExpressionInformationControl extends AbstractInformationControl implements IInformationControlExtension2, IViewerInputRequestor {
+ /**
+ * A presentation context for the expression hover control.
+ * Implements equals and hashCode based on id comparison.
+ */
+ private static final class ExpressionHoverPresentationContext extends PresentationContext {
+
+ private ExpressionHoverPresentationContext(String id) {
+ super(id);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof ExpressionHoverPresentationContext) {
+ if (getId().equals(((PresentationContext) obj).getId())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return getId().hashCode();
+ }
+ }
+
+ class ExpressionInformationControl extends AbstractInformationControl
+ implements IInformationControlExtension2, IViewerInputRequestor {
/**
* Dialog setting key for height
@@ -104,7 +105,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
private static final String HEIGHT = "HEIGHT"; //$NON-NLS-1$
/**
- * Dialog setting key for width.
+ * Dialog setting key for width.
*/
private static final String WIDTH = "WIDTH"; //$NON-NLS-1$
@@ -116,7 +117,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
/**
* Dialog setting key for details sash weight
*/
- private static final String SASH_WEIGHT_DETAILS = "SashWeightDetails"; //$NON-NLS-1$
+ private static final String SASH_WEIGHT_DETAILS = "SashWeightDetails"; //$NON-NLS-1$
/**
* Variable to display.
@@ -132,7 +133,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
private ViewerInputService fInputService;
- private IInformationControlCreator fInformationControlCreator;
+ private IInformationControlCreator fInformationControlCreator;
/**
* Inner class implementing IDetailPaneContainer methods. Handles changes to detail
@@ -153,14 +154,14 @@ public class ExpressionInformationControlCreator implements IInformationControlC
*/
@Override
public IStructuredSelection getCurrentSelection() {
- return (IStructuredSelection)fViewer.getSelection();
+ return (IStructuredSelection) fViewer.getSelection();
}
/*
* @see org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer#refreshDetailPaneContents()
*/
@Override
- public void refreshDetailPaneContents() {
+ public void refreshDetailPaneContents() {
fDetailPane.display(getCurrentSelection());
}
@@ -185,8 +186,9 @@ public class ExpressionInformationControlCreator implements IInformationControlC
*/
@Override
public void paneChanged(String newPaneID) {
- if (DefaultDetailPane.ID.equals(newPaneID)){
- fDetailPane.getCurrentControl().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ if (DefaultDetailPane.ID.equals(newPaneID)) {
+ fDetailPane.getCurrentControl()
+ .setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
}
@@ -194,7 +196,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
/**
* Constructs a new control in the given shell.
- *
+ *
* @param parentShell shell
* @param resize whether resize is supported
*/
@@ -212,7 +214,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
// Bug 417559: The TextViewerHoverManager constrains the size of a newly created
// ExpressionInformationControl by 100 chars by 12 chars (602x182). The control
// size can be expanded beyond that, however when re-created it will still be constrained.
- // By removing the constraint in the presence of a non-null IDialogSettings,
+ // By removing the constraint in the presence of a non-null IDialogSettings,
// the size gets restored properly even when previously expanded.
Point dialogSettingsSize = getDialogSettingsSize();
if (dialogSettingsSize != null) {
@@ -237,7 +239,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
if (x > 0) {
int y = getIntSetting(settings, HEIGHT);
if (y > 0) {
- return new Point(x,y);
+ return new Point(x, y);
}
}
}
@@ -247,16 +249,16 @@ public class ExpressionInformationControlCreator implements IInformationControlC
@Override
public void setSize(int width, int height) {
- if (!isResizable() && fDetailPaneComposite != null) {
- // add height of details pane
- height += fDetailPaneComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
- }
- super.setSize(width, height);
+ if (!isResizable() && fDetailPaneComposite != null) {
+ // add height of details pane
+ height += fDetailPaneComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
+ }
+ super.setSize(width, height);
}
/**
* Returns the dialog settings for this hover or <code>null</code> if none
- *
+ *
* @param create whether to create the settings
*/
private IDialogSettings getDialogSettings(boolean create) {
@@ -270,7 +272,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
/**
* Returns an integer value in the given dialog settings or -1 if none.
- *
+ *
* @param settings dialog settings
* @param key key
* @return value or -1 if not present
@@ -291,7 +293,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
/**
* Persists dialog settings.
- *
+ *
* @param shell
*/
private void persistSettings(Shell shell) {
@@ -301,14 +303,13 @@ public class ExpressionInformationControlCreator implements IInformationControlC
Point size = shell.getSize();
settings.put(WIDTH, size.x);
settings.put(HEIGHT, size.y);
- int[] weights = fSashForm.getWeights();
- if (weights.length == 1) {
- settings.put(SASH_WEIGHT_TREE, weights[0]);
- }
- else if (weights.length == 2) {
- settings.put(SASH_WEIGHT_TREE, weights[0]);
- settings.put(SASH_WEIGHT_DETAILS, weights[1]);
- }
+ int[] weights = fSashForm.getWeights();
+ if (weights.length == 1) {
+ settings.put(SASH_WEIGHT_TREE, weights[0]);
+ } else if (weights.length == 2) {
+ settings.put(SASH_WEIGHT_TREE, weights[0]);
+ settings.put(SASH_WEIGHT_DETAILS, weights[1]);
+ }
}
}
}
@@ -337,10 +338,11 @@ public class ExpressionInformationControlCreator implements IInformationControlC
// update presentation context
AbstractDebugView view = getViewToEmulate();
- IPresentationContext context = new ExpressionHoverPresentationContext(IDsfDebugUIConstants.ID_EXPRESSION_HOVER);
+ IPresentationContext context = new ExpressionHoverPresentationContext(
+ IDsfDebugUIConstants.ID_EXPRESSION_HOVER);
if (view != null) {
// copy over properties
- IPresentationContext copy = ((TreeModelViewer)view.getViewer()).getPresentationContext();
+ IPresentationContext copy = ((TreeModelViewer) view.getViewer()).getPresentationContext();
try {
String[] properties = copy.getProperties();
for (int i = 0; i < properties.length; i++) {
@@ -354,7 +356,7 @@ public class ExpressionInformationControlCreator implements IInformationControlC
fViewer = new TreeModelViewer(fSashForm, SWT.MULTI | SWT.VIRTUAL | SWT.FULL_SELECTION, context);
fViewer.setAutoExpandLevel(fExpansionLevel);
-
+
if (view != null) {
// copy over filters
StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
@@ -366,38 +368,40 @@ public class ExpressionInformationControlCreator implements IInformationControlC
}
}
fInputService = new ViewerInputService(fViewer, this);
- fTree = fViewer.getTree();
-
- if (fShowDetailPane) {
- fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
- Layout layout = fDetailPaneComposite.getLayout();
- if (layout instanceof GridLayout) {
- GridLayout gl = (GridLayout) layout;
- gl.marginHeight = 0;
- gl.marginWidth = 0;
- }
-
- fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
- fDetailPane.display(null); // Bring up the default pane so the user doesn't see an empty composite
-
- fTree.addSelectionListener(new SelectionListener() {
- @Override
+ fTree = fViewer.getTree();
+
+ if (fShowDetailPane) {
+ fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
+ Layout layout = fDetailPaneComposite.getLayout();
+ if (layout instanceof GridLayout) {
+ GridLayout gl = (GridLayout) layout;
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ }
+
+ fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
+ fDetailPane.display(null); // Bring up the default pane so the user doesn't see an empty composite
+
+ fTree.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- fDetailPane.display((IStructuredSelection)fViewer.getSelection());
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {}
- });
- }
-
+ fDetailPane.display((IStructuredSelection) fViewer.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+
initSashWeights();
// add update listener to auto-select and display details of root expression
fViewerUpdateListener = new IViewerUpdateListener() {
@Override
public void viewerUpdatesComplete() {
- fViewer.getDisplay().timerExec(100, new Runnable() {
- @Override
+ fViewer.getDisplay().timerExec(100, new Runnable() {
+ @Override
public void run() {
if (!fViewer.getTree().isDisposed()) {
TreeSelection selection = (TreeSelection) fViewer.getSelection();
@@ -412,24 +416,26 @@ public class ExpressionInformationControlCreator implements IInformationControlC
}
});
}
+
@Override
public void viewerUpdatesBegin() {
}
+
@Override
public void updateStarted(IViewerUpdate update) {
}
+
@Override
public void updateComplete(IViewerUpdate update) {
}
};
-
+
fViewer.addViewerUpdateListener(fViewerUpdateListener);
- setForegroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ setForegroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
-
/**
* Attempts to find an appropriate view to emulate, this will either be the
* variables view or the expressions view.
@@ -449,45 +455,44 @@ public class ExpressionInformationControlCreator implements IInformationControlC
return expressionsView;
}
return variablesView;
- }
+ }
/**
- * Initializes the sash form weights from the preference store (using default values if
+ * Initializes the sash form weights from the preference store (using default values if
* no sash weights were stored previously).
*/
- protected void initSashWeights(){
+ protected void initSashWeights() {
IDialogSettings settings = getDialogSettings(false);
if (settings != null) {
int tree = getIntSetting(settings, SASH_WEIGHT_TREE);
if (tree > 0) {
- if (fDetailPane != null) {
- int details = getIntSetting(settings, SASH_WEIGHT_DETAILS);
- if (details <= 0) {
- details = tree / 2;
- }
- fSashForm.setWeights(new int[]{tree, details});
- }
- else {
- fSashForm.setWeights(new int[]{tree});
- }
+ if (fDetailPane != null) {
+ int details = getIntSetting(settings, SASH_WEIGHT_DETAILS);
+ if (details <= 0) {
+ details = tree / 2;
+ }
+ fSashForm.setWeights(new int[] { tree, details });
+ } else {
+ fSashForm.setWeights(new int[] { tree });
+ }
}
}
}
- @Override
- public void setForegroundColor(Color foreground) {
- super.setForegroundColor(foreground);
- if (fDetailPaneComposite != null) {
- fDetailPaneComposite.setForeground(foreground);
- }
- fTree.setForeground(foreground);
- }
+ @Override
+ public void setForegroundColor(Color foreground) {
+ super.setForegroundColor(foreground);
+ if (fDetailPaneComposite != null) {
+ fDetailPaneComposite.setForeground(foreground);
+ }
+ fTree.setForeground(foreground);
+ }
- @Override
+ @Override
public void setBackgroundColor(Color background) {
super.setBackgroundColor(background);
if (fDetailPaneComposite != null) {
- fDetailPaneComposite.setBackground(background);
+ fDetailPaneComposite.setBackground(background);
}
fTree.setBackground(background);
}
@@ -519,14 +524,14 @@ public class ExpressionInformationControlCreator implements IInformationControlC
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- if (fInformationControlCreator == null) {
- fInformationControlCreator = new ExpressionInformationControlCreator(fShowDetailPane, fExpansionLevel) {
- @Override
- public IInformationControl createInformationControl(Shell shell) {
- return new ExpressionInformationControl(shell, true);
- }
- };
- }
+ if (fInformationControlCreator == null) {
+ fInformationControlCreator = new ExpressionInformationControlCreator(fShowDetailPane, fExpansionLevel) {
+ @Override
+ public IInformationControl createInformationControl(Shell shell) {
+ return new ExpressionInformationControl(shell, true);
+ }
+ };
+ }
return fInformationControlCreator;
}
@@ -537,31 +542,31 @@ public class ExpressionInformationControlCreator implements IInformationControlC
}
- protected final boolean fShowDetailPane;
- protected final int fExpansionLevel;
+ protected final boolean fShowDetailPane;
+ protected final int fExpansionLevel;
- /**
- * Create default expression information control creator.
- * <p>
- * Same as {@code ExpressionInformationControlCreator(true, 1)}.
- * </p>
- */
- public ExpressionInformationControlCreator() {
- this(true, 1);
- }
+ /**
+ * Create default expression information control creator.
+ * <p>
+ * Same as {@code ExpressionInformationControlCreator(true, 1)}.
+ * </p>
+ */
+ public ExpressionInformationControlCreator() {
+ this(true, 1);
+ }
/**
* Create expression information control creator with customization options.
- *
- * @param showDetailPane if <code>true</code> the detail pane will be shown
- * @param expansionLevel tree level to which the expression should be expanded by default
- */
- public ExpressionInformationControlCreator(boolean showDetailPane, int expansionLevel) {
- fShowDetailPane = showDetailPane;
- fExpansionLevel = expansionLevel;
- }
-
- /*
+ *
+ * @param showDetailPane if <code>true</code> the detail pane will be shown
+ * @param expansionLevel tree level to which the expression should be expanded by default
+ */
+ public ExpressionInformationControlCreator(boolean showDetailPane, int expansionLevel) {
+ fShowDetailPane = showDetailPane;
+ fExpansionLevel = expansionLevel;
+ }
+
+ /*
* @see org.eclipse.jface.text.IInformationControlCreator#createInformationControl(org.eclipse.swt.widgets.Shell)
*/
@Override
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IDsfDebugHelpContextIds.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IDsfDebugHelpContextIds.java
index 27e80c88b2c..3ee26010a6c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IDsfDebugHelpContextIds.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IDsfDebugHelpContextIds.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -20,16 +20,16 @@ import org.eclipse.debug.ui.IDebugUIConstants;
*/
public interface IDsfDebugHelpContextIds {
- public static final String PREFIX = IDebugUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$
+ public static final String PREFIX = IDebugUIConstants.PLUGIN_ID + "."; //$NON-NLS-1$
- public static final String DETAIL_PANE = PREFIX + "detail_pane_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_ASSIGN_VALUE_ACTION = PREFIX + "detail_pane_assign_value_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_CONTENT_ASSIST_ACTION = PREFIX + "detail_pane_content_assist_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_CUT_ACTION = PREFIX + "detail_pane_cut_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_COPY_ACTION = PREFIX + "detail_pane_copy_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_PASTE_ACTION = PREFIX + "detail_pane_paste_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_SELECT_ALL_ACTION = PREFIX + "detail_pane_select_all_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_FIND_REPLACE_ACTION = PREFIX + "detail_pane_find_replace_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_WORD_WRAP_ACTION = PREFIX + "detail_pane_word_wrap_action_context"; //$NON-NLS-1$
- public static final String DETAIL_PANE_MAX_LENGTH_ACTION = PREFIX + "detail_pane_max_length_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE = PREFIX + "detail_pane_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_ASSIGN_VALUE_ACTION = PREFIX + "detail_pane_assign_value_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_CONTENT_ASSIST_ACTION = PREFIX + "detail_pane_content_assist_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_CUT_ACTION = PREFIX + "detail_pane_cut_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_COPY_ACTION = PREFIX + "detail_pane_copy_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_PASTE_ACTION = PREFIX + "detail_pane_paste_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_SELECT_ALL_ACTION = PREFIX + "detail_pane_select_all_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_FIND_REPLACE_ACTION = PREFIX + "detail_pane_find_replace_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_WORD_WRAP_ACTION = PREFIX + "detail_pane_word_wrap_action_context"; //$NON-NLS-1$
+ public static final String DETAIL_PANE_MAX_LENGTH_ACTION = PREFIX + "detail_pane_max_length_action_context"; //$NON-NLS-1$
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IInternalDsfDebugUIConstants.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IInternalDsfDebugUIConstants.java
index 2cb2da5ae7b..f399a4fadff 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IInternalDsfDebugUIConstants.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/IInternalDsfDebugUIConstants.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -19,10 +19,10 @@ import org.eclipse.cdt.dsf.debug.ui.IDsfDebugUIConstants;
* @since 2.0
*/
public interface IInternalDsfDebugUIConstants {
- /**
- * Boolean preference controlling whether the text in the detail panes is
- * wrapped. When <code>true</code> the text in the detail panes will be
- * wrapped in new variable view.
- */
- public static final String PREF_DETAIL_PANE_WORD_WRAP = IDsfDebugUIConstants.PLUGIN_ID + ".detail_pane_word_wrap"; //$NON-NLS-1$
+ /**
+ * Boolean preference controlling whether the text in the detail panes is
+ * wrapped. When <code>true</code> the text in the detail panes will be
+ * wrapped in new variable view.
+ */
+ public static final String PREF_DETAIL_PANE_WORD_WRAP = IDsfDebugUIConstants.PLUGIN_ID + ".detail_pane_word_wrap"; //$NON-NLS-1$
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java
index 3874a800b09..d2f65542959 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/Messages.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * Patrick Chuong (Texas Instruments) - Bug 315446: Invalid event breakpoint type (group) name
+ * Patrick Chuong (Texas Instruments) - Bug 315446: Invalid event breakpoint type (group) name
* Alvaro Sanchez-Leon (Ericsson AB) - Support for Step into selection (bug 244865)
* Alvaro Sanchez-Leon (Ericsson AB) - Support Register Groups (Bug 235747)
*******************************************************************************/
@@ -30,7 +30,7 @@ public class Messages extends NLS {
public static String RegisterGroupConfirmRestoreMessage;
public static String RegisterGroupRestore;
public static String RegisterGroupRestoreCancel;
-
+
static {
// initialize resource bundle
NLS.initializeMessages(Messages.class.getName(), Messages.class);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/PreferenceInitializer.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/PreferenceInitializer.java
index 076406f6b5a..4c5e3c3005f 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/PreferenceInitializer.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/PreferenceInitializer.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -29,10 +29,10 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
*/
@Override
public void initializeDefaultPreferences() {
-
+
IPreferenceStore prefs = DsfUIPlugin.getDefault().getPreferenceStore();
- /*
+ /*
* Debug View
*/
prefs.setDefault(IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT, 10);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java
index 516ff73a02f..7441c631f79 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/SuspendResumeAdapterFactory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Updated to support Move-To-Line
@@ -29,73 +29,84 @@ import org.eclipse.debug.core.model.ISuspendResume;
/**
* Adapter factory for Run-To-Line, Move-To-Line
* and Resume-At-Line
- *
+ *
* @since 2.1
*/
public class SuspendResumeAdapterFactory implements IAdapterFactory {
- static class SuspendResume implements ISuspendResume, IAdaptable {
+ static class SuspendResume implements ISuspendResume, IAdaptable {
+
+ private final RunToLine fRunToLine;
+ private final MoveToLine fMoveToLine;
+ private final ResumeAtLine fResumeAtLine;
+
+ SuspendResume(IExecutionDMContext execCtx) {
+ fRunToLine = new RunToLine(execCtx);
+ fMoveToLine = new MoveToLine(execCtx);
+ fResumeAtLine = new ResumeAtLine(execCtx);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.isInstance(fRunToLine)) {
+ return (T) fRunToLine;
+ }
+ if (adapter.isInstance(fMoveToLine)) {
+ return (T) fMoveToLine;
+ }
+ if (adapter.isInstance(fResumeAtLine)) {
+ return (T) fResumeAtLine;
+ }
+ return null;
+ }
+
+ @Override
+ public boolean canResume() {
+ return false;
+ }
- private final RunToLine fRunToLine;
- private final MoveToLine fMoveToLine;
- private final ResumeAtLine fResumeAtLine;
-
- SuspendResume(IExecutionDMContext execCtx) {
- fRunToLine = new RunToLine(execCtx);
- fMoveToLine = new MoveToLine(execCtx);
- fResumeAtLine = new ResumeAtLine(execCtx);
- }
-
- @SuppressWarnings("unchecked")
@Override
- public <T> T getAdapter(Class<T> adapter) {
- if (adapter.isInstance(fRunToLine)) {
- return (T)fRunToLine;
- }
- if (adapter.isInstance(fMoveToLine)) {
- return (T)fMoveToLine;
- }
- if (adapter.isInstance(fResumeAtLine)) {
- return (T)fResumeAtLine;
- }
- return null;
- }
+ public boolean canSuspend() {
+ return false;
+ }
- @Override
- public boolean canResume() { return false; }
- @Override
- public boolean canSuspend() { return false; }
- // This must return true because the platform
- // RunToLineActionDelegate will only enable the
- // action if we are suspended
- @Override
- public boolean isSuspended() { return true; }
- @Override
- public void resume() throws DebugException {}
- @Override
- public void suspend() throws DebugException {}
- }
-
- @SuppressWarnings("unchecked")
+ // This must return true because the platform
+ // RunToLineActionDelegate will only enable the
+ // action if we are suspended
+ @Override
+ public boolean isSuspended() {
+ return true;
+ }
+
+ @Override
+ public void resume() throws DebugException {
+ }
+
+ @Override
+ public void suspend() throws DebugException {
+ }
+ }
+
+ @SuppressWarnings("unchecked")
@Override
- public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (ISuspendResume.class.equals(adapterType)) {
- if (adaptableObject instanceof IDMVMContext) {
- IExecutionDMContext execDmc = DMContexts.getAncestorOfType(
- ((IDMVMContext)adaptableObject).getDMContext(),
- IExecutionDMContext.class);
- // It only makes sense to RunToLine, MoveToLine or
- // ResumeAtLine if we are dealing with a thread, not a container
- if (execDmc != null && !(execDmc instanceof IContainerDMContext)) {
- return (T)new SuspendResume(execDmc);
- }
- }
- }
- return null;
- }
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
+ if (ISuspendResume.class.equals(adapterType)) {
+ if (adaptableObject instanceof IDMVMContext) {
+ IExecutionDMContext execDmc = DMContexts
+ .getAncestorOfType(((IDMVMContext) adaptableObject).getDMContext(), IExecutionDMContext.class);
+ // It only makes sense to RunToLine, MoveToLine or
+ // ResumeAtLine if we are dealing with a thread, not a container
+ if (execDmc != null && !(execDmc instanceof IContainerDMContext)) {
+ return (T) new SuspendResume(execDmc);
+ }
+ }
+ }
+ return null;
+ }
- @Override
- public Class<?>[] getAdapterList() {
- return new Class[] { ISuspendResume.class };
- }
+ @Override
+ public Class<?>[] getAdapterList() {
+ return new Class[] { ISuspendResume.class };
+ }
} \ No newline at end of file
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java
index 2e6648be19a..7d8b2bfe4e4 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/ToggleBreakpointsTargetFactory.java
@@ -52,7 +52,7 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
* for the editor.
*/
public static final String TOGGLE_C_BREAKPOINT_TARGET_ID = CDebugUIPlugin.PLUGIN_ID + ".toggleCBreakpointTarget"; //$NON-NLS-1$
-
+
private static final Set<String> TOGGLE_TARGET_IDS = new HashSet<String>(1);
static {
TOGGLE_TARGET_IDS.add(TOGGLE_C_BREAKPOINT_TARGET_ID);
@@ -63,7 +63,7 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
public ToggleBreakpointsTargetFactory() {
}
- @Override
+ @Override
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
if (TOGGLE_C_BREAKPOINT_TARGET_ID.equals(targetID)) {
return fgDisassemblyToggleBreakpointsTarget;
@@ -71,45 +71,43 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
return null;
}
- @Override
+ @Override
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
if (part instanceof IDisassemblyPart) {
- // Return the debug context as a default if the currently selected context
- // is a CDT element. Otherwise return null.
- Object element = getDebugContext(part).getFirstElement();
- if (element instanceof IAdaptable) {
- IDebugModelProvider modelProvider =
- ((IAdaptable)element).getAdapter(IDebugModelProvider.class);
- if (modelProvider != null) {
- String[] models = modelProvider.getModelIdentifiers();
- for (String model : models) {
- if (CDIDebugModel.getPluginIdentifier().equals(model) ||
- ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID.equals(model))
- {
- return TOGGLE_C_BREAKPOINT_TARGET_ID;
- }
- }
- } else if (element instanceof IDebugElement) {
- if (CDIDebugModel.getPluginIdentifier().equals(((IDebugElement)element).getModelIdentifier()) ) {
- return TOGGLE_C_BREAKPOINT_TARGET_ID;
- }
- }
- }
+ // Return the debug context as a default if the currently selected context
+ // is a CDT element. Otherwise return null.
+ Object element = getDebugContext(part).getFirstElement();
+ if (element instanceof IAdaptable) {
+ IDebugModelProvider modelProvider = ((IAdaptable) element).getAdapter(IDebugModelProvider.class);
+ if (modelProvider != null) {
+ String[] models = modelProvider.getModelIdentifiers();
+ for (String model : models) {
+ if (CDIDebugModel.getPluginIdentifier().equals(model)
+ || ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID.equals(model)) {
+ return TOGGLE_C_BREAKPOINT_TARGET_ID;
+ }
+ }
+ } else if (element instanceof IDebugElement) {
+ if (CDIDebugModel.getPluginIdentifier().equals(((IDebugElement) element).getModelIdentifier())) {
+ return TOGGLE_C_BREAKPOINT_TARGET_ID;
+ }
+ }
+ }
}
return null;
}
- @Override
+ @Override
public String getToggleTargetDescription(String targetID) {
return Messages.ToggleBreakpointsTargetFactory_description;
}
- @Override
+ @Override
public String getToggleTargetName(String targetID) {
return Messages.ToggleBreakpointsTargetFactory_name;
}
- @Override
+ @Override
public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection) {
if (part instanceof IDisassemblyPart) {
return TOGGLE_TARGET_IDS;
@@ -118,11 +116,11 @@ public class ToggleBreakpointsTargetFactory implements IToggleBreakpointsTargetF
}
private IStructuredSelection getDebugContext(IWorkbenchPart part) {
- ISelection selection = DebugUITools.getDebugContextManager().
- getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
+ ISelection selection = DebugUITools.getDebugContextManager()
+ .getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
if (selection instanceof IStructuredSelection) {
- return (IStructuredSelection)selection;
- }
+ return (IStructuredSelection) selection;
+ }
return StructuredSelection.EMPTY;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/AbstractDsfRegisterGroupActions.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/AbstractDsfRegisterGroupActions.java
index 9c0f97370a3..4eeeadfa6c0 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/AbstractDsfRegisterGroupActions.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/AbstractDsfRegisterGroupActions.java
@@ -176,24 +176,25 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
protected void addRegisterGroup(final IWorkbenchPart part, final IStructuredSelection selection) {
try {
- final SelectionDMContext selectionContext = new SelectionDMContext(selection);
- selectionContext.fsession.getExecutor().execute(new DsfRunnable() {
+ final SelectionDMContext selectionContext = new SelectionDMContext(selection);
+ selectionContext.fsession.getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- final IRegisters2 registersService;
- try {
- registersService = selectionContext.resolveService();
- } catch (CoreException e) {
- failed(e);
- return;
+ @Override
+ public void run() {
+ final IRegisters2 registersService;
+ try {
+ registersService = selectionContext.resolveService();
+ } catch (CoreException e) {
+ failed(e);
+ return;
+ }
+
+ // continue to process
+ processAddRegisterGroup(part.getSite().getShell(), selectionContext,
+ resolveSelectedRegisters(selection), registersService);
}
+ });
- // continue to process
- processAddRegisterGroup(part.getSite().getShell(), selectionContext,
- resolveSelectedRegisters(selection), registersService);
- }});
-
} catch (DebugException e) {
}
}
@@ -234,27 +235,26 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
protected void editRegisterGroup(final IWorkbenchPart part, IStructuredSelection selection) {
try {
- final SelectionDMContext selectionContext = new SelectionDMContext(selection);
-
- selectionContext.fsession.getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- // Create a services tracker
- final IRegisters2 registersService;
- try {
- registersService = selectionContext.resolveService();
- } catch (CoreException e) {
- failed(e);
- return;
+ final SelectionDMContext selectionContext = new SelectionDMContext(selection);
+
+ selectionContext.fsession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ // Create a services tracker
+ final IRegisters2 registersService;
+ try {
+ registersService = selectionContext.resolveService();
+ } catch (CoreException e) {
+ failed(e);
+ return;
+ }
+
+ processEditRegisterGroup(part.getSite().getShell(), selectionContext, registersService);
}
-
- processEditRegisterGroup(part.getSite().getShell(), selectionContext,
- registersService);
- }
-
- });
- } catch (DebugException e) {
- }
+
+ });
+ } catch (DebugException e) {
+ }
}
protected boolean canEditRegisterGroup(IWorkbenchPart part, IStructuredSelection selection) {
@@ -304,24 +304,25 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
*/
protected void removeRegisterGroups(IWorkbenchPart part, IStructuredSelection selection) {
try {
- final SelectionDMContext selectionContext = new SelectionDMContext(selection);
-
- final IRegisterGroupDMContext[] groups = resolveSelectedGroups(selection);
- selectionContext.fsession.getExecutor().execute(new DsfRunnable() {
- @Override
- public void run() {
- IRegisters2 registersService;
- try {
- registersService = selectionContext.resolveService();
- } catch (CoreException e) {
- failed(e);
- return;
- }
+ final SelectionDMContext selectionContext = new SelectionDMContext(selection);
- registersService.removeRegisterGroups(groups, new RequestMonitor(registersService.getExecutor(), null) {
- });
- }
- });
+ final IRegisterGroupDMContext[] groups = resolveSelectedGroups(selection);
+ selectionContext.fsession.getExecutor().execute(new DsfRunnable() {
+ @Override
+ public void run() {
+ IRegisters2 registersService;
+ try {
+ registersService = selectionContext.resolveService();
+ } catch (CoreException e) {
+ failed(e);
+ return;
+ }
+
+ registersService.removeRegisterGroups(groups,
+ new RequestMonitor(registersService.getExecutor(), null) {
+ });
+ }
+ });
} catch (DebugException e) {
}
}
@@ -337,13 +338,13 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
// No DM context present or group registers service found in the selection
return false;
}
-
+
//resolve the selected groups
final IRegisterGroupDMContext[] groups = resolveSelectedGroups(selection);
- if (groups == null || groups.length < 1){
+ if (groups == null || groups.length < 1) {
return false;
}
-
+
//Prepare to Query the service and check if the selected groups can be removed
Query<Boolean> query = new Query<Boolean>() {
@Override
@@ -357,11 +358,11 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
rm.done();
return;
}
-
+
regService.canRemoveRegisterGroups(groups, rm);
}
};
-
+
//Execute the query
selectionContext.fsession.getExecutor().execute(query);
@@ -371,7 +372,7 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
}
-
+
// No positive answer from the service
return false;
}
@@ -399,7 +400,8 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
}
// no success handler needed
- registersService.restoreDefaultGroups(null, new RequestMonitor(registersService.getExecutor(), null));
+ registersService.restoreDefaultGroups(null,
+ new RequestMonitor(registersService.getExecutor(), null));
}
});
} catch (DebugException e) {
@@ -418,7 +420,7 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
// No DM context present or group registers service found in the selection
return false;
}
-
+
//Prepare to Query the service
Query<Boolean> query = new Query<Boolean>() {
@Override
@@ -432,11 +434,11 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
rm.done();
return;
}
-
+
regService.canRestoreDefaultGroups(selectionContext.fcontext, rm);
}
};
-
+
//Execute the query
selectionContext.fsession.getExecutor().execute(query);
@@ -446,100 +448,106 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
} catch (InterruptedException e) {
} catch (ExecutionException e) {
}
-
+
// No positive answer from the service
return false;
}
@ConfinedToDsfExecutor("selectionContext.fsession.getExecutor()")
- private void processAddRegisterGroup(final Shell shell, final SelectionDMContext selectionContext, final IRegisterDMContext[] selectedRegisters,
- final IRegisters2 regServiceManager) {
+ private void processAddRegisterGroup(final Shell shell, final SelectionDMContext selectionContext,
+ final IRegisterDMContext[] selectedRegisters, final IRegisters2 regServiceManager) {
final DsfSession session = selectionContext.fsession;
final DsfExecutor executor = session.getExecutor();
- final IContainerDMContext contDmc = DMContexts.getAncestorOfType(selectionContext.fcontext, IContainerDMContext.class);
- // Using the container context to get all existing registers from the target instead of a limited set of registers for a selected group
- regServiceManager.getRegisters(contDmc, new DataRequestMonitor<IRegisterDMContext[]>(
- executor, null) {
-
+ final IContainerDMContext contDmc = DMContexts.getAncestorOfType(selectionContext.fcontext,
+ IContainerDMContext.class);
+ // Using the container context to get all existing registers from the target instead of a limited set of registers for a selected group
+ regServiceManager.getRegisters(contDmc, new DataRequestMonitor<IRegisterDMContext[]>(executor, null) {
+
@Override
protected void handleSuccess() {
// Get Register Contexts
final IRegisterDMContext[] rootRegisters = getData();
-
+
if (rootRegisters.length < 1) {
//The target is expected to have registers, an error has happened !
assert false;
noRegisterGroupFoundErr("Add Register Group", this); //$NON-NLS-1$
return;
}
-
+
//Find the root register group, containing all the registers associated to a target, from any of the root registers
- final IRegisterGroupDMContext rootGroupDmc = DMContexts.getAncestorOfType(rootRegisters[0], IRegisterGroupDMContext.class);
+ final IRegisterGroupDMContext rootGroupDmc = DMContexts.getAncestorOfType(rootRegisters[0],
+ IRegisterGroupDMContext.class);
// Get data for all available registers
- getRegistersData(rootRegisters, regServiceManager, new DataRequestMonitor<IRegisterDMData[]>(executor, null) {
- @Override
- protected void handleSuccess() {
- final IRegisterDMData[] rootRegistersData = getData();
-
- getRegistersData(selectedRegisters, regServiceManager, new DataRequestMonitor<IRegisterDMData[]>(executor, null) {
+ getRegistersData(rootRegisters, regServiceManager,
+ new DataRequestMonitor<IRegisterDMData[]>(executor, null) {
@Override
protected void handleSuccess() {
- // Get data for all selected registers i.e. selected for the new group
- final IRegisterDMData[] selectedRegistersData = getData();
-
- //Need the root group name to build register descriptors
- regServiceManager.getRegisterGroupData(rootGroupDmc,
- new DataRequestMonitor<IRegisterGroupDMData>(executor, null) {
+ final IRegisterDMData[] rootRegistersData = getData();
+
+ getRegistersData(selectedRegisters, regServiceManager,
+ new DataRequestMonitor<IRegisterDMData[]>(executor, null) {
@Override
protected void handleSuccess() {
- final IRegisterGroupDMData rootGroupData = getData();
- // request for the next unused group name to propose it to the user
- proposeGroupName(rootRegisters, regServiceManager, new DataRequestMonitor<String>(executor, null) {
+ // Get data for all selected registers i.e. selected for the new group
+ final IRegisterDMData[] selectedRegistersData = getData();
+
+ //Need the root group name to build register descriptors
+ regServiceManager.getRegisterGroupData(rootGroupDmc,
+ new DataRequestMonitor<IRegisterGroupDMData>(executor, null) {
@Override
protected void handleSuccess() {
- String proposedGroupName = getData();
-
- String rootGroupName = (rootGroupData == null) ? BLANK_STRING
- : rootGroupData.getName();
- // Create the Register descriptors
- DialogRegisterProvider descriptors = buildDescriptors(
- rootGroupName, rootRegisters,
- rootRegistersData,
- selectedRegistersData);
- // Create Dialog Resolve selection to DSF
- // Registers
- getDialogSelection(
- shell,
- proposedGroupName,
- descriptors.getAllRegisters(),
- descriptors.getcheckedRegisters(),
- new DataRequestMonitor<IRegisterGroupDescriptor>(
- executor, null) {
+ final IRegisterGroupDMData rootGroupData = getData();
+ // request for the next unused group name to propose it to the user
+ proposeGroupName(rootRegisters, regServiceManager,
+ new DataRequestMonitor<String>(executor, null) {
@Override
protected void handleSuccess() {
- try {
- addRegisterGroup(
- regServiceManager,
- getData(), contDmc);
- } catch (CoreException e) {
- failed(e);
- }
- };
+ String proposedGroupName = getData();
+
+ String rootGroupName = (rootGroupData == null)
+ ? BLANK_STRING
+ : rootGroupData.getName();
+ // Create the Register descriptors
+ DialogRegisterProvider descriptors = buildDescriptors(
+ rootGroupName, rootRegisters,
+ rootRegistersData,
+ selectedRegistersData);
+ // Create Dialog Resolve selection to DSF
+ // Registers
+ getDialogSelection(shell,
+ proposedGroupName,
+ descriptors.getAllRegisters(),
+ descriptors
+ .getcheckedRegisters(),
+ new DataRequestMonitor<IRegisterGroupDescriptor>(
+ executor, null) {
+ @Override
+ protected void handleSuccess() {
+ try {
+ addRegisterGroup(
+ regServiceManager,
+ getData(),
+ contDmc);
+ } catch (CoreException e) {
+ failed(e);
+ }
+ };
+ });
+ }
});
+
}
});
-
}
});
}
});
- }
- });
}
-
+
});
}
@@ -552,53 +560,57 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
rm.done();
}
- private void proposeGroupName(IRegisterDMContext[] registers, final IRegisters2 regServiceManager, final DataRequestMonitor<String> rm) {
- assert(registers != null && registers.length > 0);
-
+ private void proposeGroupName(IRegisterDMContext[] registers, final IRegisters2 regServiceManager,
+ final DataRequestMonitor<String> rm) {
+ assert (registers != null && registers.length > 0);
+
final DsfExecutor executor = regServiceManager.getExecutor();
if (registers != null && registers.length > 0) {
//First get all register group contexts, any register context can be used to resolve the container context
- regServiceManager.getRegisterGroups(registers[0], new DataRequestMonitor<IRegisterGroupDMContext[]>(executor, null) {
- @Override
- protected void handleSuccess() {
- IRegisterGroupDMContext[] groupsCtx = getData();
- assert (groupsCtx != null);
-
- final IRegisterGroupDMData[] groupsData = new IRegisterGroupDMData[groupsCtx.length];
-
- final CountingRequestMonitor crm = new CountingRequestMonitor(executor, rm) {
+ regServiceManager.getRegisterGroups(registers[0],
+ new DataRequestMonitor<IRegisterGroupDMContext[]>(executor, null) {
@Override
- protected void handleCompleted() {
- //GroupsData is resolved now
- //Select an unused name
- String unusedGroupName = Messages.ProposeGroupNameRoot + (resolveGroupNameWaterMark(groupsData) + 1);
- rm.setData(unusedGroupName);
- rm.done();
- }
- };
-
- //Resolve all register group data
- for (int i=0; i < groupsCtx.length; i++) {
- final int index = i;
- regServiceManager.getRegisterGroupData(groupsCtx[index], new DataRequestMonitor<IRegisterGroupDMData>(executor, crm){
- @Override
- protected void handleSuccess() {
- groupsData[index] = getData();
- crm.done();
+ protected void handleSuccess() {
+ IRegisterGroupDMContext[] groupsCtx = getData();
+ assert (groupsCtx != null);
+
+ final IRegisterGroupDMData[] groupsData = new IRegisterGroupDMData[groupsCtx.length];
+
+ final CountingRequestMonitor crm = new CountingRequestMonitor(executor, rm) {
+ @Override
+ protected void handleCompleted() {
+ //GroupsData is resolved now
+ //Select an unused name
+ String unusedGroupName = Messages.ProposeGroupNameRoot
+ + (resolveGroupNameWaterMark(groupsData) + 1);
+ rm.setData(unusedGroupName);
+ rm.done();
+ }
+ };
+
+ //Resolve all register group data
+ for (int i = 0; i < groupsCtx.length; i++) {
+ final int index = i;
+ regServiceManager.getRegisterGroupData(groupsCtx[index],
+ new DataRequestMonitor<IRegisterGroupDMData>(executor, crm) {
+ @Override
+ protected void handleSuccess() {
+ groupsData[index] = getData();
+ crm.done();
+ }
+ });
}
- });
- }
-
- crm.setDoneCount(groupsCtx.length);
- }
- });
+
+ crm.setDoneCount(groupsCtx.length);
+ }
+ });
} else {
//Should not happen
rm.setData(Messages.DefaultRegistersGroupName);
rm.done();
}
}
-
+
// Adjust water mark suffix used to suggest register group names
private Integer resolveGroupNameWaterMark(IRegisterGroupDMData[] groupsData) {
// check only for this name pattern
@@ -623,14 +635,15 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
// Quite unlikely and only causing a possibility to
// propose a group name that already exists.
}
- }
+ }
}
-
+
return Integer.valueOf(water_mark);
}
-
+
@ConfinedToDsfExecutor("selectionContext.fsession.getExecutor()")
- private void processEditRegisterGroup(final Shell shell, final SelectionDMContext selectionContext, final IRegisters2 regServiceManager) {
+ private void processEditRegisterGroup(final Shell shell, final SelectionDMContext selectionContext,
+ final IRegisters2 regServiceManager) {
final DsfSession session = selectionContext.fsession;
final DsfExecutor executor = session.getExecutor();
@@ -646,94 +659,110 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
protected void handleSuccess() {
// Get children Register Contexts
final IRegisterDMContext[] childRegisters = getData();
-
- final IContainerDMContext contDmc = DMContexts.getAncestorOfType(selectionContext.fcontext, IContainerDMContext.class);
- // Using the container context to get all existing registers from the target instead of a limited set of registers for a selected group
+
+ final IContainerDMContext contDmc = DMContexts.getAncestorOfType(selectionContext.fcontext,
+ IContainerDMContext.class);
+ // Using the container context to get all existing registers from the target instead of a limited set of registers for a selected group
// This is needed to populate the dialog with all available registers to pick from
- regServiceManager.getRegisters(contDmc, new DataRequestMonitor<IRegisterDMContext[]>(
- executor, null) {
- @Override
- protected void handleSuccess() {
- final IRegisterDMContext[] rootRegisters = getData();
-
- if (rootRegisters.length < 1) {
- //The target is expected to have a root register group and associated registers, an error has happened !
- assert false;
- noRegisterGroupFoundErr("Edit Register Group", this); //$NON-NLS-1$
- return;
- }
-
- // We need to resolve the names for all root registers
- getRegistersData(rootRegisters, regServiceManager, new DataRequestMonitor<IRegisterDMData[]>(executor, null) {
+ regServiceManager.getRegisters(contDmc,
+ new DataRequestMonitor<IRegisterDMContext[]>(executor, null) {
@Override
protected void handleSuccess() {
- final IRegisterDMData[] rootRegistersData = getData();
-
- getRegistersData(childRegisters, regServiceManager, new DataRequestMonitor<IRegisterDMData[]>(executor, null) {
- @Override
- protected void handleSuccess() {
- // Get register data for all selected registers i.e. selected for the new group
- final IRegisterDMData[] childRegisterData = getData();
-
- // Need to get the parent group name. Used on the register descriptors
- final IRegisterGroupDMContext rootGroupDmc = DMContexts.getAncestorOfType(rootRegisters[0], IRegisterGroupDMContext.class);
- regServiceManager.getRegisterGroupData(rootGroupDmc,
- new DataRequestMonitor<IRegisterGroupDMData>(
- executor, null) {
- @Override
- protected void handleSuccess() {
- IRegisterGroupDMData rootGroupData = getData();
- final String rootGroupName = (rootGroupData == null) ? BLANK_STRING
- : rootGroupData.getName();
-
- regServiceManager.getRegisterGroupData(groupDmc,
- new DataRequestMonitor<IRegisterGroupDMData>(
- executor, null) {
- @Override
- protected void handleSuccess() {
- // Resolve the name of the selected group being edited
- String selGroupName = getData().getName();
- // Create the Register descriptors to
- // access all children registers
- DialogRegisterProvider descriptors = buildDescriptors(
- rootGroupName, rootRegisters,
- rootRegistersData,
- childRegisterData);
-
- // Create Dialog to Resolve new user
- // selection of group name and registers
- getDialogSelection(
- shell,
- selGroupName,
- descriptors.getAllRegisters(),
- descriptors
- .getcheckedRegisters(),
- new DataRequestMonitor<IRegisterGroupDescriptor>(
- executor, null) {
- @Override
- protected void handleSuccess() {
- try {
- editRegisterGroup(
- groupDmc,
- regServiceManager,
- getData());
- } catch (CoreException e) {
- failed(e);
- }
- };
- });
- }
- });
- };
-
- });
- }
- });
-
+ final IRegisterDMContext[] rootRegisters = getData();
+
+ if (rootRegisters.length < 1) {
+ //The target is expected to have a root register group and associated registers, an error has happened !
+ assert false;
+ noRegisterGroupFoundErr("Edit Register Group", this); //$NON-NLS-1$
+ return;
+ }
+
+ // We need to resolve the names for all root registers
+ getRegistersData(rootRegisters, regServiceManager,
+ new DataRequestMonitor<IRegisterDMData[]>(executor, null) {
+ @Override
+ protected void handleSuccess() {
+ final IRegisterDMData[] rootRegistersData = getData();
+
+ getRegistersData(childRegisters, regServiceManager,
+ new DataRequestMonitor<IRegisterDMData[]>(executor,
+ null) {
+ @Override
+ protected void handleSuccess() {
+ // Get register data for all selected registers i.e. selected for the new group
+ final IRegisterDMData[] childRegisterData = getData();
+
+ // Need to get the parent group name. Used on the register descriptors
+ final IRegisterGroupDMContext rootGroupDmc = DMContexts
+ .getAncestorOfType(rootRegisters[0],
+ IRegisterGroupDMContext.class);
+ regServiceManager.getRegisterGroupData(
+ rootGroupDmc,
+ new DataRequestMonitor<IRegisterGroupDMData>(
+ executor, null) {
+ @Override
+ protected void handleSuccess() {
+ IRegisterGroupDMData rootGroupData = getData();
+ final String rootGroupName = (rootGroupData == null)
+ ? BLANK_STRING
+ : rootGroupData
+ .getName();
+
+ regServiceManager
+ .getRegisterGroupData(
+ groupDmc,
+ new DataRequestMonitor<IRegisterGroupDMData>(
+ executor,
+ null) {
+ @Override
+ protected void handleSuccess() {
+ // Resolve the name of the selected group being edited
+ String selGroupName = getData()
+ .getName();
+ // Create the Register descriptors to
+ // access all children registers
+ DialogRegisterProvider descriptors = buildDescriptors(
+ rootGroupName,
+ rootRegisters,
+ rootRegistersData,
+ childRegisterData);
+
+ // Create Dialog to Resolve new user
+ // selection of group name and registers
+ getDialogSelection(
+ shell,
+ selGroupName,
+ descriptors
+ .getAllRegisters(),
+ descriptors
+ .getcheckedRegisters(),
+ new DataRequestMonitor<IRegisterGroupDescriptor>(
+ executor,
+ null) {
+ @Override
+ protected void handleSuccess() {
+ try {
+ editRegisterGroup(
+ groupDmc,
+ regServiceManager,
+ getData());
+ } catch (CoreException e) {
+ failed(e);
+ }
+ };
+ });
+ }
+ });
+ };
+
+ });
+ }
+ });
+
+ }
+ });
}
});
- }
- });
}
});
}
@@ -799,9 +828,8 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
}
@ConfinedToDsfExecutor("selectionContext.fsession.getExecutor()")
- private void getDialogSelection(Shell shell, String originalGroupName,
- IRegisterDescriptor[] allRegisters, IRegisterDescriptor[] checkedRegisters,
- DataRequestMonitor<IRegisterGroupDescriptor> rm) {
+ private void getDialogSelection(Shell shell, String originalGroupName, IRegisterDescriptor[] allRegisters,
+ IRegisterDescriptor[] checkedRegisters, DataRequestMonitor<IRegisterGroupDescriptor> rm) {
RegisterGroupDialogRunnable dialog = new RegisterGroupDialogRunnable(shell, originalGroupName, allRegisters,
checkedRegisters, rm);
shell.getDisplay().asyncExec(dialog);
@@ -833,7 +861,7 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
/**
* Build descriptor adapters to dialog interface both all registers as well as registers to be pre-selected on the
* dialog
- *
+ *
* @param checkedRegistersData
*/
@ConfinedToDsfExecutor("selectionContext.fsession.getExecutor()")
@@ -885,24 +913,24 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
}
@ConfinedToDsfExecutor("selectionContext.fsession.getExecutor()")
- private void addRegisterGroup(IRegisters2 regServiceManager,
- IRegisterGroupDescriptor groupDescriptor, IContainerDMContext contDmc) throws CoreException {
+ private void addRegisterGroup(IRegisters2 regServiceManager, IRegisterGroupDescriptor groupDescriptor,
+ IContainerDMContext contDmc) throws CoreException {
IRegisterDescriptor[] selectedRegisters = groupDescriptor.getChildren();
if (selectedRegisters != null) {
String groupName = groupDescriptor.getName();
// Register the addition of the group and notify the change
IRegisterDMContext[] registers = getRegisterContexts(selectedRegisters);
- regServiceManager.addRegisterGroup(contDmc, groupName, registers, new RequestMonitor(
- regServiceManager.getSession().getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (getStatus() != null && getStatus().getCode() == IDsfStatusConstants.NOT_SUPPORTED) {
- // This user request is not supported, notify the user
- notifyUser(getStatus().getMessage());
- }
+ regServiceManager.addRegisterGroup(contDmc, groupName, registers,
+ new RequestMonitor(regServiceManager.getSession().getExecutor(), null) {
+ @Override
+ protected void handleCompleted() {
+ if (getStatus() != null && getStatus().getCode() == IDsfStatusConstants.NOT_SUPPORTED) {
+ // This user request is not supported, notify the user
+ notifyUser(getStatus().getMessage());
+ }
- };
- });
+ };
+ });
}
}
@@ -915,15 +943,15 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
// Register the addition of the group and notify the change
regServiceManager.editRegisterGroup(group, groupName, getRegisterContexts(selectedRegisters),
new RequestMonitor(regServiceManager.getSession().getExecutor(), null) {
- @Override
- protected void handleCompleted() {
- if (getStatus() != null && getStatus().getCode() == IDsfStatusConstants.NOT_SUPPORTED) {
- // This user request is not supported, notify the user
- notifyUser(getStatus().getMessage());
- }
-
- };
- });
+ @Override
+ protected void handleCompleted() {
+ if (getStatus() != null && getStatus().getCode() == IDsfStatusConstants.NOT_SUPPORTED) {
+ // This user request is not supported, notify the user
+ notifyUser(getStatus().getMessage());
+ }
+
+ };
+ });
}
}
@@ -934,13 +962,14 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
}
private void notifyUser(final String message) {
-
+
Runnable runnable = new Runnable() {
@Override
public void run() {
Shell parent = DsfUIPlugin.getActiveWorkbenchShell();
if (parent != null) {
- MessageDialog.openInformation(parent, Messages.Information, Messages.RegisterGroupInfo + ": " + message); //$NON-NLS-1$
+ MessageDialog.openInformation(parent, Messages.Information,
+ Messages.RegisterGroupInfo + ": " + message); //$NON-NLS-1$
}
}
};
@@ -948,47 +977,47 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
Display.getDefault().asyncExec(runnable);
}
- /**
- * @return true - OK to restore
- */
- private boolean restoreConfirmed() {
- ConfirmRestoreDialog restoreDialog = new ConfirmRestoreDialog();
+ /**
+ * @return true - OK to restore
+ */
+ private boolean restoreConfirmed() {
+ ConfirmRestoreDialog restoreDialog = new ConfirmRestoreDialog();
Display.getDefault().syncExec(restoreDialog);
- return restoreDialog.fRestore;
- }
-
- private class ConfirmRestoreDialog implements Runnable {
+ return restoreDialog.fRestore;
+ }
+
+ private class ConfirmRestoreDialog implements Runnable {
+
+ private Boolean fRestore = false;
- private Boolean fRestore = false;
-
@Override
public void run() {
Shell parent = DsfUIPlugin.getActiveWorkbenchShell();
if (parent != null) {
-
- String title = Messages.RegisterGroupConfirmRestoreTitle;
- String message = Messages.RegisterGroupConfirmRestoreMessage;
- String[] buttonLabels = new String[]{Messages.RegisterGroupRestore, Messages.RegisterGroupRestoreCancel,
- };
- MessageDialog dialog = new MessageDialog(parent, title, null, message, MessageDialog.QUESTION,
- buttonLabels, 0);
- int res = dialog.open();
- if (res == 0) { // RESTORE
- fRestore = true;
- } else if (res == 1) { // CANCEL
- fRestore = false;
- }
- }
+
+ String title = Messages.RegisterGroupConfirmRestoreTitle;
+ String message = Messages.RegisterGroupConfirmRestoreMessage;
+ String[] buttonLabels = new String[] { Messages.RegisterGroupRestore,
+ Messages.RegisterGroupRestoreCancel, };
+ MessageDialog dialog = new MessageDialog(parent, title, null, message, MessageDialog.QUESTION,
+ buttonLabels, 0);
+ int res = dialog.open();
+ if (res == 0) { // RESTORE
+ fRestore = true;
+ } else if (res == 1) { // CANCEL
+ fRestore = false;
+ }
+ }
}
-
- }
-
-
- private void getRegistersData(IRegisterDMContext[] regDMCs, IRegisters2 regService, final DataRequestMonitor<IRegisterDMData[]> rm) {
+
+ }
+
+ private void getRegistersData(IRegisterDMContext[] regDMCs, IRegisters2 regService,
+ final DataRequestMonitor<IRegisterDMData[]> rm) {
final IRegisterDMData[] regDataArray = new IRegisterDMData[regDMCs.length];
final DsfExecutor executor = regService.getExecutor();
-
+
final CountingRequestMonitor crm = new CountingRequestMonitor(executor, rm) {
@Override
protected void handleSuccess() {
@@ -996,7 +1025,7 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
rm.done();
}
};
-
+
for (int i = 0; i < regDMCs.length; i++) {
final int index = i;
regService.getRegisterData(regDMCs[index], new DataRequestMonitor<IRegisterDMData>(executor, crm) {
@@ -1007,7 +1036,7 @@ public abstract class AbstractDsfRegisterGroupActions extends AbstractHandler {
}
});
}
-
+
crm.setDoneCount(regDMCs.length);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java
index 4ee134cb34a..813ec81f035 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyMoveToLineAdapter.java
@@ -35,7 +35,7 @@ import org.eclipse.ui.IWorkbenchPart;
/**
* Move to line target adapter for the DSF Disassembly view
- *
+ *
* @since 2.1
*/
public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget {
@@ -44,37 +44,36 @@ public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget {
public void moveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
if (!(selection instanceof IDisassemblySelection)) {
- selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
}
- IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection) selection;
final IAddress address = disassemblySelection.getStartAddress();
-
- if (address != null && target instanceof IAdaptable) {
- final IMoveToAddress moveToAddress = ((IAdaptable)target).getAdapter(IMoveToAddress.class);
- if (moveToAddress != null && moveToAddress.canMoveToAddress(address)) {
- try {
- moveToAddress.moveToAddress(address);
- }
- catch(DebugException e) {
- failed(e);
- }
- }
- }
+
+ if (address != null && target instanceof IAdaptable) {
+ final IMoveToAddress moveToAddress = ((IAdaptable) target).getAdapter(IMoveToAddress.class);
+ if (moveToAddress != null && moveToAddress.canMoveToAddress(address)) {
+ try {
+ moveToAddress.moveToAddress(address);
+ } catch (DebugException e) {
+ failed(e);
+ }
+ }
+ }
}
}
@Override
public boolean canMoveToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
- IMoveToAddress moveToAddress = ((IAdaptable)target).getAdapter(IMoveToAddress.class);
+ IMoveToAddress moveToAddress = ((IAdaptable) target).getAdapter(IMoveToAddress.class);
if (moveToAddress == null) {
return false;
}
-
+
if (!(selection instanceof IDisassemblySelection)) {
- selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
}
- IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection) selection;
final IAddress address = disassemblySelection.getStartAddress();
if (address == null) {
return false;
@@ -86,9 +85,11 @@ public class DisassemblyMoveToLineAdapter implements IMoveToLineTarget {
return false;
}
- protected void failed( Throwable e ) {
- MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "MoveToLine failed", null); //$NON-NLS-1$
- ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
+ protected void failed(Throwable e) {
+ MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED,
+ "MoveToLine failed", null); //$NON-NLS-1$
+ ms.add(new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED,
+ e.getMessage(), e));
DsfUIPlugin.log(ms);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java
index cc6a828a37f..dd03333db71 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyResumeAtLineAdapter.java
@@ -35,46 +35,45 @@ import org.eclipse.ui.IWorkbenchPart;
/**
* Resume at line target adapter for the DSF Disassembly view
- *
+ *
* @since 2.1
*/
public class DisassemblyResumeAtLineAdapter implements IResumeAtLineTarget {
@Override
- public void resumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
+ public void resumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
if (!(selection instanceof IDisassemblySelection)) {
- selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
}
- IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection) selection;
final IAddress address = disassemblySelection.getStartAddress();
- if (address != null && target instanceof IAdaptable) {
- final IResumeAtAddress resumeAtAddress = ((IAdaptable)target).getAdapter(IResumeAtAddress.class);
- if (resumeAtAddress != null && resumeAtAddress.canResumeAtAddress(address)) {
- try {
- resumeAtAddress.resumeAtAddress(address);
- }
- catch(DebugException e) {
- failed(e);
- }
- }
- }
+ if (address != null && target instanceof IAdaptable) {
+ final IResumeAtAddress resumeAtAddress = ((IAdaptable) target).getAdapter(IResumeAtAddress.class);
+ if (resumeAtAddress != null && resumeAtAddress.canResumeAtAddress(address)) {
+ try {
+ resumeAtAddress.resumeAtAddress(address);
+ } catch (DebugException e) {
+ failed(e);
+ }
+ }
+ }
}
}
@Override
public boolean canResumeAtLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
- IResumeAtAddress resumeAtAddress = ((IAdaptable)target).getAdapter(IResumeAtAddress.class);
+ IResumeAtAddress resumeAtAddress = ((IAdaptable) target).getAdapter(IResumeAtAddress.class);
if (resumeAtAddress == null) {
return false;
}
-
+
if (!(selection instanceof IDisassemblySelection)) {
- selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
}
- IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection) selection;
final IAddress address = disassemblySelection.getStartAddress();
if (address == null) {
return false;
@@ -86,9 +85,11 @@ public class DisassemblyResumeAtLineAdapter implements IResumeAtLineTarget {
return false;
}
- protected void failed( Throwable e ) {
- MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "Resume At Line failed", null); //$NON-NLS-1$
- ms.add( new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e));
+ protected void failed(Throwable e) {
+ MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED,
+ "Resume At Line failed", null); //$NON-NLS-1$
+ ms.add(new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED,
+ e.getMessage(), e));
DsfUIPlugin.log(ms);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java
index 73100505ae3..86f6cfe1964 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DisassemblyRunToLineAdapter.java
@@ -37,7 +37,7 @@ import org.eclipse.ui.IWorkbenchPart;
/**
* Run to line target adapter for the DSF Disassembly view
- *
+ *
* @since 2.1
*/
public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
@@ -49,21 +49,21 @@ public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
public void runToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) throws CoreException {
if (part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
if (!(selection instanceof IDisassemblySelection)) {
- selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
}
- IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection) selection;
final IAddress address = disassemblySelection.getStartAddress();
if (address != null && target instanceof IAdaptable) {
- final IRunToAddress runToAddress = ((IAdaptable)target).getAdapter(IRunToAddress.class);
+ final IRunToAddress runToAddress = ((IAdaptable) target).getAdapter(IRunToAddress.class);
if (runToAddress != null && runToAddress.canRunToAddress(address)) {
try {
- boolean skipBreakpoints = DebugUITools.getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE);
- runToAddress.runToAddress(address, skipBreakpoints);
- }
- catch(DebugException e) {
+ boolean skipBreakpoints = DebugUITools.getPreferenceStore()
+ .getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE);
+ runToAddress.runToAddress(address, skipBreakpoints);
+ } catch (DebugException e) {
failed(e);
- }
+ }
}
}
}
@@ -75,15 +75,15 @@ public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
@Override
public boolean canRunToLine(IWorkbenchPart part, ISelection selection, ISuspendResume target) {
if (target instanceof IAdaptable && part instanceof IDisassemblyPart && selection instanceof ITextSelection) {
- IRunToAddress runToAddress = ((IAdaptable)target).getAdapter(IRunToAddress.class);
+ IRunToAddress runToAddress = ((IAdaptable) target).getAdapter(IRunToAddress.class);
if (runToAddress == null) {
return false;
}
-
+
if (!(selection instanceof IDisassemblySelection)) {
- selection = new DisassemblySelection((ITextSelection)selection, (IDisassemblyPart)part);
+ selection = new DisassemblySelection((ITextSelection) selection, (IDisassemblyPart) part);
}
- IDisassemblySelection disassemblySelection = (IDisassemblySelection)selection;
+ IDisassemblySelection disassemblySelection = (IDisassemblySelection) selection;
final IAddress address = disassemblySelection.getStartAddress();
if (address == null) {
return false;
@@ -95,9 +95,11 @@ public class DisassemblyRunToLineAdapter implements IRunToLineTarget {
return false;
}
- protected void failed( Throwable e ) {
- MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, "RunToLine failed", null ); //$NON-NLS-1$
- ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED, e.getMessage(), e ) );
+ protected void failed(Throwable e) {
+ MultiStatus ms = new MultiStatus(CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED,
+ "RunToLine failed", null); //$NON-NLS-1$
+ ms.add(new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), IDsfStatusConstants.REQUEST_FAILED,
+ e.getMessage(), e));
DsfUIPlugin.log(ms);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfAddRegisterGroupCommand.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfAddRegisterGroupCommand.java
index bf382377a4a..c53761dcf17 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfAddRegisterGroupCommand.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfAddRegisterGroupCommand.java
@@ -29,23 +29,23 @@ public class DsfAddRegisterGroupCommand extends AbstractDsfRegisterGroupActions
@Override
public void setEnabled(Object evaluationContext) {
boolean state = false;
- if (evaluationContext instanceof IEvaluationContext) {
- Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
- Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
- if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
- state = canAddRegisterGroup((IWorkbenchPart)p, (IStructuredSelection)s);
- }
- }
+ if (evaluationContext instanceof IEvaluationContext) {
+ Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
+ Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
+ if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
+ state = canAddRegisterGroup((IWorkbenchPart) p, (IStructuredSelection) s);
+ }
+ }
setBaseEnabled(state);
}
-
+
@Override
public Object execute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (selection instanceof IStructuredSelection) {
- addRegisterGroup(part, (IStructuredSelection)selection);
+ addRegisterGroup(part, (IStructuredSelection) selection);
}
- return null;
- }
+ return null;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfEditRegisterGroupCommand.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfEditRegisterGroupCommand.java
index c9cb7b10c13..656b80c268d 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfEditRegisterGroupCommand.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfEditRegisterGroupCommand.java
@@ -29,23 +29,23 @@ public class DsfEditRegisterGroupCommand extends AbstractDsfRegisterGroupActions
@Override
public void setEnabled(Object evaluationContext) {
boolean state = false;
- if (evaluationContext instanceof IEvaluationContext) {
- Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
- Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
- if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
- state = canEditRegisterGroup((IWorkbenchPart)p, (IStructuredSelection)s);
- }
- }
+ if (evaluationContext instanceof IEvaluationContext) {
+ Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
+ Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
+ if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
+ state = canEditRegisterGroup((IWorkbenchPart) p, (IStructuredSelection) s);
+ }
+ }
setBaseEnabled(state);
}
-
+
@Override
public Object execute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (selection instanceof IStructuredSelection) {
- editRegisterGroup(part, (IStructuredSelection)selection);
+ editRegisterGroup(part, (IStructuredSelection) selection);
}
- return null;
- }
+ return null;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRemoveRegisterGroupsCommand.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRemoveRegisterGroupsCommand.java
index f1766f7416f..bac37622572 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRemoveRegisterGroupsCommand.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRemoveRegisterGroupsCommand.java
@@ -29,23 +29,23 @@ public class DsfRemoveRegisterGroupsCommand extends AbstractDsfRegisterGroupActi
@Override
public void setEnabled(Object evaluationContext) {
boolean state = false;
- if (evaluationContext instanceof IEvaluationContext) {
- Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
- Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
- if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
- state = canRemoveRegisterGroups((IWorkbenchPart)p, (IStructuredSelection)s);
- }
- }
+ if (evaluationContext instanceof IEvaluationContext) {
+ Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
+ Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
+ if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
+ state = canRemoveRegisterGroups((IWorkbenchPart) p, (IStructuredSelection) s);
+ }
+ }
setBaseEnabled(state);
}
-
+
@Override
public Object execute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (selection instanceof IStructuredSelection) {
- removeRegisterGroups(part, (IStructuredSelection)selection);
+ removeRegisterGroups(part, (IStructuredSelection) selection);
}
- return null;
- }
+ return null;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRestoreRegisterGroupsCommand.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRestoreRegisterGroupsCommand.java
index 145cf4788f1..d075f8092ed 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRestoreRegisterGroupsCommand.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/DsfRestoreRegisterGroupsCommand.java
@@ -29,23 +29,23 @@ public class DsfRestoreRegisterGroupsCommand extends AbstractDsfRegisterGroupAct
@Override
public void setEnabled(Object evaluationContext) {
boolean state = false;
- if (evaluationContext instanceof IEvaluationContext) {
- Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
- Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
- if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
- state = canRestoreDefaultGroups((IWorkbenchPart)p, (IStructuredSelection)s);
- }
- }
+ if (evaluationContext instanceof IEvaluationContext) {
+ Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
+ Object p = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_PART_NAME);
+ if (s instanceof IStructuredSelection && p instanceof IWorkbenchPart) {
+ state = canRestoreDefaultGroups((IWorkbenchPart) p, (IStructuredSelection) s);
+ }
+ }
setBaseEnabled(state);
}
-
+
@Override
public Object execute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (selection instanceof IStructuredSelection) {
- restoreDefaultGroups(part, (IStructuredSelection)selection);
+ restoreDefaultGroups(part, (IStructuredSelection) selection);
}
- return null;
- }
+ return null;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java
index d5c519fe163..ad3dd7c4b7c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/IDsfActionsConstants.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IAR Systems - initial API and implementation
*******************************************************************************/
@@ -15,16 +15,15 @@ package org.eclipse.cdt.dsf.debug.internal.ui.actions;
/**
* Constants used by the DSF UI action adapters
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
interface IDsfActionsConstants {
/**
- * The timeout in ms which action adapters will wait before disabling
+ * The timeout in ms which action adapters will wait before disabling
* the action itself, in order to avoid blocking the UI thread while
* waiting for the DSF thread to service a blocking query.
*/
static final int ACTION_ADAPTERS_TIMEOUT_MS = 500;
}
-
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
index c71a1262cf6..351438eb986 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/MoveToLine.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -35,158 +35,162 @@ import org.eclipse.debug.core.DebugException;
/**
* Implements the CDT's move to line interface.
- *
+ *
* @since 2.1
*/
public class MoveToLine implements IMoveToLine, IMoveToAddress {
- private final IExecutionDMContext fContext;
+ private final IExecutionDMContext fContext;
- public MoveToLine(IExecutionDMContext context) {
- fContext = context;
- }
+ public MoveToLine(IExecutionDMContext context) {
+ fContext = context;
+ }
- @Override
+ @Override
public boolean canMoveToLine(final String fileName, final int lineNumber) {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- try {
- Query<Boolean> query = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.canMoveToLine(fContext, fileName, lineNumber, false, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (TimeoutException e) {
- }
- }
- return false;
- }
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
- @Override
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToLine(fContext, fileName, lineNumber, false, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (TimeoutException e) {
+ }
+ }
+ return false;
+ }
+
+ @Override
public void moveToLine(final String fileName, final int lineNumber) throws DebugException {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- Throwable exception = null;
- try {
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.moveToLine(
- fContext, fileName, lineNumber, false, rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- query.get();
- } catch (RejectedExecutionException e) {
- exception = e;
- } catch (InterruptedException e) {
- exception = e;
- } catch (ExecutionException e) {
- exception = e;
- }
- if (exception != null) {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Failed executing move to line", exception)); //$NON-NLS-1$
- }
- } else {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
- }
- }
-
- @Override
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToLine(fContext, fileName, lineNumber, false, rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Failed executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
+ @Override
public boolean canMoveToAddress(final IAddress address) {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- try {
- Query<Boolean> query = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.canMoveToAddress(fContext, address, false, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (TimeoutException e) {
- }
- }
- return false;
- }
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToAddress(fContext, address, false, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (TimeoutException e) {
+ }
+ }
+ return false;
+ }
- @Override
+ @Override
public void moveToAddress(final IAddress address) throws DebugException {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- Throwable exception = null;
- try {
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.moveToAddress(
- fContext, address, false, rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- query.get();
- } catch (RejectedExecutionException e) {
- exception = e;
- } catch (InterruptedException e) {
- exception = e;
- } catch (ExecutionException e) {
- exception = e;
- }
- if (exception != null) {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Failed executing move to line", exception)); //$NON-NLS-1$
- }
- } else {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
- }
- }
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToAddress(fContext, address, false, rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Failed executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
index f82399a734f..d08c8d3f5e5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/ResumeAtLine.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
@@ -36,16 +36,16 @@ import org.eclipse.debug.core.DebugException;
/**
* Implements the CDT's resume at line interface.
- *
+ *
* @since 2.1
*/
public class ResumeAtLine implements IResumeAtLine, IResumeAtAddress {
- private final IExecutionDMContext fContext;
+ private final IExecutionDMContext fContext;
- public ResumeAtLine(IExecutionDMContext context) {
- fContext = context;
- }
+ public ResumeAtLine(IExecutionDMContext context) {
+ fContext = context;
+ }
@Override
public boolean canResumeAtLine(IFile file, final int lineNumber) {
@@ -54,151 +54,155 @@ public class ResumeAtLine implements IResumeAtLine, IResumeAtAddress {
@Override
public boolean canResumeAtLine(final String fileName, final int lineNumber) {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- try {
- Query<Boolean> query = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.canMoveToLine(fContext, fileName, lineNumber, true, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (TimeoutException e) {
- }
- }
- return false;
- }
-
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToLine(fContext, fileName, lineNumber, true, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (TimeoutException e) {
+ }
+ }
+ return false;
+ }
+
@Override
public void resumeAtLine(IFile file, int lineNumber) throws DebugException {
resumeAtLine(file.getLocation().makeAbsolute().toOSString(), lineNumber);
}
-
+
@Override
public void resumeAtLine(final String fileName, final int lineNumber) throws DebugException {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- Throwable exception = null;
- try {
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.moveToLine(
- fContext, fileName, lineNumber, true, rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- query.get();
- } catch (RejectedExecutionException e) {
- exception = e;
- } catch (InterruptedException e) {
- exception = e;
- } catch (ExecutionException e) {
- exception = e;
- }
- if (exception != null) {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Failed executing move to line", exception)); //$NON-NLS-1$
- }
- } else {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
- }
- }
-
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToLine(fContext, fileName, lineNumber, true, rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Failed executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
@Override
public boolean canResumeAtAddress(final IAddress address) {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- try {
- Query<Boolean> query = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.canMoveToAddress(fContext, address, true, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (TimeoutException e) {
- }
- }
- return false;
- }
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canMoveToAddress(fContext, address, true, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (TimeoutException e) {
+ }
+ }
+ return false;
+ }
@Override
public void resumeAtAddress(final IAddress address) throws DebugException {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- Throwable exception = null;
- try {
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.moveToAddress(
- fContext, address, true, rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- query.get();
- } catch (RejectedExecutionException e) {
- exception = e;
- } catch (InterruptedException e) {
- exception = e;
- } catch (ExecutionException e) {
- exception = e;
- }
- if (exception != null) {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Failed executing move to line", exception)); //$NON-NLS-1$
- }
- } else {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
- }
- }
-
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.moveToAddress(fContext, address, true, rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Failed executing move to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java
index 1f18ec28f7e..431c06ba4b7 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RetargettableActionAdapterFactory.java
@@ -20,7 +20,7 @@ import org.eclipse.debug.ui.actions.IRunToLineTarget;
/**
* Retargettable Action Adapter Factory for the DSF Disassembly view
- *
+ *
* @since 2.1
*/
public class RetargettableActionAdapterFactory implements IAdapterFactory {
@@ -32,13 +32,13 @@ public class RetargettableActionAdapterFactory implements IAdapterFactory {
@SuppressWarnings("unchecked")
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adapterType == IRunToLineTarget.class) {
- return (T)new DisassemblyRunToLineAdapter();
- }
+ return (T) new DisassemblyRunToLineAdapter();
+ }
if (adapterType == IMoveToLineTarget.class) {
- return (T)new DisassemblyMoveToLineAdapter();
- }
+ return (T) new DisassemblyMoveToLineAdapter();
+ }
if (adapterType == IResumeAtLineTarget.class) {
- return (T)new DisassemblyResumeAtLineAdapter();
+ return (T) new DisassemblyResumeAtLineAdapter();
}
return null;
}
@@ -48,6 +48,6 @@ public class RetargettableActionAdapterFactory implements IAdapterFactory {
*/
@Override
public Class<?>[] getAdapterList() {
- return new Class[]{ IRunToLineTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class };
+ return new Class[] { IRunToLineTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class };
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
index 38ffb06b6a4..956f40ee29a 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/actions/RunToLine.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Ericsson - Added support for IRunToAddress for DSF DisassemblyView (302324)
@@ -39,167 +39,173 @@ import org.eclipse.debug.ui.actions.IRunToLineTarget;
/**
* Implements the CDT's run to line interface. This interface is called by CDT's
* {@link IRunToLineTarget} implementation.
- *
+ *
* @since 2.1
*/
public class RunToLine implements IRunToLine, IRunToAddress {
- private final IExecutionDMContext fContext;
+ private final IExecutionDMContext fContext;
- public RunToLine(IExecutionDMContext context) {
- fContext = context;
- }
-
- @Override
+ public RunToLine(IExecutionDMContext context) {
+ fContext = context;
+ }
+
+ @Override
public boolean canRunToLine(final IFile file, final int lineNumber) {
- return canRunToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber);
- }
+ return canRunToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber);
+ }
- @Override
+ @Override
public boolean canRunToLine(final String fileName, final int lineNumber) {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- try {
- Query<Boolean> query = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.canRunToLine(fContext, fileName, lineNumber, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (TimeoutException e) {
- }
- }
- return false;
- }
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canRunToLine(fContext, fileName, lineNumber, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (TimeoutException e) {
+ }
+ }
+ return false;
+ }
- @Override
+ @Override
public void runToLine(IFile file, int lineNumber, boolean skipBreakpoints) throws DebugException {
- runToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber, skipBreakpoints);
- }
-
- @Override
- public void runToLine(final String fileName, final int lineNumber, final boolean skipBreakpoints) throws DebugException {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- Throwable exception = null;
- try {
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.runToLine(
- fContext, fileName, lineNumber, skipBreakpoints, rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- query.get();
- } catch (RejectedExecutionException e) {
- exception = e;
- } catch (InterruptedException e) {
- exception = e;
- } catch (ExecutionException e) {
- exception = e;
- }
- if (exception != null) {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Failed executing run to line", exception)); //$NON-NLS-1$
- }
- } else {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
- }
- }
-
+ runToLine(file.getLocation().makeAbsolute().toOSString(), lineNumber, skipBreakpoints);
+ }
+
+ @Override
+ public void runToLine(final String fileName, final int lineNumber, final boolean skipBreakpoints)
+ throws DebugException {
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.runToLine(fContext, fileName, lineNumber, skipBreakpoints, rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Failed executing run to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+
@Override
public boolean canRunToAddress(final IAddress address) {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- try {
- Query<Boolean> query = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.canRunToAddress(fContext, address, rm);
- } else {
- rm.setData(false);
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- } catch (RejectedExecutionException e) {
- } catch (InterruptedException e) {
- } catch (ExecutionException e) {
- } catch (TimeoutException e) {
- }
- }
- return false;
- }
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ try {
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.canRunToAddress(fContext, address, rm);
+ } else {
+ rm.setData(false);
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ return query.get(IDsfActionsConstants.ACTION_ADAPTERS_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ } catch (RejectedExecutionException e) {
+ } catch (InterruptedException e) {
+ } catch (ExecutionException e) {
+ } catch (TimeoutException e) {
+ }
+ }
+ return false;
+ }
@Override
public void runToAddress(final IAddress address, final boolean skipBreakpoints) throws DebugException {
- DsfSession session = DsfSession.getSession(fContext.getSessionId());
- if (session != null && session.isActive()) {
- Throwable exception = null;
- try {
- Query<Object> query = new Query<Object>() {
- @Override
- protected void execute(final DataRequestMonitor<Object> rm) {
- DsfServicesTracker tracker =
- new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fContext.getSessionId());
-
- IRunControl2 runControl = tracker.getService(IRunControl2.class);
- if (runControl != null) {
- runControl.runToAddress(fContext, address, skipBreakpoints, rm);
- } else {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
- rm.done();
- }
- tracker.dispose();
- }
- };
- session.getExecutor().execute(query);
- query.get();
- } catch (RejectedExecutionException e) {
- exception = e;
- } catch (InterruptedException e) {
- exception = e;
- } catch (ExecutionException e) {
- exception = e;
- }
- if (exception != null) {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Failed executing run to line", exception)); //$NON-NLS-1$
- }
- } else {
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Debug session is not active", null)); //$NON-NLS-1$
- }
- }
- }
+ DsfSession session = DsfSession.getSession(fContext.getSessionId());
+ if (session != null && session.isActive()) {
+ Throwable exception = null;
+ try {
+ Query<Object> query = new Query<Object>() {
+ @Override
+ protected void execute(final DataRequestMonitor<Object> rm) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ fContext.getSessionId());
+
+ IRunControl2 runControl = tracker.getService(IRunControl2.class);
+ if (runControl != null) {
+ runControl.runToAddress(fContext, address, skipBreakpoints, rm);
+ } else {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.NOT_SUPPORTED, "IRunControl2 service not available", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ tracker.dispose();
+ }
+ };
+ session.getExecutor().execute(query);
+ query.get();
+ } catch (RejectedExecutionException e) {
+ exception = e;
+ } catch (InterruptedException e) {
+ exception = e;
+ } catch (ExecutionException e) {
+ exception = e;
+ }
+ if (exception != null) {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Failed executing run to line", exception)); //$NON-NLS-1$
+ }
+ } else {
+ throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
+ "Debug session is not active", null)); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/DebugViewLayoutTester.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/DebugViewLayoutTester.java
index 04f44bf89d5..b33f5d334df 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/DebugViewLayoutTester.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/DebugViewLayoutTester.java
@@ -18,32 +18,32 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.core.expressions.PropertyTester;
/**
- * Property tester for debug view related commands - group, ungroup, hide, etc.
- *
+ * Property tester for debug view related commands - group, ungroup, hide, etc.
+ *
* @since 2.2
*/
-public class DebugViewLayoutTester extends PropertyTester{
-
+public class DebugViewLayoutTester extends PropertyTester {
+
public DebugViewLayoutTester() {
}
protected static final String IS_GROUP_VISIBLE = "isGroupDebugContextsVisible"; //$NON-NLS-1$
protected static final String IS_UNGROUP_VISIBLE = "isUngroupDebugContextsVisible"; //$NON-NLS-1$
-
+
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if( IS_GROUP_VISIBLE.equals(property) || IS_UNGROUP_VISIBLE.equals(property)) {
- if (receiver instanceof IDMVMContext) {
- return test((IDMVMContext)receiver);
- }
- }
- return false;
- }
-
- private boolean test(IDMVMContext dmContext) {
+ if (IS_GROUP_VISIBLE.equals(property) || IS_UNGROUP_VISIBLE.equals(property)) {
+ if (receiver instanceof IDMVMContext) {
+ return test((IDMVMContext) receiver);
+ }
+ }
+ return false;
+ }
+
+ private boolean test(IDMVMContext dmContext) {
String sessionId = dmContext.getDMContext().getSessionId();
return DsfSession.isSessionActive(sessionId);
- }
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfDebugViewLayoutCommand.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfDebugViewLayoutCommand.java
index 3ee859c9acb..b8e84e5438c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfDebugViewLayoutCommand.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfDebugViewLayoutCommand.java
@@ -35,86 +35,84 @@ import org.eclipse.debug.core.commands.IEnabledStateRequest;
/**
* @since 2.2
*/
-public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
-
- protected final DsfExecutor fExecutor;
- protected final DsfServicesTracker fTracker;
- protected static IExecutionDMContext[] EMPTY_ARRAY = new IExecutionDMContext[0];
-
- public DsfDebugViewLayoutCommand(DsfSession session) {
- fExecutor = session.getExecutor();
- fTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
- }
-
- public void dispose() {
- fTracker.dispose();
- }
-
- /**
- *
- * @param request
- * @return set of IExecutionDMContext if:
- * - all elements are from a DSF session.
- * - all elements are from the same DSF session.
- */
- protected IExecutionDMContext[] getDMContexts(IDebugCommandRequest request) {
-
- HashSet<IExecutionDMContext> ret = new HashSet<>();
- String sessionId = null;
-
- for (Object obj : request.getElements()) {
- if (!(obj instanceof IDMVMContext)) {
- return EMPTY_ARRAY;
- }
-
- IDMContext dmContext = ((IDMVMContext)obj).getDMContext();
- IExecutionDMContext exeContext = DMContexts.getAncestorOfType(dmContext, IExecutionDMContext.class);
-
- if (exeContext == null) {
- return EMPTY_ARRAY;
- }
-
- // make sure all elements are from the same DSF session.
- if (sessionId == null) {
- sessionId = dmContext.getSessionId();
- }
- else {
- if (!sessionId.equals(dmContext.getSessionId())) {
- return EMPTY_ARRAY;
- }
- }
-
- ret.add(exeContext);
- }
- return ret.toArray(new IExecutionDMContext[ret.size()]);
- }
-
+public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler {
+
+ protected final DsfExecutor fExecutor;
+ protected final DsfServicesTracker fTracker;
+ protected static IExecutionDMContext[] EMPTY_ARRAY = new IExecutionDMContext[0];
+
+ public DsfDebugViewLayoutCommand(DsfSession session) {
+ fExecutor = session.getExecutor();
+ fTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
+ }
+
+ public void dispose() {
+ fTracker.dispose();
+ }
+
+ /**
+ *
+ * @param request
+ * @return set of IExecutionDMContext if:
+ * - all elements are from a DSF session.
+ * - all elements are from the same DSF session.
+ */
+ protected IExecutionDMContext[] getDMContexts(IDebugCommandRequest request) {
+
+ HashSet<IExecutionDMContext> ret = new HashSet<>();
+ String sessionId = null;
+
+ for (Object obj : request.getElements()) {
+ if (!(obj instanceof IDMVMContext)) {
+ return EMPTY_ARRAY;
+ }
+
+ IDMContext dmContext = ((IDMVMContext) obj).getDMContext();
+ IExecutionDMContext exeContext = DMContexts.getAncestorOfType(dmContext, IExecutionDMContext.class);
+
+ if (exeContext == null) {
+ return EMPTY_ARRAY;
+ }
+
+ // make sure all elements are from the same DSF session.
+ if (sessionId == null) {
+ sessionId = dmContext.getSessionId();
+ } else {
+ if (!sessionId.equals(dmContext.getSessionId())) {
+ return EMPTY_ARRAY;
+ }
+ }
+
+ ret.add(exeContext);
+ }
+ return ret.toArray(new IExecutionDMContext[ret.size()]);
+ }
+
@Override
public void canExecute(final IEnabledStateRequest request) {
final IExecutionDMContext[] executionContexts = getDMContexts(request);
if (executionContexts.length > 0 && !fExecutor.isTerminated()) {
- fExecutor.submit(new DsfRunnable() {
+ fExecutor.submit(new DsfRunnable() {
@Override
public void run() {
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
if (translator != null) {
- canExecuteOnDsfThread(translator, executionContexts,
- new DataRequestMonitor<Boolean>(fExecutor, null) {
- @Override
- protected void handleCompleted() {
- boolean canExecute = isSuccess() && getData();
- request.setEnabled(canExecute);
- request.done();
- }
- });
+ canExecuteOnDsfThread(translator, executionContexts,
+ new DataRequestMonitor<Boolean>(fExecutor, null) {
+ @Override
+ protected void handleCompleted() {
+ boolean canExecute = isSuccess() && getData();
+ request.setEnabled(canExecute);
+ request.done();
+ }
+ });
} else {
request.setEnabled(false);
request.done();
}
- }
- });
- }
- else {
+ }
+ });
+ } else {
request.setEnabled(false);
request.done();
}
@@ -124,30 +122,31 @@ public abstract class DsfDebugViewLayoutCommand implements IDebugCommandHandler{
public boolean execute(final IDebugCommandRequest request) {
final IExecutionDMContext[] executionContexts = getDMContexts(request);
if (executionContexts.length > 0 && !fExecutor.isTerminated()) {
- fExecutor.submit(new DsfRunnable() {
+ fExecutor.submit(new DsfRunnable() {
@Override
public void run() {
IExecutionContextTranslator translator = fTracker.getService(IExecutionContextTranslator.class);
if (translator != null) {
- executeOnDsfThread(translator, executionContexts,
- new RequestMonitor(fExecutor, null) {
- @Override
- protected void handleCompleted() {
- request.done();
- }
- });
- }
- else {
+ executeOnDsfThread(translator, executionContexts, new RequestMonitor(fExecutor, null) {
+ @Override
+ protected void handleCompleted() {
+ request.done();
+ }
+ });
+ } else {
request.done();
}
- }
- });
+ }
+ });
return false;
}
- request.done();
+ request.done();
return true;
}
-
- abstract void executeOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, RequestMonitor rm);
- abstract void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm);
+
+ abstract void executeOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts,
+ RequestMonitor rm);
+
+ abstract void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts,
+ DataRequestMonitor<Boolean> rm);
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfGroupDebugContextsCommand.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfGroupDebugContextsCommand.java
index 0888385f121..6bd15348ef5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfGroupDebugContextsCommand.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfGroupDebugContextsCommand.java
@@ -24,18 +24,19 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler;
* @since 2.2
*/
public class DsfGroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
-
+
public DsfGroupDebugContextsCommand(DsfSession session) {
super(session);
- }
+ }
@Override
void executeOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, RequestMonitor rm) {
translator.group(contexts, rm);
}
-
+
@Override
- void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts,
+ DataRequestMonitor<Boolean> rm) {
translator.canGroup(contexts, rm);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfUngroupDebugContextsCommand.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfUngroupDebugContextsCommand.java
index c5943f9bde2..86eff45aac5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfUngroupDebugContextsCommand.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/debugview/layout/actions/DsfUngroupDebugContextsCommand.java
@@ -24,10 +24,10 @@ import org.eclipse.debug.core.commands.IDebugCommandHandler;
* @since 2.2
*/
public class DsfUngroupDebugContextsCommand extends DsfDebugViewLayoutCommand implements IDebugCommandHandler {
-
- public DsfUngroupDebugContextsCommand(DsfSession session) {
- super(session);
- }
+
+ public DsfUngroupDebugContextsCommand(DsfSession session) {
+ super(session);
+ }
@Override
void executeOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, RequestMonitor rm) {
@@ -35,7 +35,8 @@ public class DsfUngroupDebugContextsCommand extends DsfDebugViewLayoutCommand im
}
@Override
- void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts, DataRequestMonitor<Boolean> rm) {
+ void canExecuteOnDsfThread(IExecutionContextTranslator translator, IExecutionDMContext[] contexts,
+ DataRequestMonitor<Boolean> rm) {
translator.canUngroup(contexts, rm);
- }
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java
index f124e57cb4f..186733f8d8a 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AbstractImageRegistry.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -28,7 +28,6 @@ import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;
-
/**
* Abstract image registry that allows for defining fallback paths for images.
*/
@@ -36,13 +35,13 @@ public abstract class AbstractImageRegistry {
private HashMap<String, String> fPlugins = new HashMap<String, String>();
private HashMap<String, String[]> fLocations = new HashMap<String, String[]>();
private URL fBaseUrl;
- private final ImageRegistry fRegistry;
+ private final ImageRegistry fRegistry;
protected AbstractImageRegistry(Plugin plugin) {
- fRegistry = new ImageRegistry();
+ fRegistry = new ImageRegistry();
fBaseUrl = plugin.getBundle().getEntry("/"); //$NON-NLS-1$
}
-
+
/**
* Defines the key for a local image, that must be found below the icons directory
* in the plugin.
@@ -52,10 +51,10 @@ public abstract class AbstractImageRegistry {
* key.
*/
protected void localImage(String key, String dir, String name) {
- if (dir== null || dir.isEmpty())
- fLocations.put(key, new String[] {"icons/" + name}); //$NON-NLS-1$
+ if (dir == null || dir.isEmpty())
+ fLocations.put(key, new String[] { "icons/" + name }); //$NON-NLS-1$
else
- fLocations.put(key, new String[] {"icons/" + dir + "/" + name}); //$NON-NLS-1$ //$NON-NLS-2$
+ fLocations.put(key, new String[] { "icons/" + dir + "/" + name }); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -69,58 +68,58 @@ public abstract class AbstractImageRegistry {
* key.
*/
protected void externalImage(String key, String plugin, String[] dirs, String name) {
- if (plugin != null) {
- fPlugins.put(key, plugin);
- }
- String[] locations = new String[dirs.length];
- for (int i = 0; i < dirs.length; i++) {
+ if (plugin != null) {
+ fPlugins.put(key, plugin);
+ }
+ String[] locations = new String[dirs.length];
+ for (int i = 0; i < dirs.length; i++) {
String dir = dirs[i];
- if (dir== null || dir.isEmpty())
+ if (dir == null || dir.isEmpty())
locations[i] = "icons/" + name; //$NON-NLS-1$
else
locations[i] = "icons/" + dir + "/" + name; //$NON-NLS-1$ //$NON-NLS-2$
- }
- fLocations.put(key, locations);
+ }
+ fLocations.put(key, locations);
}
-
+
final public Image get(String key) {
- Image i = fRegistry.get(key);
- if (i != null) {
- return i;
- }
-
- ImageDescriptor d = createFileImageDescriptor(key);
- if (d != null) {
- fRegistry.put(key, d);
- return fRegistry.get(key);
- }
- return null;
+ Image i = fRegistry.get(key);
+ if (i != null) {
+ return i;
+ }
+
+ ImageDescriptor d = createFileImageDescriptor(key);
+ if (d != null) {
+ fRegistry.put(key, d);
+ return fRegistry.get(key);
+ }
+ return null;
}
final public ImageDescriptor getDescriptor(String key) {
- ImageDescriptor d = fRegistry.getDescriptor(key);
- if (d != null) {
- return d;
- }
-
- d = createFileImageDescriptor(key);
- if (d != null) {
- fRegistry.put(key, d);
- return d;
- }
- return null;
+ ImageDescriptor d = fRegistry.getDescriptor(key);
+ if (d != null) {
+ return d;
+ }
+
+ d = createFileImageDescriptor(key);
+ if (d != null) {
+ fRegistry.put(key, d);
+ return d;
+ }
+ return null;
}
private ImageDescriptor createFileImageDescriptor(String key) {
URL url = fBaseUrl;
String pluginId = fPlugins.get(key);
if (pluginId != null) {
- Bundle bundle= Platform.getBundle(pluginId);
+ Bundle bundle = Platform.getBundle(pluginId);
if (bundle != null) {
url = bundle.getEntry("/"); //$NON-NLS-1$
}
}
- String[] locations= fLocations.get(key);
+ String[] locations = fLocations.get(key);
if (locations != null) {
for (int i = 0; i < locations.length; i++) {
String loc = locations[i];
@@ -132,13 +131,14 @@ public abstract class AbstractImageRegistry {
return candidate;
}
} catch (MalformedURLException e) {
- DsfUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, "Malformed Icon URL", e)); //$NON-NLS-1$
+ DsfUIPlugin.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, "Malformed Icon URL", e)); //$NON-NLS-1$
} catch (SWTException e) {
// try the next one.
}
}
}
- return null;
+ return null;
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java
index e74c1500334..7c4263ded50 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/AddressRulerColumn.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -34,10 +34,11 @@ import org.eclipse.swt.SWT;
/**
* A vertical ruler column to display the instruction address.
*/
-public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerticalRulerInfo, IVerticalRulerInfoExtension, IAnnotationHover {
+public class AddressRulerColumn extends DisassemblyRulerColumn
+ implements IVerticalRulerInfo, IVerticalRulerInfoExtension, IAnnotationHover {
public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.address"; //$NON-NLS-1$
-
+
private int fRadix;
private boolean fShowRadixPrefix;
private String fRadixPrefix;
@@ -58,7 +59,7 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
@Override
protected String createDisplayString(int line) {
- DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) getParentRuler().getTextViewer().getDocument();
int offset;
try {
offset = doc.getLineOffset(line);
@@ -76,16 +77,16 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
int nLines;
if (srcPos.fFileInfo.fSource == null) {
srcLine = srcPos.fLine;
- nLines = srcLine+1;
+ nLines = srcLine + 1;
} else {
- int delta = offset-srcPos.offset;
- int baseOffset = srcPos.fFileInfo.fSource.getLineOffset(srcPos.fLine);
- srcLine = srcPos.fFileInfo.fSource.getLineOfOffset(baseOffset+delta);
+ int delta = offset - srcPos.offset;
+ int baseOffset = srcPos.fFileInfo.fSource.getLineOffset(srcPos.fLine);
+ srcLine = srcPos.fFileInfo.fSource.getLineOfOffset(baseOffset + delta);
nLines = srcPos.fFileInfo.fSource.getNumberOfLines();
}
- String digitStr = Integer.toString(srcLine+1);
- int maxDigits = (int)(Math.log(nLines)/Math.log(10))+1;
- return SPACES.substring(0, maxDigits-digitStr.length())+digitStr;
+ String digitStr = Integer.toString(srcLine + 1);
+ int maxDigits = (int) (Math.log(nLines) / Math.log(10)) + 1;
+ return SPACES.substring(0, maxDigits - digitStr.length()) + digitStr;
}
} catch (BadLocationException e) {
// silently ignored
@@ -99,20 +100,20 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
}
public void setAddressSize(int bits) {
- fAddressSize= bits;
+ fAddressSize = bits;
calculateNumberOfDigits();
}
public void setRadix(int radix) {
- fRadix= radix;
+ fRadix = radix;
calculateNumberOfDigits();
setShowRadixPrefix(fShowRadixPrefix);
}
private void calculateNumberOfDigits() {
- fNumberOfDigits= BigInteger.ONE.shiftLeft(fAddressSize).subtract(BigInteger.ONE).toString(fRadix).length();
+ fNumberOfDigits = BigInteger.ONE.shiftLeft(fAddressSize).subtract(BigInteger.ONE).toString(fRadix).length();
}
-
+
public void setShowRadixPrefix(boolean showRadixPrefix) {
fShowRadixPrefix = showRadixPrefix;
if (!fShowRadixPrefix) {
@@ -132,7 +133,7 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
buf.append(fRadixPrefix);
}
String str = address.toString(fRadix);
- for (int i=str.length(); i<fNumberOfDigits; ++i)
+ for (int i = str.length(); i < fNumberOfDigits; ++i)
buf.append('0');
buf.append(str);
buf.append(':');
@@ -169,7 +170,7 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
@Override
public String getHoverInfo(ISourceViewer sourceViewer, int line) {
- DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) getParentRuler().getTextViewer().getDocument();
BigInteger address = doc.getAddressOfLine(line);
SourceFileInfo info = doc.getSourceInfo(address);
if (info != null) {
@@ -180,7 +181,7 @@ public class AddressRulerColumn extends DisassemblyRulerColumn implements IVerti
@Override
public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
+ String property = event.getProperty();
IPreferenceStore store = getPreferenceStore();
boolean needRedraw = false;
if (DisassemblyPreferenceConstants.ADDRESS_COLOR.equals(property)) {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java
index b0db007bfb4..39951bb03e1 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java
@@ -97,7 +97,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
*/
public DisassemblyBackendDsf() {
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#init(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback)
*/
@@ -115,43 +115,43 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
DsfSession.removeSessionEndedListener(this);
}
- public static boolean supportsDebugContext_(IAdaptable context) {
- IDMVMContext dmvmContext = context.getAdapter(IDMVMContext.class);
- return dmvmContext != null && hasDisassemblyService(dmvmContext.getDMContext());
- }
-
- private static boolean hasDisassemblyService(final IDMContext dmContext) {
- DsfSession session = DsfSession.getSession(dmContext.getSessionId());
- if (session == null || !session.isActive()) {
- return false;
- }
- if (session.getExecutor().isInExecutorThread()) {
- DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
- IDisassembly disassSvc = tracker.getService(IDisassembly.class);
- tracker.dispose();
- return disassSvc != null;
- }
- Query<Boolean> query = new Query<Boolean>() {
- @Override
- protected void execute(DataRequestMonitor<Boolean> rm) {
- try {
- rm.setData(hasDisassemblyService(dmContext));
- } finally {
- rm.done();
- }
- }
- };
- try {
- session.getExecutor().execute(query);
- Boolean result = query.get(1, TimeUnit.SECONDS);
- return result != null && result.booleanValue();
- } catch (Exception exc) {
- // ignored on purpose
- }
- return false;
- }
-
- /* (non-Javadoc)
+ public static boolean supportsDebugContext_(IAdaptable context) {
+ IDMVMContext dmvmContext = context.getAdapter(IDMVMContext.class);
+ return dmvmContext != null && hasDisassemblyService(dmvmContext.getDMContext());
+ }
+
+ private static boolean hasDisassemblyService(final IDMContext dmContext) {
+ DsfSession session = DsfSession.getSession(dmContext.getSessionId());
+ if (session == null || !session.isActive()) {
+ return false;
+ }
+ if (session.getExecutor().isInExecutorThread()) {
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
+ IDisassembly disassSvc = tracker.getService(IDisassembly.class);
+ tracker.dispose();
+ return disassSvc != null;
+ }
+ Query<Boolean> query = new Query<Boolean>() {
+ @Override
+ protected void execute(DataRequestMonitor<Boolean> rm) {
+ try {
+ rm.setData(hasDisassemblyService(dmContext));
+ } finally {
+ rm.done();
+ }
+ }
+ };
+ try {
+ session.getExecutor().execute(query);
+ Boolean result = query.get(1, TimeUnit.SECONDS);
+ return result != null && result.booleanValue();
+ } catch (Exception exc) {
+ // ignored on purpose
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#supportsDebugContext(org.eclipse.core.runtime.IAdaptable)
*/
@Override
@@ -175,18 +175,19 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
assert supportsDebugContext(context) : "caller should not have invoked us"; //$NON-NLS-1$
IDMVMContext vmContext = context.getAdapter(IDMVMContext.class);
IDMContext dmContext = vmContext.getDMContext();
-
+
SetDebugContextResult result = new SetDebugContextResult();
-
+
String dsfSessionId = dmContext.getSessionId();
-
+
if (!dsfSessionId.equals(fDsfSessionId)) {
// switch to different session or initiate session
if (DEBUG) {
- System.out.println(MessageFormat.format("DisassemblyBackendDsf: switch session [{0}<<{1}]. Input context={2}", dsfSessionId, //$NON-NLS-1$
- fDsfSessionId, dmContext));
+ System.out.println(MessageFormat.format(
+ "DisassemblyBackendDsf: switch session [{0}<<{1}]. Input context={2}", dsfSessionId, //$NON-NLS-1$
+ fDsfSessionId, dmContext));
}
- fTargetContext= null;
+ fTargetContext = null;
fTargetFrameContext = null;
result.contextChanged = true;
@@ -194,29 +195,30 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (dmContext instanceof IFrameDMContext) {
fTargetFrameContext = (IFrameDMContext) dmContext;
}
- IExecutionDMContext executionContext= DMContexts.getAncestorOfType(dmContext, IExecutionDMContext.class);
+ IExecutionDMContext executionContext = DMContexts.getAncestorOfType(dmContext,
+ IExecutionDMContext.class);
if (executionContext != null) {
- fTargetContext= executionContext;
+ fTargetContext = executionContext;
}
}
if (fTargetContext != null) {
-
+
// remove ourselves as a listener with the previous session (context)
- if (fDsfSessionId != null) {
- final DsfSession prevSession = DsfSession.getSession(fDsfSessionId);
- if (prevSession != null) {
- try {
- prevSession.getExecutor().execute(new DsfRunnable() {
- @Override
+ if (fDsfSessionId != null) {
+ final DsfSession prevSession = DsfSession.getSession(fDsfSessionId);
+ if (prevSession != null) {
+ try {
+ prevSession.getExecutor().execute(new DsfRunnable() {
+ @Override
public void run() {
- prevSession.removeServiceEventListener(DisassemblyBackendDsf.this);
- }
- });
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
+ prevSession.removeServiceEventListener(DisassemblyBackendDsf.this);
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
}
- }
+ }
// Ensures the view will display 'No Debug Context'
if (fTargetFrameContext != null) {
result.sessionId = fDsfSessionId = dsfSessionId;
@@ -227,27 +229,27 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (fServicesTracker != null) {
fServicesTracker.dispose();
}
- fServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fDsfSessionId);
-
+ fServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), fDsfSessionId);
+
// add ourselves as a listener with the new session (context)
- final DsfSession newSession = DsfSession.getSession(dsfSessionId);
- if (newSession != null) {
- try {
- newSession.getExecutor().execute(new DsfRunnable() {
- @Override
+ final DsfSession newSession = DsfSession.getSession(dsfSessionId);
+ if (newSession != null) {
+ try {
+ newSession.getExecutor().execute(new DsfRunnable() {
+ @Override
public void run() {
- newSession.addServiceEventListener(DisassemblyBackendDsf.this, null);
- }
- });
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
+ newSession.addServiceEventListener(DisassemblyBackendDsf.this, null);
+ }
+ });
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
}
}
} else if (dmContext instanceof IFrameDMContext) {
result.sessionId = fDsfSessionId;
// switch to different frame
- IFrameDMContext frame= (IFrameDMContext) dmContext;
+ IFrameDMContext frame = (IFrameDMContext) dmContext;
IExecutionDMContext newExeDmc = DMContexts.getAncestorOfType(frame, IExecutionDMContext.class);
if (newExeDmc != null) {
if (fTargetFrameContext != null) {
@@ -260,12 +262,12 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
// If switching from a thread node to a frame node
result.contextChanged = true;
}
- fTargetContext= newExeDmc;
- fTargetFrameContext= frame;
+ fTargetContext = newExeDmc;
+ fTargetFrameContext = frame;
if (!result.contextChanged) {
fCallback.gotoFrameIfActive(frame.getLevel());
}
- } else {
+ } else {
fTargetContext = null;
fTargetFrameContext = null;
result.contextChanged = true;
@@ -279,15 +281,15 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} else if (dmContext.equals(fTargetContext) && canDisassemble()) {
result.contextChanged = false;
result.sessionId = fDsfSessionId;
- } else {
+ } else {
fTargetContext = null;
fTargetFrameContext = null;
result.contextChanged = true;
}
if (DEBUG) {
System.out.println(MessageFormat.format(
- "DisassemblyBackendDsf: switch session done [id={0};context={1};\n\t\t\tframe={2}].\n\t\t\tInput context={3}", //$NON-NLS-1$
- fDsfSessionId, fTargetContext, fTargetFrameContext, dmContext));
+ "DisassemblyBackendDsf: switch session done [id={0};context={1};\n\t\t\tframe={2}].\n\t\t\tInput context={3}", //$NON-NLS-1$
+ fDsfSessionId, fTargetContext, fTargetFrameContext, dmContext));
}
return result;
}
@@ -306,14 +308,14 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
session.removeServiceEventListener(DisassemblyBackendDsf.this);
}
});
- } catch (RejectedExecutionException e) {
- // Session is shut down.
- }
+ } catch (RejectedExecutionException e) {
+ // Session is shut down.
+ }
}
- fTargetContext= null;
+ fTargetContext = null;
if (fServicesTracker != null) {
- fServicesTracker.dispose();
- fServicesTracker= null;
+ fServicesTracker.dispose();
+ fServicesTracker = null;
}
}
@@ -322,17 +324,18 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
*/
@Override
public void retrieveFrameAddress(final int frame) {
- final DsfExecutor executor= getSession().getExecutor();
+ final DsfExecutor executor = getSession().getExecutor();
executor.execute(new DsfRunnable() {
@Override
public void run() {
retrieveFrameAddressInSessionThread(frame);
- }});
+ }
+ });
}
void retrieveFrameAddressInSessionThread(final int frame) {
- final IStack stack= fServicesTracker.getService(IStack.class);
- final DsfExecutor executor= getSession().getExecutor();
+ final IStack stack = fServicesTracker.getService(IStack.class);
+ final DsfExecutor executor = getSession().getExecutor();
// Our frame context is currently either un-set or it's set to the frame
// our caller is specifying. If un-set, then set it and reinvoke this
@@ -342,7 +345,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
stack.getTopFrame(fTargetContext, new DataRequestMonitor<IFrameDMContext>(executor, null) {
@Override
protected void handleCompleted() {
- fTargetFrameContext= getData();
+ fTargetFrameContext = getData();
if (fTargetFrameContext != null) {
retrieveFrameAddressInSessionThread(frame);
} else {
@@ -363,26 +366,27 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
});
} else {
// TODO retrieve other stack frame
- fCallback.setUpdatePending(false);
+ fCallback.setUpdatePending(false);
}
return;
- }
- else if (frame != fTargetFrameContext.getLevel()) {
- // frame context has changed in the meantime - reinvoke
- retrieveFrameAddressInSessionThread(fTargetFrameContext.getLevel());
+ } else if (frame != fTargetFrameContext.getLevel()) {
+ // frame context has changed in the meantime - reinvoke
+ retrieveFrameAddressInSessionThread(fTargetFrameContext.getLevel());
return;
}
-
+
stack.getFrameData(fTargetFrameContext, new DataRequestMonitor<IFrameDMData>(executor, null) {
@Override
protected void handleCompleted() {
fCallback.setUpdatePending(false);
- IFrameDMData frameData= getData();
- fTargetFrameData= frameData;
+ IFrameDMData frameData = getData();
+ fTargetFrameData = frameData;
if (!isCanceled() && frameData != null) {
- final IAddress address= frameData.getAddress();
- final BigInteger addressValue= address.getValue();
- if (DEBUG) System.out.println("retrieveFrameAddress done "+ DisassemblyUtils.getAddressText(addressValue)); //$NON-NLS-1$
+ final IAddress address = frameData.getAddress();
+ final BigInteger addressValue = address.getValue();
+ if (DEBUG)
+ System.out
+ .println("retrieveFrameAddress done " + DisassemblyUtils.getAddressText(addressValue)); //$NON-NLS-1$
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
@@ -397,7 +401,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
}
});
} else {
- final IStatus status= getStatus();
+ final IStatus status = getStatus();
if (status != null && !status.isOK()) {
DisassemblyBackendDsf.this.handleError(getStatus());
}
@@ -444,7 +448,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
} catch (InterruptedException exc) {
} catch (ExecutionException exc) {
}
-
+
return false;
}
@@ -455,29 +459,27 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
private IRunControl getRunControl() {
return getService(IRunControl.class);
}
-
+
private <V> V getService(Class<V> serviceClass) {
if (fServicesTracker != null) {
return fServicesTracker.getService(serviceClass);
}
return null;
}
-
-
@DsfServiceEventHandler
public void handleEvent(IExitedDMEvent event) {
if (fTargetContext == null) {
return;
}
- final IExecutionDMContext context= event.getDMContext();
- if (context.equals(fTargetContext)
- || DMContexts.isAncestorOf(fTargetContext, context)) {
+ final IExecutionDMContext context = event.getDMContext();
+ if (context.equals(fTargetContext) || DMContexts.isAncestorOf(fTargetContext, context)) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.handleTargetEnded();
- }});
+ }
+ });
}
}
@@ -486,9 +488,8 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (fTargetContext == null) {
return;
}
- final IExecutionDMContext context= event.getDMContext();
- if (context.equals(fTargetContext)
- || DMContexts.isAncestorOf(fTargetContext, context)) {
+ final IExecutionDMContext context = event.getDMContext();
+ if (context.equals(fTargetContext) || DMContexts.isAncestorOf(fTargetContext, context)) {
fCallback.handleTargetSuspended();
}
}
@@ -498,9 +499,8 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (fTargetContext == null) {
return;
}
- final IExecutionDMContext context= event.getDMContext();
- if (context.equals(fTargetContext)
- || DMContexts.isAncestorOf(fTargetContext, context)) {
+ final IExecutionDMContext context = event.getDMContext();
+ if (context.equals(fTargetContext) || DMContexts.isAncestorOf(fTargetContext, context)) {
fCallback.handleTargetResumed();
}
}
@@ -526,7 +526,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
}
return -1;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#hasFrameContext()
*/
@@ -534,7 +534,6 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
public boolean hasFrameContext() {
return fTargetFrameContext != null;
}
-
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#getFrameFile()
@@ -556,64 +555,72 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyBackend#retrieveDisassembly(java.math.BigInteger, java.math.BigInteger, java.lang.String, int, int, boolean, boolean, boolean, int)
*/
@Override
- public void retrieveDisassembly(final BigInteger startAddress, BigInteger endAddress, final String file, final int lineNumber, final int lines, final boolean mixed, final boolean showSymbols, final boolean showDisassembly, final int linesHint) {
+ public void retrieveDisassembly(final BigInteger startAddress, BigInteger endAddress, final String file,
+ final int lineNumber, final int lines, final boolean mixed, final boolean showSymbols,
+ final boolean showDisassembly, final int linesHint) {
// make sure address range is no less than 32 bytes
// this is an attempt to get better a response from the backend (bug 302505)
- final BigInteger finalEndAddress= startAddress.add(BigInteger.valueOf(32)).max(endAddress);
+ final BigInteger finalEndAddress = startAddress.add(BigInteger.valueOf(32)).max(endAddress);
DsfSession session = getSession();
if (session == null) {
- return; // can happen during session termination
+ return; // can happen during session termination
}
-
- final DsfExecutor executor= session.getExecutor();
- final IDisassemblyDMContext context= DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
-
+ final DsfExecutor executor = session.getExecutor();
+ final IDisassemblyDMContext context = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
+
// align the start address first (bug 328168)
- executor.execute(new Runnable() {
+ executor.execute(new Runnable() {
@Override
public void run() {
alignOpCodeAddress(startAddress, new DataRequestMonitor<BigInteger>(executor, null) {
-
+
@Override
public void handleCompleted() {
final BigInteger finalStartAddress = getData();
if (mixed) {
- final DataRequestMonitor<IMixedInstruction[]> disassemblyRequest= new DataRequestMonitor<IMixedInstruction[]>(executor, null) {
+ final DataRequestMonitor<IMixedInstruction[]> disassemblyRequest = new DataRequestMonitor<IMixedInstruction[]>(
+ executor, null) {
@Override
public void handleCompleted() {
- final IMixedInstruction[] data= getData();
+ final IMixedInstruction[] data = getData();
if (!isCanceled() && data != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
- if (!insertDisassembly(finalStartAddress, finalEndAddress, data, showSymbols, showDisassembly)) {
+ if (!insertDisassembly(finalStartAddress, finalEndAddress, data,
+ showSymbols, showDisassembly)) {
// retry in non-mixed mode
- fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress, linesHint, false, true);
+ fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress,
+ linesHint, false, true);
}
- }});
+ }
+ });
} else {
- final IStatus status= getStatus();
+ final IStatus status = getStatus();
if (status != null && !status.isOK()) {
- if( file != null ) {
+ if (file != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
- fCallback.retrieveDisassembly(finalStartAddress, finalEndAddress, linesHint, true, true);
- }});
- }
- else {
+ fCallback.retrieveDisassembly(finalStartAddress,
+ finalEndAddress, linesHint, true, true);
+ }
+ });
+ } else {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
- fCallback.insertError(finalStartAddress, status.getMessage());
+ fCallback.insertError(finalStartAddress,
+ status.getMessage());
}
});
- }});
+ }
+ });
}
}
fCallback.setUpdatePending(false);
@@ -624,46 +631,56 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
executor.execute(new Runnable() {
@Override
public void run() {
- final IDisassembly disassembly= fServicesTracker.getService(IDisassembly.class);
+ final IDisassembly disassembly = fServicesTracker
+ .getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
- disassembly.getMixedInstructions(context, file, lineNumber, lines*2, disassemblyRequest);
- }});
+ disassembly.getMixedInstructions(context, file, lineNumber, lines * 2,
+ disassemblyRequest);
+ }
+ });
} else {
executor.execute(new Runnable() {
@Override
public void run() {
- final IDisassembly disassembly= fServicesTracker.getService(IDisassembly.class);
+ final IDisassembly disassembly = fServicesTracker
+ .getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
- disassembly.getMixedInstructions(context, finalStartAddress, finalEndAddress, disassemblyRequest);
- }});
+ disassembly.getMixedInstructions(context, finalStartAddress, finalEndAddress,
+ disassemblyRequest);
+ }
+ });
}
} else {
- final DataRequestMonitor<IInstruction[]> disassemblyRequest= new DataRequestMonitor<IInstruction[]>(executor, null) {
+ final DataRequestMonitor<IInstruction[]> disassemblyRequest = new DataRequestMonitor<IInstruction[]>(
+ executor, null) {
@Override
public void handleCompleted() {
if (!isCanceled() && getData() != null) {
fCallback.asyncExec(new Runnable() {
@Override
public void run() {
- if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(), showSymbols, showDisassembly)) {
+ if (!insertDisassembly(finalStartAddress, finalEndAddress, getData(),
+ showSymbols, showDisassembly)) {
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
- fCallback.insertError(finalStartAddress, DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData);
+ fCallback.insertError(finalStartAddress,
+ DisassemblyMessages.DisassemblyBackendDsf_error_UnableToRetrieveData);
}
});
}
- }});
+ }
+ });
} else {
- final IStatus status= getStatus();
+ final IStatus status = getStatus();
if (status != null && !status.isOK()) {
fCallback.asyncExec(new Runnable() {
@Override
@@ -671,10 +688,12 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
fCallback.doScrollLocked(new Runnable() {
@Override
public void run() {
- fCallback.insertError(finalStartAddress, status.getMessage());
+ fCallback.insertError(finalStartAddress,
+ status.getMessage());
}
});
- }});
+ }
+ });
}
fCallback.setUpdatePending(false);
}
@@ -683,14 +702,16 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
executor.execute(new Runnable() {
@Override
public void run() {
- final IDisassembly disassembly= fServicesTracker.getService(IDisassembly.class);
+ final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
- disassembly.getInstructions(context, finalStartAddress, finalEndAddress, disassemblyRequest);
- }});
+ disassembly.getInstructions(context, finalStartAddress, finalEndAddress,
+ disassemblyRequest);
+ }
+ });
}
}
});
@@ -698,20 +719,22 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
});
}
- private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions, boolean showSymbols, boolean showDisassembly) {
- if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
- if (DEBUG) {
- System.out.println(MessageFormat.format(
+ private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions,
+ boolean showSymbols, boolean showDisassembly) {
+ if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
+ if (DEBUG) {
+ System.out.println(MessageFormat.format(
"insertDisassembly ignored at {0} due to missing context: [fDsfSessionId={1};fTargetContext={2}]", //$NON-NLS-1$
DisassemblyUtils.getAddressText(startAddress), fDsfSessionId, fTargetContext));
- }
- if (fTargetContext == null) {
- fCallback.setUpdatePending(false);
- }
+ }
+ if (fTargetContext == null) {
+ fCallback.setUpdatePending(false);
+ }
// return true to avoid a retry
return true;
}
- if (DEBUG) System.out.println("insertDisassembly "+ DisassemblyUtils.getAddressText(startAddress)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("insertDisassembly " + DisassemblyUtils.getAddressText(startAddress)); //$NON-NLS-1$
assert fCallback.getUpdatePending();
if (!fCallback.getUpdatePending()) {
// safe-guard in case something weird is going on
@@ -723,11 +746,11 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
try {
fCallback.lockScroller();
-
- AddressRangePosition p= null;
+
+ AddressRangePosition p = null;
for (int j = 0; j < instructions.length; j++) {
IInstruction instruction = instructions[j];
- BigInteger address= instruction.getAdress();
+ BigInteger address = instruction.getAdress();
if (startAddress == null || startAddress.compareTo(BigInteger.ZERO) < 0) {
startAddress = address;
fCallback.setGotoAddressPending(address);
@@ -739,10 +762,12 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
p.fValid = false;
fCallback.getDocument().addInvalidAddressRange(p);
} else if (p == null || address.compareTo(endAddress) > 0) {
- if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
return insertedAnyAddress;
} else if (p.fValid) {
- if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
if (!p.fAddressOffset.equals(address)) {
// override probably unaligned disassembly
p.fValid = false;
@@ -751,21 +776,22 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
continue;
}
}
- boolean hasSource= false;
- String compilationPath= null;
+ boolean hasSource = false;
+ String compilationPath = null;
// insert symbol label
- final String functionName= instruction.getFuntionName();
+ final String functionName = instruction.getFuntionName();
if (functionName != null && !functionName.isEmpty() && instruction.getOffset() == 0) {
- p = fCallback.getDocument().insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly));
+ p = fCallback.getDocument().insertLabel(p, address, functionName,
+ showSymbols && (!hasSource || showDisassembly));
}
// determine instruction byte length
- BigInteger instrLength= null;
+ BigInteger instrLength = null;
if (instruction instanceof IInstructionWithSize
- && ((IInstructionWithSize)instruction).getSize() != null) {
- instrLength= new BigInteger(((IInstructionWithSize)instruction).getSize().toString());
+ && ((IInstructionWithSize) instruction).getSize() != null) {
+ instrLength = new BigInteger(((IInstructionWithSize) instruction).getSize().toString());
} else {
if (j < instructions.length - 1) {
- instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs();
+ instrLength = instructions[j + 1].getAdress().subtract(instruction.getAdress()).abs();
}
if (instrLength == null) {
// cannot determine length of last instruction
@@ -775,18 +801,19 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
final String functionOffset; // Renamed from opCode to avoid confusion
// insert function name+offset instead of opcode bytes
if (functionName != null && !functionName.isEmpty()) {
- functionOffset= functionName + '+' + instruction.getOffset();
+ functionOffset = functionName + '+' + instruction.getOffset();
} else {
- functionOffset= ""; //$NON-NLS-1$
+ functionOffset = ""; //$NON-NLS-1$
}
-
+
BigInteger opCodes = null;
// Get raw Opcodes if available
- if(instruction instanceof IInstructionWithRawOpcodes){
- opCodes = ((IInstructionWithRawOpcodes)instruction).getRawOpcodes();
+ if (instruction instanceof IInstructionWithRawOpcodes) {
+ opCodes = ((IInstructionWithRawOpcodes) instruction).getRawOpcodes();
}
- p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), functionOffset, opCodes, instruction.getInstruction(), compilationPath, -1);
+ p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), functionOffset,
+ opCodes, instruction.getInstruction(), compilationPath, -1);
if (p == null) {
break;
}
@@ -814,7 +841,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
* an address the caller is hoping will be covered by this
* insertion. I.e., [mixedInstructions] may or may not contain
* that address; the caller wants to know if it does, and so we
- * indicate that via our return value. Can be null to indicate n/a,
+ * indicate that via our return value. Can be null to indicate n/a,
* in which case we return true as long as any instruction was inserted
* as long as any instruction was inserted
* @param endAddress
@@ -825,20 +852,22 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
* @param showDisassembly
* @return whether [startAddress] was inserted
*/
- private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IMixedInstruction[] mixedInstructions, boolean showSymbols, boolean showDisassembly) {
- if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
- if (DEBUG) {
- System.out.println(MessageFormat.format(
+ private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress,
+ IMixedInstruction[] mixedInstructions, boolean showSymbols, boolean showDisassembly) {
+ if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
+ if (DEBUG) {
+ System.out.println(MessageFormat.format(
"insertDisassembly ignored at {0} : missing context: [fDsfSessionId={1};fTargetContext={2}]", //$NON-NLS-1$
DisassemblyUtils.getAddressText(startAddress), fDsfSessionId, fTargetContext));
- }
- if (fTargetContext == null) {
- fCallback.setUpdatePending(false);
- }
+ }
+ if (fTargetContext == null) {
+ fCallback.setUpdatePending(false);
+ }
// return true to avoid a retry
return true;
}
- if (DEBUG) System.out.println("insertDisassembly "+ DisassemblyUtils.getAddressText(startAddress)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("insertDisassembly " + DisassemblyUtils.getAddressText(startAddress)); //$NON-NLS-1$
boolean updatePending = fCallback.getUpdatePending();
assert updatePending;
if (!updatePending) {
@@ -850,16 +879,16 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
boolean insertedAnyAddress = false;
try {
fCallback.lockScroller();
-
- AddressRangePosition p= null;
+
+ AddressRangePosition p = null;
for (int i = 0; i < mixedInstructions.length; ++i) {
- IMixedInstruction mixedInstruction= mixedInstructions[i];
- final String file= mixedInstruction.getFileName();
- int lineNumber= mixedInstruction.getLineNumber() - 1;
- IInstruction[] instructions= mixedInstruction.getInstructions();
+ IMixedInstruction mixedInstruction = mixedInstructions[i];
+ final String file = mixedInstruction.getFileName();
+ int lineNumber = mixedInstruction.getLineNumber() - 1;
+ IInstruction[] instructions = mixedInstruction.getInstructions();
for (int j = 0; j < instructions.length; ++j) {
IInstruction instruction = instructions[j];
- BigInteger address= instruction.getAdress();
+ BigInteger address = instruction.getAdress();
if (startAddress == null) {
startAddress = address;
fCallback.setGotoAddressPending(address);
@@ -871,10 +900,14 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
p.fValid = false;
fCallback.getDocument().addInvalidAddressRange(p);
} else if (p == null || address.compareTo(endAddress) > 0) {
- if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out
+ .println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
return insertedAnyAddress;
} else if (p.fValid) {
- if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out
+ .println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
if (!p.fAddressOffset.equals(address)) {
// override probably unaligned disassembly
p.fValid = false;
@@ -883,30 +916,31 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
continue;
}
}
- boolean hasSource= false;
+ boolean hasSource = false;
if (file != null && lineNumber >= 0) {
p = fCallback.insertSource(p, address, file, lineNumber);
hasSource = fCallback.getStorageForFile(file) != null;
}
// insert symbol label
- final String functionName= instruction.getFuntionName();
+ final String functionName = instruction.getFuntionName();
if (functionName != null && !functionName.isEmpty() && instruction.getOffset() == 0) {
- p = fCallback.getDocument().insertLabel(p, address, functionName, showSymbols && (!hasSource || showDisassembly));
+ p = fCallback.getDocument().insertLabel(p, address, functionName,
+ showSymbols && (!hasSource || showDisassembly));
}
// determine instruction byte length
- BigInteger instrLength= null;
+ BigInteger instrLength = null;
if (instruction instanceof IInstructionWithSize
- && ((IInstructionWithSize)instruction).getSize() != null) {
- instrLength= new BigInteger(((IInstructionWithSize)instruction).getSize().toString());
+ && ((IInstructionWithSize) instruction).getSize() != null) {
+ instrLength = new BigInteger(((IInstructionWithSize) instruction).getSize().toString());
} else {
if (j < instructions.length - 1) {
- instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs();
+ instrLength = instructions[j + 1].getAdress().subtract(instruction.getAdress()).abs();
} else if (i < mixedInstructions.length - 1) {
- int nextSrcLineIdx= i+1;
+ int nextSrcLineIdx = i + 1;
while (nextSrcLineIdx < mixedInstructions.length) {
- IInstruction[] nextInstrs= mixedInstructions[nextSrcLineIdx].getInstructions();
+ IInstruction[] nextInstrs = mixedInstructions[nextSrcLineIdx].getInstructions();
if (nextInstrs.length > 0) {
- instrLength= nextInstrs[0].getAdress().subtract(instruction.getAdress()).abs();
+ instrLength = nextInstrs[0].getAdress().subtract(instruction.getAdress()).abs();
break;
}
++nextSrcLineIdx;
@@ -923,24 +957,25 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
final String funcOffset;
// insert function name+offset instead of opcode bytes
if (functionName != null && !functionName.isEmpty()) {
- funcOffset= functionName + '+' + instruction.getOffset();
+ funcOffset = functionName + '+' + instruction.getOffset();
} else {
- funcOffset= ""; //$NON-NLS-1$
+ funcOffset = ""; //$NON-NLS-1$
}
-
+
BigInteger opCodes = null;
- if(instruction instanceof IInstructionWithRawOpcodes){
- opCodes = ((IInstructionWithRawOpcodes)instruction).getRawOpcodes();
+ if (instruction instanceof IInstructionWithRawOpcodes) {
+ opCodes = ((IInstructionWithRawOpcodes) instruction).getRawOpcodes();
}
-
- p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), funcOffset, opCodes, instruction.getInstruction(), file, lineNumber);
+
+ p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), funcOffset,
+ opCodes, instruction.getInstruction(), file, lineNumber);
if (p == null) {
break;
}
insertedAnyAddress = true;
}
}
-
+
} catch (BadLocationException e) {
// should not happen
DisassemblyUtils.internalError(e);
@@ -964,25 +999,25 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
@Override
public Object insertSource(Position pos, BigInteger address, final String file, int lineNumber) {
Object sourceElement = null;
- final ISourceLookupDMContext ctx= DMContexts.getAncestorOfType(fTargetContext, ISourceLookupDMContext.class);
- final DsfExecutor executor= getSession().getExecutor();
- Query<Object> query= new Query<Object>() {
+ final ISourceLookupDMContext ctx = DMContexts.getAncestorOfType(fTargetContext, ISourceLookupDMContext.class);
+ final DsfExecutor executor = getSession().getExecutor();
+ Query<Object> query = new Query<Object>() {
@Override
protected void execute(final DataRequestMonitor<Object> rm) {
- final DataRequestMonitor<Object> request= new DataRequestMonitor<Object>(executor, rm) {
+ final DataRequestMonitor<Object> request = new DataRequestMonitor<Object>(executor, rm) {
@Override
protected void handleSuccess() {
rm.setData(getData());
rm.done();
}
};
- final ISourceLookup lookup= getService(ISourceLookup.class);
+ final ISourceLookup lookup = getService(ISourceLookup.class);
lookup.getSource(ctx, file, request);
}
};
try {
getSession().getExecutor().execute(query);
- sourceElement= query.get();
+ sourceElement = query.get();
} catch (InterruptedException exc) {
DisassemblyUtils.internalError(exc);
} catch (ExecutionException exc) {
@@ -999,7 +1034,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (!hasFrameContext()) {
return;
}
- evaluateAddressExpression(symbol, false, new DataRequestMonitor<BigInteger>(getSession().getExecutor(), null) {
+ evaluateAddressExpression(symbol, false, new DataRequestMonitor<BigInteger>(getSession().getExecutor(), null) {
@Override
protected void handleSuccess() {
final BigInteger address = getData();
@@ -1008,7 +1043,8 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
@Override
public void run() {
fCallback.gotoAddress(address);
- }});
+ }
+ });
}
}
});
@@ -1027,8 +1063,8 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
Query<BigInteger> query = new Query<BigInteger>() {
@Override
protected void execute(DataRequestMonitor<BigInteger> rm) {
- evaluateAddressExpression(symbol, suppressError, rm);
- }
+ evaluateAddressExpression(symbol, suppressError, rm);
+ }
};
getSession().getExecutor().execute(query);
try {
@@ -1037,113 +1073,127 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
return null;
}
}
-
- private void evaluateAddressExpression(final String symbol, final boolean suppressError, final DataRequestMonitor<BigInteger> rm) {
- final IExpressions expressions= getService(IExpressions.class);
+
+ private void evaluateAddressExpression(final String symbol, final boolean suppressError,
+ final DataRequestMonitor<BigInteger> rm) {
+ final IExpressions expressions = getService(IExpressions.class);
if (expressions == null) {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
+ rm.setStatus(
+ new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
rm.done();
return;
}
-
- final IExpressionDMContext exprDmc= expressions.createExpression(fTargetContext, symbol);
+
+ final IExpressionDMContext exprDmc = expressions.createExpression(fTargetContext, symbol);
// first, try to get l-value address
- expressions.getExpressionAddressData(exprDmc, new DataRequestMonitor<IExpressionDMAddress>(getSession().getExecutor(), null) {
- @Override
- protected void handleSuccess() {
- IExpressionDMAddress data = getData();
- final IAddress address = data.getAddress();
- if (address != null && address != IExpressionDMLocation.INVALID_ADDRESS) {
- final BigInteger addressValue = address.getValue();
- fCallback.asyncExec(new Runnable() {
- @Override
- public void run() {
- fCallback.gotoAddress(addressValue);
- }
- });
- rm.setData(addressValue);
- rm.done();
- } else {
- handleError();
- }
- }
- @Override
- protected void handleError() {
- // not an l-value, evaluate expression
- final FormattedValueDMContext valueDmc= expressions.getFormattedValueContext(exprDmc, IFormattedValues.HEX_FORMAT);
- expressions.getFormattedExpressionValue(valueDmc, new DataRequestMonitor<FormattedValueDMData>(getSession().getExecutor(), null) {
+ expressions.getExpressionAddressData(exprDmc,
+ new DataRequestMonitor<IExpressionDMAddress>(getSession().getExecutor(), null) {
@Override
protected void handleSuccess() {
- FormattedValueDMData data= getData();
- String value= data.getFormattedValue();
- BigInteger address= null;
- try {
- address = DisassemblyUtils.decodeAddress(value);
- } catch (final Exception e) {
- // "value" can be empty i.e *fooX, where fooX is a variable.
- // Not sure if this is a bug or not. So, fail the request instead.
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
-
- if (!suppressError) {
- DisassemblyBackendDsf.this.handleError(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
- DisassemblyMessages.Disassembly_log_error_expression_eval + " (" + e.getMessage() + ")", null)); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ IExpressionDMAddress data = getData();
+ final IAddress address = data.getAddress();
+ if (address != null && address != IExpressionDMLocation.INVALID_ADDRESS) {
+ final BigInteger addressValue = address.getValue();
+ fCallback.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ fCallback.gotoAddress(addressValue);
+ }
+ });
+ rm.setData(addressValue);
+ rm.done();
+ } else {
+ handleError();
}
- rm.setData(address);
- rm.done();
}
+
@Override
protected void handleError() {
- if (!suppressError) {
- DisassemblyBackendDsf.this.handleError(getStatus());
- }
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
- rm.done();
+ // not an l-value, evaluate expression
+ final FormattedValueDMContext valueDmc = expressions.getFormattedValueContext(exprDmc,
+ IFormattedValues.HEX_FORMAT);
+ expressions.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(getSession().getExecutor(), null) {
+ @Override
+ protected void handleSuccess() {
+ FormattedValueDMData data = getData();
+ String value = data.getFormattedValue();
+ BigInteger address = null;
+ try {
+ address = DisassemblyUtils.decodeAddress(value);
+ } catch (final Exception e) {
+ // "value" can be empty i.e *fooX, where fooX is a variable.
+ // Not sure if this is a bug or not. So, fail the request instead.
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
+
+ if (!suppressError) {
+ DisassemblyBackendDsf.this.handleError(new Status(IStatus.ERROR,
+ DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
+ DisassemblyMessages.Disassembly_log_error_expression_eval + " (" //$NON-NLS-1$
+ + e.getMessage() + ")", //$NON-NLS-1$
+ null));
+ }
+ }
+ rm.setData(address);
+ rm.done();
+ }
+
+ @Override
+ protected void handleError() {
+ if (!suppressError) {
+ DisassemblyBackendDsf.this.handleError(getStatus());
+ }
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID,
+ IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
+ rm.done();
+ }
+ });
}
});
- }
- });
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend#retrieveDisassembly(java.lang.String, int, java.math.BigInteger, boolean, boolean, boolean)
*/
@Override
- public void retrieveDisassembly(final String file, final int lines, final BigInteger endAddress, boolean mixed, final boolean showSymbols, final boolean showDisassembly) {
- String debuggerPath= file;
+ public void retrieveDisassembly(final String file, final int lines, final BigInteger endAddress, boolean mixed,
+ final boolean showSymbols, final boolean showDisassembly) {
+ String debuggerPath = file;
// try reverse lookup
- final ISourceLookupDMContext ctx= DMContexts.getAncestorOfType(fTargetContext, ISourceLookupDMContext.class);
- final DsfExecutor executor= getSession().getExecutor();
- Query<String> query= new Query<String>() {
+ final ISourceLookupDMContext ctx = DMContexts.getAncestorOfType(fTargetContext, ISourceLookupDMContext.class);
+ final DsfExecutor executor = getSession().getExecutor();
+ Query<String> query = new Query<String>() {
@Override
protected void execute(final DataRequestMonitor<String> rm) {
- final DataRequestMonitor<String> request= new DataRequestMonitor<String>(executor, rm) {
+ final DataRequestMonitor<String> request = new DataRequestMonitor<String>(executor, rm) {
@Override
protected void handleSuccess() {
rm.setData(getData());
rm.done();
}
};
- final ISourceLookup lookup= getService(ISourceLookup.class);
+ final ISourceLookup lookup = getService(ISourceLookup.class);
lookup.getDebuggerPath(ctx, file, request);
}
};
try {
getSession().getExecutor().execute(query);
- debuggerPath= query.get();
+ debuggerPath = query.get();
} catch (InterruptedException exc) {
internalError(exc);
} catch (ExecutionException exc) {
internalError(exc);
}
- final IDisassemblyDMContext context= DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
+ final IDisassemblyDMContext context = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
- final String finalFile= debuggerPath;
- final DataRequestMonitor<IMixedInstruction[]> disassemblyRequest= new DataRequestMonitor<IMixedInstruction[]>(executor, null) {
+ final String finalFile = debuggerPath;
+ final DataRequestMonitor<IMixedInstruction[]> disassemblyRequest = new DataRequestMonitor<IMixedInstruction[]>(
+ executor, null) {
@Override
public void handleCompleted() {
- final IMixedInstruction[] data= getData();
+ final IMixedInstruction[] data = getData();
if (!isCanceled() && data != null) {
fCallback.asyncExec(new Runnable() {
@Override
@@ -1152,9 +1202,10 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
// retry in non-mixed mode
retrieveDisassembly(file, lines, endAddress, false, showSymbols, showDisassembly);
}
- }});
+ }
+ });
} else {
- final IStatus status= getStatus();
+ final IStatus status = getStatus();
if (status != null && !status.isOK()) {
DisassemblyBackendDsf.this.handleError(getStatus());
}
@@ -1167,14 +1218,15 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
executor.execute(new Runnable() {
@Override
public void run() {
- final IDisassembly disassembly= fServicesTracker.getService(IDisassembly.class);
+ final IDisassembly disassembly = fServicesTracker.getService(IDisassembly.class);
if (disassembly == null) {
disassemblyRequest.cancel();
disassemblyRequest.done();
return;
}
disassembly.getMixedInstructions(context, finalFile, 1, lines, disassemblyRequest);
- }});
+ }
+ });
}
/* (non-Javadoc)
@@ -1185,37 +1237,41 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
if (fTargetFrameContext == null) {
return null;
}
- final DsfExecutor executor= DsfSession.getSession(fDsfSessionId).getExecutor();
- Query<FormattedValueDMData> query= new Query<FormattedValueDMData>() {
+ final DsfExecutor executor = DsfSession.getSession(fDsfSessionId).getExecutor();
+ Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
@Override
protected void execute(final DataRequestMonitor<FormattedValueDMData> rm) {
- IExecutionDMContext exeCtx = DMContexts.getAncestorOfType(fTargetFrameContext, IExecutionDMContext.class);
- final IRunControl rc= getService(IRunControl.class);
+ IExecutionDMContext exeCtx = DMContexts.getAncestorOfType(fTargetFrameContext,
+ IExecutionDMContext.class);
+ final IRunControl rc = getService(IRunControl.class);
if (rc == null || !rc.isSuspended(exeCtx)) {
rm.done();
return;
}
- final IExpressions expressions= getService(IExpressions.class);
+ final IExpressions expressions = getService(IExpressions.class);
if (expressions == null) {
rm.done();
return;
}
- IExpressionDMContext exprDmc= expressions.createExpression(fTargetFrameContext, expression);
- final FormattedValueDMContext valueDmc= expressions.getFormattedValueContext(exprDmc, IFormattedValues.NATURAL_FORMAT);
- expressions.getFormattedExpressionValue(valueDmc, new DataRequestMonitor<FormattedValueDMData>(executor, rm) {
- @Override
- protected void handleSuccess() {
- FormattedValueDMData data= getData();
- rm.setData(data);
- rm.done();
- }
- });
- }};
-
+ IExpressionDMContext exprDmc = expressions.createExpression(fTargetFrameContext, expression);
+ final FormattedValueDMContext valueDmc = expressions.getFormattedValueContext(exprDmc,
+ IFormattedValues.NATURAL_FORMAT);
+ expressions.getFormattedExpressionValue(valueDmc,
+ new DataRequestMonitor<FormattedValueDMData>(executor, rm) {
+ @Override
+ protected void handleSuccess() {
+ FormattedValueDMData data = getData();
+ rm.setData(data);
+ rm.done();
+ }
+ });
+ }
+ };
+
executor.execute(query);
- FormattedValueDMData data= null;
+ FormattedValueDMData data = null;
try {
- data= query.get();
+ data = query.get();
} catch (InterruptedException exc) {
} catch (ExecutionException exc) {
}
@@ -1223,9 +1279,9 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
return data.getFormattedValue();
}
return null;
-
+
}
-
+
@Override
public String evaluateRegister(final String potentialRegisterName) {
if (fTargetFrameContext == null) {
@@ -1236,7 +1292,8 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() {
@Override
protected void execute(final DataRequestMonitor<FormattedValueDMData> rm) {
- IExecutionDMContext exeCtx = DMContexts.getAncestorOfType(fTargetFrameContext, IExecutionDMContext.class);
+ IExecutionDMContext exeCtx = DMContexts.getAncestorOfType(fTargetFrameContext,
+ IExecutionDMContext.class);
final IRunControl rc = getService(IRunControl.class);
if (rc == null || !rc.isSuspended(exeCtx)) {
rm.done();
@@ -1247,71 +1304,74 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
rm.done();
return;
}
-
+
// find registers for current frame context
- registersService.findRegister(fTargetFrameContext, potentialRegisterName,
- new DataRequestMonitor<IRegisterDMContext>(executor, rm)
- {
- @Override
- protected void handleSuccess() {
- // handle to the register we're looking-for
- final IRegisterDMContext theOne = getData();
-
- FormattedValueDMContext fmtCtx = registersService.getFormattedValueContext(theOne, IFormattedValues.HEX_FORMAT);
- registersService.getFormattedExpressionValue(fmtCtx, new DataRequestMonitor<FormattedValueDMData>(executor, rm) {
- @Override
- protected void handleSuccess() {
- rm.done(getData());
- }
- });
- }
- });
- }};
-
+ registersService.findRegister(fTargetFrameContext, potentialRegisterName,
+ new DataRequestMonitor<IRegisterDMContext>(executor, rm) {
+ @Override
+ protected void handleSuccess() {
+ // handle to the register we're looking-for
+ final IRegisterDMContext theOne = getData();
+
+ FormattedValueDMContext fmtCtx = registersService.getFormattedValueContext(theOne,
+ IFormattedValues.HEX_FORMAT);
+ registersService.getFormattedExpressionValue(fmtCtx,
+ new DataRequestMonitor<FormattedValueDMData>(executor, rm) {
+ @Override
+ protected void handleSuccess() {
+ rm.done(getData());
+ }
+ });
+ }
+ });
+ }
+ };
+
executor.execute(query);
String returnValue = null;
try {
- // set a query timeout, to help avoid potential deadlock
- FormattedValueDMData data = query.get(500, TimeUnit.MILLISECONDS);
- if (data != null) {
- returnValue = data.getFormattedValue();
- }
+ // set a query timeout, to help avoid potential deadlock
+ FormattedValueDMData data = query.get(500, TimeUnit.MILLISECONDS);
+ if (data != null) {
+ returnValue = data.getFormattedValue();
+ }
} catch (InterruptedException exc) {
} catch (ExecutionException exc) {
} catch (TimeoutException exc) {
- }
+ }
- return returnValue;
+ return returnValue;
}
/**
* Align the opCode of an address.
- *
+ *
* @param addr the address
* @param rm the data request monitor
*/
@ConfinedToDsfExecutor("getSession().getExecutor()")
- void alignOpCodeAddress(final BigInteger addr, final DataRequestMonitor<BigInteger> rm) {
- IDisassembly2 disassembly = getService(IDisassembly2.class);
- if (disassembly == null) {
- rm.setData(addr);
- rm.done();
- return;
- }
-
- final IDisassemblyDMContext context = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
- disassembly.alignOpCodeAddress(context, addr, new ImmediateDataRequestMonitor<BigInteger>(rm) {
- @Override
- protected void handleFailure() {
- rm.setData(addr);
- rm.done();
- }
- @Override
- protected void handleSuccess() {
- rm.setData(getData());
- rm.done();
- }
- });
+ void alignOpCodeAddress(final BigInteger addr, final DataRequestMonitor<BigInteger> rm) {
+ IDisassembly2 disassembly = getService(IDisassembly2.class);
+ if (disassembly == null) {
+ rm.setData(addr);
+ rm.done();
+ return;
+ }
+
+ final IDisassemblyDMContext context = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
+ disassembly.alignOpCodeAddress(context, addr, new ImmediateDataRequestMonitor<BigInteger>(rm) {
+ @Override
+ protected void handleFailure() {
+ rm.setData(addr);
+ rm.done();
+ }
+
+ @Override
+ protected void handleSuccess() {
+ rm.setData(getData());
+ rm.done();
+ }
+ });
}
/**
@@ -1322,7 +1382,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
protected boolean canDisassembleContext(IDMContext context) {
return DMContexts.getAncestorOfType(context, IExecutionDMContext.class) != null;
}
-
+
/**
* Returns the target context for the current selected debug context.
* @return
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsfFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsfFactory.java
index 81fbde9622b..70d71833631 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsfFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsfFactory.java
@@ -29,8 +29,9 @@ public class DisassemblyBackendDsfFactory implements IAdapterFactory {
@Override
@SuppressWarnings("unchecked")
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (IDisassemblyBackend.class.equals(adapterType)) {
- if (adaptableObject instanceof IAdaptable && DisassemblyBackendDsf.supportsDebugContext_((IAdaptable)adaptableObject)) {
+ if (IDisassemblyBackend.class.equals(adapterType)) {
+ if (adaptableObject instanceof IAdaptable
+ && DisassemblyBackendDsf.supportsDebugContext_((IAdaptable) adaptableObject)) {
String sessionId = ((IDMVMContext) adaptableObject).getDMContext().getSessionId();
DsfSession session = DsfSession.getSession(sessionId);
if (session.isActive()) {
@@ -41,7 +42,7 @@ public class DisassemblyBackendDsfFactory implements IAdapterFactory {
return adapter;
}
}
- return (T)new DisassemblyBackendDsf();
+ return (T) new DisassemblyBackendDsf();
}
}
return null;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java
index a7a920938b9..1de8ce769f5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java
@@ -49,9 +49,9 @@ class DisassemblyColumnSupport implements IColumnSupport {
public DisassemblyColumnSupport(DisassemblyPart disassembly, RulerColumnRegistry registry) {
Assert.isLegal(disassembly != null);
Assert.isLegal(registry != null);
- fDisassembly= disassembly;
- fRegistry= registry;
- fColumns= new ArrayList<IContributedRulerColumn>();
+ fDisassembly = disassembly;
+ fRegistry = registry;
+ fColumns = new ArrayList<IContributedRulerColumn>();
}
/*
@@ -61,12 +61,12 @@ class DisassemblyColumnSupport implements IColumnSupport {
public final void setColumnVisible(RulerColumnDescriptor descriptor, boolean visible) {
Assert.isLegal(descriptor != null);
- final CompositeRuler ruler= getRuler();
+ final CompositeRuler ruler = getRuler();
if (ruler == null)
return;
if (!isColumnSupported(descriptor))
- visible= false;
+ visible = false;
if (isColumnVisible(descriptor)) {
if (!visible)
@@ -79,12 +79,12 @@ class DisassemblyColumnSupport implements IColumnSupport {
private void addColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) {
- final int idx= computeIndex(ruler, descriptor);
+ final int idx = computeIndex(ruler, descriptor);
- SafeRunnable runnable= new SafeRunnable() {
+ SafeRunnable runnable = new SafeRunnable() {
@Override
public void run() throws Exception {
- IContributedRulerColumn column= descriptor.createColumn(fDisassembly);
+ IContributedRulerColumn column = descriptor.createColumn(fDisassembly);
fColumns.add(column);
initializeColumn(column);
ruler.addDecorator(idx, column);
@@ -109,7 +109,7 @@ class DisassemblyColumnSupport implements IColumnSupport {
private void removeColumn(final CompositeRuler ruler, final IContributedRulerColumn rulerColumn) {
if (rulerColumn != null) {
- SafeRunnable runnable= new SafeRunnable() {
+ SafeRunnable runnable = new SafeRunnable() {
@Override
public void run() throws Exception {
if (ruler != null)
@@ -130,11 +130,11 @@ class DisassemblyColumnSupport implements IColumnSupport {
* @return the matching column or <code>null</code>
*/
private IContributedRulerColumn getVisibleColumn(CompositeRuler ruler, RulerColumnDescriptor descriptor) {
- for (Iterator<?> it= ruler.getDecoratorIterator(); it.hasNext();) {
- IVerticalRulerColumn column= (IVerticalRulerColumn)it.next();
+ for (Iterator<?> it = ruler.getDecoratorIterator(); it.hasNext();) {
+ IVerticalRulerColumn column = (IVerticalRulerColumn) it.next();
if (column instanceof IContributedRulerColumn) {
- IContributedRulerColumn rulerColumn= (IContributedRulerColumn)column;
- RulerColumnDescriptor rcd= rulerColumn.getDescriptor();
+ IContributedRulerColumn rulerColumn = (IContributedRulerColumn) column;
+ RulerColumnDescriptor rcd = rulerColumn.getDescriptor();
if (descriptor.equals(rcd))
return rulerColumn;
}
@@ -150,13 +150,13 @@ class DisassemblyColumnSupport implements IColumnSupport {
* @return the insertion index for a new column
*/
private int computeIndex(CompositeRuler ruler, RulerColumnDescriptor descriptor) {
- int index= 0;
- List<?> all= fRegistry.getColumnDescriptors();
- int newPos= all.indexOf(descriptor);
- for (Iterator<?> it= ruler.getDecoratorIterator(); it.hasNext();) {
- IVerticalRulerColumn column= (IVerticalRulerColumn) it.next();
+ int index = 0;
+ List<?> all = fRegistry.getColumnDescriptors();
+ int newPos = all.indexOf(descriptor);
+ for (Iterator<?> it = ruler.getDecoratorIterator(); it.hasNext();) {
+ IVerticalRulerColumn column = (IVerticalRulerColumn) it.next();
if (column instanceof IContributedRulerColumn) {
- RulerColumnDescriptor rcd= ((IContributedRulerColumn)column).getDescriptor();
+ RulerColumnDescriptor rcd = ((IContributedRulerColumn) column).getDescriptor();
if (rcd != null && all.indexOf(rcd) > newPos)
break;
}
@@ -168,7 +168,7 @@ class DisassemblyColumnSupport implements IColumnSupport {
@Override
public final boolean isColumnVisible(RulerColumnDescriptor descriptor) {
Assert.isLegal(descriptor != null);
- CompositeRuler ruler= getRuler();
+ CompositeRuler ruler = getRuler();
return ruler != null && getVisibleColumn(ruler, descriptor) != null;
}
@@ -188,7 +188,7 @@ class DisassemblyColumnSupport implements IColumnSupport {
* @return the disassembly part's {@link CompositeRuler} or <code>null</code>
*/
private CompositeRuler getRuler() {
- Object ruler= fDisassembly.getAdapter(IVerticalRulerInfo.class);
+ Object ruler = fDisassembly.getAdapter(IVerticalRulerInfo.class);
if (ruler instanceof CompositeRuler)
return (CompositeRuler) ruler;
return null;
@@ -202,7 +202,8 @@ class DisassemblyColumnSupport implements IColumnSupport {
*/
@Override
public void dispose() {
- for (Iterator<IContributedRulerColumn> iter= new ArrayList<IContributedRulerColumn>(fColumns).iterator(); iter.hasNext();)
+ for (Iterator<IContributedRulerColumn> iter = new ArrayList<IContributedRulerColumn>(fColumns).iterator(); iter
+ .hasNext();)
removeColumn(getRuler(), iter.next());
fColumns.clear();
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyDropAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyDropAdapter.java
index cbeee5b18aa..fa4487cc42e 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyDropAdapter.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyDropAdapter.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -21,7 +21,7 @@ import org.eclipse.swt.dnd.*;
public class DisassemblyDropAdapter extends DropTargetAdapter {
private DisassemblyPart fDisassembly;
-
+
/**
* New DisassemblyDropAdapter.
*/
@@ -39,12 +39,12 @@ public class DisassemblyDropAdapter extends DropTargetAdapter {
if (isFileDataType(dataType)) {
// event.data is an array of strings which represent the absolute file pathes
assert event.data instanceof String[];
- String fileNames[] = (String[])event.data;
+ String fileNames[] = (String[]) event.data;
dropFiles(fileNames);
} else if (isTextDataType(dataType)) {
// event.data is a string
assert event.data instanceof String;
- String text = (String)event.data;
+ String text = (String) event.data;
if (text.indexOf('/') != -1 || text.indexOf('.') != -1) {
dropFiles(new String[] { text });
} else {
@@ -74,6 +74,7 @@ public class DisassemblyDropAdapter extends DropTargetAdapter {
private static boolean isFileDataType(TransferData dataType) {
return FileTransfer.getInstance().isSupportedType(dataType);
}
+
private static boolean isTextDataType(TransferData dataType) {
return TextTransfer.getInstance().isSupportedType(dataType);
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyEditor.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyEditor.java
index e0b174e2b46..433a778835f 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyEditor.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyEditor.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -37,7 +37,7 @@ public class DisassemblyEditor extends DisassemblyPart implements IEditorPart {
private Label fContentDescriptionLabel;
/**
- *
+ *
*/
public DisassemblyEditor() {
super();
@@ -70,7 +70,7 @@ public class DisassemblyEditor extends DisassemblyPart implements IEditorPart {
inner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
super.createPartControl(inner);
}
-
+
/*
* @see org.eclipse.ui.part.WorkbenchPart#setContentDescription(java.lang.String)
*/
@@ -105,7 +105,7 @@ public class DisassemblyEditor extends DisassemblyPart implements IEditorPart {
*/
@Override
public IEditorSite getEditorSite() {
- return (IEditorSite)getSite();
+ return (IEditorSite) getSite();
}
/*
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyHyperlinkDetector.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyHyperlinkDetector.java
index ba651e4fb1f..a83b61c6359 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyHyperlinkDetector.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyHyperlinkDetector.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -37,8 +37,8 @@ class DisassemblyHyperlinkDetector extends AbstractHyperlinkDetector {
* @param region
*/
public DisassemblyHyperlink(String symbol, IRegion region) {
- fSymbol= symbol;
- fRegion= region;
+ fSymbol = symbol;
+ fRegion = region;
}
/*
@@ -71,7 +71,7 @@ class DisassemblyHyperlinkDetector extends AbstractHyperlinkDetector {
@Override
public void open() {
if (fPart != null) {
- fPart.gotoSymbol(fSymbol);
+ fPart.gotoSymbol(fSymbol);
}
}
@@ -80,16 +80,15 @@ class DisassemblyHyperlinkDetector extends AbstractHyperlinkDetector {
private DisassemblyPart fPart;
public DisassemblyHyperlinkDetector(DisassemblyPart part) {
- fPart= part;
+ fPart = part;
}
/*
* @see org.eclipse.jface.text.hyperlink.IHyperlinkDetector#detectHyperlinks(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion, boolean)
*/
@Override
- public IHyperlink[] detectHyperlinks(ITextViewer textViewer,
- IRegion region, boolean canShowMultipleHyperlinks) {
- IDocument document= textViewer.getDocument();
+ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
+ IDocument document = textViewer.getDocument();
if (document == null) {
return null;
}
@@ -97,7 +96,7 @@ class DisassemblyHyperlinkDetector extends AbstractHyperlinkDetector {
if (wordRegion != null && wordRegion.getLength() != 0) {
String word;
try {
- word= document.get(wordRegion.getOffset(), wordRegion.getLength());
+ word = document.get(wordRegion.getOffset(), wordRegion.getLength());
return new IHyperlink[] { new DisassemblyHyperlink(word, wordRegion) };
} catch (BadLocationException e) {
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyImageRegistry.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyImageRegistry.java
index 94d445554f1..04bd4c92cbb 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyImageRegistry.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyImageRegistry.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
@@ -29,48 +29,57 @@ public class DisassemblyImageRegistry extends AbstractImageRegistry {
private static List<Object[]> fStore = new ArrayList<Object[]>();
private static String add(String plugin, String[] dirs, String name) {
- String key = plugin+'/'+dirs[0]+'/'+name;
- fStore.add(new Object[] {key, plugin, dirs, name});
- return key;
+ String key = plugin + '/' + dirs[0] + '/' + name;
+ fStore.add(new Object[] { key, plugin, dirs, name });
+ return key;
}
- private static final String ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID = "org.eclipse.debug.ui"; //$NON-NLS-1$
- private static final String ORG_ECLIPSE_UI_PLUGIN_ID = "org.eclipse.ui"; //$NON-NLS-1$
-
- public static final String ICON_ToggleBreakpoint = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID, new String[] { "full/obj16"}, "brkp_obj.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Refresh_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/elcl16"}, "refresh_nav.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Refresh_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dlcl16"}, "refresh_nav.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Copy_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/etool16"}, "copy_edit.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Copy_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dtool16"}, "copy_edit.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Home_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/elcl16"}, "home_nav.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Home_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] {"full/dlcl16"}, "home_nav.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Sync_enabled = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID, new String[] {"full/elcl16"}, "synced.png"); //$NON-NLS-1$ //$NON-NLS-2$
- public static final String ICON_Sync_disabled = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID, new String[] {"full/dlcl16"}, "synced.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ private static final String ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID = "org.eclipse.debug.ui"; //$NON-NLS-1$
+ private static final String ORG_ECLIPSE_UI_PLUGIN_ID = "org.eclipse.ui"; //$NON-NLS-1$
+
+ public static final String ICON_ToggleBreakpoint = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID,
+ new String[] { "full/obj16" }, "brkp_obj.png"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String ICON_Refresh_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/elcl16" }, //$NON-NLS-1$
+ "refresh_nav.png"); //$NON-NLS-1$
+ public static final String ICON_Refresh_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/dlcl16" }, //$NON-NLS-1$
+ "refresh_nav.png"); //$NON-NLS-1$
+ public static final String ICON_Copy_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/etool16" }, //$NON-NLS-1$
+ "copy_edit.png"); //$NON-NLS-1$
+ public static final String ICON_Copy_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/dtool16" }, //$NON-NLS-1$
+ "copy_edit.png"); //$NON-NLS-1$
+ public static final String ICON_Home_enabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/elcl16" }, //$NON-NLS-1$
+ "home_nav.png"); //$NON-NLS-1$
+ public static final String ICON_Home_disabled = add(ORG_ECLIPSE_UI_PLUGIN_ID, new String[] { "full/dlcl16" }, //$NON-NLS-1$
+ "home_nav.png"); //$NON-NLS-1$
+ public static final String ICON_Sync_enabled = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID, new String[] { "full/elcl16" }, //$NON-NLS-1$
+ "synced.png"); //$NON-NLS-1$
+ public static final String ICON_Sync_disabled = add(ORG_ECLIPSE_DEBUG_UI_PLUGIN_ID, new String[] { "full/dlcl16" }, //$NON-NLS-1$
+ "synced.png"); //$NON-NLS-1$
- private static DisassemblyImageRegistry INSTANCE= new DisassemblyImageRegistry(DsfUIPlugin.getDefault());
-
- DisassemblyImageRegistry(Plugin plugin) {
+ private static DisassemblyImageRegistry INSTANCE = new DisassemblyImageRegistry(DsfUIPlugin.getDefault());
+
+ DisassemblyImageRegistry(Plugin plugin) {
super(plugin);
initialize();
}
- void initialize() {
- for (Iterator<Object[]> iter = fStore.iterator(); iter.hasNext();) {
- Object[] element = iter.next();
- if (element.length == 2) {
- String dir= (String) element[0];
- String name= (String) element[1];
- localImage(name, dir, name);
- } else {
- String key = (String) element[0];
- String plugin= (String) element[1];
- String[] dirs= (String[]) element[2];
- String name= (String) element[3];
- externalImage(key, plugin, dirs, name);
- }
- }
+ void initialize() {
+ for (Iterator<Object[]> iter = fStore.iterator(); iter.hasNext();) {
+ Object[] element = iter.next();
+ if (element.length == 2) {
+ String dir = (String) element[0];
+ String name = (String) element[1];
+ localImage(name, dir, name);
+ } else {
+ String key = (String) element[0];
+ String plugin = (String) element[1];
+ String[] dirs = (String[]) element[2];
+ String name = (String) element[3];
+ externalImage(key, plugin, dirs, name);
+ }
+ }
}
-
+
public static ImageDescriptor getImageDescriptor(String key) {
return INSTANCE.getDescriptor(key);
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java
index 8bc7818ae6f..b3a0a09d9d6 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyMessages.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
@@ -80,12 +80,11 @@ public final class DisassemblyMessages extends NLS {
public static String Disassembly_Error_Dialog_title;
public static String Disassembly_Error_Dialog_ok_button;
public static String DisassemblyBackendDsf_error_UnableToRetrieveData;
- public static String Disassembly_action_AddBreakpoint_label;
- public static String Disassembly_action_AddBreakpoint_errorTitle;
- public static String Disassembly_action_AddBreakpoint_errorMessage;
- public static String Disassembly_action_ToggleBreakpoint_accelerator;
+ public static String Disassembly_action_AddBreakpoint_label;
+ public static String Disassembly_action_AddBreakpoint_errorTitle;
+ public static String Disassembly_action_AddBreakpoint_errorMessage;
+ public static String Disassembly_action_ToggleBreakpoint_accelerator;
-
static {
NLS.initializeMessages(DisassemblyMessages.class.getName(), DisassemblyMessages.class);
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
index f0df59c4da9..2d112f14d3d 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Patrick Chuong (Texas Instruments) - Bug 326670
@@ -197,15 +197,17 @@ import com.ibm.icu.text.MessageFormat;
* DisassemblyPart
*/
@SuppressWarnings("restriction")
-public abstract class DisassemblyPart extends WorkbenchPart implements IDisassemblyPart, IViewportListener, ITextPresentationListener, IDisassemblyPartCallback {
+public abstract class DisassemblyPart extends WorkbenchPart
+ implements IDisassemblyPart, IViewportListener, ITextPresentationListener, IDisassemblyPartCallback {
- final static boolean DEBUG = Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.cdt.dsf.ui/debug/disassembly")); //$NON-NLS-1$
+ final static boolean DEBUG = Boolean
+ .parseBoolean(Platform.getDebugOption("org.eclipse.cdt.dsf.ui/debug/disassembly")); //$NON-NLS-1$
/**
* Annotation model attachment key for breakpoint annotations.
*/
- private final static String BREAKPOINT_ANNOTATIONS= "breakpoints"; //$NON-NLS-1$
-
+ private final static String BREAKPOINT_ANNOTATIONS = "breakpoints"; //$NON-NLS-1$
+
/**
* Annotation model attachment key for extended PC annotations.
*/
@@ -236,7 +238,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/**
* A named preference that controls the visible ruler column contributions.
*/
- public static final String PREFERENCE_RULER_CONTRIBUTIONS= "rulerContributions"; //$NON-NLS-1$
+ public static final String PREFERENCE_RULER_CONTRIBUTIONS = "rulerContributions"; //$NON-NLS-1$
protected DisassemblyViewer fViewer;
@@ -254,12 +256,12 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private MarkerAnnotationPreferences fAnnotationPreferences;
private IPreferenceStore fPreferenceStore;
private IOverviewRuler fOverviewRuler;
- private final ListenerList<IMenuListener> fRulerContextMenuListeners= new ListenerList<>(ListenerList.IDENTITY);
+ private final ListenerList<IMenuListener> fRulerContextMenuListeners = new ListenerList<>(ListenerList.IDENTITY);
private SourceViewerDecorationSupport fDecorationSupport;
private Font fFont;
private IVerticalRuler fVerticalRuler;
private IFindReplaceTarget fFindReplaceTarget;
- private IPropertyChangeListener fPropertyChangeListener= new PropertyChangeListener();
+ private IPropertyChangeListener fPropertyChangeListener = new PropertyChangeListener();
private Color fInstructionColor;
private Color fErrorColor;
private Color fSourceColor;
@@ -275,13 +277,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private BigInteger fStartAddress;
private BigInteger fEndAddress;
- private int fAddressSize= 32;
+ private int fAddressSize = 32;
private volatile boolean fUpdatePending;
- private volatile int fUpdateCount;
+ private volatile int fUpdateCount;
private BigInteger fPCAddress;
- private BigInteger fGotoAddressPending= PC_UNKNOWN;
- private BigInteger fFocusAddress= PC_UNKNOWN;
+ private BigInteger fGotoAddressPending = PC_UNKNOWN;
+ private BigInteger fFocusAddress = PC_UNKNOWN;
private int fBufferZone;
private String fDebugSessionId;
private int fTargetFrame;
@@ -292,7 +294,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private Position fScrollPos;
private int fScrollLine;
private Position fFocusPos;
- private BigInteger fFrameAddress= PC_UNKNOWN;
+ private BigInteger fFrameAddress = PC_UNKNOWN;
protected Map<String, Action> fGlobalActions = new HashMap<String, Action>();
private List<Action> fSelectionActions = new ArrayList<Action>();
private List<AbstractDisassemblyAction> fStateDependentActions = new ArrayList<AbstractDisassemblyAction>();
@@ -311,44 +313,50 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private String fPCLastLocationTxt = DisassemblyMessages.Disassembly_GotoLocation_initial_text;
private BigInteger fPCLastAddress = PC_UNKNOWN;
private IAdaptable fDebugContext;
-
+
private String fPCAnnotationColorKey;
private ArrayList<Runnable> fRunnableQueue = new ArrayList<Runnable>();
- protected IPartListener2 fPartListener =
- new IPartListener2() {
- @Override
- public void partActivated(IWorkbenchPartReference partRef) {
- }
- @Override
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
- @Override
- public void partClosed(IWorkbenchPartReference partRef) {
- }
- @Override
- public void partDeactivated(IWorkbenchPartReference partRef) {
- }
- @Override
- public void partOpened(IWorkbenchPartReference partRef) {
- }
- @Override
- public void partHidden(IWorkbenchPartReference partRef) {
- if (partRef.getPart(false) == DisassemblyPart.this) {
- setActive(false);
- }
- }
- @Override
- public void partVisible(IWorkbenchPartReference partRef) {
- if (partRef.getPart(false) == DisassemblyPart.this) {
- setActive(true);
- }
+ protected IPartListener2 fPartListener = new IPartListener2() {
+ @Override
+ public void partActivated(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partBroughtToTop(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partClosed(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partDeactivated(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partOpened(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partHidden(IWorkbenchPartReference partRef) {
+ if (partRef.getPart(false) == DisassemblyPart.this) {
+ setActive(false);
}
- @Override
- public void partInputChanged(IWorkbenchPartReference partRef) {
+ }
+
+ @Override
+ public void partVisible(IWorkbenchPartReference partRef) {
+ if (partRef.getPart(false) == DisassemblyPart.this) {
+ setActive(true);
}
- };
+ }
+
+ @Override
+ public void partInputChanged(IWorkbenchPartReference partRef) {
+ }
+ };
private boolean fActive = true;
private boolean fDoPendingPosted;
@@ -362,66 +370,73 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private ArrayList<IHandlerActivation> fHandlerActivations;
private IContextActivation fContextActivation;
-
+
private IDisassemblyBackend fBackend;
-
+
private AddressBarContributionItem fAddressBar = null;
private Action fJumpToAddressAction = new JumpToAddressAction(this);
- private IDebugContextListener fDebugContextListener;
- private DisassemblyAnnotationModel fExtPCAnnotationModel;
+ private IDebugContextListener fDebugContextListener;
+ private DisassemblyAnnotationModel fExtPCAnnotationModel;
private IColumnSupport fColumnSupport;
- private final class SyncActiveDebugContextAction extends Action {
- public SyncActiveDebugContextAction() {
- setChecked(DisassemblyPart.this.isSyncWithActiveDebugContext());
- setText(DisassemblyMessages.Disassembly_action_Sync_label);
- setImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Sync_enabled));
- setDisabledImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Sync_disabled));
- }
-
- @Override
- public void run() {
- DisassemblyPart.this.setSyncWithDebugView(this.isChecked());
- }
- }
-
- private final class TrackExpressionAction extends Action {
- public TrackExpressionAction() {
- setChecked(DisassemblyPart.this.isTrackExpression());
- setEnabled(!fSynchWithActiveDebugContext);
- setText(DisassemblyMessages.Disassembly_action_TrackExpression_label);
- }
-
- @Override
- public void run() {
- DisassemblyPart.this.setTrackExpression(this.isChecked());
- }
-
- }
-
- private final class ActionRefreshView extends AbstractDisassemblyAction {
+ private final class SyncActiveDebugContextAction extends Action {
+ public SyncActiveDebugContextAction() {
+ setChecked(DisassemblyPart.this.isSyncWithActiveDebugContext());
+ setText(DisassemblyMessages.Disassembly_action_Sync_label);
+ setImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Sync_enabled));
+ setDisabledImageDescriptor(
+ DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Sync_disabled));
+ }
+
+ @Override
+ public void run() {
+ DisassemblyPart.this.setSyncWithDebugView(this.isChecked());
+ }
+ }
+
+ private final class TrackExpressionAction extends Action {
+ public TrackExpressionAction() {
+ setChecked(DisassemblyPart.this.isTrackExpression());
+ setEnabled(!fSynchWithActiveDebugContext);
+ setText(DisassemblyMessages.Disassembly_action_TrackExpression_label);
+ }
+
+ @Override
+ public void run() {
+ DisassemblyPart.this.setTrackExpression(this.isChecked());
+ }
+
+ }
+
+ private final class ActionRefreshView extends AbstractDisassemblyAction {
public ActionRefreshView() {
super(DisassemblyPart.this);
setText(DisassemblyMessages.Disassembly_action_RefreshView_label);
- setImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Refresh_enabled));
- setDisabledImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Refresh_disabled));
+ setImageDescriptor(
+ DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Refresh_enabled));
+ setDisabledImageDescriptor(
+ DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Refresh_disabled));
}
+
@Override
public void run() {
fPCLastAddress = getTopAddress();
refreshView(10);
}
}
-
+
private final class ActionToggleBreakpointEnablement extends AbstractDisassemblyAction {
private IBreakpoint fBreakpoint;
+
public ActionToggleBreakpointEnablement() {
super(DisassemblyPart.this);
- setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label + "\t" + //$NON-NLS-1$
- CDebugUIUtils.formatKeyBindingString(SWT.MOD2, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
+ setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label + "\t" + //$NON-NLS-1$
+ CDebugUIUtils.formatKeyBindingString(SWT.MOD2,
+ DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
}
+
@Override
public void run() {
try {
@@ -430,6 +445,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
internalError(e);
}
}
+
@Override
public void update() {
super.update();
@@ -442,11 +458,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fBreakpoint = bps[0];
try {
if (fBreakpoint.isEnabled()) {
- setText(DisassemblyMessages.Disassembly_action_DisableBreakpoint_label + "\t" + //$NON-NLS-1$
- CDebugUIUtils.formatKeyBindingString(SWT.MOD2, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
+ setText(DisassemblyMessages.Disassembly_action_DisableBreakpoint_label + "\t" + //$NON-NLS-1$
+ CDebugUIUtils.formatKeyBindingString(SWT.MOD2,
+ DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
} else {
- setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label + "\t" + //$NON-NLS-1$
- CDebugUIUtils.formatKeyBindingString(SWT.MOD2, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
+ setText(DisassemblyMessages.Disassembly_action_EnableBreakpoint_label + "\t" + //$NON-NLS-1$
+ CDebugUIUtils.formatKeyBindingString(SWT.MOD2,
+ DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
}
} catch (CoreException e) {
setEnabled(false);
@@ -461,11 +479,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
super(DisassemblyPart.this, IAction.AS_CHECK_BOX);
setText(DisassemblyMessages.Disassembly_action_ShowSource_label);
}
+
@Override
public void run() {
IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
store.setValue(DisassemblyPreferenceConstants.SHOW_SOURCE, !fShowSource);
}
+
@Override
public void update() {
super.update();
@@ -481,11 +501,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
super(DisassemblyPart.this, IAction.AS_CHECK_BOX);
setText(DisassemblyMessages.Disassembly_action_ShowSymbols_label);
}
+
@Override
public void run() {
IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
store.setValue(DisassemblyPreferenceConstants.SHOW_SYMBOLS, !fShowSymbols);
}
+
@Override
public void update() {
super.update();
@@ -507,23 +529,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
-
/**
* The constructor.
*/
public DisassemblyPart() {
fAnnotationPreferences = new MarkerAnnotationPreferences();
setPreferenceStore(new ChainedPreferenceStore(new IPreferenceStore[] {
- DsfUIPlugin.getDefault().getPreferenceStore(), EditorsUI.getPreferenceStore() }));
+ DsfUIPlugin.getDefault().getPreferenceStore(), EditorsUI.getPreferenceStore() }));
fPCAddress = fFrameAddress = PC_UNKNOWN;
fTargetFrame = -1;
fBufferZone = 32;
fPCAnnotation = new DisassemblyIPAnnotation(true, 0);
fSecondaryPCAnnotation = new DisassemblyIPAnnotation(false, 0);
- IPreferenceStore prefs = getPreferenceStore();
+ IPreferenceStore prefs = getPreferenceStore();
fStartAddress = new BigInteger(prefs.getString(DisassemblyPreferenceConstants.START_ADDRESS));
String endAddressString = prefs.getString(DisassemblyPreferenceConstants.END_ADDRESS);
- if(endAddressString.startsWith("0x")) //$NON-NLS-1$
+ if (endAddressString.startsWith("0x")) //$NON-NLS-1$
fEndAddress = new BigInteger(endAddressString.substring(2), 16);
else
fEndAddress = new BigInteger(endAddressString, 16);
@@ -540,34 +561,35 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/*
* @see IAdaptable#getAdapter(java.lang.Class)
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> required) {
if (IVerticalRulerInfo.class.equals(required)) {
if (fVerticalRuler != null) {
- return (T)fVerticalRuler;
+ return (T) fVerticalRuler;
}
} else if (IDisassemblyPart.class.equals(required)) {
- return (T)this;
+ return (T) this;
} else if (IFindReplaceTarget.class.equals(required)) {
if (fFindReplaceTarget == null) {
fFindReplaceTarget = (fViewer == null ? null : fViewer.getFindReplaceTarget());
}
- return (T)fFindReplaceTarget;
+ return (T) fFindReplaceTarget;
} else if (ITextOperationTarget.class.equals(required)) {
- return (fViewer == null ? null : (T)fViewer.getTextOperationTarget());
+ return (fViewer == null ? null : (T) fViewer.getTextOperationTarget());
} else if (Control.class.equals(required)) {
- return fViewer != null ? (T)fViewer.getTextWidget() : null;
+ return fViewer != null ? (T) fViewer.getTextWidget() : null;
} else if (IGotoMarker.class.equals(required)) {
- return (T)new IGotoMarker() {
+ return (T) new IGotoMarker() {
@Override
public void gotoMarker(IMarker marker) {
DisassemblyPart.this.gotoMarker(marker);
- }};
+ }
+ };
} else if (IColumnSupport.class.equals(required)) {
if (fColumnSupport == null)
- fColumnSupport= createColumnSupport();
- return (T)fColumnSupport;
+ fColumnSupport = createColumnSupport();
+ return (T) fColumnSupport;
}
return super.getAdapter(required);
@@ -580,15 +602,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
*/
private void addRulerContributionActions(IMenuManager menu) {
// store directly in generic editor preferences
- final IColumnSupport support= getAdapter(IColumnSupport.class);
- IPreferenceStore store= DsfUIPlugin.getDefault().getPreferenceStore();
- final RulerColumnPreferenceAdapter adapter= new RulerColumnPreferenceAdapter(store, PREFERENCE_RULER_CONTRIBUTIONS);
- List<RulerColumnDescriptor> descriptors= RulerColumnRegistry.getDefault().getColumnDescriptors();
+ final IColumnSupport support = getAdapter(IColumnSupport.class);
+ IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
+ final RulerColumnPreferenceAdapter adapter = new RulerColumnPreferenceAdapter(store,
+ PREFERENCE_RULER_CONTRIBUTIONS);
+ List<RulerColumnDescriptor> descriptors = RulerColumnRegistry.getDefault().getColumnDescriptors();
for (final RulerColumnDescriptor descriptor : descriptors) {
if (!descriptor.isIncludedInMenu() || !support.isColumnSupported(descriptor))
continue;
- final boolean isVisible= support.isColumnVisible(descriptor);
- IAction action= new Action(MessageFormat.format(DisassemblyMessages.DisassemblyPart_showRulerColumn_label, new Object[] {descriptor.getName()}), IAction.AS_CHECK_BOX) {
+ final boolean isVisible = support.isColumnVisible(descriptor);
+ IAction action = new Action(MessageFormat.format(DisassemblyMessages.DisassemblyPart_showRulerColumn_label,
+ new Object[] { descriptor.getName() }), IAction.AS_CHECK_BOX) {
@Override
public void run() {
if (descriptor.isGlobal())
@@ -611,16 +635,16 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* @param ruler the composite ruler to add contributions to
*/
protected void updateContributedRulerColumns(CompositeRuler ruler) {
- IColumnSupport support= getAdapter(IColumnSupport.class);
+ IColumnSupport support = getAdapter(IColumnSupport.class);
if (support == null)
return;
- RulerColumnPreferenceAdapter adapter= null;
+ RulerColumnPreferenceAdapter adapter = null;
if (fPreferenceStore != null)
- adapter= new RulerColumnPreferenceAdapter(getPreferenceStore(), PREFERENCE_RULER_CONTRIBUTIONS);
+ adapter = new RulerColumnPreferenceAdapter(getPreferenceStore(), PREFERENCE_RULER_CONTRIBUTIONS);
- RulerColumnRegistry registry= RulerColumnRegistry.getDefault();
- List<RulerColumnDescriptor> descriptors= registry.getColumnDescriptors();
+ RulerColumnRegistry registry = RulerColumnRegistry.getDefault();
+ List<RulerColumnDescriptor> descriptors = registry.getColumnDescriptors();
for (RulerColumnDescriptor descriptor : descriptors) {
support.setColumnVisible(descriptor, adapter == null || adapter.isEnabled(descriptor));
}
@@ -629,7 +653,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
protected IColumnSupport createColumnSupport() {
return new DisassemblyColumnSupport(this, RulerColumnRegistry.getDefault());
}
-
+
private void setPreferenceStore(IPreferenceStore store) {
if (fPreferenceStore != null) {
fPreferenceStore.removePropertyChangeListener(fPropertyChangeListener);
@@ -684,19 +708,20 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
} else if (property.equals(fPCAnnotationColorKey)) {
fPCAnnotationRGB = PreferenceConverter.getColor(store, fPCAnnotationColorKey);
// redraw
- for (Iterator<AddressRangePosition> it=fPCHistory.iterator(); it.hasNext();) {
+ for (Iterator<AddressRangePosition> it = fPCHistory.iterator(); it.hasNext();) {
AddressRangePosition pos = it.next();
fViewer.invalidateTextPresentation(pos.offset, pos.length);
}
} else if (property.equals(DisassemblyPreferenceConstants.PC_HISTORY_SIZE)) {
fPCHistorySizeMax = store.getInt(property);
} else if (PREFERENCE_RULER_CONTRIBUTIONS.equals(property)) {
- String[] difference= StringSetSerializer.getDifference((String) event.getOldValue(), (String) event.getNewValue());
- IColumnSupport support= getAdapter(IColumnSupport.class);
- for (int i= 0; i < difference.length; i++) {
- RulerColumnDescriptor desc= RulerColumnRegistry.getDefault().getColumnDescriptor(difference[i]);
- if (desc != null && support.isColumnSupported(desc)) {
- boolean newState= !support.isColumnVisible(desc);
+ String[] difference = StringSetSerializer.getDifference((String) event.getOldValue(),
+ (String) event.getNewValue());
+ IColumnSupport support = getAdapter(IColumnSupport.class);
+ for (int i = 0; i < difference.length; i++) {
+ RulerColumnDescriptor desc = RulerColumnRegistry.getDefault().getColumnDescriptor(difference[i]);
+ if (desc != null && support.isColumnSupported(desc)) {
+ boolean newState = !support.isColumnVisible(desc);
support.setColumnVisible(desc, newState);
}
}
@@ -721,7 +746,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fViewer.addTextPresentationListener(this);
fViewer.configure(sourceViewerConfig);
fDecorationSupport = new SourceViewerDecorationSupport(fViewer, getOverviewRuler(), getAnnotationAccess(),
- getSharedColors());
+ getSharedColors());
configureSourceViewerDecorationSupport(fDecorationSupport);
fDecorationSupport.install(getPreferenceStore());
if (fPCAnnotationColorKey != null) {
@@ -739,7 +764,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
hookRulerContextMenu();
hookContextMenu();
contributeToActionBars();
-
+
fViewer.getTextWidget().addVerifyKeyListener(new VerifyKeyListener() {
@Override
public void verifyKey(VerifyEvent event) {
@@ -765,16 +790,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fSourceColor = getSharedColors().getColor(new RGB(64, 0, 80));
fLabelColor = getSharedColors().getColor(new RGB(0, 0, 96));
- IVerticalRuler ruler= getVerticalRuler();
+ IVerticalRuler ruler = getVerticalRuler();
if (ruler instanceof CompositeRuler) {
updateContributedRulerColumns((CompositeRuler) ruler);
}
initDragAndDrop();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fViewer.getControl(), IDisassemblyHelpContextIds.DISASSEMBLY_VIEW);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(fViewer.getControl(),
+ IDisassemblyHelpContextIds.DISASSEMBLY_VIEW);
updateTitle();
updateStateDependentActions();
-
+
if (fDebugSessionId != null) {
debugContextChanged();
} else {
@@ -788,16 +814,16 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
@Override
protected void setSite(IWorkbenchPartSite site) {
super.setSite(site);
- site.getPage().addPartListener(fPartListener);
- fDebugContextListener = new IDebugContextListener() {
- @Override
+ site.getPage().addPartListener(fPartListener);
+ fDebugContextListener = new IDebugContextListener() {
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
- updateDebugContext();
- }
- }
- };
- DebugUITools.addPartDebugContextListener(site, fDebugContextListener);
+ if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) {
+ updateDebugContext();
+ }
+ }
+ };
+ DebugUITools.addPartDebugContextListener(site, fDebugContextListener);
}
private DisassemblyDocument createDocument() {
@@ -814,25 +840,25 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
IWorkbenchPartSite site = getSite();
site.setSelectionProvider(null);
site.getPage().removePartListener(fPartListener);
- if (fDebugContextListener != null) {
- DebugUITools.removePartDebugContextListener(site, fDebugContextListener);
- fDebugContextListener = null;
- }
+ if (fDebugContextListener != null) {
+ DebugUITools.removePartDebugContextListener(site, fDebugContextListener);
+ fDebugContextListener = null;
+ }
if (fHandlerActivations != null) {
IHandlerService handlerService = site.getService(IHandlerService.class);
handlerService.deactivateHandlers(fHandlerActivations);
fHandlerActivations = null;
}
-
+
deactivateDisassemblyContext();
-
+
fViewer = null;
if (fBackend != null) {
fBackend.clearDebugContext();
fBackend.dispose();
fBackend = null;
}
-
+
fAnnotationAccess = null;
fAnnotationPreferences = null;
fAnnotationRulerColumn = null;
@@ -860,7 +886,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
if (fColumnSupport != null) {
fColumnSupport.dispose();
- fColumnSupport= null;
+ fColumnSupport = null;
}
fDocument.dispose();
@@ -896,7 +922,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
Iterator<?> e = fAnnotationPreferences.getAnnotationPreferences().iterator();
while (e.hasNext()) {
- AnnotationPreference pref = (AnnotationPreference)e.next();
+ AnnotationPreference pref = (AnnotationPreference) e.next();
support.setAnnotationPreference(pref);
if (pref.getAnnotationType().equals(fPCAnnotation.getType())) {
fPCAnnotationColorKey = pref.getColorPreferenceKey();
@@ -945,7 +971,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
else if (fPreferenceStore != null) {
// Backward compatibility
if (fPreferenceStore.contains(JFaceResources.TEXT_FONT)
- && !fPreferenceStore.isDefault(JFaceResources.TEXT_FONT)) {
+ && !fPreferenceStore.isDefault(JFaceResources.TEXT_FONT)) {
FontData data = PreferenceConverter.getFontData(fPreferenceStore, JFaceResources.TEXT_FONT);
if (data != null) {
@@ -1029,7 +1055,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
IVerticalRulerColumn column = (IVerticalRulerColumn) iter.next();
if (column instanceof AnnotationRulerColumn) {
fAnnotationRulerColumn = (AnnotationRulerColumn) column;
- for (Iterator<?> iter2 = fAnnotationPreferences.getAnnotationPreferences().iterator(); iter2.hasNext();) {
+ for (Iterator<?> iter2 = fAnnotationPreferences.getAnnotationPreferences().iterator(); iter2
+ .hasNext();) {
AnnotationPreference preference = (AnnotationPreference) iter2.next();
String key = preference.getVerticalRulerPreferenceKey();
boolean showAnnotation = true;
@@ -1087,29 +1114,28 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* @param rulerColumn the ruler column to be initialized
*/
protected void initializeRulerColumn(DisassemblyRulerColumn rulerColumn, String colorPrefKey) {
- ISharedTextColors sharedColors= getSharedColors();
- IPreferenceStore store= getPreferenceStore();
+ ISharedTextColors sharedColors = getSharedColors();
+ IPreferenceStore store = getPreferenceStore();
if (store != null) {
- RGB rgb= null;
+ RGB rgb = null;
// foreground color
if (store.contains(colorPrefKey)) {
if (store.isDefault(colorPrefKey))
- rgb= PreferenceConverter.getDefaultColor(store, colorPrefKey);
+ rgb = PreferenceConverter.getDefaultColor(store, colorPrefKey);
else
- rgb= PreferenceConverter.getColor(store, colorPrefKey);
+ rgb = PreferenceConverter.getColor(store, colorPrefKey);
}
if (rgb == null)
- rgb= new RGB(0, 0, 0);
+ rgb = new RGB(0, 0, 0);
rulerColumn.setForeground(sharedColors.getColor(rgb));
- rgb= null;
+ rgb = null;
rulerColumn.redraw();
}
}
-
/**
* @return the preference store
*/
@@ -1195,7 +1221,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
bars.setGlobalActionHandler(key, action);
}
IMenuManager menu = bars.getMenuManager();
- IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
+ IMenuManager navigateMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
if (navigateMenu != null) {
navigateMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fActionGotoPC);
navigateMenu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fActionGotoAddress);
@@ -1212,8 +1238,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
manager.add(new Separator("group.breakpoints")); //$NON-NLS-1$
manager.add(new Separator("group.debug")); //$NON-NLS-1$
manager.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
- manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.COPY));
- manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
+ manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
+ fGlobalActions.get(ITextEditorActionConstants.COPY));
+ manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
+ fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL));
manager.add(new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
manager.add(fActionToggleSource);
manager.add(fActionToggleSymbols);
@@ -1241,36 +1269,39 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
listener.menuAboutToShow(manager);
manager.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
- manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.COPY));
+ manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT,
+ fGlobalActions.get(ITextEditorActionConstants.COPY));
}
protected void fillLocalToolBar(IToolBarManager manager) {
final int ADDRESS_BAR_WIDTH = 190;
- ToolBar toolbar = ((ToolBarManager)manager).getControl();
+ ToolBar toolbar = ((ToolBarManager) manager).getControl();
fAddressBar = new AddressBarContributionItem(fJumpToAddressAction);
- fAddressBar.createAddressBox(toolbar, ADDRESS_BAR_WIDTH, DisassemblyMessages.Disassembly_GotoLocation_initial_text, DisassemblyMessages.Disassembly_GotoLocation_warning);
+ fAddressBar.createAddressBox(toolbar, ADDRESS_BAR_WIDTH,
+ DisassemblyMessages.Disassembly_GotoLocation_initial_text,
+ DisassemblyMessages.Disassembly_GotoLocation_warning);
manager.add(fAddressBar);
- fJumpToAddressAction.setEnabled(fDebugSessionId!=null);
-
+ fJumpToAddressAction.setEnabled(fDebugSessionId != null);
+
manager.add(new Separator());
manager.add(fActionRefreshView);
manager.add(fActionGotoPC);
manager.add(fSyncAction);
manager.add(fActionToggleSource);
- // Other plug-ins can contribute their actions here
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ // Other plug-ins can contribute their actions here
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
protected void updateSelectionDependentActions() {
- Iterator<Action> iterator= fSelectionActions.iterator();
+ Iterator<Action> iterator = fSelectionActions.iterator();
while (iterator.hasNext()) {
- IUpdate action = (IUpdate)iterator.next();
+ IUpdate action = (IUpdate) iterator.next();
action.update();
}
}
protected void updateStateDependentActions() {
- Iterator<AbstractDisassemblyAction> iterator= fStateDependentActions.iterator();
+ Iterator<AbstractDisassemblyAction> iterator = fStateDependentActions.iterator();
while (iterator.hasNext()) {
IUpdate action = iterator.next();
action.update();
@@ -1279,35 +1310,39 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
protected void createActions() {
Action action;
- action= new TextOperationAction(fViewer, ITextOperationTarget.COPY);
+ action = new TextOperationAction(fViewer, ITextOperationTarget.COPY);
action.setText(DisassemblyMessages.Disassembly_action_Copy_label);
- action.setImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Copy_enabled));
- action.setDisabledImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Copy_disabled));
+ action.setImageDescriptor(
+ DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Copy_enabled));
+ action.setDisabledImageDescriptor(
+ DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Copy_disabled));
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
fGlobalActions.put(ITextEditorActionConstants.COPY, action);
fSelectionActions.add(action);
- action= new TextOperationAction(fViewer, ITextOperationTarget.SELECT_ALL);
+ action = new TextOperationAction(fViewer, ITextOperationTarget.SELECT_ALL);
action.setText(DisassemblyMessages.Disassembly_action_SelectAll_label);
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
fGlobalActions.put(ITextEditorActionConstants.SELECT_ALL, action);
- action= new TextOperationAction(fViewer, ITextOperationTarget.PRINT);
+ action = new TextOperationAction(fViewer, ITextOperationTarget.PRINT);
action.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PRINT);
fGlobalActions.put(ITextEditorActionConstants.PRINT, action);
- action= new FindReplaceAction(DisassemblyMessages.getBundleForConstructedKeys(), "FindReplaceAction.", this); //$NON-NLS-1$
+ action = new FindReplaceAction(DisassemblyMessages.getBundleForConstructedKeys(), "FindReplaceAction.", this); //$NON-NLS-1$
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
fGlobalActions.put(ActionFactory.FIND.getId(), action);
fSelectionActions.add(action);
fActionGotoPC = new ActionGotoProgramCounter(this);
fActionGotoPC.setActionDefinitionId(COMMAND_ID_GOTO_PC);
- fActionGotoPC.setImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Home_enabled));
- fActionGotoPC.setDisabledImageDescriptor(DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Home_disabled));
+ fActionGotoPC.setImageDescriptor(
+ DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Home_enabled));
+ fActionGotoPC.setDisabledImageDescriptor(
+ DisassemblyImageRegistry.getImageDescriptor(DisassemblyImageRegistry.ICON_Home_disabled));
fStateDependentActions.add(fActionGotoPC);
registerWithHandlerService(fActionGotoPC);
-
+
fActionGotoAddress = new ActionGotoAddress(this);
fActionGotoAddress.setActionDefinitionId(COMMAND_ID_GOTO_ADDRESS);
fStateDependentActions.add(fActionGotoAddress);
@@ -1315,7 +1350,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fActionToggleSource = new ActionToggleSource();
fStateDependentActions.add(fActionToggleSource);
- fActionToggleSource.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(DsfUIPlugin.PLUGIN_ID, "icons/source.gif")); //$NON-NLS-1$
+ fActionToggleSource.setImageDescriptor(
+ AbstractUIPlugin.imageDescriptorFromPlugin(DsfUIPlugin.PLUGIN_ID, "icons/source.gif")); //$NON-NLS-1$
fVerticalRuler.getControl().addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(final MouseEvent e) {
@@ -1323,17 +1359,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
IHandlerService handlerService = getSite().getService(IHandlerService.class);
if (handlerService != null) {
try {
- Event event= new Event();
- event.display = e.display;
- event.widget = e.widget;
- event.time = e.time;
- event.data = e.data;
- event.x = e.x;
- event.y = e.y;
- event.button = e.button;
- event.stateMask = e.stateMask;
- event.count = e.count;
-
+ Event event = new Event();
+ event.display = e.display;
+ event.widget = e.widget;
+ event.time = e.time;
+ event.data = e.data;
+ event.x = e.x;
+ event.y = e.y;
+ event.button = e.button;
+ event.stateMask = e.stateMask;
+ event.count = e.count;
+
handlerService.executeCommand(COMMAND_ID_TOGGLE_BREAKPOINT, event);
} catch (org.eclipse.core.commands.ExecutionException exc) {
DsfUIPlugin.log(exc);
@@ -1356,7 +1392,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/**
* Register given action with the handler service for key bindings.
- *
+ *
* @param action
*/
private void registerWithHandlerService(IAction action) {
@@ -1364,7 +1400,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fHandlerActivations = new ArrayList<IHandlerActivation>(5);
}
IHandlerService handlerService = getSite().getService(IHandlerService.class);
- fHandlerActivations.add(handlerService.activateHandler(action.getActionDefinitionId(), new ActionHandler(action)));
+ fHandlerActivations
+ .add(handlerService.activateHandler(action.getActionDefinitionId(), new ActionHandler(action)));
}
/*
@@ -1396,17 +1433,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
});
}
}
-
+
public final void gotoLocationByUser(BigInteger address, String locationTxt) {
fPCLastAddress = address;
fPCLastLocationTxt = locationTxt;
gotoAddress(address);
}
-
+
public final void gotoActiveFrameByUser() {
gotoFrame(getActiveStackFrame());
}
-
+
/*
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#gotoAddress(java.math.BigInteger)
*/
@@ -1415,7 +1452,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fDebugSessionId == null) {
return;
}
- if (DEBUG) System.out.println("gotoAddress " + getAddressText(address)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("gotoAddress " + getAddressText(address)); //$NON-NLS-1$
fFocusAddress = address;
BigInteger previousAddress = fGotoAddressPending;
if (fGotoAddressPending == PC_UNKNOWN) {
@@ -1427,21 +1465,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
AddressRangePosition pos = getPositionOfAddress(address);
if (pos != null) {
if (pos.fValid) {
- if ((pos instanceof ErrorPosition || !pos.fAddressOffset.equals(address)) && !previousAddress.equals(address)) {
- // address is within a disassembled instruction or error - need to invalidate
- pos.fValid = false;
- fDocument.addInvalidAddressRange(pos);
- } else {
- if (fGotoAddressPending.equals(address)) {
- fGotoAddressPending = PC_UNKNOWN;
- }
- gotoPosition(pos, !address.equals(fFrameAddress));
- return;
- }
- }
- int lines = fBufferZone+3;
- BigInteger endAddress = pos.fAddressOffset.add(pos.fAddressLength).min(
- address.add(BigInteger.valueOf(lines * fDocument.getMeanSizeOfInstructions())));
+ if ((pos instanceof ErrorPosition || !pos.fAddressOffset.equals(address))
+ && !previousAddress.equals(address)) {
+ // address is within a disassembled instruction or error - need to invalidate
+ pos.fValid = false;
+ fDocument.addInvalidAddressRange(pos);
+ } else {
+ if (fGotoAddressPending.equals(address)) {
+ fGotoAddressPending = PC_UNKNOWN;
+ }
+ gotoPosition(pos, !address.equals(fFrameAddress));
+ return;
+ }
+ }
+ int lines = fBufferZone + 3;
+ BigInteger endAddress = pos.fAddressOffset.add(pos.fAddressLength)
+ .min(address.add(BigInteger.valueOf(lines * fDocument.getMeanSizeOfInstructions())));
retrieveDisassembly(address, endAddress, lines);
}
}
@@ -1498,28 +1537,28 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
*/
@Override
public void viewportChanged(int verticalOffset) {
- if (fDebugSessionId != null && fGotoAddressPending == PC_UNKNOWN && fScrollPos == null && !fUpdatePending && !fRefreshViewPending
- && fFocusAddress != PC_UNKNOWN) {
+ if (fDebugSessionId != null && fGotoAddressPending == PC_UNKNOWN && fScrollPos == null && !fUpdatePending
+ && !fRefreshViewPending && fFocusAddress != PC_UNKNOWN) {
fUpdatePending = true;
- final int updateCount = fUpdateCount;
- invokeLater(new Runnable() {
- @Override
+ final int updateCount = fUpdateCount;
+ invokeLater(new Runnable() {
+ @Override
public void run() {
- if (updateCount == fUpdateCount) {
- assert fUpdatePending;
- if (fUpdatePending) {
- fUpdatePending = false;
- updateVisibleArea();
- }
- }
- }
- });
+ if (updateCount == fUpdateCount) {
+ assert fUpdatePending;
+ if (fUpdatePending) {
+ fUpdatePending = false;
+ updateVisibleArea();
+ }
+ }
+ }
+ });
}
}
/**
* Update lines of currently visible area + one page buffer zone below.
- *
+ *
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#updateVisibleArea()
*/
@Override
@@ -1539,7 +1578,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
int bottomIndex = fViewer.getBottomIndex();
int focusIndex = -1;
boolean focusVisible = false;
- boolean isScrollingUp = fViewer.isUserTriggeredScrolling() && fViewer.getLastTopPixel() >= styledText.getTopPixel();
+ boolean isScrollingUp = fViewer.isUserTriggeredScrolling()
+ && fViewer.getLastTopPixel() >= styledText.getTopPixel();
if (fFocusPos != null) {
try {
int focusOffset = fFocusPos.offset;
@@ -1565,16 +1605,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
AddressRangePosition bestPosition = null;
int bestLine = -1;
BigInteger bestDistance = null;
- if (DEBUG) System.out.println("DisassemblyPart.updateVisibleArea() called. There are " + fDocument.getInvalidAddressRanges().length + " invalid ranges to consider updating"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (DEBUG)
+ System.out.println("DisassemblyPart.updateVisibleArea() called. There are " //$NON-NLS-1$
+ + fDocument.getInvalidAddressRanges().length + " invalid ranges to consider updating"); //$NON-NLS-1$
for (AddressRangePosition p : fDocument.getInvalidAddressRanges()) {
try {
int line = fDocument.getLineOfOffset(p.offset);
if (line >= topIndex && line <= bottomIndex) {
- if (p instanceof DisassemblyPosition || p.fAddressLength.compareTo(
- BigInteger.valueOf(fBufferZone * 2)) <= 0) {
+ if (p instanceof DisassemblyPosition
+ || p.fAddressLength.compareTo(BigInteger.valueOf(fBufferZone * 2)) <= 0) {
// small areas and known areas are OK to update
- } else if (!isScrollingUp && !fUpdateBeforeFocus
- && p.fAddressOffset.compareTo(focusAddress) < 0) {
+ } else if (!isScrollingUp && !fUpdateBeforeFocus && p.fAddressOffset.compareTo(focusAddress) < 0) {
continue;
}
BigInteger distance = p.fAddressOffset.subtract(focusAddress).abs();
@@ -1592,8 +1633,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
if (bestPosition != null) {
- if (DEBUG) System.out.println("...and the best candidate is: " + bestPosition); //$NON-NLS-1$
- int lines = fBufferZone+3;
+ if (DEBUG)
+ System.out.println("...and the best candidate is: " + bestPosition); //$NON-NLS-1$
+ int lines = fBufferZone + 3;
BigInteger startAddress = bestPosition.fAddressOffset;
BigInteger endAddress = bestPosition.fAddressOffset.add(bestPosition.fAddressLength);
BigInteger addressRange = BigInteger.valueOf(lines * fDocument.getMeanSizeOfInstructions());
@@ -1603,7 +1645,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
// try to increase range to reduce number of requests
Iterator<?> iter = fDocument.getModelPositionIterator(endAddress);
while (iter.hasNext()) {
- AddressRangePosition p = (AddressRangePosition)iter.next();
+ AddressRangePosition p = (AddressRangePosition) iter.next();
if (p.fValid) {
endAddress = endAddress.add(p.fAddressLength);
if (endAddress.subtract(startAddress).compareTo(addressRange) >= 0) {
@@ -1621,8 +1663,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
lines = endAddress.subtract(startAddress).intValue();
}
retrieveDisassembly(startAddress, endAddress, lines);
- }
- else {
+ } else {
if (DEBUG) {
System.out.println("...but alas we didn't deem any of them worth updating. They are:"); //$NON-NLS-1$
int i = 0;
@@ -1643,9 +1684,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fViewer.getControl().getDisplay().asyncExec(runnable);
}
}
+
private void invokeLater(Runnable runnable) {
invokeLater(10, runnable);
}
+
private void invokeLater(int delay, Runnable runnable) {
if (fViewer != null) {
fViewer.getControl().getDisplay().timerExec(delay, runnable);
@@ -1654,7 +1697,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
/**
* Insert source lines if available.
- *
+ *
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#updateInvalidSource()
*/
@Override
@@ -1667,10 +1710,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
try {
if (fScrollPos == null) {
if (fUpdatePending) {
- fUpdateSourcePending= true;
+ fUpdateSourcePending = true;
return;
}
- fUpdateSourcePending= false;
+ fUpdateSourcePending = false;
unlock = true;
fUpdatePending = true;
lockScroller();
@@ -1680,7 +1723,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (!p.fValid) {
insertSource(p);
} else if (DEBUG && fDocument.removeInvalidSourcePosition(p)) {
- System.err.println("!!! valid source position in invalid source list at "+ getAddressText(p.fAddressOffset)); //$NON-NLS-1$
+ System.err.println(
+ "!!! valid source position in invalid source list at " + getAddressText(p.fAddressOffset)); //$NON-NLS-1$
}
}
} finally {
@@ -1696,7 +1740,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* Show disassembly for given (source) file. Retrieves disassembly starting
* at the beginning of the file, for as many lines as are specified. If
* [lines] == -1, the entire file is disassembled.
- *
+ *
* @param file
* @param lines
*/
@@ -1704,20 +1748,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fDebugSessionId == null) {
return;
}
- startUpdate(new Runnable() {
- @Override
+ startUpdate(new Runnable() {
+ @Override
public void run() {
- if (DEBUG) System.out.println("retrieveDisassembly "+file); //$NON-NLS-1$
- fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
- }
- });
+ if (DEBUG)
+ System.out.println("retrieveDisassembly " + file); //$NON-NLS-1$
+ fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
+ }
+ });
}
private void retrieveDisassembly(BigInteger startAddress, BigInteger endAddress, int lines) {
if (fDebugSessionId == null) {
return;
}
- if (DEBUG) System.out.println("retrieveDisassembly "+getAddressText(startAddress)+" "+lines+" lines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (DEBUG)
+ System.out.println("retrieveDisassembly " + getAddressText(startAddress) + " " + lines + " lines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
retrieveDisassembly(startAddress, endAddress, lines, fShowSource, true);
}
@@ -1725,29 +1771,33 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#retrieveDisassembly(java.math.BigInteger, java.math.BigInteger, int, boolean, boolean)
*/
@Override
- public void retrieveDisassembly(final BigInteger startAddress, BigInteger endAddress, final int linesHint, boolean mixed, boolean ignoreFile) {
+ public void retrieveDisassembly(final BigInteger startAddress, BigInteger endAddress, final int linesHint,
+ boolean mixed, boolean ignoreFile) {
assert isGuiThread();
assert !fUpdatePending;
fUpdatePending = true;
- final int lines= linesHint + 2;
- final BigInteger addressLength= BigInteger.valueOf(lines * 4);
+ final int lines = linesHint + 2;
+ final BigInteger addressLength = BigInteger.valueOf(lines * 4);
if (endAddress.subtract(startAddress).compareTo(addressLength) > 0) {
- endAddress= startAddress.add(addressLength);
+ endAddress = startAddress.add(addressLength);
}
- boolean insideActiveFrame= startAddress.equals(fFrameAddress);
- String file= null;
- int lineNumber= -1;
+ boolean insideActiveFrame = startAddress.equals(fFrameAddress);
+ String file = null;
+ int lineNumber = -1;
if (!ignoreFile && insideActiveFrame && fBackend != null) {
- file= fBackend.getFrameFile();
+ file = fBackend.getFrameFile();
if (file != null && file.trim().length() == 0) {
file = null;
}
if (file != null) {
- lineNumber= fBackend.getFrameLine();
+ lineNumber = fBackend.getFrameLine();
}
}
- if (DEBUG) System.out.println("Asking backend to retrieve disassembly: sa=0x" + startAddress.toString(16) + ",ea=0x" + endAddress.toString(16) + ",file=" + file + ",lineNumber=" + lineNumber + ",lines=" + lines); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- fBackend.retrieveDisassembly(startAddress, endAddress, file, lineNumber, lines, mixed, fShowSymbols, fShowDisassembly, linesHint);
+ if (DEBUG)
+ System.out.println("Asking backend to retrieve disassembly: sa=0x" + startAddress.toString(16) + ",ea=0x" //$NON-NLS-1$//$NON-NLS-2$
+ + endAddress.toString(16) + ",file=" + file + ",lineNumber=" + lineNumber + ",lines=" + lines); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ fBackend.retrieveDisassembly(startAddress, endAddress, file, lineNumber, lines, mixed, fShowSymbols,
+ fShowDisassembly, linesHint);
}
/* (non-Javadoc)
@@ -1776,20 +1826,20 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
assert isGuiThread();
return fAddressSize;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#addressSizeChanged(int)
*/
@Override
public void addressSizeChanged(int addressSize) {
assert isGuiThread();
- BigInteger oldEndAddress= fEndAddress;
- fEndAddress= BigInteger.ONE.shiftLeft(addressSize);
- int oldAddressSize= fAddressSize;
- fAddressSize= addressSize;
+ BigInteger oldEndAddress = fEndAddress;
+ fEndAddress = BigInteger.ONE.shiftLeft(addressSize);
+ int oldAddressSize = fAddressSize;
+ fAddressSize = addressSize;
if (addressSize < oldAddressSize) {
fDocument.deleteDisassemblyRange(fEndAddress, oldEndAddress, true, true);
- List<AddressRangePosition> toRemove= new ArrayList<AddressRangePosition>();
+ List<AddressRangePosition> toRemove = new ArrayList<AddressRangePosition>();
for (AddressRangePosition position : fDocument.getInvalidAddressRanges()) {
if (position.fAddressOffset.compareTo(fEndAddress) >= 0) {
try {
@@ -1799,8 +1849,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
} catch (BadLocationException exc) {
internalError(exc);
}
- } else if (position.containsAddress(fEndAddress)){
- position.fAddressLength= fEndAddress.subtract(position.fAddressOffset);
+ } else if (position.containsAddress(fEndAddress)) {
+ position.fAddressLength = fEndAddress.subtract(position.fAddressOffset);
}
}
fDocument.removeInvalidAddressRanges(toRemove);
@@ -1810,14 +1860,14 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
return;
}
AddressRulerColumn fAddressRulerColumn = (AddressRulerColumn) getRulerColumn(AddressRulerColumn.ID);
- if (fAddressRulerColumn != null) {
+ if (fAddressRulerColumn != null) {
fAddressRulerColumn.setAddressSize(addressSize);
if (fComposite != null) {
fComposite.layout(true);
}
}
}
-
+
private IContributedRulerColumn getRulerColumn(String id) {
CompositeRuler compositeRuler = (CompositeRuler) getVerticalRuler();
for (Iterator<?> iter = compositeRuler.getDecoratorIterator(); iter.hasNext();) {
@@ -1859,7 +1909,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
protected void setActive(boolean active) {
- if (DEBUG) System.out.println("setActive("+ active +")"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (DEBUG)
+ System.out.println("setActive(" + active + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fActive = active;
if (fActive) {
if (fRefreshAll) {
@@ -1870,7 +1921,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fBackend != null && fBackend.hasDebugContext()) {
int frame = getActiveStackFrame();
if (frame < 0 && isSuspended()) {
- frame= 0;
+ frame = 0;
}
if (frame != fTargetFrame) {
gotoFrame(frame);
@@ -1878,7 +1929,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
} else {
- fGotoAddressPending= fFocusAddress= PC_UNKNOWN;
+ fGotoAddressPending = fFocusAddress = PC_UNKNOWN;
}
firePropertyChange(PROP_ACTIVE);
}
@@ -1900,7 +1951,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
IDisassemblyBackend contextBackend = fDebugContext.getAdapter(IDisassemblyBackend.class);
// Need to compare the backend classes to prevent reusing the same backend object.
// sub class can overwrite the standard disassembly backend to provide its own customization.
- if ((prevBackend != null) && (contextBackend != null) && prevBackend.getClass().equals(contextBackend.getClass()) && prevBackend.supportsDebugContext(fDebugContext)) {
+ if ((prevBackend != null) && (contextBackend != null)
+ && prevBackend.getClass().equals(contextBackend.getClass())
+ && prevBackend.supportsDebugContext(fDebugContext)) {
newBackend = prevBackend;
} else {
needUpdate = true;
@@ -1949,6 +2002,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
public void run() {
update.run();
}
+
@Override
public void handleException(Throwable e) {
internalError(e);
@@ -1972,15 +2026,16 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
private void debugContextChanged() {
- if (DEBUG) System.out.println("DisassemblyPart.debugContextChanged()"); //$NON-NLS-1$
- fUpdateCount++;
+ if (DEBUG)
+ System.out.println("DisassemblyPart.debugContextChanged()"); //$NON-NLS-1$
+ fUpdateCount++;
fRunnableQueue.clear();
fUpdatePending = false;
resetViewer();
if (fDebugSessionId != null) {
fJumpToAddressAction.setEnabled(true);
if (fAddressBar != null)
- fAddressBar.enableAddressBox(true);
+ fAddressBar.enableAddressBox(true);
int activeFrame = getActiveStackFrame();
if (activeFrame > 0) {
@@ -1989,20 +2044,20 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
updatePC(PC_UNKNOWN);
}
- if (fGotoAddressPending != PC_UNKNOWN) {
- gotoAddress(fGotoAddressPending);
- }
- if (fGotoMarkerPending != null) {
- gotoMarker(fGotoMarkerPending);
- }
+ if (fGotoAddressPending != PC_UNKNOWN) {
+ gotoAddress(fGotoAddressPending);
+ }
+ if (fGotoMarkerPending != null) {
+ gotoMarker(fGotoMarkerPending);
+ }
fViewer.addViewportListener(this);
- } else {
- fJumpToAddressAction.setEnabled(false);
- if (fAddressBar != null)
- fAddressBar.enableAddressBox(false);
+ } else {
+ fJumpToAddressAction.setEnabled(false);
+ if (fAddressBar != null)
+ fAddressBar.enableAddressBox(false);
fViewer.removeViewportListener(this);
- fGotoMarkerPending = null;
- }
+ fGotoMarkerPending = null;
+ }
updateTitle();
updateStateDependentActions();
firePropertyChange(PROP_CONNECTED);
@@ -2012,16 +2067,16 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private void attachExtendedPCAnnotationModel() {
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
if (annotationModel instanceof IAnnotationModelExtension) {
- IAnnotationModelExtension ame= (IAnnotationModelExtension) annotationModel;
+ IAnnotationModelExtension ame = (IAnnotationModelExtension) annotationModel;
fExtPCAnnotationModel = new DisassemblyAnnotationModel();
ame.addAnnotationModel(EXTENDED_PC_ANNOTATIONS, fExtPCAnnotationModel);
}
}
-
+
private void attachBreakpointsAnnotationModel() {
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
if (annotationModel instanceof IAnnotationModelExtension) {
- IAnnotationModelExtension ame= (IAnnotationModelExtension) annotationModel;
+ IAnnotationModelExtension ame = (IAnnotationModelExtension) annotationModel;
ame.addAnnotationModel(BREAKPOINT_ANNOTATIONS, new BreakpointsAnnotationModel(fDebugContext));
}
}
@@ -2039,14 +2094,15 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fRefreshViewPending = false;
long now = System.currentTimeMillis();
if (now >= refreshViewScheduled) {
- if (DEBUG) System.err.println("*** refreshing view ***"); //$NON-NLS-1$
-
+ if (DEBUG)
+ System.err.println("*** refreshing view ***"); //$NON-NLS-1$
+
// save viewport position and frame info
BigInteger topAddress = getTopAddress();
- int targetFrame= fTargetFrame;
+ int targetFrame = fTargetFrame;
BigInteger frameAddress = fFrameAddress;
BigInteger pcAddress = fPCAddress;
-
+
// clear viewer
resetViewer();
if (fScrollPos != null) {
@@ -2060,15 +2116,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fPCAddress = pcAddress;
gotoAddress(topAddress);
} else {
- refreshView((int)(refreshViewScheduled - now));
+ refreshView((int) (refreshViewScheduled - now));
}
- }};
+ }
+ };
if (delay > 0) {
invokeLater(delay, new Runnable() {
@Override
public void run() {
doScrollLocked(refresh);
- }});
+ }
+ });
} else {
doScrollLocked(refresh);
}
@@ -2083,7 +2141,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
topAddress = getAddressOfLine(fViewer.getTopIndex() + 1);
}
return topAddress;
-
+
} else {
return PC_UNKNOWN;
}
@@ -2104,14 +2162,14 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fFile2Storage.clear();
fDocument.clear();
fViewer.setDocument(fDocument, new AnnotationModel());
- if (fDebugSessionId != null) {
- attachBreakpointsAnnotationModel();
- attachExtendedPCAnnotationModel();
+ if (fDebugSessionId != null) {
+ attachBreakpointsAnnotationModel();
+ attachExtendedPCAnnotationModel();
fDocument.insertInvalidAddressRange(0, 0, fStartAddress, fEndAddress);
- }
+ }
}
- private AddressRangePosition getPCPosition(BigInteger address) {
+ private AddressRangePosition getPCPosition(BigInteger address) {
if (address.compareTo(BigInteger.ZERO) < 0) {
// invalid address
return null;
@@ -2129,7 +2187,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (!(pos instanceof DisassemblyPosition)) {
return pos;
}
- String srcFile = ((DisassemblyPosition)pos).getFile();
+ String srcFile = ((DisassemblyPosition) pos).getFile();
if (srcFile == null) {
return pos;
}
@@ -2144,7 +2202,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
return null;
}
- int stmtLine = ((DisassemblyPosition)pos).getLine();
+ int stmtLine = ((DisassemblyPosition) pos).getLine();
if (stmtLine < 0) {
return pos;
}
@@ -2155,46 +2213,46 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
int offset = srcPos.offset;
int length = srcPos.length;
return new AddressRangePosition(offset, length, address, BigInteger.ZERO);
- }
+ }
- /**
+ /**
* Update the annotation indicating the given address.
* @return a position which denotes the documents position
*/
private AddressRangePosition updateAddressAnnotation(Annotation annotation, BigInteger address) {
if (fViewer == null) {
- return null; // can happen during session shutdown
+ return null; // can happen during session shutdown
}
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
annotationModel.removeAnnotation(annotation);
AddressRangePosition pos = getPCPosition(address);
if (pos != null) {
- annotationModel.addAnnotation(annotation, new Position(pos.offset, Math.max(0, pos.length-1)));
+ annotationModel.addAnnotation(annotation, new Position(pos.offset, Math.max(0, pos.length - 1)));
}
return pos;
}
public IBreakpoint[] getBreakpointsAtLine(int line) {
- BreakpointsAnnotationModel bpModel= null;
- IAnnotationModel am= fViewer.getAnnotationModel();
+ BreakpointsAnnotationModel bpModel = null;
+ IAnnotationModel am = fViewer.getAnnotationModel();
if (am instanceof IAnnotationModelExtension) {
- IAnnotationModelExtension ame= (IAnnotationModelExtension) am;
- bpModel= (BreakpointsAnnotationModel) ame.getAnnotationModel(BREAKPOINT_ANNOTATIONS);
+ IAnnotationModelExtension ame = (IAnnotationModelExtension) am;
+ bpModel = (BreakpointsAnnotationModel) ame.getAnnotationModel(BREAKPOINT_ANNOTATIONS);
if (bpModel != null) {
IRegion lineRegion;
try {
- lineRegion= fDocument.getLineInformation(line);
+ lineRegion = fDocument.getLineInformation(line);
} catch (BadLocationException exc) {
return null;
}
- int offset= lineRegion.getOffset();
- int length= lineRegion.getLength();
- Iterator<Annotation> it= bpModel.getAnnotationIterator(offset, length, true, true);
- List<IBreakpoint> bpList= new ArrayList<IBreakpoint>(5);
- final IBreakpointManager bpMgr= DebugPlugin.getDefault().getBreakpointManager();
+ int offset = lineRegion.getOffset();
+ int length = lineRegion.getLength();
+ Iterator<Annotation> it = bpModel.getAnnotationIterator(offset, length, true, true);
+ List<IBreakpoint> bpList = new ArrayList<IBreakpoint>(5);
+ final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
while (it.hasNext()) {
- final SimpleMarkerAnnotation annotation= (SimpleMarkerAnnotation) it.next();
- IBreakpoint bp= bpMgr.getBreakpoint(annotation.getMarker());
+ final SimpleMarkerAnnotation annotation = (SimpleMarkerAnnotation) it.next();
+ IBreakpoint bp = bpMgr.getBreakpoint(annotation.getMarker());
if (bp != null) {
bpList.add(bp);
}
@@ -2213,7 +2271,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
@Override
public void gotoFrame(int frame) {
assert isGuiThread();
- fGotoAddressPending = PC_UNKNOWN;
+ fGotoAddressPending = PC_UNKNOWN;
gotoFrame(frame, PC_UNKNOWN);
}
@@ -2237,8 +2295,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
@Override
public void gotoFrame(int frame, BigInteger address) {
assert isGuiThread();
- if (DEBUG) System.out.println("gotoFrame " + frame + " " + getAddressText(address)); //$NON-NLS-1$ //$NON-NLS-2$
-
+ if (DEBUG)
+ System.out.println("gotoFrame " + frame + " " + getAddressText(address)); //$NON-NLS-1$ //$NON-NLS-2$
+
// cache the last PC address
if (!isSyncWithActiveDebugContext()) {
if (isTrackExpression()) {
@@ -2248,26 +2307,26 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fPCLastAddress != PC_UNKNOWN) {
address = fPCLastAddress;
} else if (address != PC_UNKNOWN) {
- fPCLastAddress = address;
+ fPCLastAddress = address;
}
-
+
// need to get the frame address when the view first started.
if (fPCLastAddress != PC_UNKNOWN)
frame = -2; // clear the annotation
} else {
fPCLastAddress = address;
}
-
- if (fGotoAddressPending == fFrameAddress) {
- // cancel goto address from previous goto frame
- fGotoAddressPending = PC_UNKNOWN;
- }
+
+ if (fGotoAddressPending == fFrameAddress) {
+ // cancel goto address from previous goto frame
+ fGotoAddressPending = PC_UNKNOWN;
+ }
fTargetFrame = frame;
fFrameAddress = address;
if (fTargetFrame == -1) {
fTargetFrame = getActiveStackFrame();
if (fTargetFrame < 0 && fBackend != null && fBackend.canDisassemble()) {
- fTargetFrame= 0;
+ fTargetFrame = 0;
}
if (fTargetFrame == -1) {
fGotoFramePending = false;
@@ -2282,7 +2341,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (!fUpdatePending) {
fGotoFramePending = false;
if (fBackend != null && fBackend.hasDebugContext() && fBackend.canDisassemble()) {
- if (DEBUG) System.out.println("retrieveFrameAddress "+frame); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("retrieveFrameAddress " + frame); //$NON-NLS-1$
fUpdatePending = true;
fBackend.retrieveFrameAddress(fTargetFrame);
}
@@ -2319,7 +2379,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
public final boolean isActive() {
return fActive;
}
-
+
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.IDisassemblyPart#isConnected()
*/
@@ -2328,7 +2388,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fDebugSessionId == null) {
return false;
}
-
+
return (fBackend != null) ? fBackend.hasDebugContext() : false;
}
@@ -2347,7 +2407,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
public final ISourceViewer getTextViewer() {
return fViewer;
}
-
+
@Override
public final boolean hasViewer() {
return fViewer != null;
@@ -2374,7 +2434,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* Should return a <code>Long</code> object in case the value was computed,
* another object to be waited on if the retrieval is in progress, <code>null</code>
* if no time stamp could be retrieved.
- *
+ *
* @param address
* @return Long, Object or <code>null</code>
*/
@@ -2421,7 +2481,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
private void addToPCHistory(AddressRangePosition pcPos) {
- if (DEBUG) System.out.println("addToPCHistory "+getAddressText(pcPos.fAddressOffset)); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("addToPCHistory " + getAddressText(pcPos.fAddressOffset)); //$NON-NLS-1$
if (fPCHistorySizeMax <= 1) {
return;
}
@@ -2452,7 +2513,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fViewer.invalidateTextPresentation(last.offset, last.length);
}
// redraw
- for (Iterator<AddressRangePosition> it=fPCHistory.iterator(); it.hasNext();) {
+ for (Iterator<AddressRangePosition> it = fPCHistory.iterator(); it.hasNext();) {
AddressRangePosition pos = it.next();
fViewer.invalidateTextPresentation(pos.offset, pos.length);
}
@@ -2470,9 +2531,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
public void updatePC(BigInteger pc) {
assert isGuiThread();
if (!fPendingPCUpdates.isEmpty()) {
- BigInteger last = fPendingPCUpdates.get(fPendingPCUpdates.size()-1);
+ BigInteger last = fPendingPCUpdates.get(fPendingPCUpdates.size() - 1);
if (last.compareTo(BigInteger.ZERO) < 0) {
- fPendingPCUpdates.remove(fPendingPCUpdates.size()-1);
+ fPendingPCUpdates.remove(fPendingPCUpdates.size() - 1);
}
}
fPendingPCUpdates.add(pc);
@@ -2509,7 +2570,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
// set primary
pos = updateAddressAnnotation(fPCAnnotation, fPCAddress);
} else if (fTargetFrame < 0) {
- // clear both
+ // clear both
updateAddressAnnotation(fPCAnnotation, PC_UNKNOWN);
updateAddressAnnotation(fSecondaryPCAnnotation, PC_UNKNOWN);
} else {
@@ -2519,11 +2580,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
pos = updateAddressAnnotation(fSecondaryPCAnnotation, fFrameAddress);
}
fPCAnnotationUpdatePending = pos == null && fFrameAddress.compareTo(BigInteger.ZERO) >= 0;
-
+
if (fExtPCAnnotationModel != null) {
fBackend.updateExtendedPCAnnotation(fExtPCAnnotationModel);
}
-
+
return pos;
}
@@ -2552,7 +2613,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fUpdateSourcePending) {
updateInvalidSource();
}
- boolean sourceValid= !fDocument.hasInvalidSourcePositions();
+ boolean sourceValid = !fDocument.hasInvalidSourcePositions();
if (sourceValid || fShowDisassembly) {
if (fGotoFramePending) {
gotoFrame(fTargetFrame, fFrameAddress);
@@ -2588,49 +2649,50 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
if (!fActive) {
// refresh all when becoming active again
- fRefreshViewPending= false;
+ fRefreshViewPending = false;
fRefreshAll = true;
return;
}
if (doit != null) {
fRunnableQueue.add(doit);
}
- final int updateCount = fUpdateCount;
- if (fUpdatePending) {
- if (fRunnableQueue.size() == 1) {
- Runnable doitlater = new Runnable() {
- @Override
+ final int updateCount = fUpdateCount;
+ if (fUpdatePending) {
+ if (fRunnableQueue.size() == 1) {
+ Runnable doitlater = new Runnable() {
+ @Override
public void run() {
- if (updateCount == fUpdateCount) {
- doScrollLocked(null);
- }
- }};
- invokeLater(doitlater);
- }
- } else {
- fUpdatePending = true;
- lockScroller();
- try {
- ArrayList<Runnable> copy = new ArrayList<Runnable>(fRunnableQueue);
- fRunnableQueue.clear();
- for (Iterator<Runnable> iter = copy.iterator(); iter.hasNext();) {
- if (updateCount != fUpdateCount) {
- return;
- }
- Runnable doitnow = iter.next();
- try {
- doitnow.run();
- } catch(Exception e) {
- internalError(e);
- }
- }
- } finally {
- fUpdatePending = false;
- unlockScroller();
- doPending();
- updateVisibleArea();
- }
- }
+ if (updateCount == fUpdateCount) {
+ doScrollLocked(null);
+ }
+ }
+ };
+ invokeLater(doitlater);
+ }
+ } else {
+ fUpdatePending = true;
+ lockScroller();
+ try {
+ ArrayList<Runnable> copy = new ArrayList<Runnable>(fRunnableQueue);
+ fRunnableQueue.clear();
+ for (Iterator<Runnable> iter = copy.iterator(); iter.hasNext();) {
+ if (updateCount != fUpdateCount) {
+ return;
+ }
+ Runnable doitnow = iter.next();
+ try {
+ doitnow.run();
+ } catch (Exception e) {
+ internalError(e);
+ }
+ }
+ } finally {
+ fUpdatePending = false;
+ unlockScroller();
+ doPending();
+ updateVisibleArea();
+ }
+ }
}
/* (non-Javadoc)
@@ -2661,7 +2723,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
AddressRangePosition pos = fDocument.getDisassemblyPosition(focusOffset);
if (pos != null && !pos.fValid) {
// don't lock position of invalid range
- focusOffset = pos.offset+pos.length;
+ focusOffset = pos.offset + pos.length;
focusLine = fDocument.getLineOfOffset(focusOffset);
}
}
@@ -2700,10 +2762,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
int topLine = fDocument.getLineOfOffset(fScrollPos.offset) - fScrollLine;
// limit text size
int lineCount = fDocument.getNumberOfLines();
- if (lineCount > fgHighWaterMark*fBufferZone) {
- int startLine = Math.max(0, topLine-fgLowWaterMark/2*fBufferZone);
- int endLine = Math.min(lineCount-1, topLine+fgLowWaterMark/2*fBufferZone);
- fDocument.deleteLineRange(endLine, lineCount-1);
+ if (lineCount > fgHighWaterMark * fBufferZone) {
+ int startLine = Math.max(0, topLine - fgLowWaterMark / 2 * fBufferZone);
+ int endLine = Math.min(lineCount - 1, topLine + fgLowWaterMark / 2 * fBufferZone);
+ fDocument.deleteLineRange(endLine, lineCount - 1);
fDocument.deleteLineRange(0, startLine);
}
int lineHeight = fViewer.getTextWidget().getLineHeight();
@@ -2727,31 +2789,31 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#insertSource(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#insertSource(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition)
+ */
+ @Override
public void insertSource(AddressRangePosition _pos) {
- assert isGuiThread();
+ assert isGuiThread();
// IDisassemblyPartCallback does not have visibility to the
// SourcePosition type, which is DSF-specific, so it uses the base type
- if (!(_pos instanceof SourcePosition)) {
- assert false : "Caller should have passed in a SourcePosition"; //$NON-NLS-1$
- return;
- }
- SourcePosition pos = (SourcePosition)_pos;
-
- if (!fShowSource) {
- fDocument.insertSource(pos, "", pos.fLine, true); //$NON-NLS-1$
- return;
- }
- SourceFileInfo fi = pos.fFileInfo;
+ if (!(_pos instanceof SourcePosition)) {
+ assert false : "Caller should have passed in a SourcePosition"; //$NON-NLS-1$
+ return;
+ }
+ SourcePosition pos = (SourcePosition) _pos;
+
+ if (!fShowSource) {
+ fDocument.insertSource(pos, "", pos.fLine, true); //$NON-NLS-1$
+ return;
+ }
+ SourceFileInfo fi = pos.fFileInfo;
if (fi.fSource != null || fi.fError != null) {
- int lineNr = pos.fLine;
+ int lineNr = pos.fLine;
if (fi.fSource != null && lineNr >= 0 && lineNr < fi.fSource.getNumberOfLines()) {
fi.fStartAddress = fi.fStartAddress.min(pos.fAddressOffset);
fi.fEndAddress = fi.fEndAddress.max(pos.fAddressOffset.add(pos.fAddressLength));
- int last = pos.fLast > lineNr ? pos.fLast : lineNr;
+ int last = pos.fLast > lineNr ? pos.fLast : lineNr;
final BigInteger lineAddr = fi.fLine2Addr[lineNr];
if (lineAddr == null) {
fi.fLine2Addr[lineNr] = pos.fAddressOffset;
@@ -2765,9 +2827,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (oldPos != null) {
// test if source positions are consecutive
try {
- int index = fDocument.computeIndexInCategory(DisassemblyDocument.CATEGORY_SOURCE, pos.fAddressOffset);
+ int index = fDocument.computeIndexInCategory(DisassemblyDocument.CATEGORY_SOURCE,
+ pos.fAddressOffset);
if (index >= 0) {
- SourcePosition nextPos = (SourcePosition) fDocument.getPositionOfIndex(DisassemblyDocument.CATEGORY_SOURCE, index+1);
+ SourcePosition nextPos = (SourcePosition) fDocument
+ .getPositionOfIndex(DisassemblyDocument.CATEGORY_SOURCE, index + 1);
if (nextPos.fFileInfo == fi && nextPos.fLine == lineNr) {
fDocument.replace(oldPos, oldPos.length, ""); //$NON-NLS-1$
fDocument.removeSourcePosition(oldPos);
@@ -2789,9 +2853,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
// new source position is after old position
try {
// test if source positions are consecutive
- int index = fDocument.computeIndexInCategory(DisassemblyDocument.CATEGORY_SOURCE, pos.fAddressOffset);
+ int index = fDocument.computeIndexInCategory(DisassemblyDocument.CATEGORY_SOURCE,
+ pos.fAddressOffset);
if (index > 0) {
- SourcePosition prevPos = (SourcePosition) fDocument.getPositionOfIndex(DisassemblyDocument.CATEGORY_SOURCE, index-1);
+ SourcePosition prevPos = (SourcePosition) fDocument
+ .getPositionOfIndex(DisassemblyDocument.CATEGORY_SOURCE, index - 1);
if (prevPos.fFileInfo == fi && prevPos.fLine == lineNr) {
fDocument.insertSource(pos, "", lineNr, true); //$NON-NLS-1$
fDocument.removeSourcePosition(pos);
@@ -2816,29 +2882,29 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
}
- private void updateTitle() {
- if (fDebugSessionId == null) {
- String descr = DisassemblyMessages.Disassembly_message_notConnected;
- String title = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
- setPartName(title);
- setContentDescription(descr);
- setTitleToolTip(title);
- } else {
- // TLETODO Proper content description
- setContentDescription(""); //$NON-NLS-1$
- }
- }
+ private void updateTitle() {
+ if (fDebugSessionId == null) {
+ String descr = DisassemblyMessages.Disassembly_message_notConnected;
+ String title = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
+ setPartName(title);
+ setContentDescription(descr);
+ setTitleToolTip(title);
+ } else {
+ // TLETODO Proper content description
+ setContentDescription(""); //$NON-NLS-1$
+ }
+ }
- /**
+ /**
* Close this part
*/
protected abstract void closePart();
@Override
- public void applyTextPresentation(TextPresentation textPresentation) {
+ public void applyTextPresentation(TextPresentation textPresentation) {
IRegion coverage = textPresentation.getExtent();
if (coverage == null) {
- coverage= new Region(0, fDocument.getLength());
+ coverage = new Region(0, fDocument.getLength());
}
int startOffset = coverage.getOffset();
int length = coverage.getLength();
@@ -2858,27 +2924,28 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
return;
}
ArrayList<StyleRange> styleRanges = new ArrayList<StyleRange>();
- while(it.hasNext()) {
- AddressRangePosition pos = (AddressRangePosition)it.next();
+ while (it.hasNext()) {
+ AddressRangePosition pos = (AddressRangePosition) it.next();
if (pos.offset >= endOffset) {
break;
}
- if (pos.offset+pos.length <= startOffset) {
+ if (pos.offset + pos.length <= startOffset) {
continue;
}
if (pos.fValid && pos.length > 0) {
if (pos instanceof DisassemblyPosition) {
- DisassemblyPosition disPos = (DisassemblyPosition)pos;
+ DisassemblyPosition disPos = (DisassemblyPosition) pos;
styleRanges.add(new StyleRange(pos.offset, disPos.length, fInstructionColor, null, SWT.NULL));
} else if (pos instanceof ErrorPosition) {
styleRanges.add(new StyleRange(pos.offset, pos.length, fErrorColor, null, SWT.NULL));
} else if (pos instanceof LabelPosition) {
styleRanges.add(new StyleRange(pos.offset, pos.length, fLabelColor, null, SWT.BOLD));
} else if (pos instanceof SourcePosition) {
- SourcePosition srcPos = (SourcePosition)pos;
+ SourcePosition srcPos = (SourcePosition) pos;
TextPresentation presentation = null;
if (srcPos.fFileInfo.fSource != null) {
- presentation = srcPos.fFileInfo.getPresentation(srcPos.fFileInfo.getRegion(srcPos.fLine, pos.length));
+ presentation = srcPos.fFileInfo
+ .getPresentation(srcPos.fFileInfo.getRegion(srcPos.fLine, pos.length));
}
if (presentation != null) {
// clip result window to coverage
@@ -2886,8 +2953,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
int end = Math.min(endOffset, srcPos.offset + srcPos.length);
int srcOffset = srcPos.fFileInfo.getLineOffset(srcPos.fLine);
int clipOffset = start - srcPos.offset;
- presentation.setResultWindow(new Region(srcOffset + clipOffset, end-start));
- for (Iterator<StyleRange> iter = presentation.getNonDefaultStyleRangeIterator(); iter.hasNext();) {
+ presentation.setResultWindow(new Region(srcOffset + clipOffset, end - start));
+ for (Iterator<StyleRange> iter = presentation.getNonDefaultStyleRangeIterator(); iter
+ .hasNext();) {
StyleRange styleRange = iter.next();
styleRange.start += srcPos.offset + clipOffset;
styleRanges.add(styleRange);
@@ -2906,9 +2974,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
// update pc history trail
if (fPCHistory.size() > 1) {
HSL hsv = new HSL(fPCAnnotationRGB);
- double luminanceStep = (1-hsv.luminance)/(fPCHistorySizeMax+1);
+ double luminanceStep = (1 - hsv.luminance) / (fPCHistorySizeMax + 1);
hsv.luminance = 1 - luminanceStep * (fPCHistorySizeMax - fPCHistory.size());
- for (ListIterator<AddressRangePosition> listIt = fPCHistory.listIterator(fPCHistory.size()); listIt.hasPrevious();) {
+ for (ListIterator<AddressRangePosition> listIt = fPCHistory.listIterator(fPCHistory.size()); listIt
+ .hasPrevious();) {
AddressRangePosition pcPos = listIt.previous();
hsv.luminance -= luminanceStep;
if (pcPos.isDeleted) {
@@ -2923,7 +2992,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
Color pcColor = getSharedColors().getColor(rgb);
Color textColor = null;
// experimental: if color is dark, use white (background) as text color
-// Color textColor = hsv.luminance < 0.7 ? fViewer.getTextWidget().getBackground() : null;
+ // Color textColor = hsv.luminance < 0.7 ? fViewer.getTextWidget().getBackground() : null;
textPresentation.mergeStyleRange(new StyleRange(pcPos.offset, pcPos.length, textColor, pcColor));
}
}
@@ -2931,11 +3000,14 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
@Override
- public AddressRangePosition insertSource(AddressRangePosition pos, BigInteger address, final String file, int lineNumber) {
+ public AddressRangePosition insertSource(AddressRangePosition pos, BigInteger address, final String file,
+ int lineNumber) {
return insertSource(pos, address, file, lineNumber, lineNumber);
}
+
@Override
- public AddressRangePosition insertSource(AddressRangePosition pos, BigInteger address, final String file, int firstLine, int lastLine) {
+ public AddressRangePosition insertSource(AddressRangePosition pos, BigInteger address, final String file,
+ int firstLine, int lastLine) {
assert isGuiThread();
Object sourceElement = null;
if (fFile2Storage.containsKey(file)) {
@@ -2944,17 +3016,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
sourceElement = fBackend.insertSource(pos, address, file, firstLine);
}
if (sourceElement instanceof File) {
- sourceElement = new LocalFileStorage((File)sourceElement);
- } else if (sourceElement instanceof ITranslationUnit) {
- IPath location = ((ITranslationUnit) sourceElement).getLocation();
- if (location != null) {
- sourceElement = new LocalFileStorage(location.toFile());
- }
+ sourceElement = new LocalFileStorage((File) sourceElement);
+ } else if (sourceElement instanceof ITranslationUnit) {
+ IPath location = ((ITranslationUnit) sourceElement).getLocation();
+ if (location != null) {
+ sourceElement = new LocalFileStorage(location.toFile());
+ }
}
if (sourceElement instanceof IStorage) {
if (!(sourceElement instanceof IFile)) {
// try to resolve as resource
- final IPath location= ((IStorage) sourceElement).getFullPath();
+ final IPath location = ((IStorage) sourceElement).getFullPath();
if (location != null) {
IFile iFile = ResourceLookup.selectFileForLocation(location, null);
if (iFile != null && iFile.isAccessible()) {
@@ -2965,18 +3037,18 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
fFile2Storage.put(file, sourceElement);
} else if (sourceElement == null) {
if (!fFile2Storage.containsKey(file)) {
- logWarning(DisassemblyMessages.Disassembly_log_error_locateFile+file, null);
- fFile2Storage.put(file, null);
+ logWarning(DisassemblyMessages.Disassembly_log_error_locateFile + file, null);
+ fFile2Storage.put(file, null);
}
} else {
- fFile2Storage.put(file, null);
- assert false : "missing support for source element of type " + sourceElement.getClass().toString(); //$NON-NLS-1$
+ fFile2Storage.put(file, null);
+ assert false : "missing support for source element of type " + sourceElement.getClass().toString(); //$NON-NLS-1$
}
-
+
if (sourceElement instanceof IStorage) {
- SourceFileInfo fi = fDocument.getSourceInfo((IStorage)sourceElement);
+ SourceFileInfo fi = fDocument.getSourceInfo((IStorage) sourceElement);
if (fi == null) {
- IStorage storage = (IStorage)sourceElement;
+ IStorage storage = (IStorage) sourceElement;
Display display = getSite().getShell().getDisplay();
Runnable done = new SourceColorerJob(display, storage, this);
fi = fDocument.createSourceInfo(file, storage, done);
@@ -2989,25 +3061,27 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
pos = fDocument.insertInvalidSource(pos, address, fi, firstLine, lastLine);
}
-
+
return pos;
}
-
+
public AddressBarContributionItem getAddressBar() {
return fAddressBar;
}
-
+
public void generateErrorDialog(String message) {
- MessageDialog messageDialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), DisassemblyMessages.Disassembly_Error_Dialog_title, null, message, MessageDialog.ERROR, new String[]{DisassemblyMessages.Disassembly_Error_Dialog_ok_button}, 0);
+ MessageDialog messageDialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ DisassemblyMessages.Disassembly_Error_Dialog_title, null, message, MessageDialog.ERROR,
+ new String[] { DisassemblyMessages.Disassembly_Error_Dialog_ok_button }, 0);
messageDialog.open();
}
-
+
public void activateDisassemblyContext() {
IContextService ctxService = getSite().getService(IContextService.class);
- if (ctxService!=null)
+ if (ctxService != null)
fContextActivation = ctxService.activateContext(KEY_BINDING_CONTEXT_DISASSEMBLY);
}
-
+
public void deactivateDisassemblyContext() {
if (fContextActivation != null) {
IContextService ctxService = getSite().getService(IContextService.class);
@@ -3042,7 +3116,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
});
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#handleTargetEnded()
*/
@@ -3052,16 +3126,16 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
@Override
public void run() {
fDebugSessionId = null;
- startUpdate(new Runnable() {
- @Override
+ startUpdate(new Runnable() {
+ @Override
public void run() {
- debugContextChanged();
- }
- });
+ debugContextChanged();
+ }
+ });
}
});
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#setUpdatePending(boolean)
*/
@@ -3105,7 +3179,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
assert isGuiThread();
return fDocument;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#getStorageForFile(java.lang.String)
*/
@@ -3119,7 +3193,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
* A pass through to process the text to populate into a text hover.
*/
public String getHoverInfoData(AddressRangePosition pos, String ident) {
- if (fBackend != null ) {
+ if (fBackend != null) {
return fBackend.getHoverInfoData(pos, ident);
}
return ""; //$NON-NLS-1$
@@ -3134,7 +3208,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
return ""; //$NON-NLS-1$
}
-
+
/**
* A passthru from the text hover code to the backend.
*/
@@ -3144,7 +3218,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
return ""; //$NON-NLS-1$
}
-
+
public BigInteger eval(String expr, boolean suppressError) {
if (fBackend != null) {
BigInteger address = null;
@@ -3175,29 +3249,29 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private void setTrackExpression(boolean track) {
fTrackExpression = track;
}
-
+
protected boolean isSyncWithActiveDebugContext() {
return fSynchWithActiveDebugContext;
}
-
+
private void setSyncWithDebugView(boolean sync) {
fSynchWithActiveDebugContext = sync;
fTrackExpressionAction.setEnabled(!sync);
-
+
if (sync) {
gotoActiveFrameByUser();
} else {
// redraw
while (!fPCHistory.isEmpty()) {
- AddressRangePosition pos = fPCHistory.removeFirst();
+ AddressRangePosition pos = fPCHistory.removeFirst();
fViewer.invalidateTextPresentation(pos.offset, pos.length);
}
-
+
fTargetFrame = -2; // clear the annotation
updatePCAnnotation();
}
}
-
+
/**
* Most methods in IDisassemblyPartCallback require execution on the GUI thread.
*/
@@ -3231,13 +3305,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
scrollToAddress = bottomAddress.add(addressRange).min(bottomAddress);
break;
default:
- assert false; // invalid keycode passed
+ assert false; // invalid keycode passed
scrollToAddress = fFocusAddress;
}
AddressRangePosition pos = getPositionOfAddress(scrollToAddress);
if (pos != null && pos.fValid) {
if (SWT.ARROW_DOWN == keyCode && pos.fAddressOffset.compareTo(bottomAddress) <= 0
- || SWT.ARROW_UP == keyCode && pos.fAddressOffset.compareTo(topAddress) >= 0) {
+ || SWT.ARROW_UP == keyCode && pos.fAddressOffset.compareTo(topAddress) >= 0) {
return false;
}
gotoPosition(pos, SWT.ARROW_DOWN != keyCode);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java
index 64b6d77fab0..f2b12746c74 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
-
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblySelection;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.IDisassemblySelection;
import org.eclipse.core.runtime.ListenerList;
@@ -38,7 +37,7 @@ class DisassemblySelectionProvider implements ISelectionProvider {
private final ListenerList<ISelectionChangedListener> fListenerList = new ListenerList<>(ListenerList.IDENTITY);
private final ISelectionChangedListener fListener = event -> fireSelectionChanged(event);
private final DisassemblyPart fPart;
-
+
DisassemblySelectionProvider(DisassemblyPart disassemblyPart) {
fPart = disassemblyPart;
fPart.getTextViewer().getSelectionProvider().addSelectionChangedListener(fListener);
@@ -53,12 +52,12 @@ class DisassemblySelectionProvider implements ISelectionProvider {
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
- fListenerList.add(listener);
+ fListenerList.add(listener);
}
@Override
public ISelection getSelection() {
- final ISourceViewer textViewer= fPart.getTextViewer();
+ final ISourceViewer textViewer = fPart.getTextViewer();
ISelectionProvider provider = textViewer.getSelectionProvider();
if (provider != null) {
return new DisassemblySelection((ITextSelection) provider.getSelection(), fPart);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java
index 6bc2f4a1cc4..cdd4cd75327 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyTextHover.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -38,13 +38,13 @@ public class DisassemblyTextHover implements ITextHover {
* Create a new disassembly text hover.
*/
public DisassemblyTextHover(DisassemblyPart part) {
- fDisassemblyPart= part;
+ fDisassemblyPart = part;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, int)
*/
- @Override
+ @Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
IDocument doc = textViewer.getDocument();
return CWordFinder.findWord(doc, offset);
@@ -55,17 +55,17 @@ public class DisassemblyTextHover implements ITextHover {
*/
@Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
- DisassemblyDocument doc = (DisassemblyDocument)textViewer.getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) textViewer.getDocument();
int offset = hoverRegion.getOffset();
AddressRangePosition pos;
try {
String ident = doc.get(offset, hoverRegion.getLength());
String value = null;
pos = doc.getModelPosition(offset);
-
+
value = fDisassemblyPart.getHoverInfoData(pos, ident);
- // If returns null (or empty string), not implemented or something went wrong.
+ // If returns null (or empty string), not implemented or something went wrong.
if (value == null || value.length() == 0) {
if (pos instanceof SourcePosition) {
value = evaluateExpression(ident);
@@ -82,12 +82,12 @@ public class DisassemblyTextHover implements ITextHover {
if (value != null) {
return ident + " = " + value; //$NON-NLS-1$
}
- }
- else
+ } else
return value;
} catch (BadLocationException e) {
if (DsfUIPlugin.getDefault().isDebugging()) {
- DsfUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, "Internal Error", e)); //$NON-NLS-1$
+ DsfUIPlugin.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, "Internal Error", e)); //$NON-NLS-1$
}
}
return null;
@@ -99,7 +99,7 @@ public class DisassemblyTextHover implements ITextHover {
* @return register value or <code>null</code>
*/
private String evaluateRegister(String register) {
- return fDisassemblyPart.evaluateRegister(register);
+ return fDisassemblyPart.evaluateRegister(register);
}
/**
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyToggleBreakpointTester.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyToggleBreakpointTester.java
index bb0c10dfd06..4b5e6841670 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyToggleBreakpointTester.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyToggleBreakpointTester.java
@@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
- * Patrick Chuong (Texas Instruments) -
+ * Patrick Chuong (Texas Instruments) -
* Update CDT ToggleBreakpointTargetFactory enablement (340177 )
*****************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
@@ -26,7 +26,7 @@ import org.eclipse.debug.ui.DebugUITools;
/**
* Disassembly toggle breakpoint factory enablement tester.
- *
+ *
* @since 2.2
*/
public class DisassemblyToggleBreakpointTester extends PropertyTester {
@@ -40,25 +40,25 @@ public class DisassemblyToggleBreakpointTester extends PropertyTester {
if ("isDisassemblyViewSupportsCBreakpoint".equals(property) && (receiver instanceof IDisassemblyPart)) { //$NON-NLS-1$
IDisassemblyPart view = ((IDisassemblyPart) receiver);
if (!CDebugUtils.isCustomToggleBreakpointFactory())
- return true;
-
- IAdaptable element = DebugUITools.getPartDebugContext(view.getSite());
- if (element != null) {
- IDebugModelProvider modelProvider = element.getAdapter(IDebugModelProvider.class);
- if (modelProvider != null) {
- String[] models = modelProvider.getModelIdentifiers();
- for (String model : models) {
- if (CDIDebugModel.getPluginIdentifier().equals(model) ||
- ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID.equals(model)) {
- return true;
- }
- }
- } else if (element instanceof IDebugElement) {
- if (CDIDebugModel.getPluginIdentifier().equals(((IDebugElement)element).getModelIdentifier()) ) {
- return true;
- }
- }
- }
+ return true;
+
+ IAdaptable element = DebugUITools.getPartDebugContext(view.getSite());
+ if (element != null) {
+ IDebugModelProvider modelProvider = element.getAdapter(IDebugModelProvider.class);
+ if (modelProvider != null) {
+ String[] models = modelProvider.getModelIdentifiers();
+ for (String model : models) {
+ if (CDIDebugModel.getPluginIdentifier().equals(model)
+ || ICBreakpoint.C_BREAKPOINTS_DEBUG_MODEL_ID.equals(model)) {
+ return true;
+ }
+ }
+ } else if (element instanceof IDebugElement) {
+ if (CDIDebugModel.getPluginIdentifier().equals(((IDebugElement) element).getModelIdentifier())) {
+ return true;
+ }
+ }
+ }
}
return false;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyView.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyView.java
index 56c1a2becfe..6136cd69129 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyView.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyView.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Patrick Chuong (Texas Instruments) - Bug fix (326670)
@@ -32,7 +32,7 @@ import org.eclipse.ui.texteditor.ITextEditorActionConstants;
public class DisassemblyView extends DisassemblyPart implements IViewPart {
/**
- *
+ *
*/
public DisassemblyView() {
super();
@@ -48,7 +48,7 @@ public class DisassemblyView extends DisassemblyPart implements IViewPart {
*/
@Override
public IViewSite getViewSite() {
- return (IViewSite)getSite();
+ return (IViewSite) getSite();
}
/*
@@ -65,14 +65,14 @@ public class DisassemblyView extends DisassemblyPart implements IViewPart {
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
setSite(site);
- if (memento != null) {
- Boolean trackExpression = memento.getBoolean(DisassemblyPreferenceConstants.TRACK_EXPRESSION);
- if (trackExpression != null)
- fTrackExpression = trackExpression;
- Boolean syncContext = memento.getBoolean(DisassemblyPreferenceConstants.SYNC_ACTIVE_CONTEXT);
- if (syncContext != null)
- fSynchWithActiveDebugContext = syncContext;
- }
+ if (memento != null) {
+ Boolean trackExpression = memento.getBoolean(DisassemblyPreferenceConstants.TRACK_EXPRESSION);
+ if (trackExpression != null)
+ fTrackExpression = trackExpression;
+ Boolean syncContext = memento.getBoolean(DisassemblyPreferenceConstants.SYNC_ACTIVE_CONTEXT);
+ if (syncContext != null)
+ fSynchWithActiveDebugContext = syncContext;
+ }
}
/*
@@ -93,18 +93,18 @@ public class DisassemblyView extends DisassemblyPart implements IViewPart {
protected void fillLocalPullDown(IMenuManager manager) {
manager.add(fGlobalActions.get(ActionFactory.FIND.getId()));
- manager.add(new Separator("group.goto")); // ICommonMenuConstants.GROUP_GOTO //$NON-NLS-1$
+ manager.add(new Separator("group.goto")); // ICommonMenuConstants.GROUP_GOTO //$NON-NLS-1$
manager.add(fActionGotoPC);
manager.add(fActionGotoAddress);
- manager.add(new Separator("group.show")); // ICommonMenuConstants.GROUP_SHOW //$NON-NLS-1$
- manager.add(fSyncAction);
+ manager.add(new Separator("group.show")); // ICommonMenuConstants.GROUP_SHOW //$NON-NLS-1$
+ manager.add(fSyncAction);
manager.add(fTrackExpressionAction);
- manager.add(new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
- manager.add(fActionToggleSource);
- manager.add(fActionToggleSymbols);
- manager.add(fActionOpenPreferences);
- // Other plug-ins can contribute their actions here
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
+ manager.add(fActionToggleSource);
+ manager.add(fActionToggleSymbols);
+ manager.add(fActionOpenPreferences);
+ // Other plug-ins can contribute their actions here
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
@Override
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewerConfiguration.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewerConfiguration.java
index 6d67cd94002..dbbf0ac7ffa 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewerConfiguration.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyViewerConfiguration.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -55,8 +55,8 @@ public class DisassemblyViewerConfiguration extends TextSourceViewerConfiguratio
*/
@Override
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
- int start= e.fOffset;
- int end= e.getOffset() + (e.getText() == null ? 0 : e.getText().length());
+ int start = e.fOffset;
+ int end = e.getOffset() + (e.getText() == null ? 0 : e.getText().length());
return new Region(start, end - start);
}
@@ -71,7 +71,7 @@ public class DisassemblyViewerConfiguration extends TextSourceViewerConfiguratio
}
/**
- *
+ *
*/
public DisassemblyViewerConfiguration(DisassemblyPart part) {
super(EditorsUI.getPreferenceStore());
@@ -89,6 +89,7 @@ public class DisassemblyViewerConfiguration extends TextSourceViewerConfiguratio
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
return reconciler;
}
+
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getUndoManager(org.eclipse.jface.text.source.ISourceViewer)
*/
@@ -97,7 +98,7 @@ public class DisassemblyViewerConfiguration extends TextSourceViewerConfiguratio
// no undo/redo
return null;
}
-
+
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
*/
@@ -111,21 +112,21 @@ public class DisassemblyViewerConfiguration extends TextSourceViewerConfiguratio
*/
@Override
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
- IHyperlinkDetector[] inheritedDetectors= super.getHyperlinkDetectors(sourceViewer);
-
+ IHyperlinkDetector[] inheritedDetectors = super.getHyperlinkDetectors(sourceViewer);
+
if (fPart == null || inheritedDetectors == null)
return inheritedDetectors;
-
- int inheritedDetectorsLength= inheritedDetectors.length;
- IHyperlinkDetector[] detectors= new IHyperlinkDetector[inheritedDetectorsLength + 1];
- detectors[0]= new DisassemblyHyperlinkDetector(fPart);
- for (int i= 0; i < inheritedDetectorsLength; i++) {
- detectors[i+1]= inheritedDetectors[i];
+
+ int inheritedDetectorsLength = inheritedDetectors.length;
+ IHyperlinkDetector[] detectors = new IHyperlinkDetector[inheritedDetectorsLength + 1];
+ detectors[0] = new DisassemblyHyperlinkDetector(fPart);
+ for (int i = 0; i < inheritedDetectorsLength; i++) {
+ detectors[i + 1] = inheritedDetectors[i];
}
-
+
return detectors;
}
-
+
/*
* @see org.eclipse.ui.editors.text.TextSourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/EditionFinderJob.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/EditionFinderJob.java
index b40825d01d8..8874640a7d3 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/EditionFinderJob.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/EditionFinderJob.java
@@ -40,7 +40,7 @@ class EditionFinderJob extends Job {
/**
* Create a new edition finder for a file resource and address.
- *
+ *
* @param sourceInfo the file info containing the file resource for which to find an edition
* @param address address inside the module
* @param disassemblyPart the disassembly part where this job originated from
@@ -49,13 +49,13 @@ class EditionFinderJob extends Job {
super(DisassemblyMessages.EditionFinderJob_name);
Assert.isNotNull(sourceInfo);
Assert.isLegal(sourceInfo.fFile instanceof IFile);
- fSourceInfo= sourceInfo;
- fFile = (IFile)sourceInfo.fFile;
+ fSourceInfo = sourceInfo;
+ fFile = (IFile) sourceInfo.fFile;
fAddress = address;
- fDisassemblyPart= disassemblyPart;
+ fDisassemblyPart = disassemblyPart;
setRule(fFile);
setSystem(true);
- sourceInfo.fEditionJob= this;
+ sourceInfo.fEditionJob = this;
}
/*
@@ -79,7 +79,7 @@ class EditionFinderJob extends Job {
}
monitor.worked(1);
if (token instanceof Long && !monitor.isCanceled()) {
- moduleTime = ((Long)token).longValue();
+ moduleTime = ((Long) token).longValue();
long buildTime = moduleTime * 1000;
if (fFile.getLocalTimeStamp() > buildTime) {
monitor.subTask(DisassemblyMessages.EditionFinderJob_task_search_history);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java
index 9fac702c37e..1e314e637a3 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/FunctionOffsetRulerColumn.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -29,7 +29,7 @@ public class FunctionOffsetRulerColumn extends DisassemblyRulerColumn {
public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.functionOffset"; //$NON-NLS-1$
/** Maximum width of column (in characters) */
- private static final int MAXWIDTH= 20;
+ private static final int MAXWIDTH = 20;
/**
* Default constructor.
@@ -44,13 +44,13 @@ public class FunctionOffsetRulerColumn extends DisassemblyRulerColumn {
*/
@Override
protected String createDisplayString(int line) {
- DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) getParentRuler().getTextViewer().getDocument();
int offset;
try {
offset = doc.getLineOffset(line);
AddressRangePosition pos = doc.getDisassemblyPosition(offset);
if (pos instanceof DisassemblyPosition && pos.length > 0 && pos.offset == offset && pos.fValid) {
- DisassemblyPosition disassPos = (DisassemblyPosition)pos;
+ DisassemblyPosition disassPos = (DisassemblyPosition) pos;
int length = disassPos.fFunction.length;
if (length > MAXWIDTH) {
return "..." + new String(disassPos.fFunction, length - MAXWIDTH + 3, MAXWIDTH - 3); //$NON-NLS-1$
@@ -67,13 +67,13 @@ public class FunctionOffsetRulerColumn extends DisassemblyRulerColumn {
@Override
protected int computeNumberOfCharacters() {
- DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) getParentRuler().getTextViewer().getDocument();
return Math.min(MAXWIDTH, doc.getMaxFunctionLength());
}
@Override
public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
+ String property = event.getProperty();
boolean needRedraw = false;
if (DisassemblyPreferenceConstants.FUNCTION_OFFSETS_COLOR.equals(property)) {
setForeground(getColor(property));
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/IDisassemblyHelpContextIds.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/IDisassemblyHelpContextIds.java
index bffe1ec3058..92be62b550d 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/IDisassemblyHelpContextIds.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/IDisassemblyHelpContextIds.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
index d95cca8ebf0..a62c300e2d2 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
@@ -30,7 +30,7 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.opcode"; //$NON-NLS-1$
/** Maximum width of column (in characters) */
- private static final int MAXWIDTH= 20;
+ private static final int MAXWIDTH = 20;
private int fRadix;
private String fRadixPrefix;
@@ -45,7 +45,7 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
}
public void setRadix(int radix) {
- fRadix= radix;
+ fRadix = radix;
setShowRadixPrefix();
}
@@ -66,26 +66,26 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
protected String createDisplayString(int line) {
int nChars = computeNumberOfCharacters();
if (nChars > 0) {
- DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) getParentRuler().getTextViewer().getDocument();
try {
int offset = doc.getLineOffset(line);
AddressRangePosition pos = doc.getDisassemblyPosition(offset);
if (pos instanceof DisassemblyPosition && pos.length > 0 && pos.offset == offset && pos.fValid) {
- DisassemblyPosition disassPos = (DisassemblyPosition)pos;
+ DisassemblyPosition disassPos = (DisassemblyPosition) pos;
if (disassPos.fOpcodes != null) {
// Format the output.
String str = disassPos.fOpcodes.toString(fRadix);
int prefixLength = 0;
-
+
if (fRadixPrefix != null)
prefixLength = fRadixPrefix.length();
-
+
StringBuilder buf = new StringBuilder(nChars);
-
+
if (prefixLength != 0)
buf.append(fRadixPrefix);
-
- for (int i=str.length()+prefixLength; i < nChars; ++i)
+
+ for (int i = str.length() + prefixLength; i < nChars; ++i)
buf.append('0');
buf.append(str);
if (buf.length() > nChars)
@@ -104,13 +104,13 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
@Override
protected int computeNumberOfCharacters() {
- DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) getParentRuler().getTextViewer().getDocument();
return Math.min(MAXWIDTH, doc.getMaxOpcodeLength(fRadix));
}
@Override
public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
+ String property = event.getProperty();
IPreferenceStore store = getPreferenceStore();
boolean needRedraw = false;
if (DisassemblyPreferenceConstants.CODE_BYTES_COLOR.equals(property)) {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourceColorerJob.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourceColorerJob.java
index 5e99d800703..e523f2412cc 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourceColorerJob.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourceColorerJob.java
@@ -36,9 +36,9 @@ class SourceColorerJob extends UIJob implements Runnable {
public SourceColorerJob(Display jobDisplay, IStorage storage, DisassemblyPart disassemblyPart) {
super(DisassemblyMessages.SourceColorerJob_name);
- fDisassemblyPart= disassemblyPart;
- fViewer= disassemblyPart.getTextViewer();
- fDocument= (DisassemblyDocument) fViewer.getDocument();
+ fDisassemblyPart = disassemblyPart;
+ fViewer = disassemblyPart.getTextViewer();
+ fDocument = (DisassemblyDocument) fViewer.getDocument();
fStorage = storage;
setDisplay(fDisassemblyPart.getSite().getShell().getDisplay());
setSystem(true);
@@ -56,7 +56,7 @@ class SourceColorerJob extends UIJob implements Runnable {
if (fi != null) {
fi.initPresentationCreator(fViewer);
if (fi.fError != null) {
- String message= DisassemblyMessages.Disassembly_log_error_readFile + fi.fFileKey;
+ String message = DisassemblyMessages.Disassembly_log_error_readFile + fi.fFileKey;
fDisassemblyPart.logWarning(message, fi.fError);
}
}
@@ -71,8 +71,9 @@ class SourceColorerJob extends UIJob implements Runnable {
*/
@Override
public void run() {
- IWorkbenchSiteProgressService progressService = fDisassemblyPart.getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if(progressService != null) {
+ IWorkbenchSiteProgressService progressService = fDisassemblyPart.getSite()
+ .getAdapter(IWorkbenchSiteProgressService.class);
+ if (progressService != null) {
progressService.schedule(this, 0, true);
} else {
schedule();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourcePosition.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourcePosition.java
index ba5eb30f818..289ba9d4508 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourcePosition.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/SourcePosition.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -27,20 +27,22 @@ public class SourcePosition extends AddressRangePosition {
public int fLine;
public int fLast = -1;
- public SourcePosition(int offset, int length, BigInteger addressOffset, SourceFileInfo fileInfo, int line, int last) {
+ public SourcePosition(int offset, int length, BigInteger addressOffset, SourceFileInfo fileInfo, int line,
+ int last) {
this(offset, length, addressOffset, fileInfo, line, last, true);
}
- public SourcePosition(int offset, int length, BigInteger addressOffset, SourceFileInfo fileInfo, int line, int last, boolean valid) {
+ public SourcePosition(int offset, int length, BigInteger addressOffset, SourceFileInfo fileInfo, int line, int last,
+ boolean valid) {
super(offset, length, addressOffset, BigInteger.ZERO, valid);
fFileInfo = fileInfo;
fLine = line;
fLast = last;
}
-
+
@Override
public String toString() {
- return super.toString() + "->["+fFileInfo.fFileKey + ':' + fLine + ']'; //$NON-NLS-1$
+ return super.toString() + "->[" + fFileInfo.fFileKey + ':' + fLine + ']'; //$NON-NLS-1$
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyAction.java
index 4f3b8afa23b..5c92c047226 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyAction.java
@@ -28,18 +28,18 @@ public abstract class AbstractDisassemblyAction extends Action implements IUpdat
/**
* Create a disassembly action.
- *
+ *
* @param disassemblyPart
*/
public AbstractDisassemblyAction(IDisassemblyPart disassemblyPart) {
Assert.isLegal(disassemblyPart != null);
- fDisassemblyPart= disassemblyPart;
+ fDisassemblyPart = disassemblyPart;
fDisassemblyPart.addPropertyListener(this);
}
/**
* Create a disassembly action.
- *
+ *
* @param disassemblyPart
* @param style
* one of <code>AS_PUSH_BUTTON</code>,
@@ -50,18 +50,17 @@ public abstract class AbstractDisassemblyAction extends Action implements IUpdat
public AbstractDisassemblyAction(IDisassemblyPart disassemblyPart, int style) {
super(null, style);
Assert.isLegal(disassemblyPart != null);
- fDisassemblyPart= disassemblyPart;
+ fDisassemblyPart = disassemblyPart;
fDisassemblyPart.addPropertyListener(this);
}
-
/**
* @return the disassembly part
*/
public final IDisassemblyPart getDisassemblyPart() {
return fDisassemblyPart;
}
-
+
/*
* @see org.eclipse.jface.action.Action#run()
*/
@@ -70,10 +69,10 @@ public abstract class AbstractDisassemblyAction extends Action implements IUpdat
@Override
public void update() {
- boolean enabled= fDisassemblyPart == null || fDisassemblyPart.isConnected();
+ boolean enabled = fDisassemblyPart == null || fDisassemblyPart.isConnected();
setEnabled(enabled);
}
-
+
/*
* @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object, int)
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyBreakpointRulerAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyBreakpointRulerAction.java
index fb961ef9428..63764b6526e 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyBreakpointRulerAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyBreakpointRulerAction.java
@@ -34,7 +34,7 @@ public abstract class AbstractDisassemblyBreakpointRulerAction extends AbstractD
/**
* Create breakpoint ruler action.
- *
+ *
* @param disassemblyPart
* @param rulerInfo
*/
@@ -45,7 +45,7 @@ public abstract class AbstractDisassemblyBreakpointRulerAction extends AbstractD
/**
* Returns the breakpoint at the last line of mouse activity in the ruler
* or <code>null</code> if none.
- *
+ *
* @return breakpoint associated with activity in the ruler or <code>null</code>
*/
protected IBreakpoint getBreakpoint() {
@@ -63,7 +63,8 @@ public abstract class AbstractDisassemblyBreakpointRulerAction extends AbstractD
Position position = annotationModel.getPosition(markerAnnotation);
int line = document.getLineOfOffset(position.getOffset());
if (line == getRulerInfo().getLineOfLastMouseButtonActivity()) {
- IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager()
+ .getBreakpoint(marker);
if (breakpoint != null) {
return breakpoint;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerAction.java
index f7d1ece3f7b..0de7b3881de 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerAction.java
@@ -26,18 +26,18 @@ public abstract class AbstractDisassemblyRulerAction extends AbstractDisassembly
private final IVerticalRulerInfo fRulerInfo;
protected AbstractDisassemblyRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
- fDisassemblyPart= disassemblyPart;
- fRulerInfo= rulerInfo;
+ fDisassemblyPart = disassemblyPart;
+ fRulerInfo = rulerInfo;
}
-
+
public final IVerticalRulerInfo getRulerInfo() {
return fRulerInfo;
}
-
+
public final IDocument getDocument() {
return getDisassemblyPart().getTextViewer().getDocument();
}
-
+
public final IAnnotationModel getAnnotationModel() {
return getDisassemblyPart().getTextViewer().getAnnotationModel();
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerActionDelegate.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerActionDelegate.java
index 48f2ece4c62..555cf32b4b6 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerActionDelegate.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AbstractDisassemblyRulerActionDelegate.java
@@ -39,10 +39,11 @@ import org.eclipse.ui.texteditor.IUpdate;
* adapter (inner) action on menu and mouse action on the vertical ruler.<p>
* Extending classes must implement the factory method
* <code>createAction(IDisassemblyPart, IVerticalRulerInfo)</code>.
- *
+ *
* @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate
*/
-public abstract class AbstractDisassemblyRulerActionDelegate extends ActionDelegate implements IEditorActionDelegate, IViewActionDelegate, MouseListener, IMenuListener {
+public abstract class AbstractDisassemblyRulerActionDelegate extends ActionDelegate
+ implements IEditorActionDelegate, IViewActionDelegate, MouseListener, IMenuListener {
/** The disassembly part. */
private IDisassemblyPart fDisassemblyPart;
@@ -68,24 +69,24 @@ public abstract class AbstractDisassemblyRulerActionDelegate extends ActionDeleg
setTargetPart(callerAction, targetEditor);
}
- /*
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- @Override
+ /*
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ @Override
public void init(IViewPart view) {
- setTargetPart(fCallerAction, view);
- }
+ setTargetPart(fCallerAction, view);
+ }
@Override
public void init(IAction action) {
- fCallerAction= action;
+ fCallerAction = action;
}
private void setTargetPart(IAction callerAction, IWorkbenchPart targetPart) {
if (fDisassemblyPart != null) {
- IVerticalRulerInfo rulerInfo= fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
+ IVerticalRulerInfo rulerInfo = fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
if (rulerInfo != null) {
- Control control= rulerInfo.getControl();
+ Control control = rulerInfo.getControl();
if (control != null && !control.isDisposed())
control.removeMouseListener(this);
}
@@ -93,19 +94,19 @@ public abstract class AbstractDisassemblyRulerActionDelegate extends ActionDeleg
fDisassemblyPart.removeRulerContextMenuListener(this);
}
- fDisassemblyPart= targetPart == null ? null : targetPart.getAdapter(IDisassemblyPart.class);
- fCallerAction= callerAction;
- fAction= null;
+ fDisassemblyPart = targetPart == null ? null : targetPart.getAdapter(IDisassemblyPart.class);
+ fCallerAction = callerAction;
+ fAction = null;
if (fDisassemblyPart != null) {
- fDisassemblyPart.addRulerContextMenuListener(this);
+ fDisassemblyPart.addRulerContextMenuListener(this);
- IVerticalRulerInfo rulerInfo= fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
+ IVerticalRulerInfo rulerInfo = fDisassemblyPart.getAdapter(IVerticalRulerInfo.class);
if (rulerInfo != null) {
- fAction= createAction(fDisassemblyPart, rulerInfo);
+ fAction = createAction(fDisassemblyPart, rulerInfo);
update();
- Control control= rulerInfo.getControl();
+ Control control = rulerInfo.getControl();
if (control != null && !control.isDisposed())
control.addMouseListener(this);
}
@@ -117,7 +118,7 @@ public abstract class AbstractDisassemblyRulerActionDelegate extends ActionDeleg
if (fAction != null)
fAction.run();
}
-
+
@Override
public void runWithEvent(IAction action, Event event) {
if (fAction != null)
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoAddress.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoAddress.java
index a4355d04870..109e89a7328 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoAddress.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoAddress.java
@@ -30,10 +30,11 @@ public final class ActionGotoAddress extends AbstractDisassemblyAction {
super(disassemblyPart);
setText(DisassemblyMessages.Disassembly_action_GotoAddress_label);
}
+
@Override
public void run() {
ITextViewer viewer = getDisassemblyPart().getTextViewer();
- IDocument document= viewer.getDocument();
+ IDocument document = viewer.getDocument();
IRegion wordRegion = CWordFinder.findWord(document, viewer.getSelectedRange().x);
String defaultValue = null;
if (wordRegion != null) {
@@ -51,7 +52,7 @@ public final class ActionGotoAddress extends AbstractDisassemblyAction {
}
String dlgTitle = DisassemblyMessages.Disassembly_GotoAddressDialog_title;
String dlgLabel = DisassemblyMessages.Disassembly_GotoAddressDialog_label;
- final Shell shell= getDisassemblyPart().getSite().getShell();
+ final Shell shell = getDisassemblyPart().getSite().getShell();
InputDialog dlg = new InputDialog(shell, dlgTitle, dlgLabel, defaultValue, null);
if (dlg.open() == IDialogConstants.OK_ID) {
String value = dlg.getValue();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoProgramCounter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoProgramCounter.java
index f68f962e63f..096653e0c92 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoProgramCounter.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionGotoProgramCounter.java
@@ -22,6 +22,7 @@ public final class ActionGotoProgramCounter extends AbstractDisassemblyAction {
setText(DisassemblyMessages.Disassembly_action_GotoPC_label);
setToolTipText(DisassemblyMessages.Disassembly_action_GotoPC_tooltip);
}
+
@Override
public void run() {
getDisassemblyPart().gotoProgramCounter();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionOpenPreferences.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionOpenPreferences.java
index 6c98ba02274..018c7af3825 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionOpenPreferences.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/ActionOpenPreferences.java
@@ -21,10 +21,12 @@ import org.eclipse.ui.dialogs.PreferencesUtil;
public final class ActionOpenPreferences extends Action {
private final static String PREF_PAGE_ID = "org.eclipse.cdt.dsf.debug.ui.disassembly.preferencePage"; //$NON-NLS-1$
private final Shell fShell;
+
public ActionOpenPreferences(Shell shell) {
- fShell= shell;
+ fShell = shell;
setText(DisassemblyMessages.Disassembly_action_OpenPreferences_label);
}
+
@Override
public void run() {
PreferencesUtil.createPreferenceDialogOn(fShell, PREF_PAGE_ID, new String[] { PREF_PAGE_ID }, null).open();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddBreakpointRulerAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddBreakpointRulerAction.java
index 3b6c35879db..989b352005b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddBreakpointRulerAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddBreakpointRulerAction.java
@@ -41,101 +41,98 @@ import org.eclipse.ui.IWorkbenchPart;
* Ruler action to add breakpoint with a dialog properties.
*/
public class AddBreakpointRulerAction extends AbstractDisassemblyBreakpointRulerAction {
-
-
+
protected AddBreakpointRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
super(disassemblyPart, rulerInfo);
- setText(DisassemblyMessages.Disassembly_action_AddBreakpoint_label + "\t" + //$NON-NLS-1$
- CDebugUIUtils.formatKeyBindingString(SWT.MOD1, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
+ setText(DisassemblyMessages.Disassembly_action_AddBreakpoint_label + "\t" + //$NON-NLS-1$
+ CDebugUIUtils.formatKeyBindingString(SWT.MOD1,
+ DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
}
-
+
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction#run()
*/
@Override
public void run() {
- IWorkbenchPart part = getDisassemblyPart();
- ISelection selection = getSelection();
- IToggleBreakpointsTargetCExtension toggleTarget = getToggleTarget(selection);
- if (toggleTarget != null) {
- try {
- if (toggleTarget.canCreateLineBreakpointsInteractive(part, selection)) {
- toggleTarget.createLineBreakpointsInteractive(part, selection);
- }
- } catch (CoreException e) {
- reportException(e);
- }
- }
+ IWorkbenchPart part = getDisassemblyPart();
+ ISelection selection = getSelection();
+ IToggleBreakpointsTargetCExtension toggleTarget = getToggleTarget(selection);
+ if (toggleTarget != null) {
+ try {
+ if (toggleTarget.canCreateLineBreakpointsInteractive(part, selection)) {
+ toggleTarget.createLineBreakpointsInteractive(part, selection);
+ }
+ } catch (CoreException e) {
+ reportException(e);
+ }
+ }
}
@Override
public void update() {
- IDisassemblyPart part = getDisassemblyPart();
- if (part != null && part.isConnected()) {
- ISelection selection = getSelection();
- IToggleBreakpointsTargetCExtension toggleTarget = getToggleTarget(selection);
- if (toggleTarget != null) {
- setEnabled( toggleTarget.canCreateLineBreakpointsInteractive(part, selection) );
- return;
- }
- }
- setEnabled(false);
+ IDisassemblyPart part = getDisassemblyPart();
+ if (part != null && part.isConnected()) {
+ ISelection selection = getSelection();
+ IToggleBreakpointsTargetCExtension toggleTarget = getToggleTarget(selection);
+ if (toggleTarget != null) {
+ setEnabled(toggleTarget.canCreateLineBreakpointsInteractive(part, selection));
+ return;
+ }
+ }
+ setEnabled(false);
}
-
+
private IToggleBreakpointsTargetCExtension getToggleTarget(ISelection selection) {
- IToggleBreakpointsTargetManager toggleMgr = DebugUITools.getToggleBreakpointsTargetManager();
- IToggleBreakpointsTarget toggleTarget = toggleMgr.getToggleBreakpointsTarget(getDisassemblyPart(), selection);
- if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
- return (IToggleBreakpointsTargetCExtension)toggleTarget;
- }
- return null;
+ IToggleBreakpointsTargetManager toggleMgr = DebugUITools.getToggleBreakpointsTargetManager();
+ IToggleBreakpointsTarget toggleTarget = toggleMgr.getToggleBreakpointsTarget(getDisassemblyPart(), selection);
+ if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
+ return (IToggleBreakpointsTargetCExtension) toggleTarget;
+ }
+ return null;
}
- /**
- * Report an error to the user.
- *
- * @param e underlying exception
- */
- private void reportException(Exception e) {
- IStatus status= new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Error creating breakpoint: ", e); //$NON-NLS-1$
- ErrorDialog.openError(
- getDisassemblyPart().getSite().getShell(),
- DisassemblyMessages.Disassembly_action_AddBreakpoint_errorTitle,
- DisassemblyMessages.Disassembly_action_AddBreakpoint_errorMessage,
- status);
- CDebugUIPlugin.log(status);
- }
+ /**
+ * Report an error to the user.
+ *
+ * @param e underlying exception
+ */
+ private void reportException(Exception e) {
+ IStatus status = new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Error creating breakpoint: ", e); //$NON-NLS-1$
+ ErrorDialog.openError(getDisassemblyPart().getSite().getShell(),
+ DisassemblyMessages.Disassembly_action_AddBreakpoint_errorTitle,
+ DisassemblyMessages.Disassembly_action_AddBreakpoint_errorMessage, status);
+ CDebugUIPlugin.log(status);
+ }
/**
- * Determines the text selection for the breakpoint action. If clicking on the ruler inside
- * the highlighted text, return the text selection for the highlighted text. Otherwise,
- * return a text selection representing the start of the line.
- *
- * @return An ISelection as described.
- * @throws BadLocationException If underlying operations throw.
- */
- private ISelection getSelection() {
- IDocument document = getDocument();
- if (document != null) {
- int line = getRulerInfo().getLineOfLastMouseButtonActivity();
-
- try {
- IRegion region = getDocument().getLineInformation(line);
- ITextSelection textSelection = new TextSelection(document, region.getOffset(), 0);
- ISelectionProvider provider = getDisassemblyPart().getSite().getSelectionProvider();
- if (provider != null){
- ISelection selection = provider.getSelection();
- if (selection instanceof ITextSelection
- && ((ITextSelection) selection).getStartLine() <= line
- && ((ITextSelection) selection).getEndLine() >= line) {
- textSelection = (ITextSelection) selection;
- }
- }
- return textSelection;
- } catch (BadLocationException e) {
- }
- }
- return StructuredSelection.EMPTY;
- }
+ * Determines the text selection for the breakpoint action. If clicking on the ruler inside
+ * the highlighted text, return the text selection for the highlighted text. Otherwise,
+ * return a text selection representing the start of the line.
+ *
+ * @return An ISelection as described.
+ * @throws BadLocationException If underlying operations throw.
+ */
+ private ISelection getSelection() {
+ IDocument document = getDocument();
+ if (document != null) {
+ int line = getRulerInfo().getLineOfLastMouseButtonActivity();
+
+ try {
+ IRegion region = getDocument().getLineInformation(line);
+ ITextSelection textSelection = new TextSelection(document, region.getOffset(), 0);
+ ISelectionProvider provider = getDisassemblyPart().getSite().getSelectionProvider();
+ if (provider != null) {
+ ISelection selection = provider.getSelection();
+ if (selection instanceof ITextSelection && ((ITextSelection) selection).getStartLine() <= line
+ && ((ITextSelection) selection).getEndLine() >= line) {
+ textSelection = (ITextSelection) selection;
+ }
+ }
+ return textSelection;
+ } catch (BadLocationException e) {
+ }
+ }
+ return StructuredSelection.EMPTY;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddressBarContributionItem.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddressBarContributionItem.java
index ec3d9c2a739..62659c39ac3 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddressBarContributionItem.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/AddressBarContributionItem.java
@@ -57,7 +57,7 @@ public class AddressBarContributionItem extends ContributionItem {
/**
* Use this constructor to create an AddressBarContributionItem.
- *
+ *
* @param action
* a contribution action.
*/
@@ -68,7 +68,7 @@ public class AddressBarContributionItem extends ContributionItem {
/**
* After constructing this object, call this method to create an address
* box.
- *
+ *
* @param parent
* a ToolBar object. Can be obtain with the getControl() method
* in the ToolBarManager class.
@@ -81,8 +81,7 @@ public class AddressBarContributionItem extends ContributionItem {
* the tooltip of the warning label if it ever becomes visible.
* May be null.
*/
- public void createAddressBox(ToolBar parent, int width, String initialText,
- String warningText) {
+ public void createAddressBox(ToolBar parent, int width, String initialText, String warningText) {
this.width = width;
this.initialText = initialText;
this.lastText = initialText;
@@ -108,8 +107,8 @@ public class AddressBarContributionItem extends ContributionItem {
Control box = internalCreateAddressBox(parent);
item.setControl(box);
item.setWidth(width);
-
- enableAddressBox(action.isEnabled());
+
+ enableAddressBox(action.isEnabled());
}
/**
@@ -122,7 +121,7 @@ public class AddressBarContributionItem extends ContributionItem {
/**
* Get the address bar text
- *
+ *
* @return The text in the address bar.
*/
public String getText() {
@@ -135,7 +134,7 @@ public class AddressBarContributionItem extends ContributionItem {
/**
* Set the visibility of the warning icon. Should be set to true when there
* is a problem jumping to the specified address; false otherwise
- *
+ *
* @param visible
* True for visible, false for hidden.
*/
@@ -147,7 +146,7 @@ public class AddressBarContributionItem extends ContributionItem {
/**
* Return whether the warning icon is visible or not.
- *
+ *
* @return True if visible, otherwise false.
*/
public boolean isWarningIconVisible() {
@@ -158,7 +157,7 @@ public class AddressBarContributionItem extends ContributionItem {
/**
* Enable the address combo box.
- *
+ *
* @param enable
* true to enable, else false.
*/
@@ -171,7 +170,7 @@ public class AddressBarContributionItem extends ContributionItem {
/**
* Creates the combo box and add it to the toolbar.
- *
+ *
* @param parent
* the parent, toolbar.
* @return the combo box address control.
@@ -186,9 +185,8 @@ public class AddressBarContributionItem extends ContributionItem {
warningLabel = new Label(top, SWT.NONE);
- warningImage = AbstractUIPlugin
- .imageDescriptorFromPlugin(
- DsfUIPlugin.PLUGIN_ID, "icons/address_warning.gif").createImage(); //$NON-NLS-1$
+ warningImage = AbstractUIPlugin.imageDescriptorFromPlugin(DsfUIPlugin.PLUGIN_ID, "icons/address_warning.gif") //$NON-NLS-1$
+ .createImage();
warningLabel.setImage(warningImage);
warningLabel.setToolTipText(warningText);
setWarningIconVisible(false);
@@ -209,27 +207,21 @@ public class AddressBarContributionItem extends ContributionItem {
@Override
public void keyReleased(KeyEvent e) {
- if (e.stateMask == SWT.CTRL
- && (((char) e.keyCode) == 'c' || ((char) e.keyCode) == 'C')) {
+ if (e.stateMask == SWT.CTRL && (((char) e.keyCode) == 'c' || ((char) e.keyCode) == 'C')) {
String selection = null;
Point selectionPoint = addressBox.getSelection();
if (selectionPoint.x == selectionPoint.y)
return;
- selection = addressBox.getText().substring(
- selectionPoint.x, selectionPoint.y);
+ selection = addressBox.getText().substring(selectionPoint.x, selectionPoint.y);
- if ((selection != null)
- && (!(selection.trim().length() == 0))) {
+ if ((selection != null) && (!(selection.trim().length() == 0))) {
Clipboard clipboard = null;
try {
- clipboard = new Clipboard(addressBox
- .getDisplay());
- clipboard.setContents(
- new Object[] { selection },
- new Transfer[] { TextTransfer
- .getInstance() });
+ clipboard = new Clipboard(addressBox.getDisplay());
+ clipboard.setContents(new Object[] { selection },
+ new Transfer[] { TextTransfer.getInstance() });
} finally {
if (clipboard != null)
clipboard.dispose();
@@ -243,12 +235,12 @@ public class AddressBarContributionItem extends ContributionItem {
@Override
public void focusGained(FocusEvent e) {
// [nmehregani] bugzilla 297387: 'Home' shouldn't jump to PC address when focus is on location combo box
- if (action instanceof JumpToAddressAction)
- ((JumpToAddressAction)action).deactivateDisassemblyContext();
+ if (action instanceof JumpToAddressAction)
+ ((JumpToAddressAction) action).deactivateDisassemblyContext();
// end 297387
-
+
lastText = addressBox.getText();
-
+
// Erase the guide text when the focus is gained.
if (lastText.trim().equals(initialText))
addressBox.setText(""); //$NON-NLS-1$
@@ -260,10 +252,10 @@ public class AddressBarContributionItem extends ContributionItem {
@Override
public void focusLost(FocusEvent e) {
// [nmehregani] bugzilla 297387: 'Home' shouldn't jump to PC address when focus is on location combo box
- if (action instanceof JumpToAddressAction)
- ((JumpToAddressAction)action).activateDisassemblyContext();
+ if (action instanceof JumpToAddressAction)
+ ((JumpToAddressAction) action).activateDisassemblyContext();
// end 297387
-
+
// Re-insert the last text when the focus is lost and the text
// field is empty.
if (addressBox.getText().trim().length() == 0)
@@ -298,8 +290,7 @@ public class AddressBarContributionItem extends ContributionItem {
}
}
- if ((!bExist) && (addressBox.getText() != null)
- && (!(addressBox.getText().trim().length() == 0)))
+ if ((!bExist) && (addressBox.getText() != null) && (!(addressBox.getText().trim().length() == 0)))
addressBox.add(addressBox.getText());
}
}
@@ -319,8 +310,7 @@ public class AddressBarContributionItem extends ContributionItem {
}
});
- addressBox.setLayoutData(new GridData(GridData.FILL,
- GridData.BEGINNING, true, false));
+ addressBox.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
return top;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/BreakpointPropertiesRulerAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/BreakpointPropertiesRulerAction.java
index 3add572606b..b56893ec7a7 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/BreakpointPropertiesRulerAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/BreakpointPropertiesRulerAction.java
@@ -34,48 +34,64 @@ import org.eclipse.ui.IWorkbenchPart;
* Ruler action to display breakpoint properties.
*/
public class BreakpointPropertiesRulerAction extends AbstractDisassemblyBreakpointRulerAction {
-
-
+
private ICBreakpoint fBreakpoint;
protected BreakpointPropertiesRulerAction(IDisassemblyPart disassemblyPart, IVerticalRulerInfo rulerInfo) {
super(disassemblyPart, rulerInfo);
- setText(DisassemblyMessages.Disassembly_action_BreakpointProperties_label + "\t" + //$NON-NLS-1$
- CDebugUIUtils.formatKeyBindingString(SWT.MOD1, DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
+ setText(DisassemblyMessages.Disassembly_action_BreakpointProperties_label + "\t" + //$NON-NLS-1$
+ CDebugUIUtils.formatKeyBindingString(SWT.MOD1,
+ DisassemblyMessages.Disassembly_action_ToggleBreakpoint_accelerator));
}
-
+
/*
* @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.actions.AbstractDisassemblyAction#run()
*/
@Override
public void run() {
- if ( fBreakpoint != null ) {
- final ISelection debugContext = getDebugContext();
-
- CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
- getDisassemblyPart().getSite(),
- new ISelectionProvider() {
- @Override
- public ISelection getSelection() {
- return new StructuredSelection( fBreakpoint );
- }
- @Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
- @Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
- @Override public void setSelection( ISelection selection ) {}
- },
- new IDebugContextProvider() {
- @Override
- public ISelection getActiveContext() {
- return debugContext;
- }
- @Override public void addDebugContextListener(IDebugContextListener listener) {}
- @Override public void removeDebugContextListener(IDebugContextListener listener) {}
- @Override public IWorkbenchPart getPart() { return null; }
-
- }
- );
- propertiesAction.run();
- propertiesAction.dispose();
+ if (fBreakpoint != null) {
+ final ISelection debugContext = getDebugContext();
+
+ CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
+ getDisassemblyPart().getSite(), new ISelectionProvider() {
+ @Override
+ public ISelection getSelection() {
+ return new StructuredSelection(fBreakpoint);
+ }
+
+ @Override
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+
+ @Override
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+
+ @Override
+ public void setSelection(ISelection selection) {
+ }
+ }, new IDebugContextProvider() {
+ @Override
+ public ISelection getActiveContext() {
+ return debugContext;
+ }
+
+ @Override
+ public void addDebugContextListener(IDebugContextListener listener) {
+ }
+
+ @Override
+ public void removeDebugContextListener(IDebugContextListener listener) {
+ }
+
+ @Override
+ public IWorkbenchPart getPart() {
+ return null;
+ }
+
+ });
+ propertiesAction.run();
+ propertiesAction.dispose();
}
}
@@ -84,18 +100,19 @@ public class BreakpointPropertiesRulerAction extends AbstractDisassemblyBreakpoi
*/
@Override
public void update() {
- IBreakpoint breakpoint= getBreakpoint();
-
- if (breakpoint instanceof ICBreakpoint) {
- fBreakpoint = (ICBreakpoint)breakpoint;
- } else {
- fBreakpoint = null;
- }
- setEnabled( fBreakpoint != null );
+ IBreakpoint breakpoint = getBreakpoint();
+
+ if (breakpoint instanceof ICBreakpoint) {
+ fBreakpoint = (ICBreakpoint) breakpoint;
+ } else {
+ fBreakpoint = null;
+ }
+ setEnabled(fBreakpoint != null);
}
-
+
private ISelection getDebugContext() {
- return DebugUITools.getDebugContextManager().getContextService(getDisassemblyPart().getSite().getWorkbenchWindow()).getActiveContext();
+ return DebugUITools.getDebugContextManager()
+ .getContextService(getDisassemblyPart().getSite().getWorkbenchWindow()).getActiveContext();
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/JumpToAddressAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/JumpToAddressAction.java
index 376a7adedad..c878e5e0a9e 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/JumpToAddressAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/JumpToAddressAction.java
@@ -25,41 +25,41 @@ import org.eclipse.jface.action.Action;
public class JumpToAddressAction extends Action {
DisassemblyPart fDisassemblyPart = null;
-
+
public JumpToAddressAction(DisassemblyPart disassemblyPart) {
fDisassemblyPart = disassemblyPart;
}
-
+
@Override
- public void run() {
+ public void run() {
AddressBarContributionItem addressBar = fDisassemblyPart.getAddressBar();
- if (addressBar!=null && addressBar.isEnabled() && fDisassemblyPart.isSuspended()) {
- String locationTxt = addressBar.getText();
-
- if (locationTxt==null || locationTxt.trim().length()==0)
- return;
-
- locationTxt = locationTxt.trim();
-
- if (locationTxt.equals(DisassemblyMessages.Disassembly_GotoLocation_initial_text)) {
- fDisassemblyPart.gotoActiveFrameByUser();
- return;
- }
+ if (addressBar != null && addressBar.isEnabled() && fDisassemblyPart.isSuspended()) {
+ String locationTxt = addressBar.getText();
+
+ if (locationTxt == null || locationTxt.trim().length() == 0)
+ return;
+
+ locationTxt = locationTxt.trim();
- BigInteger address = fDisassemblyPart.eval(locationTxt, false);
+ if (locationTxt.equals(DisassemblyMessages.Disassembly_GotoLocation_initial_text)) {
+ fDisassemblyPart.gotoActiveFrameByUser();
+ return;
+ }
+
+ BigInteger address = fDisassemblyPart.eval(locationTxt, false);
if (address.compareTo(BigInteger.ZERO) < 0) {
addressBar.setWarningIconVisible(true);
- } else {
+ } else {
fDisassemblyPart.gotoLocationByUser(address, locationTxt);
addressBar.setWarningIconVisible(false);
}
- }
+ }
}
-
+
protected void activateDisassemblyContext() {
- fDisassemblyPart.activateDisassemblyContext();
+ fDisassemblyPart.activateDisassemblyContext();
}
-
+
protected void deactivateDisassemblyContext() {
fDisassemblyPart.deactivateDisassemblyContext();
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointActionDelegate.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointActionDelegate.java
index 6de5b847e9b..6874ffbe364 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointActionDelegate.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointActionDelegate.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.text.source.IVerticalRulerInfo;
* Ruler toggle breakpoint action delegate for disassembly parts.
*
* @since 2.1
- *
+ *
* @see org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate
*/
public class RulerToggleBreakpointActionDelegate extends AbstractDisassemblyRulerActionDelegate {
@@ -37,7 +37,8 @@ public class RulerToggleBreakpointActionDelegate extends AbstractDisassemblyRule
if (fDelegate != null) {
fDelegate.dispose();
}
- return fDelegate = new ToggleBreakpointAction(disassemblyPart, disassemblyPart.getTextViewer().getDocument(), rulerInfo);
+ return fDelegate = new ToggleBreakpointAction(disassemblyPart, disassemblyPart.getTextViewer().getDocument(),
+ rulerInfo);
}
/*
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointHandler.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointHandler.java
index b6dffe9b653..b57218784e2 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointHandler.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/RulerToggleBreakpointHandler.java
@@ -27,7 +27,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
/**
* Default handler for the toggle breakpoint command in the disassembly ruler.
* Invoked on double click in the ruler.
- *
+ *
* @since 2.1
*/
public class RulerToggleBreakpointHandler extends AbstractHandler {
@@ -38,20 +38,20 @@ public class RulerToggleBreakpointHandler extends AbstractHandler {
if (part instanceof IDisassemblyPart) {
IDisassemblyPart disassemblyPart = (IDisassemblyPart) part;
IDocument document = disassemblyPart.getTextViewer().getDocument();
- final IVerticalRulerInfo rulerInfo= part.getAdapter(IVerticalRulerInfo.class);
+ final IVerticalRulerInfo rulerInfo = part.getAdapter(IVerticalRulerInfo.class);
if (rulerInfo != null) {
- final ToggleBreakpointAction toggleBpAction= new ToggleBreakpointAction(part, document, rulerInfo);
+ final ToggleBreakpointAction toggleBpAction = new ToggleBreakpointAction(part, document, rulerInfo);
try {
toggleBpAction.update();
if (toggleBpAction.isEnabled()) {
- if (event.getTrigger() instanceof Event) {
- // Pass through the event that triggered the action.
- // This will give toggle action access to key modifiers
- // (shift, ctrl, etc.)
- toggleBpAction.runWithEvent((Event)event.getTrigger());
- } else {
- toggleBpAction.run();
- }
+ if (event.getTrigger() instanceof Event) {
+ // Pass through the event that triggered the action.
+ // This will give toggle action access to key modifiers
+ // (shift, ctrl, etc.)
+ toggleBpAction.runWithEvent((Event) event.getTrigger());
+ } else {
+ toggleBpAction.run();
+ }
}
} finally {
toggleBpAction.dispose();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/TextOperationAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/TextOperationAction.java
index ed34714299e..7ec162af4e0 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/TextOperationAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/actions/TextOperationAction.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -22,41 +22,42 @@ import org.eclipse.ui.texteditor.IUpdate;
* TextOperationAction
*/
public class TextOperationAction extends Action implements IUpdate {
-
- private int fOperationCode= -1;
- private ITextOperationTarget fOperationTarget;
-
- public TextOperationAction(ITextViewer viewer, int operationCode) {
- fOperationCode= operationCode;
- fOperationTarget= viewer.getTextOperationTarget();
- update();
- }
-
- /**
- * Updates the enabled state of the action.
- * Fires a property change if the enabled state changes.
- *
- * @see Action#firePropertyChange(String, Object, Object)
- */
- @Override
- public void update() {
-
- boolean wasEnabled= isEnabled();
- boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
- setEnabled(isEnabled);
-
- if (wasEnabled != isEnabled) {
- firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
- }
+
+ private int fOperationCode = -1;
+ private ITextOperationTarget fOperationTarget;
+
+ public TextOperationAction(ITextViewer viewer, int operationCode) {
+ fOperationCode = operationCode;
+ fOperationTarget = viewer.getTextOperationTarget();
+ update();
+ }
+
+ /**
+ * Updates the enabled state of the action.
+ * Fires a property change if the enabled state changes.
+ *
+ * @see Action#firePropertyChange(String, Object, Object)
+ */
+ @Override
+ public void update() {
+
+ boolean wasEnabled = isEnabled();
+ boolean isEnabled = (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
+ setEnabled(isEnabled);
+
+ if (wasEnabled != isEnabled) {
+ firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE,
+ isEnabled ? Boolean.TRUE : Boolean.FALSE);
}
-
- /**
- * @see Action#run()
- */
- @Override
- public void run() {
- if (fOperationCode != -1 && fOperationTarget != null) {
- fOperationTarget.doOperation(fOperationCode);
- }
+ }
+
+ /**
+ * @see Action#run()
+ */
+ @Override
+ public void run() {
+ if (fOperationCode != -1 && fOperationTarget != null) {
+ fOperationTarget.doOperation(fOperationCode);
}
}
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/Addr2Line.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/Addr2Line.java
index 3a47d09b619..92148529438 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/Addr2Line.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/Addr2Line.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -15,14 +15,13 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model;
import java.math.BigInteger;
-
public class Addr2Line {
- public BigInteger addr;
- public Addr2Line next;
- public int first;
- public int last;
-
- public static int hash(BigInteger addr, int size) {
- return (int)((addr.shiftRight(2).longValue()) % size);
- }
+ public BigInteger addr;
+ public Addr2Line next;
+ public int first;
+ public int last;
+
+ public static int hash(BigInteger addr, int size) {
+ return (int) ((addr.shiftRight(2).longValue()) % size);
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java
index f39a55a3595..d4e56201573 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java
@@ -49,20 +49,21 @@ import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
* Annotation model for breakpoints in the disassembly.
* Works only with {@link DisassemblyDocument}.
*/
-public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel implements IBreakpointListener, IDocumentListener {
-
+public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel
+ implements IBreakpointListener, IDocumentListener {
+
private Runnable fCatchup;
private IAdaptable fDebugContext;
-
+
public BreakpointsAnnotationModel(IAdaptable debugContext) {
fDebugContext = debugContext;
}
-
+
@Override
public void connect(IDocument document) {
super.connect(document);
if (document instanceof DisassemblyDocument) {
- final IBreakpointManager bpMgr= DebugPlugin.getDefault().getBreakpointManager();
+ final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
addBreakpoints(bpMgr.getBreakpoints());
bpMgr.addBreakpointListener(this);
document.addDocumentListener(this);
@@ -72,17 +73,17 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
@Override
public void disconnect(IDocument document) {
if (document instanceof DisassemblyDocument) {
- final IBreakpointManager bpMgr= DebugPlugin.getDefault().getBreakpointManager();
+ final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
bpMgr.removeBreakpointListener(this);
document.removeDocumentListener(this);
- fCatchup= null;
+ fCatchup = null;
}
super.disconnect(document);
}
private void catchupWithBreakpoints() {
removeAllAnnotations(false);
- final IBreakpointManager bpMgr= DebugPlugin.getDefault().getBreakpointManager();
+ final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
addBreakpoints(bpMgr.getBreakpoints());
}
@@ -106,10 +107,10 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
*/
@Override
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
- Annotation a= findAnnotation(breakpoint.getMarker());
+ Annotation a = findAnnotation(breakpoint.getMarker());
if (a != null) {
if (a instanceof SimpleMarkerAnnotation) {
- ((SimpleMarkerAnnotation)a).update();
+ ((SimpleMarkerAnnotation) a).update();
}
synchronized (getLockObject()) {
getAnnotationModelEvent().annotationChanged(a);
@@ -125,15 +126,15 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
*/
@Override
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
- Annotation a= findAnnotation(breakpoint.getMarker());
+ Annotation a = findAnnotation(breakpoint.getMarker());
if (a != null) {
removeAnnotation(a, true);
}
}
private Annotation findAnnotation(IMarker marker) {
- for (Iterator<Annotation> it= getAnnotationIterator(false); it.hasNext();) {
- SimpleMarkerAnnotation a= (SimpleMarkerAnnotation) it.next();
+ for (Iterator<Annotation> it = getAnnotationIterator(false); it.hasNext();) {
+ SimpleMarkerAnnotation a = (SimpleMarkerAnnotation) it.next();
if (a.getMarker().equals(marker)) {
return a;
}
@@ -145,7 +146,7 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
if (fDocument == null) {
return;
}
- final IMarker marker= breakpoint.getMarker();
+ final IMarker marker = breakpoint.getMarker();
if (marker == null) {
return;
}
@@ -160,10 +161,10 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
// ignore wrong positions
}
}
-
+
private Position createPositionFromBreakpoint(IBreakpoint breakpoint) throws CoreException {
IBreakpointLocationProvider locationProvider = breakpoint.getAdapter(IBreakpointLocationProvider.class);
-
+
/* if there is a location provider, than use the provider to retrieve the location */
if (locationProvider != null) {
@@ -172,20 +173,20 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
if (sourceFile != null) {
int lineNumber = locationProvider.getLineNumber(breakpoint, fDebugContext) - 1;
return createPositionFromSourceLine(sourceFile, lineNumber);
-
+
} else {
/* if there is label info, than create a label position */
IAddress labelAddress = locationProvider.getLabelAddress(breakpoint, fDebugContext);
if (labelAddress != null) {
return createPositionFromLabel(labelAddress.getValue());
-
- /* Otherwise, create an address position */
+
+ /* Otherwise, create an address position */
} else {
// See bug 300053 comment 5:
- // Since there can only be one annotation per marker and in order to support multiple
+ // Since there can only be one annotation per marker and in order to support multiple
// annotations per breakpoint, we need a specialized annotation type.
//
- // So for now, we only create an annotation for the first valid address. We can add
+ // So for now, we only create an annotation for the first valid address. We can add
// support for multiple annotations per breakpoint when it's needed.
IAddress[] addresses = locationProvider.getAddresses(breakpoint, fDebugContext);
for (int i = 0; addresses != null && i < addresses.length; ++i) {
@@ -196,31 +197,31 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
}
}
}
-
- /* otherwise, use legacy ICBreakpoint location info */
+
+ /* otherwise, use legacy ICBreakpoint location info */
} else {
if (breakpoint instanceof ICAddressBreakpoint) {
- ICAddressBreakpoint addressBreakpoint= (ICAddressBreakpoint) breakpoint;
+ ICAddressBreakpoint addressBreakpoint = (ICAddressBreakpoint) breakpoint;
return createPositionFromAddress(decodeAddress(addressBreakpoint.getAddress()));
} else if (breakpoint instanceof ILineBreakpoint) {
- ILineBreakpoint lineBreakpoint= (ILineBreakpoint) breakpoint;
- Position position= null;
- final int lineNumber= lineBreakpoint.getLineNumber() - 1;
- final IMarker marker= breakpoint.getMarker();
+ ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
+ Position position = null;
+ final int lineNumber = lineBreakpoint.getLineNumber() - 1;
+ final IMarker marker = breakpoint.getMarker();
if (marker.getResource().getType() == IResource.FILE) {
- position= createPositionFromSourceLine((IFile) marker.getResource(), lineNumber);
+ position = createPositionFromSourceLine((IFile) marker.getResource(), lineNumber);
if (position != null) {
return position;
}
}
- String fileName= marker.getAttribute(ICLineBreakpoint.SOURCE_HANDLE, null);
- position= createPositionFromSourceLine(fileName, lineNumber);
+ String fileName = marker.getAttribute(ICLineBreakpoint.SOURCE_HANDLE, null);
+ position = createPositionFromSourceLine(fileName, lineNumber);
if (position == null && breakpoint instanceof ICLineBreakpoint) {
- ICLineBreakpoint cBreakpoint= (ICLineBreakpoint) breakpoint;
+ ICLineBreakpoint cBreakpoint = (ICLineBreakpoint) breakpoint;
if (breakpoint instanceof ICFunctionBreakpoint) {
- position= createPositionFromLabel(cBreakpoint.getFunction());
+ position = createPositionFromLabel(cBreakpoint.getFunction());
} else {
- position= createPositionFromAddress(decodeAddress(cBreakpoint.getAddress()));
+ position = createPositionFromAddress(decodeAddress(cBreakpoint.getAddress()));
}
}
return position;
@@ -232,7 +233,7 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
/**
* Decode given string representation of a non-negative integer. A
* hexadecimal encoded integer is expected to start with <code>0x</code>.
- *
+ *
* @param string
* decimal or hexadecimal representation of an non-negative integer
* @return address value as <code>BigInteger</code> or <code>null</code> in case of a <code>NumberFormatException</code>
@@ -266,14 +267,15 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple
@Override
public void documentChanged(DocumentEvent event) {
if (fCatchup == null && event.fText != null && !event.fText.isEmpty()) {
- fCatchup= new Runnable() {
+ fCatchup = new Runnable() {
@Override
public void run() {
if (fCatchup == this) {
catchupWithBreakpoints();
- fCatchup= null;
+ fCatchup = null;
}
- }};
+ }
+ };
Display.getCurrent().timerExec(50, fCatchup);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java
index f6d6376bdca..ce851ee11c9 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* Patrick Chuong (Texas Instruments) - Bug 315443
@@ -69,7 +69,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* manipulate the list. This list should be accessed only from the GUI thread
*/
private final List<SourcePosition> fInvalidSource = new ArrayList<SourcePosition>();
-
+
private final Map<IStorage, SourceFileInfo> fFileInfoMap = new HashMap<IStorage, SourceFileInfo>();
private int fMaxFunctionLength = 0;
@@ -116,7 +116,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
assert isGuiThread();
super.dispose();
-
+
// cleanup source info
for (Iterator<SourceFileInfo> iter = fFileInfoMap.values().iterator(); iter.hasNext();) {
SourceFileInfo fi = iter.next();
@@ -136,7 +136,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
setLineTracker(new DefaultLineTracker());
completeInitialization();
}
-
+
public AddressRangePosition[] getInvalidAddressRanges() {
assert isGuiThread();
return fInvalidAddressRanges.toArray(new AddressRangePosition[fInvalidAddressRanges.size()]);
@@ -150,35 +150,35 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return fMaxFunctionLength;
}
- public void setMaxOpcodeLength(BigInteger longOpcode ) {
+ public void setMaxOpcodeLength(BigInteger longOpcode) {
fMaxOpcodeLength = longOpcode;
}
- public int getMaxOpcodeLength(int radix ) {
+ public int getMaxOpcodeLength(int radix) {
int retVal = 0;
if (fMaxOpcodeLength != null) {
String str = fMaxOpcodeLength.toString(radix);
retVal = str.length();
switch (radix) {
- case 8:
- retVal += 1; // Padded for 0 prefix
- break;
- case 16:
- retVal += 2; // Padded for 0x prefix
- break;
- default:
- break;
+ case 8:
+ retVal += 1; // Padded for 0 prefix
+ break;
+ case 16:
+ retVal += 2; // Padded for 0x prefix
+ break;
+ default:
+ break;
}
}
return retVal;
}
public int getAddressLength() {
- return fNumberOfDigits+2;
+ return fNumberOfDigits + 2;
}
public int getMeanSizeOfInstructions() {
- return (int)(fMeanSizeOfInstructions+.9);
+ return (int) (fMeanSizeOfInstructions + .9);
}
public Iterator<Position> getModelPositionIterator(BigInteger address) {
@@ -199,7 +199,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return positions.listIterator(idx);
}
- public Iterator<Position> getPositionIterator(String category, BigInteger address) throws BadPositionCategoryException {
+ public Iterator<Position> getPositionIterator(String category, BigInteger address)
+ throws BadPositionCategoryException {
List<Position> positions = getDocumentManagedPositions().get(category);
if (positions == null) {
throw new BadPositionCategoryException();
@@ -220,11 +221,11 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* Computes the index in the list of positions at which a position with the
* given address would be inserted. The position is supposed to become the
* first in this list of all positions with the same offset.
- *
+ *
* @param positions the list in which the index is computed
* @param address the address for which the index is computed
* @return the computed index
- *
+ *
*/
protected int computeIndexInPositionListFirst(List<Position> positions, BigInteger address) {
int size = positions.size();
@@ -236,7 +237,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
int mid = 0;
while (low < high) {
mid = (low + high) >>> 1;
- AddressRangePosition range = (AddressRangePosition)positions.get(mid);
+ AddressRangePosition range = (AddressRangePosition) positions.get(mid);
int compareSign = address.compareTo(range.fAddressOffset);
if (compareSign < 0) {
high = mid;
@@ -250,14 +251,14 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
int idx = mid;
- AddressRangePosition p = (AddressRangePosition)positions.get(idx);
+ AddressRangePosition p = (AddressRangePosition) positions.get(idx);
if (address.compareTo(p.fAddressOffset) == 0) {
do {
--idx;
if (idx < 0) {
break;
}
- p = (AddressRangePosition)positions.get(idx);
+ p = (AddressRangePosition) positions.get(idx);
} while (address.compareTo(p.fAddressOffset) == 0);
++idx;
} else if (address.compareTo(p.fAddressOffset.add(p.fAddressLength)) >= 0) {
@@ -270,11 +271,11 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* Computes the index in the list of positions at which a position with the
* given address would be inserted. The position is supposed to become the
* last but one in this list of all positions with the same address.
- *
+ *
* @param positions the list in which the index is computed
* @param address the address for which the index is computed
* @return the computed index
- *
+ *
*/
protected int computeIndexInPositionListLast(List<Position> positions, BigInteger address) {
int size = positions.size();
@@ -319,11 +320,11 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* Computes the index in the list of positions at which a position with the
* given offset would be inserted. The position is supposed to become the
* last in this list of all positions with the same offset.
- *
+ *
* @param positions the list in which the index is computed
* @param offset the offset for which the index is computed
* @return the computed index
- *
+ *
* @see IDocument#computeIndexInCategory(String, int)
* @deprecated Use {@link #computeIndexInPositionListLast(List, BigInteger)}
* as it is for managing lists of AddressRangePositions
@@ -376,7 +377,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
/**
* Returns the position for the supplied category and index.
- *
+ *
* @param category
* @param index
* @return a Position matching the category and index, or <code>null</code>.
@@ -441,7 +442,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
/**
* Compute the address of the given document line number.
- *
+ *
* @param line
* @return the address of the given document line number, -1 if no valid
* address can be computed
@@ -459,7 +460,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
/**
* Compute the address off the given document offset.
- *
+ *
* @param offset
* @return the address of the given document offset, -1 if no valid address
* can be computed
@@ -501,7 +502,6 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return getPositionOfAddress(CATEGORY_DISASSEMBLY, address);
}
-
/**
* @param offset
* @return
@@ -558,34 +558,34 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
/**
* Compute document position of the given source line.
- *
+ *
* @param file the file as an <code>IStorage</code>
* @param lineNumber the 0-based line number
* @return the document position or <code>null</code>
*/
public Position getSourcePosition(IStorage file, int lineNumber) {
- SourceFileInfo info= getSourceInfo(file);
+ SourceFileInfo info = getSourceInfo(file);
return getSourcePosition(info, lineNumber);
}
/**
* Compute document position of the given source line.
- *
+ *
* @param fileName the file name, may be a raw debugger path or the path to an external file
* @param lineNumber the 0-based line number
* @return the document position or <code>null</code>
*/
public Position getSourcePosition(String fileName, int lineNumber) {
- SourceFileInfo info= getSourceInfo(fileName);
+ SourceFileInfo info = getSourceInfo(fileName);
if (info == null) {
- info= getSourceInfo(new LocalFileStorage(new File(fileName)));
+ info = getSourceInfo(new LocalFileStorage(new File(fileName)));
}
return getSourcePosition(info, lineNumber);
}
-
+
/**
* Compute document position of the given source line.
- *
+ *
* @param info
* @param lineNumber the 0-based line number
* @return the document position or <code>null</code>
@@ -595,8 +595,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return null;
}
try {
- SourcePosition srcPos= null;
- IRegion stmtLineRegion= info.fSource.getLineInformation(lineNumber);
+ SourcePosition srcPos = null;
+ IRegion stmtLineRegion = info.fSource.getLineInformation(lineNumber);
final int lineOffset = stmtLineRegion.getOffset();
final int lineLength = stmtLineRegion.getLength() + 1;
BigInteger stmtAddress = info.fLine2Addr[lineNumber];
@@ -604,12 +604,12 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
srcPos = getSourcePosition(stmtAddress);
}
if (srcPos == null) {
- for (Iterator<Position> iterator = getPositionIterator(CATEGORY_SOURCE, 0); iterator.hasNext(); ) {
- SourcePosition pos= (SourcePosition) iterator.next();
+ for (Iterator<Position> iterator = getPositionIterator(CATEGORY_SOURCE, 0); iterator.hasNext();) {
+ SourcePosition pos = (SourcePosition) iterator.next();
if (pos.fFileInfo == info && pos.fValid && lineNumber >= pos.fLine) {
- int baseOffset= info.fSource.getLineOffset(pos.fLine);
+ int baseOffset = info.fSource.getLineOffset(pos.fLine);
if (lineOffset + lineLength - baseOffset <= pos.length) {
- srcPos= pos;
+ srcPos = pos;
break;
}
}
@@ -634,7 +634,6 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return null;
}
-
/**
* @param category
* @param offset
@@ -642,7 +641,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* @throws BadPositionCategoryException
* @throws BadLocationException
*/
- public Position getPosition(String category, int offset, boolean allowZeroLength) throws BadLocationException, BadPositionCategoryException {
+ public Position getPosition(String category, int offset, boolean allowZeroLength)
+ throws BadLocationException, BadPositionCategoryException {
List<Position> list = getDocumentManagedPositions().get(category);
int idx;
idx = computeIndexInPositionList(list, offset, true);
@@ -701,7 +701,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
// cannot happen
}
if (pos instanceof DisassemblyPosition) {
- DisassemblyPosition disassPos = (DisassemblyPosition)pos;
+ DisassemblyPosition disassPos = (DisassemblyPosition) pos;
int functionLength = disassPos.fFunction.length;
if (functionLength > fMaxFunctionLength) {
fMaxFunctionLength = functionLength;
@@ -712,7 +712,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
}
if (fNumberOfInstructions < 100 && fMeanSizeOfInstructions < 16.0) {
- fMeanSizeOfInstructions = (fMeanSizeOfInstructions * fNumberOfInstructions + pos.fAddressLength.floatValue()) / (++fNumberOfInstructions);
+ fMeanSizeOfInstructions = (fMeanSizeOfInstructions * fNumberOfInstructions
+ + pos.fAddressLength.floatValue()) / (++fNumberOfInstructions);
}
}
}
@@ -726,7 +727,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
if (list == null) {
throw new BadPositionCategoryException();
}
- if (DEBUG) System.out.println("Adding position to category <" + category + "> : " + pos); //$NON-NLS-1$ //$NON-NLS-2$
+ if (DEBUG)
+ System.out.println("Adding position to category <" + category + "> : " + pos); //$NON-NLS-1$ //$NON-NLS-2$
list.add(computeIndexInPositionListLast(list, pos.fAddressOffset), pos);
}
@@ -807,8 +809,9 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
public void removePosition(String category, Position position) throws BadPositionCategoryException {
super.removePosition(category, position);
- if (DEBUG && isOneOfOurs(category)) System.out.println("Removing position from category(" + category + ") :" + position); //$NON-NLS-1$ //$NON-NLS-2$
-
+ if (DEBUG && isOneOfOurs(category))
+ System.out.println("Removing position from category(" + category + ") :" + position); //$NON-NLS-1$ //$NON-NLS-2$
+
if (!category.equals(CATEGORY_MODEL) && position instanceof AddressRangePosition) {
super.removePosition(CATEGORY_MODEL, position);
}
@@ -818,15 +821,15 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
if (toRemove.isEmpty()) {
return;
}
-
- if (DEBUG && isOneOfOurs(category)) {
+
+ if (DEBUG && isOneOfOurs(category)) {
System.out.println("Removing positions from category(" + category + ')'); //$NON-NLS-1$
int i = 0;
for (AddressRangePosition pos : toRemove) {
- System.out.println("[" + i++ +"] " + pos); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("[" + i++ + "] " + pos); //$NON-NLS-1$ //$NON-NLS-2$
}
}
-
+
List<Position> positions = getDocumentManagedPositions().get(category);
if (positions != null) {
positions.removeAll(toRemove);
@@ -844,8 +847,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* instead as DissemblyDocument's lists are AddressRangePositions
*/
@Deprecated
- public void addPositionLast(String category, Position position) throws BadLocationException,
- BadPositionCategoryException {
+ public void addPositionLast(String category, Position position)
+ throws BadLocationException, BadPositionCategoryException {
if ((0 > position.offset) || (0 > position.length) || (position.offset + position.length > getLength()))
throw new BadLocationException();
@@ -907,7 +910,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
pos.offset += delta;
}
}
-
+
if (DEBUG) {
String escapedText = null;
if (text != null) {
@@ -915,7 +918,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
escapedText = escapedText.replace(new StringBuilder("\r"), new StringBuilder("\\r")); //$NON-NLS-1$ //$NON-NLS-2$
escapedText = escapedText.replace(new StringBuilder("\t"), new StringBuilder("\\t")); //$NON-NLS-1$ //$NON-NLS-2$
}
- System.out.println("Calling AbstractDocument.replace("+insertPos.offset+','+replaceLength+",\""+escapedText+"\")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ System.out.println("Calling AbstractDocument.replace(" + insertPos.offset + ',' + replaceLength + ",\"" //$NON-NLS-1$//$NON-NLS-2$
+ + escapedText + "\")"); //$NON-NLS-1$
}
super.replace(insertPos.offset, replaceLength, text);
}
@@ -927,24 +931,26 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* @throws BadPositionCategoryException
* @throws BadLocationException
*/
- public AddressRangePosition insertAddressRange(AddressRangePosition pos, AddressRangePosition insertPos, String line, boolean addToModel)
- throws BadLocationException {
- assert isGuiThread();
+ public AddressRangePosition insertAddressRange(AddressRangePosition pos, AddressRangePosition insertPos,
+ String line, boolean addToModel) throws BadLocationException {
+ assert isGuiThread();
final BigInteger address = insertPos.fAddressOffset;
BigInteger length = insertPos.fAddressLength;
if (pos == null) {
pos = getPositionOfAddress(address);
}
- assert !pos.isDeleted && !pos.fValid && (length.compareTo(BigInteger.ZERO) == 0 || pos.containsAddress(address));
+ assert !pos.isDeleted && !pos.fValid
+ && (length.compareTo(BigInteger.ZERO) == 0 || pos.containsAddress(address));
int insertOffset;
int replaceLength = 0;
- if (length.compareTo(BigInteger.ONE) > 0 && !pos.containsAddress(address.add(length.subtract(BigInteger.ONE)))) {
+ if (length.compareTo(BigInteger.ONE) > 0
+ && !pos.containsAddress(address.add(length.subtract(BigInteger.ONE)))) {
// merge with successor positions
Iterator<Position> it = getModelPositionIterator(pos.fAddressOffset.add(pos.fAddressLength));
assert it.hasNext();
do {
AddressRangePosition overlap = (AddressRangePosition) it.next();
- BigInteger posEndAddress= pos.fAddressOffset.add(pos.fAddressLength);
+ BigInteger posEndAddress = pos.fAddressOffset.add(pos.fAddressLength);
assert pos.offset <= overlap.offset && overlap.fAddressOffset.compareTo(posEndAddress) == 0;
if (overlap instanceof LabelPosition || overlap instanceof SourcePosition) {
// don't override label or source positions, instead fix
@@ -959,7 +965,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
if (!overlap.fValid) {
removeInvalidAddressRange(overlap);
}
- } while(!pos.containsAddress(address.add(length.subtract(BigInteger.ONE))));
+ } while (!pos.containsAddress(address.add(length.subtract(BigInteger.ONE))));
}
BigInteger newEndAddress = pos.fAddressOffset.add(pos.fAddressLength);
BigInteger newStartAddress = address.add(length);
@@ -987,9 +993,10 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
pos = null;
}
if (newEndAddress.compareTo(newStartAddress) > 0) {
- pos = insertInvalidAddressRange(insertOffset+replaceLength, 0, newStartAddress, newEndAddress);
+ pos = insertInvalidAddressRange(insertOffset + replaceLength, 0, newStartAddress, newEndAddress);
}
- assert pos == null || pos.fAddressLength.compareTo(BigInteger.ZERO) > 0 && pos.containsAddress(address.add(length));
+ assert pos == null
+ || pos.fAddressLength.compareTo(BigInteger.ZERO) > 0 && pos.containsAddress(address.add(length));
assert insertOffset + replaceLength <= getLength();
insertPos.offset = insertOffset;
@@ -997,7 +1004,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
addModelPosition(insertPos);
}
replace(insertPos, replaceLength, line);
- if (DEBUG) checkConsistency();
+ if (DEBUG)
+ checkConsistency();
return pos;
}
@@ -1005,17 +1013,18 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertDisassemblyLine(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, int, java.lang.String, java.lang.String, java.lang.String, int)
*/
@Override
- public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length, String functionOffset, String instruction, String file, int lineNr)
- throws BadLocationException {
+ public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length,
+ String functionOffset, String instruction, String file, int lineNr) throws BadLocationException {
return insertDisassemblyLine(pos, address, length, functionOffset, null, instruction, file, lineNr);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertDisassemblyLine(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, int, java.lang.String, java.lang.String, java.lang.String, int)
*/
@Override
- public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length, String functionOffset, BigInteger opcode, String instruction, String file, int lineNr)
- throws BadLocationException {
+ public AddressRangePosition insertDisassemblyLine(AddressRangePosition pos, BigInteger address, int length,
+ String functionOffset, BigInteger opcode, String instruction, String file, int lineNr)
+ throws BadLocationException {
assert isGuiThread();
String disassLine = null;
if (instruction == null || instruction.length() == 0) {
@@ -1025,7 +1034,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
AddressRangePosition disassPos;
if (lineNr < 0) {
- disassPos = new DisassemblyPosition(0, disassLine.length(), address, BigInteger.valueOf(length), functionOffset, opcode);
+ disassPos = new DisassemblyPosition(0, disassLine.length(), address, BigInteger.valueOf(length),
+ functionOffset, opcode);
} else {
disassPos = new DisassemblyWithSourcePosition(0, disassLine.length(), address, BigInteger.valueOf(length),
functionOffset, opcode, file, lineNr);
@@ -1033,7 +1043,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
pos = insertAddressRange(pos, disassPos, disassLine, true);
addDisassemblyPosition(disassPos);
return pos;
- }
+ }
+
/**
* @param address
* @param functionOffset
@@ -1046,7 +1057,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
buf.append(fRadixPrefix);
}
String str = address.toString(fRadix);
- for (int i=str.length(); i<fNumberOfDigits; ++i)
+ for (int i = str.length(); i < fNumberOfDigits; ++i)
buf.append('0');
buf.append(str);
buf.append(':');
@@ -1071,10 +1082,10 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
for (int j = 0; j < n; j++) {
char ch = instruction.charAt(j);
if (ch == '\t') {
- int tab = (buf.length()-prefixLen + 8) & ~0x7;
+ int tab = (buf.length() - prefixLen + 8) & ~0x7;
do
buf.append(' ');
- while (buf.length()-prefixLen < tab);
+ while (buf.length() - prefixLen < tab);
} else {
buf.append(ch);
}
@@ -1085,7 +1096,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
public void setRadix(int radix) {
fRadix = radix;
- fNumberOfDigits = (int)(Math.log(1L<<32)/Math.log(radix)+0.9);
+ fNumberOfDigits = (int) (Math.log(1L << 32) / Math.log(radix) + 0.9);
setShowRadixPrefix(fShowRadixPrefix);
}
@@ -1102,20 +1113,21 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
}
- public AddressRangePosition insertErrorLine(AddressRangePosition pos, BigInteger address, BigInteger length, String line)
- throws BadLocationException {
+ public AddressRangePosition insertErrorLine(AddressRangePosition pos, BigInteger address, BigInteger length,
+ String line) throws BadLocationException {
assert isGuiThread();
int hashCode = line.hashCode();
final long alignment = fErrorAlignment;
if (alignment > 1 && !(pos instanceof ErrorPosition)) {
AddressRangePosition before = getPositionOfAddress(address.subtract(BigInteger.ONE));
- if (before instanceof ErrorPosition && before.hashCode() == hashCode && before.offset + before.length == pos.offset) {
+ if (before instanceof ErrorPosition && before.hashCode() == hashCode
+ && before.offset + before.length == pos.offset) {
assert before.fAddressOffset.add(before.fAddressLength).compareTo(address) == 0;
assert pos.fAddressOffset.compareTo(address) == 0;
// merge with previous error position
- BigInteger pageOffset = before.fAddressOffset.and(BigInteger.valueOf(~(alignment-1)));
+ BigInteger pageOffset = before.fAddressOffset.and(BigInteger.valueOf(~(alignment - 1)));
BigInteger mergeLen = pageOffset.add(BigInteger.valueOf(alignment))
- .subtract((before.fAddressOffset.add(before.fAddressLength))).min(length);
+ .subtract((before.fAddressOffset.add(before.fAddressLength))).min(length);
if (mergeLen.compareTo(BigInteger.ZERO) > 0) {
pos.fAddressLength = pos.fAddressLength.subtract(mergeLen);
if (pos.fAddressLength.compareTo(BigInteger.ZERO) == 0) {
@@ -1129,18 +1141,20 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
before.fAddressLength = before.fAddressLength.add(mergeLen);
address = address.add(mergeLen);
length = length.subtract(mergeLen);
- if (DEBUG) checkConsistency();
+ if (DEBUG)
+ checkConsistency();
if (length.compareTo(BigInteger.ZERO) == 0) {
return pos;
}
}
}
AddressRangePosition after = getPositionOfAddress(address.add(length));
- if (after instanceof ErrorPosition && after.hashCode() == hashCode && pos != null && pos.offset + pos.length == after.offset) {
+ if (after instanceof ErrorPosition && after.hashCode() == hashCode && pos != null
+ && pos.offset + pos.length == after.offset) {
assert after.fAddressOffset == address.add(length);
assert pos.fAddressOffset.add(pos.fAddressLength).compareTo(after.fAddressOffset) == 0;
// merge with next error position
- BigInteger pageOffset = after.fAddressOffset.add(BigInteger.valueOf(~(alignment-1)));
+ BigInteger pageOffset = after.fAddressOffset.add(BigInteger.valueOf(~(alignment - 1)));
BigInteger mergeLen = after.fAddressOffset.subtract(pageOffset).min(length);
if (mergeLen.compareTo(BigInteger.ZERO) > 0) {
after.fAddressOffset = after.fAddressOffset.subtract(mergeLen);
@@ -1152,7 +1166,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
removeInvalidAddressRange(pos);
pos = null;
}
- if (DEBUG) checkConsistency();
+ if (DEBUG)
+ checkConsistency();
length = length.subtract(mergeLen);
if (length.compareTo(BigInteger.ZERO) == 0) {
return pos;
@@ -1160,7 +1175,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
}
}
- BigInteger pageOffset = address.and(BigInteger.valueOf(~(alignment-1)));
+ BigInteger pageOffset = address.and(BigInteger.valueOf(~(alignment - 1)));
BigInteger posLen = pageOffset.add(BigInteger.valueOf(alignment)).subtract(address).min(length);
while (length.compareTo(BigInteger.ZERO) > 0) {
AddressRangePosition errorPos = new ErrorPosition(0, 0, address, posLen, hashCode);
@@ -1182,8 +1197,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument#insertLabel(org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition, java.math.BigInteger, java.lang.String, boolean)
*/
@Override
- public AddressRangePosition insertLabel(AddressRangePosition pos, BigInteger address, String label, boolean showLabels)
- throws BadLocationException {
+ public AddressRangePosition insertLabel(AddressRangePosition pos, BigInteger address, String label,
+ boolean showLabels) throws BadLocationException {
assert isGuiThread();
String labelLine = showLabels ? label + ":\n" : ""; //$NON-NLS-1$ //$NON-NLS-2$
LabelPosition labelPos = getLabelPosition(address);
@@ -1212,8 +1227,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* @throws BadPositionCategoryException
*/
public SourcePosition insertSource(SourcePosition pos, String source, int line, boolean endOfSource) {
-// System.out.println("insertSource at "+getAddressText(pos.fAddressOffset));
-// System.out.println(source);
+ // System.out.println("insertSource at "+getAddressText(pos.fAddressOffset));
+ // System.out.println(source);
String sourceLines = source;
if (!source.isEmpty() && sourceLines.charAt(source.length() - 1) != '\n') {
sourceLines += "\n"; //$NON-NLS-1$
@@ -1228,9 +1243,10 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
replace(pos, oldLength, sourceLines);
if (!endOfSource) {
if (pos.length > 0) {
- SourcePosition oldPos = getSourcePosition(pos.offset+pos.length);
+ SourcePosition oldPos = getSourcePosition(pos.offset + pos.length);
if (oldPos == null || oldPos.fAddressOffset.compareTo(pos.fAddressOffset) != 0) {
- pos = new SourcePosition(pos.offset+pos.length, 0, pos.fAddressOffset, pos.fFileInfo, line, pos.fLast, false);
+ pos = new SourcePosition(pos.offset + pos.length, 0, pos.fAddressOffset, pos.fFileInfo, line,
+ pos.fLast, false);
addSourcePosition(pos);
addModelPosition(pos);
addInvalidSourcePositions(pos);
@@ -1246,15 +1262,16 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return pos;
}
- /**
+ /**
* @param pos
* @param address
* @param fi
* @param firstLine
- * @param lastLine
+ * @param lastLine
* @return
*/
- public AddressRangePosition insertInvalidSource(AddressRangePosition pos, BigInteger address, SourceFileInfo fi, int firstLine, int lastLine) {
+ public AddressRangePosition insertInvalidSource(AddressRangePosition pos, BigInteger address, SourceFileInfo fi,
+ int firstLine, int lastLine) {
assert isGuiThread();
SourcePosition sourcePos = getSourcePosition(address);
if (sourcePos != null) {
@@ -1280,11 +1297,12 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
* @param endAddress
* @return
*/
- public AddressRangePosition insertInvalidAddressRange(int offset, int replaceLength, BigInteger startAddress, BigInteger endAddress) {
+ public AddressRangePosition insertInvalidAddressRange(int offset, int replaceLength, BigInteger startAddress,
+ BigInteger endAddress) {
assert isGuiThread();
String periods = "...\n"; //$NON-NLS-1$
- AddressRangePosition newPos = new AddressRangePosition(offset, periods.length(), startAddress, endAddress
- .subtract(startAddress), false);
+ AddressRangePosition newPos = new AddressRangePosition(offset, periods.length(), startAddress,
+ endAddress.subtract(startAddress), false);
try {
addModelPositionFirst(newPos);
replace(newPos, replaceLength, periods);
@@ -1299,8 +1317,9 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
public void invalidateAddressRange(BigInteger startAddress, BigInteger endAddress, boolean collapse) {
deleteDisassemblyRange(startAddress, endAddress, true, collapse);
}
-
- public void deleteDisassemblyRange(BigInteger startAddress, BigInteger endAddress, boolean invalidate, boolean collapse) {
+
+ public void deleteDisassemblyRange(BigInteger startAddress, BigInteger endAddress, boolean invalidate,
+ boolean collapse) {
assert isGuiThread();
DocumentRewriteSession session = startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL);
try {
@@ -1329,9 +1348,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
pos = null;
} else if (pos instanceof DisassemblyPosition) {
// optimization: join adjacent positions
- if (collapse && lastPos != null
- && (invalidate || lastPos.fValid == pos.fValid)
- && lastPos.offset+lastPos.length == pos.offset) {
+ if (collapse && lastPos != null && (invalidate || lastPos.fValid == pos.fValid)
+ && lastPos.offset + lastPos.length == pos.offset) {
assert lastPos.fAddressOffset.add(lastPos.fAddressLength).compareTo(pos.fAddressOffset) == 0;
lastPos.length += pos.length;
lastPos.fAddressLength = lastPos.fAddressLength.add(pos.fAddressLength);
@@ -1372,7 +1390,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
} finally {
stopRewriteSession(session);
}
- if (DEBUG) checkConsistency();
+ if (DEBUG)
+ checkConsistency();
}
public void invalidateSource() {
@@ -1385,7 +1404,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
return;
}
while (it.hasNext()) {
- SourcePosition srcPos = (SourcePosition)it.next();
+ SourcePosition srcPos = (SourcePosition) it.next();
if (srcPos != null && srcPos.fValid) {
srcPos.fValid = false;
assert !fInvalidSource.contains(srcPos);
@@ -1393,7 +1412,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
}
}
-
+
public SourcePosition[] getInvalidSourcePositions() {
assert isGuiThread();
return fInvalidSource.toArray(new SourcePosition[fInvalidSource.size()]);
@@ -1401,26 +1420,29 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
public boolean addInvalidSourcePositions(SourcePosition srcPos) {
assert isGuiThread();
- if (DEBUG) System.out.println("Adding invalid source position to list: " + srcPos); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("Adding invalid source position to list: " + srcPos); //$NON-NLS-1$
return fInvalidSource.add(srcPos);
}
public boolean removeInvalidSourcePosition(SourcePosition srcPos) {
assert isGuiThread();
- if (DEBUG) System.out.println("Removing invalid source position from list: " + srcPos); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("Removing invalid source position from list: " + srcPos); //$NON-NLS-1$
return fInvalidSource.remove(srcPos);
}
-
+
public boolean hasInvalidSourcePositions() {
assert isGuiThread();
- return !fInvalidSource.isEmpty();
+ return !fInvalidSource.isEmpty();
}
public void invalidateDisassemblyWithSource(boolean removeDisassembly) {
for (Iterator<SourceFileInfo> it = fFileInfoMap.values().iterator(); it.hasNext();) {
SourceFileInfo info = it.next();
if (info.fLine2Addr != null) {
- deleteDisassemblyRange(info.fStartAddress, info.fEndAddress.add(BigInteger.ONE), !removeDisassembly, !removeDisassembly);
+ deleteDisassemblyRange(info.fStartAddress, info.fEndAddress.add(BigInteger.ONE), !removeDisassembly,
+ !removeDisassembly);
}
}
}
@@ -1459,12 +1481,13 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
toRemove.add(p);
if (!p.fValid) {
if (p instanceof SourcePosition) {
- removeInvalidSourcePosition((SourcePosition)p);
+ removeInvalidSourcePosition((SourcePosition) p);
} else {
removeInvalidAddressRange(p);
}
}
- if (addressLength.compareTo(BigInteger.ZERO) > 0 && p.fAddressOffset.compareTo(endPos.fAddressOffset) >= 0) {
+ if (addressLength.compareTo(BigInteger.ZERO) > 0
+ && p.fAddressOffset.compareTo(endPos.fAddressOffset) >= 0) {
break;
}
}
@@ -1483,7 +1506,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
public SourceFileInfo getSourceInfo(BigInteger address) {
AddressRangePosition pos = getDisassemblyPosition(address);
if (pos instanceof DisassemblyPosition) {
- DisassemblyPosition disassPos = (DisassemblyPosition)pos;
+ DisassemblyPosition disassPos = (DisassemblyPosition) pos;
return getSourceInfo(disassPos.getFile());
}
return null;
@@ -1543,7 +1566,8 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
@Override
public void addInvalidAddressRange(AddressRangePosition pos) {
assert isGuiThread();
- if (DEBUG) System.out.println("Adding to invalid range list: " + pos); //$NON-NLS-1$
+ if (DEBUG)
+ System.out.println("Adding to invalid range list: " + pos); //$NON-NLS-1$
fInvalidAddressRanges.add(pos);
}
@@ -1557,19 +1581,18 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
}
public void removeInvalidAddressRange(AddressRangePosition pos) {
- assert isGuiThread();
- if (DEBUG) System.out.println("Removing from invalid range list: " + pos); //$NON-NLS-1$
+ assert isGuiThread();
+ if (DEBUG)
+ System.out.println("Removing from invalid range list: " + pos); //$NON-NLS-1$
fInvalidAddressRanges.remove(pos);
}
-
+
private static boolean isGuiThread() {
return Display.getCurrent() != null;
}
-
+
private static boolean isOneOfOurs(String category) {
- return category.equals(CATEGORY_MODEL) ||
- category.equals(CATEGORY_DISASSEMBLY) ||
- category.equals(CATEGORY_LABELS) ||
- category.equals(CATEGORY_SOURCE);
+ return category.equals(CATEGORY_MODEL) || category.equals(CATEGORY_DISASSEMBLY)
+ || category.equals(CATEGORY_LABELS) || category.equals(CATEGORY_SOURCE);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyWithSourcePosition.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyWithSourcePosition.java
index 8c2a38c3d8b..a4ce9b845d7 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyWithSourcePosition.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyWithSourcePosition.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -31,9 +31,10 @@ public class DisassemblyWithSourcePosition extends DisassemblyPosition {
* @param addressOffset
* @param addressLength
* @param functionOffset
- * @param opcode
+ * @param opcode
*/
- public DisassemblyWithSourcePosition(int offset, int length, BigInteger addressOffset, BigInteger addressLength, String functionOffset, BigInteger opcode, String file, int lineNr) {
+ public DisassemblyWithSourcePosition(int offset, int length, BigInteger addressOffset, BigInteger addressLength,
+ String functionOffset, BigInteger opcode, String file, int lineNr) {
super(offset, length, addressOffset, addressLength, functionOffset, opcode);
fFile = file;
fLine = lineNr;
@@ -54,7 +55,7 @@ public class DisassemblyWithSourcePosition extends DisassemblyPosition {
*/
@Override
public String toString() {
- return super.toString() + "->["+fFile + ':' + fLine + ']'; //$NON-NLS-1$
+ return super.toString() + "->[" + fFile + ':' + fLine + ']'; //$NON-NLS-1$
}
-
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceDocumentProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceDocumentProvider.java
index d7d0f8441ed..b6a4d7c7c7f 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceDocumentProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceDocumentProvider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -43,7 +43,7 @@ public class SourceDocumentProvider extends StorageDocumentProvider {
*/
public void dispose() {
Iterator<?> it = getConnectedElements();
- while(it.hasNext()) {
+ while (it.hasNext()) {
Object element = it.next();
ElementInfo info = getElementInfo(element);
// force refcount to 1
@@ -88,7 +88,7 @@ public class SourceDocumentProvider extends StorageDocumentProvider {
super.disposeElementInfo(element, info);
IDocument doc = info.fDocument;
if (doc instanceof REDDocument) {
- ((REDDocument)doc).dispose();
+ ((REDDocument) doc).dispose();
}
}
@@ -99,16 +99,16 @@ public class SourceDocumentProvider extends StorageDocumentProvider {
public long getModificationStamp(Object element) {
try {
if (element instanceof IStorageEditorInput) {
- IStorage file= ((IStorageEditorInput)element).getStorage();
+ IStorage file = ((IStorageEditorInput) element).getStorage();
if (file instanceof IFile) {
- return ((IFile)file).getLocalTimeStamp();
+ return ((IFile) file).getLocalTimeStamp();
} else if (file instanceof IFileState) {
- return ((IFileState)file).getModificationTime();
+ return ((IFileState) file).getModificationTime();
} else if (file instanceof LocalFileStorage) {
- return ((LocalFileStorage)file).getFile().lastModified();
+ return ((LocalFileStorage) file).getFile().lastModified();
}
} else if (element instanceof IURIEditorInput) {
- return EFS.getStore(((IURIEditorInput)element).getURI()).fetchInfo().getLastModified();
+ return EFS.getStore(((IURIEditorInput) element).getURI()).fetchInfo().getLastModified();
}
} catch (CoreException e) {
// ignore
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceEditorInput.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceEditorInput.java
index daa13011d24..5f9bd965f26 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceEditorInput.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceEditorInput.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceFileInfo.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceFileInfo.java
index 1821df52c36..67b544ec318 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceFileInfo.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceFileInfo.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -40,7 +40,7 @@ import org.eclipse.ui.IEditorInput;
*/
public class SourceFileInfo {
public final String fFileKey;
- public final IStorage fFile; // fEdition is subject to change; this records value given to us at construction
+ public final IStorage fFile; // fEdition is subject to change; this records value given to us at construction
public IStorage fEdition;
public BigInteger[] fLine2Addr;
public Addr2Line[] fAddr2Line;
@@ -52,7 +52,7 @@ public class SourceFileInfo {
public volatile Job fEditionJob;
public ISourcePresentationCreator fPresentationCreator;
public BigInteger fStartAddress = BigInteger.ONE.shiftLeft(64).subtract(BigInteger.ONE);
- public BigInteger fEndAddress= BigInteger.ZERO;
+ public BigInteger fEndAddress = BigInteger.ZERO;
public SourceFileInfo(String fileKey, IStorage file) {
fFileKey = fileKey;
@@ -84,19 +84,19 @@ public class SourceFileInfo {
IEditorInput input = new SourceEditorInput(fEdition);
IDocument doc = provider.getDocument(input);
if (doc != null) {
- IContentType contentType= null;
+ IContentType contentType = null;
if (fEdition instanceof IFile) {
- IFile file= (IFile)fEdition;
- contentType= CCorePlugin.getContentType(file.getProject(), file.getName());
+ IFile file = (IFile) fEdition;
+ contentType = CCorePlugin.getContentType(file.getProject(), file.getName());
} else {
- contentType= CCorePlugin.getContentType(fEdition.getName());
+ contentType = CCorePlugin.getContentType(fEdition.getName());
}
- ILanguage language= null;
+ ILanguage language = null;
if (contentType != null) {
- language= LanguageManager.getInstance().getLanguage(contentType);
+ language = LanguageManager.getInstance().getLanguage(contentType);
}
if (language != null) {
- fPresentationCreator= SourcePresentationCreatorFactory.create(language, fEdition, viewer);
+ fPresentationCreator = SourcePresentationCreatorFactory.create(language, fEdition, viewer);
}
int lines = doc.getNumberOfLines();
fLine2Addr = new BigInteger[lines];
@@ -126,7 +126,7 @@ public class SourceFileInfo {
}
fSource = null;
fValid = false;
-// fLinesNode = null;
+ // fLinesNode = null;
}
public String getLine(int lineNr) {
@@ -137,8 +137,8 @@ public class SourceFileInfo {
try {
int startOffset = fSource.getLineOffset(first);
int endOffset;
- if (last < fSource.getNumberOfLines()-1) {
- IRegion lastRegion = fSource.getLineInformation(last+1);
+ if (last < fSource.getNumberOfLines() - 1) {
+ IRegion lastRegion = fSource.getLineInformation(last + 1);
endOffset = lastRegion.getOffset();
} else {
// last line
@@ -186,12 +186,12 @@ public class SourceFileInfo {
}
return -1;
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return fEdition.toString();
+ return fEdition.toString();
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceReadingJob.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceReadingJob.java
index 47c9328a1ff..9a4f457d232 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceReadingJob.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/SourceReadingJob.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
-
/**
* Low-level job to read source files in the background.
*/
@@ -37,7 +36,7 @@ public class SourceReadingJob extends Job {
fFileInfo.fReadingJob = this;
fDone = done;
if (fi.fFile instanceof ISchedulingRule) {
- setRule((ISchedulingRule)fi.fFile);
+ setRule((ISchedulingRule) fi.fFile);
}
setSystem(true);
// usually short lived job
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java
index c5e9b9781f8..e8e0544c03b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferenceConstants.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -41,9 +41,9 @@ public class DisassemblyPreferenceConstants {
public static final String AVOID_READ_BEFORE_PC = "disassembly.avoidReadBeforePC"; //$NON-NLS-1$
public static final String TRACK_EXPRESSION = "disassembly.trackExpression"; //$NON-NLS-1$
public static final String SYNC_ACTIVE_CONTEXT = "disassembly.syncActiveContext"; //$NON-NLS-1$
-
+
/**
- *
+ *
*/
private DisassemblyPreferenceConstants() {
// not intended to be subclassed or instantiated
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java
index d0b3c1e202d..6d1e33c689c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/preferences/DisassemblyPreferencePage.java
@@ -49,19 +49,15 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
private ModifyListener fNumberFieldListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
- numberFieldChanged((Text)e.widget);
+ numberFieldChanged((Text) e.widget);
}
};
private Combo fAddressFormatCombo;
private Combo fOpcodeFormatCombo;
- private final static String[] fcRadixItems = {
- DisassemblyMessages.DisassemblyPreferencePage_radix_octal,
- DisassemblyMessages.DisassemblyPreferencePage_radix_decimal,
- DisassemblyMessages.DisassemblyPreferencePage_radix_hexadecimal,
- };
- private final static int[] fcRadixValues = {
- 8, 10, 16
- };
+ private final static String[] fcRadixItems = { DisassemblyMessages.DisassemblyPreferencePage_radix_octal,
+ DisassemblyMessages.DisassemblyPreferencePage_radix_decimal,
+ DisassemblyMessages.DisassemblyPreferencePage_radix_hexadecimal, };
+ private final static int[] fcRadixValues = { 8, 10, 16 };
/**
* Create the Disassembly preference page.
@@ -77,7 +73,8 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDisassemblyHelpContextIds.DISASSEMBLY_PREFERENCE_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
+ IDisassemblyHelpContextIds.DISASSEMBLY_PREFERENCE_PAGE);
}
/* (non-Javadoc)
@@ -143,15 +140,15 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
}
private Combo addComboBox(Composite parent, String label, String key, String[] items) {
- Label labelControl= new Label(parent, SWT.NONE);
+ Label labelControl = new Label(parent, SWT.NONE);
labelControl.setText(label);
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = 0;
gd.horizontalSpan = 2;
labelControl.setLayoutData(gd);
Combo combo = new Combo(parent, SWT.READ_ONLY);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
combo.setLayoutData(gd);
combo.setItems(items);
combo.setData(key);
@@ -160,16 +157,17 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
return combo;
}
- protected Text addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
+ protected Text addTextField(Composite composite, String label, String key, int textLimit, int indentation,
+ boolean isNumber) {
return getTextControl(addLabelledTextField(composite, label, key, textLimit, indentation, isNumber));
}
-// private static Label getLabelControl(Control[] labelledTextField){
-// return (Label)labelledTextField[0];
-// }
+ // private static Label getLabelControl(Control[] labelledTextField){
+ // return (Label)labelledTextField[0];
+ // }
- private static Text getTextControl(Control[] labelledTextField){
- return (Text)labelledTextField[1];
+ private static Text getTextControl(Control[] labelledTextField) {
+ return (Text) labelledTextField[1];
}
/**
@@ -178,16 +176,17 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
* - second element is of type <code>Text</code>
* Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls.
*/
- private Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
- Label labelControl= new Label(composite, SWT.NONE);
+ private Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit,
+ int indentation, boolean isNumber) {
+ Label labelControl = new Label(composite, SWT.NONE);
labelControl.setText(label);
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent= indentation;
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalIndent = indentation;
labelControl.setLayoutData(gd);
- Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
+ Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
textControl.setLayoutData(gd);
textControl.setTextLimit(textLimit);
textControl.setData(key);
@@ -196,7 +195,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
textControl.addModifyListener(fNumberFieldListener);
}
- return new Control[]{labelControl, textControl};
+ return new Control[] { labelControl, textControl };
}
/* (non-Javadoc)
@@ -207,18 +206,19 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
IPreferenceStore store = getPreferenceStore();
for (Iterator<Button> iter = fCheckBoxes.iterator(); iter.hasNext();) {
Button btn = iter.next();
- store.setValue((String)btn.getData(), btn.getSelection());
+ store.setValue((String) btn.getData(), btn.getSelection());
}
for (Iterator<Text> iter = fNumberFields.iterator(); iter.hasNext();) {
Text field = iter.next();
- store.setValue((String)field.getData(), Long.decode(field.getText()).longValue());
+ store.setValue((String) field.getData(), Long.decode(field.getText()).longValue());
}
for (Iterator<Combo> iter = fComboBoxes.iterator(); iter.hasNext();) {
Combo combo = iter.next();
- store.setValue((String)combo.getData(), fcRadixValues[combo.getSelectionIndex()]);
+ store.setValue((String) combo.getData(), fcRadixValues[combo.getSelectionIndex()]);
}
return super.performOk();
}
+
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
@@ -227,16 +227,16 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
IPreferenceStore store = getPreferenceStore();
for (Iterator<Button> iter = fCheckBoxes.iterator(); iter.hasNext();) {
Button btn = iter.next();
- btn.setSelection(store.getDefaultBoolean((String)btn.getData()));
+ btn.setSelection(store.getDefaultBoolean((String) btn.getData()));
}
for (Iterator<Text> iter = fNumberFields.iterator(); iter.hasNext();) {
Text field = iter.next();
- long value = store.getDefaultLong((String)field.getData());
- field.setText("0x"+Long.toHexString(value)); //$NON-NLS-1$
+ long value = store.getDefaultLong((String) field.getData());
+ field.setText("0x" + Long.toHexString(value)); //$NON-NLS-1$
}
for (Iterator<Combo> iter = fComboBoxes.iterator(); iter.hasNext();) {
Combo combo = iter.next();
- int value = store.getDefaultInt((String)combo.getData());
+ int value = store.getDefaultInt((String) combo.getData());
for (int i = 0; i < fcRadixValues.length; i++) {
if (fcRadixValues[i] == value) {
combo.select(i);
@@ -245,6 +245,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
}
super.performDefaults();
}
+
/**
* Initialize widget values from preference store.
*/
@@ -252,16 +253,16 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
IPreferenceStore store = getPreferenceStore();
for (Iterator<Button> iter = fCheckBoxes.iterator(); iter.hasNext();) {
Button btn = iter.next();
- btn.setSelection(store.getBoolean((String)btn.getData()));
+ btn.setSelection(store.getBoolean((String) btn.getData()));
}
for (Iterator<Text> iter = fNumberFields.iterator(); iter.hasNext();) {
Text field = iter.next();
- long value = store.getLong((String)field.getData());
- field.setText("0x"+Long.toHexString(value)); //$NON-NLS-1$
+ long value = store.getLong((String) field.getData());
+ field.setText("0x" + Long.toHexString(value)); //$NON-NLS-1$
}
for (Iterator<Combo> iter = fComboBoxes.iterator(); iter.hasNext();) {
Combo combo = iter.next();
- int value = store.getInt((String)combo.getData());
+ int value = store.getInt((String) combo.getData());
for (int i = 0; i < fcRadixValues.length; i++) {
if (fcRadixValues[i] == value) {
combo.select(i);
@@ -282,7 +283,7 @@ public class DisassemblyPreferencePage extends PreferencePage implements IWorkbe
} else {
setErrorMessage(null);
}
- } catch(NumberFormatException nfe) {
+ } catch (NumberFormatException nfe) {
setErrorMessage(DisassemblyMessages.DisassemblyPreferencePage_error_not_a_number);
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourcePresentationCreator.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourcePresentationCreator.java
index 2222046cd48..5941fab3de1 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourcePresentationCreator.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourcePresentationCreator.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -54,7 +54,8 @@ import org.eclipse.ui.IEditorInput;
/**
* A presentation creator based on CDT syntax highlighting.
*/
-public class CSourcePresentationCreator extends PresentationReconciler implements ISourcePresentationCreator, IPropertyChangeListener {
+public class CSourcePresentationCreator extends PresentationReconciler
+ implements ISourcePresentationCreator, IPropertyChangeListener {
/**
*
@@ -71,13 +72,13 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
* @param preferenceStore
* @param language
*/
- private CustomCSourceViewerConfiguration(
- IColorManager colorManager, IPreferenceStore preferenceStore,
+ private CustomCSourceViewerConfiguration(IColorManager colorManager, IPreferenceStore preferenceStore,
ILanguage language) {
super(colorManager, preferenceStore, null, ICPartitions.C_PARTITIONING);
fLanguage = language;
if (language instanceof IAsmLanguage) {
- fAsmConfig= new AsmSourceViewerConfiguration(colorManager, preferenceStore, null, ICPartitions.C_PARTITIONING);
+ fAsmConfig = new AsmSourceViewerConfiguration(colorManager, preferenceStore, null,
+ ICPartitions.C_PARTITIONING);
}
}
@@ -127,7 +128,7 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
}
return super.getCodeScanner(language);
}
-
+
/*
* @see org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration#getPreprocessorScanner(org.eclipse.cdt.core.model.ILanguage)
*/
@@ -218,7 +219,7 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
return null;
}
-
+
/*
* @see CSourceViewerConfiguration#getOutlinePresenter(ISourceViewer)
*/
@@ -226,7 +227,7 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
public IInformationPresenter getOutlinePresenter(ISourceViewer sourceViewer) {
return null;
}
-}
+ }
private ITextViewer fViewer;
private ISourceTagProvider fSourceTagProvider;
@@ -243,10 +244,10 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
*/
public CSourcePresentationCreator(ILanguage language, IStorage storage, ITextViewer textViewer) {
if (language != null) {
- fViewer= textViewer;
- fPreferenceStore= CUIPlugin.getDefault().getCombinedPreferenceStore();
- final IColorManager colorManager= CDTUITools.getColorManager();
- fSourceViewerConfiguration= new CustomCSourceViewerConfiguration(colorManager, fPreferenceStore, language);
+ fViewer = textViewer;
+ fPreferenceStore = CUIPlugin.getDefault().getCombinedPreferenceStore();
+ final IColorManager colorManager = CDTUITools.getColorManager();
+ fSourceViewerConfiguration = new CustomCSourceViewerConfiguration(colorManager, fPreferenceStore, language);
setDocumentPartitioning(fSourceViewerConfiguration.getConfiguredDocumentPartitioning(null));
initializeDamagerRepairer(storage, colorManager, fPreferenceStore);
fPreferenceStore.addPropertyChangeListener(this);
@@ -254,7 +255,7 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
}
private void initializeDamagerRepairer(IStorage storage, IColorManager colorManager, IPreferenceStore store) {
- String[] contentTypes= fSourceViewerConfiguration.getConfiguredContentTypes(null);
+ String[] contentTypes = fSourceViewerConfiguration.getConfiguredContentTypes(null);
for (int i = 0; i < contentTypes.length; ++i) {
String contentType = contentTypes[i];
ITokenScanner scanner;
@@ -262,14 +263,15 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
if (scanner != null) {
if (fDamagerRepairer == null) {
fSourceTagProvider = createSourceTagProvider(storage);
- fDamagerRepairer= new SourceTagDamagerRepairer(scanner, fSourceTagProvider, colorManager, store);
+ fDamagerRepairer = new SourceTagDamagerRepairer(scanner, fSourceTagProvider, colorManager, store);
if (fSourceTagProvider != null) {
if (fSourceTagListener == null) {
- fSourceTagListener= new ISourceTagListener() {
+ fSourceTagListener = new ISourceTagListener() {
@Override
public void sourceTagsChanged(ISourceTagProvider provider) {
handleSourceTagsChanged();
- }};
+ }
+ };
}
fSourceTagProvider.addSourceTagListener(fSourceTagListener);
}
@@ -286,22 +288,22 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
*/
@Override
public void dispose() {
- fViewer= null;
- fPresentation= null;
+ fViewer = null;
+ fPresentation = null;
if (fPreferenceStore != null) {
fPreferenceStore.removePropertyChangeListener(this);
- fPreferenceStore= null;
+ fPreferenceStore = null;
}
if (fSourceViewerConfiguration != null) {
fSourceViewerConfiguration.dispose();
- fSourceViewerConfiguration= null;
+ fSourceViewerConfiguration = null;
}
if (fSourceTagProvider != null) {
if (fSourceTagListener != null) {
fSourceTagProvider.removeSourceTagListener(fSourceTagListener);
- fSourceTagListener= null;
+ fSourceTagListener = null;
}
- fSourceTagProvider= null;
+ fSourceTagProvider = null;
}
}
@@ -317,10 +319,10 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
if (fPresentation == null) {
setDocumentToDamagers(document);
setDocumentToRepairers(document);
- int docLength= document.getLength();
- if (docLength <= 128*1024) {
- IRegion all= new Region(0, docLength);
- fPresentation= createPresentation(all, document);
+ int docLength = document.getLength();
+ if (docLength <= 128 * 1024) {
+ IRegion all = new Region(0, docLength);
+ fPresentation = createPresentation(all, document);
} else {
return createPresentation(region, document);
}
@@ -335,9 +337,9 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
private void invalidateTextPresentation() {
if (fPresentation != null) {
- fPresentation= null;
+ fPresentation = null;
if (fViewer != null) {
- Display display= fViewer.getTextWidget().getDisplay();
+ Display display = fViewer.getTextWidget().getDisplay();
if (display.getThread() != Thread.currentThread()) {
display.asyncExec(new Runnable() {
@Override
@@ -345,7 +347,8 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
if (fViewer != null) {
fViewer.invalidateTextPresentation();
}
- }});
+ }
+ });
} else {
fViewer.invalidateTextPresentation();
}
@@ -354,23 +357,23 @@ public class CSourcePresentationCreator extends PresentationReconciler implement
}
private ISourceTagProvider createSourceTagProvider(IStorage storage) {
- ITranslationUnit tUnit= null;
+ ITranslationUnit tUnit = null;
if (storage instanceof IFile) {
- tUnit= (ITranslationUnit) CoreModel.getDefault().create((IFile)storage);
+ tUnit = (ITranslationUnit) CoreModel.getDefault().create((IFile) storage);
} else if (storage instanceof IFileState) {
- ICModel cModel= CoreModel.getDefault().getCModel();
+ ICModel cModel = CoreModel.getDefault().getCModel();
ICProject[] cProjects;
try {
cProjects = cModel.getCProjects();
if (cProjects.length > 0) {
- tUnit= CoreModel.getDefault().createTranslationUnitFrom(cProjects[0], storage.getFullPath());
+ tUnit = CoreModel.getDefault().createTranslationUnitFrom(cProjects[0], storage.getFullPath());
}
} catch (CModelException e) {
}
} else {
- IEditorInput input= CDTUITools.getEditorInputForLocation(storage.getFullPath(), null);
+ IEditorInput input = CDTUITools.getEditorInputForLocation(storage.getFullPath(), null);
if (input != null) {
- tUnit= input.getAdapter(ITranslationUnit.class);
+ tUnit = input.getAdapter(ITranslationUnit.class);
}
}
if (tUnit != null) {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTag.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTag.java
index 766aed4a68a..2bb37db9cd7 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTag.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTag.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -63,7 +63,7 @@ public class CSourceTag implements ISourceTag {
* @param sourceRange
*/
public CSourceRange(org.eclipse.cdt.core.model.ISourceRange sourceRange) {
- fRange= sourceRange;
+ fRange = sourceRange;
}
@Override
@@ -83,9 +83,9 @@ public class CSourceTag implements ISourceTag {
@Override
public int compareTo(ISourceRange other) {
- int delta= this.getBeginOffset() - other.getBeginOffset();
+ int delta = this.getBeginOffset() - other.getBeginOffset();
if (delta == 0) {
- delta= this.getEndOffset() - other.getEndOffset();
+ delta = this.getEndOffset() - other.getEndOffset();
}
return delta;
}
@@ -100,7 +100,7 @@ public class CSourceTag implements ISourceTag {
private org.eclipse.cdt.core.model.ISourceRange fRange;
public CIdentifierRange(org.eclipse.cdt.core.model.ISourceRange sourceRange) {
- fRange= sourceRange;
+ fRange = sourceRange;
}
@Override
@@ -120,27 +120,27 @@ public class CSourceTag implements ISourceTag {
@Override
public int compareTo(ISourceRange other) {
- int delta= this.getBeginOffset() - other.getBeginOffset();
+ int delta = this.getBeginOffset() - other.getBeginOffset();
if (delta == 0) {
- delta= this.getEndOffset() - other.getEndOffset();
+ delta = this.getEndOffset() - other.getEndOffset();
}
return delta;
}
}
-
+
private ISourceReference fReference;
private int fType;
/**
* Create a new source tag for the given element and type.
- *
+ *
* @param element
* @param elementType
*/
public CSourceTag(ISourceReference element, int elementType) {
- fReference= element;
- fType= elementType;
+ fReference = element;
+ fType = elementType;
}
@Override
@@ -154,7 +154,7 @@ public class CSourceTag implements ISourceTag {
@Override
public String getName() {
- return ((ICElement)fReference).getElementName();
+ return ((ICElement) fReference).getElementName();
}
@Override
@@ -179,7 +179,7 @@ public class CSourceTag implements ISourceTag {
@Override
public int getStyleCode() {
switch (fType) {
- case ICElement.C_METHOD :
+ case ICElement.C_METHOD:
case ICElement.C_METHOD_DECLARATION:
case ICElement.C_TEMPLATE_METHOD:
case ICElement.C_TEMPLATE_METHOD_DECLARATION:
@@ -189,7 +189,7 @@ public class CSourceTag implements ISourceTag {
case ICElement.C_TEMPLATE_FUNCTION:
case ICElement.C_TEMPLATE_FUNCTION_DECLARATION:
return ISourceTag.STYLE_Function;
- case ICElement.C_FIELD :
+ case ICElement.C_FIELD:
return ISourceTag.STYLE_MemberVariable;
case ICElement.C_VARIABLE:
case ICElement.C_VARIABLE_DECLARATION:
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java
index 3173393ef5a..ead860df36a 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -27,16 +27,16 @@ import org.eclipse.core.runtime.ListenerList;
*/
public class CSourceTagProvider implements ISourceTagProvider {
- private ListenerList<ISourceTagListener> fListenerList= new ListenerList<>(ListenerList.IDENTITY);
+ private ListenerList<ISourceTagListener> fListenerList = new ListenerList<>(ListenerList.IDENTITY);
private ITranslationUnit fUnit;
-
+
/**
* Create a new source tag provider for the given translation unit.
- *
+ *
* @param unit
*/
public CSourceTagProvider(ITranslationUnit unit) {
- fUnit= unit;
+ fUnit = unit;
}
@Override
@@ -69,7 +69,7 @@ public class CSourceTagProvider implements ISourceTagProvider {
*/
private ISourceTag convertToSourceTag(ICElement element) {
if (element instanceof ISourceReference) {
- return new CSourceTag((ISourceReference)element, element.getElementType());
+ return new CSourceTag((ISourceReference) element, element.getElementType());
}
return null;
}
@@ -81,13 +81,13 @@ public class CSourceTagProvider implements ISourceTagProvider {
*/
private void convertToSourceTags(ICElement[] children, Collection<ISourceTag> target) throws CModelException {
for (int i = 0; i < children.length; i++) {
- ICElement element= children[i];
- ISourceTag tag= convertToSourceTag(element);
+ ICElement element = children[i];
+ ISourceTag tag = convertToSourceTag(element);
if (tag != null) {
target.add(tag);
}
if (element instanceof IParent) {
- convertToSourceTags(((IParent)element).getChildren(), target);
+ convertToSourceTags(((IParent) element).getChildren(), target);
}
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/DisassemblyIPAnnotation.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/DisassemblyIPAnnotation.java
index 709f84f6a22..cf67a111784 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/DisassemblyIPAnnotation.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/DisassemblyIPAnnotation.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -28,29 +28,26 @@ import org.eclipse.swt.widgets.Canvas;
*/
public class DisassemblyIPAnnotation extends Annotation implements IAnnotationPresentation {
- public static final String ID_TOP = IDebugUIConstants.ANNOTATION_TYPE_INSTRUCTION_POINTER_CURRENT;
- public static final String ID_SECONDARY = IDebugUIConstants.ANNOTATION_TYPE_INSTRUCTION_POINTER_SECONDARY;
+ public static final String ID_TOP = IDebugUIConstants.ANNOTATION_TYPE_INSTRUCTION_POINTER_CURRENT;
+ public static final String ID_SECONDARY = IDebugUIConstants.ANNOTATION_TYPE_INSTRUCTION_POINTER_SECONDARY;
private Image fImage;
private int fContext = Integer.MIN_VALUE;
- /**
+ /**
* Annotation denoting the current instruction pointer.
*/
public DisassemblyIPAnnotation(boolean isTopFrame, int context) {
- super(
- isTopFrame ? ID_TOP : ID_SECONDARY,
- false,
- isTopFrame ? DisassemblyMessages.DisassemblyIPAnnotation_primary
- : DisassemblyMessages.DisassemblyIPAnnotation_secondary
- );
+ super(isTopFrame ? ID_TOP : ID_SECONDARY, false,
+ isTopFrame ? DisassemblyMessages.DisassemblyIPAnnotation_primary
+ : DisassemblyMessages.DisassemblyIPAnnotation_secondary);
setContext(context);
}
public boolean isTopFrame() {
return ID_TOP.equals(getType());
}
-
+
public void setContext(int context) {
if (context == fContext) {
return;
@@ -78,7 +75,8 @@ public class DisassemblyIPAnnotation extends Annotation implements IAnnotationPr
@Override
public void paint(GC gc, Canvas canvas, Rectangle bounds) {
Rectangle imageBounds = fImage.getBounds();
- gc.drawImage(fImage, bounds.x + (bounds.width - imageBounds.width) / 2 , bounds.y + (bounds.height - imageBounds.height) / 2);
+ gc.drawImage(fImage, bounds.x + (bounds.width - imageBounds.width) / 2,
+ bounds.y + (bounds.height - imageBounds.height) / 2);
}
-
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourcePresentationCreator.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourcePresentationCreator.java
index d30fe5db04d..4744f3ccad8 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourcePresentationCreator.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourcePresentationCreator.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceRange.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceRange.java
index 0ebdca3a786..f44bca82539 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceRange.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceRange.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -16,16 +16,18 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation;
/**
* Represents a range within a source file.
*/
-
+
public interface ISourceRange extends Comparable<ISourceRange> {
/**
* Returns 0-based absolute number for the inclusive start of the range.
*/
int getBeginOffset();
+
/**
* Returns 0-based absolute number for the inclusive end of the range.
*/
int getEndOffset();
+
/**
* Checks whether the range contains the given offset.
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTag.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTag.java
index 3efa35a121f..1e48f515453 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTag.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTag.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -18,38 +18,38 @@ package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation;
*/
public interface ISourceTag {
// style codes
- final static int STYLE_None = 0;
- final static int STYLE_Class = 1;
- final static int STYLE_Struct = 2;
- final static int STYLE_Union = 3;
- final static int STYLE_Interface = 4;
- final static int STYLE_Package = 5;
- final static int STYLE_Function = 6;
+ final static int STYLE_None = 0;
+ final static int STYLE_Class = 1;
+ final static int STYLE_Struct = 2;
+ final static int STYLE_Union = 3;
+ final static int STYLE_Interface = 4;
+ final static int STYLE_Package = 5;
+ final static int STYLE_Function = 6;
final static int STYLE_ProtectedFunction = 7;
- final static int STYLE_Method = 8;
- final static int STYLE_Exception = 9;
- final static int STYLE_Variable = 10;
- final static int STYLE_MemberVariable = 11;
- final static int STYLE_Enumerator = 12;
- final static int STYLE_Macro = 13;
- final static int STYLE_Include = 14;
- final static int STYLE_Undefined = 15;
- final static int STYLE_Enumeration = 16;
- final static int STYLE_Typedef = 17;
- final static int STYLE_Type3 = 18;
- final static int STYLE_Type4 = 19;
- final static int STYLE_Type5 = 20;
- final static int STYLE_File = 21;
- final static int STYLE_Project = 22;
+ final static int STYLE_Method = 8;
+ final static int STYLE_Exception = 9;
+ final static int STYLE_Variable = 10;
+ final static int STYLE_MemberVariable = 11;
+ final static int STYLE_Enumerator = 12;
+ final static int STYLE_Macro = 13;
+ final static int STYLE_Include = 14;
+ final static int STYLE_Undefined = 15;
+ final static int STYLE_Enumeration = 16;
+ final static int STYLE_Typedef = 17;
+ final static int STYLE_Type3 = 18;
+ final static int STYLE_Type4 = 19;
+ final static int STYLE_Type5 = 20;
+ final static int STYLE_File = 21;
+ final static int STYLE_Project = 22;
final static int STYLE_IncludeContainer = 23;
- final static int STYLE_LocalVariable = 24;
- final static int STYLE_Label = 25;
- final static int STYLE_Record = 26;
- final static int STYLE_TaggedType = 27;
- final static int STYLE_Subtype = 28;
- final static int STYLE_Warning = 29;
- final static int STYLE_Count = 30;
-
+ final static int STYLE_LocalVariable = 24;
+ final static int STYLE_Label = 25;
+ final static int STYLE_Record = 26;
+ final static int STYLE_TaggedType = 27;
+ final static int STYLE_Subtype = 28;
+ final static int STYLE_Warning = 29;
+ final static int STYLE_Count = 30;
+
/**
* Returns the unqualified name of the source tag. Files return their base name.
*/
@@ -69,7 +69,7 @@ public interface ISourceTag {
* Returns the range of the identifier of the symbol within the file.
*/
ISourceRange getRangeOfIdentifier();
-
+
/**
* Computes the style code. Style codes are language dependent. You
* cannot derive any information from the style-code of a symbol. It
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagListener.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagListener.java
index e53f6dadff7..551d785ef03 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagListener.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagListener.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagProvider.java
index d318ec7b6f2..fe002a02caf 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/ISourceTagProvider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -48,5 +48,5 @@ public interface ISourceTagProvider {
* information cannot be obtained.
*/
public int[] getActiveCodePositions();
-
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourcePresentationCreatorFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourcePresentationCreatorFactory.java
index d68c9a0aba9..5971ce09557 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourcePresentationCreatorFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourcePresentationCreatorFactory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourceTagDamagerRepairer.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourceTagDamagerRepairer.java
index 5d730d746b6..03b7116b9d6 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourceTagDamagerRepairer.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/SourceTagDamagerRepairer.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -45,33 +45,27 @@ import org.eclipse.swt.graphics.RGB;
public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements ISourceTagListener {
private ISourceTagProvider fSourceTagProvider;
- private Map<String, ITokenScanner> fScannerMap= new HashMap<String, ITokenScanner>();
+ private Map<String, ITokenScanner> fScannerMap = new HashMap<String, ITokenScanner>();
private List<ISourceTag> fSourceTags = new ArrayList<ISourceTag>();
private IColorManager fColorManager;
private IPreferenceStore fPreferenceStore;
- private Map<String, TextAttribute> fAttributeMap= new HashMap<String, TextAttribute>();
-
- private final static String[] KEYS= {
- SemanticHighlightings.CLASS,
- SemanticHighlightings.METHOD_DECLARATION,
- SemanticHighlightings.FUNCTION_DECLARATION,
- SemanticHighlightings.FIELD,
- SemanticHighlightings.GLOBAL_VARIABLE,
- SemanticHighlightings.TYPEDEF,
- SemanticHighlightings.MACRO_DEFINITION,
- SemanticHighlightings.ENUMERATOR,
- SemanticHighlightings.ENUM,
- };
+ private Map<String, TextAttribute> fAttributeMap = new HashMap<String, TextAttribute>();
+
+ private final static String[] KEYS = { SemanticHighlightings.CLASS, SemanticHighlightings.METHOD_DECLARATION,
+ SemanticHighlightings.FUNCTION_DECLARATION, SemanticHighlightings.FIELD,
+ SemanticHighlightings.GLOBAL_VARIABLE, SemanticHighlightings.TYPEDEF,
+ SemanticHighlightings.MACRO_DEFINITION, SemanticHighlightings.ENUMERATOR, SemanticHighlightings.ENUM, };
/**
* @param scanner
* @param sourceTagProvider
*/
- public SourceTagDamagerRepairer(ITokenScanner scanner, ISourceTagProvider sourceTagProvider, IColorManager colorManager, IPreferenceStore store) {
+ public SourceTagDamagerRepairer(ITokenScanner scanner, ISourceTagProvider sourceTagProvider,
+ IColorManager colorManager, IPreferenceStore store) {
super(scanner);
- fSourceTagProvider= sourceTagProvider;
- fColorManager= colorManager;
- fPreferenceStore= store;
+ fSourceTagProvider = sourceTagProvider;
+ fColorManager = colorManager;
+ fPreferenceStore = store;
fDefaultTextAttribute = new TextAttribute(null, null, SWT.NORMAL);
if (fSourceTagProvider != null) {
fSourceTagProvider.addSourceTagListener(this);
@@ -80,16 +74,22 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
}
private void initTextAttributes() {
- boolean shEnabled= fPreferenceStore.getBoolean(PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED);
- for (int i= 0; i < KEYS.length; i++) {
- String enabledKey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i] + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX;
- String colorKey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i] + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_COLOR_SUFFIX;
- boolean enabled= shEnabled && fPreferenceStore.getBoolean(enabledKey);
+ boolean shEnabled = fPreferenceStore.getBoolean(PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED);
+ for (int i = 0; i < KEYS.length; i++) {
+ String enabledKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i]
+ + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX;
+ String colorKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i]
+ + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_COLOR_SUFFIX;
+ boolean enabled = shEnabled && fPreferenceStore.getBoolean(enabledKey);
if (enabled) {
- String boldKey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i] + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX;
- String italicKey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i] + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX;
- String strikethroughKey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i] + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_STRIKETHROUGH_SUFFIX;
- String underlineKey= PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i] + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_UNDERLINE_SUFFIX;
+ String boldKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i]
+ + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX;
+ String italicKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i]
+ + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX;
+ String strikethroughKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i]
+ + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_STRIKETHROUGH_SUFFIX;
+ String underlineKey = PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX + KEYS[i]
+ + PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_UNDERLINE_SUFFIX;
addTextAttribute(KEYS[i], colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
} else {
removeTextAttribute(KEYS[i], colorKey);
@@ -99,7 +99,7 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
private void removeTextAttribute(String key, String colorKey) {
if (fColorManager != null && colorKey != null) {
- Color color= fColorManager.getColor(colorKey);
+ Color color = fColorManager.getColor(colorKey);
if (color != null) {
fColorManager.unbindColor(colorKey);
}
@@ -108,26 +108,28 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
fAttributeMap.remove(key);
}
- private void addTextAttribute(String key, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) {
+ private void addTextAttribute(String key, String colorKey, String boldKey, String italicKey,
+ String strikethroughKey, String underlineKey) {
if (fColorManager != null && colorKey != null) {
- RGB rgb= PreferenceConverter.getColor(fPreferenceStore, colorKey);
- Color color= fColorManager.getColor(colorKey);
+ RGB rgb = PreferenceConverter.getColor(fPreferenceStore, colorKey);
+ Color color = fColorManager.getColor(colorKey);
if (color == null || !rgb.equals(color.getRGB())) {
fColorManager.unbindColor(colorKey);
fColorManager.bindColor(colorKey, rgb);
}
}
- TextAttribute textAttribute= createTextAttribute(colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
+ TextAttribute textAttribute = createTextAttribute(colorKey, boldKey, italicKey, strikethroughKey, underlineKey);
fAttributeMap.put(key, textAttribute);
}
- private TextAttribute createTextAttribute(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) {
- Color color= null;
+ private TextAttribute createTextAttribute(String colorKey, String boldKey, String italicKey,
+ String strikethroughKey, String underlineKey) {
+ Color color = null;
if (colorKey != null)
- color= fColorManager.getColor(colorKey);
+ color = fColorManager.getColor(colorKey);
- int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
+ int style = fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
if (fPreferenceStore.getBoolean(italicKey))
style |= SWT.ITALIC;
@@ -157,7 +159,7 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
if (fAttributeMap.isEmpty()) {
initTextAttributes();
}
- String contentType= region.getType();
+ String contentType = region.getType();
fScanner = fScannerMap.get(contentType);
if (!contentType.equals(IDocument.DEFAULT_CONTENT_TYPE) && !contentType.equals(ICPartitions.C_PREPROCESSOR)) {
super.createPresentation(presentation, region);
@@ -181,7 +183,7 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
if (sourceTagCount > 0 && fDocument.getLength() > 0) {
int left = 0;
- int mid = (int) (sourceTagCount * ((float)lastStart / fDocument.getLength()));
+ int mid = (int) (sourceTagCount * ((float) lastStart / fDocument.getLength()));
int right = sourceTagCount - 1;
while (true) {
sourceTag = fSourceTags.get(mid);
@@ -218,7 +220,7 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
TextAttribute attribute = getTokenTextAttribute(token);
int tokenLength = fScanner.getTokenLength();
if (tokenLength > 0
- && (lastAttribute == attribute || lastAttribute != null && lastAttribute.equals(attribute))) {
+ && (lastAttribute == attribute || lastAttribute != null && lastAttribute.equals(attribute))) {
length += tokenLength;
continue;
}
@@ -234,14 +236,12 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
String sourceTagStyle = getSourceTagStyle(sourceTag.getStyleCode());
if (sourceTagStyle != null) {
if (sourceTagStart > lastStart) {
- addRange(presentation, lastStart, Math.min(sourceTagStart - lastStart, length), lastAttribute);
+ addRange(presentation, lastStart, Math.min(sourceTagStart - lastStart, length),
+ lastAttribute);
}
int rangeEnd = Math.min(sourceTagEnd, regionEnd);
- addRange(
- presentation,
- sourceTagStart,
- rangeEnd - sourceTagStart,
- getSourceTagTextAttribute(sourceTagStyle));
+ addRange(presentation, sourceTagStart, rangeEnd - sourceTagStart,
+ getSourceTagTextAttribute(sourceTagStyle));
length = lastStart + length - rangeEnd;
lastStart = rangeEnd;
} else {
@@ -293,37 +293,37 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
*/
private String getSourceTagStyle(int styleCode) {
switch (styleCode) {
- case ISourceTag.STYLE_None :
- return null;
- case ISourceTag.STYLE_Class :
- return SemanticHighlightings.CLASS;
- case ISourceTag.STYLE_Struct :
- return SemanticHighlightings.CLASS;
- case ISourceTag.STYLE_Union :
- return SemanticHighlightings.CLASS;
- case ISourceTag.STYLE_Function :
- return SemanticHighlightings.FUNCTION_DECLARATION;
- case ISourceTag.STYLE_Method :
- return SemanticHighlightings.METHOD_DECLARATION;
- case ISourceTag.STYLE_Variable :
- return SemanticHighlightings.GLOBAL_VARIABLE;
- case ISourceTag.STYLE_MemberVariable :
- return SemanticHighlightings.FIELD;
- case ISourceTag.STYLE_Enumerator :
- return SemanticHighlightings.ENUMERATOR;
- case ISourceTag.STYLE_Macro :
- return SemanticHighlightings.MACRO_DEFINITION;
- case ISourceTag.STYLE_Include :
- // include is colored by the scanner
- return null;
- case ISourceTag.STYLE_Enumeration :
- return SemanticHighlightings.ENUM;
- case ISourceTag.STYLE_Undefined :
- return null;
- case ISourceTag.STYLE_Typedef :
- return SemanticHighlightings.TYPEDEF;
- default :
- return null;
+ case ISourceTag.STYLE_None:
+ return null;
+ case ISourceTag.STYLE_Class:
+ return SemanticHighlightings.CLASS;
+ case ISourceTag.STYLE_Struct:
+ return SemanticHighlightings.CLASS;
+ case ISourceTag.STYLE_Union:
+ return SemanticHighlightings.CLASS;
+ case ISourceTag.STYLE_Function:
+ return SemanticHighlightings.FUNCTION_DECLARATION;
+ case ISourceTag.STYLE_Method:
+ return SemanticHighlightings.METHOD_DECLARATION;
+ case ISourceTag.STYLE_Variable:
+ return SemanticHighlightings.GLOBAL_VARIABLE;
+ case ISourceTag.STYLE_MemberVariable:
+ return SemanticHighlightings.FIELD;
+ case ISourceTag.STYLE_Enumerator:
+ return SemanticHighlightings.ENUMERATOR;
+ case ISourceTag.STYLE_Macro:
+ return SemanticHighlightings.MACRO_DEFINITION;
+ case ISourceTag.STYLE_Include:
+ // include is colored by the scanner
+ return null;
+ case ISourceTag.STYLE_Enumeration:
+ return SemanticHighlightings.ENUM;
+ case ISourceTag.STYLE_Undefined:
+ return null;
+ case ISourceTag.STYLE_Typedef:
+ return SemanticHighlightings.TYPEDEF;
+ default:
+ return null;
}
}
@@ -335,8 +335,8 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
Collections.sort(fSourceTags, new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
- ISourceRange sr1 = ((ISourceTag)o1).getRangeOfIdentifier();
- ISourceRange sr2 = ((ISourceTag)o2).getRangeOfIdentifier();
+ ISourceRange sr1 = ((ISourceTag) o1).getRangeOfIdentifier();
+ ISourceRange sr2 = ((ISourceTag) o2).getRangeOfIdentifier();
return (sr1.getBeginOffset() - sr2.getBeginOffset());
}
});
@@ -350,13 +350,13 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
protected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr) {
if (length > 0 && attr != null) {
presentation.addStyleRange(
- new StyleRange(offset, length, attr.getForeground(), attr.getBackground(), attr.getStyle()));
+ new StyleRange(offset, length, attr.getForeground(), attr.getBackground(), attr.getStyle()));
}
}
/**
* Test whether the given preference change affects us.
- *
+ *
* @param event
* @return <code>true</code> if the given event affects the behavior.
*/
@@ -366,7 +366,7 @@ public class SourceTagDamagerRepairer extends DefaultDamagerRepairer implements
/**
* Adapt to changes in the preferences.
- *
+ *
* @param event
*/
public void handlePropertyChangeEvent(PropertyChangeEvent event) {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java
index bd26ba1d5b1..ba2e5e7c47b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java
@@ -49,7 +49,7 @@ public class DisassemblyAnnotationModel extends AnnotationModel {
protected Position createPositionFromAddress(BigInteger address) {
if (address != null) {
- AddressRangePosition p= getDisassemblyDocument().getDisassemblyPosition(address);
+ AddressRangePosition p = getDisassemblyDocument().getDisassemblyPosition(address);
if (p != null && p.fValid) {
return new Position(p.offset, p.length);
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
index f4a4fd3b4e7..bcd5cf16451 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyRulerColumn.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Anton Leherbauer (Wind River Systems)
@@ -69,7 +69,7 @@ import org.eclipse.ui.editors.text.EditorsUI;
* </p>
*/
public class DisassemblyRulerColumn extends AbstractContributedRulerColumn implements IPropertyChangeListener {
- protected final static String DOTS = "......................................................................"; //$NON-NLS-1$
+ protected final static String DOTS = "......................................................................"; //$NON-NLS-1$
protected final static String SPACES = " "; //$NON-NLS-1$
/**
@@ -231,7 +231,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Expands the line selection from the remembered start line to the
* given line.
- *
+ *
* @param lineNumber
* the line to which to expand the selection
*/
@@ -242,8 +242,8 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
IRegion lineInfo = document.getLineInformation(lineNumber);
int start = Math.min(fStartLine.getOffset(), lineInfo.getOffset());
- int end = Math.max(fStartLine.getOffset() + fStartLine.getLength(), lineInfo.getOffset()
- + lineInfo.getLength());
+ int end = Math.max(fStartLine.getOffset() + fStartLine.getLength(),
+ lineInfo.getOffset() + lineInfo.getLength());
if (lineNumber < fStartLineNumber)
fCachedTextViewer.setSelectedRange(end, start - end);
@@ -263,7 +263,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Called on drag selection.
- *
+ *
* @param event
* the mouse event caught by the mouse move listener
* @return <code>true</code> if scrolling happened, <code>false</code>
@@ -288,7 +288,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Scrolls the viewer into the given direction.
- *
+ *
* @param direction
* the scroll direction
*/
@@ -340,7 +340,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Returns the viewer's first visible line, even if only partially
* visible.
- *
+ *
* @return the viewer's first visible line
*/
private int getInclusiveTopIndex() {
@@ -408,7 +408,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Constructs a new vertical ruler column.
- *
+ *
*/
public DisassemblyRulerColumn() {
this(SWT.LEFT);
@@ -439,7 +439,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Sets the foreground color of this column.
- *
+ *
* @param foreground
* the foreground color
*/
@@ -449,7 +449,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Returns the foreground color being used to print the line numbers.
- *
+ *
* @return the configured foreground color
*/
protected Color getForeground() {
@@ -458,7 +458,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Sets the background color of this column.
- *
+ *
* @param background
* the background color
*/
@@ -470,7 +470,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Returns the System background color for list widgets.
- *
+ *
* @param display
* the display
* @return the System background color for list widgets
@@ -506,7 +506,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
* if the number of digits changed compared to the previous call of this
* method. If the method is called for the first time, the return value is
* also <code>true</code>.
- *
+ *
* @return whether the number of digits has been changed
*/
protected boolean updateNumberOfDigits() {
@@ -527,14 +527,14 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
* Does the real computation of the number of characters. The default
* implementation computes the number of digits for the line number.
* Subclasses may override this method if they need extra space on the ruler.
- *
+ *
* @return the number of characters to be displayed on the ruler.
*/
protected int computeNumberOfCharacters() {
IDocument document = fCachedTextViewer.getDocument();
- int lines= document == null ? 0 : document.getNumberOfLines();
+ int lines = document == null ? 0 : document.getNumberOfLines();
- int digits= 2;
+ int digits = 2;
while (lines > Math.pow(10, digits) - 1) {
++digits;
}
@@ -544,22 +544,22 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Layouts the enclosing viewer to adapt the layout to changes of the size
* of the individual components.
- *
+ *
* @param redraw
* <code>true</code> if this column can be redrawn
*/
protected void layout(boolean redraw) {
if (!redraw) {
- fRelayoutRequired= true;
+ fRelayoutRequired = true;
return;
}
- fRelayoutRequired= false;
+ fRelayoutRequired = false;
if (fCachedTextViewer instanceof ITextViewerExtension) {
- ITextViewerExtension extension= (ITextViewerExtension) fCachedTextViewer;
- Control control= extension.getControl();
+ ITextViewerExtension extension = (ITextViewerExtension) fCachedTextViewer;
+ Control control = extension.getControl();
if (control instanceof Composite && !control.isDisposed()) {
- Composite composite= (Composite) control;
+ Composite composite = (Composite) control;
composite.layout(true);
}
}
@@ -573,20 +573,20 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
if (fCanvas == null)
return;
- GC gc= new GC(fCanvas);
+ GC gc = new GC(fCanvas);
try {
gc.setFont(fCanvas.getFont());
- fIndentation= new int[fCachedNumberOfDigits + 1];
- char[] digitStr= new char[fCachedNumberOfDigits + 1];
+ fIndentation = new int[fCachedNumberOfDigits + 1];
+ char[] digitStr = new char[fCachedNumberOfDigits + 1];
Arrays.fill(digitStr, '9');
- Point p= gc.stringExtent(new String(digitStr, 0, fCachedNumberOfDigits + 1));
- fIndentation[0]= p.x;
+ Point p = gc.stringExtent(new String(digitStr, 0, fCachedNumberOfDigits + 1));
+ fIndentation[0] = p.x;
- for (int i= 1; i <= fCachedNumberOfDigits; i++) {
- p= gc.stringExtent(new String(digitStr, 0, i));
- fIndentation[i]= fIndentation[0] - p.x;
+ for (int i = 1; i <= fCachedNumberOfDigits; i++) {
+ p = gc.stringExtent(new String(digitStr, 0, i));
+ fIndentation[i] = fIndentation[0] - p.x;
}
} finally {
@@ -600,11 +600,11 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
@Override
public Control createControl(CompositeRuler parentRuler, Composite parentControl) {
- fParentRuler= parentRuler;
- fCachedTextViewer= parentRuler.getTextViewer();
- fCachedTextWidget= fCachedTextViewer.getTextWidget();
+ fParentRuler = parentRuler;
+ fCachedTextViewer = parentRuler.getTextViewer();
+ fCachedTextWidget = fCachedTextViewer.getTextWidget();
- fCanvas= new Canvas(parentControl, SWT.NONE);
+ fCanvas = new Canvas(parentControl, SWT.NONE);
fCanvas.setBackground(getBackground(fCanvas.getDisplay()));
fCanvas.setForeground(fForeground);
@@ -620,8 +620,8 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
@Override
public void widgetDisposed(DisposeEvent e) {
handleDispose();
- fCachedTextViewer= null;
- fCachedTextWidget= null;
+ fCachedTextViewer = null;
+ fCachedTextWidget = null;
}
});
@@ -635,7 +635,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
if (fFont == null) {
if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed())
- fFont= fCachedTextWidget.getFont();
+ fFont = fCachedTextWidget.getFont();
}
}
@@ -660,7 +660,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
if (fBuffer != null) {
fBuffer.dispose();
- fBuffer= null;
+ fBuffer = null;
}
}
@@ -674,28 +674,28 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Double buffer drawing.
- *
+ *
* @param dest
* the gc to draw into
*/
private void doubleBufferPaint(GC dest) {
- Point size= fCanvas.getSize();
+ Point size = fCanvas.getSize();
if (size.x <= 0 || size.y <= 0)
return;
if (fBuffer != null) {
- Rectangle r= fBuffer.getBounds();
+ Rectangle r = fBuffer.getBounds();
if (r.width != size.x || r.height != size.y) {
fBuffer.dispose();
- fBuffer= null;
+ fBuffer = null;
}
}
if (fBuffer == null)
- fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
+ fBuffer = new Image(fCanvas.getDisplay(), size.x, size.y);
- GC gc= new GC(fBuffer);
+ GC gc = new GC(fBuffer);
gc.setFont(fCanvas.getFont());
if (fForeground != null)
gc.setForeground(fForeground);
@@ -718,17 +718,17 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Returns the viewport height in lines.
- *
+ *
* @return the viewport height in lines
*/
protected int getVisibleLinesInViewport() {
- Rectangle clArea= fCachedTextWidget.getClientArea();
+ Rectangle clArea = fCachedTextWidget.getClientArea();
return clArea.height / fCachedTextWidget.getLineHeight();
}
/**
* Draws the ruler column.
- *
+ *
* @param gc
* the gc to draw into
*/
@@ -740,12 +740,12 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
if (fCachedTextWidget == null)
return;
- int firstLine= 0;
+ int firstLine = 0;
- int topLine= fCachedTextWidget.getTopIndex();
- fScrollPos= fCachedTextWidget.getTopPixel();
- int lineheight= fCachedTextWidget.getLineHeight();
- int partialLineHidden= fScrollPos % lineheight;
+ int topLine = fCachedTextWidget.getTopIndex();
+ fScrollPos = fCachedTextWidget.getTopPixel();
+ int lineheight = fCachedTextWidget.getLineHeight();
+ int partialLineHidden = fScrollPos % lineheight;
if (partialLineHidden > 0 && topLine > 0) // widgetTopLine shows the
// first fully visible line
@@ -755,51 +755,51 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
try {
- IRegion region= fCachedTextViewer.getVisibleRegion();
- IDocument doc= fCachedTextViewer.getDocument();
+ IRegion region = fCachedTextViewer.getVisibleRegion();
+ IDocument doc = fCachedTextViewer.getDocument();
if (doc == null)
return;
- firstLine= doc.getLineOfOffset(region.getOffset());
+ firstLine = doc.getLineOfOffset(region.getOffset());
if (firstLine > topLine)
- topLine= firstLine;
+ topLine = firstLine;
- bottomLine= doc.getLineOfOffset(region.getOffset() + region.getLength());
+ bottomLine = doc.getLineOfOffset(region.getOffset() + region.getLength());
} catch (BadLocationException x) {
return;
}
- fSensitiveToTextChanges= bottomLine - topLine < getVisibleLinesInViewport();
+ fSensitiveToTextChanges = bottomLine - topLine < getVisibleLinesInViewport();
- int baselineBias= getBaselineBias(gc);
+ int baselineBias = getBaselineBias(gc);
- int topInset= fCachedTextViewer.getTopInset();
- int y= topInset - partialLineHidden;
- Point canvasSize= fCanvas.getSize();
- Point selection= fCachedTextWidget.getSelection();
- boolean selectedLine= false;
- Color defaultForeground= gc.getForeground();
- Color defaultBackground= gc.getBackground();
+ int topInset = fCachedTextViewer.getTopInset();
+ int y = topInset - partialLineHidden;
+ Point canvasSize = fCanvas.getSize();
+ Point selection = fCachedTextWidget.getSelection();
+ boolean selectedLine = false;
+ Color defaultForeground = gc.getForeground();
+ Color defaultBackground = gc.getBackground();
- for (int line= topLine; y < canvasSize.y && line <= bottomLine; line++, y += lineheight) {
- int widgetOffset= fCachedTextWidget.getOffsetAtLine(line);
+ for (int line = topLine; y < canvasSize.y && line <= bottomLine; line++, y += lineheight) {
+ int widgetOffset = fCachedTextWidget.getOffsetAtLine(line);
if (fPaintSelectionBackground && widgetOffset >= selection.x && widgetOffset < selection.y) {
if (!selectedLine) {
- selectedLine= true;
+ selectedLine = true;
gc.setForeground(fCachedTextWidget.getSelectionForeground());
gc.setBackground(fCachedTextWidget.getSelectionBackground());
}
} else if (selectedLine) {
- selectedLine= false;
+ selectedLine = false;
gc.setForeground(defaultForeground);
gc.setBackground(defaultBackground);
}
if (selectedLine) {
gc.fillRectangle(0, y, canvasSize.x, lineheight);
} else if (fPaintStyleBackground && widgetOffset >= 0 && widgetOffset < fCachedTextWidget.getCharCount()) {
- StyleRange style= fCachedTextWidget.getStyleRangeAtOffset(widgetOffset);
+ StyleRange style = fCachedTextWidget.getStyleRangeAtOffset(widgetOffset);
if (style != null && style.background != null) {
gc.setBackground(style.background);
gc.fillRectangle(0, y + baselineBias, canvasSize.x, lineheight - baselineBias);
@@ -807,8 +807,8 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
}
paintLine(line, y, lineheight, gc, fCachedTextWidget.getDisplay());
- String s= createDisplayString(line);
- int indentation= fAlignRight ? fIndentation[s.length()] : 0;
+ String s = createDisplayString(line);
+ int indentation = fAlignRight ? fIndentation[s.length()] : 0;
gc.drawString(s, indentation, y + baselineBias, true);
}
}
@@ -816,7 +816,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Computes the string to be printed for <code>line</code>. The default
* implementation returns <code>Integer.toString(line + 1)</code>.
- *
+ *
* @param line
* the line number for which the string is generated
* @return the string to be printed on the ruler column for <code>line</code>
@@ -828,7 +828,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Draws the ruler column. Uses <code>ITextViewerExtension5</code> for the
* implementation. Will replace <code>doPinat(GC)</code>.
- *
+ *
* @param gc
* the gc to draw into
*/
@@ -837,77 +837,77 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
if (fCachedTextViewer == null)
return;
- ITextViewerExtension5 extension= (ITextViewerExtension5) fCachedTextViewer;
+ ITextViewerExtension5 extension = (ITextViewerExtension5) fCachedTextViewer;
- int widgetTopLine= fCachedTextWidget.getTopIndex();
- fScrollPos= fCachedTextWidget.getTopPixel();
- int lineheight= fCachedTextWidget.getLineHeight();
- int partialLineHidden= fScrollPos % lineheight;
+ int widgetTopLine = fCachedTextWidget.getTopIndex();
+ fScrollPos = fCachedTextWidget.getTopPixel();
+ int lineheight = fCachedTextWidget.getLineHeight();
+ int partialLineHidden = fScrollPos % lineheight;
if (partialLineHidden > 0 && widgetTopLine > 0) // widgetTopLine shows
// the first fully
// visible line
--widgetTopLine;
- int modelTopLine= extension.widgetLine2ModelLine(widgetTopLine);
- int modelBottomLine= fCachedTextViewer.getBottomIndex();
+ int modelTopLine = extension.widgetLine2ModelLine(widgetTopLine);
+ int modelBottomLine = fCachedTextViewer.getBottomIndex();
if (modelBottomLine >= 0)
++modelBottomLine;
try {
- IRegion region= extension.getModelCoverage();
- IDocument doc= fCachedTextViewer.getDocument();
+ IRegion region = extension.getModelCoverage();
+ IDocument doc = fCachedTextViewer.getDocument();
if (doc == null)
return;
- int coverageTopLine= doc.getLineOfOffset(region.getOffset());
+ int coverageTopLine = doc.getLineOfOffset(region.getOffset());
if (coverageTopLine > modelTopLine || modelTopLine == -1)
- modelTopLine= coverageTopLine;
+ modelTopLine = coverageTopLine;
- int coverageBottomLine= doc.getLineOfOffset(region.getOffset() + region.getLength());
+ int coverageBottomLine = doc.getLineOfOffset(region.getOffset() + region.getLength());
if (coverageBottomLine < modelBottomLine || modelBottomLine == -1)
- modelBottomLine= coverageBottomLine;
+ modelBottomLine = coverageBottomLine;
} catch (BadLocationException x) {
return;
}
- fSensitiveToTextChanges= modelBottomLine - modelTopLine < getVisibleLinesInViewport();
+ fSensitiveToTextChanges = modelBottomLine - modelTopLine < getVisibleLinesInViewport();
- int baselineBias= getBaselineBias(gc);
+ int baselineBias = getBaselineBias(gc);
- int topInset= fCachedTextViewer.getTopInset();
- int y= topInset - partialLineHidden;
- Point canvasSize= fCanvas.getSize();
- Point selection= fCachedTextWidget.getSelection();
- boolean selectedLine= false;
- Color defaultForeground= gc.getForeground();
- Color defaultBackground= gc.getBackground();
+ int topInset = fCachedTextViewer.getTopInset();
+ int y = topInset - partialLineHidden;
+ Point canvasSize = fCanvas.getSize();
+ Point selection = fCachedTextWidget.getSelection();
+ boolean selectedLine = false;
+ Color defaultForeground = gc.getForeground();
+ Color defaultBackground = gc.getBackground();
- for (int modelLine= modelTopLine; y < canvasSize.y && modelLine <= modelBottomLine; modelLine++) {
+ for (int modelLine = modelTopLine; y < canvasSize.y && modelLine <= modelBottomLine; modelLine++) {
// don't draw hidden (e.g. folded) lines
- int widgetLine= extension.modelLine2WidgetLine(modelLine);
+ int widgetLine = extension.modelLine2WidgetLine(modelLine);
if (widgetLine == -1)
continue;
- int widgetOffset= fCachedTextWidget.getOffsetAtLine(widgetLine);
+ int widgetOffset = fCachedTextWidget.getOffsetAtLine(widgetLine);
if (fPaintSelectionBackground && widgetOffset >= selection.x && widgetOffset < selection.y) {
if (!selectedLine) {
- selectedLine= true;
+ selectedLine = true;
gc.setForeground(fCachedTextWidget.getSelectionForeground());
gc.setBackground(fCachedTextWidget.getSelectionBackground());
}
} else if (selectedLine) {
- selectedLine= false;
+ selectedLine = false;
gc.setForeground(defaultForeground);
gc.setBackground(defaultBackground);
}
if (selectedLine) {
gc.fillRectangle(0, y, canvasSize.x, lineheight);
} else if (fPaintStyleBackground && widgetOffset >= 0 && widgetOffset < fCachedTextWidget.getCharCount()) {
- StyleRange style= fCachedTextWidget.getStyleRangeAtOffset(widgetOffset);
+ StyleRange style = fCachedTextWidget.getStyleRangeAtOffset(widgetOffset);
if (style != null && style.background != null) {
gc.setBackground(style.background);
gc.fillRectangle(0, y + baselineBias, canvasSize.x, lineheight - baselineBias);
@@ -917,8 +917,8 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
paintLine(modelLine, y, lineheight, gc, fCachedTextWidget.getDisplay());
- String s= createDisplayString(modelLine);
- int indentation= fAlignRight ? fIndentation[s.length()] : 0;
+ String s = createDisplayString(modelLine);
+ int indentation = fAlignRight ? fIndentation[s.length()] : 0;
gc.drawString(s, indentation, y + baselineBias, true);
y += lineheight;
}
@@ -929,7 +929,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
* baseline as specified by the font for <code>gc</code>. When drawing
* text, the returned bias should be added to obtain text line up on
* the correct base line of the text widget.
- *
+ *
* @param gc
* the <code>GC</code> to get the font metrics from
* @return the baseline bias to use when drawing text that is line up with
@@ -942,11 +942,11 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
* since font styles (bold, italics...) can have larger font metrics
* than the simple font used for the numbers.
*/
- int widgetBaseline= fCachedTextWidget.getBaseline();
- FontMetrics fm= gc.getFontMetrics();
- int fontBaseline= fm.getAscent() + fm.getLeading();
+ int widgetBaseline = fCachedTextWidget.getBaseline();
+ FontMetrics fm = gc.getFontMetrics();
+ int fontBaseline = fm.getAscent() + fm.getLeading();
Assert.isTrue(widgetBaseline >= fontBaseline);
- int baselineBias= widgetBaseline - fontBaseline;
+ int baselineBias = widgetBaseline - fontBaseline;
return baselineBias;
}
@@ -956,7 +956,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
* <p>
* This default implementation does nothing.
* </p>
- *
+ *
* @param line
* the line of the document which the ruler is painted for
* @param y
@@ -978,12 +978,12 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
*/
protected final void postRedraw() {
if (fCanvas != null && !fCanvas.isDisposed()) {
- Display d= fCanvas.getDisplay();
+ Display d = fCanvas.getDisplay();
if (d != null) {
synchronized (fRunnableLock) {
if (fIsRunnablePosted)
return;
- fIsRunnablePosted= true;
+ fIsRunnablePosted = true;
}
d.asyncExec(fRunnable);
}
@@ -1002,7 +1002,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
}
if (fCanvas != null && !fCanvas.isDisposed()) {
- GC gc= new GC(fCanvas);
+ GC gc = new GC(fCanvas);
doubleBufferPaint(gc);
gc.dispose();
}
@@ -1020,7 +1020,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
*/
@Override
public void setFont(Font font) {
- fFont= font;
+ fFont = font;
if (fCanvas != null && !fCanvas.isDisposed()) {
fCanvas.setFont(fFont);
updateNumberOfDigits();
@@ -1030,7 +1030,7 @@ public class DisassemblyRulerColumn extends AbstractContributedRulerColumn imple
/**
* Returns the parent (composite) ruler of this ruler column.
- *
+ *
* @return the parent ruler
*/
protected CompositeRuler getParentRuler() {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java
index ed8b92cee64..a92cdd31bb7 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblySelection.java
@@ -36,7 +36,7 @@ import org.eclipse.jface.text.Position;
/**
* Default implementation of {@link IDisassemblySelection}.
- *
+ *
* @since 2.1
* @noextend This class is not intended to be subclassed by clients.
*/
@@ -50,7 +50,7 @@ public class DisassemblySelection implements IDisassemblySelection {
/**
* Create a disassembly selection from a normal text selection and a disassembly part.
- *
+ *
* @param selection the text selection
* @param part the disassembly part
*/
@@ -91,7 +91,7 @@ public class DisassemblySelection implements IDisassemblySelection {
fStartAddress = null;
}
}
-
+
try {
Position labelPosition = document.getPosition(DisassemblyDocument.CATEGORY_LABELS, offset, true);
if (labelPosition != null) {
@@ -103,7 +103,7 @@ public class DisassemblySelection implements IDisassemblySelection {
fLabel = null;
}
}
-
+
/*
* @see org.eclipse.jface.viewers.ISelection#isEmpty()
*/
@@ -203,7 +203,7 @@ public class DisassemblySelection implements IDisassemblySelection {
public IAddress getStartAddress() {
return fStartAddress;
}
-
+
/**
* @since 2.2
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java
index 6fd302a24c7..c0cc9951143 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyViewer.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -47,6 +47,7 @@ public class DisassemblyViewer extends SourceViewer {
public void controlResized(ControlEvent e) {
updateViewportListeners(RESIZE);
}
+
@Override
public void controlMoved(ControlEvent e) {
}
@@ -54,7 +55,7 @@ public class DisassemblyViewer extends SourceViewer {
private boolean fUserTriggeredScrolling;
private int fCachedLastTopPixel;
-
+
/**
* Create a new DisassemblyViewer.
* @param parent
@@ -63,7 +64,8 @@ public class DisassemblyViewer extends SourceViewer {
* @param showsAnnotationOverview
* @param styles
*/
- public DisassemblyViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean showsAnnotationOverview, int styles) {
+ public DisassemblyViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler,
+ boolean showsAnnotationOverview, int styles) {
super(parent, ruler, overviewRuler, showsAnnotationOverview, styles);
// always readonly
setEditable(false);
@@ -100,7 +102,8 @@ public class DisassemblyViewer extends SourceViewer {
selectedText = getSelectedText();
} catch (BadLocationException e) {
// should not happend
- DsfUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, e.getLocalizedMessage(), e));
+ DsfUIPlugin.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, e.getLocalizedMessage(), e));
return;
}
Clipboard clipboard = new Clipboard(textWidget.getDisplay());
@@ -121,7 +124,7 @@ public class DisassemblyViewer extends SourceViewer {
public String getSelectedText() throws BadLocationException {
StringBuilder text = new StringBuilder(200);
String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
- DisassemblyDocument doc = (DisassemblyDocument)getDocument();
+ DisassemblyDocument doc = (DisassemblyDocument) getDocument();
Point selection = getSelectedRange();
int startOffset = selection.x;
int length = selection.y;
@@ -176,15 +179,15 @@ public class DisassemblyViewer extends SourceViewer {
StringBuilder prefix = new StringBuilder(10);
IVerticalRuler ruler = getVerticalRuler();
if (ruler instanceof CompositeRuler) {
- for (Iterator<?> iter = ((CompositeRuler)ruler).getDecoratorIterator(); iter.hasNext();) {
+ for (Iterator<?> iter = ((CompositeRuler) ruler).getDecoratorIterator(); iter.hasNext();) {
IVerticalRulerColumn column = (IVerticalRulerColumn) iter.next();
if (column instanceof DisassemblyRulerColumn) {
- DisassemblyRulerColumn disassColumn = (DisassemblyRulerColumn)column;
+ DisassemblyRulerColumn disassColumn = (DisassemblyRulerColumn) column;
String columnText = disassColumn.createDisplayString(line);
prefix.append(columnText);
int columnWidth = disassColumn.computeNumberOfCharacters();
columnWidth -= columnText.length();
- while(columnWidth-- > 0)
+ while (columnWidth-- > 0)
prefix.append(' ');
prefix.append(' ');
}
@@ -213,7 +216,7 @@ public class DisassemblyViewer extends SourceViewer {
int bottom = top + lines;
int bottomBuffer = Math.max(1, lines / 3);
-
+
if (!onTop && focusLine >= top && focusLine <= bottom - bottomBuffer) {
// do not scroll at all as it is already visible
} else {
@@ -242,7 +245,7 @@ public class DisassemblyViewer extends SourceViewer {
private int getEstimatedVisibleLinesInViewport() {
StyledText textWidget = getTextWidget();
if (textWidget != null) {
- Rectangle clArea= textWidget.getClientArea();
+ Rectangle clArea = textWidget.getClientArea();
if (!clArea.isEmpty())
return clArea.height / textWidget.getLineHeight();
}
@@ -252,7 +255,7 @@ public class DisassemblyViewer extends SourceViewer {
public int getLastTopPixel() {
return fCachedLastTopPixel;
}
-
+
public boolean isUserTriggeredScrolling() {
return fUserTriggeredScrolling;
}
@@ -269,5 +272,5 @@ public class DisassemblyViewer extends SourceViewer {
}
super.updateViewportListeners(origin);
}
-
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java
index c8529129777..287d505a4bf 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IBreakpointLocationProvider.java
@@ -27,13 +27,13 @@ import org.eclipse.debug.core.model.ILineBreakpoint;
* If a breakpoint adapts to this interface, its position in the viewer is
* determined by the information provided by the location provider.
* </p>
- *
+ *
* <p>
* Breakpoints implementing either {@link ICAddressBreakpoint} or {@link ILineBreakpoint}
* need not provide a location provider but may do so in order to override default
* location retrieval.
- * </p>
- *
+ * </p>
+ *
* <p>
* The annotation position will be determined with the following ordering:
* <ol>
@@ -50,7 +50,7 @@ public interface IBreakpointLocationProvider {
/**
* Returns the line number of the breakpoint or -1 if no line number is
* available.
- *
+ *
* @param breakpoint the breakpoint
* @param debugContext the debug context of the view
* @return the line number or -1
@@ -60,7 +60,7 @@ public interface IBreakpointLocationProvider {
/**
* Returns the source file path of the breakpoint or <code>null</code> if no
* source file is associated with this breakpoint.
- *
+ *
* @param breakpoint the breakpoint
* @param debugContext the debug context of the view
* @return the file path, can be <code>null</code>
@@ -70,7 +70,7 @@ public interface IBreakpointLocationProvider {
/**
* Returns the label address of the breakpoint or <code>null</code> if no
* label is associated with this breakpoint.
- *
+ *
* @param breakpoint the breakpoint
* @param debugContext the debug context of the view
* @return the label address, can be <code>null</code>
@@ -79,13 +79,13 @@ public interface IBreakpointLocationProvider {
/**
* Returns the addresses of the breakpoint.
- *
+ *
* <p>
* <i>Currently there can only be one annotation per breakpoint. Therefore
* an annotation is created only for the first valid address. Support for
* multiple annotations per breakpoint is up for future enhancements. </i>
* </p>
- *
+ *
* @param breakpoint the breakpoint
* @param debugContext the debug context of the view
* @return the addresses, can be <code>null</code>
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java
index 6499d6fbd6b..70c09ab2869 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblyPart.java
@@ -20,60 +20,60 @@ import org.eclipse.ui.IWorkbenchPart;
/**
* Interface which the disassembly view and editor implement.
- *
+ *
* @since 2.1
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IDisassemblyPart extends IWorkbenchPart {
-
+
/**
* Property id for the active state of the part.
*/
- public final int PROP_ACTIVE= 0x505;
+ public final int PROP_ACTIVE = 0x505;
/**
* Property id for the connected state of the part.
*/
- public final int PROP_CONNECTED= 0x506;
+ public final int PROP_CONNECTED = 0x506;
/**
* Property id for the suspended state of the underlying execution context.
*/
- public final int PROP_SUSPENDED= 0x507;
-
+ public final int PROP_SUSPENDED = 0x507;
+
/**
* Test whether this part is connected to a debug session and execution context.
- *
+ *
* @return <code>true</code> if the part is connected to a debug session and execution context
*/
boolean isConnected();
-
+
/**
* Test whether this part is active. A part is active if it is visible and connected.
- *
+ *
* @return <code>true</code> if the part is active
*/
boolean isActive();
-
+
/**
* Test whether the underlying execution context is currently suspended.
* Implies connected state.
- *
+ *
* @return <code>true</code> if the execution context is currently suspended
*/
boolean isSuspended();
/**
* Get access to the text viewer.
- *
+ *
* @return the text viewer
*/
ISourceViewer getTextViewer();
-
+
/**
* Navigate to the given address.
- *
+ *
* @param address
*/
void gotoAddress(IAddress address);
@@ -85,7 +85,7 @@ public interface IDisassemblyPart extends IWorkbenchPart {
/**
* Navigate to the address the given expression evaluates to.
- *
+ *
* @param expression a symbolic address expression
*/
void gotoSymbol(String expression);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java
index a33141d56ff..e9c2c8f99fd 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/IDisassemblySelection.java
@@ -35,25 +35,25 @@ public interface IDisassemblySelection extends ITextSelection {
* @return the address associated with the start of the selection, may be <code>null</code>
*/
IAddress getStartAddress();
-
+
/**
* @return the {@link IFile} associated with the selection, may be <code>null</code>
*/
IFile getSourceFile();
-
+
/**
* @return the source location {@link URI} of the associated source file, may be <code>null</code>
*/
URI getSourceLocationURI();
-
+
/**
* @return the 0-based line number of the source file associated with the selection, -1 if not available
*/
int getSourceLine();
-
+
/**
* @return the label, may be <code>null</code>
- *
+ *
* @since 2.2
*/
String getLabel();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/IFileRider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/IFileRider.java
index af72483c741..2bc548bef57 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/IFileRider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/IFileRider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDDocument.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDDocument.java
index 23e66736085..e4e24359a94 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDDocument.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDDocument.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -35,7 +35,7 @@ public class REDDocument extends AbstractDocument {
public void dispose() {
ITextStore store = getStore();
if (store instanceof REDTextStore) {
- ((REDTextStore)store).dispose();
+ ((REDTextStore) store).dispose();
setTextStore(new StringTextStore());
getTracker().set(""); //$NON-NLS-1$
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFile.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFile.java
index 1f4a36ccc0c..32378d84fe1 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFile.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFile.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -78,7 +78,7 @@ public final class REDFile {
if (file != null) {
try {
setFile(file);
- fLength = (int)(fFile.length() / 2);
+ fLength = (int) (fFile.length() / 2);
} catch (IOException ioe) {
throw new Error(ioe);
}
@@ -86,7 +86,7 @@ public final class REDFile {
}
public REDFile() {
- this((File)null, false);
+ this((File) null, false);
}
public REDFile(String name, boolean readonly) {
@@ -172,7 +172,7 @@ public final class REDFile {
fLength = 0;
} else {
try {
- fLength = (int)(fFile.length() / 2);
+ fLength = (int) (fFile.length() / 2);
} catch (IOException e) {
fLength = 0;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFileRider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFileRider.java
index b81ef2a403b..414684b4dee 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFileRider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDFileRider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -30,6 +30,7 @@ public final class REDFileRider implements IFileRider {
public REDFileRider(REDFile f) throws IOException {
set(f, 0);
}
+
public REDFileRider(REDFile f, int limit) throws IOException {
fLimit = limit;
set(f, 0);
@@ -47,7 +48,7 @@ public final class REDFileRider implements IFileRider {
/**
* Set rider to file and position
- *
+ *
* @param f the file the rider should operate on
* @param pos is normalized to be in range [0, f.length()]
* @pre f != null
@@ -137,14 +138,14 @@ public final class REDFileRider implements IFileRider {
@Override
public void readChars(char[] buf, int off, int n) throws IOException {
int count = fFile.readBuffered(buf, off, n);
- fResult = n-count;
+ fResult = n - count;
fEof = fResult > 0;
}
@Override
public void readChars(StringBuffer buf, int n) throws IOException {
int count = fFile.readBuffered(buf, n);
- fResult = n-count;
+ fResult = n - count;
fEof = fResult > 0;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDRun.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDRun.java
index 92d4acafe46..274879d7adc 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDRun.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDRun.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -111,7 +111,6 @@ public class REDRun implements CharSequence {
return r.fRider == fRider && r.fOffset == fOffset + fLength;
}
-
/*
* @see java.lang.Object#toString()
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDTextStore.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDTextStore.java
index b5e9ee26506..45bf337ef97 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDTextStore.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/REDTextStore.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -63,13 +63,13 @@ public final class REDTextStore implements ITextStore {
REDFileRider fileRider = null;
if (!monitor.isCanceled()) {
try {
-// System.out.println("TextStoreSwapper.run() creating swap file");
+ // System.out.println("TextStoreSwapper.run() creating swap file");
fileRider = new REDFileRider(new REDFile());
int size = fText.length();
- monitor.beginTask(getName(), size+1);
+ monitor.beginTask(getName(), size + 1);
int written = 0;
while (written < size && !monitor.isCanceled()) {
- int n = Math.min(size-written, CHUNK_SIZE);
+ int n = Math.min(size - written, CHUNK_SIZE);
fileRider.writeChars(fText, written, n);
monitor.worked(n);
written += n;
@@ -79,19 +79,19 @@ public final class REDTextStore implements ITextStore {
}
}
if (!monitor.isCanceled()) {
-// System.out.println("TextStoreSwapper.run() swapping");
+ // System.out.println("TextStoreSwapper.run() swapping");
fileRider = swap(fRider, fileRider);
monitor.done();
}
// something went wrong, dispose the file
if (fileRider != null) {
-// System.out.println("TextStoreSwapper.run() disposing");
+ // System.out.println("TextStoreSwapper.run() disposing");
fileRider.getFile().dispose();
}
// remove references
fText = null;
fRider = null;
-// System.out.println("TextStoreSwapper.run() done");
+ // System.out.println("TextStoreSwapper.run() done");
return Status.OK_STATUS;
}
}
@@ -103,9 +103,11 @@ public final class REDTextStore implements ITextStore {
LinkedRun(IFileRider rider, String str) throws IOException {
super(rider, str);
}
+
LinkedRun(IFileRider rider, char[] buf, int off, int n) throws IOException {
super(rider, buf, off, n);
}
+
LinkedRun(IFileRider rider, int offset, int length) {
super(rider, offset, length);
}
@@ -179,8 +181,8 @@ public final class REDTextStore implements ITextStore {
synchronized (fRunSpec) {
// special case: long in-memory text in full length (about to be swapped)
if (length == fLength && fSwapper != null && fHead != null && fHead.fNext == null) {
- ((StringRider)fHead.fRider).fBuffer.position(0);
- return ((StringRider)fHead.fRider).fBuffer.toString();
+ ((StringRider) fHead.fRider).fBuffer.position(0);
+ return ((StringRider) fHead.fRider).fBuffer.toString();
}
return toString(offset, offset + length);
}
@@ -283,7 +285,7 @@ public final class REDTextStore implements ITextStore {
assert from >= 0 && from <= fLength;
assert deleteLen >= 0;
assert from + deleteLen <= fLength;
-
+
RunPair split = null;
if (deleteLen > 0) {
split = delete(from, from + deleteLen);
@@ -291,19 +293,19 @@ public final class REDTextStore implements ITextStore {
if (buf == null || insertLen == 0) {
return;
}
-// assert off >= 0 && off < buf.length;
-// assert insertLen >= 0 && off+insertLen <= buf.length;
- if (split == null) {
- split = splitRun(from);
- }
+ // assert off >= 0 && off < buf.length;
+ // assert insertLen >= 0 && off+insertLen <= buf.length;
+ if (split == null) {
+ split = splitRun(from);
+ }
RunPair insert = makeRuns(split.fBefore, buf, off, insertLen);
-// assert runLength(insert.fBefore, insert.fAfter) == insertLen;
+ // assert runLength(insert.fBefore, insert.fAfter) == insertLen;
insertRuns(split, insert.fBefore, insert.fAfter);
fLength += insertLen;
-// assert runLength(fHead, null) == fLength;
+ // assert runLength(fHead, null) == fLength;
fCache = insert.fAfter;
- fCachePos = from+insertLen-insert.fAfter.fLength;
-// assert checkConsistency();
+ fCachePos = from + insertLen - insert.fAfter.fLength;
+ // assert checkConsistency();
if (split.fBefore != null) {
mergeRuns(split.fBefore, split.fAfter);
} else {
@@ -366,7 +368,8 @@ public final class REDTextStore implements ITextStore {
*/
private LinkedRun createRun(LinkedRun before, int n) {
IFileRider scratchFile;
- if (before != null && before.fRider.length() == before.fOffset + before.fLength && before.fRider.limit() >= before.fRider.length() + n) {
+ if (before != null && before.fRider.length() == before.fOffset + before.fLength
+ && before.fRider.limit() >= before.fRider.length() + n) {
scratchFile = before.fRider;
} else {
scratchFile = getScratchFile();
@@ -457,6 +460,7 @@ public final class REDTextStore implements ITextStore {
private final static class RunSpec {
public LinkedRun fRun = null;
public int fOff = -1;
+
public boolean isValid() {
return fRun != null;
}
@@ -586,7 +590,8 @@ public final class REDTextStore implements ITextStore {
p.fBefore = spec.fRun;
int len = spec.fRun.length();
if (spec.fOff != len) { // need to split
- p.fAfter = new LinkedRun(p.fBefore.fRider, p.fBefore.fOffset + spec.fOff, p.fBefore.fLength - spec.fOff);
+ p.fAfter = new LinkedRun(p.fBefore.fRider, p.fBefore.fOffset + spec.fOff,
+ p.fBefore.fLength - spec.fOff);
p.fBefore.fLength = spec.fOff;
p.fAfter.fNext = p.fBefore.fNext;
if (p.fAfter.fNext != null) {
@@ -648,13 +653,13 @@ public final class REDTextStore implements ITextStore {
}
run.fRider.seek(run.fOffset);
if (buf instanceof char[]) {
- run.fRider.writeChars((char[])buf, off, count);
+ run.fRider.writeChars((char[]) buf, off, count);
} else {
- run.fRider.writeChars((String)buf, off, count);
+ run.fRider.writeChars((String) buf, off, count);
}
if (run.fLength - count >= RECYCLE_THRESHOLD) {
LinkedRun next = run.fNext;
- LinkedRun newRun = new LinkedRun(run.fRider, run.fOffset+count, run.fLength-count);
+ LinkedRun newRun = new LinkedRun(run.fRider, run.fOffset + count, run.fLength - count);
joinRuns(run, newRun);
joinRuns(newRun, next);
} else {
@@ -667,7 +672,7 @@ public final class REDTextStore implements ITextStore {
run = run.fNext;
} catch (IOException e) {
run = null;
-// internalError(e);
+ // internalError(e);
break;
}
} while (run != null && n > 0);
@@ -681,18 +686,18 @@ public final class REDTextStore implements ITextStore {
if (buf instanceof char[]) {
try {
run.fRider.seek(run.fOffset);
- run.fRider.writeChars((char[])buf, off, n);
+ run.fRider.writeChars((char[]) buf, off, n);
} catch (IOException e) {
-// internalError(e);
- run = new LinkedRun(new StringRider(CharBuffer.wrap((char[])buf, off, off+n)), 0, n);
+ // internalError(e);
+ run = new LinkedRun(new StringRider(CharBuffer.wrap((char[]) buf, off, off + n)), 0, n);
}
} else {
try {
run.fRider.seek(run.fOffset);
- run.fRider.writeChars((String)buf, off, n);
+ run.fRider.writeChars((String) buf, off, n);
} catch (IOException e) {
-// internalError(e);
- run = new LinkedRun(new StringRider(CharBuffer.wrap((String)buf, off, off+n)), 0, n);
+ // internalError(e);
+ run = new LinkedRun(new StringRider(CharBuffer.wrap((String) buf, off, off + n)), 0, n);
}
}
if (result.fBefore == null) {
@@ -706,7 +711,7 @@ public final class REDTextStore implements ITextStore {
}
return result;
}
-
+
private void joinRuns(LinkedRun start, LinkedRun next) {
assert start != next;
start.fNext = next;
@@ -714,6 +719,7 @@ public final class REDTextStore implements ITextStore {
next.fPrev = start;
}
}
+
private void insertRuns(RunPair pos, LinkedRun start, LinkedRun end) {
assert pos.fBefore == null || pos.fBefore != pos.fAfter;
start.fPrev = pos.fBefore;
@@ -727,7 +733,7 @@ public final class REDTextStore implements ITextStore {
pos.fAfter.fPrev = end;
}
}
-
+
/**
* Swap given old (readonly) rider with the new (writable) one.
* @param oldRider
@@ -735,7 +741,7 @@ public final class REDTextStore implements ITextStore {
* @return <code>null</code> if the new rider was consumed
*/
private REDFileRider swap(IFileRider oldRider, REDFileRider newRider) {
- synchronized(fRunSpec) {
+ synchronized (fRunSpec) {
// search linked run list starting from head and replace
// all instances of oldRider with newRider
// in the general case, spare list should be searched, too
@@ -754,7 +760,7 @@ public final class REDTextStore implements ITextStore {
}
if (newRider != null) {
// unlikely, but possible: need to increase array
- REDFileRider[] scratchFiles = new REDFileRider[fScratchFiles.length+1];
+ REDFileRider[] scratchFiles = new REDFileRider[fScratchFiles.length + 1];
System.arraycopy(fScratchFiles, 0, scratchFiles, 0, fScratchFiles.length);
scratchFiles[fScratchFiles.length] = newRider;
fScratchFiles = scratchFiles;
@@ -775,23 +781,23 @@ public final class REDTextStore implements ITextStore {
int nSpare = 0;
int spareLength = 0;
LinkedRun run = fHead;
- while(run != null) {
+ while (run != null) {
++nRuns;
run = run.fNext;
}
run = fSpare;
- while(run != null) {
+ while (run != null) {
++nSpare;
spareLength += run.fLength;
run = run.fNext;
}
- double runMean = nRuns > 0 ? (double)fLength / nRuns : Double.NaN;
+ double runMean = nRuns > 0 ? (double) fLength / nRuns : Double.NaN;
double spareMean = nSpare > 0 ? spareLength / nSpare : Double.NaN;
- out.println("Length: "+fLength); //$NON-NLS-1$
- out.println("Number of runs: "+nRuns); //$NON-NLS-1$
+ out.println("Length: " + fLength); //$NON-NLS-1$
+ out.println("Number of runs: " + nRuns); //$NON-NLS-1$
out.println("Mean length of runs: " + runMean); //$NON-NLS-1$
- out.println("Length of spare runs: "+spareLength); //$NON-NLS-1$
- out.println("Number of spare runs: "+nSpare); //$NON-NLS-1$
+ out.println("Length of spare runs: " + spareLength); //$NON-NLS-1$
+ out.println("Number of spare runs: " + nSpare); //$NON-NLS-1$
out.println("Mean length of spare runs: " + spareMean); //$NON-NLS-1$
out.println("Length of dead runs: " + fDeadLength); //$NON-NLS-1$
}
@@ -817,7 +823,7 @@ public final class REDTextStore implements ITextStore {
structure += "null"; //$NON-NLS-1$
return structure;
}
-
+
/**
* For debugging purposes only.
*/
@@ -862,7 +868,7 @@ public final class REDTextStore implements ITextStore {
}
return true;
}
-
+
int runLength(LinkedRun first, LinkedRun last) {
LinkedRun run = first;
int length = 0;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringRider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringRider.java
index ba5c4df0912..3d360f28b2a 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringRider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringRider.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -61,7 +61,7 @@ public class StringRider implements IFileRider {
@Override
public void writeChars(String buf, int off, int n) throws IOException {
- fBuffer.put(buf, off, off+n);
+ fBuffer.put(buf, off, off + n);
}
@Override
@@ -90,7 +90,7 @@ public class StringRider implements IFileRider {
if (fBuffer.hasArray()) {
buf.append(fBuffer.array(), fBuffer.arrayOffset() + pos, n);
} else {
- fBuffer.limit(pos+n);
+ fBuffer.limit(pos + n);
String str = fBuffer.toString();
assert str.length() == n;
buf.append(str);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringTextStore.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringTextStore.java
index 0c19fb4aa89..18c9b2f2473 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringTextStore.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/text/StringTextStore.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -47,7 +47,7 @@ public class StringTextStore implements ITextStore {
if (length == fText.length()) {
return fText;
}
- return new String(fText.substring(offset, offset+length));
+ return new String(fText.substring(offset, offset + length));
}
/* (non-Javadoc)
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/HSL.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/HSL.java
index 61ae28c3214..66cc3d38d11 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/HSL.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/HSL.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -32,14 +32,14 @@ public class HSL {
double red = rgb.red / 255.0;
double green = rgb.green / 255.0;
double blue = rgb.blue / 255.0;
- double cmax= Math.max(Math.max(red, green), blue);
- double cmin= Math.min(Math.min(red, green), blue);
- luminance = (cmax+cmin)/2;
+ double cmax = Math.max(Math.max(red, green), blue);
+ double cmin = Math.min(Math.min(red, green), blue);
+ luminance = (cmax + cmin) / 2;
if (cmax == cmin) {
hue = 0;
saturation = 0;
} else {
- double delta = cmax-cmin;
+ double delta = cmax - cmin;
if (luminance < 0.5) {
saturation = delta / (cmax + cmin);
} else {
@@ -62,9 +62,9 @@ public class HSL {
}
public RGB toRGB() {
- int red,green,blue;
+ int red, green, blue;
if (saturation == 0) {
- red = (int)Math.round(255*luminance);
+ red = (int) Math.round(255 * luminance);
green = red;
blue = red;
} else {
@@ -75,9 +75,9 @@ public class HSL {
m2 = luminance + saturation - luminance * saturation;
}
m1 = 2 * luminance - m2;
- red = hueToColorValue(hue + 1./3., m1, m2);
+ red = hueToColorValue(hue + 1. / 3., m1, m2);
green = hueToColorValue(hue, m1, m2);
- blue = hueToColorValue(hue - 1./3., m1, m2);
+ blue = hueToColorValue(hue - 1. / 3., m1, m2);
}
return new RGB(red, green, blue);
}
@@ -89,16 +89,16 @@ public class HSL {
} else if (hue > 1) {
hue -= 1;
}
- if (6*hue < 1) {
- v = m1 + (m2-m1) * hue * 6;
- } else if (2*hue < 1) {
+ if (6 * hue < 1) {
+ v = m1 + (m2 - m1) * hue * 6;
+ } else if (2 * hue < 1) {
v = m2;
- } else if (3*hue < 2) {
- v = m1 + (m2-m1) * (2./3. - hue) * 6;
+ } else if (3 * hue < 2) {
+ v = m1 + (m2 - m1) * (2. / 3. - hue) * 6;
} else {
v = m1;
}
- return (int)Math.round(255 * v);
+ return (int) Math.round(255 * v);
}
/**
@@ -108,7 +108,7 @@ public class HSL {
* @return a string representation of the <code>HSL</code>
*/
@Override
- public String toString () {
+ public String toString() {
return "HSL {" + hue + ", " + saturation + ", " + luminance + "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/StorageEditorInput.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/StorageEditorInput.java
index ff198b4fe08..ada4e152065 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/StorageEditorInput.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/util/StorageEditorInput.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.IStorageEditorInput;
-
/**
* Abstract implementation of <code>IStorageEditorInput</code>.
*/
@@ -96,7 +95,7 @@ abstract public class StorageEditorInput implements IStorageEditorInput {
}
try {
return object instanceof IStorageEditorInput
- && getStorage().equals(((IStorageEditorInput)object).getStorage());
+ && getStorage().equals(((IStorageEditorInput) object).getStorage());
} catch (CoreException e) {
}
return false;
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingIntegerFieldEditor.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingIntegerFieldEditor.java
index 5290a442ac4..92285661eb4 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingIntegerFieldEditor.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingIntegerFieldEditor.java
@@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Text;
/**
* An {@link IntegerFieldEditor} with field decoration.
- *
+ *
* @since 1.1
*/
public class DecoratingIntegerFieldEditor extends IntegerFieldEditor {
@@ -35,25 +35,25 @@ public class DecoratingIntegerFieldEditor extends IntegerFieldEditor {
protected DecoratingIntegerFieldEditor() {
}
- /**
- * Creates an integer field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
+ /**
+ * Creates an integer field editor.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param parent the parent of the field editor's control
+ */
public DecoratingIntegerFieldEditor(String name, String labelText, Composite parent) {
super(name, labelText, parent);
}
- /**
- * Creates an integer field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- * @param textLimit the maximum number of characters in the text.
- */
+ /**
+ * Creates an integer field editor.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param parent the parent of the field editor's control
+ * @param textLimit the maximum number of characters in the text.
+ */
public DecoratingIntegerFieldEditor(String name, String labelText, Composite parent, int textLimit) {
super(name, labelText, parent, textLimit);
}
@@ -63,21 +63,22 @@ public class DecoratingIntegerFieldEditor extends IntegerFieldEditor {
Text control = super.getTextControl(parent);
if (fDecoration == null) {
fDecoration = new ControlDecoration(control, SWT.LEFT | SWT.TOP);
- FieldDecoration errorDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ FieldDecoration errorDecoration = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
fDecoration.setImage(errorDecoration.getImage());
fDecoration.setDescriptionText(getErrorMessage());
// validate on focus gain
- control.addFocusListener(new FocusAdapter() {
- @Override
+ control.addFocusListener(new FocusAdapter() {
+ @Override
public void focusGained(FocusEvent e) {
- refreshValidState();
- }
- });
+ refreshValidState();
+ }
+ });
}
return control;
}
-
+
@Override
protected void showErrorMessage(String msg) {
super.showErrorMessage(msg);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingStringFieldEditor.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingStringFieldEditor.java
index 057e4c4ed43..b34af4ac9b6 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingStringFieldEditor.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DecoratingStringFieldEditor.java
@@ -34,45 +34,45 @@ public class DecoratingStringFieldEditor extends StringFieldEditor {
protected DecoratingStringFieldEditor() {
}
- /**
- * Creates a string field editor of unlimited width.
- * Use the method <code>setTextLimit</code> to limit the text.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
+ /**
+ * Creates a string field editor of unlimited width.
+ * Use the method <code>setTextLimit</code> to limit the text.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param parent the parent of the field editor's control
+ */
public DecoratingStringFieldEditor(String name, String labelText, Composite parent) {
super(name, labelText, parent);
}
- /**
- * Creates a string field editor.
- * Use the method <code>setTextLimit</code> to limit the text.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param width the width of the text input field in characters,
- * or <code>UNLIMITED</code> for no limit
- * @param parent the parent of the field editor's control
- */
+ /**
+ * Creates a string field editor.
+ * Use the method <code>setTextLimit</code> to limit the text.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param width the width of the text input field in characters,
+ * or <code>UNLIMITED</code> for no limit
+ * @param parent the parent of the field editor's control
+ */
public DecoratingStringFieldEditor(String name, String labelText, int width, Composite parent) {
super(name, labelText, width, parent);
}
- /**
- * Creates a string field editor.
- * Use the method <code>setTextLimit</code> to limit the text.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param width the width of the text input field in characters,
- * or <code>UNLIMITED</code> for no limit
- * @param strategy either <code>VALIDATE_ON_KEY_STROKE</code> to perform
- * on the fly checking (the default), or <code>VALIDATE_ON_FOCUS_LOST</code> to
- * perform validation only after the text has been typed in
- * @param parent the parent of the field editor's control
- */
+ /**
+ * Creates a string field editor.
+ * Use the method <code>setTextLimit</code> to limit the text.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param width the width of the text input field in characters,
+ * or <code>UNLIMITED</code> for no limit
+ * @param strategy either <code>VALIDATE_ON_KEY_STROKE</code> to perform
+ * on the fly checking (the default), or <code>VALIDATE_ON_FOCUS_LOST</code> to
+ * perform validation only after the text has been typed in
+ * @param parent the parent of the field editor's control
+ */
public DecoratingStringFieldEditor(String name, String labelText, int width, int strategy, Composite parent) {
super(name, labelText, width, strategy, parent);
}
@@ -82,21 +82,22 @@ public class DecoratingStringFieldEditor extends StringFieldEditor {
Text control = super.getTextControl(parent);
if (fDecoration == null) {
fDecoration = new ControlDecoration(control, SWT.LEFT | SWT.TOP);
- FieldDecoration errorDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ FieldDecoration errorDecoration = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
fDecoration.setImage(errorDecoration.getImage());
fDecoration.setDescriptionText(getErrorMessage());
// validate on focus gain
- control.addFocusListener(new FocusAdapter() {
- @Override
+ control.addFocusListener(new FocusAdapter() {
+ @Override
public void focusGained(FocusEvent e) {
- refreshValidState();
- }
- });
+ refreshValidState();
+ }
+ });
}
return control;
}
-
+
@Override
protected void showErrorMessage(String msg) {
super.showErrorMessage(msg);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java
index 55f900ccc08..acfc6d5753b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/DsfDebugPreferencePage.java
@@ -39,9 +39,9 @@ public class DsfDebugPreferencePage extends FieldEditorPreferencePage implements
*/
public DsfDebugPreferencePage() {
super(FLAT);
- IPreferenceStore store= DsfUIPlugin.getDefault().getPreferenceStore();
+ IPreferenceStore store = DsfUIPlugin.getDefault().getPreferenceStore();
setPreferenceStore(store);
- setDescription(MessagesForPreferences.DsfDebugPreferencePage_description);
+ setDescription(MessagesForPreferences.DsfDebugPreferencePage_description);
}
/*
@@ -59,23 +59,21 @@ public class DsfDebugPreferencePage extends FieldEditorPreferencePage implements
@Override
protected void createFieldEditors() {
- final Composite parent= getFieldEditorParent();
- final GridLayout layout= new GridLayout();
- layout.marginWidth= 0;
+ final Composite parent = getFieldEditorParent();
+ final GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
parent.setLayout(layout);
-
- Group performanceGroup= new Group(parent, SWT.NONE);
+
+ Group performanceGroup = new Group(parent, SWT.NONE);
performanceGroup.setText(MessagesForPreferences.DsfDebugPreferencePage_performanceGroup_label);
- GridLayout groupLayout= new GridLayout(3, false);
+ GridLayout groupLayout = new GridLayout(3, false);
performanceGroup.setLayout(groupLayout);
performanceGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// stack frame limit
- IntegerFieldEditor limitEditor= new IntegerWithBooleanFieldEditor(
- IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT_ENABLE,
- IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT,
- MessagesForPreferences.DsfDebugPreferencePage_limitStackFrames_label,
- performanceGroup);
+ IntegerFieldEditor limitEditor = new IntegerWithBooleanFieldEditor(
+ IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT_ENABLE, IDsfDebugUIConstants.PREF_STACK_FRAME_LIMIT,
+ MessagesForPreferences.DsfDebugPreferencePage_limitStackFrames_label, performanceGroup);
limitEditor.setValidRange(1, Integer.MAX_VALUE);
limitEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_FOCUS_LOST);
@@ -83,27 +81,25 @@ public class DsfDebugPreferencePage extends FieldEditorPreferencePage implements
addField(limitEditor);
// sync stepping speed
- BooleanFieldEditor syncSteppingEditor= new BooleanFieldEditor(
+ BooleanFieldEditor syncSteppingEditor = new BooleanFieldEditor(
IDsfDebugUIConstants.PREF_WAIT_FOR_VIEW_UPDATE_AFTER_STEP_ENABLE,
- MessagesForPreferences.DsfDebugPreferencePage_waitForViewUpdate_label,
- performanceGroup);
+ MessagesForPreferences.DsfDebugPreferencePage_waitForViewUpdate_label, performanceGroup);
syncSteppingEditor.fillIntoGrid(performanceGroup, 3);
addField(syncSteppingEditor);
// minimum step interval
- IntegerFieldEditor minIntervalEditor= new DecoratingIntegerFieldEditor(
+ IntegerFieldEditor minIntervalEditor = new DecoratingIntegerFieldEditor(
IDsfDebugUIConstants.PREF_MIN_STEP_INTERVAL,
- MessagesForPreferences.DsfDebugPreferencePage_minStepInterval_label,
- performanceGroup);
+ MessagesForPreferences.DsfDebugPreferencePage_minStepInterval_label, performanceGroup);
minIntervalEditor.setValidRange(0, 10000);
minIntervalEditor.fillIntoGrid(performanceGroup, 3);
addField(minIntervalEditor);
-
+
// need to set layout again
performanceGroup.setLayout(groupLayout);
-}
+ }
@Override
protected void adjustGridLayout() {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/IntegerWithBooleanFieldEditor.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/IntegerWithBooleanFieldEditor.java
index d067578c1da..821b798458a 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/IntegerWithBooleanFieldEditor.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/IntegerWithBooleanFieldEditor.java
@@ -32,12 +32,13 @@ public class IntegerWithBooleanFieldEditor extends DecoratingIntegerFieldEditor
public IntegerWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, Composite parent) {
super(nameKey, labelText, parent);
- fEnableKey= enableKey;
+ fEnableKey = enableKey;
}
- public IntegerWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, Composite parent, int textLimit) {
+ public IntegerWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, Composite parent,
+ int textLimit) {
super(nameKey, labelText, parent, textLimit);
- fEnableKey= enableKey;
+ fEnableKey = enableKey;
}
@Override
@@ -48,11 +49,11 @@ public class IntegerWithBooleanFieldEditor extends DecoratingIntegerFieldEditor
private Button getCheckboxControl(Composite parent) {
if (fCheckbox == null) {
- Composite inner= new Composite(parent, SWT.NULL);
- final GridLayout layout= new GridLayout(2, false);
+ Composite inner = new Composite(parent, SWT.NULL);
+ final GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
inner.setLayout(layout);
- fCheckbox= new Button(inner, SWT.CHECK);
+ fCheckbox = new Button(inner, SWT.CHECK);
fCheckbox.setFont(parent.getFont());
fCheckbox.setText(getLabelText());
// create and hide label from base class
@@ -62,9 +63,9 @@ public class IntegerWithBooleanFieldEditor extends DecoratingIntegerFieldEditor
fCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- boolean isSelected = fCheckbox.getSelection();
- valueChanged(fWasSelected, isSelected);
- fWasSelected = isSelected;
+ boolean isSelected = fCheckbox.getSelection();
+ valueChanged(fWasSelected, isSelected);
+ fWasSelected = isSelected;
}
});
} else {
@@ -75,7 +76,7 @@ public class IntegerWithBooleanFieldEditor extends DecoratingIntegerFieldEditor
@Override
public Label getLabelControl(Composite parent) {
- final Label label= getLabelControl();
+ final Label label = getLabelControl();
if (label == null) {
return super.getLabelControl(parent);
} else {
@@ -85,11 +86,11 @@ public class IntegerWithBooleanFieldEditor extends DecoratingIntegerFieldEditor
}
protected void valueChanged(boolean oldValue, boolean newValue) {
- if (oldValue != newValue) {
- valueChanged();
+ if (oldValue != newValue) {
+ valueChanged();
fireStateChanged(VALUE, oldValue, newValue);
- getTextControl().setEnabled(newValue);
- getLabelControl().setEnabled(newValue);
+ getTextControl().setEnabled(newValue);
+ getLabelControl().setEnabled(newValue);
}
}
@@ -105,40 +106,40 @@ public class IntegerWithBooleanFieldEditor extends DecoratingIntegerFieldEditor
@Override
protected void doLoad() {
super.doLoad();
- if (fCheckbox != null) {
- boolean value = getPreferenceStore().getBoolean(fEnableKey);
- fCheckbox.setSelection(value);
- fWasSelected = value;
- getTextControl().setEnabled(value);
- getLabelControl().setEnabled(value);
- }
+ if (fCheckbox != null) {
+ boolean value = getPreferenceStore().getBoolean(fEnableKey);
+ fCheckbox.setSelection(value);
+ fWasSelected = value;
+ getTextControl().setEnabled(value);
+ getLabelControl().setEnabled(value);
+ }
}
@Override
protected void doLoadDefault() {
super.doLoadDefault();
- if (fCheckbox != null) {
- boolean value = getPreferenceStore().getDefaultBoolean(fEnableKey);
- fCheckbox.setSelection(value);
- fWasSelected = value;
- getTextControl().setEnabled(value);
- getLabelControl().setEnabled(value);
- }
+ if (fCheckbox != null) {
+ boolean value = getPreferenceStore().getDefaultBoolean(fEnableKey);
+ fCheckbox.setSelection(value);
+ fWasSelected = value;
+ getTextControl().setEnabled(value);
+ getLabelControl().setEnabled(value);
+ }
}
- @Override
+ @Override
protected void doStore() {
- super.doStore();
- getPreferenceStore().setValue(fEnableKey, fCheckbox.getSelection());
- }
+ super.doStore();
+ getPreferenceStore().setValue(fEnableKey, fCheckbox.getSelection());
+ }
- /**
- * Returns this field editor's current boolean value.
- *
- * @return the value
- */
- public boolean getBooleanValue() {
- return fCheckbox.getSelection();
- }
+ /**
+ * Returns this field editor's current boolean value.
+ *
+ * @return the value
+ */
+ public boolean getBooleanValue() {
+ return fCheckbox.getSelection();
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java
index edc9af69763..1a203893883 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/preferences/StringWithBooleanFieldEditor.java
@@ -32,19 +32,21 @@ public class StringWithBooleanFieldEditor extends DecoratingStringFieldEditor {
public StringWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, Composite parent) {
super(nameKey, labelText, parent);
- fEnableKey= enableKey;
+ fEnableKey = enableKey;
}
- public StringWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, int width, Composite parent) {
+ public StringWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, int width,
+ Composite parent) {
super(nameKey, labelText, width, parent);
- fEnableKey= enableKey;
+ fEnableKey = enableKey;
}
- public StringWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, int width, int strategy, Composite parent) {
+ public StringWithBooleanFieldEditor(String enableKey, String nameKey, String labelText, int width, int strategy,
+ Composite parent) {
super(nameKey, labelText, width, strategy, parent);
- fEnableKey= enableKey;
+ fEnableKey = enableKey;
}
-
+
@Override
protected void doFillIntoGrid(Composite parent, int numColumns) {
getCheckboxControl(parent);
@@ -53,11 +55,11 @@ public class StringWithBooleanFieldEditor extends DecoratingStringFieldEditor {
public Button getCheckboxControl(Composite parent) {
if (fCheckbox == null) {
- Composite inner= new Composite(parent, SWT.NULL);
- final GridLayout layout= new GridLayout(2, false);
+ Composite inner = new Composite(parent, SWT.NULL);
+ final GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
inner.setLayout(layout);
- fCheckbox= new Button(inner, SWT.CHECK);
+ fCheckbox = new Button(inner, SWT.CHECK);
fCheckbox.setFont(parent.getFont());
fCheckbox.setText(getLabelText());
// create and hide label from base class
@@ -67,9 +69,9 @@ public class StringWithBooleanFieldEditor extends DecoratingStringFieldEditor {
fCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- boolean isSelected = fCheckbox.getSelection();
- valueChanged(fWasSelected, isSelected);
- fWasSelected = isSelected;
+ boolean isSelected = fCheckbox.getSelection();
+ valueChanged(fWasSelected, isSelected);
+ fWasSelected = isSelected;
}
});
} else {
@@ -80,7 +82,7 @@ public class StringWithBooleanFieldEditor extends DecoratingStringFieldEditor {
@Override
public Label getLabelControl(Composite parent) {
- final Label label= getLabelControl();
+ final Label label = getLabelControl();
if (label == null) {
return super.getLabelControl(parent);
} else {
@@ -90,11 +92,11 @@ public class StringWithBooleanFieldEditor extends DecoratingStringFieldEditor {
}
protected void valueChanged(boolean oldValue, boolean newValue) {
- if (oldValue != newValue) {
- valueChanged();
+ if (oldValue != newValue) {
+ valueChanged();
fireStateChanged(VALUE, oldValue, newValue);
- getTextControl().setEnabled(newValue);
- getLabelControl().setEnabled(newValue);
+ getTextControl().setEnabled(newValue);
+ getLabelControl().setEnabled(newValue);
}
}
@@ -110,40 +112,40 @@ public class StringWithBooleanFieldEditor extends DecoratingStringFieldEditor {
@Override
protected void doLoad() {
super.doLoad();
- if (fCheckbox != null) {
- boolean value = getPreferenceStore().getBoolean(fEnableKey);
- fCheckbox.setSelection(value);
- fWasSelected = value;
- getTextControl().setEnabled(value);
- getLabelControl().setEnabled(value);
- }
+ if (fCheckbox != null) {
+ boolean value = getPreferenceStore().getBoolean(fEnableKey);
+ fCheckbox.setSelection(value);
+ fWasSelected = value;
+ getTextControl().setEnabled(value);
+ getLabelControl().setEnabled(value);
+ }
}
@Override
protected void doLoadDefault() {
super.doLoadDefault();
- if (fCheckbox != null) {
- boolean value = getPreferenceStore().getDefaultBoolean(fEnableKey);
- fCheckbox.setSelection(value);
- fWasSelected = value;
- getTextControl().setEnabled(value);
- getLabelControl().setEnabled(value);
- }
+ if (fCheckbox != null) {
+ boolean value = getPreferenceStore().getDefaultBoolean(fEnableKey);
+ fCheckbox.setSelection(value);
+ fWasSelected = value;
+ getTextControl().setEnabled(value);
+ getLabelControl().setEnabled(value);
+ }
}
- @Override
+ @Override
protected void doStore() {
- super.doStore();
- getPreferenceStore().setValue(fEnableKey, fCheckbox.getSelection());
- }
-
- /**
- * Returns this field editor's current boolean value.
- *
- * @return the value
- */
- public boolean getBooleanValue() {
- return fCheckbox.getSelection();
- }
+ super.doStore();
+ getPreferenceStore().setValue(fEnableKey, fCheckbox.getSelection());
+ }
+
+ /**
+ * Returns this field editor's current boolean value.
+ *
+ * @return the value
+ */
+ public boolean getBooleanValue() {
+ return fCheckbox.getSelection();
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/sourcelookup/DsfSourceSelectionResolver.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/sourcelookup/DsfSourceSelectionResolver.java
index 13d91160e6a..8aee0d5cc99 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/sourcelookup/DsfSourceSelectionResolver.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/sourcelookup/DsfSourceSelectionResolver.java
@@ -30,7 +30,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.ITextEditor;
-public class DsfSourceSelectionResolver implements Runnable {
+public class DsfSourceSelectionResolver implements Runnable {
private ITextEditor fEditorPage = null;
private ITextSelection fSelection = null;
private LineLocation fLineLocation = new LineLocation();
@@ -40,19 +40,19 @@ public class DsfSourceSelectionResolver implements Runnable {
public class LineLocation {
private String fileName = null;
private int lineNumber = 0;
-
+
public String getFileName() {
return fileName;
}
-
+
public void setFileName(String fileName) {
this.fileName = fileName;
}
-
+
public int getLineNumber() {
return lineNumber;
}
-
+
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
@@ -63,7 +63,7 @@ public class DsfSourceSelectionResolver implements Runnable {
}
public DsfSourceSelectionResolver() {
-
+
}
public DsfSourceSelectionResolver(ITextEditor editor, ITextSelection selection) {
@@ -108,7 +108,7 @@ public class DsfSourceSelectionResolver implements Runnable {
if (fEditorPage != null) {
return fEditorPage;
}
-
+
final IWorkbench wb = DsfUIPlugin.getDefault().getWorkbench();
// Run in UI thread to access UI resources
ResolveEditorRunnable reditorRunnable = new ResolveEditorRunnable() {
@@ -135,13 +135,13 @@ public class DsfSourceSelectionResolver implements Runnable {
Display.getDefault().syncExec(reditorRunnable);
return reditorRunnable.getEditor();
- }
-
+ }
+
private LineLocation resolveSelectedLine() {
String errorMessage = ""; //$NON-NLS-1$
IEditorInput input = fEditorPage.getEditorInput();
if (input == null) {
- errorMessage = "Invalid Editor input on selection"; //$NON-NLS-1$
+ errorMessage = "Invalid Editor input on selection"; //$NON-NLS-1$
} else {
IDocument document = fEditorPage.getDocumentProvider().getDocument(input);
if (document == null) {
@@ -178,21 +178,21 @@ public class DsfSourceSelectionResolver implements Runnable {
DsfUIPlugin.logErrorMessage(errorMessage);
return null;
}
-
+
public ITextSelection resolveSelection() {
if (fSelection != null) {
//Value received at construction time
return fSelection;
}
-
+
ISelection selection = fEditorPage.getEditorSite().getSelectionProvider().getSelection();
if (selection instanceof ITextSelection) {
return (ITextSelection) selection;
}
-
+
return null;
}
-
+
private IFunctionDeclaration[] resolveSelectedFunction(ITextSelection textSelection) {
if (textSelection != null) {
SelectionToDeclarationJob job;
@@ -207,11 +207,11 @@ public class DsfSourceSelectionResolver implements Runnable {
DsfUIPlugin.log(e);
return null;
}
-
- //fetch the result
+
+ //fetch the result
return job.getSelectedFunctions();
}
-
+
return null;
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java
index e4617e4f3c9..cd902c16d78 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Nokia - Initial API and implementation
- * Marc Khouzam (Ericsson) - Turn off casting for expression-group or
+ * Marc Khouzam (Ericsson) - Turn off casting for expression-group or
* pattern expressions (bug 394408)
*******************************************************************************/
@@ -50,60 +50,59 @@ import org.eclipse.debug.core.DebugException;
* This provides {@link ICastToType} and {@link ICastToArray} support on
* expression nodes.
*/
-public class DsfCastToTypeSupport {
+public class DsfCastToTypeSupport {
private final DsfServicesTracker serviceTracker;
private final AbstractDMVMProvider dmvmProvider;
private final SyncVariableDataAccess fSyncVariableDataAccess;
-
- /** expression memento to casting context (TODO: persist these; bug 228301)*/
- private Map<String, CastInfo> fCastedExpressionStorage = new HashMap<String, CastInfo>();
- public class CastImplementation extends PlatformObject implements ICastToArray {
+ /** expression memento to casting context (TODO: persist these; bug 228301)*/
+ private Map<String, CastInfo> fCastedExpressionStorage = new HashMap<String, CastInfo>();
+
+ public class CastImplementation extends PlatformObject implements ICastToArray {
private final IExpressionDMContext exprDMC;
private String memento;
public CastImplementation(IExpressionDMContext exprDMC) {
this.exprDMC = exprDMC;
this.memento = createCastedExpressionMemento(exprDMC);
- }
-
- public class TestExpressions2Query extends Query<Boolean> {
-
- public TestExpressions2Query() {
- super();
- }
-
- @Override
- protected void execute(final DataRequestMonitor<Boolean> rm) {
- /*
- * We're in another dispatch, so we must guard against executor
- * shutdown again.
- */
- final DsfSession session = DsfSession.getSession(
- dmvmProvider.getSession().getId());
- if (session == null) {
- rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Debug session already shut down.", null)); //$NON-NLS-1$
- rm.done();
- return;
- }
-
- DsfServicesTracker tracker = new DsfServicesTracker(
- DsfUIPlugin.getBundleContext(), dmvmProvider.getSession().getId());
- IExpressions2 expressions2 = tracker.getService(IExpressions2.class);
- rm.setData(expressions2 != null);
- rm.done();
- tracker.dispose();
- }
- }
+ }
+
+ public class TestExpressions2Query extends Query<Boolean> {
+
+ public TestExpressions2Query() {
+ super();
+ }
+
+ @Override
+ protected void execute(final DataRequestMonitor<Boolean> rm) {
+ /*
+ * We're in another dispatch, so we must guard against executor
+ * shutdown again.
+ */
+ final DsfSession session = DsfSession.getSession(dmvmProvider.getSession().getId());
+ if (session == null) {
+ rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE,
+ "Debug session already shut down.", null)); //$NON-NLS-1$
+ rm.done();
+ return;
+ }
+
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ dmvmProvider.getSession().getId());
+ IExpressions2 expressions2 = tracker.getService(IExpressions2.class);
+ rm.setData(expressions2 != null);
+ rm.done();
+ tracker.dispose();
+ }
+ }
private boolean isValid() {
- if (exprDMC instanceof IIndexedPartitionDMContext ||
- exprDMC instanceof IExpressionGroupDMContext) {
+ if (exprDMC instanceof IIndexedPartitionDMContext || exprDMC instanceof IExpressionGroupDMContext) {
return false;
}
-
- TestExpressions2Query query = new TestExpressions2Query();
- dmvmProvider.getSession().getExecutor().execute(query);
+
+ TestExpressions2Query query = new TestExpressions2Query();
+ dmvmProvider.getSession().getExecutor().execute(query);
try {
/*
@@ -118,39 +117,40 @@ public class DsfCastToTypeSupport {
return false;
}
}
-
+
private void throwIfNotValid() throws DebugException {
- if (!isValid())
- throw new DebugException(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
- MessagesForVariablesVM.VariableVMNode_CannotCastVariable, null));
+ if (!isValid())
+ throw new DebugException(
+ new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR,
+ MessagesForVariablesVM.VariableVMNode_CannotCastVariable, null));
}
-
- /*
+
+ /*
* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICastToType#canCast()
*/
- @Override
- public boolean canCast() {
- return isValid();
+ @Override
+ public boolean canCast() {
+ return isValid();
}
/*
* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICastToType#getCurrentType()
*/
- @Override
- public String getCurrentType() {
- // get expected casted type first, if possible (if there's an error in the type,
- // the expression might not evaluate successfully)
- CastInfo castDMC = fCastedExpressionStorage.get(memento);
- if (castDMC != null && castDMC.getTypeString() != null)
- return castDMC.getTypeString();
-
- // else, get the actual type
- IExpressionDMData data = fSyncVariableDataAccess.readVariable(exprDMC);
- if (data != null)
- return data.getTypeName();
-
+ @Override
+ public String getCurrentType() {
+ // get expected casted type first, if possible (if there's an error in the type,
+ // the expression might not evaluate successfully)
+ CastInfo castDMC = fCastedExpressionStorage.get(memento);
+ if (castDMC != null && castDMC.getTypeString() != null)
+ return castDMC.getTypeString();
+
+ // else, get the actual type
+ IExpressionDMData data = fSyncVariableDataAccess.readVariable(exprDMC);
+ if (data != null)
+ return data.getTypeName();
+
return ""; //$NON-NLS-1$
}
@@ -158,34 +158,33 @@ public class DsfCastToTypeSupport {
* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICastToType#cast(java.lang.String)
*/
- @Override
- public void cast(String type) throws DebugException {
- throwIfNotValid();
-
- CastInfo currentContext = fCastedExpressionStorage.get(memento);
-
- updateCastInformation(type,
- currentContext != null ? currentContext.getArrayStartIndex() : 0,
- currentContext != null ? currentContext.getArrayCount() : 0);
-
+ @Override
+ public void cast(String type) throws DebugException {
+ throwIfNotValid();
+
+ CastInfo currentContext = fCastedExpressionStorage.get(memento);
+
+ updateCastInformation(type, currentContext != null ? currentContext.getArrayStartIndex() : 0,
+ currentContext != null ? currentContext.getArrayCount() : 0);
+
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICastToType#restoreOriginal()
- */
- @Override
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICastToType#restoreOriginal()
+ */
+ @Override
public void restoreOriginal() throws DebugException {
throwIfNotValid();
- fCastedExpressionStorage.remove(memento);
- fireExpressionChangedEvent(exprDMC);
+ fCastedExpressionStorage.remove(memento);
+ fireExpressionChangedEvent(exprDMC);
}
/*
* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICastToType#isCasted()
*/
- @Override
+ @Override
public boolean isCasted() {
if (isValid())
return fCastedExpressionStorage.containsKey(memento);
@@ -197,7 +196,7 @@ public class DsfCastToTypeSupport {
* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICastToArray#canCastToArray()
*/
- @Override
+ @Override
public boolean canCastToArray() {
return isValid();
}
@@ -206,74 +205,71 @@ public class DsfCastToTypeSupport {
* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICastToArray#castToArray(int, int)
*/
- @Override
- public void castToArray(int startIndex, int length)
- throws DebugException {
+ @Override
+ public void castToArray(int startIndex, int length) throws DebugException {
throwIfNotValid();
-
+
CastInfo currentContext = fCastedExpressionStorage.get(memento);
-
- updateCastInformation(currentContext != null ? currentContext.getTypeString() : null,
- startIndex,
- length);
+
+ updateCastInformation(currentContext != null ? currentContext.getTypeString() : null, startIndex, length);
}
- private void updateCastInformation(
- String type, int arrayStartIndex,
- int arrayCount) {
+ private void updateCastInformation(String type, int arrayStartIndex, int arrayCount) {
final CastInfo info = new CastInfo(type, arrayStartIndex, arrayCount);
fCastedExpressionStorage.put(memento, info);
- fireExpressionChangedEvent(exprDMC);
+ fireExpressionChangedEvent(exprDMC);
}
- private class ExpressionChangedEvent extends AbstractDMEvent<IExpressionDMContext> implements IExpressionChangedDMEvent {
+ private class ExpressionChangedEvent extends AbstractDMEvent<IExpressionDMContext>
+ implements IExpressionChangedDMEvent {
public ExpressionChangedEvent(IExpressionDMContext context) {
super(context);
}
}
-
+
private void fireExpressionChangedEvent(IExpressionDMContext exprDMC) {
ExpressionChangedEvent event = new ExpressionChangedEvent(exprDMC);
dmvmProvider.handleEvent(event);
}
- }
-
- public DsfCastToTypeSupport(DsfSession session, AbstractDMVMProvider dmvmProvider, SyncVariableDataAccess fSyncVariableDataAccess) {
+ }
+
+ public DsfCastToTypeSupport(DsfSession session, AbstractDMVMProvider dmvmProvider,
+ SyncVariableDataAccess fSyncVariableDataAccess) {
this.dmvmProvider = dmvmProvider;
this.fSyncVariableDataAccess = fSyncVariableDataAccess;
this.serviceTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.ICastSupportTarget#createCastedExpressionMemento(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext, java.lang.String)
*/
public String createCastedExpressionMemento(IExpressionDMContext exprDMC) {
// go to the original variable first
if (exprDMC instanceof ICastedExpressionDMContext) {
- IExpressionDMContext origExpr = DMContexts.getAncestorOfType(exprDMC.getParents()[0], IExpressionDMContext.class);
+ IExpressionDMContext origExpr = DMContexts.getAncestorOfType(exprDMC.getParents()[0],
+ IExpressionDMContext.class);
if (origExpr == null) {
assert false;
} else {
exprDMC = origExpr;
}
}
-
+
// TODO: the memento doesn't really strictly define the expression's context;
// we should fetch module name, function name, etc. to be more useful (but do that asynchronously)
String expression = exprDMC.getExpression();
- String memento = exprDMC.getSessionId() + "." + expression; //$NON-NLS-1$
+ String memento = exprDMC.getSessionId() + "." + expression; //$NON-NLS-1$
return memento;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.dsf.debug.ui.viewmodel.variable.ICastSupportTarget#replaceWihCastedExpression(org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext)
*/
- public IExpressionDMContext replaceWithCastedExpression(
- IExpressionDMContext exprDMC) {
+ public IExpressionDMContext replaceWithCastedExpression(IExpressionDMContext exprDMC) {
IExpressions2 expression2Service = serviceTracker.getService(IExpressions2.class);
if (expression2Service == null)
return exprDMC;
-
+
if (!fCastedExpressionStorage.isEmpty()) {
String memento = createCastedExpressionMemento(exprDMC);
CastInfo castInfo = fCastedExpressionStorage.get(memento);
@@ -286,7 +282,7 @@ public class DsfCastToTypeSupport {
/**
* Get the ICastToArray (and ICastToType) implementation for the expression.
- * This does not necessarily return a unique object for each call.
+ * This does not necessarily return a unique object for each call.
* @param exprDMC
* @return {@link ICastToArray}
*/
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/VMViewerUpdateTracing.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/VMViewerUpdateTracing.java
index 360366a7227..e8f4c28b03e 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/VMViewerUpdateTracing.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/VMViewerUpdateTracing.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Freescale Semiconductor. - initial API and implementation
*******************************************************************************/
@@ -31,13 +31,15 @@ public final class VMViewerUpdateTracing {
* The value of the trace option "debug/vmUpdates/regex", which is a regular
* expression used to filter VMViewerUpdate traces.
*/
- public final static String DEBUG_VMUPDATE_REGEX = Platform.getDebugOption("org.eclipse.cdt.dsf.ui/debug/vm/updates/regex"); //$NON-NLS-1$
+ public final static String DEBUG_VMUPDATE_REGEX = Platform
+ .getDebugOption("org.eclipse.cdt.dsf.ui/debug/vm/updates/regex"); //$NON-NLS-1$
/**
* Has the "debug/vmUpdates/properties" tracing option been turned on? Requires
* "debug/vmUpdates" to also be turned on.
*/
- public static final boolean DEBUG_VMUPDATES = DsfUIPlugin.DEBUG && Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.cdt.dsf.ui/debug/vm/updates")); //$NON-NLS-1$
+ public static final boolean DEBUG_VMUPDATES = DsfUIPlugin.DEBUG
+ && Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.cdt.dsf.ui/debug/vm/updates")); //$NON-NLS-1$
/**
* Looks at the optional filter (regular expression) set in the tracing
@@ -46,22 +48,20 @@ public final class VMViewerUpdateTracing {
* classes. Note that for optimization reasons, we expect the caller to
* first check that DEBUG_VMUPDATES is true before invoking us; we do not
* check it here (other than to assert it).
- *
+ *
* @return true if this class's activity should be traced
*/
- public static boolean matchesFilterRegex(Class<?> clazz) {
- assert DEBUG_VMUPDATES;
- if (DEBUG_VMUPDATE_REGEX == null || DEBUG_VMUPDATE_REGEX.length() == 0) {
- return true;
- }
- try {
- Pattern regex = Pattern.compile(DEBUG_VMUPDATE_REGEX);
- Matcher matcher = regex.matcher(clazz.toString());
- return matcher.find();
- }
- catch (PatternSyntaxException exc) {
- return false;
- }
- }
+ public static boolean matchesFilterRegex(Class<?> clazz) {
+ assert DEBUG_VMUPDATES;
+ if (DEBUG_VMUPDATE_REGEX == null || DEBUG_VMUPDATE_REGEX.length() == 0) {
+ return true;
+ }
+ try {
+ Pattern regex = Pattern.compile(DEBUG_VMUPDATE_REGEX);
+ Matcher matcher = regex.matcher(clazz.toString());
+ return matcher.find();
+ } catch (PatternSyntaxException exc) {
+ return false;
+ }
+ }
}
-
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/DsfViewMemoryHandler.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/DsfViewMemoryHandler.java
index 5f945baf666..30f5a81eb8c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/DsfViewMemoryHandler.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/DsfViewMemoryHandler.java
@@ -84,59 +84,60 @@ public class DsfViewMemoryHandler extends AbstractHandler {
setBaseEnabled(viewableMemoryITems.length > 0);
setMemoryViewables(viewableMemoryITems);
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- if (getMemoryViewables() == null || getMemoryViewables().length == 0) {
- return null;
- }
-
- showInMemoryView(getMemoryViewables());
-
- return null;
+ if (getMemoryViewables() == null || getMemoryViewables().length == 0) {
+ return null;
+ }
+
+ showInMemoryView(getMemoryViewables());
+
+ return null;
}
private VariableExpressionVMC[] getMemoryViewables(Object evaluationContext) {
- List<VariableExpressionVMC> viewableMemoryItems = new ArrayList<VariableExpressionVMC>();
- if (evaluationContext instanceof IEvaluationContext) {
- Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
- if (s instanceof IStructuredSelection) {
- Iterator<?> iter = ((IStructuredSelection)s).iterator();
- while(iter.hasNext()) {
- Object obj = iter.next();
- if (obj instanceof VariableExpressionVMC) {
- Object element = DebugPlugin.getAdapter(obj, IViewInMemory.class);
- if (element != null) {
- if (((IViewInMemory)element).canViewInMemory()) {
- viewableMemoryItems.add((VariableExpressionVMC)obj);
- }
- }
- }
- }
- }
- }
- return viewableMemoryItems.toArray(new VariableExpressionVMC[viewableMemoryItems.size()]);
+ List<VariableExpressionVMC> viewableMemoryItems = new ArrayList<VariableExpressionVMC>();
+ if (evaluationContext instanceof IEvaluationContext) {
+ Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
+ if (s instanceof IStructuredSelection) {
+ Iterator<?> iter = ((IStructuredSelection) s).iterator();
+ while (iter.hasNext()) {
+ Object obj = iter.next();
+ if (obj instanceof VariableExpressionVMC) {
+ Object element = DebugPlugin.getAdapter(obj, IViewInMemory.class);
+ if (element != null) {
+ if (((IViewInMemory) element).canViewInMemory()) {
+ viewableMemoryItems.add((VariableExpressionVMC) obj);
+ }
+ }
+ }
+ }
+ }
+ }
+ return viewableMemoryItems.toArray(new VariableExpressionVMC[viewableMemoryItems.size()]);
}
private void addDefaultRenderings(IMemoryBlock memoryBlock, IMemoryRenderingSite memRendSite) {
// This method was mostly lifted from the platform's AddMemoryBlockAction
- IMemoryRenderingType primaryType = DebugUITools.getMemoryRenderingManager().getPrimaryRenderingType(memoryBlock);
- IMemoryRenderingType renderingTypes[] = DebugUITools.getMemoryRenderingManager().getDefaultRenderingTypes(memoryBlock);
+ IMemoryRenderingType primaryType = DebugUITools.getMemoryRenderingManager()
+ .getPrimaryRenderingType(memoryBlock);
+ IMemoryRenderingType renderingTypes[] = DebugUITools.getMemoryRenderingManager()
+ .getDefaultRenderingTypes(memoryBlock);
try {
if (primaryType != null) {
- createRenderingInContainer(memoryBlock, memRendSite,
- primaryType, IDebugUIConstants.ID_RENDERING_VIEW_PANE_1);
+ createRenderingInContainer(memoryBlock, memRendSite, primaryType,
+ IDebugUIConstants.ID_RENDERING_VIEW_PANE_1);
} else if (renderingTypes.length > 0) {
primaryType = renderingTypes[0];
- createRenderingInContainer(memoryBlock, memRendSite,
- renderingTypes[0],
+ createRenderingInContainer(memoryBlock, memRendSite, renderingTypes[0],
IDebugUIConstants.ID_RENDERING_VIEW_PANE_1);
}
} catch (CoreException e) {
@@ -151,8 +152,7 @@ public class DsfViewMemoryHandler extends AbstractHandler {
create = false;
}
if (create)
- createRenderingInContainer(memoryBlock, memRendSite,
- renderingTypes[i],
+ createRenderingInContainer(memoryBlock, memRendSite, renderingTypes[i],
IDebugUIConstants.ID_RENDERING_VIEW_PANE_2);
} catch (CoreException e) {
DsfUIPlugin.logErrorMessage(e.getMessage());
@@ -160,9 +160,8 @@ public class DsfViewMemoryHandler extends AbstractHandler {
}
}
- private void createRenderingInContainer(IMemoryBlock memoryBlock,
- IMemoryRenderingSite memRendSite, IMemoryRenderingType primaryType,
- String paneId) throws CoreException {
+ private void createRenderingInContainer(IMemoryBlock memoryBlock, IMemoryRenderingSite memRendSite,
+ IMemoryRenderingType primaryType, String paneId) throws CoreException {
// This method was mostly lifted from the platform's AddMemoryBlockAction
@@ -178,21 +177,20 @@ public class DsfViewMemoryHandler extends AbstractHandler {
addDefaultRenderings(memBlock, memRendSite);
}
- private IStatus showExpressionInMemoryView(VariableExpressionVMC context, IExpressionDMData exprData,
+ private IStatus showExpressionInMemoryView(VariableExpressionVMC context, IExpressionDMData exprData,
IMemoryRenderingSite memRendSite) {
- BasicType type = exprData.getBasicType();
- String exprString;
- if (type == BasicType.array || type == BasicType.pointer) {
- exprString = context.getExpression();
- }
- else {
- exprString = "&(" + context.getExpression() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- try {
+ BasicType type = exprData.getBasicType();
+ String exprString;
+ if (type == BasicType.array || type == BasicType.pointer) {
+ exprString = context.getExpression();
+ } else {
+ exprString = "&(" + context.getExpression() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ try {
IDMContext dmc = context.getDMContext();
IMemoryBlockRetrieval retrieval = (IMemoryBlockRetrieval) context.getAdapter(IMemoryBlockRetrieval.class);
if (retrieval == null && context instanceof IDebugElement)
- retrieval = ((IDebugElement)context).getDebugTarget();
+ retrieval = ((IDebugElement) context).getDebugTarget();
if (retrieval == null || !(retrieval instanceof IMemoryBlockRetrievalExtension))
return Status.OK_STATUS;
IMemoryBlockRetrievalExtension dsfRetrieval = (IMemoryBlockRetrievalExtension) retrieval;
@@ -210,7 +208,8 @@ public class DsfViewMemoryHandler extends AbstractHandler {
IViewPart memoryView = page.showView(IDebugUIConstants.ID_MEMORY_VIEW, null, IWorkbenchPage.VIEW_ACTIVATE);
final IMemoryRenderingSite memRendSite = (IMemoryRenderingSite) memoryView;
for (final VariableExpressionVMC context : contexts) {
- final IExpressionDMContext dmc = DMContexts.getAncestorOfType(context.getDMContext(), IExpressionDMContext.class);
+ final IExpressionDMContext dmc = DMContexts.getAncestorOfType(context.getDMContext(),
+ IExpressionDMContext.class);
if (dmc == null) {
continue;
}
@@ -225,7 +224,8 @@ public class DsfViewMemoryHandler extends AbstractHandler {
executor.execute(new DsfRunnable() {
@Override
public void run() {
- DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), session.getId());
+ DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(),
+ session.getId());
IExpressions service = tracker.getService(IExpressions.class);
tracker.dispose();
if (service != null) {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/MessagesForVMActions.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/MessagesForVMActions.java
index 332660331d1..0c8b567f048 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/MessagesForVMActions.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/MessagesForVMActions.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems, Inc. - initial API and implementation
*******************************************************************************/
@@ -17,19 +17,20 @@ package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions;
import org.eclipse.osgi.util.NLS;
public class MessagesForVMActions extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions.messages"; //$NON-NLS-1$
- public static String RetargetDebugContextAction_ErrorDialog_title;
- public static String RetargetDebugContextAction_ErrorDialog_message;
-
- public static String UpdatePoliciesContribution_EmptyPoliciesList_label;
- public static String UpdateScopesContribution_EmptyScopesList_label;
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions.messages"; //$NON-NLS-1$
+
+ public static String RetargetDebugContextAction_ErrorDialog_title;
+ public static String RetargetDebugContextAction_ErrorDialog_message;
+
+ public static String UpdatePoliciesContribution_EmptyPoliciesList_label;
+ public static String UpdateScopesContribution_EmptyScopesList_label;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, MessagesForVMActions.class);
- }
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, MessagesForVMActions.class);
+ }
- private MessagesForVMActions() {}
+ private MessagesForVMActions() {
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshActionDelegate.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshActionDelegate.java
index d1f6843c60c..d763320b68f 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshActionDelegate.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshActionDelegate.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
- * Texas Instruments - Bug 340478
+ * Texas Instruments - Bug 340478
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions;
@@ -24,36 +24,36 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewPart;
/**
- *
+ *
*/
public class RefreshActionDelegate extends AbstractVMProviderActionDelegate {
- @Override
+ @Override
public void run(IAction action) {
- IVMProvider provider = VMHandlerUtils.getVMProviderForPart(getView());
- if (provider instanceof ICachingVMProvider) {
- ((ICachingVMProvider)provider).refresh();
- }
- }
-
- @Override
- public void init(IViewPart view) {
- super.init(view);
- IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
- getAction().setEnabled(vp instanceof ICachingVMProvider);
- }
-
- @Override
- public void debugContextChanged(DebugContextEvent event) {
- super.debugContextChanged(event);
- IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
- getAction().setEnabled(vp instanceof ICachingVMProvider);
- }
+ IVMProvider provider = VMHandlerUtils.getVMProviderForPart(getView());
+ if (provider instanceof ICachingVMProvider) {
+ ((ICachingVMProvider) provider).refresh();
+ }
+ }
+
+ @Override
+ public void init(IViewPart view) {
+ super.init(view);
+ IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
+ getAction().setEnabled(vp instanceof ICachingVMProvider);
+ }
+
+ @Override
+ public void debugContextChanged(DebugContextEvent event) {
+ super.debugContextChanged(event);
+ IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
+ getAction().setEnabled(vp instanceof ICachingVMProvider);
+ }
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- super.selectionChanged(action, selection);
- IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
- getAction().setEnabled(vp instanceof ICachingVMProvider);
- }
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ super.selectionChanged(action, selection);
+ IVMProvider vp = VMHandlerUtils.getVMProviderForPart(getView());
+ getAction().setEnabled(vp instanceof ICachingVMProvider);
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshAllRetargetAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshAllRetargetAction.java
index 0ec7109b675..b6d74484c00 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshAllRetargetAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshAllRetargetAction.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -18,23 +18,23 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.ISelection;
/**
- *
+ *
*/
public class RefreshAllRetargetAction extends RetargetDebugContextAction {
- @Override
- protected boolean canPerformAction(Object target, ISelection selection) {
- return true;
- }
+ @Override
+ protected boolean canPerformAction(Object target, ISelection selection) {
+ return true;
+ }
- @Override
- protected Class<?> getAdapterClass() {
- return IRefreshAllTarget.class;
- }
+ @Override
+ protected Class<?> getAdapterClass() {
+ return IRefreshAllTarget.class;
+ }
- @Override
- protected void performAction(Object target, ISelection debugContext) throws CoreException {
- ((IRefreshAllTarget)target).refresh(debugContext);
- }
+ @Override
+ protected void performAction(Object target, ISelection debugContext) throws CoreException {
+ ((IRefreshAllTarget) target).refresh(debugContext);
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshHandler.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshHandler.java
index f9fd2d8f4e7..a9d37a53cf2 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshHandler.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshHandler.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -20,16 +20,16 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-public class RefreshHandler extends AbstractHandler {
+public class RefreshHandler extends AbstractHandler {
- @Override
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IVMProvider vmProvider = VMHandlerUtils.getActiveVMProvider(event);
-
- if (vmProvider instanceof ICachingVMProvider) {
- ((ICachingVMProvider)vmProvider).refresh();
- }
-
- return null;
- }
+ IVMProvider vmProvider = VMHandlerUtils.getActiveVMProvider(event);
+
+ if (vmProvider instanceof ICachingVMProvider) {
+ ((ICachingVMProvider) vmProvider).refresh();
+ }
+
+ return null;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RetargetDebugContextAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RetargetDebugContextAction.java
index c472227b201..080113fa5b3 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RetargetDebugContextAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RetargetDebugContextAction.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems, Inc. - initial implementation
*******************************************************************************/
@@ -34,128 +34,130 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
* Base class for actions which delegate functionality to an adapter retrieved
* from the current debug context.
- *
+ *
* @since 1.1
*/
-abstract public class RetargetDebugContextAction implements IWorkbenchWindowActionDelegate, IDebugContextListener, IActionDelegate2 {
-
- private IWorkbenchWindow fWindow = null;
- private IAction fAction = null;
- private ISelection fDebugContext;
- private Object fTargetAdapter = null;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void init(IWorkbenchWindow window) {
- fWindow = window;
- IDebugContextService debugContextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
- debugContextService.addPostDebugContextListener(this);
- fDebugContext = debugContextService.getActiveContext();
- update();
- }
+abstract public class RetargetDebugContextAction
+ implements IWorkbenchWindowActionDelegate, IDebugContextListener, IActionDelegate2 {
+
+ private IWorkbenchWindow fWindow = null;
+ private IAction fAction = null;
+ private ISelection fDebugContext;
+ private Object fTargetAdapter = null;
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public void init(IWorkbenchWindow window) {
+ fWindow = window;
+ IDebugContextService debugContextService = DebugUITools.getDebugContextManager().getContextService(fWindow);
+ debugContextService.addPostDebugContextListener(this);
+ fDebugContext = debugContextService.getActiveContext();
+ update();
+ }
- @Override
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
- if (fAction != action) {
- fAction = action;
- }
- // Update on debug context changed events
- }
-
- @Override
+ if (fAction != action) {
+ fAction = action;
+ }
+ // Update on debug context changed events
+ }
+
+ @Override
public void runWithEvent(IAction action, Event event) {
- run(action);
- }
-
- @Override
+ run(action);
+ }
+
+ @Override
public void run(IAction action) {
- if (fTargetAdapter != null) {
- try {
- performAction(fTargetAdapter, fDebugContext);
- } catch (CoreException e) {
- ErrorDialog.openError(fWindow.getShell(), MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_title, MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_message, e.getStatus());
- }
- }
- }
-
- /**
- * Returns whether the specific operation is supported.
- *
- * @param target the target adapter
- * @param selection the selection to verify the operation on
- * @param part the part the operation has been requested on
- * @return whether the operation can be performed
- */
- protected abstract boolean canPerformAction(Object target, ISelection debugContext);
-
- /**
- * Performs the specific breakpoint toggling.
- *
- * @param selection selection in the active part
- * @param part active part
- * @throws CoreException if an exception occurrs
- */
- protected abstract void performAction(Object target, ISelection debugContext) throws CoreException;
-
- /**
- * Returns the type of adapter (target) this action works on.
- *
- * @return the type of adapter this action works on
- */
- protected abstract Class<?> getAdapterClass();
-
- @Override
+ if (fTargetAdapter != null) {
+ try {
+ performAction(fTargetAdapter, fDebugContext);
+ } catch (CoreException e) {
+ ErrorDialog.openError(fWindow.getShell(),
+ MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_title,
+ MessagesForVMActions.RetargetDebugContextAction_ErrorDialog_message, e.getStatus());
+ }
+ }
+ }
+
+ /**
+ * Returns whether the specific operation is supported.
+ *
+ * @param target the target adapter
+ * @param selection the selection to verify the operation on
+ * @param part the part the operation has been requested on
+ * @return whether the operation can be performed
+ */
+ protected abstract boolean canPerformAction(Object target, ISelection debugContext);
+
+ /**
+ * Performs the specific breakpoint toggling.
+ *
+ * @param selection selection in the active part
+ * @param part active part
+ * @throws CoreException if an exception occurrs
+ */
+ protected abstract void performAction(Object target, ISelection debugContext) throws CoreException;
+
+ /**
+ * Returns the type of adapter (target) this action works on.
+ *
+ * @return the type of adapter this action works on
+ */
+ protected abstract Class<?> getAdapterClass();
+
+ @Override
public void init(IAction action) {
- fAction = action;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- if (fAction == null) {
- return;
- }
- fTargetAdapter = null;
- if (fDebugContext instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) fDebugContext;
- if (!ss.isEmpty()) {
- Object object = ss.getFirstElement();
- if (object instanceof IAdaptable) {
- fTargetAdapter = getAdapter((IAdaptable) object);
- if (fTargetAdapter != null) {
- fAction.setEnabled(canPerformAction(fTargetAdapter, fDebugContext));
- return;
- }
- }
- }
- }
- fAction.setEnabled(false);
- }
-
- @Override
+ fAction = action;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ */
+ public void update() {
+ if (fAction == null) {
+ return;
+ }
+ fTargetAdapter = null;
+ if (fDebugContext instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) fDebugContext;
+ if (!ss.isEmpty()) {
+ Object object = ss.getFirstElement();
+ if (object instanceof IAdaptable) {
+ fTargetAdapter = getAdapter((IAdaptable) object);
+ if (fTargetAdapter != null) {
+ fAction.setEnabled(canPerformAction(fTargetAdapter, fDebugContext));
+ return;
+ }
+ }
+ }
+ }
+ fAction.setEnabled(false);
+ }
+
+ @Override
public void dispose() {
- DebugUITools.getDebugContextManager().getContextService(fWindow).removePostDebugContextListener(this);
- fTargetAdapter = null;
- }
-
- @Override
+ DebugUITools.getDebugContextManager().getContextService(fWindow).removePostDebugContextListener(this);
+ fTargetAdapter = null;
+ }
+
+ @Override
public void debugContextChanged(DebugContextEvent event) {
- fDebugContext = event.getContext();
- update();
- }
-
- protected Object getAdapter(IAdaptable adaptable) {
- Object adapter = adaptable.getAdapter(getAdapterClass());
- if (adapter == null) {
- IAdapterManager adapterManager = Platform.getAdapterManager();
- if (adapterManager.hasAdapter(adaptable, getAdapterClass().getName())) {
- adapter = adapterManager.loadAdapter(adaptable, getAdapterClass().getName());
- }
- }
- return adapter;
- }
+ fDebugContext = event.getContext();
+ update();
+ }
+
+ protected Object getAdapter(IAdaptable adaptable) {
+ Object adapter = adaptable.getAdapter(getAdapterClass());
+ if (adapter == null) {
+ IAdapterManager adapterManager = Platform.getAdapterManager();
+ if (adapterManager.hasAdapter(adaptable, getAdapterClass().getName())) {
+ adapter = adapterManager.loadAdapter(adaptable, getAdapterClass().getName());
+ }
+ }
+ return adapter;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesContribution.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesContribution.java
index 46ba8019fbc..6aef69cc9c7 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesContribution.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesContribution.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -32,83 +32,83 @@ import org.eclipse.ui.menus.IWorkbenchContribution;
import org.eclipse.ui.services.IServiceLocator;
/**
- * Dynamic menu contribution that shows available update policies
+ * Dynamic menu contribution that shows available update policies
* in the current view.
- *
+ *
* @since 1.1
*/
public class UpdatePoliciesContribution extends CompoundContributionItem implements IWorkbenchContribution {
-
- private class SelectUpdatePolicyAction extends Action {
- private final ICachingVMProvider fProvider;
- private final IVMUpdatePolicy fPolicy;
- SelectUpdatePolicyAction(ICachingVMProvider provider, IVMUpdatePolicy policy) {
- super(policy.getName(), AS_RADIO_BUTTON);
- fProvider = provider;
- fPolicy = policy;
- }
-
- @Override
- public void run() {
- if (isChecked()) {
- fProvider.setActiveUpdatePolicy(fPolicy);
- }
- }
- }
-
- private IServiceLocator fServiceLocator;
-
- private static IContributionItem[] NO_UPDATE_POLICIES_CONTRIBUTION_ITEMS = new IContributionItem[] {
- new ContributionItem() {
- @Override
- public void fill(Menu menu, int index) {
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setEnabled(false);
- item.setText(MessagesForVMActions.UpdatePoliciesContribution_EmptyPoliciesList_label);
+
+ private class SelectUpdatePolicyAction extends Action {
+ private final ICachingVMProvider fProvider;
+ private final IVMUpdatePolicy fPolicy;
+
+ SelectUpdatePolicyAction(ICachingVMProvider provider, IVMUpdatePolicy policy) {
+ super(policy.getName(), AS_RADIO_BUTTON);
+ fProvider = provider;
+ fPolicy = policy;
+ }
+
+ @Override
+ public void run() {
+ if (isChecked()) {
+ fProvider.setActiveUpdatePolicy(fPolicy);
}
-
- @Override
- public boolean isEnabled() {
- return false;
+ }
+ }
+
+ private IServiceLocator fServiceLocator;
+
+ private static IContributionItem[] NO_UPDATE_POLICIES_CONTRIBUTION_ITEMS = new IContributionItem[] {
+ new ContributionItem() {
+ @Override
+ public void fill(Menu menu, int index) {
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setEnabled(false);
+ item.setText(MessagesForVMActions.UpdatePoliciesContribution_EmptyPoliciesList_label);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return false;
+ }
+ } };
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IVMProvider provider = VMHandlerUtils.getActiveVMProvider(fServiceLocator);
+
+ // If no part or selection, disable all.
+ if (provider == null || !(provider instanceof ICachingVMProvider)) {
+ return NO_UPDATE_POLICIES_CONTRIBUTION_ITEMS;
+ }
+ ICachingVMProvider cachingProvider = (ICachingVMProvider) provider;
+
+ IVMUpdatePolicy[] policies = cachingProvider.getAvailableUpdatePolicies();
+ IVMUpdatePolicy activePolicy = cachingProvider.getActiveUpdatePolicy();
+
+ List<Action> actions = new ArrayList<Action>(policies.length);
+ for (IVMUpdatePolicy policy : policies) {
+ Action action = new SelectUpdatePolicyAction(cachingProvider, policy);
+ if (policy.getID().equals(activePolicy.getID())) {
+ action.setChecked(true);
}
- }
- };
-
- @Override
- protected IContributionItem[] getContributionItems() {
- IVMProvider provider = VMHandlerUtils.getActiveVMProvider(fServiceLocator);
-
- // If no part or selection, disable all.
- if (provider == null || !(provider instanceof ICachingVMProvider)) {
- return NO_UPDATE_POLICIES_CONTRIBUTION_ITEMS;
- }
- ICachingVMProvider cachingProvider = (ICachingVMProvider)provider;
-
- IVMUpdatePolicy[] policies = cachingProvider.getAvailableUpdatePolicies();
- IVMUpdatePolicy activePolicy = cachingProvider.getActiveUpdatePolicy();
-
- List<Action> actions = new ArrayList<Action>(policies.length);
- for (IVMUpdatePolicy policy : policies) {
- Action action = new SelectUpdatePolicyAction(cachingProvider, policy);
- if (policy.getID().equals(activePolicy.getID())) {
- action.setChecked(true);
- }
- actions.add(action);
- }
-
- if ( actions.isEmpty() ) {
- return NO_UPDATE_POLICIES_CONTRIBUTION_ITEMS;
- }
-
- IContributionItem[] items = new IContributionItem[actions.size()];
- for (int i = 0; i < actions.size(); i++) {
- items[i] = new ActionContributionItem(actions.get(i));
- }
- return items;
- }
-
- @Override
+ actions.add(action);
+ }
+
+ if (actions.isEmpty()) {
+ return NO_UPDATE_POLICIES_CONTRIBUTION_ITEMS;
+ }
+
+ IContributionItem[] items = new IContributionItem[actions.size()];
+ for (int i = 0; i < actions.size(); i++) {
+ items[i] = new ActionContributionItem(actions.get(i));
+ }
+ return items;
+ }
+
+ @Override
public void initialize(IServiceLocator serviceLocator) {
- fServiceLocator = serviceLocator;
- }
+ fServiceLocator = serviceLocator;
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesPropertyTester.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesPropertyTester.java
index 6349e50a28c..1ec52a98330 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesPropertyTester.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/UpdatePoliciesPropertyTester.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
@@ -23,60 +23,60 @@ import org.eclipse.debug.ui.IDebugView;
import org.eclipse.ui.IWorkbenchPart;
/**
- * Property tester for update policy information available through the given
- * object. The object being tested should be either an {@link IVMContext},
+ * Property tester for update policy information available through the given
+ * object. The object being tested should be either an {@link IVMContext},
* through which an instance of {@link ICachingVMProvider} could be obtained.
* Or it could be an {@link IWorkbenchPart}, which is tested to see if it
- * is a debug view through which a caching VM provider can be obtained.
+ * is a debug view through which a caching VM provider can be obtained.
* The Caching View Model provider is used to test the given property.
* <p>
* Three properties are supported:
* <ul>
- * <li> "areUpdatePoliciesSupported" - Checks whether update policies are
+ * <li> "areUpdatePoliciesSupported" - Checks whether update policies are
* available at all given the receiver.</li>
- * <li> "isUpdatePolicyAvailable" - Checks whether the update policy in the
+ * <li> "isUpdatePolicyAvailable" - Checks whether the update policy in the
* expected value is available for the given receiver.</li>
- * <li> "isUpdatePolicyActive" - Checks whether the policy given in the expected
+ * <li> "isUpdatePolicyActive" - Checks whether the policy given in the expected
* value is the currently active policy for the given receiver.</li>
* </ul>
* </p>
*/
public class UpdatePoliciesPropertyTester extends PropertyTester {
- private static final String SUPPORTED = "areUpdatePoliciesSupported"; //$NON-NLS-1$
- private static final String AVAILABLE = "isUpdatePolicyAvailable"; //$NON-NLS-1$
- private static final String ACTIVE = "isUpdatePolicyActive"; //$NON-NLS-1$
+ private static final String SUPPORTED = "areUpdatePoliciesSupported"; //$NON-NLS-1$
+ private static final String AVAILABLE = "isUpdatePolicyAvailable"; //$NON-NLS-1$
+ private static final String ACTIVE = "isUpdatePolicyActive"; //$NON-NLS-1$
- @Override
+ @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof IVMContext) {
- IVMProvider provider = ((IVMContext)receiver).getVMNode().getVMProvider();
- if (provider instanceof ICachingVMProvider) {
- return testProvider((ICachingVMProvider)provider, property, expectedValue);
- }
- } else if (receiver instanceof IDebugView) {
- IVMProvider provider = VMHandlerUtils.getVMProviderForPart((IDebugView)receiver);
- if (provider instanceof ICachingVMProvider) {
- return testProvider((ICachingVMProvider)provider, property, expectedValue);
- }
- }
- return false;
- }
+ if (receiver instanceof IVMContext) {
+ IVMProvider provider = ((IVMContext) receiver).getVMNode().getVMProvider();
+ if (provider instanceof ICachingVMProvider) {
+ return testProvider((ICachingVMProvider) provider, property, expectedValue);
+ }
+ } else if (receiver instanceof IDebugView) {
+ IVMProvider provider = VMHandlerUtils.getVMProviderForPart((IDebugView) receiver);
+ if (provider instanceof ICachingVMProvider) {
+ return testProvider((ICachingVMProvider) provider, property, expectedValue);
+ }
+ }
+ return false;
+ }
+
+ private boolean testProvider(ICachingVMProvider provider, String property, Object expectedValue) {
+ if (SUPPORTED.equals(property)) {
+ return true;
+ } else if (AVAILABLE.equals(property)) {
+ for (IVMUpdatePolicy policy : provider.getAvailableUpdatePolicies()) {
+ if (policy.getID().equals(expectedValue)) {
+ return true;
+ }
+ return false;
+ }
+ } else if (ACTIVE.equals(property)) {
+ return expectedValue != null && expectedValue.equals(provider.getActiveUpdatePolicy().getID());
+ }
+ return false;
+ }
- private boolean testProvider(ICachingVMProvider provider, String property, Object expectedValue) {
- if (SUPPORTED.equals(property)) {
- return true;
- } else if (AVAILABLE.equals(property)) {
- for (IVMUpdatePolicy policy : provider.getAvailableUpdatePolicies()) {
- if (policy.getID().equals(expectedValue)) {
- return true;
- }
- return false;
- }
- } else if (ACTIVE.equals(property)) {
- return expectedValue != null && expectedValue.equals(provider.getActiveUpdatePolicy().getID());
- }
- return false;
- }
-
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java
index 2b2b1af34f8..d0887300707 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Wind River Systems, Inc. - extended implementation
@@ -22,22 +22,22 @@ import org.eclipse.ui.PlatformUI;
/**
* Opens a dialog so that the user can enter the maximum length in characters that
* the detail pane should display.
- *
+ *
* @see DetailPaneMaxLengthDialog
* @since 3.0
*/
public class DetailPaneMaxLengthAction extends Action {
-
+
private Shell fDialogShell;
-
- public DetailPaneMaxLengthAction(Shell dialogShell){
+
+ public DetailPaneMaxLengthAction(Shell dialogShell) {
super(MessagesForDetailPane.PaneMaxLengthAction_MaxLength);
fDialogShell = dialogShell;
-
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugHelpContextIds.DETAIL_PANE_MAX_LENGTH_ACTION);
-
+
}
-
+
@Override
public void run() {
DetailPaneMaxLengthDialog dialog = new DetailPaneMaxLengthDialog(fDialogShell);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java
index dc28b9b7130..37312cc133d 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java
@@ -7,9 +7,9 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
* Wind River Systems, Inc. - extended implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport;
@@ -34,43 +34,44 @@ import org.eclipse.ui.PlatformUI;
/**
* Provides a dialog for changing the maximum length allowed in the detail pane
- *
+ *
* @since 3.0
*/
public class DetailPaneMaxLengthDialog extends TrayDialog {
private static final String SETTINGS_ID = DsfUIPlugin.PLUGIN_ID + ".MAX_DETAILS_LENGTH_DIALOG"; //$NON-NLS-1$
-
+
private Text fTextWidget;
private Text fErrorTextWidget;
private String fErrorMessage;
private String fValue;
private IInputValidator fValidator;
-
+
/**
* Constructs a new dialog on the given shell.
- *
+ *
* @param parent shell
*/
public DetailPaneMaxLengthDialog(Shell parent) {
super(parent);
setShellStyle(getShellStyle() | SWT.RESIZE);
- fValue = Integer.toString(DsfUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH));
+ fValue = Integer.toString(
+ DsfUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH));
fValidator = new IInputValidator() {
- @Override
- public String isValid(String newText) {
- try {
- int num = Integer.parseInt(newText);
- if (num < 0) {
- return MessagesForDetailPane.PaneMaxLengthDialog_IntegerCannotBeNegative;
- }
- } catch (NumberFormatException e) {
- return MessagesForDetailPane.PaneMaxLengthDialog_EnterAnInteger;
- }
- return null;
+ @Override
+ public String isValid(String newText) {
+ try {
+ int num = Integer.parseInt(newText);
+ if (num < 0) {
+ return MessagesForDetailPane.PaneMaxLengthDialog_IntegerCannotBeNegative;
}
-
- };
+ } catch (NumberFormatException e) {
+ return MessagesForDetailPane.PaneMaxLengthDialog_EnterAnInteger;
+ }
+ return null;
+ }
+
+ };
}
/* (non-Javadoc)
@@ -82,10 +83,10 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
IDialogSettings section = settings.getSection(SETTINGS_ID);
if (section == null) {
section = settings.addNewSection(SETTINGS_ID);
- }
+ }
return section;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite)
*/
@@ -93,7 +94,8 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
protected Control createContents(Composite parent) {
getShell().setText(MessagesForDetailPane.PaneMaxLengthDialog_ConfigureDetails);
Control contents = super.createContents(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(), IDsfDebugHelpContextIds.DETAIL_PANE_MAX_LENGTH_ACTION);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(),
+ IDsfDebugHelpContextIds.DETAIL_PANE_MAX_LENGTH_ACTION);
return contents;
}
@@ -102,30 +104,30 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
*/
@Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- Label label = new Label(composite, SWT.WRAP);
- label.setText(MessagesForDetailPane.PaneMaxLengthDialog_MaxCharactersToDisplay);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(parent.getFont());
- fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
- fTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- fTextWidget.setText(fValue);
- fTextWidget.addModifyListener(new ModifyListener() {
- @Override
+ Composite composite = (Composite) super.createDialogArea(parent);
+ Label label = new Label(composite, SWT.WRAP);
+ label.setText(MessagesForDetailPane.PaneMaxLengthDialog_MaxCharactersToDisplay);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ label.setLayoutData(data);
+ label.setFont(parent.getFont());
+ fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ fTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ fTextWidget.setText(fValue);
+ fTextWidget.addModifyListener(new ModifyListener() {
+ @Override
public void modifyText(ModifyEvent e) {
- validateInput();
- fValue = fTextWidget.getText();
- }
- });
- fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
- fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL));
- fErrorTextWidget.setBackground(fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- setErrorMessage(fErrorMessage);
- applyDialogFont(composite);
- return composite;
+ validateInput();
+ fValue = fTextWidget.getText();
+ }
+ });
+ fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
+ fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ fErrorTextWidget.setBackground(fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ setErrorMessage(fErrorMessage);
+ applyDialogFont(composite);
+ return composite;
}
/* (non-Javadoc)
@@ -135,52 +137,52 @@ public class DetailPaneMaxLengthDialog extends TrayDialog {
protected void okPressed() {
String text = getValue();
try {
- DsfUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, Integer.parseInt(text));
- }
- catch (NumberFormatException e) {
+ DsfUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH,
+ Integer.parseInt(text));
+ } catch (NumberFormatException e) {
DsfUIPlugin.log(e);
}
super.okPressed();
}
-
+
+ /**
+ * Returns the string typed into this input dialog.
+ *
+ * @return the input string
+ * @since 3.3
+ */
+ public String getValue() {
+ return fValue;
+ }
+
+ /**
+ * Validates the current input
+ * @since 3.3
+ */
+ private void validateInput() {
+ String errorMessage = null;
+ if (fValidator != null) {
+ errorMessage = fValidator.isValid(fTextWidget.getText());
+ }
+ setErrorMessage(errorMessage);
+ }
+
/**
- * Returns the string typed into this input dialog.
- *
- * @return the input string
- * @since 3.3
- */
- public String getValue() {
- return fValue;
- }
-
- /**
- * Validates the current input
- * @since 3.3
- */
- private void validateInput() {
- String errorMessage = null;
- if (fValidator != null) {
- errorMessage = fValidator.isValid(fTextWidget.getText());
- }
- setErrorMessage(errorMessage);
- }
-
- /**
- * Sets the current error message or none if null
- * @param errorMessage
- * @since 3.3
- */
- public void setErrorMessage(String errorMessage) {
- fErrorMessage = errorMessage;
- if (fErrorTextWidget != null && !fErrorTextWidget.isDisposed()) {
- fErrorTextWidget.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
- fErrorTextWidget.getParent().update();
- // Access the ok button by id, in case clients have overridden button creation.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
- Control button = getButton(IDialogConstants.OK_ID);
- if (button != null) {
- button.setEnabled(errorMessage == null);
- }
- }
- }
+ * Sets the current error message or none if null
+ * @param errorMessage
+ * @since 3.3
+ */
+ public void setErrorMessage(String errorMessage) {
+ fErrorMessage = errorMessage;
+ if (fErrorTextWidget != null && !fErrorTextWidget.isDisposed()) {
+ fErrorTextWidget.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
+ fErrorTextWidget.getParent().update();
+ // Access the ok button by id, in case clients have overridden button creation.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
+ Control button = getButton(IDialogConstants.OK_ID);
+ if (button != null) {
+ button.setEnabled(errorMessage == null);
+ }
+ }
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java
index 249e08ddcbf..717cc7ab33b 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Wind River Systems, Inc. - extended implementation
@@ -29,30 +29,31 @@ import org.eclipse.ui.PlatformUI;
public class DetailPaneWordWrapAction extends Action {
ITextViewer fTextViewer;
-
+
public DetailPaneWordWrapAction(ITextViewer textViewer) {
- super(MessagesForDetailPane.PaneWordWrapAction_WrapText,IAction.AS_CHECK_BOX);
-
+ super(MessagesForDetailPane.PaneWordWrapAction_WrapText, IAction.AS_CHECK_BOX);
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugHelpContextIds.DETAIL_PANE_WORD_WRAP_ACTION);
-
+
fTextViewer = textViewer;
setEnabled(true);
-
- boolean prefSetting = DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP);
+
+ boolean prefSetting = DsfUIPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP);
fTextViewer.getTextWidget().setWordWrap(prefSetting);
setChecked(prefSetting);
-
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
fTextViewer.getTextWidget().setWordWrap(isChecked());
- DsfUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP,isChecked());
+ DsfUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP,
+ isChecked());
DsfUIPlugin.getDefault().savePluginPreferences();
}
-
+
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java
index 8f7868592e6..5540996ef85 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Wind River Systems, Inc. - extended implementation
@@ -18,23 +18,23 @@ package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.detailsupport;
import org.eclipse.osgi.util.NLS;
public class MessagesForDetailPane extends NLS {
- public static String NumberFormatDetailPane_Name;
- public static String NumberFormatDetailPane_Description;
+ public static String NumberFormatDetailPane_Name;
+ public static String NumberFormatDetailPane_Description;
public static String DetailPane_Copy;
public static String DetailPane_LabelPattern;
public static String DetailPane_Select_All;
- public static String PaneWordWrapAction_WrapText;
- public static String PaneMaxLengthAction_MaxLength;
- public static String PaneMaxLengthDialog_ConfigureDetails;
+ public static String PaneWordWrapAction_WrapText;
+ public static String PaneMaxLengthAction_MaxLength;
+ public static String PaneMaxLengthDialog_ConfigureDetails;
public static String PaneMaxLengthDialog_MaxCharactersToDisplay;
public static String PaneMaxLengthDialog_IntegerCannotBeNegative;
public static String PaneMaxLengthDialog_EnterAnInteger;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(MessagesForDetailPane.class.getName(), MessagesForDetailPane.class);
- }
- private MessagesForDetailPane() {
- }
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(MessagesForDetailPane.class.getName(), MessagesForDetailPane.class);
+ }
+
+ private MessagesForDetailPane() {
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/TextViewerAction.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/TextViewerAction.java
index 8132694cbc7..98ec5207d2f 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/TextViewerAction.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/detailsupport/TextViewerAction.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Wind River Systems, Inc. - extended implementation
@@ -28,63 +28,63 @@ import org.eclipse.ui.texteditor.IUpdate;
*/
public class TextViewerAction extends Action implements IUpdate {
- private int fOperationCode= -1;
- private ITextOperationTarget fOperationTarget;
+ private int fOperationCode = -1;
+ private ITextOperationTarget fOperationTarget;
- /**
- * Constructs a new action in the given text viewer with
- * the specified operation code.
- *
- * @param viewer
- * @param operationCode
- */
- public TextViewerAction(ITextViewer viewer, int operationCode) {
- fOperationCode= operationCode;
- fOperationTarget= viewer.getTextOperationTarget();
- update();
- }
+ /**
+ * Constructs a new action in the given text viewer with
+ * the specified operation code.
+ *
+ * @param viewer
+ * @param operationCode
+ */
+ public TextViewerAction(ITextViewer viewer, int operationCode) {
+ fOperationCode = operationCode;
+ fOperationTarget = viewer.getTextOperationTarget();
+ update();
+ }
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- *
- * Updates the enabled state of the action.
- * Fires a property change if the enabled state changes.
- *
- * @see org.eclipse.jface.action.Action#firePropertyChange(String, Object, Object)
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ *
+ * Updates the enabled state of the action.
+ * Fires a property change if the enabled state changes.
+ *
+ * @see org.eclipse.jface.action.Action#firePropertyChange(String, Object, Object)
+ */
+ @Override
public void update() {
- boolean wasEnabled= isEnabled();
- boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
- setEnabled(isEnabled);
+ boolean wasEnabled = isEnabled();
+ boolean isEnabled = (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
+ setEnabled(isEnabled);
- if (wasEnabled != isEnabled) {
- firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- @Override
- public void run() {
- if (fOperationCode != -1 && fOperationTarget != null) {
- fOperationTarget.doOperation(fOperationCode);
- }
- }
-
- /**
- * Configures this action with a label, tool tip, and description.
- *
- * @param text action label
- * @param toolTipText action tool tip
- * @param description action description
- */
- public void configureAction(String text, String toolTipText, String description) {
- setText(text);
- setToolTipText(toolTipText);
- setDescription(description);
- }
-}
+ if (wasEnabled != isEnabled) {
+ firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE,
+ isEnabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#run()
+ */
+ @Override
+ public void run() {
+ if (fOperationCode != -1 && fOperationTarget != null) {
+ fOperationTarget.doOperation(fOperationCode);
+ }
+ }
+
+ /**
+ * Configures this action with a label, tool tip, and description.
+ *
+ * @param text action label
+ * @param toolTipText action tool tip
+ * @param description action description
+ */
+ public void configureAction(String text, String toolTipText, String description) {
+ setText(text);
+ setToolTipText(toolTipText);
+ setDescription(description);
+ }
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java
index 3432677cbf7..e72e1d9a7a5 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetailPane.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems, Inc. - initial API and implementation
*******************************************************************************/
@@ -20,18 +20,19 @@ import org.eclipse.osgi.util.NLS;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class MessagesForNumberFormatDetailPane extends NLS {
- public static String NumberFormatDetailPane_format_separator__label;
- public static String NumberFormatDetailPane_Name_label;
- public static String NumberFormatDetailPane_Spaces_label;
- public static String NumberFormatDetailPane_CarriageReturn_label;
- public static String NumberFormatDetailPane_DotDotDot_label;
- public static String NumberFormatDetailPane__End_parentheses;
+ public static String NumberFormatDetailPane_format_separator__label;
+ public static String NumberFormatDetailPane_Name_label;
+ public static String NumberFormatDetailPane_Spaces_label;
+ public static String NumberFormatDetailPane_CarriageReturn_label;
+ public static String NumberFormatDetailPane_DotDotDot_label;
+ public static String NumberFormatDetailPane__End_parentheses;
- static {
- // initialize resource bundle
- NLS.initializeMessages(MessagesForNumberFormatDetailPane.class.getName(), MessagesForNumberFormatDetailPane.class);
- }
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(MessagesForNumberFormatDetailPane.class.getName(),
+ MessagesForNumberFormatDetailPane.class);
+ }
- private MessagesForNumberFormatDetailPane() {
- }
+ private MessagesForNumberFormatDetailPane() {
+ }
}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java
index fdc081f6496..7cb4cec91c2 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Wind River Systems, Inc. - extended implementation
@@ -101,732 +101,753 @@ import org.eclipse.ui.texteditor.IUpdate;
public class NumberFormatDetailPane implements IDetailPane2, IAdaptable, IPropertyChangeListener {
- /**
- * The <code>IWorkbenchPartSite</code> that the details area (and the
- * variables view) belongs to.
- */
- private IWorkbenchPartSite fWorkbenchPartSite;
-
- /**
- * Map of actions. Keys are strings, values
- * are <code>IAction</code>.
- */
- private Map<String, IAction> fActionMap = new HashMap<String, IAction>();
-
- /**
- * Collection to track actions that should be updated when selection occurs.
- */
- private List<String> fSelectionActions = new ArrayList<String>();
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPane#init(org.eclipse.ui.IWorkbenchPartSite)
- */
- @Override
+ /**
+ * The <code>IWorkbenchPartSite</code> that the details area (and the
+ * variables view) belongs to.
+ */
+ private IWorkbenchPartSite fWorkbenchPartSite;
+
+ /**
+ * Map of actions. Keys are strings, values
+ * are <code>IAction</code>.
+ */
+ private Map<String, IAction> fActionMap = new HashMap<String, IAction>();
+
+ /**
+ * Collection to track actions that should be updated when selection occurs.
+ */
+ private List<String> fSelectionActions = new ArrayList<String>();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#init(org.eclipse.ui.IWorkbenchPartSite)
+ */
+ @Override
public void init(IWorkbenchPartSite workbench) {
- fWorkbenchPartSite = workbench;
-
- }
-
- /**
- * Adds an action to the Map storing actions. Removes it if action is null.
- *
- * @param actionID The ID of the action, used as the key in the Map
- * @param action The action associated with the ID
- */
- protected void setAction(String actionID, IAction action) {
- if (action == null) {
- fActionMap.remove(actionID);
- } else {
- fActionMap.put(actionID, action);
- }
- }
-
- /**
- * Adds the given action to the global action handler for the ViewSite.
- * A call to <code>updateActionBars()</code> must be called after changes
- * to propagate changes through the workbench.
- *
- * @param actionID The ID of the action
- * @param action The action to be set globally
- */
- protected void setGlobalAction(String actionID, IAction action){
- getViewSite().getActionBars().setGlobalActionHandler(actionID, action);
- }
-
- /**
- * Adds the given action to the list of actions that will be updated when
- * <code>updateSelectionDependentActions()</code> is called. If the string
- * is null it will not be added to the list.
- *
- * @param actionID The ID of the action which should be updated
- */
- protected void setSelectionDependantAction(String actionID){
- if (actionID != null) fSelectionActions.add(actionID);
- }
-
- /**
- * Gets the action out of the map, casts it to an <code>IAction</code>
- *
- * @param actionID The ID of the action to find
- * @return The action associated with the ID or null if none is found.
- */
- protected IAction getAction(String actionID) {
- return fActionMap.get(actionID);
- }
-
- /**
- * Calls the update method of the action with the given action ID.
- * The action must exist in the action map and must be an instance of
- * </code>IUpdate</code>
- *
- * @param actionId The ID of the action to update
- */
- protected void updateAction(String actionId) {
- IAction action= getAction(actionId);
- if (action instanceof IUpdate) {
- ((IUpdate) action).update();
- }
- }
-
- /**
- * Iterates through the list of selection dependent actions and
- * updates them. Use <code>setSelectionDependentAction(String actionID)</code>
- * to add an action to the list. The action must have been added to the known
- * actions map by calling <code>setAction(String actionID, IAction action)</code>
- * before it can be updated by this method.
- */
- protected void updateSelectionDependentActions() {
- Iterator<String> iterator= fSelectionActions.iterator();
- while (iterator.hasNext()) {
- updateAction(iterator.next());
- }
- }
-
- /**
- * Gets the view site for this view. May be null if this detail pane
- * is not part of a view.
- *
- * @return The site for this view or <code>null</code>
- */
- protected IViewSite getViewSite(){
- if (fWorkbenchPartSite == null){
- return null;
- } else {
- return (IViewSite) fWorkbenchPartSite.getPart().getSite();
- }
- }
-
- /**
- * Gets the workbench part site for this view. May be null if this detail pane
- * is not part of a view.
- *
- * @return The workbench part site or <code>null</code>
- */
- protected IWorkbenchPartSite getWorkbenchPartSite() {
- return fWorkbenchPartSite;
- }
-
- /**
- * Returns whether this detail pane is being displayed in a view with a workbench part site.
- *
- * @return whether this detail pane is being displayed in a view with a workbench part site.
- */
- protected boolean isInView(){
- return fWorkbenchPartSite != null;
- }
-
- /**
- * These are the IDs for the actions in the context menu
- */
- protected static final String DETAIL_COPY_ACTION = ActionFactory.COPY.getId() + ".TextDetailPane"; //$NON-NLS-1$
- protected static final String DETAIL_SELECT_ALL_ACTION = IDebugView.SELECT_ALL_ACTION + ".TextDetailPane"; //$NON-NLS-1$
- protected static final String DETAIL_WORD_WRAP_ACTION = DsfUIPlugin.PLUGIN_ID + ".detail_pane_word_wrap"; //$NON-NLS-1$
- protected static final String DETAIL_MAX_LENGTH_ACTION = "MaxLength"; //$NON-NLS-1$
-
- /**
- * The ID, name and description of this pane are stored in constants so that the class
- * does not have to be instantiated to access them.
- */
- public static final String ID = "NumberFormatPane"; //$NON-NLS-1$
-
- /**
- * Useful shortened names for the internationalized strings.
- */
- public static String FORMAT_SEPARATOR = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_format_separator__label;
- public static String NAME = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Name_label;
- public static String SPACES = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Spaces_label;
- public static String CRLF = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_CarriageReturn_label;
- public static String DOTS = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_DotDotDot_label;
- public static String PARENTHESES = MessagesForNumberFormatDetailPane.NumberFormatDetailPane__End_parentheses;
-
- /**
- * Job to compute the details for a selection
- */
- class DetailJob extends Job implements IValueDetailListener {
- private IPresentationContext fPresentationContext;
- private Object fViewerInput;
- private ITreeSelection fElements;
- private boolean fFirst = true;
- private IProgressMonitor fMonitor;
-
- public DetailJob(IPresentationContext context, Object viewerInput, ITreeSelection elements,
- IDebugModelPresentation model)
- {
- super("compute variable details"); //$NON-NLS-1$
- setSystem(true);
- fPresentationContext = context;
- fViewerInput = viewerInput;
- fElements = elements;
- }
-
- public IProgressMonitor getDetailMonitor() {
- return fMonitor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- if ( fMonitor != null && ! fMonitor.isCanceled() ) {
- fMonitor.setCanceled(true);
- }
- fMonitor = monitor;
- TreePath[] paths = fElements.getPaths();
- for (int i = 0; i < paths.length; i++) {
- if (monitor.isCanceled()) {
- break;
- }
- final TreePath path = paths[i];
- Object element = paths[i].getLastSegment();
-
- final IElementPropertiesProvider propertiesProvider =
- (IElementPropertiesProvider)DebugPlugin.getAdapter(element, IElementPropertiesProvider.class);
-
- Display display;
- if (fWorkbenchPartSite != null) {
- display = fWorkbenchPartSite.getShell().getDisplay();
- } else {
- display = PlatformUI.getWorkbench().getDisplay();
- }
+ fWorkbenchPartSite = workbench;
+
+ }
+
+ /**
+ * Adds an action to the Map storing actions. Removes it if action is null.
+ *
+ * @param actionID The ID of the action, used as the key in the Map
+ * @param action The action associated with the ID
+ */
+ protected void setAction(String actionID, IAction action) {
+ if (action == null) {
+ fActionMap.remove(actionID);
+ } else {
+ fActionMap.put(actionID, action);
+ }
+ }
+
+ /**
+ * Adds the given action to the global action handler for the ViewSite.
+ * A call to <code>updateActionBars()</code> must be called after changes
+ * to propagate changes through the workbench.
+ *
+ * @param actionID The ID of the action
+ * @param action The action to be set globally
+ */
+ protected void setGlobalAction(String actionID, IAction action) {
+ getViewSite().getActionBars().setGlobalActionHandler(actionID, action);
+ }
+
+ /**
+ * Adds the given action to the list of actions that will be updated when
+ * <code>updateSelectionDependentActions()</code> is called. If the string
+ * is null it will not be added to the list.
+ *
+ * @param actionID The ID of the action which should be updated
+ */
+ protected void setSelectionDependantAction(String actionID) {
+ if (actionID != null)
+ fSelectionActions.add(actionID);
+ }
+
+ /**
+ * Gets the action out of the map, casts it to an <code>IAction</code>
+ *
+ * @param actionID The ID of the action to find
+ * @return The action associated with the ID or null if none is found.
+ */
+ protected IAction getAction(String actionID) {
+ return fActionMap.get(actionID);
+ }
+
+ /**
+ * Calls the update method of the action with the given action ID.
+ * The action must exist in the action map and must be an instance of
+ * </code>IUpdate</code>
+ *
+ * @param actionId The ID of the action to update
+ */
+ protected void updateAction(String actionId) {
+ IAction action = getAction(actionId);
+ if (action instanceof IUpdate) {
+ ((IUpdate) action).update();
+ }
+ }
+
+ /**
+ * Iterates through the list of selection dependent actions and
+ * updates them. Use <code>setSelectionDependentAction(String actionID)</code>
+ * to add an action to the list. The action must have been added to the known
+ * actions map by calling <code>setAction(String actionID, IAction action)</code>
+ * before it can be updated by this method.
+ */
+ protected void updateSelectionDependentActions() {
+ Iterator<String> iterator = fSelectionActions.iterator();
+ while (iterator.hasNext()) {
+ updateAction(iterator.next());
+ }
+ }
+
+ /**
+ * Gets the view site for this view. May be null if this detail pane
+ * is not part of a view.
+ *
+ * @return The site for this view or <code>null</code>
+ */
+ protected IViewSite getViewSite() {
+ if (fWorkbenchPartSite == null) {
+ return null;
+ } else {
+ return (IViewSite) fWorkbenchPartSite.getPart().getSite();
+ }
+ }
+
+ /**
+ * Gets the workbench part site for this view. May be null if this detail pane
+ * is not part of a view.
+ *
+ * @return The workbench part site or <code>null</code>
+ */
+ protected IWorkbenchPartSite getWorkbenchPartSite() {
+ return fWorkbenchPartSite;
+ }
+
+ /**
+ * Returns whether this detail pane is being displayed in a view with a workbench part site.
+ *
+ * @return whether this detail pane is being displayed in a view with a workbench part site.
+ */
+ protected boolean isInView() {
+ return fWorkbenchPartSite != null;
+ }
+
+ /**
+ * These are the IDs for the actions in the context menu
+ */
+ protected static final String DETAIL_COPY_ACTION = ActionFactory.COPY.getId() + ".TextDetailPane"; //$NON-NLS-1$
+ protected static final String DETAIL_SELECT_ALL_ACTION = IDebugView.SELECT_ALL_ACTION + ".TextDetailPane"; //$NON-NLS-1$
+ protected static final String DETAIL_WORD_WRAP_ACTION = DsfUIPlugin.PLUGIN_ID + ".detail_pane_word_wrap"; //$NON-NLS-1$
+ protected static final String DETAIL_MAX_LENGTH_ACTION = "MaxLength"; //$NON-NLS-1$
+
+ /**
+ * The ID, name and description of this pane are stored in constants so that the class
+ * does not have to be instantiated to access them.
+ */
+ public static final String ID = "NumberFormatPane"; //$NON-NLS-1$
+
+ /**
+ * Useful shortened names for the internationalized strings.
+ */
+ public static String FORMAT_SEPARATOR = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_format_separator__label;
+ public static String NAME = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Name_label;
+ public static String SPACES = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_Spaces_label;
+ public static String CRLF = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_CarriageReturn_label;
+ public static String DOTS = MessagesForNumberFormatDetailPane.NumberFormatDetailPane_DotDotDot_label;
+ public static String PARENTHESES = MessagesForNumberFormatDetailPane.NumberFormatDetailPane__End_parentheses;
+
+ /**
+ * Job to compute the details for a selection
+ */
+ class DetailJob extends Job implements IValueDetailListener {
+ private IPresentationContext fPresentationContext;
+ private Object fViewerInput;
+ private ITreeSelection fElements;
+ private boolean fFirst = true;
+ private IProgressMonitor fMonitor;
+
+ public DetailJob(IPresentationContext context, Object viewerInput, ITreeSelection elements,
+ IDebugModelPresentation model) {
+ super("compute variable details"); //$NON-NLS-1$
+ setSystem(true);
+ fPresentationContext = context;
+ fViewerInput = viewerInput;
+ fElements = elements;
+ }
+
+ public IProgressMonitor getDetailMonitor() {
+ return fMonitor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ if (fMonitor != null && !fMonitor.isCanceled()) {
+ fMonitor.setCanceled(true);
+ }
+ fMonitor = monitor;
+ TreePath[] paths = fElements.getPaths();
+ for (int i = 0; i < paths.length; i++) {
+ if (monitor.isCanceled()) {
+ break;
+ }
+ final TreePath path = paths[i];
+ Object element = paths[i].getLastSegment();
+
+ final IElementPropertiesProvider propertiesProvider = (IElementPropertiesProvider) DebugPlugin
+ .getAdapter(element, IElementPropertiesProvider.class);
+
+ Display display;
+ if (fWorkbenchPartSite != null) {
+ display = fWorkbenchPartSite.getShell().getDisplay();
+ } else {
+ display = PlatformUI.getWorkbench().getDisplay();
+ }
final Executor executor = SimpleDisplayExecutor.getSimpleDisplayExecutor(display);
- Set<String> properties = new HashSet<String>(1);
- properties.add(IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS);
- propertiesProvider.update(new IPropertiesUpdate[] { new VMPropertiesUpdate(
- properties, path, fViewerInput, fPresentationContext,
- new DataRequestMonitor<Map<String,Object>>(executor, null) {
- @Override
- protected void handleCompleted() {
-
- // Bugzilla 310191: Detail pane does not clear up when DSF-GDB session is terminated
- if (fMonitor.isCanceled())
- return;
-
- Set<String> properties = new HashSet<String>(1);
- properties.add(IElementPropertiesProvider.PROP_NAME);
- final String[] formats = (String[])getData().get(
- IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS);
- if (formats != null) {
- for (String format : formats) {
- properties.add(FormattedValueVMUtil.getPropertyForFormatId(format, null));
- }
- }
-
- propertiesProvider.update(new IPropertiesUpdate[] { new VMPropertiesUpdate(
- properties, path, fViewerInput, fPresentationContext,
- new DataRequestMonitor<Map<String,Object>>(executor, null) {
- @Override
- protected void handleSuccess() {
- StringBuilder finalResult = new StringBuilder();
- finalResult.append(NAME).append(getData().get(IElementPropertiesProvider.PROP_NAME)).append(CRLF);
-
- if (formats != null) {
- for (int i = 0; i < formats.length; i++) {
- String formatId = formats[i];
- finalResult.append(SPACES);
- finalResult.append( FormattedValueVMUtil.getFormatLabel(formatId) );
- finalResult.append(FORMAT_SEPARATOR);
- finalResult.append( getData().get(FormattedValueVMUtil.getPropertyForFormatId(formatId, null)) );
- if ( i < formats.length + 1 ) {
- finalResult.append(CRLF);
- }
- }
- }
- detailComputed(null, finalResult.toString());
- }
-
- @Override
- protected void handleErrorOrWarning() {
- String rootMessage = new String(getStatus().getMessage()).trim();
- // Provide a detail Error message to the user
- StringBuilder finalResult = new StringBuilder(rootMessage);
- IStatus[] statuses = getStatus().getChildren();
- if (statuses != null) {
- for (int i=0; i < statuses.length; i++) {
- String childMessage = statuses[i].getMessage().trim();
- // Avoid root message duplication
- if (!childMessage.equals(rootMessage)) {
- finalResult.append(CRLF).append(CRLF).append(i + 1).append(PARENTHESES).append(childMessage);
- }
- }
- }
-
- detailComputed(null, finalResult.toString());
- };
- })
- });
- }
- })
- });
- continue;
- }
-
- return Status.OK_STATUS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#canceling()
- */
- @Override
- protected void canceling() {
- super.canceling();
- synchronized (this) {
- notifyAll();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IValueDetailListener#detailComputed(org.eclipse.debug.core.model.IValue, java.lang.String)
- */
- @Override
+ Set<String> properties = new HashSet<String>(1);
+ properties.add(IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS);
+ propertiesProvider
+ .update(new IPropertiesUpdate[] { new VMPropertiesUpdate(properties, path, fViewerInput,
+ fPresentationContext, new DataRequestMonitor<Map<String, Object>>(executor, null) {
+ @Override
+ protected void handleCompleted() {
+
+ // Bugzilla 310191: Detail pane does not clear up when DSF-GDB session is terminated
+ if (fMonitor.isCanceled())
+ return;
+
+ Set<String> properties = new HashSet<String>(1);
+ properties.add(IElementPropertiesProvider.PROP_NAME);
+ final String[] formats = (String[]) getData()
+ .get(IDebugVMConstants.PROP_FORMATTED_VALUE_AVAILABLE_FORMATS);
+ if (formats != null) {
+ for (String format : formats) {
+ properties
+ .add(FormattedValueVMUtil.getPropertyForFormatId(format, null));
+ }
+ }
+
+ propertiesProvider
+ .update(new IPropertiesUpdate[] { new VMPropertiesUpdate(properties,
+ path, fViewerInput, fPresentationContext,
+ new DataRequestMonitor<Map<String, Object>>(executor, null) {
+ @Override
+ protected void handleSuccess() {
+ StringBuilder finalResult = new StringBuilder();
+ finalResult.append(NAME)
+ .append(getData().get(
+ IElementPropertiesProvider.PROP_NAME))
+ .append(CRLF);
+
+ if (formats != null) {
+ for (int i = 0; i < formats.length; i++) {
+ String formatId = formats[i];
+ finalResult.append(SPACES);
+ finalResult.append(FormattedValueVMUtil
+ .getFormatLabel(formatId));
+ finalResult.append(FORMAT_SEPARATOR);
+ finalResult.append(
+ getData().get(FormattedValueVMUtil
+ .getPropertyForFormatId(
+ formatId, null)));
+ if (i < formats.length + 1) {
+ finalResult.append(CRLF);
+ }
+ }
+ }
+ detailComputed(null, finalResult.toString());
+ }
+
+ @Override
+ protected void handleErrorOrWarning() {
+ String rootMessage = new String(
+ getStatus().getMessage()).trim();
+ // Provide a detail Error message to the user
+ StringBuilder finalResult = new StringBuilder(
+ rootMessage);
+ IStatus[] statuses = getStatus().getChildren();
+ if (statuses != null) {
+ for (int i = 0; i < statuses.length; i++) {
+ String childMessage = statuses[i].getMessage()
+ .trim();
+ // Avoid root message duplication
+ if (!childMessage.equals(rootMessage)) {
+ finalResult.append(CRLF).append(CRLF)
+ .append(i + 1).append(PARENTHESES)
+ .append(childMessage);
+ }
+ }
+ }
+
+ detailComputed(null, finalResult.toString());
+ };
+ }) });
+ }
+ }) });
+ continue;
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#canceling()
+ */
+ @Override
+ protected void canceling() {
+ super.canceling();
+ synchronized (this) {
+ notifyAll();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IValueDetailListener#detailComputed(org.eclipse.debug.core.model.IValue, java.lang.String)
+ */
+ @Override
public void detailComputed(IValue value, final String result) {
- synchronized (this) {
+ synchronized (this) {
+ }
+ if (!fMonitor.isCanceled()) {
+ WorkbenchJob append = new WorkbenchJob("append details") { //$NON-NLS-1$
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ if (!fMonitor.isCanceled()) {
+ String insert = result;
+ int length = 0;
+ if (!fFirst) {
+ length = getDetailDocument().getLength();
+ }
+ if (length > 0) {
+ insert = CRLF + result;
+ }
+ try {
+ int max = DsfUIPlugin.getDefault().getPreferenceStore()
+ .getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH);
+ if (max > 0 && insert.length() > max) {
+ insert = insert.substring(0, max) + DOTS;
+ }
+ if (fFirst) {
+ getDetailDocument().set(insert);
+ fFirst = false;
+ } else {
+ getDetailDocument().replace(length, 0, insert);
+ }
+ } catch (BadLocationException e) {
+ DsfUIPlugin.log(e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ append.setSystem(true);
+ append.schedule();
+ }
+ synchronized (this) {
+ notifyAll();
}
- if (!fMonitor.isCanceled()) {
- WorkbenchJob append = new WorkbenchJob("append details") { //$NON-NLS-1$
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (!fMonitor.isCanceled()) {
- String insert = result;
- int length = 0;
- if (!fFirst) {
- length = getDetailDocument().getLength();
- }
- if (length > 0) {
- insert = CRLF + result;
- }
- try {
- int max = DsfUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH);
- if (max > 0 && insert.length() > max) {
- insert = insert.substring(0, max) + DOTS;
- }
- if (fFirst) {
- getDetailDocument().set(insert);
- fFirst = false;
- } else {
- getDetailDocument().replace(length, 0,insert);
- }
- } catch (BadLocationException e) {
- DsfUIPlugin.log(e);
- }
- }
- return Status.OK_STATUS;
- }
- };
- append.setSystem(true);
- append.schedule();
- }
- synchronized (this) {
- notifyAll();
- }
- }
- }
-
- /**
- * The model presentation used to produce the string details for a
- * selected variable.
- */
- private String fDebugModelIdentifier;
-
- /**
- * The text viewer in which the computed string detail
- * of selected variables will be displayed.
- */
- private TextViewer fTextViewer;
-
- /**
- * The last selection displayed in the text viewer.
- */
- private IStructuredSelection fLastDisplayed = null;
-
- /**
- * Variables used to create the detailed information for a selection
- */
- private IDocument fDetailDocument;
- private DetailJob fDetailJob = null;
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPane#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
+ }
+ }
+
+ /**
+ * The model presentation used to produce the string details for a
+ * selected variable.
+ */
+ private String fDebugModelIdentifier;
+
+ /**
+ * The text viewer in which the computed string detail
+ * of selected variables will be displayed.
+ */
+ private TextViewer fTextViewer;
+
+ /**
+ * The last selection displayed in the text viewer.
+ */
+ private IStructuredSelection fLastDisplayed = null;
+
+ /**
+ * Variables used to create the detailed information for a selection
+ */
+ private IDocument fDetailDocument;
+ private DetailJob fDetailJob = null;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
public Control createControl(Composite parent) {
-
- createTextViewer(parent);
-
- if (isInView()){
- createViewSpecificComponents();
- createActions();
- DsfUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
- JFaceResources.getFontRegistry().addListener(this);
- }
-
- return fTextViewer.getControl();
- }
-
- /**
- * Creates the text viewer in the given parent composite
- *
- * @param parent Parent composite to create the text viewer in
- */
- private void createTextViewer(Composite parent) {
-
- // Create & configure a TextViewer
- fTextViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL);
- fTextViewer.setDocument(getDetailDocument());
- fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
- fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
- fTextViewer.setEditable(false);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextViewer.getTextWidget(), IDsfDebugHelpContextIds.DETAIL_PANE);
- Control control = fTextViewer.getControl();
- GridData gd = new GridData(GridData.FILL_BOTH);
- control.setLayoutData(gd);
- }
-
- /**
- * Creates listeners and other components that should only be added to the
- * text viewer when this detail pane is inside a view.
- */
- private void createViewSpecificComponents(){
-
- // Add a document listener so actions get updated when the document changes
- getDetailDocument().addDocumentListener(new IDocumentListener() {
- @Override
- public void documentAboutToBeChanged(DocumentEvent event) {}
- @Override
+
+ createTextViewer(parent);
+
+ if (isInView()) {
+ createViewSpecificComponents();
+ createActions();
+ DsfUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+ JFaceResources.getFontRegistry().addListener(this);
+ }
+
+ return fTextViewer.getControl();
+ }
+
+ /**
+ * Creates the text viewer in the given parent composite
+ *
+ * @param parent Parent composite to create the text viewer in
+ */
+ private void createTextViewer(Composite parent) {
+
+ // Create & configure a TextViewer
+ fTextViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL);
+ fTextViewer.setDocument(getDetailDocument());
+ fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
+ fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
+ fTextViewer.setEditable(false);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(fTextViewer.getTextWidget(),
+ IDsfDebugHelpContextIds.DETAIL_PANE);
+ Control control = fTextViewer.getControl();
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ control.setLayoutData(gd);
+ }
+
+ /**
+ * Creates listeners and other components that should only be added to the
+ * text viewer when this detail pane is inside a view.
+ */
+ private void createViewSpecificComponents() {
+
+ // Add a document listener so actions get updated when the document changes
+ getDetailDocument().addDocumentListener(new IDocumentListener() {
+ @Override
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+
+ @Override
public void documentChanged(DocumentEvent event) {
- updateSelectionDependentActions();
- }
- });
-
- // Add the selection listener so selection dependent actions get updated.
- fTextViewer.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
+ updateSelectionDependentActions();
+ }
+ });
+
+ // Add the selection listener so selection dependent actions get updated.
+ fTextViewer.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- updateSelectionDependentActions();
- }
- });
-
- // Add a focus listener to update actions when details area gains focus
- fTextViewer.getControl().addFocusListener(new FocusAdapter() {
- @Override
- public void focusGained(FocusEvent e) {
-
- setGlobalAction(IDebugView.SELECT_ALL_ACTION, getAction(DETAIL_SELECT_ALL_ACTION));
- setGlobalAction(IDebugView.COPY_ACTION, getAction(DETAIL_COPY_ACTION));
-
- getViewSite().getActionBars().updateActionBars();
- }
-
- @Override
- public void focusLost(FocusEvent e) {
-
- setGlobalAction(IDebugView.SELECT_ALL_ACTION, null);
- setGlobalAction(IDebugView.COPY_ACTION, null);
-
- getViewSite().getActionBars().updateActionBars();
- }
- });
-
- // Add a context menu to the detail area
- createDetailContextMenu(fTextViewer.getTextWidget());
- }
-
- /**
- * Creates the actions to add to the context menu
- */
- private void createActions() {
-
- TextViewerAction textAction= new TextViewerAction(fTextViewer, ITextOperationTarget.SELECT_ALL);
- textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- textAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugHelpContextIds.DETAIL_PANE_SELECT_ALL_ACTION);
- setAction(DETAIL_SELECT_ALL_ACTION, textAction);
-
- textAction= new TextViewerAction(fTextViewer, ITextOperationTarget.COPY);
- textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
- textAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugHelpContextIds.DETAIL_PANE_COPY_ACTION);
- setAction(DETAIL_COPY_ACTION, textAction);
-
- setSelectionDependantAction(DETAIL_COPY_ACTION);
-
- updateSelectionDependentActions();
-
- IAction action = new DetailPaneWordWrapAction(fTextViewer);
- setAction(DETAIL_WORD_WRAP_ACTION, action);
-
- action = new DetailPaneMaxLengthAction(fTextViewer.getControl().getShell());
- setAction(DETAIL_MAX_LENGTH_ACTION,action);
- }
-
- /**
- * Create the context menu particular to the detail pane. Note that anyone
- * wishing to contribute an action to this menu must use
- * <code>IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID</code> as the
- * <code>targetID</code> in the extension XML.
- */
- protected void createDetailContextMenu(Control menuControl) {
- MenuManager menuMgr= new MenuManager();
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- @Override
+ updateSelectionDependentActions();
+ }
+ });
+
+ // Add a focus listener to update actions when details area gains focus
+ fTextViewer.getControl().addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent e) {
+
+ setGlobalAction(IDebugView.SELECT_ALL_ACTION, getAction(DETAIL_SELECT_ALL_ACTION));
+ setGlobalAction(IDebugView.COPY_ACTION, getAction(DETAIL_COPY_ACTION));
+
+ getViewSite().getActionBars().updateActionBars();
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+
+ setGlobalAction(IDebugView.SELECT_ALL_ACTION, null);
+ setGlobalAction(IDebugView.COPY_ACTION, null);
+
+ getViewSite().getActionBars().updateActionBars();
+ }
+ });
+
+ // Add a context menu to the detail area
+ createDetailContextMenu(fTextViewer.getTextWidget());
+ }
+
+ /**
+ * Creates the actions to add to the context menu
+ */
+ private void createActions() {
+
+ TextViewerAction textAction = new TextViewerAction(fTextViewer, ITextOperationTarget.SELECT_ALL);
+ textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ textAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction,
+ IDsfDebugHelpContextIds.DETAIL_PANE_SELECT_ALL_ACTION);
+ setAction(DETAIL_SELECT_ALL_ACTION, textAction);
+
+ textAction = new TextViewerAction(fTextViewer, ITextOperationTarget.COPY);
+ textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ textAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugHelpContextIds.DETAIL_PANE_COPY_ACTION);
+ setAction(DETAIL_COPY_ACTION, textAction);
+
+ setSelectionDependantAction(DETAIL_COPY_ACTION);
+
+ updateSelectionDependentActions();
+
+ IAction action = new DetailPaneWordWrapAction(fTextViewer);
+ setAction(DETAIL_WORD_WRAP_ACTION, action);
+
+ action = new DetailPaneMaxLengthAction(fTextViewer.getControl().getShell());
+ setAction(DETAIL_MAX_LENGTH_ACTION, action);
+ }
+
+ /**
+ * Create the context menu particular to the detail pane. Note that anyone
+ * wishing to contribute an action to this menu must use
+ * <code>IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID</code> as the
+ * <code>targetID</code> in the extension XML.
+ */
+ protected void createDetailContextMenu(Control menuControl) {
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager mgr) {
- fillDetailContextMenu(mgr);
- }
- });
- Menu menu= menuMgr.createContextMenu(menuControl);
- menuControl.setMenu(menu);
-
- getViewSite().registerContextMenu(IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID, menuMgr, fTextViewer.getSelectionProvider());
- }
-
- /**
- * Adds items to the detail pane's context menu including any extension defined
- * actions.
- *
- * @param menu The menu to add the item to.
- */
- protected void fillDetailContextMenu(IMenuManager menu) {
-
- menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP));
- menu.add(new Separator());
- menu.add(getAction(DETAIL_COPY_ACTION));
- menu.add(getAction(DETAIL_SELECT_ALL_ACTION));
- menu.add(new Separator());
- menu.add(getAction(DETAIL_WORD_WRAP_ACTION));
- menu.add(getAction(DETAIL_MAX_LENGTH_ACTION));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPane#display(org.eclipse.jface.viewers.IStructuredSelection)
- */
- @Override
+ fillDetailContextMenu(mgr);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(menuControl);
+ menuControl.setMenu(menu);
+
+ getViewSite().registerContextMenu(IDebugUIConstants.VARIABLE_VIEW_DETAIL_ID, menuMgr,
+ fTextViewer.getSelectionProvider());
+ }
+
+ /**
+ * Adds items to the detail pane's context menu including any extension defined
+ * actions.
+ *
+ * @param menu The menu to add the item to.
+ */
+ protected void fillDetailContextMenu(IMenuManager menu) {
+
+ menu.add(new Separator(IDebugUIConstants.VARIABLE_GROUP));
+ menu.add(new Separator());
+ menu.add(getAction(DETAIL_COPY_ACTION));
+ menu.add(getAction(DETAIL_SELECT_ALL_ACTION));
+ menu.add(new Separator());
+ menu.add(getAction(DETAIL_WORD_WRAP_ACTION));
+ menu.add(getAction(DETAIL_MAX_LENGTH_ACTION));
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#display(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
public void display(IStructuredSelection selection) {
-
- if (selection == null){
- clearTextViewer();
- return;
- }
-
- fLastDisplayed = selection;
-
- if ( selection.isEmpty() || !(selection instanceof ITreeSelection) ) {
- clearTextViewer();
- return;
- }
-
- Object firstElement = selection.getFirstElement();
- if (firstElement instanceof IAdaptable) {
- IDebugModelProvider debugModelProvider =
- ((IAdaptable)firstElement).getAdapter(IDebugModelProvider.class);
- if (debugModelProvider != null) {
- String[] ids = debugModelProvider.getModelIdentifiers();
- if (ids != null && ids.length > 0) {
- setDebugModel(ids[0]);
- }
- }
- }
-
- synchronized (this) {
- if (fDetailJob != null) {
- fDetailJob.cancel();
- }
- if (fWorkbenchPartSite != null) {
- IWorkbenchPart part = fWorkbenchPartSite.getPart();
- if (part instanceof IDebugView) {
- Viewer viewer = ((IDebugView)part).getViewer();
- Object input = viewer.getInput();
- if (input != null && viewer instanceof TreeModelViewer) {
- TreeModelViewer treeModelViewer = (TreeModelViewer)viewer;
- fDetailJob = new DetailJob(treeModelViewer.getPresentationContext(), input,
- (ITreeSelection)selection, null);
- fDetailJob.schedule();
- }
- }
- } else if (firstElement instanceof IDMVMContext) {
- IVMNode vmNode = ((IDMVMContext) firstElement).getVMNode();
- if (vmNode != null) {
- Object input = firstElement;
- IVMProvider vmProvider = vmNode.getVMProvider();
- final IPresentationContext context= vmProvider.getPresentationContext();
- if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(context.getId())) {
- // magic access to viewer input - see ExpressionVMProvider
- input = context.getProperty("__viewerInput"); //$NON-NLS-1$
- }
- fDetailJob = new DetailJob(context, input, (ITreeSelection)selection, null);
- fDetailJob.schedule();
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPane#setFocus()
- */
- @Override
- public boolean setFocus(){
- if (fTextViewer != null){
- fTextViewer.getTextWidget().setFocus();
- return true;
- }
- return false;
- }
-
- /*
- *
- */
- @Override
- public void dispose(){
- fActionMap.clear();
- fSelectionActions.clear();
-
- if (fDetailJob != null) fDetailJob.cancel();
- fDebugModelIdentifier = null; // Setting this to null makes sure the text viewer is reconfigured with the model presentation after disposal
- if (fTextViewer != null && fTextViewer.getControl() != null) {
- fTextViewer.getControl().dispose();
- fTextViewer = null;
- }
-
- if (isInView()){
- DsfUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
- JFaceResources.getFontRegistry().removeListener(this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPane#getDescription()
- */
- @Override
+
+ if (selection == null) {
+ clearTextViewer();
+ return;
+ }
+
+ fLastDisplayed = selection;
+
+ if (selection.isEmpty() || !(selection instanceof ITreeSelection)) {
+ clearTextViewer();
+ return;
+ }
+
+ Object firstElement = selection.getFirstElement();
+ if (firstElement instanceof IAdaptable) {
+ IDebugModelProvider debugModelProvider = ((IAdaptable) firstElement).getAdapter(IDebugModelProvider.class);
+ if (debugModelProvider != null) {
+ String[] ids = debugModelProvider.getModelIdentifiers();
+ if (ids != null && ids.length > 0) {
+ setDebugModel(ids[0]);
+ }
+ }
+ }
+
+ synchronized (this) {
+ if (fDetailJob != null) {
+ fDetailJob.cancel();
+ }
+ if (fWorkbenchPartSite != null) {
+ IWorkbenchPart part = fWorkbenchPartSite.getPart();
+ if (part instanceof IDebugView) {
+ Viewer viewer = ((IDebugView) part).getViewer();
+ Object input = viewer.getInput();
+ if (input != null && viewer instanceof TreeModelViewer) {
+ TreeModelViewer treeModelViewer = (TreeModelViewer) viewer;
+ fDetailJob = new DetailJob(treeModelViewer.getPresentationContext(), input,
+ (ITreeSelection) selection, null);
+ fDetailJob.schedule();
+ }
+ }
+ } else if (firstElement instanceof IDMVMContext) {
+ IVMNode vmNode = ((IDMVMContext) firstElement).getVMNode();
+ if (vmNode != null) {
+ Object input = firstElement;
+ IVMProvider vmProvider = vmNode.getVMProvider();
+ final IPresentationContext context = vmProvider.getPresentationContext();
+ if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(context.getId())) {
+ // magic access to viewer input - see ExpressionVMProvider
+ input = context.getProperty("__viewerInput"); //$NON-NLS-1$
+ }
+ fDetailJob = new DetailJob(context, input, (ITreeSelection) selection, null);
+ fDetailJob.schedule();
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#setFocus()
+ */
+ @Override
+ public boolean setFocus() {
+ if (fTextViewer != null) {
+ fTextViewer.getTextWidget().setFocus();
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ *
+ */
+ @Override
+ public void dispose() {
+ fActionMap.clear();
+ fSelectionActions.clear();
+
+ if (fDetailJob != null)
+ fDetailJob.cancel();
+ fDebugModelIdentifier = null; // Setting this to null makes sure the text viewer is reconfigured with the model presentation after disposal
+ if (fTextViewer != null && fTextViewer.getControl() != null) {
+ fTextViewer.getControl().dispose();
+ fTextViewer = null;
+ }
+
+ if (isInView()) {
+ DsfUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
+ JFaceResources.getFontRegistry().removeListener(this);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#getDescription()
+ */
+ @Override
public String getDescription() {
- return MessagesForDetailPane.NumberFormatDetailPane_Description;
- }
+ return MessagesForDetailPane.NumberFormatDetailPane_Description;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPane#getID()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#getID()
+ */
+ @Override
public String getID() {
- return ID;
- }
+ return ID;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPane#getName()
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPane#getName()
+ */
+ @Override
public String getName() {
- return MessagesForDetailPane.NumberFormatDetailPane_Name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
+ return MessagesForDetailPane.NumberFormatDetailPane_Name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @Override
@SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> required) {
- if (IFindReplaceTarget.class.equals(required)) {
- return (T)fTextViewer.getFindReplaceTarget();
- }
- if (ITextViewer.class.equals(required)) {
- return (T)fTextViewer;
- }
- return null;
- }
-
- /**
- * Lazily instantiate and return a Document for the detail pane text viewer.
- */
- protected IDocument getDetailDocument() {
- if (fDetailDocument == null) {
- fDetailDocument = new Document();
- }
- return fDetailDocument;
- }
-
- /**
- * Clears the text viewer, removes all text.
- */
- protected void clearTextViewer(){
- if (fDetailJob != null) {
- fDetailJob.cancel();
-
- // Bugzilla 310191: Detail pane does not clear up when DSF-GDB session is terminated
- IProgressMonitor progressMonitor = fDetailJob.getDetailMonitor();
- if (progressMonitor!=null)
- progressMonitor.setCanceled(true);
- }
- fLastDisplayed = null;
- fDetailDocument.set(""); //$NON-NLS-1$
- fTextViewer.setEditable(false);
- }
-
- /**
- * Configures the details viewer for the debug model
- * currently being displayed
- */
- protected void configureDetailsViewer() {
- fTextViewer.setEditable(false);
- }
-
- /**
- * Returns the identifier of the debug model being displayed
- * in this view, or <code>null</code> if none.
- *
- * @return debug model identifier
- */
- protected String getDebugModel() {
- return fDebugModelIdentifier;
- }
-
- /**
- * Sets the identifier of the debug model being displayed
- * in this view, or <code>null</code> if none.
- *
- * @param id debug model identifier of the type of debug
- * elements being displayed in this view
- */
- protected void setDebugModel(String id) {
- if (!id.equals(fDebugModelIdentifier)) {
- fDebugModelIdentifier = id;
- configureDetailsViewer();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- @Override
+ if (IFindReplaceTarget.class.equals(required)) {
+ return (T) fTextViewer.getFindReplaceTarget();
+ }
+ if (ITextViewer.class.equals(required)) {
+ return (T) fTextViewer;
+ }
+ return null;
+ }
+
+ /**
+ * Lazily instantiate and return a Document for the detail pane text viewer.
+ */
+ protected IDocument getDetailDocument() {
+ if (fDetailDocument == null) {
+ fDetailDocument = new Document();
+ }
+ return fDetailDocument;
+ }
+
+ /**
+ * Clears the text viewer, removes all text.
+ */
+ protected void clearTextViewer() {
+ if (fDetailJob != null) {
+ fDetailJob.cancel();
+
+ // Bugzilla 310191: Detail pane does not clear up when DSF-GDB session is terminated
+ IProgressMonitor progressMonitor = fDetailJob.getDetailMonitor();
+ if (progressMonitor != null)
+ progressMonitor.setCanceled(true);
+ }
+ fLastDisplayed = null;
+ fDetailDocument.set(""); //$NON-NLS-1$
+ fTextViewer.setEditable(false);
+ }
+
+ /**
+ * Configures the details viewer for the debug model
+ * currently being displayed
+ */
+ protected void configureDetailsViewer() {
+ fTextViewer.setEditable(false);
+ }
+
+ /**
+ * Returns the identifier of the debug model being displayed
+ * in this view, or <code>null</code> if none.
+ *
+ * @return debug model identifier
+ */
+ protected String getDebugModel() {
+ return fDebugModelIdentifier;
+ }
+
+ /**
+ * Sets the identifier of the debug model being displayed
+ * in this view, or <code>null</code> if none.
+ *
+ * @param id debug model identifier of the type of debug
+ * elements being displayed in this view
+ */
+ protected void setDebugModel(String id) {
+ if (!id.equals(fDebugModelIdentifier)) {
+ fDebugModelIdentifier = id;
+ configureDetailsViewer();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- String propertyName= event.getProperty();
- if (propertyName.equals(IDebugUIConstants.PREF_DETAIL_PANE_FONT)) {
- fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
- } else if (propertyName.equals(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) {
- display(fLastDisplayed);
- } else if (propertyName.equals(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)) {
- fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
- getAction(DETAIL_WORD_WRAP_ACTION).setChecked(DsfUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
- }
- }
+ String propertyName = event.getProperty();
+ if (propertyName.equals(IDebugUIConstants.PREF_DETAIL_PANE_FONT)) {
+ fTextViewer.getTextWidget().setFont(JFaceResources.getFont(IDebugUIConstants.PREF_DETAIL_PANE_FONT));
+ } else if (propertyName.equals(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) {
+ display(fLastDisplayed);
+ } else if (propertyName.equals(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)) {
+ fTextViewer.getTextWidget().setWordWrap(DsfUIPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
+ getAction(DETAIL_WORD_WRAP_ACTION).setChecked(DsfUIPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IInternalDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP));
+ }
+ }
/*
* @see org.eclipse.debug.ui.IDetailPane2#getSelectionProvider()
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java
index 36f50f06f9b..98160946ba0 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Wind River Systems, Inc. - initial implementation
*******************************************************************************/
@@ -27,53 +27,53 @@ import org.eclipse.jface.viewers.IStructuredSelection;
public class NumberFormatDetailPaneFactory implements IDetailPaneFactory {
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#createDetailsArea(java.lang.String)
- */
- @Override
- public IDetailPane createDetailPane(String id) {
- return new NumberFormatDetailPane();
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#createDetailsArea(java.lang.String)
+ */
+ @Override
+ public IDetailPane createDetailPane(String id) {
+ return new NumberFormatDetailPane();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDetailsTypes(org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Set getDetailPaneTypes(IStructuredSelection selection) {
+ Set<String> possibleIDs = new HashSet<String>(1);
+ possibleIDs.add(NumberFormatDetailPane.ID);
+ return possibleIDs;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDetailsTypes(org.eclipse.jface.viewers.IStructuredSelection)
- */
- @SuppressWarnings("rawtypes")
- @Override
- public Set getDetailPaneTypes(IStructuredSelection selection) {
- Set<String> possibleIDs = new HashSet<String>(1);
- possibleIDs.add(NumberFormatDetailPane.ID);
- return possibleIDs;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDetailPaneFactory#getDefaultDetailPane(java.util.Set, org.eclipse.jface.viewers.IStructuredSelection)
- */
- @Override
- public String getDefaultDetailPane(IStructuredSelection selection) {
- return null; // Allow competing detail pane factories to override this one
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDetailPaneFactory#getDefaultDetailPane(java.util.Set, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ @Override
+ public String getDefaultDetailPane(IStructuredSelection selection) {
+ return null; // Allow competing detail pane factories to override this one
+ }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getName(java.lang.String)
- */
- @Override
- public String getDetailPaneName(String id) {
- if (id.equals(NumberFormatDetailPane.ID)){
- return MessagesForDetailPane.NumberFormatDetailPane_Name;
- }
- return null;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getName(java.lang.String)
+ */
+ @Override
+ public String getDetailPaneName(String id) {
+ if (id.equals(NumberFormatDetailPane.ID)) {
+ return MessagesForDetailPane.NumberFormatDetailPane_Name;
+ }
+ return null;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDescription(java.lang.String)
- */
- @Override
- public String getDetailPaneDescription(String id) {
- if (id.equals(NumberFormatDetailPane.ID)){
- return MessagesForDetailPane.NumberFormatDetailPane_Description;
- }
- return null;
- }
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDescription(java.lang.String)
+ */
+ @Override
+ public String getDetailPaneDescription(String id) {
+ if (id.equals(NumberFormatDetailPane.ID)) {
+ return MessagesForDetailPane.NumberFormatDetailPane_Description;
+ }
+ return null;
+ }
}

Back to the top