001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.xslt.tmap.nodes.properties;
020:
021: import java.util.ArrayList;
022: import java.util.List;
023: import org.netbeans.modules.xml.schema.model.GlobalComplexType;
024: import org.netbeans.modules.xml.schema.model.GlobalElement;
025: import org.netbeans.modules.xml.schema.model.GlobalSimpleType;
026: import org.netbeans.modules.xml.schema.model.GlobalType;
027: import org.netbeans.modules.xml.schema.model.SchemaComponent;
028: import org.netbeans.modules.xml.schema.model.SchemaModelFactory;
029: import org.netbeans.modules.xml.wsdl.model.Message;
030: import org.openide.nodes.Node;
031: import org.openide.util.NbBundle;
032:
033: /**
034: * Keeps constants for identification of the TMap Diagram elements and theirs properties.
035: * @author Vitaly Bychkov
036: * @author nk160297
037: */
038: public interface Constants {
039:
040: // StereotypeFilter CORRELATION_PROPERTY_STEREO_TYPE_FILTER
041: // = new StereotypeFilter(/*VariableStereotype.GLOBAL_TYPE
042: // , VariableStereotype.GLOBAL_SIMPLE_TYPE
043: // , VariableStereotype.GLOBAL_COMPLEX_TYPE
044: // , VariableStereotype.PRIMITIVE_TYPE
045: // , VariableStereotype.GLOBAL_ELEMENT*/
046: // VariableStereotype.PRIMITIVE_TYPE
047: // );
048:
049: enum PropertiesGroups {
050: MAIN_SET, MESSAGE_SET, FAULT_SET, EXPERT_SET;
051:
052: private String myDisplayName;
053:
054: public String getDisplayName() {
055: if (myDisplayName == null) {
056: myDisplayName = NbBundle.getMessage(PropertyType.class,
057: this .toString());
058: }
059: return myDisplayName;
060: }
061: }
062:
063: enum MessageDirection {
064: INPUT, OUTPUT, FAULT;
065: }
066:
067: enum VariableStereotype {
068: GLOBAL_TYPE, GLOBAL_SIMPLE_TYPE, GLOBAL_COMPLEX_TYPE, PRIMITIVE_TYPE, MESSAGE, GLOBAL_ELEMENT;
069:
070: private String myDisplayName;
071:
072: public String getDisplayName() {
073: if (myDisplayName == null) {
074: myDisplayName = NbBundle.getMessage(PropertyType.class,
075: this .toString());
076: }
077: return myDisplayName;
078: }
079:
080: public static VariableStereotype recognizeStereotype(Object type) {
081: if (type == null) {
082: return null;
083: }
084: if (type instanceof Message) {
085: return VariableStereotype.MESSAGE;
086: } else if (type instanceof GlobalType) {
087: if (type instanceof GlobalSimpleType) {
088: if (((GlobalSimpleType) type).getModel() == SchemaModelFactory
089: .getDefault().getPrimitiveTypesModel()) {
090: return PRIMITIVE_TYPE;
091: } else {
092: return GLOBAL_SIMPLE_TYPE;
093: }
094: } else if (type instanceof GlobalComplexType) {
095: return GLOBAL_COMPLEX_TYPE;
096: } else {
097: return VariableStereotype.GLOBAL_TYPE;
098: }
099: } else if (type instanceof GlobalElement) {
100: return VariableStereotype.GLOBAL_ELEMENT;
101: }
102: assert false : "type paramether can be one of the following types"
103: + "(or subtype of them): Message, Part, GlobalType, GlobalElement";
104: return null;
105: }
106: }
107:
108: }
|