Archi Forum

Archi => Archi Development => Topic started by: jucanoma on October 04, 2017, 18:02:13 PM

Title: New Plugin doesn't work
Post by: jucanoma on October 04, 2017, 18:02:13 PM
Hello,

I am working on a plugin to export in HTML the model excluding selected of the folders. It runs perfectly in the Debug mode through Eclipse, but when I try to export it to a jar file. add it to the plug-in folder, and run it through Archi standalon, the plugin appears, I select some folders, click on finish but it doesn't do what expected. Is there a way to debug the standalone and see logs?

Here is my MANIFEST.MF file:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Export selected views
Bundle-SymbolicName: org.archicontribs.reports.html;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: CV
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.archimatetool.editor
Bundle-ClassPath: com.archimatetool.reports.html.jar,
lib/ST-4.0.8.jar,
lib/antlr-runtime-4.4.jar,
.
Bundle-Activator: org.archicontribs.reports.html.ArchiReportsPlugin
Bundle-ActivationPolicy: lazy


Here is the plugin.xml :
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         id="org.archicontribs.reports.html"
         name="views to html"
         point="com.archimatetool.editor.exportHandler">
      <exportHandler
            class="org.archicontribs.reports.html.HTMLExporter"
            id="com.archimatetool.import_export_example.exportHandler"
            label="HTML view export">
      </exportHandler>
   </extension>
   <extension
         point="org.eclipse.ui.startup">
      <startup
            class="org.archicontribs.reports.html.Startup">
      </startup>
   </extension>

</plugin>
Title: Re: New Plugin doesn't work
Post by: Phil Beauvoir on October 04, 2017, 18:47:02 PM
What do you expect it to do? And what is it doing instead?

You can add the -console argument to Archi t run it. But you'd need to add system.out() debgug messages to the code.

Note - these problems are hard to help with if one does not have access to the code. ;-)
Title: Re: New Plugin doesn't work
Post by: jucanoma on October 04, 2017, 19:13:39 PM
Hi PB
When I run it in Eclipse it generate the HTML report, like the official functionality, but it filters the selected folders to not generate the views images who are inside.
I attach the source code.
Regards
Juan
Title: Re: New Plugin doesn't work
Post by: jucanoma on October 04, 2017, 21:08:08 PM
Now I have the trace error:
java.io.IOException: Source folder does not exist
   at com.archimatetool.editor.utils.FileUtils.copyFolder(FileUtils.java:167)
   at com.archimatetool.editor.utils.FileUtils.copyFolder(FileUtils.java:202)
   at org.archicontribs.reports.html.HTMLFolderReporter.copyHTMLSkeleton(HTMLFolderReporter.java:161)
   at org.archicontribs.reports.html.HTMLFolderReporter.createReport(HTMLFolderReporter.java:96)
   at org.archicontribs.reports.html.HTMLFolderReporter.export(HTMLFolderReporter.java:72)
   at org.archicontribs.reports.html.ExportViewsWizard.performFinish(ExportViewsWizard.java:44)

I compare my plugin with the oficial HTML plugin and I se the oficial have a folder in the plugin folder. This is the reason of my error because when I try to copy the template folder in the destination the app can't get the information because the root he have is ../Archi/plugins/org.archicontribs.reports.html_1.0.0.201710041659.jar!
Is there a way to install the plugin that is not to put the jar file?
Title: Re: New Plugin doesn't work
Post by: Phil Beauvoir on October 04, 2017, 21:09:26 PM
Try removing the "." from here:

Bundle-ClassPath: com.archimatetool.reports.html.jar,
lib/ST-4.0.8.jar,
lib/antlr-runtime-4.4.jar,
.


Title: Re: New Plugin doesn't work
Post by: jucanoma on October 04, 2017, 21:32:52 PM
I remove it bt it still can't get the templates folder to copy to destination.
Title: Re: New Plugin doesn't work
Post by: Phil Beauvoir on October 05, 2017, 11:53:23 AM
I've edited 3 files to allow this to export the binaries in a folder, not a single jar file.

MANIFEST.MF
build.properties
.classpath

Attached in a zip.

Phil
Title: Re: New Plugin doesn't work
Post by: jucanoma on October 05, 2017, 14:10:46 PM
Hi Phil
I updated the 3 files. In eclipse I ussually export the jar in the menu Export, Deployable plug-ins and fragments. How do I have to do to export in a zip and import it in Archi as a plugin?
Thx
Juan
Title: Re: New Plugin doesn't work
Post by: Phil Beauvoir on October 05, 2017, 14:13:33 PM
Do the same as you are doing now - Export, Deployable plug-ins and fragments.

Archi's "magic" zip formula consist of the exported folder and a special file called "archi-plugin". This file is a kind of "marker" to say "this is an Archi plugin".

So you manually have to create this zip file.

Phil
Title: Re: New Plugin doesn't work
Post by: jucanoma on October 05, 2017, 14:28:45 PM
it works! Thx a lot!
If I want to share this plugin what I have to do?
Regards
Juan
Title: Re: New Plugin doesn't work
Post by: Phil Beauvoir on October 05, 2017, 16:44:50 PM
You could host it on GitHub. That's what other people do.