Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2014-08-13 11:02:50 +0000
committerMarkus Tiede2014-08-13 11:02:50 +0000
commita9a171512b110b66fe69efff940e9fdf9e992813 (patch)
tree435b73a6adb44d900c442fae652e4d8468b87f87 /org.eclipse.jubula.client.wiki.ui
parent606f9c22e665affa2cf34deeef0b3f612d4e930a (diff)
downloadorg.eclipse.jubula.core-a9a171512b110b66fe69efff940e9fdf9e992813.tar.gz
org.eclipse.jubula.core-a9a171512b110b66fe69efff940e9fdf9e992813.tar.xz
org.eclipse.jubula.core-a9a171512b110b66fe69efff940e9fdf9e992813.zip
Sprint task - Wikitext description view: renamed + i18n support added.
Diffstat (limited to 'org.eclipse.jubula.client.wiki.ui')
-rw-r--r--org.eclipse.jubula.client.wiki.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jubula.client.wiki.ui/icons/descriptionView.pngbin0 -> 446 bytes
-rw-r--r--org.eclipse.jubula.client.wiki.ui/icons/sample.gifbin983 -> 0 bytes
-rw-r--r--org.eclipse.jubula.client.wiki.ui/plugin.xml8
-rw-r--r--org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/Messages.java30
-rw-r--r--org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/messages.properties8
-rw-r--r--org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DescriptionView.java92
-rw-r--r--org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DocumentationView.java54
8 files changed, 136 insertions, 58 deletions
diff --git a/org.eclipse.jubula.client.wiki.ui/META-INF/MANIFEST.MF b/org.eclipse.jubula.client.wiki.ui/META-INF/MANIFEST.MF
index d17b44ced..61f23f15f 100644
--- a/org.eclipse.jubula.client.wiki.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jubula.client.wiki.ui/META-INF/MANIFEST.MF
@@ -9,6 +9,8 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.editors;bundle-version="[3.2.0,4.0.0)",
+ org.apache.commons.lang;bundle-version="[2.4.0,3.0.0)",
+ org.eclipse.jubula.client.core;bundle-version="[2.4.0,2.5.0)",
org.eclipse.jubula.ui.compatibility;bundle-version="[2.4.0,2.5.0)",
org.eclipse.mylyn.wikitext.core;bundle-version="[1.7.0,2.0.0)",
org.eclipse.mylyn.wikitext.confluence.core;bundle-version="[1.7.0,2.0.0)",
diff --git a/org.eclipse.jubula.client.wiki.ui/icons/descriptionView.png b/org.eclipse.jubula.client.wiki.ui/icons/descriptionView.png
new file mode 100644
index 000000000..a8ab7f8ab
--- /dev/null
+++ b/org.eclipse.jubula.client.wiki.ui/icons/descriptionView.png
Binary files differ
diff --git a/org.eclipse.jubula.client.wiki.ui/icons/sample.gif b/org.eclipse.jubula.client.wiki.ui/icons/sample.gif
deleted file mode 100644
index 34fb3c9d8..000000000
--- a/org.eclipse.jubula.client.wiki.ui/icons/sample.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.jubula.client.wiki.ui/plugin.xml b/org.eclipse.jubula.client.wiki.ui/plugin.xml
index cf3e24963..f240beeca 100644
--- a/org.eclipse.jubula.client.wiki.ui/plugin.xml
+++ b/org.eclipse.jubula.client.wiki.ui/plugin.xml
@@ -12,10 +12,10 @@
point="org.eclipse.ui.views">
<view
category="org.eclipse.jubula.client.views"
- class="org.eclipse.jubula.client.wiki.ui.views.DocumentationView"
- icon="icons/sample.gif"
- id="org.eclipse.jubula.client.wiki.ui.views.DocumentationView"
- name="Documentation View">
+ class="org.eclipse.jubula.client.wiki.ui.views.DescriptionView"
+ icon="icons/descriptionView.png"
+ id="org.eclipse.jubula.client.wiki.ui.views.DescriptionView"
+ name="Description">
</view>
</extension>
diff --git a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/Messages.java b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/Messages.java
new file mode 100644
index 000000000..9caa8fbf3
--- /dev/null
+++ b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/Messages.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.wiki.ui.i18n;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * I18n class
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.jubula.client.wiki.ui.i18n.messages"; //$NON-NLS-1$
+
+ public static String NoDescriptionAvailable;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ /** private constructor */
+ private Messages() {
+ }
+}
diff --git a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/messages.properties b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/messages.properties
new file mode 100644
index 000000000..6c10816c7
--- /dev/null
+++ b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/i18n/messages.properties
@@ -0,0 +1,8 @@
+###############################################################################
+# Copyright (c) 2014 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
+##############################################################################
+NoDescriptionAvailable=No description available... \ No newline at end of file
diff --git a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DescriptionView.java b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DescriptionView.java
new file mode 100644
index 000000000..3da65248e
--- /dev/null
+++ b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DescriptionView.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.wiki.ui.views;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jubula.client.core.model.INodePO;
+import org.eclipse.jubula.client.wiki.ui.i18n.Messages;
+import org.eclipse.mylyn.wikitext.tracwiki.core.TracWikiLanguage;
+import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewer;
+import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewerConfiguration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @author BREDEX GmbH
+ */
+public class DescriptionView extends ViewPart {
+ /** the viewer to display the documentation */
+ private MarkupViewer m_viewer;
+
+ /** the m_listener we register with the selection service */
+ private ISelectionListener m_listener = new ISelectionListener() {
+ public void selectionChanged(IWorkbenchPart sourcepart,
+ ISelection selection) {
+ // we ignore our own selections
+ if (sourcepart != DescriptionView.this) {
+ showSelection(selection);
+ }
+ }
+
+ /**
+ * @param selection the selection to show
+ */
+ private void showSelection(ISelection selection) {
+ if (selection instanceof StructuredSelection) {
+ StructuredSelection structuredSelection =
+ (StructuredSelection) selection;
+ Object firstElement = structuredSelection.getFirstElement();
+ if (firstElement instanceof INodePO) {
+ INodePO node = (INodePO) firstElement;
+ final String comment = node.getComment();
+ if (StringUtils.isNotEmpty(comment)) {
+ m_viewer.setMarkup(comment);
+ return;
+ }
+ }
+ }
+ m_viewer.setMarkup(Messages.NoDescriptionAvailable);
+ }
+ };
+
+ /** {@inheritDoc} */
+ public void createPartControl(Composite parent) {
+ m_viewer = new MarkupViewer(parent, null, SWT.MULTI | SWT.WRAP
+ | SWT.V_SCROLL);
+ m_viewer.setMarkupLanguage(new TracWikiLanguage());
+
+ MarkupViewerConfiguration configuration =
+ new MarkupViewerConfiguration(m_viewer);
+ m_viewer.configure(configuration);
+
+ m_viewer.getTextWidget().setEditable(false);
+
+ getSite().getWorkbenchWindow().getSelectionService()
+ .addSelectionListener(m_listener);
+ }
+
+ /** {@inheritDoc} */
+ public void setFocus() {
+ m_viewer.getTextWidget().setFocus();
+ }
+
+ /** {@inheritDoc} */
+ public void dispose() {
+ getSite().getWorkbenchWindow().getSelectionService()
+ .removeSelectionListener(m_listener);
+ super.dispose();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DocumentationView.java b/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DocumentationView.java
deleted file mode 100644
index 14c917b39..000000000
--- a/org.eclipse.jubula.client.wiki.ui/src/org/eclipse/jubula/client/wiki/ui/views/DocumentationView.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 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.wiki.ui.views;
-
-import org.eclipse.mylyn.wikitext.tracwiki.core.TracWikiLanguage;
-import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewer;
-import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewerConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * @author BREDEX GmbH
- */
-public class DocumentationView extends ViewPart {
- /** the viewer to display the documentation */
- private MarkupViewer m_viewer;
-
- @Override
- public void createPartControl(Composite parent) {
- m_viewer = new MarkupViewer(parent, null, SWT.MULTI | SWT.WRAP
- | SWT.V_SCROLL);
- m_viewer.setMarkupLanguage(new TracWikiLanguage());
-
- MarkupViewerConfiguration configuration =
- new MarkupViewerConfiguration(m_viewer);
- m_viewer.configure(configuration);
-
- m_viewer.getTextWidget().setEditable(false);
- StringBuilder sb = new StringBuilder();
- sb.append("= H1 = \n"); //$NON-NLS-1$
- sb.append("= H2 = \n"); //$NON-NLS-1$
- sb.append("= H3 = \n"); //$NON-NLS-1$
- sb.append("= H4 = \n"); //$NON-NLS-1$
- sb.append(" * bullets list \n"); //$NON-NLS-1$
- sb.append(" * another bullet \n"); //$NON-NLS-1$
- sb.append("http://www.eclipse.org/jubula \n"); //$NON-NLS-1$
-
- m_viewer.setMarkup(sb.toString());
- }
-
- @Override
- public void setFocus() {
- m_viewer.getTextWidget().setFocus();
- }
-} \ No newline at end of file

Back to the top