Copying the selected item full path of project browser - enterprise-architect

We have EA Element Object now how can we get the full path of the EA Element in the project browser as the menu (copy node path to clipboard) work in EA using addin

Just parse from the element upwards.
pck = Repository.GetPackageById(Element.PackageId)
loop while pck.ParentId != 0
pck = Repository.GetPackageById(pck.ParentId)
Just join the package names backwards and you're done.
Edit In case you have a child element in focus, you need to recurse Element.ParentID until that is zero which is the topmost parent from which you can continue the above loop.

Related

What's this red "A" on my property?

This is a property in an ibd diagram using sysml1.3.
I don't know what this red letter A is in the low right corner. It's the only item that has it. I guess I have done something to get it but I don't know what and googling it has not given any answer. Can someone explain it?
It contains an attachment (Linked Document). Use Ctrl-Alt-D to view it. Use the context menu to delete (or edit) it.
I would just add that in some cases by default EA (v 14) can open document like diagrams - in full view, especially for CTRL+ALT+D shortcut (or right click on element with Linked Document and after selecting from context menu option Linked Document).
For below flows EA can open Dynamic Document tab by default, as preview next to the i.e. Element Properties, instead of Linked Document:
Start > Explore > Properties > Linked Document or
Show > Portals > Window > Document > Linked Document
Default Document tab by default instead of Linked Document
On Dynamic Document you won't find option to delete Linked Document:
Delete is not available for Dynamic Document
Just switch to the Linked Document, from hamburger select delete and that's it:
Delete is available for Linked Document

E4 contribute with a shared element

My application is built from multiple plugins/model fragments. I am trying to contribute with a shared element (a part) in one of my fragments. I don't have access to the main e4xmi file (the one that contains the Trimmed Window) so it has to be done within my fragment. Any way I can do this ?
In your fragment.e4xmi just add a Model Fragment specifying the id of the parent Trimmed Window as the 'Extended Element ID' and 'sharedElements' as the 'Feature Name'. Add your part to the
Something like:

How to see #document-fragment in the Elements page in Chrome dev tools?

Is there a way to see all document fragments that were created on the page?
So far I am able to see them by using JS Debugger, adding DOM object to watch (or using console), and then using "Reveal in elements panel"
https://developers.google.com/web/updates/2015/04/28/reveal-in-elements-panel?hl=en
But is there a way to go to straight to elements panel and see what are the document-fragments were created?
Also tried this (worth a shot, right?):
document.getElementById("#document-fragment")
null
document.getElementById("document-fragment")
null
There is no such thing as a list of all document-fragments. They are not a part of the document tree so Elements panel doesn't show them. However, if you can find a reference to the document-fragment in some JS variable you can use console to reveal that fragment in the Elements panel:
inspect(documentFragmentRef);
You can also find all document-fragments referenced in the JavaScript code of the inspected application by taking heap snapshot (Profiles panel > Take Heap Snapshot, Take Snapshot) and then filtering by DocumentFragment class name. After that select one of the fragments in the heap snapshot and it will be available in the console as $0 variable:

File Selection from List in a Wizard page

I have a Wizard page which gets a list of IFile. I want to show the user the list and select one file from the list. Then the Wizard returns the selected file.
Is there a standard file chooser that I can use instead of building from scratch in the createControl() of the WizardPage? (Maybe something like table view list with scrollbar to show the list.)
There is FilteredResourcesSelectionDialog that is a popup displaying any resource wanted, eventually with pre-loaded regexp, allowing to search for file, and you give him a root directory :
You call getResult() to retrieve selection as Object[].
If you want to do just a wizard that does that, then I would do it this way.
If it's a list include in a wizard that does other things, then just list all the files and create a org.eclipse.swt.widgets.List
Though there is no ready-to-use FileViewer or the like, you can use a TableViewer with a WorkbenchLabelProvider to show the list of files.
IFile[] files = ...
TableViewer fileViewer = new TableViewer( parent );
fileViewer.setInput( files );
fileViewer.setContentProvider( ArrayContentProvider.getInstance() );
fileViewer.setLabelProvider( new WorkbenchLabelProvider() );
This will create a single-selection table (viewer) that displays the files from the files array.
If multi-selection or further styles apply, use new TableViewer( parent, SWT.MULTI | ... ) to create the viewer.
If the list of files need to be sorted by name or type, you can use the ResourceComparator from the org.eclipse.ui.ide plug-in.
fileViewer.setComparator( new ResourceComparator( ResourceComparator.NAME ) );
If you don't want the extra plug-in dependency or need to sort by another criteria, it may still be used as a template.

Access jcr:content propeties from page node

I have dropdown where the values of options are like jcr:content/jcr:title, jcr:content/jcr:description, /jcr:content/par/entry/text etc. Here the last one is the property of parent, like jcr:title is the property of jcr:content node & text is the property of entry node, but entry has parent par and par has parent jcr:content. I am at the page node and using the below code to fetch such values which doesn't work :
Node n = (Node)nodeIter.next();
log.info(n.getProperty("/jcr:content/par/entry/text"));
Any Idea how to get values in such a way.
Thanks
Remove the starting slash from the property path. It makes the path absolute while you are interested in the relative one (as in other examples you've described):
n.getProperty("jcr:content/par/entry/text");