1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[233407] - [update policy][menu] The update modes menu is enabled when no DSF debug session is active.

This commit is contained in:
Pawel Piech 2008-10-06 21:51:07 +00:00
parent 405b19f8df
commit 39cf259bbd
27 changed files with 1083 additions and 916 deletions

View file

@ -35,7 +35,6 @@ Export-Package:
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch;x-internal:=true, org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.launch;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules;x-internal:=true, org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;x-internal:=true, org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register;x-internal:=true, org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.register;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update;x-internal:=true, org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update;x-internal:=true,
org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;x-internal:=true, org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;x-internal:=true,

View file

@ -32,20 +32,9 @@ action.refresh.label = Refresh
menu.updatePolicy = Update Policy menu.updatePolicy = Update Policy
menu.threadsUpdatePolicy = Threads Update Policy menu.threadsUpdatePolicy = Threads Update Policy
action.breakpointHitUpdatePolicy.label = Breakpoint Hit
action.manualUpdatePolicy.label = Manual
action.automaticUpdatePolicy.label = Automatic
menu.updateScope = Update Scope menu.updateScope = Update Scope
action.visibleUpdateScope.label = Visible
action.allUpdateScope.label = Expanded
menu.numberFormat = Number Format menu.numberFormat = Number Format
action.setDefaultNumberFormatHex.label = Hex
action.setDefaultNumberFormatDecimal.label = Decimal
action.setDefaultNumberFormatOctal.label = Octal
action.setDefaultNumberFormatBinary.label = Binary
action.setDefaultNumberFormatNatural.label = Natural
preferencePage.name = DSF preferencePage.name = DSF

View file

