View Question

taggedvalue of selected attribute

How can I get the taggedvalue of an selected attribute of a class?

Product: Astah Professional

Hi,

I tried to convert these to java but can you give me an example that works in java? I can only get taggedvalues of classes, packages or model. But I want to get taggedvalue of attribute (when its selected).

Help would be very appreciated thanks!

Hi,

Sorry you are right. Using IDiagramViewManager#getSelectedPresentations() will return presentations of a class even when Attribute is selected. So please use this method getSelectedElements(), the snippet below should help:


function printSelectedElementsTaggedValueInfo() {
    var viewManager = astah.getViewManager()
    var diagramViewManager = viewManager.getDiagramViewManager()
    var selectedElements = diagramViewManager.getSelectedElements()
    for each(var selectedElement in selectedElements) {
        printTaggedValueInfo(selectedElement)
    }
}

To note, IDiagramViewManager can only be accessed via plug-ins. So for us to write this in Java, we'll have to create a plug-in and cannot provide it with you right now.

I'm curious what you'll need this in Java for? For studies?

Cheers,

SJ

Answer Question

This content has the following tags: