[Uml-devel] kdesdk/umbrello/umbrello/codegenerators

Brian Thomas thomas at mail630.gsfc.nasa.gov
Wed Nov 12 12:24:08 UTC 2003


CVS commit by thomas: 

bug fix: java code operations shouldnt have bodies when inside an interface. FIxes bug  67770


  M +21 -2     javacodeoperation.cpp   1.8
  M +2 -0      javacodeoperation.h   1.5


--- kdesdk/umbrello/umbrello/codegenerators/javacodeoperation.cpp  #1.7:1.8
@@ -40,4 +40,5 @@ void JavaCodeOperation::updateMethodDecl
         JavaClassifierCodeDocument * javadoc = dynamic_cast<JavaClassifierCodeDocument*>(doc);
         UMLOperation * o = getParentOperation();
+        bool isInterface = javadoc->getParentClassifier()->isInterface();
 
         // first, the comment on the operation
@@ -67,9 +68,28 @@ void JavaCodeOperation::updateMethodDecl
         }
 
-        QString startText = strVis + " "+ returnType + methodName + " ( "+paramStr+") {";
+        QString startText = strVis + " "+ returnType + methodName + " ( "+paramStr+")";
+
+        // IF the parent is an interface, our operations look different
+        // e.g. they have no body
+        if(isInterface) {
+                startText += ";";
+                setEndMethodText("");
+        } else {
+                startText += " {";
+                setEndMethodText("}");
+        }
+
         setStartMethodText(startText);
 
 }
 
+int JavaCodeOperation::lastEditableLine() {
+        ClassifierCodeDocument * doc = (ClassifierCodeDocument*)getParentDocument();
+        if(doc->parentIsInterface()) 
+                return -1; // very last line is NOT editable as its a one-line declaration w/ no body in 
+                        // an interface.
+        return 0;
+}
+
 void JavaCodeOperation::init (JavaClassifierCodeDocument * doc ) 
 {
@@ -81,5 +101,4 @@ void JavaCodeOperation::init (JavaClassi
         // these things never change..
         setOverallIndentationLevel(1);
-        setEndMethodText("}"); 
 
         updateMethodDeclaration();

--- kdesdk/umbrello/umbrello/codegenerators/javacodeoperation.h  #1.4:1.5
@@ -41,4 +41,6 @@ public:
         virtual ~JavaCodeOperation ( );
 
+        virtual int lastEditableLine();
+
 protected:
 






More information about the umbrello-devel mailing list