How to generate diagrams from *.aird through code - eclipse

I have drawn an image in the Obeo Designer. And I can export the image through right-click the image and click the "Export as a Diagram". Now I want to export the diagrams through java code instead of interacting with the Obeo Designer because my program will generate some .aird files during the runtime and I want to turn these .aird files into diagrams in the form of JPG or JPEG automatically. Is there any way to implement the idea?

You could call:
org.eclipse.sirius.ui.business.api.dialect.DialectUIManager.INSTANCE.export(representation,
session, filePath, exportFormat,progressMonitor);
where exportFormat can be for example:
ExportFormat exportFormat = new ExportFormat(ExportDocumentFormat.NONE, ImageFileFormat.PNG);

Related

Selection problems after Bio Format Importer, czi and zvi Files, ImageJ

Hello I'm using ImageJ to analyse -czi and -zvi files. I'm using an automatic selection with "create selection" or "analyze particle"s. It's working well when openening/importing the files with ImageJ. But when I try to use the Bio-Format importer Plugin with the same pictures, it's not working. Not my intended ROIS are selected but the background or even nothing. With using the plugin something about the parameters of the picture changes and I don't know what it is or how to undo it. Does somebody has an idea?
One of the Solutions I realised is a Change of scale. My original files use pixels, whereas the BioFormat importer converts the scale into microns.
Analyze--> Set Scale... --> Click to remove scale or changing the scale solves one part of the problem.
For a macro following code restores the scale:
run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel");
Still somethng about the colour values changes, I can't find, create selection is still not working properly.

profiled Relationship matrix in html reports in Enterprise Architect