@ -68,103 +68,6 @@
label="%action.refresh.label" label="%action.refresh.label"
toolbarPath="additions"> toolbarPath="additions">
</action> </action>
<menu id="numberFormat"
label="%menu.numberFormat"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatHex"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Hex_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Hex"
label="%action.setDefaultNumberFormatHex.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatDecimal"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Decimal_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Decimal"
label="%action.setDefaultNumberFormatDecimal.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatOctal"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Octal_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Octal"
label="%action.setDefaultNumberFormatOctal.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatBinary"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Binary_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Binary"
label="%action.setDefaultNumberFormatBinary.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatNatural"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Natural_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Natural"
label="%action.setDefaultNumberFormatNatural.label"
menubarPath="numberFormat/additions"
state="true"
style="radio">
</action>
<menu id="updateScope"
label="%menu.updateScope"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AllUpdateScopeAction"
id="org.eclipse.dd.dsf.debug.ui.UpdateScope_All"
label="%action.allUpdateScope.label"
state="false"
menubarPath="updateScope/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.VisibleUpdateScopeAction"
id="org.eclipse.dd.dsf.debug.ui.UpdateScope_Visible"
label="%action.visibleUpdateScope.label"
menubarPath="updateScope/additions"
state="true"
style="radio">
</action>
<menu id="updatePolicy"
label="%menu.updatePolicy"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.BreakpointHitUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_BreakpointHit_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_BreakpointHit"
label="%action.breakpointHitUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.ManualUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual"
label="%action.manualUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AutomaticUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic"
label="%action.automaticUpdatePolicy.label"
menubarPath="updatePolicy/additions"
state="true"
style="radio">
</action>
</viewContribution> </viewContribution>
<!-- Registers View menu contributions --> <!-- Registers View menu contributions -->
@ -178,100 +81,6 @@
label="%action.refresh.label" label="%action.refresh.label"
toolbarPath="additions"> toolbarPath="additions">
</action> </action>
<menu id="numberFormat"
label="%menu.numberFormat"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatHex"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Hex_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Hex"
label="%action.setDefaultNumberFormatHex.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatDecimal"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Decimal_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Decimal"
label="%action.setDefaultNumberFormatDecimal.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatOctal"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Octal_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Octal"
label="%action.setDefaultNumberFormatOctal.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatBinary"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Binary_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Binary"
label="%action.setDefaultNumberFormatBinary.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatNatural"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Natural_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Natural"
label="%action.setDefaultNumberFormatNatural.label"
menubarPath="numberFormat/additions"
state="true"
style="radio">
</action>
<menu id="updateScope"
label="%menu.updateScope"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AllUpdateScopeAction"
id="org.eclipse.dd.dsf.debug.ui.UpdateScope_All"
label="%action.allUpdateScope.label"
menubarPath="updateScope/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.VisibleUpdateScopeAction"
id="org.eclipse.dd.dsf.debug.ui.UpdateScope_Visible"
label="%action.visibleUpdateScope.label"
menubarPath="updateScope/additions"
state="true"
style="radio">
</action>
<menu id="updatePolicy"
label="%menu.updatePolicy"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.BreakpointHitUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_BreakpointHit_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_BreakpointHit"
label="%action.breakpointHitUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.ManualUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual"
label="%action.manualUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AutomaticUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic"
label="%action.automaticUpdatePolicy.label"
menubarPath="updatePolicy/additions"
state="true"
style="radio">
</action>
</viewContribution> </viewContribution>
<!-- Expressions View menu contributions --> <!-- Expressions View menu contributions -->
@ -285,101 +94,6 @@
label="%action.refresh.label" label="%action.refresh.label"
toolbarPath="additions"> toolbarPath="additions">
</action> </action>
<menu id="numberFormat"
label="%menu.numberFormat"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatHex"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Hex_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Hex"
label="%action.setDefaultNumberFormatHex.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatDecimal"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Decimal_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Decimal"
label="%action.setDefaultNumberFormatDecimal.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatOctal"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Octal_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Octal"
label="%action.setDefaultNumberFormatOctal.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatBinary"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Binary_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Binary"
label="%action.setDefaultNumberFormatBinary.label"
menubarPath="numberFormat/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions.SetDefaultFormatNatural"
helpContextId="org.eclipse.dd.dsf.debug.ui.NumberFormat_Natural_helpContext"
id="org.eclipse.dd.dsf.debug.ui.NumberFormat_Natural"
label="%action.setDefaultNumberFormatNatural.label"
menubarPath="numberFormat/additions"
state="true"
style="radio">
</action>
<menu id="updateScope"
label="%menu.updateScope"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AllUpdateScopeAction"
id="org.eclipse.dd.dsf.debug.ui.UpdateScope_All"
label="%action.allUpdateScope.label"
state="false"
menubarPath="updateScope/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.VisibleUpdateScopeAction"
id="org.eclipse.dd.dsf.debug.ui.UpdateScope_Visible"
label="%action.visibleUpdateScope.label"
menubarPath="updateScope/additions"
state="true"
style="radio">
</action>
<menu id="updatePolicy"
label="%menu.updatePolicy"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.BreakpointHitUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_BreakpointHit_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_BreakpointHit"
label="%action.breakpointHitUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.ManualUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual"
label="%action.manualUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AutomaticUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic"
label="%action.automaticUpdatePolicy.label"
menubarPath="updatePolicy/additions"
state="true"
style="radio">
</action>
</viewContribution> </viewContribution>
<!-- Debug View menu contributions --> <!-- Debug View menu contributions -->
@ -393,29 +107,290 @@
label="%action.refresh.label" label="%action.refresh.label"
toolbarPath="additions"> toolbarPath="additions">
</action> </action>
<menu id="updatePolicy"
label="%menu.threadsUpdatePolicy"
path="additions"/>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.ManualUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Manual"
label="%action.manualUpdatePolicy.label"
menubarPath="updatePolicy/additions"
style="radio">
</action>
<action
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.AutomaticUpdatePolicyAction"
helpContextId="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic_helpContext"
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicy_Automatic"
label="%action.automaticUpdatePolicy.label"
menubarPath="updatePolicy/additions"
state="true"
style="radio">
</action>
</viewContribution> </viewContribution>
</extension>
<extension
point="org.eclipse.ui.menus">
<!-- Debug view menu commands -->
<menuContribution
locationURI="menu:org.eclipse.debug.ui.DebugView?after=additions">
<separator name="additions" visible="false"/>
<separator name="updatePolicy" visible="true"/>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.DebugView?after=updatePolicy">
<menu
id="org.eclipse.dd.dsf.debug.ui.debugView_updatePolicies"
label="%menu.threadsUpdatePolicy">
<visibleWhen checkEnabled="false">
<and>
<with variable="org.eclipse.core.runtime.Platform">
<test property="org.eclipse.core.runtime.bundleState"
args="org.eclipse.dd.dsf.debug.ui"
value="ACTIVE"/>
</with>
<with variable="selection">
<count value="+"/>
<iterate>
<test property="org.eclipse.dd.dsf.debug.ui.areUpdatePoliciesSupported"/>
</iterate>
</with>
</and>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.UpdatePolicies"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdatePoliciesContribution">
</dynamic>
</menu>
</menuContribution>
<!-- Registers view menu commands -->
<menuContribution
locationURI="menu:org.eclipse.debug.ui.RegisterView?after=additions">
<separator name="additions" visible="false"/>
<separator name="formatting" visible="true"/>
<separator name="updatePolicy" visible="true"/>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.RegisterView?after=updatePolicy">
<menu
id="org.eclipse.dd.dsf.debug.ui.registersView_updatePolicies"
label="%menu.updatePolicy">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreUpdatePoliciesSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.registersUpdatePolicies"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdatePoliciesContribution">
</dynamic>
</menu>
<menu
id="org.eclipse.dd.dsf.debug.ui.registersView_updateScopes"
label="%menu.updateScope">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreUpdateScopesSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.registersUpdateScopes"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdateScopesContribution">
</dynamic>
</menu>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.RegisterView?after=formatting">
<menu
id="org.eclipse.dd.dsf.debug.ui.registersView_numberFormats"
label="%menu.numberFormat">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreNumberFormatsSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.registersNumberFormats"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.NumberFormatsContribution">
</dynamic>
</menu>
</menuContribution>
<!-- Variables view menu commands -->
<menuContribution
locationURI="menu:org.eclipse.debug.ui.VariableView?after=additions">
<separator name="additions" visible="false"/>
<separator name="formatting" visible="true"/>
<separator name="updatePolicy" visible="true"/>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.VariableView?after=updatePolicy">
<menu
id="org.eclipse.dd.dsf.debug.ui.variablesView_updatePolicies"
label="%menu.updatePolicy">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreUpdatePoliciesSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.variablesUpdatePolicies"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdatePoliciesContribution">
</dynamic>
</menu>
<menu
id="org.eclipse.dd.dsf.debug.ui.variablesView_updateScopes"
label="%menu.updateScope">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreUpdateScopesSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.variablesUpdateScopes"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdateScopesContribution">
</dynamic>
</menu>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.VariableView?after=formatting">
<menu
id="org.eclipse.dd.dsf.debug.ui.variablesView_numberFormats"
label="%menu.numberFormat">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreNumberFormatsSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.variablesNumberFormats"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.NumberFormatsContribution">
</dynamic>
</menu>
</menuContribution>
<!-- Expressions view menu commands -->
<menuContribution
locationURI="menu:org.eclipse.debug.ui.ExpressionView?after=additions">
<separator name="additions" visible="false"/>
<separator name="formatting" visible="true"/>
<separator name="updatePolicy" visible="true"/>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.ExpressionView?after=updatePolicy">
<menu
id="org.eclipse.dd.dsf.debug.ui.expressionsView_updatePolicies"
label="%menu.updatePolicy">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreUpdatePoliciesSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.expressionUpdatePolicies"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdatePoliciesContribution">
</dynamic>
</menu>
<menu
id="org.eclipse.dd.dsf.debug.ui.expressionsView_updateScopes"
label="%menu.updateScope">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreUpdateScopesSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.expressionUpdateScopes"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdateScopesContribution">
</dynamic>
</menu>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.debug.ui.ExpressionView?after=formatting">
<menu
id="org.eclipse.dd.dsf.debug.ui.expressionsView_numberFormats"
label="%menu.numberFormat">
<visibleWhen checkEnabled="false">
<reference definitionId="org.eclipse.dd.dsf.debug.ui.testAreNumberFormatsSupported"/>
</visibleWhen>
<dynamic
id="org.eclipse.dd.dsf.debug.ui.expressionNumberFormats"
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.NumberFormatsContribution">
</dynamic>
</menu>
</menuContribution>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="org.eclipse.dd.dsf.debug.ui.testAreUpdatePoliciesSupported">
<and>
<with variable="org.eclipse.core.runtime.Platform">
<test property="org.eclipse.core.runtime.bundleState"
args="org.eclipse.dd.dsf.debug.ui"
value="ACTIVE"/>
</with>
<or>
<with variable="activePart">
<test property="org.eclipse.dd.dsf.debug.ui.areUpdatePoliciesSupported"/>
</with>
<with variable="selection">
<test property="org.eclipse.dd.dsf.debug.ui.areUpdatePoliciesSupported"/>
</with>
</or>
</and>
</definition>
<definition
id="org.eclipse.dd.dsf.debug.ui.testAreUpdateScopesSupported">
<and>
<with variable="org.eclipse.core.runtime.Platform">
<test property="org.eclipse.core.runtime.bundleState"
args="org.eclipse.dd.dsf.debug.ui"
value="ACTIVE"/>
</with>
<or>
<with variable="activePart">
<test property="org.eclipse.dd.dsf.debug.ui.areUpdateScopesSupported"/>
</with>
<with variable="selection">
<test property="org.eclipse.dd.dsf.debug.ui.areUpdateScopesSupported"/>
</with>
</or>
</and>
</definition>
<definition
id="org.eclipse.dd.dsf.debug.ui.testAreNumberFormatsSupported">
<and>
<with variable="org.eclipse.core.runtime.Platform">
<test property="org.eclipse.core.runtime.bundleState"
args="org.eclipse.dd.dsf.debug.ui"
value="ACTIVE"/>
</with>
<or>
<with variable="activePart">
<test property="org.eclipse.dd.dsf.debug.ui.areNumberFormatsSupported"/>
</with>
<with variable="selection">
<test property="org.eclipse.dd.dsf.debug.ui.areNumberFormatsSupported"/>
</with>
</or>
</and>
</definition>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdatePoliciesPropertyTester"
id="org.eclipse.dd.dsf.debug.ui.selectionUpdatePoliciesTester"
namespace="org.eclipse.dd.dsf.debug.ui"
properties="areUpdatePoliciesSupported,isUpdatePolicyAvailable,isUpdatePolicyActive"
type="org.eclipse.dd.dsf.ui.viewmodel.IVMContext">
</propertyTester>
<propertyTester
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdatePoliciesPropertyTester"
id="org.eclipse.dd.dsf.debug.ui.partUpdatePoliciesTester"
namespace="org.eclipse.dd.dsf.debug.ui"
properties="areUpdatePoliciesSupported,isUpdatePolicyAvailable,isUpdatePolicyActive"
type="org.eclipse.debug.ui.IDebugView">
</propertyTester>
<propertyTester
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdateScopesPropertyTester"
id="org.eclipse.dd.dsf.debug.ui.selectionUpdateScopesTester"
namespace="org.eclipse.dd.dsf.debug.ui"
properties="areUpdateScopesSupported,isUpdateScopeAvailable,isUpdateScopeActive"
type="org.eclipse.dd.dsf.ui.viewmodel.IVMContext">
</propertyTester>
<propertyTester
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.UpdateScopesPropertyTester"
id="org.eclipse.dd.dsf.debug.ui.partUpdateScopesTester"
namespace="org.eclipse.dd.dsf.debug.ui"
properties="areUpdateScopesSupported,isUpdateScopeAvailable,isUpdateScopeActive"
type="org.eclipse.debug.ui.IDebugView">
</propertyTester>
<propertyTester
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.NumberFormatsPropertyTester"
id="org.eclipse.dd.dsf.debug.ui.selectionNumberFormatsTester"
namespace="org.eclipse.dd.dsf.debug.ui"
properties="areNumberFormatsSupported,isNumberFormatAvailable,isNumberFormatActive"
type="org.eclipse.dd.dsf.ui.viewmodel.IVMContext">
</propertyTester>
<propertyTester
class="org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.NumberFormatsPropertyTester"
id="org.eclipse.dd.dsf.debug.ui.partNumberFormatsTester"
namespace="org.eclipse.dd.dsf.debug.ui"
properties="areNumberFormatsSupported,isNumberFormatAvailable,isNumberFormatActive"
type="org.eclipse.debug.ui.IDebugView">
</propertyTester>
</extension> </extension>
<extension <extension

