Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-03-05 04:47:03 +0000
committerspingel2009-03-05 04:47:03 +0000
commit56ab397fc0797972b29a396f137ab60a331c55b3 (patch)
tree1a4e4aef1fde404e0145bedebf9c53f5ce0ed4b7 /org.eclipse.mylyn.tasks.ui
parent831c6dfca3809d5b0db6810d7771e0861718963b (diff)
downloadorg.eclipse.mylyn.tasks-56ab397fc0797972b29a396f137ab60a331c55b3.tar.gz
org.eclipse.mylyn.tasks-56ab397fc0797972b29a396f137ab60a331c55b3.tar.xz
org.eclipse.mylyn.tasks-56ab397fc0797972b29a396f137ab60a331c55b3.zip
REOPENED - bug 267112: need a way of viewing unformatted task editor comment text when WikiText is enabled
https://bugs.eclipse.org/bugs/show_bug.cgi?id=267112
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java13
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java36
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java2
5 files changed, 46 insertions, 8 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java
index dded8bfdb..be06428bd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/ViewSourceHandler.java
@@ -87,7 +87,6 @@ public class ViewSourceHandler extends AbstractHandler implements IElementUpdate
action.setChecked(!action.isChecked());
action.run();
setChecked(action.isChecked());
- EditorUtil.reflow(focusedControl);
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
index 24c55afa1..abeedbf39 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
@@ -99,6 +99,7 @@ public class RichTextAttributeEditor extends AbstractAttributeEditor {
public ViewSourceAction() {
super(Messages.RichTextAttributeEditor_Viewer_Source, SWT.TOGGLE);
setChecked(false);
+ setEnabled(false);
}
@Override
@@ -108,6 +109,10 @@ public class RichTextAttributeEditor extends AbstractAttributeEditor {
} else {
showEditor();
}
+ if (editorLayout != null) {
+ EditorUtil.reflow(editorLayout.topControl);
+ }
+ ViewSourceHandler.setChecked(isChecked());
}
}
@@ -325,10 +330,14 @@ public class RichTextAttributeEditor extends AbstractAttributeEditor {
configure(defaultViewer, isReadOnly());
show(defaultViewer);
}
+
+ viewSourceAction.setEnabled(true);
} else {
defaultViewer = createDefaultEditor(parent, style);
configure(defaultViewer, isReadOnly());
setControl(defaultViewer.getControl());
+
+ viewSourceAction.setEnabled(false);
}
}
@@ -517,4 +526,8 @@ public class RichTextAttributeEditor extends AbstractAttributeEditor {
}
}
+ public IAction getViewSourceAction() {
+ return viewSourceAction;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
index fba96c6dd..a0932cd31 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
@@ -20,6 +20,7 @@ import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ISelection;
@@ -273,6 +274,8 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
private final TaskComment taskComment;
+ private AbstractAttributeEditor editor;
+
public CommentViewer(TaskAttribute commentAttribute) {
this.commentAttribute = commentAttribute;
this.taskComment = new TaskComment(getModel().getTaskRepository(), getModel().getTask(), commentAttribute);
@@ -348,7 +351,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
buttonComposite.setVisible(commentComposite.isExpanded());
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- ReplyToCommentAction replyAction = new ReplyToCommentAction(taskComment);
+ ReplyToCommentAction replyAction = new ReplyToCommentAction(this, taskComment);
replyAction.setImageDescriptor(TasksUiImages.COMMENT_REPLY_SMALL);
toolBarManager.add(replyAction);
toolBarManager.createControl(buttonComposite);
@@ -397,7 +400,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
// create viewer
TaskAttribute textAttribute = getTaskData().getAttributeMapper().getAssoctiatedAttribute(
taskComment.getTaskAttribute());
- AbstractAttributeEditor editor = createAttributeEditor(textAttribute);
+ editor = createAttributeEditor(textAttribute);
if (editor != null) {
editor.setDecorationEnabled(false);
editor.createControl(composite, toolkit);
@@ -433,14 +436,26 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
}
}
+ /**
+ * Returns the comment viewer.
+ *
+ * @return null, if the viewer has not been constructed
+ */
+ public AbstractAttributeEditor getEditor() {
+ return editor;
+ }
+
}
private class ReplyToCommentAction extends AbstractReplyToCommentAction implements IMenuCreator {
private final ITaskComment taskComment;
- public ReplyToCommentAction(ITaskComment taskComment) {
+ private final CommentViewer commentViewer;
+
+ public ReplyToCommentAction(CommentViewer commentViewer, ITaskComment taskComment) {
super(TaskEditorCommentPart.this.getTaskEditorPage(), taskComment);
+ this.commentViewer = commentViewer;
this.taskComment = taskComment;
setMenuCreator(this);
}
@@ -451,6 +466,7 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
}
public Menu getMenu(Control parent) {
+ currentViewer = commentViewer;
selectionProvider.setSelection(new StructuredSelection(taskComment));
return commentMenu;
}
@@ -484,6 +500,9 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
private SelectionProviderAdapter selectionProvider;
+ // XXX: stores a reference to the viewer for which the commentMenu was displayed last
+ private CommentViewer currentViewer;
+
private Menu commentMenu;
private CommentActionGroup actionGroup;
@@ -555,9 +574,16 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
manager.add(replyAction);
}
}
-
- actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
actionGroup.fillContextMenu(manager);
+ actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
+
+ if (currentViewer != null && currentViewer.getEditor() instanceof RichTextAttributeEditor) {
+ RichTextAttributeEditor editor = (RichTextAttributeEditor) currentViewer.getEditor();
+ if (editor.getViewSourceAction().isEnabled()) {
+ manager.add(new Separator("planning")); //$NON-NLS-1$
+ manager.add(editor.getViewSourceAction());
+ }
+ }
}
});
getTaskEditorPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, selectionProvider, false);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
index c12921f1a..d50c27fb0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
@@ -35,7 +35,7 @@ PreviewAttributeEditor_Formatting_Wiki_Text=Formatting Wiki Text
PreviewAttributeEditor_Loading_preview_=Loading preview...
PreviewAttributeEditor_Preview=Preview
-RichTextAttributeEditor_Viewer_Source=Viewer Source
+RichTextAttributeEditor_Viewer_Source=View Unformatted Text
TaskAttachmentDropListener_Note_that_only_the_first_file_dragged_will_be_attached=Note that only the first file dragged will be attached.
TaskEditorActionContributor_Add_to_X=Add to {0}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index f6a47f81a..a240e3a92 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -607,7 +607,7 @@ public class TaskEditor extends SharedHeaderFormEditor {
}
};
}
- toolBarManager.add(new Separator("planning"));
+ toolBarManager.add(new Separator("planning")); //$NON-NLS-1$
toolBarManager.add(new TaskEditorScheduleAction(task));
toolBarManager.add(new Separator("activation")); //$NON-NLS-1$

Back to the top