use of org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator in project webtools.sourceediting by eclipse.
the class XSDBaseFieldEditPart method directEditNameField.
protected void directEditNameField() {
Object model = getModel();
IFieldFigure fieldFigure = getFieldFigure();
if (model instanceof IField) {
IField field = (IField) model;
if (field.isReference()) {
ReferenceDirectEditManager manager = null;
if (field instanceof XSDElementDeclarationAdapter) {
manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
} else if (field instanceof XSDAttributeDeclarationAdapter) {
manager = new AttributeReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
}
if (manager != null) {
ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
elementUpdateCommand.setDelegate(manager);
adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
manager.show();
}
} else {
LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
adtDirectEditPolicy.setUpdateCommand(wrapper);
manager.show();
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method directEditNameField.
protected void directEditNameField() {
if (isFileReadOnly())
return;
Object model = getModel();
IFieldFigure fieldFigure = getFieldFigure();
if (model instanceof IField) {
IField field = (IField) model;
if (field.isReference()) {
ElementReferenceDirectEditManager manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
elementUpdateCommand.setDelegate(manager);
adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
manager.show();
} else {
LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
adtDirectEditPolicy.setUpdateCommand(wrapper);
manager.show();
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method doEditName.
public void doEditName(boolean addFromDesign) {
if (!addFromDesign)
return;
// removeFeedback();
Runnable runnable = new Runnable() {
public void run() {
Object object = ((XSDBaseAdapter) getModel()).getTarget();
if (object instanceof XSDNamedComponent) {
Point p = getNameLabelFigure().getLocation();
LabelEditManager manager = new LabelEditManager(BaseFieldEditPart.this, new LabelCellEditorLocator(BaseFieldEditPart.this, p));
NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
adtDirectEditPolicy.setUpdateCommand(wrapper);
manager.show();
}
}
};
Display.getCurrent().asyncExec(runnable);
}
Aggregations