View file

@ -0,0 +1,115 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.dd.dsf.ui.viewmodel.IVMAdapter;
import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.services.IServiceLocator;
/**
* Static utility methods for use with View Model related
* commands and handlers.
*
* @since 1.1
*/
@SuppressWarnings("restriction")
public class VMCommandUtils {
/**
* Retrieves the active VM provider based on the currently active
* selection and part.
* @param serviceLocator Service locator for access to active selection
* and part.
*
* @return The active VM provder.
*/
static public IVMProvider getActiveVMProvider(IServiceLocator serviceLocator) {
ISelection selection = null;
ISelectionService selectionService =
(ISelectionService)serviceLocator.getService(ISelectionService.class);
if (selectionService != null) {
selection = selectionService.getSelection();
}
if (selection != null && !selection.isEmpty()) {
return getVMProviderForSelection(selection);
}
else {
IWorkbenchPart part = null;
IPartService partService = (IPartService)serviceLocator.getService(IPartService.class);
if (partService != null) {
part = partService.getActivePart();
}
return getVMProviderForPart(part);
}
}
public static IVMProvider getVMProviderForPart(IWorkbenchPart part) {
IDebugContextService contextService =
DebugUITools.getDebugContextManager().getContextService(part.getSite().getWorkbenchWindow());
ISelection debugContext = contextService.getActiveContext(getPartId(part));
if (debugContext == null) {
debugContext = contextService.getActiveContext();
}
Object input = null;
if (debugContext instanceof IStructuredSelection) {
input = ((IStructuredSelection)debugContext).getFirstElement();
}
if (part instanceof IDebugView) {
Viewer viewer = ((IDebugView)part).getViewer();
if (input instanceof IAdaptable && viewer instanceof TreeModelViewer) {
IPresentationContext presContext = ((TreeModelViewer)viewer).getPresentationContext();
IVMAdapter vmAdapter = (IVMAdapter)((IAdaptable)input).getAdapter(IVMAdapter.class);
return vmAdapter.getVMProvider(presContext);
}
}
return null;
}
private static String getPartId(IWorkbenchPart part) {
if (part instanceof IViewPart) {
IViewSite site = (IViewSite)part.getSite();
return site.getId() + (site.getSecondaryId() != null ? (":" + site.getSecondaryId()) : ""); //$NON-NLS-1$ //$NON-NLS-2$
} else {
return part.getSite().getId();
}
}
public static IVMProvider getVMProviderForSelection(ISelection selection) {
if (selection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof IVMContext) {
return ((IVMContext)element).getVMNode().getVMProvider();
}
}
return null;
}
}

