use of org.eclipse.wst.xsd.ui.internal.adt.facade.IField in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method getTargetConnectionEditPart.
private EditPart getTargetConnectionEditPart() {
EditPart result = null;
IField field = (IField) getModel();
IType type = field.getType();
if (type != null) {
// getTargetEditPart(type);
result = getTargetEP(type);
}
return result;
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IField in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method refreshVisuals.
protected void refreshVisuals() {
super.refreshVisuals();
IFieldFigure figure = getFieldFigure();
IField field = (IField) getModel();
figure.getNameLabel().setText(field.getName());
figure.getTypeLabel().setText(field.getTypeName());
figure.refreshVisuals(getModel());
figure.recomputeLayout();
((GraphicalEditPart) getRoot()).getFigure().invalidateTree();
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IField in project webtools.sourceediting by eclipse.
the class AddFieldAction method run.
public void run() {
if (getSelectedObjects().size() > 0) {
Object o = getSelectedObjects().get(0);
IComplexType type = null;
if (o instanceof IComplexType) {
type = (IComplexType) o;
} else if (o instanceof IField) {
IField field = (IField) o;
type = field.getContainerType();
}
if (type != null) {
// $NON-NLS-1$
Command command = type.getAddNewFieldCommand("");
if (command != null) {
getCommandStack().execute(command);
Adapter adapter = XSDAdapterFactory.getInstance().adapt(((BaseCommand) command).getAddedComponent());
selectAddedComponent(adapter);
} else {
// TODO ... pop up a command not implemented message
}
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IField in project webtools.sourceediting by eclipse.
the class FocusTypeColumn method getChildren.
public List getChildren() {
List result = new ArrayList();
if (model instanceof IType) {
IType type = (IType) model;
if (type.getSuperType() != null) {
result.add(type.getSuperType());
}
result.add(type);
} else if (model instanceof IField || model instanceof IStructure) {
result.add(model);
}
return result;
}
use of org.eclipse.wst.xsd.ui.internal.adt.facade.IField 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();
}
}
}
Aggregations