1 21 package org.jacorb.ir.gui.typesystem.remote; 22 23 27 28 import java.util.*; 29 import org.omg.CORBA.*; 30 import javax.swing.tree.*; 31 import org.jacorb.ir.gui.typesystem.*; 32 33 public class IROperation extends IRNodeWithType implements AbstractContainer 34 { 35 protected IRParameter[] parameters; 36 protected IRException[] exceptions; 37 private String instanceNodeTypeName; 38 private OperationDef operationDef; 39 40 41 44 public IROperation ( ) { 45 super(); 46 } 47 51 public IROperation ( IRObject irObject) { 52 super(irObject); 53 this.operationDef = OperationDefHelper.narrow((org.omg.CORBA.Object )irObject); 54 setAssociatedTypeSystemNode(RemoteTypeSystem.createTypeSystemNode(operationDef.result_def())); 55 String dummy = super.getInstanceNodeTypeName(); 56 if (operationDef.mode().value() == OperationMode._OP_ONEWAY) { 57 dummy = "oneway" + " " + dummy; 58 } 59 this.instanceNodeTypeName = dummy; 60 } 61 64 public org.jacorb.ir.gui.typesystem.ModelParticipant[] contents() { 65 OperationDef operationDef= OperationDefHelper.narrow((org.omg.CORBA.Object )this.irObject); 67 ParameterDescription[] contents = operationDef.params(); 68 org.jacorb.ir.gui.typesystem.TypeSystemNode[] result = new org.jacorb.ir.gui.typesystem.TypeSystemNode[contents.length]; 69 for (int i=0; i<contents.length; i++) { 70 result[i] = RemoteTypeSystem.createTypeSystemNode(contents[i]); 71 } return result; 73 } 76 80 public String getInstanceNodeTypeName ( ) { 81 return instanceNodeTypeName; 82 } 83 87 public static String nodeTypeName() { 88 return "operation"; 89 } 90 91 public String description() { 92 String result = super.description(); 93 if (exceptions==null) { 94 ExceptionDef[] exceptionDefs = operationDef.exceptions(); 95 exceptions = new IRException[exceptionDefs.length]; 96 for (int i=0; i<exceptionDefs.length; i++) { 97 exceptions[i] = (IRException)RemoteTypeSystem.createTypeSystemNode(exceptionDefs[i]); 98 } } 100 if (exceptions.length>0) { 101 result = result + "\nExceptions:\t "; 102 for (int i = 0; i<exceptions.length; i++) { 103 result = result + ((TypeSystemNode)exceptions[i]).getAbsoluteName(); 104 if (!(i==exceptions.length-1)) { 105 result = result + ", "; 106 } 107 } 108 } 109 else { 110 result = result + "\nExceptions:\t:none"; 111 } 112 return result; 113 } 114 } 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | Popular Tags |