Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-10-24 01:03:12 -0400
committermkersten2005-10-24 01:03:12 -0400
commitaca983785e6e5031d7a2d9833c92229ce5546cf2 (patch)
tree6b3d7c595abef5dde2138e2969be64b3cd42e83b
parentc1c8d541b7ab9f96cb1de42703d7f8bb609dc307 (diff)
downloadorg.eclipse.mylyn.tasks-aca983785e6e5031d7a2d9833c92229ce5546cf2.tar.gz
org.eclipse.mylyn.tasks-aca983785e6e5031d7a2d9833c92229ce5546cf2.tar.xz
org.eclipse.mylyn.tasks-aca983785e6e5031d7a2d9833c92229ce5546cf2.zip
Progress on Bugzilla Bug 113386: support viewing of web docs in context
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/RelatedLinks.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskEditor.java108
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java407
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java2
8 files changed, 119 insertions, 454 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java
index c51c5e4fe..ed428bcb4 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java
@@ -1204,7 +1204,7 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
* elements which can change).
*/
protected void setGeneralTitleText() {
- String text = "Open in browser";
+ String text = "[Open in Browser]";
linkToBug.setText(text);
linkToBug.setFont(TEXT_FONT);
if(this instanceof ExistingBugEditor){
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java
index de539a407..401daf3d9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITask.java
@@ -40,9 +40,9 @@ public interface ITask extends Serializable, ITaskListElement {
public abstract void setCompleted(boolean completed);
- public abstract RelatedLinks getRelatedLinks();
+ public abstract List<String> getRelatedLinks();
- public abstract void setRelatedLinks(RelatedLinks relatedLinks);
+ public abstract void setRelatedLinks(List<String> relatedLinks);
public abstract void addLink(String url);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/RelatedLinks.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/RelatedLinks.java
deleted file mode 100644
index 3fe7cfdfe..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/RelatedLinks.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2005 University Of British Columbia 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:
- * University Of British Columbia - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylar.tasklist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Related links stored for each task used as input to the Table
- * used in the TaskSummaryEditor
- *
- * @author Ken Sueda
- */
-public class RelatedLinks {
- private List<String> links;
-
- public RelatedLinks() {
- links = new ArrayList<String>();
- }
- public void add(String link) {
- links.add(link);
- }
- public List<String> getLinks() {
- return links;
- }
- public void remove(String link) {
- links.remove(link);
- }
- public void clear() {
- links.clear();
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java
index 3bd11b53a..0884bca43 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java
@@ -54,7 +54,7 @@ public class Task implements ITask {
private String notes = "";
private int estimatedTime = 0;
private boolean completed;
- private RelatedLinks links = new RelatedLinks();
+ private List<String> links = new ArrayList<String>();
private String issueReportURL = "";
private ITaskListCategory parentCategory = null;
@@ -241,15 +241,15 @@ public class Task implements ITask {
this.priority = priority;
}
- public RelatedLinks getRelatedLinks() {
+ public List<String> getRelatedLinks() {
// TODO: removed check for null once xml updated.
if (links == null) {
- links = new RelatedLinks();
+ links = new ArrayList<String>();
}
return links;
}
- public void setRelatedLinks(RelatedLinks relatedLinks) {
+ public void setRelatedLinks(List<String> relatedLinks) {
this.links = relatedLinks;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java
index 8874cc2c1..ab2981bf0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/DefaultTaskListExternalizer.java
@@ -128,7 +128,7 @@ public class DefaultTaskListExternalizer implements ITaskListExternalizer {
} else {
node.setAttribute(REMINDED, FALSE);
}
- List<String> rl = task.getRelatedLinks().getLinks();
+ List<String> rl = task.getRelatedLinks();
int i = 0;
for (String link : rl) {
node.setAttribute(LINK+i, link);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskEditor.java
index 3d507ac9a..318c2b8f2 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskEditor.java
@@ -12,6 +12,9 @@
package org.eclipse.mylar.tasklist.ui;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasklist.IContextEditorFactory;
import org.eclipse.mylar.tasklist.ITask;
@@ -28,57 +31,89 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.part.MultiPageSelectionProvider;
/**
* @author Mik Kersten
- * @author Eric Booth
+ * @author Eric Booth (initial prototype)
*/
public class TaskEditor extends MultiPageEditorPart {
private static final String TASK_INFO_PAGE_LABEL = "Task Info";
- private static final String ISSUE_WEB_PAGE_LABEL = "Issue Report Page";
+ private static final String ISSUE_WEB_PAGE_LABEL = "Web Link";
protected ITask task;
private TaskSummaryEditor taskSummaryEditor;
private Browser issueBrowser;
private TaskEditorInput taskEditorInput;
+ private static class TaskEditorSelectionProvider extends MultiPageSelectionProvider {
+ private ISelection globalSelection;
+
+ public TaskEditorSelectionProvider(TaskEditor taskEditor) {
+ super(taskEditor);
+ }
+
+ public ISelection getSelection() {
+ IEditorPart activeEditor = ((TaskEditor) getMultiPageEditor()).getActiveEditor();
+ if (activeEditor != null && activeEditor.getSite() != null) {
+ ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
+ if (selectionProvider != null)
+ return selectionProvider.getSelection();
+ }
+ return globalSelection;
+ }
+
+ public void setSelection(ISelection selection) {
+ IEditorPart activeEditor = ((TaskEditor) getMultiPageEditor()).getActiveEditor();
+ if (activeEditor != null && activeEditor.getSite() != null) {
+ ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
+ if (selectionProvider != null) selectionProvider.setSelection(selection);
+ } else {
+ this.globalSelection = selection;
+ fireSelectionChanged(new SelectionChangedEvent(this, globalSelection));
+ }
+ }
+ }
+
public TaskEditor() {
super();
-
- // get the workbench page and add a listener so we can detect when it closes
- IWorkbench wb = MylarTasklistPlugin.getDefault().getWorkbench();
- IWorkbenchWindow aw = wb.getActiveWorkbenchWindow();
- IWorkbenchPage ap = aw.getActivePage();
+ IWorkbench workbench = MylarTasklistPlugin.getDefault().getWorkbench();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage activePage = window.getActivePage();
TaskEditorListener listener = new TaskEditorListener();
- ap.addPartListener(listener);
-
+ activePage.addPartListener(listener);
taskSummaryEditor = new TaskSummaryEditor();
}
- /**
- * Creates page 1 of the multi-page editor,
- * which displays the task for viewing.
- */
- private void createTaskSummaryPage() {
+ @Override
+ protected void createPages() {
+ try {
+ int index = createTaskSummaryPage();
+ if(task.getIssueReportURL().length() > 9){
+ createTaskIssueWebPage();
+ }
+ for (IContextEditorFactory factory : MylarTasklistPlugin.getDefault().getContextEditors()) {
+ taskSummaryEditor.setParentEditor(this);
+ IEditorPart editor = factory.createEditor();
+ index = addPage(editor, factory.createEditorInput(MylarPlugin.getContextManager().getActiveContext()));
+ setPageText(index++, factory.getTitle());
+ }
+ } catch (PartInitException e) {
+ MylarPlugin.fail(e, "failed to create task editor pages", false);
+ }
+ }
+
+ private int createTaskSummaryPage() throws PartInitException {
try {
taskSummaryEditor.createPartControl(getContainer());
taskSummaryEditor.setParentEditor(this);
int index = addPage(taskSummaryEditor.getControl());
- setPageText(index, TASK_INFO_PAGE_LABEL);
-
- for (IContextEditorFactory factory : MylarTasklistPlugin.getDefault().getContextEditors()) {
- try {
- taskSummaryEditor.setParentEditor(this);
- index = addPage(factory.createEditor(), factory.createEditorInput(MylarPlugin.getContextManager().getActiveContext()));
- setPageText(index++, factory.getTitle());
- } catch (PartInitException e) {
- MylarPlugin.fail(e, "could not add task editor", false);
- }
- }
-
+ setPageText(index, TASK_INFO_PAGE_LABEL);
+ return index;
} catch (RuntimeException e) {
MylarPlugin.fail(e, "could not add task editor", false);
}
+ return 0;
}
/**
@@ -95,17 +130,6 @@ public class TaskEditor extends MultiPageEditorPart {
MylarPlugin.fail(e, "could not open issue report web page", false);
}
}
-
- /**
- * Creates the pages of the multi-page editor.
- */
- @Override
- protected void createPages() {
- createTaskSummaryPage();
- if(task.getIssueReportURL().length() > 9){
- createTaskIssueWebPage();
- }
- }
@Override
public void doSave(IProgressMonitor monitor) {
@@ -136,17 +160,17 @@ public class TaskEditor extends MultiPageEditorPart {
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
-
-// if (!(input instanceof TaskEditorInput))
-// throw new PartInitException("Invalid Input: Must be TaskEditorInput");
- taskEditorInput = (TaskEditorInput)input;
+ taskEditorInput = (TaskEditorInput)input;
super.init(site, input);
+ setSite(site);
+ site.setSelectionProvider(new TaskEditorSelectionProvider(this));
+
/*
* The task data is saved only once, at the initialization of the editor. This is
* then passed to each of the child editors. This way, only one instance of
* the task data is stored for each editor opened.
- */
+ */
task = taskEditorInput.getTask();
try {
taskSummaryEditor.init(this.getEditorSite(), this.getEditorInput());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java
index 03d6f2831..39afce013 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java
@@ -16,37 +16,15 @@
*/
package org.eclipse.mylar.tasklist.ui;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Calendar;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskActivityListener;
import org.eclipse.mylar.tasklist.MylarTasklistPlugin;
-import org.eclipse.mylar.tasklist.RelatedLinks;
-import org.eclipse.mylar.tasklist.TaskListImages;
import org.eclipse.mylar.tasklist.contribution.DatePicker;
import org.eclipse.mylar.tasklist.internal.RelativePathUtil;
import org.eclipse.mylar.tasklist.ui.views.TaskListView;
@@ -54,27 +32,17 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
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.FileDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
@@ -82,7 +50,6 @@ import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.RetargetAction;
-import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.events.IExpansionListener;
@@ -94,15 +61,14 @@ import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
import org.eclipse.ui.part.EditorPart;
/**
* For details on forms, go to:
* http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/pde-ui-home/working/EclipseForms/EclipseForms.html
*
- * @author Ken Sueda
* @author Mik Kersten
+ * @author Ken Sueda (initial prototype)
*/
public class TaskSummaryEditor extends EditorPart {
@@ -122,16 +88,10 @@ public class TaskSummaryEditor extends EditorPart {
private RetargetAction cutAction;
private static final String cutActionDefId = "org.eclipse.ui.edit.cut";
private static final String pasteActionDefId = "org.eclipse.ui.edit.paste";
- private Table table;
- private TableViewer tableViewer;
- private RelatedLinks links;
- private RelatedLinksContentProvider contentProvider;
private Button browse;
private Text pathText;
- private ScrolledForm sform;
- private Action add;
- private Action delete;
+ private ScrolledForm form;
private Text description;
private Text issueReportURL;
private Text notes;
@@ -213,6 +173,7 @@ public class TaskSummaryEditor extends EditorPart {
copyAction.setEnabled(false);
MylarTasklistPlugin.getTaskListManager().addListener(TASK_LIST_LISTENER);
}
+
@Override
public void doSave(IProgressMonitor monitor) {
String label = description.getText();
@@ -221,13 +182,13 @@ public class TaskSummaryEditor extends EditorPart {
String note = notes.getText();
task.setNotes(note);
task.setEstimatedTime(estimated.getSelection());
- links.clear();
- TableItem[] items = table.getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() instanceof String) {
- links.add((String)items[i].getData());
- }
- }
+// links.clear();
+// TableItem[] items = table.getItems();
+// for (int i = 0; i < items.length; i++) {
+// if (items[i].getData() instanceof String) {
+// links.add((String)items[i].getData());
+// }
+// }
//"<MylarDir>/" + res + ".xml"
String path = pathText.getText();
path = path.substring(path.indexOf('/') + 1, path.lastIndexOf('.'));
@@ -255,6 +216,7 @@ public class TaskSummaryEditor extends EditorPart {
editorInput = (TaskEditorInput)input;
setPartName(editorInput.getLabel());
}
+
@Override
public boolean isDirty() {
return isDirty;
@@ -268,9 +230,9 @@ public class TaskSummaryEditor extends EditorPart {
@Override
public void createPartControl(Composite parent) {
FormToolkit toolkit = new FormToolkit(parent.getDisplay());
- sform = toolkit.createScrolledForm(parent);
- sform.getBody().setLayout(new TableWrapLayout());
- editorComposite = sform.getBody();
+ form = toolkit.createScrolledForm(parent);
+ form.getBody().setLayout(new TableWrapLayout());
+ editorComposite = form.getBody();
TableWrapLayout layout = new TableWrapLayout();
@@ -287,16 +249,16 @@ public class TaskSummaryEditor extends EditorPart {
// Put the info onto the editor
createContent(editorComposite, toolkit);
- sform.setFocus();
+ form.setFocus();
}
@Override
public void setFocus() {
- sform.setFocus();
+ form.setFocus();
}
public Control getControl() {
- return sform;
+ return form;
}
public void setTask(ITask task) throws Exception {
@@ -333,10 +295,10 @@ public class TaskSummaryEditor extends EditorPart {
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
section.addExpansionListener(new IExpansionListener() {
public void expansionStateChanging(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
public void expansionStateChanged(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
});
@@ -363,7 +325,6 @@ public class TaskSummaryEditor extends EditorPart {
});
}
}
-
private void createDocumentationSection(Composite parent, FormToolkit toolkit) {
Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR);
@@ -372,11 +333,11 @@ public class TaskSummaryEditor extends EditorPart {
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
section.addExpansionListener(new IExpansionListener() {
public void expansionStateChanging(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
public void expansionStateChanged(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
});
Composite container = toolkit.createComposite(section);
@@ -401,19 +362,19 @@ public class TaskSummaryEditor extends EditorPart {
});
}
- issueReportURL.addMouseListener(new MouseListener(){
- public void mouseDoubleClick(MouseEvent e) {
- openURLinBrowser(issueReportURL.getText());
- }
-
- public void mouseDown(MouseEvent e) {
- //Don't open on mouse down so that the field can still be edited.
- }
-
- public void mouseUp(MouseEvent e) {
-
- }
- });
+// issueReportURL.addMouseListener(new MouseListener(){
+// public void mouseDoubleClick(MouseEvent e) {
+// openURLinBrowser(issueReportURL.getText());
+// }
+//
+// public void mouseDown(MouseEvent e) {
+// //Don't open on mouse down so that the field can still be edited.
+// }
+//
+// public void mouseUp(MouseEvent e) {
+//
+// }
+// });
Label notesLabel = toolkit.createLabel(container, "Notes:");
@@ -431,10 +392,10 @@ public class TaskSummaryEditor extends EditorPart {
Label relatedLinksLabel = toolkit.createLabel(container, "Related Links:");
relatedLinksLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- createTable(container, toolkit);
- createTableViewer(container, toolkit);
+// createTable(container, toolkit);
+// createTableViewer(container, toolkit);
toolkit.paintBordersFor(container);
- createAddDeleteButtons(container, toolkit);
+// createAddDeleteButtons(container, toolkit);
// notes.addKeyListener(new KeyListener() {
// public void keyPressed(KeyEvent e) {
// }
@@ -453,11 +414,11 @@ public class TaskSummaryEditor extends EditorPart {
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
section.addExpansionListener(new IExpansionListener() {
public void expansionStateChanging(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
public void expansionStateChanged(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
});
Composite container = toolkit.createComposite(section);
@@ -558,91 +519,7 @@ public class TaskSummaryEditor extends EditorPart {
// container.setLayout(layout);
// }
- private void createTable(Composite parent, FormToolkit toolkit) {
- table = toolkit.createTable(parent, SWT.NONE );
- TableColumn col1 = new TableColumn(table, SWT.NULL);
- TableLayout tlayout = new TableLayout();
- tlayout.addColumnData(new ColumnWeightData(0,0,false));
- table.setLayout(tlayout);
- TableWrapData wd = new TableWrapData(TableWrapData.FILL_GRAB);
- wd.heightHint = 60;
- wd.grabVertical = true;
- table.setLayoutData(wd);
- table.setHeaderVisible(false);
- col1.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new RelatedLinksTableSorter(
- RelatedLinksTableSorter.LABEL));
- }
- });
- table.addMouseTrackListener(new MouseTrackListener() {
- public void mouseEnter(MouseEvent e) {
- if(!((RelatedLinksContentProvider)tableViewer.getContentProvider()).isEmpty()) {
- Cursor hyperlinkCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
- Display.getCurrent().getCursorControl().setCursor(hyperlinkCursor);
- }
- }
-
- public void mouseExit(MouseEvent e) {
- Cursor pointer = new Cursor(Display.getCurrent(), SWT.CURSOR_ARROW);
- Display.getCurrent().getCursorControl().setCursor(pointer);
- }
-
- public void mouseHover(MouseEvent e){
- if(!((RelatedLinksContentProvider)tableViewer.getContentProvider()).isEmpty()) {
- Cursor hyperlinkCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
- Display.getCurrent().getCursorControl().setCursor(hyperlinkCursor);
- }
- }
- });
- }
- private void createTableViewer(Composite parent, FormToolkit toolkit) {
- String[] columnNames = {"Links"};
- tableViewer = new TableViewer(table);
- tableViewer.setColumnProperties(columnNames);
-
- CellEditor[] editors = new CellEditor[columnNames.length];
-
- TextCellEditor textEditor = new TextCellEditor(table);
- ((Text) textEditor.getControl()).setTextLimit(50);
- ((Text) textEditor.getControl()).setOrientation(SWT.LEFT_TO_RIGHT);
- editors[0] = textEditor;
-
- tableViewer.setCellEditors(editors);
- tableViewer.setCellModifier(new RelatedLinksCellModifier());
- contentProvider = new RelatedLinksContentProvider();
- tableViewer.setContentProvider(contentProvider);
- tableViewer.setLabelProvider(new RelatedLinksLabelProvider());
- links = task.getRelatedLinks();
- tableViewer.setInput(links);
- defineActions();
- hookContextMenu();
- }
- private void createAddDeleteButtons(Composite parent, FormToolkit toolkit) {
- Composite container = toolkit.createComposite(parent);
- container.setLayout(new GridLayout(2, true));
- Button addButton = toolkit.createButton(container, " Add Hyperlink ", SWT.PUSH | SWT.CENTER);
- //add.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- addButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- addLinkToTable();
- }
- });
-
- Button deleteButton = toolkit.createButton(container, "Delete Hyperlink ", SWT.PUSH | SWT.CENTER);
-// deleteButton.setText("Delete");
- //delete.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- deleteButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- removeLinkFromTable();
- }
- });
- }
private void createDetailsSection(Composite parent, FormToolkit toolkit) {
Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | Section.TWISTIE);
@@ -651,10 +528,10 @@ public class TaskSummaryEditor extends EditorPart {
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
section.addExpansionListener(new IExpansionListener() {
public void expansionStateChanging(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
public void expansionStateChanged(ExpansionEvent e) {
- sform.reflow(true);
+ form.reflow(true);
}
});
@@ -727,212 +604,16 @@ public class TaskSummaryEditor extends EditorPart {
private void refreshTaskListView(ITask task) {
if (TaskListView.getDefault() != null) TaskListView.getDefault().notifyTaskDataChanged(task);
}
- private class RelatedLinksCellModifier implements ICellModifier, IColorProvider {
- RelatedLinksCellModifier() {
- super();
-
- }
- public boolean canModify(Object element, String property) {
- return true;
- }
- public Object getValue(Object element, String property) {
- Object res = null;
- if (element instanceof String) {
- String url = (String) element;
- openURLinBrowser(url);
- res = (String) element;
- }
- return res;
- }
- public void modify(Object element, String property, Object value) {
- return;
- }
-
- public Color getForeground(Object element) {
- return HYPERLINK;
- }
-
- public Color getBackground(Object element) {
- return null;
- }
- }
-
- private class RelatedLinksLabelProvider extends LabelProvider implements
- ITableLabelProvider, IColorProvider {
-
- public RelatedLinksLabelProvider() {
- // don't have any initialization to do
- }
- public String getColumnText(Object obj, int columnIndex) {
- String result = "";
- if (obj instanceof String) {
- switch (columnIndex) {
- case 0:
- result = (String) obj;
- break;
- default:
- break;
- }
- }
- return result;
- }
- public Image getColumnImage(Object obj, int columnIndex) {
- return null;
- }
- public Color getForeground(Object element) {
- return HYPERLINK;
- }
-
- public Color getBackground(Object element) {
- return null;
- }
- }
-
- private class RelatedLinksContentProvider implements
- IStructuredContentProvider {
-
- public Object[] getElements(Object inputElement) {
- return links.getLinks().toArray();
- }
- public void dispose() {
- // don't care if we are disposed
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // don't care if the input chages
- }
- public boolean isEmpty() {
- return links.getLinks().isEmpty();
- }
- }
-
- private class RelatedLinksTableSorter extends ViewerSorter {
-
- public final static int LABEL = 1;
- private int criteria;
-
- public RelatedLinksTableSorter(int criteria) {
- super();
- this.criteria = criteria;
- }
-
- @Override
- public int compare(Viewer viewer, Object o1, Object o2) {
- String s1 = (String) o1;
- String s2 = (String) o2;
- switch (criteria) {
- case LABEL:
- return compareLabel(s1, s2);
- default:
- return 0;
- }
- }
- protected int compareLabel(String s1, String s2) {
- return s1.compareTo(s2);
- }
- public int getCriteria() {
- return criteria;
- }
- }
-
- private void addLinkToTable() {
- InputDialog dialog = new InputDialog(Display.getDefault().getActiveShell(), "New related link",
- "Enter new related link for this task", "", null);
- dialog.open();
- String url = null;
- String link = dialog.getValue();
- if (link != null) {
- if (!(link.startsWith("http://") || link.startsWith("https://"))) {
- url = "http://" + link;
- } else {
- url = link;
- }
- tableViewer.add(url);
- markDirty(true);
- }
- }
-
- private void removeLinkFromTable() {
- String url = (String) ((IStructuredSelection) tableViewer
- .getSelection()).getFirstElement();
- if (url != null) {
- tableViewer.remove(url);
- markDirty(true);
- }
- }
-
-
- private void defineActions() {
- delete = new Action() {
- @Override
- public void run() {
- removeLinkFromTable();
- }
- };
- delete.setText("Delete");
- delete.setToolTipText("Delete");
- delete.setImageDescriptor(TaskListImages.REMOVE);
-
- add = new Action() {
- @Override
- public void run() {
- addLinkToTable();
- }
- };
- add.setText("Add");
- add.setToolTipText("Add");
- //add.setImageDescriptor(MylarImages.REMOVE);
- }
-
- private void hookContextMenu() {
- MenuManager menuMgr = new MenuManager("#PopupMenu");
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- manager.add(add);
- manager.add(delete);
- }
- });
- Menu menu = menuMgr.createContextMenu(tableViewer.getControl());
- tableViewer.getControl().setMenu(menu);
- //getSite().registerContextMenu(menuMgr, tableViewer);
- }
private void markDirty(boolean dirty) {
isDirty = dirty;
if (parentEditor != null) {
- parentEditor.updatePartName();
- }
+ parentEditor.updatePartName();
+ }
return;
}
-
+
public void setParentEditor(TaskEditor parentEditor) {
this.parentEditor = parentEditor;
}
-
- private void openURLinBrowser(String url) {
- try {
- IWebBrowser b = null;
- int flags = 0;
- if (WorkbenchBrowserSupport.getInstance()
- .isInternalWebBrowserAvailable()) {
- flags = WorkbenchBrowserSupport.AS_EDITOR
- | WorkbenchBrowserSupport.LOCATION_BAR
- | WorkbenchBrowserSupport.NAVIGATION_BAR;
-
- } else {
- flags = WorkbenchBrowserSupport.AS_EXTERNAL
- | WorkbenchBrowserSupport.LOCATION_BAR
- | WorkbenchBrowserSupport.NAVIGATION_BAR;
- }
- b = WorkbenchBrowserSupport.getInstance().createBrowser(
- flags, "org.eclipse.mylar.tasklist", "Task", "tasktooltip");
- b.openURL(new URL(url));
- } catch (PartInitException e) {
- MessageDialog.openError( Display.getDefault().getActiveShell(),
- "URL not found", url + " could not be opened");
- } catch (MalformedURLException e) {
- MessageDialog.openError( Display.getDefault().getActiveShell(),
- "URL not found", url + " could not be opened");
- }
- }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java
index c2c9d9903..66b5f7776 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/TaskInputDialog.java
@@ -92,7 +92,7 @@ public class TaskInputDialog extends Dialog {
Label urlLabel = new Label(composite, SWT.WRAP);
- urlLabel.setText("Issue URL:");
+ urlLabel.setText("Web Link:");
urlLabel.setFont(parent.getFont());
issueURLTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);

Back to the top