How can i include a profiled Relationship matrix in html reports in Enterprise Architect.
I have a link on each diagram which points to a profiled relationship matrix.
I tried to generate a html report for my project. But all these relation matrix links are disabled.
A relationship matrix can't be directly included in an HTML generation and there's no way to script running it or exporting it to an image file. But you can include it in an RTF document, so here's a sort of workaround based on RTF templates and virtual documents.
Create an RTF template which outputs the relationship matrix image. You might want to include the package name and the current date and time as well.
For each package you want a matrix report for, create a «model document» and add the package to it. Please note that if you've defined multiple relationship matrices for a package, you can't choose which one to report - EA will just pick one.
For each «model document», create an Artifact and draw a «trace» from the «model document» to the Artifact.
Move the Artifacts to a package which is included in the HTML generation. You don't have to place them in any diagrams if you don't want to, but they must reside inside the hierarchy for which HTML is generated.
The «model document»:s should be in a separate package which is not included in the HTML generation. Name them according to the scheme "pkgname - matrixname" or similar.
The Artifacts should be given names which make sense within the generated HTML - call them "Requirement Matrix: pkgname" or similar.
Now, before you run your HTML generation, you must run the matrix reports individually and manually by right-clicking the Artifact in the same diagram as the «model document» and selecting "Create Document to Artifact" (so it's a good idea to include the date and time in the template). Then generate your HTML as usual.
This will output the matrix images into the HTML. You'll have to click the document to see the image and as noted you'll have to run the matrix reports manually, but the result will be there.
You could do something similar by placing hyperlinks to image files in your diagrams and then output the different matrices to these image files. I prefer the Artifact method, because it keeps everything inside EA (no broken links) and it gives you the option of including the report date and time and more stuff if you want it.

How can you debug a DITA transformation?

I know XSLT in general can be debugged, but how exactly would one go about debugging a DITA transformation, considering its modular XSLT structure and the fact that stylesheets are pointed to by the catalog.xml file?
I want to be able to step through the code during runtime, and be able to set break points, etc.
If you are using the Oxygen editor, you can debug Toolkit transforms using the technique described here (from the Oxygen 14.2 documentation):
Debugging PDF Transformations
To debug a DITA PDF transformation scenario using the XSLT Debugger follow these steps:
Go to Options > Preferences > XML > XML Catalog, click Add and select the file located at [Oxygen Install Directory]\ frameworks\dita\DITA-OT\plugins\org.dita.pdf2\cfg\catalog.xml;
Open the map in the DITA Maps Manager and create a DITA Map PDF transformation scenario;
Edit the scenario, go to the Parameters tab and change the value of the clean.temp parameter to no;
Run the transformation scenario;
Open in Oxygen XML the stage1.xml file located in the temporary directory and format and indent it;
Create a transformation scenario for this XML file by associating the topic2fo_shell.xsl stylesheet located at OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/xsl/fo/topic2fo_shell_fop.xsl;
In the transformation scenario edit the Parameters list and set the parameter locale with the value en_GB and the parameter customizationDir.url to point either to your customization directory or to the default DITA OT customization directory. It's value should have an URL syntax like:file://c:/path/to/OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/cfg.
Debug the transformation scenario.
I found this topic by searching for "debug toolkit" in the Oxygen online help.
These instructions are specifically for PDF, but you should be able to adapt these instructions to HTML-based transforms as well.
There is always the good old trick of adding print statements around in the code, which is xslt translates to <xsl:message>. Here is a snippet from my frontmatter transformation:
<!--
<xsl:message>createFrontMatter_1.0</xsl:message>
<xsl:message>artworkPrefix=<xsl:copy-of select="$artworkPrefix"/></xsl:message>
<xsl:message>customizationDir.url=<xsl:value-of select="$customizationDir.url"/></xsl:message>
<xsl:message>imageLogoPath=<xsl:value-of select="$imageLogoPath"/></xsl:message>
<xsl:message>imageNotePath=<xsl:value-of select="$imageNotePath"/></xsl:message>
<xsl:message>imageWatermarkPath=<xsl:value-of select="$imageWatermarkPath"/></xsl:message>
<xsl:message>page-width=<xsl:value-of select="$page-width"/></xsl:message>
<xsl:message>page-height=<xsl:value-of select="$page-height"/></xsl:message>
-->
If I uncomment this, I get a nice debugging block of text in the output log, showing the various values for the settings I use.

GMF display diagram example

How can I display a GMF diagram, with the file format "*.ecorediag" in Eclipse in a View?
The diagram should not be editable.
Is there a simple sample view that loads a diagram from say "/home/diagrams/test.ecorediag"
The GMF diagrams (including ecorediag) are rendered on the editor with the help of "org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer".
So the bare minimum code to make this work
DiagramGraphicalViewer viewer = new DiagramGraphicalViewer();
viewer.createControl(composite);
RootEditPart root = EditPartService.getInstance().createRootEditPart(
diagram);
viewer.setRootEditPart(root);
viewer.setEditPartFactory(new EcoreEditPartProvider());
viewer.getControl().setBackground(ColorConstants.listBackground);
viewer.setContents(diagram);

Exporting data in enhanced Grid to csv or xml format using dojo

In my project we are using dojo framework in UI. We are having a functionality to exporting the data in the enhanced grid into excel/csv files. In the dojo toolkit, they are binding the id in the textarea but i need those values in the excel/csv file...can any one help in this issue...? if possible pls tell me how to export the enhanced grid data to excel/csv files...
If you are already using the Enhanced Data Grid, you should be able to include the exporter plugin - dojox.grid.enhanced.plugins.exporter.CSVWriter - to get the CSV text.
This will give you access to two main functions exportGrid and exportSelected that will take the contents and export them as CSV text.
Unfortunately that doesn't get them as a separate file (click to download), just the formatted text in a textarea (or whatever).
To get a "click to download CSV function), you could write a servlet/jsp proxy, which would take a POST from your page with the CSV text (from the plugin above) as part of the form and simply copy it back out with the correct headers to make it appear as an attachment.
response.setContentType("text/csv"); response.setHeader("Content-Disposition","attatchment;filename=name.csv")
This would require something server side though.. and at that point, you may want to consider having a servlet simply produce the CSV text directly.
http://dojotoolkit.org/reference-guide/dojox/grid/EnhancedGrid/plugins/Exporter.html