use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDAttributeDragAndDropCommand method getElement.
/*
* (non-Javadoc)
* @see org.eclipse.wst.xsd.ui.internal.commands.BaseDragAndDropCommand#getElement()
*/
protected Element getElement() {
XSDAttributeDeclarationAdapter adapter = (XSDAttributeDeclarationAdapter) itemToDrag.getModel();
XSDAttributeDeclaration target = (XSDAttributeDeclaration) adapter.getTarget();
XSDConcreteComponent parent = (XSDConcreteComponent) target.eContainer();
return parent.getElement();
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDAttributeGroupDefinitionAdapter method getActions.
public String[] getActions(Object object) {
List list = new ArrayList();
list.add(AddXSDAttributeDeclarationAction.ID);
list.add(AddXSDAnyAttributeAction.ID);
list.add(BaseSelectionAction.SEPARATOR_ID);
list.add(DeleteAction.ID);
list.add(BaseSelectionAction.SEPARATOR_ID);
Object schema = getEditorSchema();
XSDAttributeGroupDefinition attributeGroupDefinition = getXSDAttributeGroupDefinition();
if (attributeGroupDefinition.getSchema() == schema) {
XSDConcreteComponent container = attributeGroupDefinition.getContainer();
if (container == schema || container instanceof XSDRedefine) {
list.add(SetInputToGraphView.ID);
}
} else {
list.add(OpenInNewEditor.ID);
}
list.add(BaseSelectionAction.SEPARATOR_ID);
list.add(ShowPropertiesViewAction.ID);
return (String[]) list.toArray(new String[0]);
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDModelGroupDefinitionAdapter method getActions.
/*
* (non-Javadoc)
*
* @see org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider#getActions(java.lang.Object)
*/
public String[] getActions(Object object) {
Collection list = new ArrayList();
XSDModelGroupDefinition modelGroupDefinition = getXSDModelGroupDefinition();
boolean isModelGroupReference = modelGroupDefinition.isModelGroupDefinitionReference();
if (!isModelGroupReference) {
list.add(AddXSDElementAction.ID);
list.add(AddXSDElementAction.REF_ID);
list.add(BaseSelectionAction.SEPARATOR_ID);
list.add(AddXSDModelGroupAction.SEQUENCE_ID);
list.add(AddXSDModelGroupAction.CHOICE_ID);
list.add(AddXSDModelGroupAction.ALL_ID);
list.add(BaseSelectionAction.SEPARATOR_ID);
}
list.add(DeleteAction.ID);
if (isModelGroupReference) {
list.add(BaseSelectionAction.SEPARATOR_ID);
list.add(BaseSelectionAction.SUBMENU_START_ID + Messages._UI_ACTION_SET_MULTIPLICITY);
list.add(SetMultiplicityAction.REQUIRED_ID);
list.add(SetMultiplicityAction.ZERO_OR_ONE_ID);
list.add(SetMultiplicityAction.ZERO_OR_MORE_ID);
list.add(SetMultiplicityAction.ONE_OR_MORE_ID);
list.add(BaseSelectionAction.SUBMENU_END_ID);
}
list.add(BaseSelectionAction.SEPARATOR_ID);
Object schema = getEditorSchema();
if (modelGroupDefinition.getSchema() == schema) {
XSDConcreteComponent container = modelGroupDefinition.getContainer();
if (container == schema || container instanceof XSDRedefine) {
list.add(SetInputToGraphView.ID);
}
} else {
list.add(OpenInNewEditor.ID);
}
list.add(BaseSelectionAction.SEPARATOR_ID);
list.add(ShowPropertiesViewAction.ID);
return (String[]) list.toArray(new String[0]);
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class TopLevelComponentEditPart method refreshVisuals.
public void refreshVisuals() {
XSDBaseAdapter adapter = (XSDBaseAdapter) getModel();
if (adapter != null) {
isReadOnly = adapter.isReadOnly();
label.setForegroundColor(computeLabelColor());
label.setText(adapter.getText());
Image image = adapter.getImage();
if (image != null) {
label.setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) adapter.getTarget(), image, isReadOnly));
}
if (adapter.isAbstract()) {
if (italicFont == null) {
Font font = label.getFont();
italicFont = getItalicFont(font);
}
if (italicFont != null) {
label.setFont(italicFont);
}
} else {
label.setFont(label.getParent().getFont());
}
} else {
label.setText(Messages._UI_GRAPH_UNKNOWN_OBJECT + getModel().getClass().getName());
// arrowLabel.setVisible(false);
}
if (reselect) {
getViewer().select(this);
setReselect(false);
}
}
use of org.eclipse.xsd.XSDConcreteComponent in project webtools.sourceediting by eclipse.
the class XSDSchemaEditPart method refreshVisuals.
protected void refreshVisuals() {
super.refreshVisuals();
LineBorder border = (LineBorder) outer.getBorder();
border.setWidth(isSelected ? 2 : 1);
headingFigure.setSelected(isSelected);
XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter) getModel();
Image image = schemaAdapter.getImage();
headingFigure.getLabel().setIcon(image);
if (image != null) {
headingFigure.getLabel().setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) schemaAdapter.getTarget(), image, false));
}
outer.repaint();
String targetNamespaceValue = ((XSDSchema) ((XSDSchemaAdapter) getModel()).getTarget()).getTargetNamespace();
targetNamespaceValue = TextProcessor.process(targetNamespaceValue);
if (targetNamespaceValue == null || targetNamespaceValue.length() == 0) {
targetNamespaceValue = Messages._UI_GRAPH_XSDSCHEMA_NO_NAMESPACE;
}
// $NON-NLS-1$
headingFigure.getLabel().setText(Messages._UI_GRAPH_XSDSCHEMA + " : " + targetNamespaceValue);
}
Aggregations