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.bpel.nodes;
020:
021: import org.netbeans.modules.bpel.nodes.BpelNode;
022: import org.netbeans.modules.bpel.model.api.Correlation;
023: import org.netbeans.modules.bpel.model.api.CorrelationSet;
024: import org.netbeans.modules.bpel.model.api.support.Initiate;
025: import org.netbeans.modules.bpel.properties.Constants;
026: import org.netbeans.modules.bpel.editors.api.nodes.NodeType;
027: import org.netbeans.modules.bpel.model.api.BaseCorrelation;
028: import org.netbeans.modules.bpel.model.api.references.BpelReference;
029: import org.netbeans.modules.bpel.properties.props.PropertyUtils;
030: import org.openide.nodes.Sheet;
031: import static org.netbeans.modules.bpel.properties.PropertyType.*;
032: import org.netbeans.modules.bpel.editors.api.nodes.actions.ActionType;
033: import org.netbeans.modules.soa.ui.SoaUiUtil;
034: import org.openide.nodes.Children;
035: import org.openide.util.Lookup;
036:
037: /**
038: *
039: * @author nk160297
040: */
041: public class CorrelationNode extends BpelNode<Correlation> {
042:
043: public CorrelationNode(Correlation correlation, Children children,
044: Lookup lookup) {
045: super (correlation, children, lookup);
046: }
047:
048: public CorrelationNode(Correlation correlation, Lookup lookup) {
049: super (correlation, lookup);
050: }
051:
052: public NodeType getNodeType() {
053: return NodeType.CORRELATION;
054: }
055:
056: protected String getNameImpl() {
057: CorrelationSet corrSet = null;
058: Correlation ref = getReference();
059: if (ref != null) {
060: BpelReference<CorrelationSet> corrSetRef = ref.getSet();
061: if (corrSetRef != null) {
062: corrSet = corrSetRef.get();
063: }
064: }
065: return corrSet == null ? "" : corrSet.getName();
066: }
067:
068: protected Sheet createSheet() {
069: Sheet sheet = super .createSheet();
070:
071: if (getReference() == null) {
072: return sheet;
073: }
074: //
075: Sheet.Set mainPropertySet = getPropertySet(sheet,
076: Constants.PropertiesGroups.MAIN_SET);
077: //
078: PropertyUtils.registerAttributeProperty(this , mainPropertySet,
079: BaseCorrelation.SET, CORRELATION_SET, "getSet", null,
080: null); // NOI18N
081: //
082: PropertyUtils.registerAttributeProperty(this , mainPropertySet,
083: BaseCorrelation.INITIATE, CORRELATION_INITIATE,
084: "getInitiate", "setInitiate", "removeInitiate"); // NOI18N
085: //
086: PropertyUtils.registerProperty(this , mainPropertySet,
087: DOCUMENTATION, "getDocumentation", "setDocumentation",
088: "removeDocumentation"); // NOI18N
089: //
090: return sheet;
091: }
092:
093: protected String getImplHtmlDisplayName() {
094: String nodeName = null;
095: Correlation ref = getReference();
096: if (ref != null) {
097: Initiate initiate = getReference().getInitiate();
098: nodeName = initiate == null
099: || initiate.equals(Initiate.INVALID) ? ""
100: : " initiate=" + initiate.toString(); // NOI18N
101: }
102:
103: return SoaUiUtil.getGrayString(getName(), nodeName == null ? ""
104: : nodeName);
105: }
106:
107: protected ActionType[] getActionsArray() {
108: return new ActionType[] { ActionType.GO_TO_SOURCE,
109: ActionType.SEPARATOR, ActionType.REMOVE,
110: ActionType.SEPARATOR, ActionType.PROPERTIES };
111: }
112: }
|