diff --git a/configuration_extractor/ConfigurationPlugIn/plugins/org.universal.tools.configurationExtractor_1.0.0.201103010942.jar b/configuration_extractor/ConfigurationPlugIn/plugins/org.universal.tools.configurationExtractor_1.0.0.201103010942.jar new file mode 100644 index 0000000000000000000000000000000000000000..12ee33a069d1653a21e0784813fd89e20781e62a Binary files /dev/null and b/configuration_extractor/ConfigurationPlugIn/plugins/org.universal.tools.configurationExtractor_1.0.0.201103010942.jar differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/.classpath b/configuration_extractor/org.universal.tools.configurationExtractor/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..e1a209794014846cc58e220b5c2936a88cda19a5 --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/.classpath @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="lib" path="C:/Users/Alexander/Desktop/jdom.jar"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/.project b/configuration_extractor/org.universal.tools.configurationExtractor/.project new file mode 100644 index 0000000000000000000000000000000000000000..dd40906d39ed6c6415209ffa155a269874d76fef --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.universal.tools.configurationExtractor</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/.settings/org.eclipse.jdt.core.prefs b/configuration_extractor/org.universal.tools.configurationExtractor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f5f1916e5e70c7514650a0176eb62337808bc0c4 --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Nov 24 15:17:29 CET 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/How To.txt b/configuration_extractor/org.universal.tools.configurationExtractor/How To.txt new file mode 100644 index 0000000000000000000000000000000000000000..0875ca7551294c4a28e385f7034fd15364beb36c --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/How To.txt @@ -0,0 +1,56 @@ +Project and Item Wizards + +== Role of this tool == +ConfigurationExtractor Eclipse Plug-In extracts pieces of source code and special annotations and writes them into a XML configuration file. + +=== Benefits === +Builds up a XML configuration file automatically in a few seconds, searching trough all source files you want it to use. +Much more faster than doing it by hand. + +=== Relation to reference architecture === +Tool was written for the FZI Living Lab AAL - PATRONUS project. + +=== Relation to Eclipse === +This Plug-In was developed in Eclipse to use with Eclipse development environment. + +== Overview of functionality == +Extract pieces of source code and comment annotations, write them into a XML file. + +== Installation guide == +1. Copy directory fzi.de.util.config into your Eclipse\plugins folder. +2. Download JDOM from http//www.jdom.org +3. Start your Eclipse development environment +4. Import the JDom.jar file into your build path +5. Use the ConfigurationExtractor + +=== Prerequisites and dependencies === +Depends on the JDOM Package (http://www.jdom.org/), tested and works with JDOM 1.1 + +=== Tool installation procedure === +See Installation guide. + +== Release history == +Not released yet. + +=== Release for D3.1-A === + +{| border="1" cellpadding="2" +|- valign="top" +! scope="row" width="30%" | New features implemented +| width="70%" | Creat a new PERSONA-compliant blank template project. + +Set the initial description of the project. + +Select the initial premade wrapper classes included. + +Defines command for invoking the wizard. +|- valign="top" +! scope="row" | Limitations and problems fixed +| This is the first release, and thus no limitations and problems from previous releases are addressed. +|- valign="top" +! scope="row" | Known remaining limitations and problems +| No problems detected or reported until now. +|- valign="top" +! scope="row" | Features not yet implemented +| Wizards for creating new Items (project-specific classes and files) in selected projects, folders or packages +|} \ No newline at end of file diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/META-INF/MANIFEST.MF b/configuration_extractor/org.universal.tools.configurationExtractor/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..52e4987770a4d8d253949e2f002037f9788a3a49 --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Configuration_Extractor +Bundle-SymbolicName: org.universal.tools.configurationExtractor;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.universal.tools.configurationExtractor.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ClassPath: ., + lib/jdom.jar diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Activator.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Activator.class new file mode 100644 index 0000000000000000000000000000000000000000..c18011083c64ad8cb866aab3a64710649aa35f48 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Activator.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementL$Type.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementL$Type.class new file mode 100644 index 0000000000000000000000000000000000000000..1a45cdea4a8a57ff16db1fb416a14e380ac48bed Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementL$Type.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementL.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementL.class new file mode 100644 index 0000000000000000000000000000000000000000..6440012077e965d15b71317cfb888c9f0f2f82fb Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementL.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementP$Type.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementP$Type.class new file mode 100644 index 0000000000000000000000000000000000000000..4d1ef0aa6c7c5fb89f80f5756a0247482c987d2f Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementP$Type.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementP.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementP.class new file mode 100644 index 0000000000000000000000000000000000000000..4f81ce6af4cbddc7b987b2aceb80ff7c37896532 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$ElementP.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$Lst.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$Lst.class new file mode 100644 index 0000000000000000000000000000000000000000..772d1a90447854ac7e32c76d9644b9b218217825 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$Lst.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$LstPanel.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$LstPanel.class new file mode 100644 index 0000000000000000000000000000000000000000..0c2b0d6e569ee842658e1e6e6b86cca210fccf37 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$LstPanel.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$Root.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$Root.class new file mode 100644 index 0000000000000000000000000000000000000000..e966e0afad96d42a5388ace6fe06927a80b12b87 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations$Root.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations.class new file mode 100644 index 0000000000000000000000000000000000000000..dc0ee3610efb0c0a8ef6d90fc9e417d78ddf2a3c Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/Annotations.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$1.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$1.class new file mode 100644 index 0000000000000000000000000000000000000000..c6f857f7d552ddf47ff85d9d7f4c5328db6d6b49 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$1.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$10.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$10.class new file mode 100644 index 0000000000000000000000000000000000000000..4a6ba74ca86f173c7cdfc470444f179427c2f765 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$10.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$11.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$11.class new file mode 100644 index 0000000000000000000000000000000000000000..1c8117fc510f44f8def67847f6db5be16ca9f3d7 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$11.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$12.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$12.class new file mode 100644 index 0000000000000000000000000000000000000000..5483bd99982ee321f6007a11860a6e992f6ac123 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$12.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$13.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$13.class new file mode 100644 index 0000000000000000000000000000000000000000..19de00ac63bb99b002274cfc19a5aff68b7a486d Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$13.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$2.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$2.class new file mode 100644 index 0000000000000000000000000000000000000000..efeb99f6bca76aba685723c3785f9c198185556d Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$2.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$3.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$3.class new file mode 100644 index 0000000000000000000000000000000000000000..6efcd05cc47fb6a66d45adc409312001e9d94248 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$3.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$4.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$4.class new file mode 100644 index 0000000000000000000000000000000000000000..b81617c6badddd3271abe28a5c69e04ac8700e58 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$4.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$5.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$5.class new file mode 100644 index 0000000000000000000000000000000000000000..981cc4edc750b29f466a52ec668d36ee25621dd6 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$5.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$6.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$6.class new file mode 100644 index 0000000000000000000000000000000000000000..b12fab21bf35742b2abcb38d1602e43322a63420 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$6.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$7.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$7.class new file mode 100644 index 0000000000000000000000000000000000000000..f26d6fa389942224f99e787c08830eba305fa4b3 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$7.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$8.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$8.class new file mode 100644 index 0000000000000000000000000000000000000000..cf951832b58d8042ab29a9b3be19e0c0a1ce6866 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$8.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$9.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$9.class new file mode 100644 index 0000000000000000000000000000000000000000..45047129dec95fb304209f8e6b726a924860a552 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction$9.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction.class b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction.class new file mode 100644 index 0000000000000000000000000000000000000000..989bc3c65f7e78ffcaed43e563717afdf92ea719 Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/bin/org/universal/tools/configurationExtractor/SampleAction.class differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/build.properties b/configuration_extractor/org.universal.tools.configurationExtractor/build.properties new file mode 100644 index 0000000000000000000000000000000000000000..0f269509aaa98011302ab5f80333e7af40d99f9c --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + lib/jdom.jar diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/icons/icon_config.gif b/configuration_extractor/org.universal.tools.configurationExtractor/icons/icon_config.gif new file mode 100644 index 0000000000000000000000000000000000000000..ed8cd29cbbe657afe3b83a39f7d6465bee0eb55a Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/icons/icon_config.gif differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/lib/jdom.jar b/configuration_extractor/org.universal.tools.configurationExtractor/lib/jdom.jar new file mode 100644 index 0000000000000000000000000000000000000000..65a1b3f737390b50a50fa24d17c5ca71a581f0bf Binary files /dev/null and b/configuration_extractor/org.universal.tools.configurationExtractor/lib/jdom.jar differ diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/plugin.xml b/configuration_extractor/org.universal.tools.configurationExtractor/plugin.xml new file mode 100644 index 0000000000000000000000000000000000000000..999e0f045ff8e389f998af275ae1b93d42e0da84 --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/plugin.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + + <extension + point="org.eclipse.ui.actionSets"> + <actionSet + label="Sample Action Set" + visible="true" + id="Configuration_Extractor.actionSet"> + <menu + label="Configuration &" + id="sampleMenu"> + <separator + name="sampleGroup"> + </separator> + </menu> + <action + label="&Extract Configuration" + icon="icons/icon_config.gif" + class="org.universal.tools.configurationExtractor.SampleAction" + tooltip="Extract Configuration" + menubarPath="sampleMenu/sampleGroup" + toolbarPath="sampleGroup" + id="org.universal.tools.configurationExtractor.SampleAction"> + </action> + </actionSet> + </extension> + +</plugin> diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/Activator.java b/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/Activator.java new file mode 100644 index 0000000000000000000000000000000000000000..7f3eaf44309f5ba0cd650d1190470425ee46503a --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/Activator.java @@ -0,0 +1,73 @@ +package org.universal.tools.configurationExtractor; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/* + * This comment will be removed later + * $-panel_element; + * id:notificationTimeout; + * type:TEXTBOX; + * label:Timeout bis zur Benachrichtigung; + * title:Timeout bis zur Benachrichtigung; + * standardvalue:42 + * -$ + */ + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "Configuration_Extractor"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/Annotations.java b/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/Annotations.java new file mode 100644 index 0000000000000000000000000000000000000000..1ad7d6f81c03c423ce7ab0f62206ba5a01716beb --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/Annotations.java @@ -0,0 +1,54 @@ +package org.universal.tools.configurationExtractor; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + + +public class Annotations { + + @Retention(RetentionPolicy.RUNTIME) + public @interface Root { + String name(); + String title(); + String info(); + } + + @Retention(RetentionPolicy.RUNTIME) + public @interface LstPanel { + String id(); + String title(); + } + + @Retention(RetentionPolicy.RUNTIME) + public @interface Lst { + String label(); + String title(); + long limit(); + String domain(); + + } + + @Retention(RetentionPolicy.RUNTIME) + public @interface ElementL { + String id(); + enum Type {CHECKBOX,DROPDOWNLIST,LABEL,LISTBOX,MULTISELECTLISTBOX,RADIOBUTTONGROUP,TEXTAREA,TEXTBOX}; + Type type(); + String label(); + String title(); + String standardvalue() default " "; + String domain() default " "; + } + + @Retention(RetentionPolicy.RUNTIME) + public @interface ElementP { + String id(); + enum Type {CHECKBOX,DROPDOWNLIST,LABEL,LISTBOX,MULTISELECTLISTBOX,RADIOBUTTONGROUP,TEXTAREA,TEXTBOX}; + Type type(); + String label(); + String title(); + String standardvalue() default " "; + String domain() default " "; + + } + +} diff --git a/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/SampleAction.java b/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/SampleAction.java new file mode 100644 index 0000000000000000000000000000000000000000..3b1e72119c6a68e68bae515806fcc4ad63021842 --- /dev/null +++ b/configuration_extractor/org.universal.tools.configurationExtractor/src/org/universal/tools/configurationExtractor/SampleAction.java @@ -0,0 +1,896 @@ +package org.universal.tools.configurationExtractor; + +import java.io.*; +//import javax.xml.bind.*; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.output.Format; +import org.jdom.output.XMLOutputter; +//import java.lang.annotation.Retention; +//import java.lang.annotation.RetentionPolicy; +import java.util.*; + +//import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JTextField; +import javax.swing.UIManager; + +import java.io.File; + +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.lang.reflect.Method; +//import java.lang.annotation.*; +import java.util.UUID; + +import org.universal.tools.configurationExtractor.Annotations.*; + +import javax.swing.JPanel; + +import java.awt.BorderLayout; +//import java.awt.Component; +import java.awt.CardLayout; +import java.awt.Container; +//import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Image; +import java.awt.Insets; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BoxLayout; + +/** + * Our sample action implements workbench action delegate. + * The action proxy will be created by the workbench and + * shown in the UI. When the user tries to use the action, + * this delegate will be created and execution will be + * delegated to it. + * @see IWorkbenchWindowActionDelegate + */ +public class SampleAction implements IWorkbenchWindowActionDelegate { + private IWorkbenchWindow window; + /** + * The constructor. + */ + public SampleAction() { + } + + + @Root(name="Vergessene Geräte",title="Einstellungen vergessene Geräte",info="Hier können Sie Ihre zu überwachenden Geräte konfigurieren") + public void coolActionDelete() { + + } + + + + /** + * The action has been activated. The argument of the + * method represents the 'real' action sitting + * in the workbench UI. + * @see IWorkbenchWindowActionDelegate#run + */ + @Lst(label="Geräte",title="Geräte auswählen",limit=-1,domain="http://www.openaal.org/SAM/Ontology/highLevelThing#Device|http://www.openaal.org/SAM/Ontology/highLevelThing#Oven") + public void run(IAction action) { + + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + catch (Exception e) { + //Do nothing + } + + final HashMap<String, String> hm = new HashMap<String, String>(); + hm.put("subdir", "no"); + + JFrame frame = new JFrame("XML Configuration Wizard"); + Image icon = Toolkit.getDefaultToolkit().getImage("C:\\Users\\Alexander\\workspace\\org.universal.tools.configurationExtractor\\icons\\icon_config.gif"); + frame.setIconImage(icon); + frame.setSize(500,330); + + final Container contentPane = frame.getContentPane(); + final CardLayout layout = new CardLayout(); + contentPane.setLayout(layout); + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + JButton sourceButton = (JButton)e.getSource(); + if (sourceButton.getText().equals("Next >")) { + layout.next(contentPane); + } + else if (sourceButton.getText().equals("< Back")) { + layout.previous(contentPane); + } + + + } + }; + + contentPane.add(getFirstPage(hm,listener),"",0); + contentPane.add(getSecondPage(hm,listener),"",1); + contentPane.add(getThirdPage(hm,listener),"",2); + contentPane.add(getFourthPage(hm,listener),"",3); + contentPane.add(getFifthPage(hm,listener),"",4); + + frame.show(); + + } + + + public static void exportXML(HashMap<String,String> hm) { + + String dirToSearch = hm.get("fieldSourceDir"); + + String fileName = hm.get("fieldTargetDir"); + + Element root = new Element("root"); + Element panels = new Element("panels"); + Element listPanel = new Element("listpanel"); + Element panel = new Element("panel"); + + root.addContent(panels); + + + try { + root.setAttribute("id",fileName.replace(".xml", "") + ":" + System.currentTimeMillis()/1000); + root.setAttribute("name",hm.get("rootName")); + root.setAttribute("title",hm.get("rootTitle")); + root.setAttribute("info",hm.get("rootInfo")); + + listPanel.setAttribute("id","listPanelDoors"); + listPanel.setAttribute("title","listPanelTitle"); + } + catch (NullPointerException npe) { + //Do nothing + } + + panels.addContent(listPanel); + panels.addContent(panel); + + ArrayList<File> files = new ArrayList<File>(); + File[] fileList = new File[0]; + + try { + files = getFiles(dirToSearch,"java",hm); + fileList=new File[files.size()]; + } + catch (NullPointerException npe) { + files = null; + fileList = null; + } + + if (files!=null) { + + String allCode =""; + String str; + + for (int i=0; i<files.size(); i++) { + + if (files.get(i) == null || files.get(i).getAbsolutePath()=="") { + System.out.println("Datei nicht erfolgreich!!! " + fileList[i]); + } + else { + fileList[i] = files.get(i); + + //Read all source code of the file and write it into a String + try { + //Platform.getLocation() + "\\" + fileList[i].getName() + BufferedReader in = new BufferedReader(new FileReader(fileList[i])); + while ((str = in.readLine()) != null) { + allCode += str; + } + in.close(); + } + catch (IOException ioe) { + System.err.println(ioe); + } + + + + } + } + + //Get all Annotations, write them into an array + String contentsReplace = SampleAction.getLst(SampleAction.class); + String[] contents = contentsReplace.split("-\\$\\$-"); + for (int i=0; i<contents.length; i++) { + contents[i]=contents[i].replace("$-", "").replace("-$", ""); + //System.out.println(contents[i]); + } + + + for (int i=0; i<contents.length; i++) { + + String[] content = contents[i].split(";"); + String elementType = content[0]; + + // if (elementType.equals("root")) { + // root.setAttribute("id",fileName.replace(".xml", "") + ":" + System.currentTimeMillis()/1000); + // for (int k=1; k<content.length; k++) { + // root.setAttribute(content[k].split("\"")[0],content[k].split("\"")[1]); + // } + // root.addContent(panels); + // } + // else if (elementType.equals("listpanel")) { + // for (int k=1; k<content.length; k++) { + // listPanel.setAttribute(content[k].split("\"")[0],content[k].split("\"")[1]); + // } + // } + if (elementType.equals("list")) { + Element list = new Element("list"); + for (int k=1; k<content.length; k++) { + Element listChild = new Element(content[k].split("\"")[0]); + listChild.addContent(content[k].split("\"")[1]); + list.addContent(listChild); + } + listPanel.addContent(list); + } + else if (elementType.equals("panel_element")) { + Element element = new Element("element"); + for (int k=1; k<content.length; k++) { + if (content[k].split("\"")[0].equals("id")) { + element.setAttribute("id",content[k].split("\"")[1] + ":" + UUID.randomUUID().toString()); + } + else if (!content[k].split("\"")[1].equals("")) { + Element panel_elementChild = new Element(content[k].split("\"")[0]); + panel_elementChild.addContent(content[k].split("\"")[1]); + element.addContent(panel_elementChild); + } + } + panel.addContent(element); + } + else if (elementType.equals("list_element")) { + Element element = new Element("element"); + for (int k=1; k<content.length; k++) { + if (content[k].split("\"")[0].equals("id")) { + element.setAttribute("id",content[k].split("\"")[1] + ":" + UUID.randomUUID().toString()); + } + else if (!(content[k].split("\"")[0].equals("domain") && content[k].split("\"")[1].replace(" ", "").equals(""))) { + Element panel_elementChild = new Element(content[k].split("\"")[0]); + panel_elementChild.addContent(content[k].split("\"")[1]); + element.addContent(panel_elementChild); + } + } + listPanel.addContent(element); + } + else if (elementType.equals("panel")) { + for (int k=1; k<content.length; k++) { + panel.setAttribute(content[k].split("\"")[0],content[k].split("\"")[1]); + } + } + /*}*/ + } + + + + Document configurationDoc = new Document(root); + //File f = new File(Platform.getLocation().toFile().toURI()); + + XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat().setIndent(" ").setExpandEmptyElements(true)); + + try { + outputter.output(configurationDoc, System.out); + } + catch (java.io.IOException ioe) { + ioe.printStackTrace(); + } + + try { + FileWriter writer = new FileWriter(/*dirName + "\\" + */fileName); + outputter.output(configurationDoc, writer); + writer.close(); + } + catch (IOException ioe) { + System.out.print(ioe); + } + } + else { + System.out.println("No Files with java extension"); + } + } + + @ElementL(id="notify_mms",type=ElementL.Type.CHECKBOX,label="Fliegen",title="Benachrichtigungstyp (MMS)",standardvalue="unchecked") + public static String getLst(Class<?> clazz) { + String allLst = new String(); + for (Method method : clazz.getMethods()) { + if (method.getAnnotation(ElementL.class) != null) { + ElementL value = method.getAnnotation(ElementL.class); + allLst += "$-list_element;id\"" + value.id() + "\";type\"" + value.type() + "\";label\"" + value.label() + "\";title\"" + value.title() + "\";standardvalue\"" + value.standardvalue() + "\";domain\"" + value.domain() + "\"-$"; + } + else if (method.getAnnotation(ElementP.class) != null) { + ElementP value = method.getAnnotation(ElementP.class); + allLst += "$-panel_element;id\"" + value.id() + "\";type\"" + value.type() + "\";label\"" + value.label() + "\";title\"" + value.title() + "\";standardvalue\"" + value.standardvalue() + "\";domain\"" + value.domain() + "\"-$"; + } + else if (method.getAnnotation(LstPanel.class) != null) { + LstPanel value = method.getAnnotation(LstPanel.class); + allLst += "$-listpanel;id\"" + value.id() + "\";title\"" + value.title() + "\"-$"; + } + else if (method.getAnnotation(Lst.class) != null) { + Lst value = method.getAnnotation(Lst.class); + allLst += "$-list;label\"" + value.label() + "\";title\"" + value.title() + "\";limit\"" + value.limit() + "\";domain\"" + value.domain() + "\"-$"; + } + else if (method.getAnnotation(Root.class) != null) { + Root value = method.getAnnotation(Root.class); + allLst += "$-root;name\"" + value.name() + "\";title\"" + value.title() + "\";info\"" + value.info() + "\"-$"; + } + + } + return allLst; + } + + + + /** + * getFiles searches for all files in a Directory and in all SubDirectories, + * writing the one with the correct extension into a ArrayList + * @param baseDir Root Directory to start recursive search + * @param extension Defines the extension of the added files + * @return Returns all files of a selected Root Directory and all + * SubDirectories, which have a specified extension + */ + + + @ElementP(id="notificationTimeout",type=ElementP.Type.TEXTBOX,label="Timeout bis zur Benachrichtigung:",title="Timeout bis zur Benachrichtigung",standardvalue="42",domain="AN") + public static ArrayList<File> getFiles(String baseDir, String extension, HashMap<String,String> hm) + { + final ArrayList<File> files = new ArrayList<File>( 1024 ); + final Stack<File> dirs = new Stack<File>(); + final File startdir = new File(baseDir); + if ( startdir.isDirectory() && hm.get("subdir").equals("yes")) { + System.out.println("Startdir: " + hm.get("subdir")); + dirs.push( startdir ); + } + while (dirs.size() > 0) { + for (File file : dirs.pop().listFiles()) { + if (file.isDirectory() && hm.get("subdir").equals("yes")) { + System.out.println("File Directory: " + hm.get("subdir")); + dirs.push( file ); + } + else if (file.canRead()) { + files.add( file ); + } + } + } + + for (int i=0; i<files.size(); i++) { + if (!files.get(i).getName().endsWith(extension)) { + files.remove(i); + System.out.println("Removed: " + files.get(i).getName()); + } + } + return files; + } + + + + + /** + * Selection in the workbench has been changed. We + * can change the state of the 'real' action here + * if we want, but this can only happen after + * the delegate has been created. + * @see IWorkbenchWindowActionDelegate#selectionChanged + */ + @ElementL(id="deviceSate",type=ElementL.Type.DROPDOWNLIST,label="Device Status:",title="Device Status",domain="http://www.openaal.org/SAM/Ontology/highLevelThing#Device-State") + public void selectionChanged(IAction action, ISelection selection) { + } + + /** + * We can use this method to dispose of any system + * resources we previously allocated. + * @see IWorkbenchWindowActionDelegate#dispose + */ + @LstPanel(id="doors",title="Geräte") + public void dispose() { + } + + /** + * We will cache window object in order to + * be able to provide parent shell for the message dialog. + * @see IWorkbenchWindowActionDelegate#init + */ + @ElementP(id="tempControl",type=ElementP.Type.RADIOBUTTONGROUP,label="Temperaturkontrolle",title="Temperaturkontrolle",standardvalue="AUS",domain="AN|AUS") + public void init(IWorkbenchWindow window) { + this.window = window; + } + + +public static JPanel getFirstPage(HashMap<String, String> hm, ActionListener listener) { + + JPanel page = new JPanel(); + page.setLayout(new BorderLayout(50,0)); + + page.add(BorderLayout.WEST,getMenu(0)); + + JPanel content = new JPanel(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + + gbc.gridx=0; + gbc.gridy=0; + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.fill=GridBagConstraints.HORIZONTAL; + + content.add(new JLabel("<html><br><font size=4>Welcome at Configuration-Extractor V0.9</font><br><br>This Wizard helps you to extract Annotations from your sourcecode at runtime and saves them as a XML configuration-file.<br><br>Please follow the steps of this Wizard to generate the XML file.</html>"),gbc); + + gbc.weightx=1.0; + gbc.weighty=1.0; + content.add(new JPanel(),gbc); + + page.add(BorderLayout.CENTER,content); + page.add(BorderLayout.SOUTH,getButtons(hm,listener,false,true,false)); + + return page; + + } + + public static JPanel getSecondPage(final HashMap<String, String> hm, ActionListener listener) { + + JPanel page = new JPanel(); + page.setLayout(new BorderLayout(50,0)); + + page.add(BorderLayout.WEST,getMenu(1)); + + JPanel formular = new JPanel(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.anchor=GridBagConstraints.NORTHWEST; + gbc.fill=GridBagConstraints.HORIZONTAL; + gbc.gridx=0; + gbc.gridy=0; + gbc.gridwidth=2; + gbc.gridwidth=4; + formular.add(new JLabel("<html><br>Please select the directory, which contains your sourcecode.<br>Choose if the Wizard either search trough subdirs or not.<br>Select the destination (including filename) of the XML-file, too.<br><br></html>"),gbc); + + gbc.gridwidth=1; + gbc.gridy++; + gbc.gridx=0; + + formular.add(new JLabel("Source Directory"),gbc); + + gbc.gridy++; + gbc.gridx=0; + gbc.gridwidth=2; + gbc.fill=GridBagConstraints.HORIZONTAL; + final JTextField fieldSourceDir = new JTextField(); + fieldSourceDir.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + hm.put("fieldSourceDir", fieldSourceDir.getText()); + } + @Override + public void insertUpdate(DocumentEvent e) { + hm.put("fieldSourceDir", fieldSourceDir.getText()); + } + @Override + public void changedUpdate(DocumentEvent e) { + hm.put("fieldSourceDir", fieldSourceDir.getText()); + } + }); + + formular.add(fieldSourceDir,gbc); + gbc.fill=GridBagConstraints.NONE; + gbc.gridwidth=1; + gbc.gridx+=3; + JButton sourceButton = new JButton("Choose..."); + sourceButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + JFileChooser chooser = new JFileChooser(); + chooser.setCurrentDirectory(new java.io.File("")); + chooser.setDialogTitle("Ordner öffnen"); + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.setAcceptAllFileFilterUsed(false); + chooser.showOpenDialog(chooser); + try { + fieldSourceDir.setText(chooser.getSelectedFile().getAbsolutePath()); + } + catch (NullPointerException npe) { + //Do nothing + } + } + }); + formular.add(sourceButton,gbc); + gbc.gridx=0; + gbc.gridy++; + gbc.gridwidth=1; + JCheckBox subdir = new JCheckBox("Search in Subdirectories"); + subdir.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent evt) { + JCheckBox box = (JCheckBox)evt.getSource(); + if (box.isSelected()) { + hm.put("subdir", "yes"); + } + else { + hm.put("subdir", "no"); + } + } + }); + formular.add(subdir,gbc); + + gbc.gridwidth=1; + gbc.gridy++; + gbc.gridx=0; + formular.add(new JLabel("<html><br></html>"),gbc); + gbc.gridy++; + + formular.add(new JLabel("Destination File"),gbc); + gbc.gridy++; + gbc.gridx=0; + gbc.gridwidth=2; + gbc.fill=GridBagConstraints.HORIZONTAL; + final JTextField fieldTargetDir = new JTextField(); + fieldTargetDir.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + hm.put("fieldTargetDir", fieldTargetDir.getText()); + } + @Override + public void insertUpdate(DocumentEvent e) { + hm.put("fieldTargetDir", fieldTargetDir.getText()); + } + @Override + public void changedUpdate(DocumentEvent e) { + hm.put("fieldTargetDir", fieldTargetDir.getText()); + } + }); + formular.add(fieldTargetDir,gbc); + gbc.fill=GridBagConstraints.NONE; + gbc.gridwidth=1; + gbc.gridx+=3; + JButton targetButton = new JButton("Choose..."); + targetButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + JFileChooser saver = new JFileChooser(); + saver.setCurrentDirectory(new java.io.File("C:\\Users\\Alexander\\Desktop")); + saver.setDialogTitle("XML Konfigurationsdatei speichern unter"); + saver.setFileSelectionMode(JFileChooser.FILES_ONLY); + saver.setFileFilter(new FileNameExtensionFilter("XML", new String[] {"xml"})); + saver.showOpenDialog(saver); + try { + fieldTargetDir.setText(saver.getCurrentDirectory().getAbsolutePath() + "\\" + saver.getSelectedFile().getName()); + } + catch (NullPointerException npe) { + //Do nothing + } + } + }); + formular.add(targetButton,gbc); + + gbc.fill=GridBagConstraints.HORIZONTAL; + gbc.weightx=1.0; + gbc.weighty=1.0; + formular.add(new JPanel(),gbc); + + page.add(BorderLayout.CENTER,formular); + page.add(BorderLayout.SOUTH,getButtons(hm,listener,true,true,false)); + return page; + + } + + public static JPanel getThirdPage(final HashMap<String, String> hm, ActionListener listener) { + + JPanel page = new JPanel(); + page.setLayout(new BorderLayout(50,0)); + + page.add(BorderLayout.WEST,getMenu(2)); + + JPanel formular = new JPanel(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.anchor = GridBagConstraints.NORTHWEST; + gbc.gridx=0; + gbc.gridy=0; + gbc.ipadx=5; + gbc.fill=GridBagConstraints.HORIZONTAL; + + gbc.gridx=0; + gbc.gridy=0; + gbc.gridwidth=3; + formular.add(new JLabel("<html><br>Please specify the attributes of root-element.<br><br><root id=\"filename\" name=\"\" title=\"\" info=\"\"><br></root><br><br><br></html>"),gbc); + + gbc.insets=new Insets(0,0,0,10); + gbc.gridx=0; + gbc.gridy++; + gbc.fill=GridBagConstraints.HORIZONTAL; + JPanel box = new JPanel(); + box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS)); + box.add(new JLabel("Name: ")); + final JTextField rootName = new JTextField(); + rootName.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + hm.put("rootName", rootName.getText()); + } + @Override + public void insertUpdate(DocumentEvent e) { + hm.put("rootName", rootName.getText()); + } + @Override + public void changedUpdate(DocumentEvent e) { + hm.put("rootName", rootName.getText()); + } + }); + box.add(rootName); + formular.add(box,gbc); + + gbc.gridx=0; + gbc.gridy++; + gbc.fill=GridBagConstraints.HORIZONTAL; + box = new JPanel(); + box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS)); + box.add(new JLabel("Title: ")); + final JTextField rootTitle = new JTextField(); + rootTitle.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + hm.put("rootTitle", rootTitle.getText()); + } + @Override + public void insertUpdate(DocumentEvent e) { + hm.put("rootTitle", rootTitle.getText()); + } + @Override + public void changedUpdate(DocumentEvent e) { + hm.put("rootTitle", rootTitle.getText()); + } + }); + box.add(rootTitle); + formular.add(box,gbc); + + gbc.gridx=0; + gbc.gridy++; + gbc.fill=GridBagConstraints.HORIZONTAL; + box = new JPanel(); + box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS)); + box.add(new JLabel("Info: ")); + final JTextField rootInfo = new JTextField(); + rootInfo.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + hm.put("rootInfo", rootInfo.getText()); + } + @Override + public void insertUpdate(DocumentEvent e) { + hm.put("rootInfo", rootInfo.getText()); + } + @Override + public void changedUpdate(DocumentEvent e) { + hm.put("rootInfo", rootInfo.getText()); + } + }); + box.add(rootInfo); + formular.add(box,gbc); + + gbc.weightx=1.0; + gbc.weighty=1.0; + formular.add(new JPanel(),gbc); + + page.add(BorderLayout.CENTER,formular); + page.add(BorderLayout.SOUTH,getButtons(hm,listener,true,true,false)); + + return page; + + } + + public static JPanel getFourthPage(final HashMap<String, String> hm, ActionListener listener) { + + JPanel page = new JPanel(); + page.setLayout(new BorderLayout(50,0)); + + page.add(BorderLayout.WEST,getMenu(3)); + + JPanel formular = new JPanel(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.anchor=GridBagConstraints.NORTHWEST; + gbc.gridx=0; + gbc.gridy=0; + gbc.ipadx=5; + + gbc.gridwidth=4; + formular.add(new JLabel("<html><br>Please specify the attributes of listpanel-element.<br><br><listpanel doors=\"\" title=\"\"><br></listpanel><br><br><br></html>"),gbc); + + gbc.insets=new Insets(0,0,0,10); + gbc.gridx=0; + gbc.gridy++; + gbc.fill=GridBagConstraints.HORIZONTAL; + JPanel box = new JPanel(); + box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS)); + box.add(new JLabel("Doors: ")); + final JTextField listPanelDoors = new JTextField(); + listPanelDoors.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + hm.put("listPanelDoors", listPanelDoors.getText()); + } + @Override + public void insertUpdate(DocumentEvent e) { + hm.put("listPanelDoors", listPanelDoors.getText()); + } + @Override + public void changedUpdate(DocumentEvent e) { + hm.put("listPanelDoors", listPanelDoors.getText()); + } + }); + box.add(listPanelDoors); + formular.add(box,gbc); + + gbc.gridx=0; + gbc.gridy++; + gbc.fill=GridBagConstraints.HORIZONTAL; + box = new JPanel(); + box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS)); + box.add(new JLabel("Title: ")); + final JTextField listPanelTitle = new JTextField(); + listPanelTitle.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + hm.put("listPanelTitle", listPanelTitle.getText()); + } + @Override + public void insertUpdate(DocumentEvent e) { + hm.put("listPanelTitle", listPanelTitle.getText()); + } + @Override + public void changedUpdate(DocumentEvent e) { + hm.put("listPanelTitle", listPanelTitle.getText()); + } + }); + box.add(listPanelTitle); + formular.add(box,gbc); + + gbc.weightx=1.0; + gbc.weighty=1.0; + formular.add(new JPanel(),gbc); + + page.add(BorderLayout.CENTER,formular); + page.add(BorderLayout.SOUTH,getButtons(hm,listener,true,true,false)); + + return page; + + + } + + public static JPanel getFifthPage(HashMap<String, String> hm, ActionListener listener) { + + JPanel page = new JPanel(); + page.setLayout(new BorderLayout(50,0)); + + page.add(BorderLayout.WEST,getMenu(4)); + + JPanel content = new JPanel(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.anchor=GridBagConstraints.NORTHWEST; + gbc.fill=GridBagConstraints.HORIZONTAL; + gbc.gridx=0; + gbc.gridy=0; + + content.add(new JLabel("<html><br>The configuartion file will be created, as soon as you click on the Finish Button...</font></html>"),gbc); + + gbc.weightx=1.0; + gbc.weighty=1.0; + content.add(new JPanel(),gbc); + + page.add(BorderLayout.CENTER,content); + page.add(BorderLayout.SOUTH,getButtons(hm,listener,false,false,true)); + + return page; + + } + +public static JPanel getMenu(int index) { + + JLabel entryZero; + JLabel entryOne; + JLabel entryTwo; + JLabel entryThree; + JLabel entryFour; + + JPanel menu = new JPanel(new GridBagLayout()); + GridBagConstraints gbc = new GridBagConstraints(); + + if (index == 0) { + entryZero = new JLabel("<html> <b>1. Welcome</b></html>"); + } + else { + entryZero = new JLabel("<html> 1. Welcome</html>"); + } + + if (index == 1) { + entryOne = new JLabel("<html> <b>2. Source- and Target-Dir</b></html>"); + } + else { + entryOne = new JLabel("<html> 2. Source- and Target-Dir</html>"); + } + + if (index == 2) { + entryTwo = new JLabel("<html> <b>3. Define Root-Element</b></html>"); + } + else { + entryTwo = new JLabel("<html> 3. Define Root-Element</html>"); + } + + if (index == 3) { + entryThree = new JLabel("<html> <b>4. Define ListPanel</b></html>"); + } + else { + entryThree = new JLabel("<html> 4. Define ListPanel</html>"); + } + + if (index == 4) { + entryFour = new JLabel("<html> <b>5. Create Configuration-File</b></html>"); + } + else { + entryFour = new JLabel("<html> 5. Create Configuration-File</html>"); + } + + gbc.gridx=0; + gbc.gridy=0; + gbc.anchor = GridBagConstraints.NORTHWEST; + menu.add(new JLabel(" "),gbc); + gbc.gridy++; + menu.add(entryZero,gbc); + gbc.gridy++; + menu.add(entryOne,gbc); + gbc.gridy++; + menu.add(entryTwo,gbc); + gbc.gridy++; + menu.add(entryThree,gbc); + gbc.gridy++; + menu.add(entryFour,gbc); + gbc.weighty=1.0; + menu.add(new JLabel(" "),gbc); + + return menu; + } + + public static JPanel getButtons(final HashMap hm,ActionListener listener, boolean bBack, boolean bFurther, boolean bFinish) { + + + JButton back = new JButton("< Back"); + back.setEnabled(bBack); + back.addActionListener(listener); + JButton further = new JButton("Next >"); + further.setEnabled(bFurther); + further.addActionListener(listener); + JButton finish = new JButton("Finish"); + finish.setEnabled(bFinish); + finish.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + exportXML(hm); + System.exit(0); + } + }); + JButton cancel = new JButton("Cancel"); + cancel.setEnabled(!bFinish); + cancel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + System.exit(0); + } + }); + + JPanel box = new JPanel(); + box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS)); + + box.add(new JLabel("<html><div align=center> </html>")); + box.add(back); + box.add(new JLabel(" ")); + box.add(further); + box.add(new JLabel(" ")); + box.add(finish); + box.add(new JLabel(" ")); + box.add(cancel); + box.add(new JLabel("<html></div><br><br><br><br></html>")); + + return box; + + } + +} \ No newline at end of file