001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.core.reverseengineering.reframework;
043:
044: import org.dom4j.Node;
045:
046: import org.netbeans.modules.uml.core.reverseengineering.reframework.parsingframework.ITokenDescriptor;
047: import org.netbeans.modules.uml.core.support.umlsupport.XMLManip;
048:
049: /**
050: */
051: public class RECallAction extends REAction implements IRECallAction {
052: /**
053: * Retrieves the package that contains the return types class.
054: *
055: * @param pVal [out] The package name.
056: */
057: public String getReturnTypePackage() {
058: ITokenDescriptor desc = getTokenDescriptor("ReturnTypePackage");
059: return desc != null ? desc.getValue() : null;
060: }
061:
062: /**
063: * Retrieves the returns type class name. The class name will be the short
064: * version of the name. The class name will not contain the package that
065: * contains the class.
066: *
067: * @param pVal [out[ The class name.
068: */
069: public String getReturnTypeClass() {
070: ITokenDescriptor desc = getTokenDescriptor("ReturnTypeClass");
071: return desc != null ? desc.getValue() : null;
072: }
073:
074: /**
075: * Retrieves if the the operation that is being called is a static method.
076: *
077: * @param pVal [out] True if the operation is static, false otherwise.
078: */
079: public boolean getIsOperationStatic() {
080: ITokenDescriptor desc = getTokenDescriptor("StaticOperation");
081: if (desc instanceof IXMLTokenDescriptor) {
082: Node n = ((IXMLTokenDescriptor) desc)
083: .getTokenDescriptorNode();
084: return Boolean.valueOf(
085: XMLManip.getAttributeValue(n, "value"))
086: .booleanValue();
087: }
088: return false;
089: }
090:
091: /**
092: * Retrieves if the receiving instance is a static instance.
093: *
094: * @param pVal [out] True if the instance is static, false otherwise.
095: */
096: public boolean getIsInstanceStatic() {
097: ITokenDescriptor desc = getTokenDescriptor("StaticInstance");
098: if (desc instanceof IXMLTokenDescriptor) {
099: Node n = ((IXMLTokenDescriptor) desc)
100: .getTokenDescriptorNode();
101: return Boolean.valueOf(
102: XMLManip.getAttributeValue(n, "value"))
103: .booleanValue();
104: }
105: return false;
106: }
107:
108: /**
109: * The called opertions return type. The fully scoped name of the return type
110: * is given when the the file that contains the return type is found.
111: *
112: * @param pVal [out] The return type.
113: */
114: public String getReturnType() {
115: ITokenDescriptor desc = getTokenDescriptor("ReturnType");
116: return desc != null ? desc.getValue() : null;
117: }
118:
119: /**
120: * The fully scoped name of the class that implements the operation.
121: * When the operation is implemented by the super class the class that
122: * implements the class may be different than the recieving class.
123: *
124: * @param pVal [out] The name of the implementing class.
125: */
126: public String getImplementingClass() {
127: ITokenDescriptor desc = getTokenDescriptor("OperationOwner");
128: return desc != null ? desc.getValue() : null;
129: }
130:
131: /**
132: * Retrieves the name of the class that contains the instance of the object
133: * that is being called.
134: *
135: * @param pVal [out] The name the class that owns the instance.
136: */
137: public String getInstanceOwner() {
138: ITokenDescriptor desc = getTokenDescriptor("ContainingClass");
139: return desc != null ? desc.getValue() : null;
140: }
141:
142: /**
143: * Retrieves the name of the object that will recieve the method call.
144: * @param pVal [out] The instance name.
145: */
146: public String getInstanceName() {
147: ITokenDescriptor desc = getTokenDescriptor("Name");
148: return desc != null ? desc.getValue() : null;
149: }
150:
151: /**
152: * Retrieves the name of the operation that will be called. Use
153: * the Arguments property to retrieve the calls parameters.
154: * @param pVal [out] The operations name.
155: */
156: public String getOperationName() {
157: return XMLManip.getAttributeValue(getEventData(), "operation");
158: }
159: }
|