View file

@ -1,197 +0,0 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.IDebugVMConstants;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewSite;
@SuppressWarnings("restriction")
public class AbstractSetFormatStyle implements IViewActionDelegate, IDebugContextListener {
/*
* Local private storage.
*/
private IViewPart fpart = null;
private Object fViewInput = null;
private IAction fAction = null;
/*
* This routine is meant to be overidden so extenders of this class tell us what
* to use for the default.
*/
protected String getFormatStyle() {
return IFormattedValues.NATURAL_FORMAT;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
public void init(IViewPart view) {
/*
* Save the view information for later reference and data retrieval.
*/
fpart = view;
/*
* Get the current selection from the DebugView so we can determine if we want this menu action to be live or not.
*/
IViewSite site = (IViewSite) view.getSite();
String combinedViewId = site.getId() + (site.getSecondaryId() != null ? (":" + site.getSecondaryId()) : ""); //$NON-NLS-1$ //$NON-NLS-2$
DebugUITools.getDebugContextManager().getContextService(view.getSite().getWorkbenchWindow()).addPostDebugContextListener(this, combinedViewId);
ISelection sel = DebugUITools.getDebugContextManager().getContextService(view.getSite().getWorkbenchWindow()).getActiveContext();
if ( sel instanceof IStructuredSelection ) {
/*
* Save the view selection as well so we can later determine if we want our action to be valid or not.
*/
fViewInput = ( (IStructuredSelection) sel ).getFirstElement();
}
}
/*
* (non-Javadoc)
* @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
*/
public void debugContextChanged(DebugContextEvent event) {
/*
* This handler is called whenever a selection in the debug view is changed. So here is
* where we will know when we need to reenable the menu actions.
*/
ISelection sel = event.getContext();
if (sel instanceof IStructuredSelection) {
fViewInput = ((IStructuredSelection)sel).getFirstElement();
}
/*
* Update the current state of affairs.
*/
update();
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
/*
* Make sure we have a valid set of information. Otherwise we cannot go forward.
*/
if ( fpart instanceof AbstractDebugView && fViewInput != null )
{
Viewer viewer = ( (AbstractDebugView) fpart).getViewer();
/*
* Now we need to make sure this is one of the Flexible Hierarchy viewws.
*/
if ( viewer instanceof TreeModelViewer ) {
/*
* Get the presentation context and see if there is a numeric property there. If so then this
* is a view implementation which supports changing the format.
*/
TreeModelViewer treeViewer = (TreeModelViewer) viewer;
IPresentationContext context = treeViewer.getPresentationContext();
/*
* Store the new style. So it will be picked up by the view when the view changes.
*/
context.setProperty( IDebugVMConstants.CURRENT_FORMAT_STORAGE, getFormatStyle() );
}
}
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
/*
* Since we are creating a generic central handler ( "update" ). It needs to get the
* action information later.
*/
fAction = action;
/*
* We need to what our input is. This will either be a selection from the debug view
* or something selected in our view.
*/
if (selection instanceof IStructuredSelection) {
Object element = ( (IStructuredSelection) selection ).getFirstElement();
if (element instanceof IDMVMContext ) { fViewInput = element; }
else {
/*
* We deliberately do nothing here. A valid structured selection has already been
* selected. It comes from the Debug View and is a valid Debug Element. We do not
* want to overwrite it.
*/
}
} else {
fViewInput = null;
}
update();
}
/*
* This is the common processing routine which is called from the various selection routines.
* Its job is to determine if we are valid for OCD and if so what is the proper execution dmc
* we should be operating on
*/
private void update() {
if ( fAction != null ) {
/*
* If the element is a debug view context selection then we want to be active since
* a possible OCD selection is there. We will let the connection type determine if
* we are active or not.
*/
if ( fViewInput instanceof IDebugElement )
{
fAction.setEnabled(true);
}
else if ( fViewInput instanceof IDMVMContext )
{
fAction.setEnabled(true);
}
else {
/*
* It is not us and we will mark ourselves not available. Remember on reselection will
* will renable again. The Debug View change handler we have will deal with being moved
* back into the picture.
*/
fAction.setEnabled(false);
}
}
}
}

View file

@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;
import org.eclipse.osgi.util.NLS;
public class MessagesForNumberFormat extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.messages"; //$NON-NLS-1$
public static String NumberFormatContribution_Natural_label;
public static String NumberFormatContribution_Decimal_label;
public static String NumberFormatContribution_Hex_label;
public static String NumberFormatContribution_Octal_label;
public static String NumberFormatContribution_Binary_label;
public static String NumberFormatContribution_String_label;
public static String NumberFormatContribution_EmptyFormatsList_label;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, MessagesForNumberFormat.class);
}
private MessagesForNumberFormat() {}
}

