[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] Re: enabledWhen for handlers and editors
|
This is the contents of the expression definitions extension point:
There are property testers for the properties org.kdr.isNew,
org.kdr.isDirty, and org.kdr.isAllowed.
The org.kdr.isDirty simply examines the isDirty method of the
IEditorPart. org.kdr.isNew examines the model contained by the
associated IEditorPart.getEditorInput() which all have the method
isNew(). org.kdr.isAllowed checks permissions for the specific operation
(the first parameter) for the given object (the object contained in the
<with> tag or the class evaluated from the second parameter). If the
<with> tag is an ISelection or a collection and does not have an
<iterate> tag, it is iterated by the property tester and every object's
permission is checked. If not object is supplied by <with> the second
parameter is used to determine the class of the object and used to check
permissions (e.g. used for an add operation).
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="org.kdr.risk.definition.portfolio.view">
<and>
<with
variable="activeContexts">
<iterate
ifEmpty="false"
operator="or">
<or>
<equals
value="org.kdr.risk.context.portfolio">
</equals>
</or>
</iterate>
</with>
<with
variable="activePartId">
<equals
value="view.portfolio">
</equals>
</with>
</and>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.editor">
<and>
<with
variable="activeContexts">
<iterate
ifEmpty="false"
operator="or">
<or>
<equals
value="org.kdr.risk.context.portfolio">
</equals>
</or>
</iterate>
</with>
<with
variable="activeEditorId">
<equals
value="editor.portfolio">
</equals>
</with>
</and>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.editor.focus">
<and>
<with
variable="activeContexts">
<iterate
ifEmpty="false"
operator="or">
<or>
<equals
value="org.kdr.risk.context.portfolio">
</equals>
</or>
</iterate>
</with>
<with
variable="activePartId">
<equals
value="editor.portfolio">
</equals>
</with>
</and>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.not.new">
<with
variable="activeEditor">
<test
property="org.kdr.isNew"
value="false">
</test>
</with>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.dirty">
<with
variable="activeEditor">
<test
property="org.kdr.isDirty"
value="true">
</test>
</with>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.selected">
<with
variable="selection">
<and>
<count
value="+">
</count>
<iterate>
<or>
<instanceof
value="org.kdr.portfolio.Portfolio">
</instanceof>
</or>
</it0erate>
</and>
</with>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.security.add">
<with
variable="selection">
<and>
<test
args="add,org.kdr.portfolio.Portfolio"
property="org.kdr.isAllowed"
value="true">
</test>
</and>
</with>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.security.change">
<with
variable="selection">
<iterate>
<and>
<test
args="change"
property="org.kdr.isAllowed"
value="true">
</test>
</and>
</iterate>
</with>
</definition>
<definition
id="org.kdr.risk.definition.portfolio.security.delete">
<or>
<with
variable="selection">
<iterate>
<and>
<test
args="remove"
property="org.kdr.isAllowed"
value="true">
</test>
</and>
</iterate>
</with>
<and>
<reference
definitionId="org.kdr.risk.definition.portfolio.editor">
</reference>
<with
variable="activeEditor">
<test
args="remove,org.kdr.portfolio.Portfolio"
property="org.kdr.isAllowed"
value="true">
</test>
</with>
</and>
</or>
</definition>
</extension>
Paul Webster wrote:
What do the expression definitions look like? The variables used in the
definition (in <with/> elements) will determine when the expressions get
re-evaluated.
are you using property testers?
PW
>