org.eclipse.gmf.runtime.diagram.ui.properties.sections
Class AbstractModelerPropertySection
java.lang.Object
org.eclipse.ui.views.properties.tabbed.AbstractPropertySection
org.eclipse.gmf.runtime.diagram.ui.properties.sections.AbstractModelerPropertySection
-
All Implemented Interfaces:
-
ISection
-
Direct Known Subclasses:
-
AbstractBasicTextPropertySection,
AbstractNotationPropertiesSection,
AdvancedPropertySection
-
public abstract class AbstractModelerPropertySection
- extends
AbstractPropertySection
An abstract implementation of a section in a tab in the tabbed property sheet
page for modeler.
Field Summary
|
protected boolean
|
disposed
a flag indicating if this property section got disposed |
protected org.eclipse.emf.ecore.EObject
|
eObject
eObject should gradually replace EElement |
protected org.eclipse.emf.transaction.DemultiplexingListener
|
eventListener
model event listener |
protected java.util.List
|
input
object currently selected on either a diagram or a ME - a view |
protected static
PropertiesServiceAdapterFactory
|
propertiesProvider
|
protected static java.lang.String
|
VALUE_CHANGED_STRING
value changed string |
Method Summary
|
void
|
aboutToBeHidden
()
|
void
|
aboutToBeShown
()
|
protected org.eclipse.emf.ecore.EObject
|
adapt
(java.lang.Object object)
Adapt the object to an EObject - if possible |
protected boolean
|
addToEObjectList
(java.lang.Object object)
Add next object in the selection to the list of EObjects if this object
could be adapted to an EObject
|
protected
ICommand
|
createCommand
(java.lang.String name,
org.eclipse.emf.ecore.EObject res,
java.lang.Runnable runnable)
|
protected
ICommand
|
createCommand
(java.lang.String name,
org.eclipse.emf.ecore.resource.Resource res,
java.lang.Runnable runnable)
|
void
|
createControls
(
Composite parent,
TabbedPropertySheetPage aTabbedPropertySheetPage)
|
protected boolean
|
digIntoGroups
()
Override to return true to have this property section work on the shapes
in a GroupEditPart as if the shapes were multi-selected. |
void
|
dispose
()
|
protected
CommandResult
|
executeAsCompositeCommand
(java.lang.String actionName,
java.util.List commands)
A utility method allows execute a list of commands by wrapping them\ in a
composite command. |
protected void
|
executeAsReadAction
(java.lang.Runnable code)
A utility method allows execute a piece of code wrapping it in the read
call to the model. |
protected org.eclipse.emf.transaction.TransactionalEditingDomain
|
getEditingDomain
()
Gets the editing domain from my EObject input. |
protected org.eclipse.emf.ecore.EObject
|
getEObject
()
|
protected java.util.List
|
getEObjectList
()
|
protected org.eclipse.emf.transaction.DemultiplexingListener
|
getEventListener
()
|
org.eclipse.emf.transaction.NotificationFilter
|
getFilter
()
Subclasses overriding this method should remember to override
update(TransactionalEditingDomain, Notification) as required. |
java.util.List
|
getInput
()
Returns currently selected view object |
protected java.lang.Object
|
getPrimarySelection
()
Returns currently selected view object |
protected int
|
getStandardLabelWidth
(
Composite parent,
java.lang.String[] labels)
Get the standard label width when labels for sections line up on the left
hand side of the composite. |
protected
SectionUpdateRequestCollapser
|
getUpdateRequestCollapser
()
|
void
|
handleElementModifiedEvent
(org.eclipse.emf.common.notify.Notification notification,
org.eclipse.emf.ecore.EObject element)
|
protected boolean
|
isCurrentSelection
(org.eclipse.emf.common.notify.Notification notification,
org.eclipse.emf.ecore.EObject element)
Determines if the page is displaying properties for this element |
protected boolean
|
isDisposed
()
|
protected boolean
|
isNotifierDeleted
(org.eclipse.emf.common.notify.Notification notification)
Returns whether or not the notifier for a particular notification has been
deleted from its parent. |
protected boolean
|
isReadOnly
()
Determine if the property sheet page contributor is read only. |
protected void
|
postUpdateRequest
(java.lang.Runnable updateRequest)
Use requset collapser to post update requests. |
protected void
|
setEditingDomain
(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
Sets the editingDomain. |
protected void
|
setEObject
(org.eclipse.emf.ecore.EObject object)
|
void
|
setInput
(
IWorkbenchPart part,
ISelection selection)
|
protected org.eclipse.emf.ecore.EObject
|
unwrap
(java.lang.Object object)
Unwarp the ME or diagram object down to the underlaying UML element |
void
|
update
(org.eclipse.emf.common.notify.Notification notification,
org.eclipse.emf.ecore.EObject element)
Update if nessesary, upon receiving the model event. |
protected void
|
update
(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
org.eclipse.emf.common.notify.Notification notification)
Updates me if the notifier is an EObject by calling
update(Notification, EObject) . |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
eventListener
protected org.eclipse.emf.transaction.DemultiplexingListener eventListener
- model event listener
propertiesProvider
protected static final
PropertiesServiceAdapterFactory propertiesProvider
VALUE_CHANGED_STRING
protected static java.lang.String VALUE_CHANGED_STRING
- value changed string
input
protected java.util.List input
- object currently selected on either a diagram or a ME - a view
eObject
protected org.eclipse.emf.ecore.EObject eObject
- eObject should gradually replace EElement
disposed
protected boolean disposed
- a flag indicating if this property section got disposed
AbstractModelerPropertySection
public AbstractModelerPropertySection()
setInput
public void setInput(
IWorkbenchPart part,
ISelection selection)
-
-
Specified by:
-
setInput
in interface
ISection
-
Overrides:
-
setInput
in class
AbstractPropertySection
-
digIntoGroups
protected boolean digIntoGroups()
- Override to return true to have this property section work on the shapes
in a
GroupEditPart
as if the shapes were multi-selected.
-
-
Returns:
- true if this property section is to dig into the shapes of groups
addToEObjectList
protected boolean addToEObjectList(java.lang.Object object)
- Add next object in the selection to the list of EObjects if this object
could be adapted to an
EObject
-
-
Parameters:
-
object
- the object to add
-
Returns:
- - true if the object is added, false otherwise
unwrap
protected org.eclipse.emf.ecore.EObject unwrap(java.lang.Object object)
- Unwarp the ME or diagram object down to the underlaying UML element
-
-
Parameters:
-
object
- -
object from a diagram or ME
-
Returns:
- - underlaying UML element
adapt
protected org.eclipse.emf.ecore.EObject adapt(java.lang.Object object)
- Adapt the object to an EObject - if possible
-
-
Parameters:
-
object
- object from a diagram or ME
-
Returns:
- EObject
isCurrentSelection
protected boolean isCurrentSelection(org.eclipse.emf.common.notify.Notification notification,
org.eclipse.emf.ecore.EObject element)
- Determines if the page is displaying properties for this element
-
-
Parameters:
-
notification
- The notification -
element
- The element to be tested
-
Returns:
- 'true' if the page is displaying properties for this element
executeAsReadAction
protected void executeAsReadAction(java.lang.Runnable code)
- A utility method allows execute a piece of code wrapping it in the read
call to the model.
-
-
Parameters:
-
code
- -
Runnable code to execute
executeAsCompositeCommand
protected
CommandResult executeAsCompositeCommand(java.lang.String actionName,
java.util.List commands)
- A utility method allows execute a list of commands by wrapping them\ in a
composite command.
-
-
Parameters:
-
commands
- -
List of commands to execute
getInput
public java.util.List getInput()
- Returns currently selected view object
-
-
Returns:
- Returns the input.
aboutToBeHidden
public void aboutToBeHidden()
-
-
Specified by:
-
aboutToBeHidden
in interface
ISection
-
Overrides:
-
aboutToBeHidden
in class
AbstractPropertySection
-
aboutToBeShown
public void aboutToBeShown()
-
-
Specified by:
-
aboutToBeShown
in interface
ISection
-
Overrides:
-
aboutToBeShown
in class
AbstractPropertySection
-
dispose
public void dispose()
-
-
Specified by:
-
dispose
in interface
ISection
-
Overrides:
-
dispose
in class
AbstractPropertySection
-
getPrimarySelection
protected java.lang.Object getPrimarySelection()
- Returns currently selected view object
-
-
Returns:
- Returns the input.
getEObject
protected org.eclipse.emf.ecore.EObject getEObject()
-
-
Returns:
- Returns the eObject.
setEObject
protected void setEObject(org.eclipse.emf.ecore.EObject object)
-
-
Parameters:
-
object
- The eObject to set.
getFilter
public org.eclipse.emf.transaction.NotificationFilter getFilter()
- Subclasses overriding this method should remember to override
update(TransactionalEditingDomain, Notification)
as required.
The default implementation of
update(TransactionalEditingDomain, Notification)
will only
update if the notifier is an EObject
.
-
-
Returns:
- the filter for events used by my
eventListener
.
update
public void update(org.eclipse.emf.common.notify.Notification notification,
org.eclipse.emf.ecore.EObject element)
- Update if nessesary, upon receiving the model event. This event will only
be processed when the reciever is visible (the default behavior is not to
listen to the model events while not showing). Therefore it is safe to
refresh the UI. Sublclasses, which will choose to override event
listening behavior should take into account that the model events are
sent all the time - regardless of the section visibility. Thus special
care should be taken by the section that will choose to listen to such
events all the time. Also, the default implementation of this method
synchronizes on the GUI thread. The subclasses that overwrite it should
do the same if they perform any GUI work (because events may be sent from
a non-GUI thread).
-
-
Parameters:
-
notification
- notification object -
element
- element that has changed -
See Also:
-
aboutToBeShown()
,
aboutToBeHidden()
update
protected void update(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
org.eclipse.emf.common.notify.Notification notification)
- Updates me if the notifier is an
EObject
by calling
update(Notification, EObject)
. Does nothing otherwise.
Subclasses should override this method if they need to update based on
non-EObject notifiers.
-
-
Parameters:
-
domain
- the editing domain -
notification
- the event notification
isNotifierDeleted
protected boolean isNotifierDeleted(org.eclipse.emf.common.notify.Notification notification)
- Returns whether or not the notifier for a particular notification has been
deleted from its parent.
This is a fix for RATLC00535181. What happens is that during deletion of
an element from the diagram, the element first deletes related elements
which causes a modification of the element itself. When the modification occurs
the event handling mechanism posts a request to the UI queue to refresh the UI.
A race condition occurs where by the time the posted request runs, the element
in question may or may not have already been deleted from its container. If
the element has been deleted from its container, we should not refresh the
property section.
-
-
Parameters:
-
notification
-
-
Returns:
-
true
if notification has been deleted from its parent, false
otherwise
postUpdateRequest
protected void postUpdateRequest(java.lang.Runnable updateRequest)
- Use requset collapser to post update requests.
-
-
Parameters:
-
updateRequest
- -
runnable update code
handleElementModifiedEvent
public void handleElementModifiedEvent(org.eclipse.emf.common.notify.Notification notification,
org.eclipse.emf.ecore.EObject element)
-
getEObjectList
protected java.util.List getEObjectList()
-
-
Returns:
- Returns the eObjectList.
isDisposed
protected boolean isDisposed()
-
-
Returns:
- Returns the disposed.
getEventListener
protected org.eclipse.emf.transaction.DemultiplexingListener getEventListener()
-
-
Returns:
- Returns the eventListener.
createCommand
protected
ICommand createCommand(java.lang.String name,
org.eclipse.emf.ecore.resource.Resource res,
java.lang.Runnable runnable)
-
-
Returns:
- Returns a command
createCommand
protected
ICommand createCommand(java.lang.String name,
org.eclipse.emf.ecore.EObject res,
java.lang.Runnable runnable)
-
-
Returns:
- Returns a command
getEditingDomain
protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
- Gets the editing domain from my EObject input.
-
-
Returns:
- my editing domain
setEditingDomain
protected void setEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)
- Sets the editingDomain.
-
-
Parameters:
-
editingDomain
- The editingDomain to set.
createControls
public void createControls(
Composite parent,
TabbedPropertySheetPage aTabbedPropertySheetPage)
-
-
Specified by:
-
createControls
in interface
ISection
-
Overrides:
-
createControls
in class
AbstractPropertySection
-
isReadOnly
protected boolean isReadOnly()
- Determine if the property sheet page contributor is read only.
Topic and Browse diagrams have properties that are read only, even
theough the selection may be modifiable.
-
-
Returns:
-
true
if the contributor is read only.
getStandardLabelWidth
protected int getStandardLabelWidth(
Composite parent,
java.lang.String[] labels)
- Get the standard label width when labels for sections line up on the left
hand side of the composite. We line up to a fixed position, but if a
string is wider than the fixed position, then we use that widest string.
-
-
Parameters:
-
parent
- The parent composite used to create a GC. -
labels
- The list of labels.
-
Returns:
- the standard label width.
getUpdateRequestCollapser
protected
SectionUpdateRequestCollapser getUpdateRequestCollapser()
-
-
Returns:
- Returns the updateRequestCollapser.
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.