View file

@ -0,0 +1,126 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.IDebugVMConstants;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.actions.CompoundContributionItem;
import org.eclipse.ui.menus.IWorkbenchContribution;
import org.eclipse.ui.services.IServiceLocator;
/**
* Dynamic menu contribution that shows available number formats
* in the current view.
*
* @since 1.1
*/
@SuppressWarnings("restriction")
public class NumberFormatsContribution extends CompoundContributionItem implements IWorkbenchContribution {
private static final Map<String, String> FORMATS = new LinkedHashMap<String, String>();
static {
FORMATS.put(IFormattedValues.NATURAL_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Natural_label);
FORMATS.put(IFormattedValues.HEX_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Hex_label);
FORMATS.put(IFormattedValues.DECIMAL_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Decimal_label);
FORMATS.put(IFormattedValues.OCTAL_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Octal_label);
FORMATS.put(IFormattedValues.BINARY_FORMAT, MessagesForNumberFormat.NumberFormatContribution_Binary_label);
FORMATS.put(IFormattedValues.STRING_FORMAT, MessagesForNumberFormat.NumberFormatContribution_String_label);
}
private class SelectNumberFormatAction extends Action {
private final IPresentationContext fContext;
private final String fFormatId;
SelectNumberFormatAction(IPresentationContext context, String formatId) {
super(FORMATS.get(formatId), AS_RADIO_BUTTON);
fContext = context;
fFormatId = formatId;
}
@Override
public void run() {
if (isChecked()) {
fContext.setProperty(IDebugVMConstants.CURRENT_FORMAT_STORAGE, fFormatId);
}
}
}
private IServiceLocator fServiceLocator;
private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] {
new ContributionItem() {
@Override
public void fill(Menu menu, int index) {
MenuItem item = new MenuItem(menu, SWT.NONE);
item.setEnabled(false);
item.setText(MessagesForNumberFormat.NumberFormatContribution_EmptyFormatsList_label);
}
@Override
public boolean isEnabled() {
return false;
}
}
};
@Override
protected IContributionItem[] getContributionItems() {
IVMProvider provider = VMCommandUtils.getActiveVMProvider(fServiceLocator);
// If no part or selection, disable all.
if (provider == null) {
return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
}
IPresentationContext context = provider.getPresentationContext();
Object activeId = context.getProperty(IDebugVMConstants.CURRENT_FORMAT_STORAGE);
if (activeId == null) {
activeId = IFormattedValues.NATURAL_FORMAT;
}
List<Action> actions = new ArrayList<Action>(FORMATS.size());
for (String formatId : FORMATS.keySet()) {
Action action = new SelectNumberFormatAction(context, formatId);
if (formatId.equals(activeId)) {
action.setChecked(true);
}
actions.add(action);
}
if ( actions.isEmpty() ) {
return NO_BREAKPOINT_TYPES_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;
}
public void initialize(IServiceLocator serviceLocator) {
fServiceLocator = serviceLocator;
}
}

