summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Parker2012-12-06 21:20:22 (EST)
committerMiles Parker2012-12-07 15:54:08 (EST)
commitf3c8576020b1ab046f64cfb06e76e75a3221f66d (patch)
treefaef2bac2595fbc81d0f58adfb5e0bc5d28a3b5b
parenta33434de28d2d6e4c62f173357e97443199e19bf (diff)
downloadorg.eclipse.mylyn.reviews-f3c8576020b1ab046f64cfb06e76e75a3221f66d.zip
org.eclipse.mylyn.reviews-f3c8576020b1ab046f64cfb06e76e75a3221f66d.tar.gz
org.eclipse.mylyn.reviews-f3c8576020b1ab046f64cfb06e76e75a3221f66d.tar.bz2
344100: Provide spell checking for commentsrefs/changes/12/9112/1
Change-Id: I2780a7bb3668b3678ef1cd214c268aaa473e05f0 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=344100
-rw-r--r--org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java14
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/dialogs/AddCommentDialog.java20
2 files changed, 29 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java
index 7a46f4e..6d6beb5 100644
--- a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java
+++ b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java
@@ -23,6 +23,7 @@ import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.fieldassist.TextContentAdapter;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.mylyn.commons.workbench.editors.CommonTextSupport;
import org.eclipse.mylyn.commons.workbench.forms.CommonFormUtil;
import org.eclipse.mylyn.internal.gerrit.core.GerritOperationFactory;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritConfiguration;
@@ -44,8 +45,10 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.statushandlers.StatusManager;
import com.google.gerrit.common.data.GerritConfig;
@@ -63,6 +66,8 @@ public abstract class GerritOperationDialog extends ProgressDialog {
protected FormToolkit toolkit;
+ private CommonTextSupport textSupport;
+
public GerritOperationDialog(Shell parentShell, ITask task) {
super(parentShell);
this.task = task;
@@ -76,6 +81,9 @@ public abstract class GerritOperationDialog extends ProgressDialog {
return false;
}
}
+ if (textSupport != null) {
+ textSupport.dispose();
+ }
return super.close();
}
@@ -158,7 +166,13 @@ public abstract class GerritOperationDialog extends ProgressDialog {
final RichTextEditor editor = new RichTextEditor(repository, style, null, extension, task);
editor.setText(value);
+ editor.setSpellCheckingEnabled(true);
editor.createControl(composite, toolkit);
+ IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ if (handlerService != null) {
+ textSupport = new CommonTextSupport(handlerService);
+ textSupport.install(editor.getViewer(), true);
+ }
// HACK: this is to make sure that we can't have multiple things highlighted
editor.getViewer().getTextWidget().addFocusListener(new FocusListener() {
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/dialogs/AddCommentDialog.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/dialogs/AddCommentDialog.java
index 0fb3e9c..e142548 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/dialogs/AddCommentDialog.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/dialogs/AddCommentDialog.java
@@ -12,7 +12,6 @@
package org.eclipse.mylyn.internal.reviews.ui.dialogs;
import java.lang.reflect.InvocationTargetException;
-import java.util.Date;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -20,16 +19,14 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.mylyn.commons.workbench.editors.CommonTextSupport;
import org.eclipse.mylyn.internal.reviews.ui.ReviewsUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
-import org.eclipse.mylyn.reviews.core.model.IComment;
import org.eclipse.mylyn.reviews.core.model.ILocation;
import org.eclipse.mylyn.reviews.core.model.IReviewItem;
import org.eclipse.mylyn.reviews.core.model.ITopic;
-import org.eclipse.mylyn.reviews.core.model.IUser;
-import org.eclipse.mylyn.reviews.internal.core.model.ReviewsFactory;
import org.eclipse.mylyn.reviews.ui.ProgressDialog;
import org.eclipse.mylyn.reviews.ui.ReviewBehavior;
import org.eclipse.mylyn.tasks.core.ITask;
@@ -43,11 +40,14 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.statushandlers.StatusManager;
/**
* @author Steffen Pingel
+ * @author Miles Parker
*/
public class AddCommentDialog extends ProgressDialog {
@@ -63,6 +63,8 @@ public class AddCommentDialog extends ProgressDialog {
private final IReviewItem item;
+ private CommonTextSupport textSupport;
+
public AddCommentDialog(Shell parentShell, ReviewBehavior reviewBehavior, IReviewItem item, ILocation location) {
super(parentShell);
this.reviewBehavior = reviewBehavior;
@@ -79,6 +81,9 @@ public class AddCommentDialog extends ProgressDialog {
return false;
}
}
+ if (textSupport != null) {
+ textSupport.dispose();
+ }
return super.close();
}
@@ -157,7 +162,13 @@ public class AddCommentDialog extends ProgressDialog {
final RichTextEditor editor = new RichTextEditor(repository, style, null, extension, task);
editor.setText(value);
+ editor.setSpellCheckingEnabled(true);
editor.createControl(composite, toolkit);
+ IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
+ if (handlerService != null) {
+ textSupport = new CommonTextSupport(handlerService);
+ textSupport.install(editor.getViewer(), true);
+ }
// HACK: this is to make sure that we can't have multiple things highlighted
editor.getViewer().getTextWidget().addFocusListener(new FocusListener() {
@@ -172,5 +183,4 @@ public class AddCommentDialog extends ProgressDialog {
return editor;
}
-
}