How to insert existing an interface or classes from the java.* library

Hallo all,
is it possible to insert an interface or a class from the standard library via the graphical UML Editor so that afterwards I can draw an implentation or generalization to that library interface or class from my own class?

What I may do is to generate code from the diagram, then navigate to the source code of the newly created class, add "implements xyz-Interface" or "extends xyz-class", save the source file, switch back to the UML Diagramm, right click and choose "configure class diagram" and choose the Iimplemented interface or inherited class to add to the diagram.

That seems rather complicated.

Other UML Tools allow to specify which interface a new class should implement or which class it extends. Do I miss something?

Thank you for your attention.

Regards Ari


  • Hi,

    there are several ways to create Classes/Interfaces from Java (or other libraries) in UML Lab.

    a) Create the Class/Interface in your model, set its name and namespace correctly, and apply the Stereotype "Reference" on it.

    b) Use UML Lab's Round-Trip-Engineering, like you described it.

    c) Open the Class/Interface in the Eclipse Package Explorer (e.g. by using Ctrl+Shift+T) and then add it to the UML Diagram editor per Drag&Drop.

    The first approaches a) and b) result in the very same model. Approach c) will give you more insight in the internals of the library Class/Interface, as the Classifier will contain more reverse engineering information like Operations and Properties [1].

    Have fun using UML Lab :).

    Best regards

    [1] Note, you can always right-click and choose "Upadate from Classpath" on model elements in the diagram. That way, Classifiers gernerated by the approaches a) and b) can be enhanced to c).
  • Hi Manuel,

    thanks for your quick reply.

    The method described in your footer note [1] I have already found.

    c) would be the nearest I am searching for. I want to insert Standard JRE Library classes or interfaces. I.E I want to insert the Observable - class and draw a generalization from my class to Obervable resulting in
    " public MyClass extends Obervable { ...."

    But this does not work for a class not referenced via a) or b) before.

    What I have found: right-click on a class edited in source ( ie. added "extends Observable implements WhateverInterface) and reverse enginered, choose "show neighbours" -> "show parents" (shift-ctrl-q) or "show neighbours"

    A more intuitive approach would be a "edit class" dialog in a popup menu appearing when right clicking on a class as with "edit association" when right clicking on an association.

    In that popup one should be able to enter the class to be extended via syntax completiion as well all implemented Interfaces.

    Nevertheless good job but demanding a strong machine.

    Cheers ari
  • Hi Ari,

    did you try to add the Class/Interface via drag&drop from the Package explorer view on the diagram editor? This works without referencing the class via a) or b). It just starts a reverse engineering and adds the result to the model and diagram.

  • Hallo Manuel,

    I tried again c) and now it works.

    Before I had tried to drag the class name (with the eclipse C-Symbol in front) from the package explorer to the diagram editor. But I must drag the entry above (i.e. Observable.class)

    Thank you for yout reply.

  • Hi Ari,

    ah, ok. Currently, the file must be dragged, not the nested Java class. But I think we can add also add the possibility to drag&drop the Java class.

Sign In or Register to comment.