The CustomAttributeValueEditor extension point allows you
customize the attribute value editing mechanisms in Oxygen XML Author Eclipse plugin. It changes the
Browse button found in the
attribute editors to an
Edit
button. When a user clicks that
Edit button, your custom attribute value editor will be presented.
Edit button can be
accessed in the following attribute editors:
Expand button is
used to reveal an expanded panel).
Expand button is
used to reveal an expanded panel).The following example creates a very simple custom attribute value editor:
/**
* A custom attribute value editor.
*/
public class MyCustomAttributeValueEditor extends CustomAttributeValueEditor {
/**
* @see ro.sync.ecss.extensions.api.Extension#getDescription()
*/
@Override
public String getDescription() {
return "My custom attribute value editor";
}
/**
* @see ro.sync.ecss.extensions.api.CustomAttributeValueEditor#getAttributeValue
(ro.sync.ecss.extensions.api.EditedAttribute, java.lang.Object)
*/
@Override
public String getAttributeValue(EditedAttribute attribute, Object parentComponent)
throws CancelledByUserException {
// Show an input dialog for collecting the new value
return JOptionPane.showInputDialog
("Set a new value for " + attribute.getAttributeQName() + ":");
}
/**
* @see ro.sync.ecss.extensions.api.CustomAttributeValueEditor#shouldHandleAttribute
(ro.sync.ecss.extensions.api.EditedAttribute)
*/
@Override
public boolean shouldHandleAttribute(EditedAttribute attribute) {
// Handle all attributes
return true;
}
}
Example result: If a user were to click the
Edit button in any of the attribute
editors, the following dialog box would be displayed that allows the user to insert a value
for the particular attribute:
