use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand in project webtools.sourceediting by eclipse.
the class XSDAttributeGroupDefinitionSection method doHandleEvent.
public void doHandleEvent(Event event) {
super.doHandleEvent(event);
if (event.widget == nameText) {
String newValue = nameText.getText().trim();
if (input instanceof XSDNamedComponent) {
XSDNamedComponent namedComponent = (XSDNamedComponent) input;
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
// doReferentialIntegrityCheck(namedComponent, newValue);
}
}
}
use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand in project webtools.sourceediting by eclipse.
the class XSDElementDeclarationSection method doHandleEvent.
public void doHandleEvent(Event event) {
if (event.type == SWT.Traverse) {
if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
isTraversing = true;
return;
}
}
super.doHandleEvent(event);
if (event.widget == nameText) {
String newValue = nameText.getText().trim();
if (input instanceof XSDElementDeclaration) {
XSDElementDeclaration namedComponent = ((XSDElementDeclaration) input).getResolvedElementDeclaration();
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
// doReferentialIntegrityCheck(namedComponent, newValue);
}
}
}
use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand in project webtools.sourceediting by eclipse.
the class XSDSimpleTypeSection method doHandleEvent.
// TODO: Common this up with element declaration
public void doHandleEvent(Event event) {
if (event.type == SWT.Traverse) {
if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
isTraversing = true;
return;
}
}
if (event.widget == nameText) {
if (!nameText.getEditable())
return;
String newValue = nameText.getText().trim();
if (input instanceof XSDNamedComponent) {
XSDNamedComponent namedComponent = (XSDNamedComponent) input;
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
}
}
}
use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand in project webtools.sourceediting by eclipse.
the class XSDModelGroupDefinitionSection method doHandleEvent.
public void doHandleEvent(Event event) {
super.doHandleEvent(event);
if (event.widget == nameText) {
String newValue = nameText.getText().trim();
if (input instanceof XSDNamedComponent) {
XSDNamedComponent namedComponent = (XSDNamedComponent) input;
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
// doReferentialIntegrityCheck(namedComponent, newValue);
}
}
}
use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand in project webtools.sourceediting by eclipse.
the class XSDComplexTypeSection method doHandleEvent.
public void doHandleEvent(Event event) {
if (event.type == SWT.Traverse) {
if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
isTraversing = true;
return;
}
}
super.doHandleEvent(event);
if (event.widget == nameText) {
if (!nameText.getEditable())
return;
String newValue = nameText.getText().trim();
if (input instanceof XSDNamedComponent) {
XSDNamedComponent namedComponent = (XSDNamedComponent) input;
if (!validateSection())
return;
Command command = null;
// Make sure an actual name change has taken place
String oldName = namedComponent.getName();
if (!newValue.equals(oldName)) {
command = new UpdateNameCommand(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_RENAME, namedComponent, newValue);
}
if (command != null && getCommandStack() != null) {
getCommandStack().execute(command);
}
// doReferentialIntegrityCheck(namedComponent, newValue);
}
}
}
Aggregations