View file

@ -0,0 +1,88 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.IDebugVMConstants;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.ui.IWorkbenchPart;
/**
* Property tester for number format information available through the given
* object. The object being tested should be either an {@link IVMContext},
* through which an instance of {@link IVMProvider} 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.
* The view's presentation context is used to test the given property.
* <p>
* Three properties are supported:
* <ul>
* <li> "areNumberFormatsSupported" - Checks whether number formats are
* available at all given the receiver.</li>
* <li> "isNumberFormatAvailable" - Checks whether the number format ID in the
* expected value is available for the given receiver.</li>
* <li> "isNumberFormatActive" - Checks whether the number format ID in the expected
* value is the currently active number format for the given receiver.</li>
* </ul>
* </p>
*/
@SuppressWarnings("restriction")
public class NumberFormatsPropertyTester extends PropertyTester {
private static final String SUPPORTED = "areNumberFormatsSupported"; //$NON-NLS-1$
private static final String AVAILABLE = "isNumberFormatAvailable"; //$NON-NLS-1$
private static final String ACTIVE = "isNumberFormatActive"; //$NON-NLS-1$
private static final List<String> AVAILABLE_FORMATS = new ArrayList<String>();
static {
AVAILABLE_FORMATS.add(IFormattedValues.NATURAL_FORMAT);
AVAILABLE_FORMATS.add(IFormattedValues.HEX_FORMAT);
AVAILABLE_FORMATS.add(IFormattedValues.DECIMAL_FORMAT);
AVAILABLE_FORMATS.add(IFormattedValues.OCTAL_FORMAT);
AVAILABLE_FORMATS.add(IFormattedValues.BINARY_FORMAT);
AVAILABLE_FORMATS.add(IFormattedValues.STRING_FORMAT);
};
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IVMContext) {
IVMProvider provider = ((IVMContext)receiver).getVMNode().getVMProvider();
if (provider != null) {
return testProvider(provider, property, expectedValue);
}
} else if (receiver instanceof IDebugView) {
IVMProvider provider = VMCommandUtils.getVMProviderForPart((IDebugView)receiver);
if (provider != null) {
return testProvider(provider, property, expectedValue);
}
}
return false;
}
private boolean testProvider(IVMProvider provider, String property, Object expectedValue) {
if (SUPPORTED.equals(property)) {
return true;
} else if (AVAILABLE.equals(property)) {
return AVAILABLE_FORMATS.contains(expectedValue);
} else if (ACTIVE.equals(property)) {
Object activeId = provider.getPresentationContext().getProperty(IDebugVMConstants.CURRENT_FORMAT_STORAGE);
return expectedValue != null && expectedValue.equals(activeId);
}
return false;
}
}

View file

@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
public class SetDefaultFormatBinary extends AbstractSetFormatStyle {
@Override
protected String getFormatStyle() {
return IFormattedValues.BINARY_FORMAT;
}
}

View file

@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
public class SetDefaultFormatDecimal extends AbstractSetFormatStyle {
@Override
protected String getFormatStyle() {
return IFormattedValues.DECIMAL_FORMAT;
}
}

View file

@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
public class SetDefaultFormatHex extends AbstractSetFormatStyle {
@Override
protected String getFormatStyle() {
return IFormattedValues.HEX_FORMAT;
}
}

View file

@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
public class SetDefaultFormatNatural extends AbstractSetFormatStyle {
@Override
protected String getFormatStyle() {
return IFormattedValues.NATURAL_FORMAT;
}
}

View file

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle;
import org.eclipse.dd.dsf.debug.service.IFormattedValues;
public class SetDefaultFormatOctal extends AbstractSetFormatStyle {
@Override
protected String getFormatStyle() {
return IFormattedValues.OCTAL_FORMAT;
}
}

View file

@ -0,0 +1,19 @@
###############################################################################
# Copyright (c) 2006, 2008 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Wind River Systems Inc - copied for non-restricted version for DSDP/DD/DSF
###############################################################################
NumberFormatContribution_Natural_label=Natural
NumberFormatContribution_Decimal_label=Decimal
NumberFormatContribution_Hex_label=Hex
NumberFormatContribution_Octal_label=Octal
NumberFormatContribution_Binary_label=Binary
NumberFormatContribution_String_label=String
NumberFormatContribution_EmptyFormatsList_label=Number formats not available

View file

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.dd.dsf.ui.viewmodel.update.AllUpdateScope;
/**
* @since 1.1
*/
public class AllUpdateScopeAction extends SelectUpdateScopeAction {
public AllUpdateScopeAction() {
super(AllUpdateScope.ALL_UPDATE_SCOPE_ID);
}
}

View file

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.dd.dsf.ui.viewmodel.update.AutomaticUpdatePolicy;
/**
*
*/
public class AutomaticUpdatePolicyAction extends SelectUpdatePolicyAction {
public AutomaticUpdatePolicyAction() {
super(AutomaticUpdatePolicy.AUTOMATIC_UPDATE_POLICY_ID);
}
}

View file

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.BreakpointHitUpdatePolicy;
/**
*
*/
public class BreakpointHitUpdatePolicyAction extends SelectUpdatePolicyAction {
public BreakpointHitUpdatePolicyAction() {
super(BreakpointHitUpdatePolicy.BREAKPOINT_HIT_UPDATE_POLICY_ID);
}
}

