Constructor and Description |
---|
CustomAttributeValueEditor() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.String |
getAttributeValue(EditedAttribute attribute,
java.lang.Object parentComponent)
Get a value for the current attribute.
|
TooltipIconInfo |
getTooltipButtonInfo(EditedAttribute attribute)
Get the information(tooltip and button) that describes the handle of the given attribute.
|
abstract boolean |
shouldHandleAttribute(EditedAttribute attribute)
Ask the custom editor if it wants to handle editing for a certain attribute.
|
boolean |
shouldHandleAttribute(EditedAttribute attribute,
CustomAttributeValueEditingContext editContext)
Ask the custom editor if it wants to handle editing for a certain attribute in a certain context.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDescription
public abstract java.lang.String getAttributeValue(EditedAttribute attribute, java.lang.Object parentComponent) throws CancelledByUserException
attribute
- The attribute to be edited.parentComponent
- The parent component, usually the table in which the user double clicked the value. Used for example to find the parent window/shell when creating dialogs.
public String getAttributeValue(EditedAttribute attribute, Object parentComponent) throws CancelledByUserException { String attrValue = null; PluginWorkspace pluginWorkspace = PluginWorkspaceProvider.getPluginWorkspace(); Platform platform = pluginWorkspace.getPlatform(); if (platform == Platform.STANDALONE) { // Find the parent window Component parent = (Component) parentComponent; while (!(parent instanceof Window)) { parent = parent.getParent(); } attrValue = JOptionPane.showInputDialog( parent, "Set a new value for \"" + attribute.getAttributeQName() + "\":"); } return attrValue; }For the Eclipse plug-in, the code changes into:
public String getAttributeValue(EditedAttribute attribute, Object parentComponent) throws CancelledByUserException { String attrValue = null; PluginWorkspace pluginWorkspace = PluginWorkspaceProvider.getPluginWorkspace(); Platform platform = pluginWorkspace.getPlatform(); if (platform == Platform.ECLIPSE) { // Find the parent shell Control parent = (Control) parentComponent; while (!(parent instanceof Shell)) { parent = parent.getParent(); } InputDialog inputDialog = new InputDialog( (Shell) parent, "Edit attribute", "Set a new value for \"" + attribute.getAttributeQName() + "\":", null, null); if (inputDialog.open() == org.eclipse.jface.window.Window.OK) { // OK pressed. Get the value. attrValue = inputDialog.getValue(); } } return attrValue; }
null
will remove the attribute, while
throwing a CancelledByUserException
will cancel the editing.CancelledByUserException
- When the user cancels the editing.public abstract boolean shouldHandleAttribute(EditedAttribute attribute)
attribute
- The attribute.true
if this custom editor's "getAttributeValue" method should be invoked for that certain attribute.public boolean shouldHandleAttribute(EditedAttribute attribute, CustomAttributeValueEditingContext editContext)
attribute
- The attribute.editContext
- The context from the editing is invoked.
Can be CustomAttributeValueEditingContext.ATTRIBUTES_TABLE_CELL_CONTEXT
or
CustomAttributeValueEditingContext.CUSTOM_EDIT_BUTTON_CONTEXT
true
if this custom editor's "getAttributeValue" method should be invoked for that certain attribute.public TooltipIconInfo getTooltipButtonInfo(EditedAttribute attribute)
attribute
- The attribute to be edited.null
if isn't a proposed info for the attribute.© Copyright Syncro Soft SRL 2002 - 2020. All rights reserved.