// Get method element for display argument names.
Type[] typeParameterArgumentName = new Type[ 2 ];
typeParameterArgumentName[ 0 ] = Type.parse( "java.lang.String" );
typeParameterArgumentName[ 1 ] = Type.parse( "int" );
MethodElement methodelementDisplayArgumentName =
//oocalcaddinsdata.customized_innerclass.getMethod(
oocalcaddinsdata.getInnerClass().getMethod(
Identifier.create( "getDisplayArgumentName" ),
typeParameterArgumentName );
// Get method element for argument description.
Type[] typeParameterArgumentDescription = new Type[ 2 ];
typeParameterArgumentDescription[ 0 ] = Type.parse( "java.lang.String" );
typeParameterArgumentDescription[ 1 ] = Type.parse( "int" );
MethodElement methodelementArgumentDescription =
//oocalcaddinsdata.customized_innerclass.getMethod(
oocalcaddinsdata.getInnerClass().getMethod(
Identifier.create( "getArgumentDescription" ),
typeParameterArgumentDescription );
// Get method element for display function names.
Type[] typeParameterFunctionName = new Type[ 1 ];
typeParameterFunctionName[ 0 ] = Type.parse( "java.lang.String" );
MethodElement methodelementDisplayFunctionName =
//oocalcaddinsdata.customized_innerclass.getMethod(
oocalcaddinsdata.getInnerClass().getMethod(
Identifier.create( "getDisplayFunctionName" ),
typeParameterFunctionName );
// Get method element for function description.
Type[] typeParameterFunctionDescription = new Type[ 1 ];
typeParameterFunctionDescription[ 0 ] = Type.parse( "java.lang.String" );
MethodElement methodelementFunctionDescription =
//oocalcaddinsdata.customized_innerclass.getMethod(
oocalcaddinsdata.getInnerClass().getMethod(
Identifier.create( "getFunctionDescription" ),
typeParameterFunctionDescription );
// Get method element for programmatic category name.
Type[] typeParameterCategoryName = new Type[ 1 ];
typeParameterCategoryName[ 0 ] = Type.parse( "java.lang.String" );
MethodElement methodelementCategoryName =
//oocalcaddinsdata.customized_innerclass.getMethod(
oocalcaddinsdata.getInnerClass().getMethod(
Identifier.create( "getProgrammaticCategoryName" ),
typeParameterCategoryName );
for ( int intInterfaceCounter = 0;
intInterfaceCounter < vectorInterfaces.size();
intInterfaceCounter++ ) {
IDLInterface interfacedescription = ( IDLInterface )
vectorInterfaces.elementAt( intInterfaceCounter );
for ( int intMethodCounter = 0;
intMethodCounter < interfacedescription.getVectorMethods().size();
intMethodCounter++ ) {
try {
IDLMethod methoddescription = ( IDLMethod )
interfacedescription.getVectorMethods().elementAt( intMethodCounter );
FieldElement fieldelement = new FieldElement();
fieldelement.setName( Identifier.create( "short" +
methoddescription.getMethodElement().getName().getName().toUpperCase() ) );
fieldelement.setInitValue( String.valueOf( intMethod++ ) );
fieldelement.setType( Type.parse( "short" ) );
fieldelement.setModifiers( Modifier.PRIVATE
+ Modifier.FINAL + Modifier.STATIC );
//oocalcaddinsdata.customized_innerclass.addField(
//fieldelement );
oocalcaddinsdata.getInnerClass().addField(
fieldelement );
fieldelementFunctionNames.setInitValue(
fieldelementFunctionNames.getInitValue().substring( 0,
fieldelementFunctionNames.getInitValue().length() - 1 )
+ ( ( intMethod == 1 ) ? "" : ",\n " ) + "\""
+ methoddescription.getMethodElement().getName().getName()
+ "\"}" );
// Insert display argument name.
MethodParameter[] methodparameter =
methoddescription.getMethodElement().getParameters();
String stringCaseParameter =
/*
" case 0:\n"
+ " stringReturn = \"(internal)\";\n"
+ " break;\n";
*/
"";
for ( int intParameterCounter = 0;
intParameterCounter < methoddescription.getArgumentDescription().length;
intParameterCounter++ ) {
stringCaseParameter +=
" case "
//+ ( intParameterCounter + 1 ) + ":\n"
+ intParameterCounter + ":\n"
+ " stringReturn = \""
+ methoddescription.getArgumentDescription()[ intParameterCounter ].getDisplayArgumentName()
+ "\";\n"
+ " break;\n";
}
String stringDisplayArgumentNameBody =
methodelementDisplayArgumentName.getBody();
int intIndexCurlyBraceOpen =
stringDisplayArgumentNameBody.indexOf( "{" );
stringDisplayArgumentNameBody =
stringDisplayArgumentNameBody.substring( 0,
intIndexCurlyBraceOpen + 1 )
+ "\n case short"
+ methoddescription.getMethodElement().getName().getName().toUpperCase()
+ ":\n"
+ " switch( intArgument ) {\n"
+ stringCaseParameter
+ " }\n"
+ " break;"
+ stringDisplayArgumentNameBody.substring(
intIndexCurlyBraceOpen + 1 );
methodelementDisplayArgumentName.setBody(
stringDisplayArgumentNameBody );
// Insert argument description.
String stringCaseParameterDescription =
/*
" case 0:\n"
+ " stringReturn = \"(internal)\";\n"
+ " break;\n";
*/
"";
for ( int intParameterCounter = 0;
intParameterCounter < methoddescription.getArgumentDescription().length;
intParameterCounter++ ) {
stringCaseParameterDescription +=
" case "
//+ ( intParameterCounter + 1 ) + ":\n"
+ intParameterCounter + ":\n"
+ " stringReturn = \""
+ methoddescription.getArgumentDescription()[ intParameterCounter ].getArgumentDescription()
+ "\";\n"
+ " break;\n";
}
String stringArgumentDescriptionBody =
methodelementArgumentDescription.getBody();
intIndexCurlyBraceOpen =
stringArgumentDescriptionBody.indexOf( "{" );
stringArgumentDescriptionBody =
stringArgumentDescriptionBody.substring( 0,
intIndexCurlyBraceOpen + 1 )
+ "\n case short"
+ methoddescription.getMethodElement().getName().getName().toUpperCase()
+ ":\n"
+ " switch( intArgument ) {\n"
+ stringCaseParameterDescription
+ " }\n"
+ " break;"
+ stringArgumentDescriptionBody.substring(
intIndexCurlyBraceOpen + 1 );
methodelementArgumentDescription.setBody(
stringArgumentDescriptionBody );
// Insert display function names.
String stringDisplayFunctionNameBody =
methodelementDisplayFunctionName.getBody();
intIndexCurlyBraceOpen =
stringDisplayFunctionNameBody.indexOf( "{" );
stringDisplayFunctionNameBody =
stringDisplayFunctionNameBody.substring( 0,
intIndexCurlyBraceOpen + 1 )
+ "\n case short"
+ methoddescription.getMethodElement().getName().getName().toUpperCase()
+ ":\n"
+ " stringReturn = \""
+ methoddescription.getDisplayFunctionName()
+ "\";\n"
+ " break;"
+ stringDisplayFunctionNameBody.substring(
intIndexCurlyBraceOpen + 1 );
methodelementDisplayFunctionName.setBody(
stringDisplayFunctionNameBody );
// Insert function description.
String stringFunctionDescriptionBody =
methodelementFunctionDescription.getBody();
intIndexCurlyBraceOpen =
stringFunctionDescriptionBody.indexOf( "{" );
stringFunctionDescriptionBody =
stringFunctionDescriptionBody.substring( 0,
intIndexCurlyBraceOpen + 1 )
+ "\n case short"
+ methoddescription.getMethodElement().getName().getName().toUpperCase()
+ ":\n"
+ " stringReturn = \""
+ methoddescription.getFunctionDescription()
+ "\";\n"
+ " break;"
+ stringFunctionDescriptionBody.substring(
intIndexCurlyBraceOpen + 1 );
methodelementFunctionDescription.setBody(
stringFunctionDescriptionBody );
// Insert programmatic category name.
String stringCategoryNameBody =
methodelementCategoryName.getBody();
intIndexCurlyBraceOpen =
stringCategoryNameBody.indexOf( "{" );
stringCategoryNameBody =
stringCategoryNameBody.substring( 0,
intIndexCurlyBraceOpen + 1 )
+ "\n case short"
+ methoddescription.getMethodElement().getName().getName().toUpperCase()
+ ":\n"
+ " stringReturn = \""
+ methoddescription.getCategory()
+ "\";\n"
+ " break;"
+ stringCategoryNameBody.substring(
intIndexCurlyBraceOpen + 1 );
methodelementCategoryName.setBody(
stringCategoryNameBody );
}
catch( SourceException sourceexception ) {
// Show message.
TopManager.getDefault().notify(