summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Achmetow2012-07-27 15:36:31 (EDT)
committer Timur Achmetow2012-07-27 15:36:31 (EDT)
commitb4f5181df152d2d182697590bf89e4cd79d63a4e (patch)
tree5c2c551a726cc7d6dfce220c2c8d13f23820b058
parent26464efeaa73d4130a5f1280cb06982b91539a6d (diff)
downloadorg.eclipse.mylyn.tasks-b4f5181df152d2d182697590bf89e4cd79d63a4e.zip
org.eclipse.mylyn.tasks-b4f5181df152d2d182697590bf89e4cd79d63a4e.tar.gz
org.eclipse.mylyn.tasks-b4f5181df152d2d182697590bf89e4cd79d63a4e.tar.bz2
NEW - bug 378003: [activity] integrate a section with an empty treerefs/changes/10/6910/6
viewer in the Task Editor; the section is now integrated in the task editor and not in a new page https://bugs.eclipse.org/bugs/show_bug.cgi?id=378003 Change-Id: Ida40425be75ef23126abe91ff365c34ae1ab801e
-rw-r--r--org.eclipse.mylyn.tasks.activity.ui/META-INF/MANIFEST.MF7
-rw-r--r--org.eclipse.mylyn.tasks.activity.ui/build.properties3
-rw-r--r--org.eclipse.mylyn.tasks.activity.ui/plugin.xml13
-rw-r--r--org.eclipse.mylyn.tasks.activity.ui/src/.placeholder0
-rw-r--r--org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityPart.java63
-rw-r--r--org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityRecordContentProvider.java61
6 files changed, 144 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.activity.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.activity.ui/META-INF/MANIFEST.MF
index f91c73e..a2be901 100644
--- a/org.eclipse.mylyn.tasks.activity.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.activity.ui/META-INF/MANIFEST.MF
@@ -5,7 +5,10 @@ Bundle-SymbolicName: org.eclipse.mylyn.tasks.activity.ui;singleton:=true
Bundle-Version: 3.9.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.ui.forms,
+ org.eclipse.core.runtime,
org.eclipse.mylyn.tasks.core;bundle-version="3.8.0",
- org.eclipse.mylyn.tasks.ui;bundle-version="3.8.0"
+ org.eclipse.mylyn.tasks.ui;bundle-version="3.8.0",
+ org.eclipse.mylyn.tasks.activity.core;bundle-version="3.9.0"
Bundle-Localization: plugin
diff --git a/org.eclipse.mylyn.tasks.activity.ui/build.properties b/org.eclipse.mylyn.tasks.activity.ui/build.properties
index 72f0e4b..1759682 100644
--- a/org.eclipse.mylyn.tasks.activity.ui/build.properties
+++ b/org.eclipse.mylyn.tasks.activity.ui/build.properties
@@ -8,6 +8,7 @@
bin.includes = META-INF/,\
.,\
about.html,\
- plugin.properties
+ plugin.properties,\
+ plugin.xml
src.includes = about.html
source.. = src/
diff --git a/org.eclipse.mylyn.tasks.activity.ui/plugin.xml b/org.eclipse.mylyn.tasks.activity.ui/plugin.xml
new file mode 100644
index 0000000..abb2b18
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.ui/plugin.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.mylyn.tasks.ui.taskEditorPageContribution">
+ <repositoryPart
+ class="org.eclipse.mylyn.internal.tasks.activity.ui.ActivityPart"
+ id="org.eclipse.mylyn.tasks.activity.ui.viewer.ActivityPart"
+ path="associations">
+ </repositoryPart>
+ </extension>
+
+</plugin>
diff --git a/org.eclipse.mylyn.tasks.activity.ui/src/.placeholder b/org.eclipse.mylyn.tasks.activity.ui/src/.placeholder
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.mylyn.tasks.activity.ui/src/.placeholder
+++ /dev/null
diff --git a/org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityPart.java b/org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityPart.java
new file mode 100644
index 0000000..e04927a
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityPart.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Timur Achmetow and others.
+ * 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:
+ * Timur Achmetow - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.activity.ui;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.mylyn.internal.tasks.activity.core.ActivityManager;
+import org.eclipse.mylyn.tasks.activity.core.IActivityStream;
+import org.eclipse.mylyn.tasks.activity.core.TaskActivityScope;
+import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @author Timur Achmetow
+ */
+@SuppressWarnings("restriction")
+public class ActivityPart extends AbstractTaskEditorPart {
+ public ActivityPart() {
+ setPartName("Activity"); //$NON-NLS-1$
+ setExpandVertically(true);
+ }
+
+ @Override
+ public void createControl(Composite parent, FormToolkit toolkit) {
+ final Section section = createSection(parent, toolkit, false);
+ section.setText("Activity"); //$NON-NLS-1$
+
+ Composite activityComposite = toolkit.createComposite(section);
+ activityComposite.setLayout(new GridLayout(1, false));
+ activityComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createTreeViewer(toolkit, activityComposite);
+
+ toolkit.paintBordersFor(activityComposite);
+ section.setClient(activityComposite);
+ setSection(toolkit, section);
+ }
+
+ private void createTreeViewer(FormToolkit toolkit, Composite activityComposite) {
+ TreeViewer viewer = new TreeViewer(toolkit.createTree(activityComposite, SWT.MULTI | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
+ GridDataFactory.fillDefaults().hint(500, 100).grab(true, true).applyTo(viewer.getControl());
+ viewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ viewer.setContentProvider(new ActivityRecordContentProvider());
+// viewer.setLabelProvider(new DecoratingStyledCellLabelProvider(new ActivityRecordLabelProvider(), null, null));
+ IActivityStream stream = new ActivityManager().getStream(new TaskActivityScope(getModel().getTask()));
+ viewer.setInput(stream);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityRecordContentProvider.java b/org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityRecordContentProvider.java
new file mode 100644
index 0000000..6763e6b
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity/ui/ActivityRecordContentProvider.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Timur Achmetow and others.
+ * 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:
+ * Timur Achmetow - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.activity.ui;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.mylyn.tasks.activity.core.ActivityEvent;
+import org.eclipse.mylyn.tasks.activity.core.IActivityStream;
+
+/**
+ * @author Timur Achmetow
+ */
+@SuppressWarnings("restriction")
+public class ActivityRecordContentProvider implements ITreeContentProvider {
+ private static final Object[] NO_ELEMENTS = new Object[0];
+
+ private List<ActivityEvent> eventList;
+
+ public void dispose() {
+ eventList = null;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (newInput instanceof IActivityStream) {
+ eventList = ((IActivityStream) newInput).getEvents();
+ }
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return eventList.toArray();
+ }
+
+ public Object[] getChildren(Object parentElement) {
+// if (parentElement instanceof ActivityCommitEvent) {
+// return ((ActivityCommitEvent) parentElement).getChanges().toArray();
+// }
+ return NO_ELEMENTS;
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+// if (element instanceof ActivityCommitEvent) {
+// return true;
+// }
+ return false;
+ }
+} \ No newline at end of file