Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2012-02-28 05:27:03 -0500
committerMarkus Tiede2012-02-28 05:27:03 -0500
commitdae27fbc7cd9a1c212d0cc36be7c493ac0dfcbb9 (patch)
tree166b65b5aa0fde2f92341b9fb0fb4189b8539df9 /org.eclipse.jubula.client.analyze.ui
parent963b9bfdec69291312f43593ab7e98ea85445b84 (diff)
downloadorg.eclipse.jubula.core-dae27fbc7cd9a1c212d0cc36be7c493ac0dfcbb9.tar.gz
org.eclipse.jubula.core-dae27fbc7cd9a1c212d0cc36be7c493ac0dfcbb9.tar.xz
org.eclipse.jubula.core-dae27fbc7cd9a1c212d0cc36be7c493ac0dfcbb9.zip
Initial source check-in for CQ 6190 and enhancement 370427.
Diffstat (limited to 'org.eclipse.jubula.client.analyze.ui')
-rw-r--r--org.eclipse.jubula.client.analyze.ui/.checkstyle10
-rw-r--r--org.eclipse.jubula.client.analyze.ui/.classpath7
-rw-r--r--org.eclipse.jubula.client.analyze.ui/.gitignore2
-rw-r--r--org.eclipse.jubula.client.analyze.ui/.project34
-rw-r--r--org.eclipse.jubula.client.analyze.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.jubula.client.analyze.ui/META-INF/MANIFEST.MF19
-rw-r--r--org.eclipse.jubula.client.analyze.ui/build.properties14
-rw-r--r--org.eclipse.jubula.client.analyze.ui/icons/analyzeToolbarA.gifbin0 -> 1023 bytes
-rw-r--r--org.eclipse.jubula.client.analyze.ui/plugin.properties12
-rw-r--r--org.eclipse.jubula.client.analyze.ui/plugin.xml132
-rw-r--r--org.eclipse.jubula.client.analyze.ui/pom.xml22
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/Activator.java42
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/components/AnalyzePreferenceDialog.java334
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ContextMenuContributionItem.java141
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ToolbarMenuContributionItem.java146
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/RunSelectionHandler.java90
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/ToolbarButtonDefaultHandler.java34
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/Messages.java58
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/messages.properties23
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/Query.java150
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/QueryResult.java82
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/ResultPage.java173
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/definition/IResultRendererUI.java34
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/AnalyzeTreeViewerInputHelper.java86
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/ContextHelper.java166
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/listener/AnalyzeTreeViewerDoubleClickListener.java104
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListContentProvider.java66
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListLabelProvider.java38
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeContentProvider.java149
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeLabelProvider.java36
-rw-r--r--org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/renderer/TableRenderer.java334
31 files changed, 2546 insertions, 0 deletions
diff --git a/org.eclipse.jubula.client.analyze.ui/.checkstyle b/org.eclipse.jubula.client.analyze.ui/.checkstyle
new file mode 100644
index 000000000..4323d7f2b
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/.checkstyle
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Jubula" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/jubula/client/analyze/ui/i18n"/>
+ </filter>
+</fileset-config>
diff --git a/org.eclipse.jubula.client.analyze.ui/.classpath b/org.eclipse.jubula.client.analyze.ui/.classpath
new file mode 100644
index 000000000..64c5e31b7
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jubula.client.analyze.ui/.gitignore b/org.eclipse.jubula.client.analyze.ui/.gitignore
new file mode 100644
index 000000000..934e0e06f
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/.gitignore
@@ -0,0 +1,2 @@
+/bin
+/target
diff --git a/org.eclipse.jubula.client.analyze.ui/.project b/org.eclipse.jubula.client.analyze.ui/.project
new file mode 100644
index 000000000..5ed27c3ea
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jubula.client.analyze.ui</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>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.jubula.client.analyze.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jubula.client.analyze.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..5e5224eac
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Dec 06 15:30:01 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.eclipse.jubula.client.analyze.ui/META-INF/MANIFEST.MF b/org.eclipse.jubula.client.analyze.ui/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..00fff8205
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jubula Analyze UI
+Bundle-SymbolicName: org.eclipse.jubula.client.analyze.ui;singleton:=true
+Bundle-Version: 1.2.0.qualifier
+Bundle-Activator: org.eclipse.jubula.client.analyze.ui.Activator
+Bundle-Vendor: BREDEX GmbH
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0.v20110110,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.7.0.20110602-0100,4.0.0)",
+ org.eclipse.jubula.client.analyze;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.jubula.client.ui;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.search;bundle-version="[3.7.0,4.0.0)",
+ org.eclipse.jubula.client.ui.rcp;bundle-version="[1.2.0,1.3.0)",
+ org.apache.commons.lang;bundle-version="[2.4.0,3.0.0)",
+ org.eclipse.jubula.client.core;bundle-version="[1.2.0,1.3.0)",
+ org.eclipse.jubula.client.analyze.impl.standard;bundle-version="[1.2.0,1.3.0)"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
diff --git a/org.eclipse.jubula.client.analyze.ui/build.properties b/org.eclipse.jubula.client.analyze.ui/build.properties
new file mode 100644
index 000000000..bd3ac6246
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/build.properties
@@ -0,0 +1,14 @@
+###############################################################################
+# Copyright (c) 2004, 2012 BREDEX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ icons/,\
+ plugin.xml
diff --git a/org.eclipse.jubula.client.analyze.ui/icons/analyzeToolbarA.gif b/org.eclipse.jubula.client.analyze.ui/icons/analyzeToolbarA.gif
new file mode 100644
index 000000000..04944bc31
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/icons/analyzeToolbarA.gif
Binary files differ
diff --git a/org.eclipse.jubula.client.analyze.ui/plugin.properties b/org.eclipse.jubula.client.analyze.ui/plugin.properties
new file mode 100644
index 000000000..971a702e4
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2004, 2012 BREDEX GmbH.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+complexity=Complexity
+numMet=Numerical Metrics
+analysis=Analysis
+analyze=Analyze
+analyzeView=Analyze View \ No newline at end of file
diff --git a/org.eclipse.jubula.client.analyze.ui/plugin.xml b/org.eclipse.jubula.client.analyze.ui/plugin.xml
new file mode 100644
index 000000000..414354dcc
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/plugin.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="org.eclipse.jubula.client.analyze.ui.analyzeToolbar">
+ <command
+ commandId="org.eclipse.jubula.client.analyze.ui.menuCommand"
+ icon="icons/analyzeToolbarA.gif"
+ style="pulldown">
+ </command>
+ </toolbar>
+ </menuContribution>
+ <menuContribution
+ locationURI="menu:org.eclipse.jubula.client.analyze.ui.menuCommand">
+ <dynamic
+ class="org.eclipse.jubula.client.analyze.ui.contributionitems.ToolbarMenuContributionItem"
+ id="org.eclipse.jubula.client.analyze.ui.dynamicMenu">
+ </dynamic>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.jubula.client.ui.rcp.views.TestSuiteBrowser?after=additions">
+ <menu
+ label="%analyze">
+ <dynamic
+ class="org.eclipse.jubula.client.analyze.ui.contributionitems.ContextMenuContributionItem"
+ id="org.eclipse.jubula.client.analyze.ui.dynamicMenu">
+ </dynamic>
+ </menu>
+</menuContribution>
+<menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.jubula.client.ui.rcp.views.TestCaseBrowser?after=additions">
+ <menu
+ label="Analyze">
+ <dynamic
+ class="org.eclipse.jubula.client.analyze.ui.contributionitems.ContextMenuContributionItem"
+ id="org.eclipse.jubula.client.analyze.ui.dynamicMenu">
+ </dynamic>
+ </menu>
+</menuContribution>
+<menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.jubula.client.ui.rcp.editors.ObjectMappingEditor?after=additions">
+ <menu
+ label="Analyze">
+ <dynamic
+ class="org.eclipse.jubula.client.analyze.ui.contributionitems.ContextMenuContributionItem"
+ id="org.eclipse.jubula.client.analyze.ui.dynamicMenu">
+ </dynamic>
+ </menu>
+</menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.jubula.client.ui.rcp.editors.CentralTestDataEditor?after=additions">
+ <menu
+ label="Analyze">
+ <dynamic
+ class="org.eclipse.jubula.client.analyze.ui.contributionitems.ContextMenuContributionItem"
+ id="org.eclipse.jubula.client.analyze.ui.dynamicMenu">
+ </dynamic>
+ </menu>
+</menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:ComponentNameBrowserContextMenuID?after=additions">
+ <menu
+ label="Analyze">
+ <dynamic
+ class="org.eclipse.jubula.client.analyze.ui.contributionitems.ContextMenuContributionItem"
+ id="org.eclipse.jubula.client.analyze.ui.dynamicMenu">
+ </dynamic>
+ </menu>
+ </menuContribution>
+
+</extension>
+ <extension
+ point="org.eclipse.ui.commands">
+
+ <command
+ defaultHandler="org.eclipse.jubula.client.analyze.ui.handlers.ToolbarButtonDefaultHandler"
+ id="org.eclipse.jubula.client.analyze.ui.RunProfile"
+ name="RunProfile">
+ <commandParameter
+ id="org.eclipse.jubula.client.analyze.ui.commandParameter3"
+ name="name"
+ optional="true">
+ </commandParameter>
+ </command>
+ <command
+ defaultHandler="org.eclipse.jubula.client.analyze.ui.handlers.RunSelectionHandler"
+ id="org.eclipse.jubula.client.analyze.ui.RunSelection"
+ name="RunSelection">
+ <commandParameter
+ id="org.eclipse.jubula.client.analyze.ui.RunSelection.IDParam"
+ name="IDParam">
+ </commandParameter>
+
+ </command>
+ <command
+ defaultHandler="org.eclipse.jubula.client.analyze.ui.handlers.ToolbarButtonDefaultHandler"
+ id="org.eclipse.jubula.client.analyze.ui.menuCommand"
+ name="%analyze">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.search.searchResultViewPages">
+ <viewPage
+ class="org.eclipse.jubula.client.analyze.ui.internal.ResultPage"
+ id="org.eclipse.jubula.client.analyze.ui.internal.resultPage"
+ searchResultClass="org.eclipse.jubula.client.analyze.ui.internal.QueryResult">
+ </viewPage>
+ </extension>
+ <extension
+ point="org.eclipse.jubula.client.analyze.definition">
+ <ResultRenderer
+ ResultType="tableResultMap"
+ id="tableRenderer"
+ rendererClass="org.eclipse.jubula.client.analyze.ui.renderer.TableRenderer">
+ </ResultRenderer>
+ <Context
+ class="org.eclipse.jubula.client.analyze.ui.internal.context.Project"
+ id="project"
+ name="Project">
+ </Context>
+ </extension>
+</plugin>
diff --git a/org.eclipse.jubula.client.analyze.ui/pom.xml b/org.eclipse.jubula.client.analyze.ui/pom.xml
new file mode 100644
index 000000000..42b8043b9
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/pom.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2004, 2012 BREDEX GmbH.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+ -->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>com.bredexsw.guidancer.project.configuration</artifactId>
+ <groupId>com.bredexsw.guidancer</groupId>
+ <version>6.0.0-SNAPSHOT</version>
+ <relativePath>../com.bredexsw.guidancer.project.configuration</relativePath>
+ </parent>
+ <groupId>org.eclipse.jubula</groupId>
+ <artifactId>org.eclipse.jubula.client.analyze.ui</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/Activator.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/Activator.java
new file mode 100644
index 000000000..a555c624b
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/Activator.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Volker Hotzan
+ */
+public class Activator implements BundleActivator {
+ /**
+ * the context
+ */
+ private static BundleContext context;
+
+ /**
+ * @return the context
+ */
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /** {@inheritDoc} */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /** {@inheritDoc} */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/components/AnalyzePreferenceDialog.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/components/AnalyzePreferenceDialog.java
new file mode 100644
index 000000000..2e4380ebf
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/components/AnalyzePreferenceDialog.java
@@ -0,0 +1,334 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.components;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeParameter;
+import org.eclipse.jubula.client.analyze.ui.i18n.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This class creates the AnalyzePreference dialog, which is shown, when an
+ * Analyze with Parameters has been chosen. This PreferenceDialog is used to
+ * adjust AnalyzeParameters
+ *
+ * @author volker
+ *
+ */
+public class AnalyzePreferenceDialog extends Dialog {
+
+ /** The ParameterDialog */
+ private Dialog m_dialog;
+
+ /** the cancel status */
+ private boolean m_cancelStatus = true;
+
+ /** The List includes the Text fields for the ParameterValues */
+ private ArrayList<Text> m_textList;
+
+ /**
+ * the parameterValue. It is modified when the text is changed in the
+ * modifyListener below
+ */
+ private String m_paramValue;
+
+ /**
+ * @param parentShell
+ * The ParentShell
+ * @param parameterList
+ * The given List of AnalyzeParameters
+ */
+ public AnalyzePreferenceDialog(Shell parentShell,
+ List<AnalyzeParameter> parameterList) {
+ super(parentShell);
+ createAnalyzePreferenceDialog(parameterList);
+ }
+
+ /**
+ * @return m_dialog The Dialog
+ */
+ public Dialog getDialog() {
+ return m_dialog;
+ }
+
+ /**
+ *
+ * @param dialog The given Dialog
+ */
+ public void setDialog(Dialog dialog) {
+ this.m_dialog = dialog;
+ }
+
+ /**
+ * @return m_cancel The cancelStatus
+ */
+ public boolean getCancelStatus() {
+ return m_cancelStatus;
+ }
+
+ /**
+ * @param cancelStatus The given cancel-state
+ */
+ public void setCancelStatus(Boolean cancelStatus) {
+ this.m_cancelStatus = cancelStatus;
+ }
+
+ /**
+ * @return m_paramValue The Parameter Value
+ */
+ public String getParamValue() {
+ return m_paramValue;
+ }
+
+ /**
+ * @param paramValue The value of the AnalyzeParameter
+ */
+ public void setParamValue(String paramValue) {
+ this.m_paramValue = paramValue;
+ }
+
+ /**
+ * creates the AnalyzePreferenceDialog
+ * @param parameterList
+ * The List of AnalyzeParameters
+ * @return dialog The AnalyzePreferenceDialog
+ */
+ public Dialog createAnalyzePreferenceDialog(
+ final List<AnalyzeParameter> parameterList) {
+ if (parameterList.size() != 0) {
+
+ // The AnalyzePreferenceDialog
+ Dialog dialog = new Dialog(Display.getCurrent().getActiveShell()) {
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super
+ .createDialogArea(parent);
+ createDialogContent(composite, parameterList);
+ return composite;
+ }
+ @Override
+ protected Point getInitialSize() {
+ int height;
+ if (parameterList.size() <= 10) {
+ height = (parameterList.size() * 32) + 132;
+ } else {
+ height = 452;
+ }
+ return new Point(600, height);
+ }
+ @Override
+ protected void okPressed() {
+ setCancelStatus(false);
+ getDialog().close();
+ }
+ @Override
+ protected void cancelPressed() {
+ setCancelStatus(true);
+ getDialog().close();
+ }
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ ((GridLayout) parent.getLayout()).numColumns++;
+ Button defaults = new Button(parent, SWT.PUSH);
+ defaults.setData(parameterList);
+ defaults.setText(Messages.DefaultsButton);
+ defaults.addListener(SWT.Selection, new Listener() {
+
+ public void handleEvent(Event event) {
+ restore();
+ }
+ });
+ createButton(parent, IDialogConstants.OK_ID,
+ IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL, false);
+ }
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(Messages.AnalyzePreferenceDialog);
+ }
+ };
+ setDialog(dialog);
+ dialog.open();
+ return dialog;
+ }
+ setCancelStatus(false);
+ return null;
+ }
+
+ /**
+ * Creates the content of the AnalyzePreferenceDialog
+ *
+ * @param composite
+ * The given Composite
+ * @param parameterList
+ * The given parameterList with the AnalyzeParameters
+ */
+ private void createDialogContent(Composite composite,
+ List<AnalyzeParameter> parameterList) {
+
+ int width = 580;
+ int height = (parameterList.size() * 28) + 40;
+ composite.setLayout(new FillLayout());
+
+ ScrolledComposite sc = new ScrolledComposite(composite, SWT.V_SCROLL);
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+ sc.setMinSize(width, height + 1);
+
+ Composite content = new Composite(sc, SWT.NONE);
+ content.setLayout(new RowLayout());
+
+ // has to be less than the setMinSize-height of the ScrolledComposite
+ content.setSize(width, height);
+
+ sc.setContent(content);
+
+ // The HeaderLabel of this Dialog.
+ Label header = new Label(content, SWT.NONE);
+ header.setSize(600, 20);
+ header.setText(Messages.AnalyzePreferenceDialogAdjustNote);
+
+ // adds a Separator
+ RowData sepData = new RowData(600, 10);
+ Label sep = new Label(content, SWT.SEPARATOR | SWT.HORIZONTAL);
+ sep.setLayoutData(sepData);
+
+ // fill the Composite with the AnalyzeParameters
+ processParameters(content, parameterList);
+ }
+
+ /**
+ * Gets the List with the TextObjects and resets their Texts
+ * to the defaults values
+ */
+ private void restore() {
+
+ for (int i = 0; i < getTextList().size(); i++) {
+ Text t = getTextList().get(i);
+ AnalyzeParameter ap = (AnalyzeParameter) t.getData();
+ t.setText(ap.getDefaultValue());
+ }
+ }
+
+ /**
+ * Handles the dynamic content of the given Composite. Creates the
+ * GridLayout with its components to display the parameters
+ *
+ * @param cmp
+ * The given Composite
+ * @param parameterList
+ * The given List of Parameters
+ * @return c The Composite that which contains the Parameters
+ */
+ private Composite processParameters(Composite cmp,
+ List<AnalyzeParameter> parameterList) {
+
+ GridLayout grid = new GridLayout(4, false);
+
+ Composite c = new Composite(cmp, SWT.NONE);
+ c.setLayout(grid);
+
+ ArrayList<Text> textList = new ArrayList<Text>();
+ setTextList(textList);
+
+ for (int i = 0; i < parameterList.size(); i++) {
+ AnalyzeParameter aParam = parameterList.get(i);
+
+ GridData sepData = new GridData();
+ sepData.widthHint = 65;
+ GridData dataLeft = new GridData(200, SWT.DEFAULT);
+ dataLeft.horizontalAlignment = SWT.CENTER;
+ GridData dataMid = new GridData(50, SWT.DEFAULT);
+ dataMid.widthHint = 50;
+ GridData dataRight = new GridData(150, SWT.DEFAULT);
+ dataRight.grabExcessHorizontalSpace = false;
+
+ // A Separator
+ Label sepLab = new Label(c, SWT.NONE);
+ sepLab.setLayoutData(sepData);
+ // This Label shows the name of the AnalyzeParameter
+ Label nameLabel = new Label(c, SWT.NONE);
+ nameLabel.setText(aParam.getName());
+ nameLabel.setLayoutData(dataLeft);
+
+ // This Label is used to show the ControlDecoration info-Image,
+ // without using the the ControlDecoration,to show the
+ // AnalyzeParameter description as a ToolTip
+ Label infoLabel = new Label(c, SWT.NONE);
+ infoLabel.setLayoutData(dataMid);
+ Image im = FieldDecorationRegistry
+ .getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION)
+ .getImage();
+ infoLabel.setImage(im);
+ infoLabel.setToolTipText(aParam.getDescription());
+ // create the Text which is used to display the parameterValue
+ Text text = new Text(c, SWT.BORDER);
+ text.setLayoutData(dataRight);
+ text.setText(aParam.getValue());
+ text.setTextLimit(30);
+ text.setSize(100, 40);
+ // set the AnalyzeParameter as the TextData
+ text.setData(aParam);
+ text.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ Text text = (Text) e.widget;
+ AnalyzeParameter param = (AnalyzeParameter) text.getData();
+ param.setModifiedValue(text.getText());
+ }
+ });
+ // save the Text in an ArrayList
+ getTextList().add(text);
+ }
+ return c;
+ }
+
+ /**
+ * @return A List with the Text-Objects for the AnalyzeParameter values
+ */
+ public List<Text> getTextList() {
+ return m_textList;
+ }
+
+ /**
+ * @param textList The given List which includes the TextObjects
+ */
+ public void setTextList(List<Text> textList) {
+ this.m_textList = (ArrayList<Text>) textList;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ContextMenuContributionItem.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ContextMenuContributionItem.java
new file mode 100644
index 000000000..19e0ba49e
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ContextMenuContributionItem.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.contributionitems;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jubula.client.analyze.ExtensionRegistry;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.Category;
+import org.eclipse.jubula.client.analyze.ui.internal.helper.ContextHelper;
+import org.eclipse.jubula.client.ui.utils.CommandHelper;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.menus.CommandContributionItem;
+
+
+/**
+ * ContextMenuContributionItem is used to handle the creation of the ContributionItems ContextMenu
+ * @author volker
+ *
+ */
+public class ContextMenuContributionItem extends CompoundContributionItem {
+
+ /** the label shown in the menu */
+ private String m_label;
+
+ /** the attribute id from the actual Analyze */
+ private String m_currentID;
+
+ /** */
+ public ContextMenuContributionItem() {
+ }
+
+ /**
+ * @param id
+ * The id
+ */
+ public ContextMenuContributionItem(String id) {
+ super(id);
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+
+ List<IContributionItem> contributionItems =
+ new ArrayList<IContributionItem>();
+
+ for (Map.Entry<String, Category> e : ExtensionRegistry.getCategory()
+ .entrySet()) {
+
+ Category c = (Category) e.getValue();
+
+ createMenuEntry(c, contributionItems, null);
+
+ }
+ return contributionItems
+ .toArray(new IContributionItem[contributionItems.size()]);
+ }
+
+ /**
+ * creates a ContributionItem which represents a Category calls the
+ * createSubMenuEntry to create the ContributionItem which represents the
+ * Analyze
+ *
+ * @param c
+ * the given category
+ * @param contributionItems
+ * the contributionItems list
+ * @param mm
+ * MenuManager
+ */
+ private void createMenuEntry(Category c,
+ List<IContributionItem> contributionItems, MenuManager mm) {
+
+ // check if there is a ToplevelCategory
+ if (c.getParentCatID() == null || c.getParentCatID().length() == 0) {
+ contributionItems.add(createSubMenuEntry(c));
+ } else {
+ for (Map.Entry<String, Category> e : ExtensionRegistry.getCategory()
+ .entrySet()) {
+ Category cat = (Category) e.getValue();
+ if (cat.getID().equals(c.getParentCatID())) {
+ MenuManager mgr = new MenuManager(cat.getName());
+ mgr.add(createSubMenuEntry(c));
+ contributionItems.add(mgr);
+ contributionItems.add(new Separator());
+ }
+ }
+ }
+ }
+
+ /**
+ * creates the ContributionItem which represents the Analyze in the contextMenu
+ * @param c
+ * current Category
+ * @return mgr MenuManager
+ */
+ private MenuManager createSubMenuEntry(Category c) {
+ // Set the Command and the Command Parameters
+ String command = "org.eclipse.jubula.client.analyze.ui.RunSelection"; //$NON-NLS-1$
+ String idParam = "org.eclipse.jubula.client.analyze.ui.RunSelection.IDParam"; //$NON-NLS-1$
+
+ MenuManager mgr = new MenuManager(c.getName());
+ for (Map.Entry<String, Analyze> f : ExtensionRegistry.getAnalyze()
+ .entrySet()) {
+
+ Analyze analyze = f.getValue();
+
+ if (analyze.getCategoryID().equals(c.getID())
+ && ContextHelper.isEnabled(analyze)) {
+
+ // shown label
+ m_label = analyze.getName();
+ // current ID
+ m_currentID = analyze.getID();
+
+ Map<String, String> params = new HashMap<String, String>();
+
+ params.put(idParam, m_currentID);
+ IContributionItem item = CommandHelper.createContributionItem(
+ command, params, m_label,
+ CommandContributionItem.STYLE_PUSH);
+ mgr.add(item);
+ }
+ }
+ return mgr;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ToolbarMenuContributionItem.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ToolbarMenuContributionItem.java
new file mode 100644
index 000000000..8a4af46b7
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/contributionitems/ToolbarMenuContributionItem.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.contributionitems;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jubula.client.analyze.ExtensionRegistry;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.Category;
+import org.eclipse.jubula.client.analyze.ui.internal.helper.ContextHelper;
+import org.eclipse.jubula.client.ui.utils.CommandHelper;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.menus.CommandContributionItem;
+
+
+/**
+ * ToolbarMenuContributionItem is used to handle the creation of the ContributionItems in the Toolbar
+ * @author volker
+ *
+ */
+public class ToolbarMenuContributionItem extends CompoundContributionItem {
+ /**
+ * the label shown in the menu
+ */
+ private String m_label;
+ /**
+ * the attribute id from the actual Analyze
+ */
+ private String m_currentID;
+
+ /**
+ *
+ */
+ public ToolbarMenuContributionItem() {
+ }
+
+ /**
+ *
+ * @param id
+ * id
+ */
+ public ToolbarMenuContributionItem(String id) {
+ super(id);
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+
+ List<IContributionItem> contributionItems =
+ new ArrayList<IContributionItem>();
+
+ for (Map.Entry<String, Category> e : ExtensionRegistry.getCategory()
+ .entrySet()) {
+ Category c = (Category) e.getValue();
+ createMenuEntry(c, contributionItems, null);
+ }
+ return contributionItems
+ .toArray(new IContributionItem[contributionItems.size()]);
+ }
+
+ /**
+ * creates a ContributionItem which represents a Category calls the
+ * createSubMenuEntry to create the ContributionItem which represents the
+ * Analyze
+ * @param c
+ * the given category
+ * @param contributionItems
+ * the contributionItems list
+ * @param mm
+ * MenuManager
+ */
+ private void createMenuEntry(Category c,
+ List<IContributionItem> contributionItems, MenuManager mm) {
+
+ // check if there is a ToplevelCategory
+ if (c.getParentCatID() == null || c.getParentCatID().length() == 0) {
+ contributionItems.add(createSubMenuEntry(c));
+ } else {
+ for (Map.Entry<String, Category> e : ExtensionRegistry.getCategory()
+ .entrySet()) {
+ Category cat = (Category) e.getValue();
+ if (cat.getID().equals(c.getParentCatID())) {
+ MenuManager mgr = new MenuManager(cat.getName());
+ mgr.add(createSubMenuEntry(c));
+ contributionItems.add(mgr);
+ contributionItems.add(new Separator());
+ }
+
+ }
+ }
+
+ }
+
+ /**
+ *
+ * creates the ContributionItem which represents the Analyze in the contextMenu
+ *
+ * @param c
+ * current Category
+ * @return mgr MenuManager
+ */
+ private MenuManager createSubMenuEntry(Category c) {
+ // Set the Command and the Command Parameters
+ String command = "org.eclipse.jubula.client.analyze.ui.RunSelection"; //$NON-NLS-1$
+ String idParam = "org.eclipse.jubula.client.analyze.ui.RunSelection.IDParam"; //$NON-NLS-1$
+
+ MenuManager mgr = new MenuManager(c.getName());
+ for (Map.Entry<String, Analyze> f : ExtensionRegistry.getAnalyze()
+ .entrySet()) {
+
+ Analyze analyze = f.getValue();
+
+ if (analyze.getCategoryID().equals(c.getID())
+ && ContextHelper.isEnabledProject(analyze)) {
+
+ // shown label
+ m_label = analyze.getName();
+ // current ID
+ m_currentID = analyze.getID();
+
+ Map<String, String> params = new HashMap<String, String>();
+
+ params.put(idParam, m_currentID);
+ IContributionItem item = CommandHelper.createContributionItem(
+ command, params, m_label,
+ CommandContributionItem.STYLE_PUSH);
+ mgr.add(item);
+ }
+ }
+ return mgr;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/RunSelectionHandler.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/RunSelectionHandler.java
new file mode 100644
index 000000000..d9d701a4a
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/RunSelectionHandler.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.handlers;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jubula.client.analyze.ExtensionRegistry;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeParameter;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeRun;
+import org.eclipse.jubula.client.analyze.ui.components.AnalyzePreferenceDialog;
+import org.eclipse.jubula.client.analyze.ui.internal.Query;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class RunSelectionHandler extends AbstractHandler {
+ /**
+ * Parameter given from the Command
+ */
+ private String m_idParam;
+
+ /**
+ * @param event
+ * event
+ * @return null
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ m_idParam = event.getParameter("org.eclipse.jubula.client.analyze.ui.RunSelection.IDParam"); //$NON-NLS-1$
+
+ Analyze ana = ExtensionRegistry.getAnalyze().get(m_idParam);
+
+ // This List is used to save the AnalyzeParameters
+
+ ArrayList<AnalyzeParameter> parameterList =
+ (ArrayList<AnalyzeParameter>) ana.getAnalyzeParameter();
+
+ // create a new AnalyzePreferenceDialog
+ AnalyzePreferenceDialog apd = new AnalyzePreferenceDialog(Display
+ .getDefault().getActiveShell(), parameterList);
+
+ if (!apd.getCancelStatus()) {
+
+ // fill the ArrayList with the Analyzes that are going to be
+ // executed
+ // and create the AnalyzeRun
+
+ ArrayList<Analyze> analyzeList = new ArrayList<Analyze>();
+ analyzeList.add(ana);
+ AnalyzeRun ar = new AnalyzeRun();
+ ar.createAnalyzeRun(analyzeList);
+
+ // create an run a new Query
+ runQuery(ar, event);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param run
+ * The given AnalyzeRun
+ * @param event
+ * The given Event
+ */
+ public void runQuery(AnalyzeRun run, ExecutionEvent event) {
+ Query query = new Query(run);
+
+ NewSearchUI.runQueryInForeground(
+ PlatformUI.getWorkbench().getProgressService(), query);
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/ToolbarButtonDefaultHandler.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/ToolbarButtonDefaultHandler.java
new file mode 100644
index 000000000..8f10b464d
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/handlers/ToolbarButtonDefaultHandler.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+
+/**
+ * The DefaultHandler for the AnalyzeToolbarButton. Currently it returns null
+ * because it has no real function
+ *
+ * @author volker
+ *
+ */
+public class ToolbarButtonDefaultHandler extends AbstractHandler {
+
+ /**
+ * @param event The given event
+ * @return null
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ return null;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/Messages.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/Messages.java
new file mode 100644
index 000000000..551cb8bd2
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/Messages.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.jubula.client.analyze.ui.i18n;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * i18n string internationalization
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jubula.client.analyze.ui.i18n.messages"; //$NON-NLS-1$
+
+ public static String CreateProfilContributionItem;
+ public static String RunningAnalyzes;
+ public static String NodeType;
+ public static String Amount;
+ public static String Running;
+ public static String AnalyzePreferenceDialog;
+ public static String AnalyzePreferenceDialogParameters;
+ public static String AnalyzePreferenceDialogAdjustNote;
+ public static String AnalyzePreferenceDialogName;
+ public static String AnalyzePreferenceDialogDefaultValue;
+ public static String AnalyzePreferenceDialogSeparator;
+ public static String AnalyzePreferenceDialogNoParameters;
+ public static String OKButton;
+ public static String DefaultsButton;
+ public static String Testsuite;
+ public static String Testcase;
+ public static String Category;
+ public static String ReferencedTestCase;
+ public static String ReferencedTestSuite;
+ public static String TestJob;
+ public static String TestStep;
+ public static String Project;
+ public static String ComponentName;
+
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /**
+ * Constructor
+ */
+ private Messages() {
+ // hide
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/messages.properties b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/messages.properties
new file mode 100644
index 000000000..bc9c8b8f0
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/i18n/messages.properties
@@ -0,0 +1,23 @@
+RunningAnalyzes=Running analysis
+CreateProfilContributionItem=Create a profile ...
+NodeType=Elements
+Amount=Amount
+Running=Running:
+AnalyzePreferenceDialog=Analyze Preference Dialog
+AnalyzePreferenceDialogParameters=Parameters
+AnalyzePreferenceDialogAdjustNote=Please adjust the values or use the default ones.
+AnalyzePreferenceDialogName=Name
+AnalyzePreferenceDialogSeparator=
+AnalyzePreferenceDialogDefaultValue=Default value
+AnalyzePreferenceDialogNoParameters=Sorry, there aren't any parameters available.
+OKButton=OK
+DefaultsButton=Restore defaults
+Testsuite=Test Suites
+Testcase=User-defined Test Cases
+Category=Categories
+ReferencedTestCase=Referenced Test Cases
+ReferencedTestSuite=Referenced Test Suites
+TestJob=Test Jobs
+TestStep=Test Steps
+Project=Projects
+ComponentName=Component Names \ No newline at end of file
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/Query.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/Query.java
new file mode 100644
index 000000000..74e3ff444
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/Query.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jubula.client.analyze.definition.IAnalyze;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeRun;
+import org.eclipse.jubula.client.analyze.ui.i18n.Messages;
+import org.eclipse.jubula.client.analyze.ui.internal.helper.ContextHelper;
+import org.eclipse.jubula.client.ui.rcp.search.query.AbstractSearchQuery;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.search.ui.ISearchResult;
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class Query extends AbstractSearchQuery implements ISearchQuery {
+
+ /** The QueryResult */
+ private QueryResult m_queryResult;
+
+ /** The AnalyzeRun*/
+ private AnalyzeRun m_analyzeRun;
+
+ /**
+ * @param analyzeRun The Analyze
+ */
+ public Query(AnalyzeRun analyzeRun) {
+ setAnalyzeRun(analyzeRun);
+ }
+
+ /**
+ * @param queryResult the queryResult to set
+ */
+ protected void setQueryResult(QueryResult queryResult) {
+ m_queryResult = queryResult;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public IStatus run(IProgressMonitor monitor)
+ throws OperationCanceledException {
+
+ try {
+ calculate(monitor);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
+ }
+ /**
+ * executes the given AnalyseRun, creates and sets a QueryResult
+ * @param monitor monitor
+ * @throws InterruptedException
+ */
+ public void calculate(IProgressMonitor monitor)
+ throws InterruptedException {
+
+ Object node = ContextHelper.getSelection();
+ // New QueryResult
+ QueryResult qr = new QueryResult(this);
+
+ // set the workAmount which is used from the ProgressMonitor
+ int workAmount = this.getAnalyzeRun().getAnalyzeRunList().size();
+
+ monitor.beginTask(Messages.RunningAnalyzes, workAmount);
+
+ ArrayList<Analyze> anaList = new ArrayList<Analyze>(this
+ .getAnalyzeRun().getAnalyzeRunList());
+
+ for (int i = 0; i < anaList.size(); i++) {
+
+ IAnalyze executableExtension = (IAnalyze) anaList.get(i)
+ .getExecutableExtension();
+ monitor.subTask(Messages.Running + anaList.get(i).getName());
+
+ AnalyzeResult res = executableExtension.execute(node,
+ new SubProgressMonitor(monitor, 1), anaList.get(i)
+ .getResultType(), anaList.get(i)
+ .getAnalyzeParameter(), anaList.get(i).getName());
+ qr.getResultMap().put(anaList.get(i), res);
+ }
+ // Set the Query Result
+ setQueryResult(qr);
+ monitor.done();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLabel() {
+ if (getAnalyzeRun().getAnalyzeRunList().size() == 1) {
+ // Add the actual TimeStamp to the AnalyzeName
+ return getTimestamp() + ": "
+ + getAnalyzeRun().getAnalyzeRunList().get(0).getName();
+ }
+ return "";
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canRerun() {
+ return true;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canRunInBackground() {
+ return false;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public ISearchResult getSearchResult() {
+
+ return m_queryResult;
+ }
+ /**
+ *
+ * @return The AnalyzeRun
+ */
+ public AnalyzeRun getAnalyzeRun() {
+ return m_analyzeRun;
+ }
+ /**
+ *
+ * @param analyzeRun The AnalyzeRun
+ */
+ public void setAnalyzeRun(AnalyzeRun analyzeRun) {
+ this.m_analyzeRun = analyzeRun;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/QueryResult.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/QueryResult.java
new file mode 100644
index 000000000..cccbc436e
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/QueryResult.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.search.ui.ISearchResult;
+import org.eclipse.search.ui.ISearchResultListener;
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class QueryResult implements ISearchResult {
+
+ /**
+ * contains the Analyzes and its AnalyzeResults
+ */
+ private Map<Analyze, AnalyzeResult> m_result =
+ new HashMap<Analyze, AnalyzeResult>();
+
+ /** The Query */
+ private final Query m_query;
+
+ /**
+ * @param query the query
+ */
+ public QueryResult(Query query) {
+ this.m_query = query;
+ }
+
+ /** {@inheritDoc} */
+ public void addListener(ISearchResultListener l) {
+
+ }
+
+ /** {@inheritDoc} */
+ public void removeListener(ISearchResultListener l) {
+
+ }
+
+ /** {@inheritDoc} */
+ public String getLabel() {
+ return getQuery().getLabel();
+ }
+
+ /** {@inheritDoc} */
+ public String getTooltip() {
+ return getQuery().getLabel();
+ }
+
+ /** {@inheritDoc} */
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ public ISearchQuery getQuery() {
+ return m_query;
+ }
+ /**
+ * @return The QueryResult Map
+ */
+ public Map<Analyze, AnalyzeResult> getResultMap() {
+ return m_result;
+ }
+
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/ResultPage.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/ResultPage.java
new file mode 100644
index 000000000..5312f453d
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/ResultPage.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jubula.client.analyze.ui.internal.listener.AnalyzeTreeViewerDoubleClickListener;
+import org.eclipse.jubula.client.analyze.ui.internal.provider.QueryTreeContentProvider;
+import org.eclipse.jubula.client.analyze.ui.internal.provider.QueryTreeLabelProvider;
+import org.eclipse.search.ui.ISearchResult;
+import org.eclipse.search.ui.ISearchResultPage;
+import org.eclipse.search.ui.ISearchResultViewPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.part.Page;
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class ResultPage extends Page implements
+ ISearchResultPage {
+
+ /** The Control of the Page */
+ private Control m_control;
+
+ /** the ID */
+ private String m_id;
+
+ /** The queryResult */
+ private QueryResult m_queryResult;
+
+ /** The ListViewer of this class */
+ private TreeViewer m_tvl;
+
+ /** The Stack-Layout Composite with the sash */
+ private Composite m_stackComp;
+
+ /** The DoubleClickListener */
+ private AnalyzeTreeViewerDoubleClickListener m_listener;
+
+ /**
+ * @return m_lvr the TreeViewer of the ResultPage
+ */
+ public TreeViewer getLeftTreeViewer() {
+ return m_tvl;
+ }
+
+ /**
+ * @return Composite with the Stack-Layout Composite of this Page
+ */
+ public Composite getStackComposite() {
+ return m_stackComp;
+ }
+
+ /**
+ * @return The Click Listener of the Tree
+ */
+ public AnalyzeTreeViewerDoubleClickListener getListener() {
+ return m_listener;
+ }
+
+ /**
+ * @param listener The Listener that is to be set
+ */
+ public void setListener(AnalyzeTreeViewerDoubleClickListener listener) {
+ this.m_listener = listener;
+ }
+
+ /**
+ * @param comp
+ * The Composite with the Stack-Layout Composite of this Page
+ */
+ public void setStackComposite(Composite comp) {
+ this.m_stackComp = comp;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public void createControl(Composite parent) {
+ // create a new SashForm
+ SashForm sash = new SashForm(parent, SWT.HORIZONTAL);
+
+ // create a new TreeViewer
+ m_tvl = new TreeViewer(sash);
+ m_tvl.setContentProvider(new QueryTreeContentProvider());
+ m_tvl.setLabelProvider(new QueryTreeLabelProvider());
+
+ StackLayout stack = new StackLayout();
+
+
+ Composite cmp = new Composite(sash, SWT.NONE);
+ // use a StackLayout to enable to change the content of this Composite
+ cmp.setLayout(stack);
+ setStackComposite(cmp);
+ m_listener = new AnalyzeTreeViewerDoubleClickListener(cmp);
+ m_tvl.addDoubleClickListener(m_listener);
+ sash.setWeights(new int[] { 40, 60 });
+ // set the Control
+ setControl(sash);
+ }
+
+ /** {@inheritDoc} */
+ public void dispose() {
+ }
+ /**
+ * @param control
+ * the control to set
+ */
+ private void setControl(Control control) {
+ m_control = control;
+ }
+ /** {@inheritDoc} */
+ public Control getControl() {
+ return m_control;
+ }
+ /** {@inheritDoc} */
+ public void setFocus() {
+ this.getControl().setFocus();
+ }
+
+ /** {@inheritDoc} */
+ public Object getUIState() {
+ return null;
+ }
+ /** {@inheritDoc} */
+ public void setInput(ISearchResult search, Object uiState) {
+ m_queryResult = (QueryResult) search;
+
+ TreeViewer tv = new TreeViewer(getStackComposite());
+ StackLayout l = (StackLayout) getStackComposite().getLayout();
+
+ l.topControl = tv.getControl();
+ getStackComposite().layout();
+
+ getLeftTreeViewer().setInput(search);
+ getLeftTreeViewer().expandAll();
+ }
+ /** {@inheritDoc} */
+ public void setViewPart(ISearchResultViewPart part) {
+ }
+ /** {@inheritDoc} */
+ public void restoreState(IMemento memento) {
+ }
+ /** {@inheritDoc} */
+ public void saveState(IMemento memento) {
+ }
+ /** {@inheritDoc} */
+ public void setID(String id) {
+ m_id = id;
+ }
+
+ /** {@inheritDoc} */
+ public String getID() {
+ return m_id;
+ }
+ /** {@inheritDoc} */
+ public String getLabel() {
+ return "";
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/definition/IResultRendererUI.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/definition/IResultRendererUI.java
new file mode 100644
index 000000000..40eef238c
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/definition/IResultRendererUI.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.definition;
+
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ *
+ * @author volker
+ *
+ */
+public interface IResultRendererUI {
+ /**
+ * @param result The given AnalyzeResult
+ * @param composite The given Composite
+ */
+ void renderResult(AnalyzeResult result, Composite composite);
+
+ /**
+ * @return The TopControl of this Renderer. Can be null if there is no TopControl
+ */
+ Control getTopControl();
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/AnalyzeTreeViewerInputHelper.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/AnalyzeTreeViewerInputHelper.java
new file mode 100644
index 000000000..ad9210206
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/AnalyzeTreeViewerInputHelper.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.helper;
+
+import java.util.HashSet;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jubula.client.analyze.ExtensionRegistry;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.jubula.client.analyze.internal.Category;
+import org.eclipse.jubula.client.analyze.ui.internal.QueryResult;
+
+
+/**
+ * Handles the conversion of a given QueryResult, which is going to be used as a
+ * TreeInput
+ *
+ * @author volker
+ *
+ */
+public class AnalyzeTreeViewerInputHelper {
+
+ /** Empty because of HelperClass */
+ private AnalyzeTreeViewerInputHelper() {
+ }
+ /**
+ * This method is used to transform a given QueryResult to an Array
+ * which can be used as TreeInput
+ *
+ * @param object The given Object (a QueryResult)
+ * @return returns an Array of the ToplevelCategories
+ */
+ public static Object[] getTreeInput(Object object) {
+
+ QueryResult qr = (QueryResult) object;
+
+ HashSet<Category> categorySet = new HashSet<Category>();
+
+ for (Map.Entry<Analyze, AnalyzeResult> a : qr.getResultMap()
+ .entrySet()) {
+
+ Category c = ExtensionRegistry.getCategory().get(
+ a.getKey().getCategoryID());
+ // add the parent category of this category to the categorySet
+ categorySet.add(getRoot(c));
+ }
+ return categorySet.toArray();
+ }
+
+ /**
+ * This method returns the root Category of the given Category by calling
+ * itself recursively until the rootnode ist reached
+ *
+ * @param category
+ * The given Category
+ * @return Parent the parentObject
+ */
+ public static Category getRoot(Category category) {
+
+ Category parent = category;
+ if (!StringUtils.isEmpty(category.getParentCatID())) {
+
+ for (Map.Entry<String, Category> entry : ExtensionRegistry
+ .getCategory().entrySet()) {
+
+ if (category.getParentCatID().equals(entry.getKey())) {
+ parent = entry.getValue();
+
+ getRoot(parent);
+ }
+ }
+ }
+
+ return parent;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/ContextHelper.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/ContextHelper.java
new file mode 100644
index 000000000..5d96d1299
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/helper/ContextHelper.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.helper;
+
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jubula.client.analyze.ExtensionRegistry;
+import org.eclipse.jubula.client.analyze.definition.IContext;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.Context;
+import org.eclipse.jubula.client.core.model.IExecObjContPO;
+import org.eclipse.jubula.client.core.model.ISpecObjContPO;
+import org.eclipse.jubula.client.core.persistence.GeneralStorage;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class ContextHelper {
+
+ /** The Selection from the UI */
+ private static Object selection;
+
+ /** Empty because of HelperClass */
+ private ContextHelper() {
+ }
+
+ /**
+ * checks the the isActive state the the Analyzes' Context.
+ * @param analyze
+ * The Given Analyze
+ * @return true if the ContributionItem is enabled, false if it is disabled
+ * caused by a not matching Context
+ */
+ public static boolean isEnabled(Analyze analyze) {
+
+ String[] contextData = contextDataToArray(analyze.getContextType());
+
+ for (Map.Entry<String, Context> c : ExtensionRegistry.getContexts()
+ .entrySet()) {
+ Context context = c.getValue();
+
+ for (int i = 0; i < contextData.length; i++) {
+
+ // check if the Element is the Context of the given Analyze
+ if (contextData[i].equals(context.getID())) {
+
+ IContext iCon = (IContext) context.getContextInstance();
+
+ ISelectionService serv = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getSelectionService();
+ ISelection sel = serv.getSelection();
+
+ if (sel instanceof IStructuredSelection) {
+
+ IStructuredSelection structuredSel =
+ (IStructuredSelection) sel;
+
+ // if the Selection is an instance of IExecObjCont or ISpecObjCont
+ // it is handled as a project because IExecObjCont and ISpecObjCont
+ // Objects cannot be traversed by the TreeTraverser
+ if (structuredSel.getFirstElement()
+ instanceof IExecObjContPO
+ || structuredSel.getFirstElement()
+ instanceof ISpecObjContPO) {
+
+ setSelection(GeneralStorage.
+ getInstance().getProject());
+ } else {
+
+ setSelection(structuredSel.getFirstElement());
+ }
+ if (iCon.isActive(getSelection())) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * checks the the isActive state the the Analyzes' Context.
+ * @param analyze
+ * The Given Analyze
+ * @return true if the ContributionItem is enabled, false if it is disabled
+ * caused by a not matching Context
+ */
+ public static boolean isEnabledProject(Analyze analyze) {
+
+ String[] contextData = contextDataToArray(analyze.getContextType());
+
+ for (Map.Entry<String, Context> c : ExtensionRegistry.getContexts()
+ .entrySet()) {
+ Context context = c.getValue();
+ IContext iCon = (IContext) context.getContextInstance();
+
+ for (int i = 0; i < contextData.length; i++) {
+
+ // check if the Context of the given Analyze is "projectLoaded"
+ if (contextData[i].equals("projectloaded")
+ && context.getID().equals("projectloaded")) {
+
+ if (GeneralStorage.getInstance().getProject() != null) {
+
+ setSelection(GeneralStorage.getInstance().getProject());
+ if (iCon.isActive(getSelection())) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns an Array of single ContextStrings from the given Analyzes
+ * ContextStrings
+ *
+ * @param context
+ * The given ContextString
+ * @return The ContextArray
+ */
+ public static String[] contextDataToArray(String context) {
+
+ final String pattern = ",";
+
+ Pattern p = Pattern.compile(pattern);
+ String[] contextData = p.split(context, 0);
+ for (int i = 0; i < contextData.length; i++) {
+ contextData[i] = contextData[i].trim().toLowerCase();
+ }
+ return contextData;
+ }
+
+ /**
+ * @return The Selection
+ */
+ public static Object getSelection() {
+ return selection;
+ }
+
+ /**
+ * @param sel
+ * The Selection
+ */
+ public static void setSelection(Object sel) {
+ ContextHelper.selection = sel;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/listener/AnalyzeTreeViewerDoubleClickListener.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/listener/AnalyzeTreeViewerDoubleClickListener.java
new file mode 100644
index 000000000..43edad856
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/listener/AnalyzeTreeViewerDoubleClickListener.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.listener;
+
+import java.util.Map;
+
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.jubula.client.analyze.internal.Renderer;
+import org.eclipse.jubula.client.analyze.internal.helper.RendererSelectionHelper;
+import org.eclipse.jubula.client.analyze.ui.internal.QueryResult;
+import org.eclipse.jubula.client.analyze.ui.internal.definition.IResultRendererUI;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * Handles the DoubleClickBehavior of the Tree in the AnalyzeSearchResultView
+ * @author volker
+ *
+ */
+public class AnalyzeTreeViewerDoubleClickListener implements
+ IDoubleClickListener {
+
+ /** The ResultType */
+ private String m_resultType;
+
+ /** The chosen Renderer */
+ private IResultRendererUI m_chosenRenderer;
+
+ /** The Composite */
+ private final Composite m_comp;
+
+ /**
+ * The AnalyzeTreeViewerDoubleClickListener
+ * @param composite The given Composite
+ */
+ public AnalyzeTreeViewerDoubleClickListener(Composite composite) {
+ this.m_comp = composite;
+ }
+
+ /** @return The chosen Renderer */
+ public IResultRendererUI getChosenRenderer() {
+ return m_chosenRenderer;
+ }
+
+ /** @param renderer The Renderer that is to be set as the chosen Renderer for this Analyze */
+ public void setChosenRenderer (IResultRendererUI renderer) {
+ this.m_chosenRenderer = renderer;
+ }
+
+ /**
+ * @return The ResultType
+ */
+ public String getResultType() {
+ return m_resultType;
+ }
+
+ /**
+ * handles the behavior after a doubleClick on an Analyze in the AnalyzeTree
+ * @param event The given Event
+ */
+ public void doubleClick(DoubleClickEvent event) {
+ // get the QueryResult from the Viewer
+ QueryResult qr = (QueryResult) event.getViewer().getInput();
+ TreeSelection selection = (TreeSelection) event.getSelection();
+ // check if the selected element is an Analyze.
+ Object firstElement = selection.getFirstElement();
+ if (firstElement instanceof Analyze) {
+ Analyze analyze = (Analyze) firstElement;
+ AnalyzeResult result = null;
+
+ for (Map.Entry<Analyze, AnalyzeResult> a : qr
+ .getResultMap().entrySet()) {
+ if (analyze.getID().equals(a.getKey().getID())) {
+ result = a.getValue();
+ }
+ }
+
+ Renderer ren = RendererSelectionHelper.getActiveRenderer(analyze);
+ IResultRendererUI rendererUI = (IResultRendererUI) ren
+ .getRendererInstance();
+ setChosenRenderer(rendererUI);
+ rendererUI.renderResult(result, m_comp);
+
+ if (m_comp.getLayout() instanceof StackLayout) {
+ StackLayout sl = (StackLayout) m_comp.getLayout();
+ sl.topControl = rendererUI.getTopControl();
+ m_comp.layout();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListContentProvider.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListContentProvider.java
new file mode 100644
index 000000000..20de5fe7e
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListContentProvider.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.provider;
+
+import java.util.Map;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.jubula.client.analyze.ui.internal.QueryResult;
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class QueryAnalyzeResultListContentProvider implements
+ IStructuredContentProvider {
+ /**
+ * The QueryResult Member
+ */
+ private QueryResult m_qr;
+
+/**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ }
+
+/**
+ * {@inheritDoc}
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ this.m_qr = (QueryResult) newInput;
+ }
+
+/**
+ * {@inheritDoc}
+ */
+ public Object[] getElements(Object inputElement) {
+
+ int counter = 0;
+ // contains the String ResultValues
+ Object[] value = new Object[m_qr.getResultMap().size()];
+
+
+ for (Map.Entry<Analyze, AnalyzeResult> e : m_qr.getResultMap()
+ .entrySet()) {
+ // put the ResultValues in an Array
+ value[counter] = (Object) e.getValue().getResult();
+ counter++;
+ }
+
+ return value;
+ }
+
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListLabelProvider.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListLabelProvider.java
new file mode 100644
index 000000000..4d6639e44
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryAnalyzeResultListLabelProvider.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.provider;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+/**
+ *
+ * @author volker
+ *
+ */
+public class QueryAnalyzeResultListLabelProvider extends LabelProvider {
+ /**
+ * @param element element
+ * @return null
+ */
+ public Image getImage(Object element) {
+ return null;
+ }
+ /**
+ * @param element element
+ * @return The Texts
+ */
+ public String getText(Object element) {
+ return element.toString();
+
+ }
+
+
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeContentProvider.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeContentProvider.java
new file mode 100644
index 000000000..0c00d0eef
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeContentProvider.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.provider;
+
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jubula.client.analyze.ExtensionRegistry;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.jubula.client.analyze.internal.Category;
+import org.eclipse.jubula.client.analyze.ui.internal.QueryResult;
+import org.eclipse.jubula.client.analyze.ui.internal.helper.AnalyzeTreeViewerInputHelper;
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class QueryTreeContentProvider implements ITreeContentProvider {
+
+ /**
+ *
+ */
+ private QueryResult m_qr;
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getElements(Object inputElement) {
+ this.m_qr = (QueryResult) inputElement;
+
+ return AnalyzeTreeViewerInputHelper.getTreeInput(m_qr);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getChildren(Object parentElement) {
+
+ // contains the given category or categories by parentElement
+ Category[] category;
+
+ // check if parentElement is instance of Category. If it is not element of
+ // Category it can only be an Category[]
+ if (!(parentElement instanceof Category)) {
+
+ Object[] parent = (Object[]) parentElement;
+ category = new Category[parent.length];
+
+ for (int i = 0; i < parent.length; i++) {
+ category[i] = (Category) parent[i];
+ }
+ } else {
+ category = new Category[1];
+ category[0] = (Category) parentElement;
+ }
+ // contains the ChildCategories
+ HashSet<Category> childCat = new HashSet<Category>();
+ // contains the Analyzes that were executed by the query
+ Analyze[] anaArray = new Analyze[m_qr.getResultMap().size()];
+ // run over the category array
+ for (int i = 0; i < category.length; i++) {
+ // get the registered categories from the ExtensionRegistry and that Category in
+ // the childCat Set, that is a child of the given Category
+ for (Map.Entry<String, Category> c : ExtensionRegistry.getCategory()
+ .entrySet()) {
+ Category ca = c.getValue();
+ if (ca.getParentCatID() != null
+ && ca.getParentCatID().equals(category[i].getID())) {
+ childCat.add(ca);
+ }
+ }
+ // if there are no ChildCategories get the Analyzes of the parentElement Category
+ if (childCat.size() == 0) {
+
+ int counter = 0;
+ for (Map.Entry<Analyze, AnalyzeResult> ana : m_qr.getResultMap()
+ .entrySet()) {
+ // check if the given category is the parent category of this analyze
+ // an put the analyze in the analyze array if its true
+ if (ana.getKey().getCategoryID()
+ .equals(category[i].getID())) {
+ anaArray[counter] = ana.getKey();
+ counter++;
+ }
+ }
+ }
+ }
+ if (childCat.size() != 0) {
+ return childCat.toArray();
+ } else {
+ return anaArray;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getParent(Object element) {
+ Category parentCategory = null;
+ if (element instanceof Analyze) {
+ Analyze analyze = (Analyze) element;
+ for (Map.Entry<String, Category> c : ExtensionRegistry
+ .getCategory().entrySet()) {
+ if (c.getKey().equals(analyze.getCategoryID())) {
+ parentCategory = c.getValue();
+ }
+ }
+ } else {
+ Category cat = (Category) element;
+ for (Map.Entry<String, Category> c : ExtensionRegistry
+ .getCategory().entrySet()) {
+ if (c.getKey().equals(cat.getParentCatID())) {
+ parentCategory = c.getValue();
+ }
+ }
+
+ }
+ return parentCategory;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof Category;
+ }
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeLabelProvider.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeLabelProvider.java
new file mode 100644
index 000000000..7396ebabf
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/internal/provider/QueryTreeLabelProvider.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.internal.provider;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jubula.client.analyze.internal.Analyze;
+import org.eclipse.jubula.client.analyze.internal.Category;
+
+/**
+ *
+ * @author volker
+ *
+ */
+public class QueryTreeLabelProvider extends LabelProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText(Object element) {
+ if (element instanceof Category) {
+ Category category = (Category) element;
+ return category.getName();
+ }
+ return ((Analyze) element).getName();
+
+ }
+
+}
diff --git a/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/renderer/TableRenderer.java b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/renderer/TableRenderer.java
new file mode 100644
index 000000000..2098dfaa4
--- /dev/null
+++ b/org.eclipse.jubula.client.analyze.ui/src/org/eclipse/jubula/client/analyze/ui/renderer/TableRenderer.java
@@ -0,0 +1,334 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2012 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.analyze.ui.renderer;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jubula.client.analyze.internal.AnalyzeResult;
+import org.eclipse.jubula.client.analyze.ui.i18n.Messages;
+import org.eclipse.jubula.client.analyze.ui.internal.definition.IResultRendererUI;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+
+
+/**
+ * @author volker
+ */
+public class TableRenderer implements IResultRendererUI {
+ /**
+ *
+ */
+ private AnalyzeResult m_analyzeResult;
+
+ /** The TopLevelControl of this Renderer */
+ private Control m_topControl;
+
+ /**
+ * The TableRenderer is able to display the AnalyzeResult as a Table
+ */
+ public TableRenderer() {
+ }
+
+ /** @return The TopControl of this Renderer */
+ public Control getTopControl() {
+ return m_topControl;
+ }
+
+ /**
+ * @param control
+ * The Control that is to be set as TopControl of this Renderer
+ */
+ public void setTopControl(Control control) {
+ this.m_topControl = control;
+ }
+
+ /**
+ * @param res
+ * The given AnalyzeResult
+ * @param composite
+ * The given Composite
+ */
+ public void renderResult(AnalyzeResult res, Composite composite) {
+ m_analyzeResult = res;
+
+ if (m_analyzeResult.getResult() instanceof Map) {
+ Map<String, String> resultMap = (Map<String, String>)
+ m_analyzeResult.getResult();
+ ArrayList<TableResult> resultList = new ArrayList<TableResult>();
+
+ for (Map.Entry<String, String> e : resultMap.entrySet()) {
+
+ TableResult tr = new TableResult();
+
+ if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.TestSuitePO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.Testsuite);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.CategoryPO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.Category);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.CapPO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.TestStep);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.ExecTestCasePO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.ReferencedTestCase);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.ProjectPO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.Project);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.SpecTestCasePO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.Testcase);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.TestJobPO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.TestJob);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.RefTestSuitePO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.ReferencedTestSuite);
+ } else if (String.valueOf(e.getKey()).equals(
+ "class org.eclipse.jubula.client.core.model.ComponentNamePO")) { //$NON-NLS-1$
+ tr.setCol1(Messages.ComponentName);
+ }
+ tr.setCol2(String.valueOf(e.getValue()));
+ resultList.add(tr);
+ }
+ createViewer(composite, resultList);
+ }
+ }
+
+ /**
+ * creates the TableViewer
+ *
+ * @param parent
+ * The parent Composite
+ * @param resultList
+ * The Given resultList
+ */
+ private void createViewer(Composite parent, List<TableResult> resultList) {
+ TableViewer tv = new TableViewer(parent);
+ createColumns(parent, tv);
+
+ Table table = tv.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ tv.setContentProvider(new ArrayContentProvider());
+ // set the Sorter
+
+ tv.setSorter(new TableResultSorter());
+
+ tv.setInput(resultList);
+ // set the crontrol of the TreeViewer as the TopControl of this Renderer
+ setTopControl(tv.getControl());
+ }
+
+ /**
+ *
+ * @param cmp
+ * the parent composite
+ * @param viewer
+ * The TableViewer
+ */
+ private void createColumns(Composite cmp, TableViewer viewer) {
+ String[] titles = { Messages.NodeType, Messages.Amount };
+ int[] colType = { 0, 1 };
+
+ // set the bounds of the table to the aspect ratio 1/3 and 2/3
+ int c1 = (((cmp.getBounds().width) / 3) * 2);
+ int c2 = ((cmp.getBounds().width) / 3);
+ int[] bounds = { c1, c2 };
+ // First column
+ TableViewerColumn col = createTabelViewerColumn(titles[0], bounds[0],
+ viewer, colType[0]);
+ col.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ TableResult tr = (TableResult) element;
+ return tr.getCol1();
+ }
+ });
+ // Second column
+ col = createTabelViewerColumn(titles[1], bounds[1], viewer, colType[1]);
+ col.setLabelProvider(new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+
+ TableResult tr = (TableResult) element;
+ return tr.getCol2();
+ }
+ });
+ }
+
+ /**
+ * @param title
+ * The columnTitle
+ * @param bounds
+ * The bounds of the Column
+ * @param viewer
+ * The parent Viewer
+ * @param colType
+ * The columnType
+ * @return The TableViewerColumn
+ */
+ private TableViewerColumn createTabelViewerColumn(String title, int bounds,
+ TableViewer viewer, int colType) {
+
+ final TableViewerColumn viewerColumn = new TableViewerColumn(viewer,
+ SWT.NONE);
+
+ final int c = colType;
+
+ final TableColumn column = viewerColumn.getColumn();
+ final TableViewer tv = viewer;
+
+ column.setText(title);
+ column.setWidth(bounds);
+ column.setResizable(true);
+ column.setMoveable(true);
+ column.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ ((TableResultSorter) tv.getSorter()).doSort(c);
+ tv.refresh();
+ }
+ });
+ return viewerColumn;
+ }
+
+ /**
+ * This class is used to sort the TableResults
+ *
+ * @author volker
+ */
+ class TableResultSorter extends ViewerSorter {
+ /** */
+ private static final int ASCENDING = 0;
+ /** */
+ private static final int DESCENDING = 1;
+ /** */
+ private int m_column;
+ /** */
+ private int m_direction;
+
+ /**
+ * checks if the direction ascending/descending
+ *
+ * @param column
+ * the column that has to be sorted
+ */
+ public void doSort(int column) {
+ if (column == this.m_column) {
+ m_direction = 1 - m_direction;
+ } else {
+ this.m_column = column;
+ m_direction = ASCENDING;
+ }
+ }
+
+ /** {@inheritDoc} */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int rc = 0;
+ TableResult tr1 = (TableResult) e1;
+ TableResult tr2 = (TableResult) e2;
+
+ // create a new Collator for the comparison
+ Collator col = Collator.getInstance();
+ switch (m_column) {
+ case 0:
+ rc = col.compare(tr1.getCol1(), tr2.getCol1());
+ break;
+ case 1:
+ if (new Integer(tr1.getCol2())
+ < (new Integer(tr2.getCol2()))) {
+ rc = -1;
+ } else if (new Integer(tr1.getCol2()) == (new Integer(
+ tr2.getCol2()))) {
+ rc = 0;
+ } else if (new Integer(tr1.getCol2()) > (new Integer(
+ tr2.getCol2()))) {
+ rc = 1;
+ }
+ break;
+ default:
+ break;
+ }
+ if (m_direction == DESCENDING) {
+ rc = -rc;
+ }
+ return rc;
+ }
+ }
+
+ /**
+ * This class is used to provide a Result, that could be used from
+ * TableRenderer with two columns
+ *
+ * @author volker
+ *
+ */
+ public class TableResult {
+ /**
+ * the value which will be shown in the first column
+ */
+ private String m_col1;
+ /**
+ * the value which will be shown in the second column
+ */
+ private String m_col2;
+
+ /**
+ * the value which will be shown in the first column
+ *
+ * @return the value which will be shown in the first column
+ */
+ public String getCol1() {
+ return m_col1;
+ }
+
+ /**
+ * the value which will be shown in the first column
+ *
+ * @param col1
+ * the value which will be shown in the first column
+ */
+ public void setCol1(String col1) {
+ this.m_col1 = col1;
+ }
+
+ /**
+ * @return the value which will be shown in the second column
+ */
+ public String getCol2() {
+ return m_col2;
+ }
+
+ /**
+ * @param col2
+ * the value which will be shown in the second column
+ */
+ public void setCol2(String col2) {
+ this.m_col2 = col2;
+ }
+ }
+}

Back to the top