View file

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.dd.dsf.ui.viewmodel.update.ManualUpdatePolicy;
/**
*
*/
public class ManualUpdatePolicyAction extends SelectUpdatePolicyAction {
public ManualUpdatePolicyAction() {
super(ManualUpdatePolicy.MANUAL_UPDATE_POLICY_ID);
}
}

View file

@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.osgi.util.NLS;
public class MessagesForVMUpdateActions extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions.messages"; //$NON-NLS-1$
public static String UpdatePoliciesContribution_EmptyPoliciesList_label;
public static String UpdateScopesContribution_EmptyScopesList_label;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, MessagesForVMUpdateActions.class);
}
private MessagesForVMUpdateActions() {}
}

View file

@ -1,85 +0,0 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.AbstractVMProviderActionDelegate;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewPart;
/**
*
*/
public class SelectUpdatePolicyAction extends AbstractVMProviderActionDelegate {
private final String fUpdatePolicyId;
public SelectUpdatePolicyAction(String policyId) {
fUpdatePolicyId = policyId;
}
protected String getUpdatePolicyId() {
return fUpdatePolicyId;
}
@Override
public void init(IViewPart view) {
super.init(view);
update();
}
public void run(IAction action) {
IVMProvider provider = getVMProvider();
if (provider instanceof ICachingVMProvider) {
ICachingVMProvider cachingProvider = (ICachingVMProvider)provider;
IVMUpdatePolicy policy = getPolicyFromProvider(cachingProvider, getUpdatePolicyId());
if (policy != null) {
cachingProvider.setActiveUpdatePolicy(policy);
}
}
}
private IVMUpdatePolicy getPolicyFromProvider(ICachingVMProvider provider, String id) {
for (IVMUpdatePolicy policy : provider.getAvailableUpdatePolicies()) {
if (policy.getID().equals(id)) {
return policy;
}
}
return null;
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
update();
}
@Override
public void debugContextChanged(DebugContextEvent event) {
super.debugContextChanged(event);
update();
}
protected void update() {
IVMProvider provider = getVMProvider();
if (provider instanceof ICachingVMProvider) {
getAction().setEnabled(true);
IVMUpdatePolicy activePolicy = ((ICachingVMProvider)provider).getActiveUpdatePolicy();
getAction().setChecked( activePolicy != null && getUpdatePolicyId().equals(activePolicy.getID()) );
} else {
getAction().setEnabled(false);
}
}
}

View file

@ -1,89 +0,0 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.AbstractVMProviderActionDelegate;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProviderExtension;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdateScope;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewPart;
/**
* @since 1.1
*/
public class SelectUpdateScopeAction extends AbstractVMProviderActionDelegate {
private final String fUpdateScopeId;
public SelectUpdateScopeAction(String policyId) {
fUpdateScopeId = policyId;
}
protected String getUpdateScopeId() {
return fUpdateScopeId;
}
@Override
public void init(IViewPart view) {
super.init(view);
update();
}
public void run(IAction action) {
if(action.isChecked())
{
IVMProvider provider = getVMProvider();
if (provider instanceof ICachingVMProvider) {
ICachingVMProviderExtension cachingProvider = (ICachingVMProviderExtension)provider;
IVMUpdateScope policy = getScopeFromProvider(cachingProvider, getUpdateScopeId());
if (policy != null) {
cachingProvider.setActiveUpdateScope(policy);
}
}
}
}
private IVMUpdateScope getScopeFromProvider(ICachingVMProviderExtension provider, String id) {
for (IVMUpdateScope policy : provider.getAvailableUpdateScopes()) {
if (policy.getID().equals(id)) {
return policy;
}
}
return null;
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
update();
}
@Override
public void debugContextChanged(DebugContextEvent event) {
super.debugContextChanged(event);
update();
}
protected void update() {
IVMProvider provider = getVMProvider();
if (provider instanceof ICachingVMProviderExtension) {
getAction().setEnabled(true);
IVMUpdateScope activeScope = ((ICachingVMProviderExtension)provider).getActiveUpdateScope();
getAction().setChecked( activeScope != null && getUpdateScopeId().equals(activeScope.getID()) );
} else {
getAction().setEnabled(false);
}
}
}

View file

