Search in sources :

Example 56 with XSDConcreteComponent

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();
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) XSDAttributeDeclarationAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter) XSDAttributeDeclaration(org.eclipse.xsd.XSDAttributeDeclaration)

Example 57 with XSDConcreteComponent

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]);
}
Also used : XSDRedefine(org.eclipse.xsd.XSDRedefine) XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) XSDAttributeGroupDefinition(org.eclipse.xsd.XSDAttributeGroupDefinition)

Example 58 with XSDConcreteComponent

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]);
}
Also used : XSDRedefine(org.eclipse.xsd.XSDRedefine) XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) ArrayList(java.util.ArrayList) Collection(java.util.Collection) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) XSDModelGroupDefinition(org.eclipse.xsd.XSDModelGroupDefinition)

Example 59 with XSDConcreteComponent

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);
    }
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) XSDBaseAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter) Image(org.eclipse.swt.graphics.Image) Font(org.eclipse.swt.graphics.Font)

Example 60 with XSDConcreteComponent

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);
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) LineBorder(org.eclipse.draw2d.LineBorder) XSDSchemaAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDSchemaAdapter) Image(org.eclipse.swt.graphics.Image) XSDSchema(org.eclipse.xsd.XSDSchema)

Aggregations

XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)88 XSDElementDeclaration (org.eclipse.xsd.XSDElementDeclaration)30 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)25 XSDSchema (org.eclipse.xsd.XSDSchema)23 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)18 XSDAttributeDeclaration (org.eclipse.xsd.XSDAttributeDeclaration)18 XSDBaseAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter)17 Adapter (org.eclipse.emf.common.notify.Adapter)15 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)15 XSDParticle (org.eclipse.xsd.XSDParticle)13 Iterator (java.util.Iterator)12 ArrayList (java.util.ArrayList)11 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)11 XSDModelGroup (org.eclipse.xsd.XSDModelGroup)11 XSDModelGroupDefinition (org.eclipse.xsd.XSDModelGroupDefinition)11 XSDTypeDefinition (org.eclipse.xsd.XSDTypeDefinition)11 List (java.util.List)10 Element (org.w3c.dom.Element)10 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)9 XSDAttributeGroupDefinition (org.eclipse.xsd.XSDAttributeGroupDefinition)9