facebook

Cannot generate Java code from Class Diagram

  1. MyEclipse Archived
  2.  > 
  3. UML Development
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #241556 Reply

    datapulse
    Member

    When I try and generate Java classes from a class diagram it only generates the directories for the packages, but not the classes.

    I don’t know if it is related but I also cannot drag and drop a Java class (from the JRE System Library) to the class diagram.

    The stack trace from the log is:

    !ENTRY org.eclipse.core.resources 4 2 2005-11-15 22:59:45.828
    !MESSAGE Problems occurred when invoking code from plug-in: “org.eclipse.core.resources”.
    !STACK 0
    java.lang.NullPointerException
    at com.genuitec.eclipse.uml.UMLPlugin$DeltaPrinter.visit(UMLPlugin.java:544)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:68)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:49)
    at com.genuitec.eclipse.uml.UMLPlugin$4.resourceChanged(UMLPlugin.java:264)
    at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:276)
    at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
    at org.eclipse.core.runtime.Platform.run(Platform.java:783)
    at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:270)
    at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:144)
    at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:180)
    at org.eclipse.core.internal.resources.Workspace.checkpoint(Workspace.java:243)
    at org.eclipse.ltk.core.refactoring.PerformChangeOperation$1.run(PerformChangeOperation.java:237)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1719)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1739)
    at org.eclipse.ltk.core.refactoring.PerformChangeOperation.executeChange(PerformChangeOperation.java:280)
    at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation.access$1(UIPerformChangeOperation.java:1)
    at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation$1.run(UIPerformChangeOperation.java:63)
    at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
    at org.eclipse.core.runtime.Platform.run(Platform.java:783)
    at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation$2.run(UIPerformChangeOperation.java:81)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3057)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2716)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:153)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:303)
    at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:293)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:547)
    at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:153)
    at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteWizard$DeleteInputPage.performFinish(DeleteWizard.java:124)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:613)
    at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:417)
    at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:409)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:556)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:809)
    at org.eclipse.jface.window.Window.open(Window.java:787)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:125)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
    at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:138)
    at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:40)
    at org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter.activate(UserInterfaceStarter.java:56)
    at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startDeleteRefactoring(RefactoringExecutionStarter.java:208)
    at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteAction.run(DeleteAction.java:84)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:222)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:198)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
    at org.eclipse.core.launcher.Main.run(Main.java:973)
    at org.eclipse.core.launcher.Main.main(Main.java:948)

    !ENTRY org.eclipse.ui 4 4 2005-11-15 23:00:01.00
    !MESSAGE Unhandled event loop exception

    !ENTRY org.eclipse.ui 4 0 2005-11-15 23:00:01.00
    !MESSAGE ru.novosoft.uml.foundation.core.MClassImpl
    !STACK 0
    java.lang.ClassCastException: ru.novosoft.uml.foundation.core.MClassImpl
    at org.argouml.model.uml.NSUMLModelFacade.getSpecifications(NSUMLModelFacade.java:4071)
    at org.argouml.language.java.generator.GeneratorJava.generateImports(GeneratorJava.java:347)
    at org.argouml.language.java.generator.GeneratorJava.generateHeader(GeneratorJava.java:263)
    at org.argouml.language.java.generator.GeneratorJava.generateFile2(GeneratorJava.java:213)
    at com.genuitec.eclipse.uml.wizard.NewUMLJavaCodeGenWizard.performFinish(NewUMLJavaCodeGenWizard.java:158)
    at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:676)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:349)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:556)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:809)
    at org.eclipse.jface.window.Window.open(Window.java:787)
    at com.genuitec.eclipse.uml.action.GenerateJavaActionDelegate.basicRun(GenerateJavaActionDelegate.java:46)
    at com.genuitec.eclipse.uml.action.GenerateJavaActionDelegate.run(GenerateJavaActionDelegate.java:34)
    at com.genuitec.eclipse.core.ui.action.LicenseValidatingActionDelegate.runWithEvent(Unknown Source)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:236)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
    at org.eclipse.core.launcher.Main.run(Main.java:973)
    at org.

    #241620 Reply

    Riyad Kalla
    Member

    Are your classes making use of any Java 5 features by chance? This isn’t supported yet.

    #241654 Reply

    datapulse
    Member

    There are no Java 5 features as such, although my JRE is 1.5.

    The only class that is referenced that is not from the class diagram itself is String…

    #241661 Reply

    Riyad Kalla
    Member

    Ok, then can you please post all the information we request in the [URL=http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-393.html]Posting Guidelines[/URL] thread at the top of this forum? That will give us some context so that we can determine if this is an installation issue, a configuration problem, or a bug. Thanks.

    #241663 Reply

    datapulse
    Member

    OK, the stack trace at top of the post is from the Error Log.

    The Configuration Summary is :
    *** Date: Wed Nov 16 21:39:31 CET 2005

    *** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.5.0_05

    *** MyEclipse details:
    MyEclipse Enterprise Workbench

    Version: 4.0.3 GA
    Build id: 20051025-4.0.3-GA

    *** Eclipse details:
    Eclipse SDK

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Platform

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse RCP

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Java Development Tools

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Plug-in Development Environment

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse Project SDK

    Version: 3.1.1
    Build id: M20050929-0840

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\java\eclipse3_1_1\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    d78_60
    -vm
    C:\WINDOWS\system32\javaw.exe

    Other information
    =================
    The class diagram is simple, just 8 interfaces and 4 classes.

    When I select UML->Generate Java the “UML Forward Engineering” dialog is displayed and I click on “Finish”.

    A dialog is displayed stating the project is not empty, Do you want to want to replace existing files?
    Click on “Yes”, it goes away leaving the “UML Forward Engineering” dialog visible.

    All that gets created is the folders that would make up the required package.

    The outcome is exactly the same if the output folders don’t exist (i.e. nothing to overwrite).

    Do you need anything else?
    thanks.

    #241665 Reply

    Riyad Kalla
    Member

    I checked with one of our UML developers and he immediately suggested that this behavior is indicative of a diagram that represents invalid Java code. For example, a Class implementing another Class. Basically the diagramming supports all UML constructs, like multiple inheritence. But right now if you tried to gen Java from it, the generation simply fails. We are working on adding validation down the road.

    Can you double check your diagram and if you can’t see the problem, email it to support@genuitec.com ATTN Riyad with a link to this thread so I know why I’m getting it.

    #241670 Reply

    datapulse
    Member

    Just sent you the UMR file. I deleted everything except the bare classes and interfaces and it still failed to generate code.

    #241706 Reply

    Riyad Kalla
    Member

    I received your file (deliverance.umr) and went to the UML menu, Generatae Java > selected my com.yourcompany.struts package (in a test project) and hit Finsh, bam, I got all the files generated correctly.

    I’d like to try a new workspace really quickly: File > Switch Workspace > C:\tempworkspace, hit OK. Now create a new project and copy your UMR into it (the one you sent me) and try and generate Java from it, did it wokr?

    #241744 Reply

    datapulse
    Member

    Thanks, that worked.

    It also worked when I created a new project in the original workspace and copied the umr file into there.

    Any idea what screwed my original project?

    One thing I still don’t get though is how does a class in the model implement an interface in the rt.jar? I cannot drag and drop a class, nor can I enter anything in the specializations box.

    thanks again.

    #241748 Reply

    Kapil Kapre
    Member

    datapulse,
    ATM we only support drag and drop of actual java files into the model. We will be expanding this functionalty in future releases.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: Cannot generate Java code from Class Diagram

You must be logged in to post in the forum log in