@ -0,0 +1,110 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.actions.CompoundContributionItem;
import org.eclipse.ui.menus.IWorkbenchContribution;
import org.eclipse.ui.services.IServiceLocator;
/**
* 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_BREAKPOINT_TYPES_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(MessagesForVMUpdateActions.UpdateScopesContribution_EmptyScopesList_label);
}
@Override
public boolean isEnabled() {
return false;
}
}
};
@Override
protected IContributionItem[] getContributionItems() {
IVMProvider provider = VMCommandUtils.getActiveVMProvider(fServiceLocator);
// If no part or selection, disable all.
if (provider == null || !(provider instanceof ICachingVMProvider)) {
return NO_BREAKPOINT_TYPES_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_BREAKPOINT_TYPES_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;
}
public void initialize(IServiceLocator serviceLocator) {
fServiceLocator = serviceLocator;
}
}

View file

@ -0,0 +1,78 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdatePolicy;
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},
* 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.
* 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
* available at all given the receiver.</li>
* <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
* 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$
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 = VMCommandUtils.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;
}
}

View file

@ -0,0 +1,110 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProviderExtension;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdateScope;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.actions.CompoundContributionItem;
import org.eclipse.ui.menus.IWorkbenchContribution;
import org.eclipse.ui.services.IServiceLocator;
/**
* Dynamic menu contribution that shows available update scopes
* in the current view.
*
* @since 1.1
*/
public class UpdateScopesContribution extends CompoundContributionItem implements IWorkbenchContribution {
private class SelectUpdateScopeAction extends Action {
private final ICachingVMProviderExtension fProvider;
private final IVMUpdateScope fScope;
SelectUpdateScopeAction(ICachingVMProviderExtension provider, IVMUpdateScope scope) {
super(scope.getName(), AS_RADIO_BUTTON);
fProvider = provider;
fScope = scope;
}
@Override
public void run() {
if (isChecked()) {
fProvider.setActiveUpdateScope(fScope);
}
}
}
private IServiceLocator fServiceLocator;
private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] {
new ContributionItem() {
@Override
public void fill(Menu menu, int index) {
MenuItem item = new MenuItem(menu, SWT.NONE);
item.setEnabled(false);
item.setText(MessagesForVMUpdateActions.UpdateScopesContribution_EmptyScopesList_label);
}
@Override
public boolean isEnabled() {
return false;
}
}
};
@Override
protected IContributionItem[] getContributionItems() {
IVMProvider provider = VMCommandUtils.getActiveVMProvider(fServiceLocator);
// If no part or selection, disable all.
if (provider == null || !(provider instanceof ICachingVMProviderExtension)) {
return NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS;
}
ICachingVMProviderExtension cachingProvider = (ICachingVMProviderExtension)provider;
IVMUpdateScope[] scopes = cachingProvider.getAvailableUpdateScopes();
IVMUpdateScope activeScope = cachingProvider.getActiveUpdateScope();
List<Action> actions = new ArrayList<Action>(scopes.length);
for (IVMUpdateScope scope : scopes) {
Action action = new SelectUpdateScopeAction(cachingProvider, scope);
if (scope.getID().equals(activeScope.getID())) {
action.setChecked(true);
}
actions.add(action);
}
if ( actions.isEmpty() ) {
return NO_BREAKPOINT_TYPES_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;
}
public void initialize(IServiceLocator serviceLocator) {
fServiceLocator = serviceLocator;
}
}

View file

@ -0,0 +1,78 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.actions.VMCommandUtils;
import org.eclipse.dd.dsf.ui.viewmodel.IVMContext;
import org.eclipse.dd.dsf.ui.viewmodel.IVMProvider;
import org.eclipse.dd.dsf.ui.viewmodel.update.ICachingVMProviderExtension;
import org.eclipse.dd.dsf.ui.viewmodel.update.IVMUpdateScope;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.ui.IWorkbenchPart;
/**
* Property tester for update scope information available through the given
* object. The object being tested should be either an {@link IVMContext},
* through which an instance of {@link ICachingVMProviderExtension} 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.
* The Caching View Model provider is used to test the given property.
* <p>
* Three properties are supported:
* <ul>
* <li> "areUpdateScopesSupported" - Checks whether update scopes are
* available at all given the receiver.</li>
* <li> "isUpdateScopeAvailable" - Checks whether the update scope in the
* expected value is available for the given receiver.</li>
* <li> "isUpdateScopeActive" - Checks whether the scope given in the expected
* value is the currently active scope for the given receiver.</li>
* </ul>
* </p>
*/
public class UpdateScopesPropertyTester extends PropertyTester {
private static final String SUPPORTED = "areUpdateScopesSupported"; //$NON-NLS-1$
private static final String AVAILABLE = "isUpdateScopeAvailable"; //$NON-NLS-1$
private static final String ACTIVE = "isUpdateScopeActive"; //$NON-NLS-1$
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IVMContext) {
IVMProvider provider = ((IVMContext)receiver).getVMNode().getVMProvider();
if (provider instanceof ICachingVMProviderExtension) {
return testProvider((ICachingVMProviderExtension)provider, property, expectedValue);
}
} else if (receiver instanceof IDebugView) {
IVMProvider provider = VMCommandUtils.getVMProviderForPart((IDebugView)receiver);
if (provider instanceof ICachingVMProviderExtension) {
return testProvider((ICachingVMProviderExtension)provider, property, expectedValue);
}
}
return false;
}
private boolean testProvider(ICachingVMProviderExtension provider, String property, Object expectedValue) {
if (SUPPORTED.equals(property)) {
return true;
} else if (AVAILABLE.equals(property)) {
for (IVMUpdateScope scope : provider.getAvailableUpdateScopes()) {
if (scope.getID().equals(expectedValue)) {
return true;
}
return false;
}
} else if (ACTIVE.equals(property)) {
return expectedValue != null && expectedValue.equals(provider.getActiveUpdateScope().getID());
}
return false;
}
}

View file

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.update.actions;
import org.eclipse.dd.dsf.ui.viewmodel.update.VisibleUpdateScope;
/**
* @since 1.1
*/
public class VisibleUpdateScopeAction extends SelectUpdateScopeAction {
public VisibleUpdateScopeAction() {
super(VisibleUpdateScope.VISIBLE_UPDATE_SCOPE_ID);
}
}

View file

@ -0,0 +1,13 @@
###############################################################################
# Copyright (c) 2006, 2008 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Wind River Systems Inc - copied for non-restricted version for DSDP/DD/DSF
###############################################################################
UpdatePoliciesContribution_EmptyPoliciesList_label=No update policies available
UpdateScopesContribution_EmptyScopesList_label=No update scopes available