Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Achmetow2012-07-27 19:36:31 +0000
committerTimur Achmetow2012-07-27 19:36:31 +0000
commitb4f5181df152d2d182697590bf89e4cd79d63a4e (patch)
tree5c2c551a726cc7d6dfce220c2c8d13f23820b058 /org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity
parent26464efeaa73d4130a5f1280cb06982b91539a6d (diff)
downloadorg.eclipse.mylyn.tasks-b4f5181df152d2d182697590bf89e4cd79d63a4e.tar.gz
org.eclipse.mylyn.tasks-b4f5181df152d2d182697590bf89e4cd79d63a4e.tar.xz
org.eclipse.mylyn.tasks-b4f5181df152d2d182697590bf89e4cd79d63a4e.zip
NEW - bug 378003: [activity] integrate a section with an empty tree
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
Diffstat (limited to 'org.eclipse.mylyn.tasks.activity.ui/src/org/eclipse/mylyn/internal/tasks/activity')
-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
2 files changed, 124 insertions, 0 deletions
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 000000000..e04927acc
--- /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 000000000..6763e6b15
--- /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

Back to the top