diff options
author | Dani Megert | 2011-01-20 10:11:22 +0000 |
---|---|---|
committer | Dani Megert | 2011-01-20 10:11:22 +0000 |
commit | db36c0096cf2045d572d2dd27ebffef8865842ba (patch) | |
tree | bc8b91ac81ea9dc73c8a6a8c1c9e1ba1cf8eb0b4 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team | |
parent | 7d66c317c1cf837017dd14228c86074f01df0faa (diff) | |
download | eclipse.platform.team-db36c0096cf2045d572d2dd27ebffef8865842ba.tar.gz eclipse.platform.team-db36c0096cf2045d572d2dd27ebffef8865842ba.tar.xz eclipse.platform.team-db36c0096cf2045d572d2dd27ebffef8865842ba.zip |
Fixed bug 334756: CVS Commit dialog commits comment "<Click here to enter a commit comment>"
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java index e13ffd5ec..c76600614 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommitCommentArea.java @@ -55,12 +55,12 @@ import org.eclipse.ui.texteditor.*; */ public class CommitCommentArea extends DialogArea { - private class TextBox implements ModifyListener, TraverseListener, FocusListener, Observer { + private class TextBox implements ModifyListener, TraverseListener, FocusListener, Observer, IDocumentListener { private final StyledText fTextField; // updated only by modify events private final String fMessage; - private String fText; + private IDocument fDocument; public TextBox(Composite composite, String message, String initialText) { @@ -86,8 +86,8 @@ public class CommitCommentArea extends DialogArea { support.install(EditorsUI.getPreferenceStore()); - final IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); - final IHandlerActivation handlerActivation= installQuickFixActionHandler(handlerService, sourceViewer); + final IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); + final IHandlerActivation handlerActivation = installQuickFixActionHandler(handlerService, sourceViewer); final TextViewerAction cutAction = new TextViewerAction(sourceViewer, ITextOperationTarget.CUT); cutAction.setText(CVSUIMessages.CommitCommentArea_7); @@ -215,20 +215,13 @@ public class CommitCommentArea extends DialogArea { }); - Document document = new Document(initialText); + fDocument = new Document(initialText); // NOTE: Configuration must be applied before the document is set in order for // Hyperlink coloring to work. (Presenter needs document object up front) sourceViewer.configure(new TextSourceViewerConfiguration(EditorsUI.getPreferenceStore())); - sourceViewer.setDocument(document, annotationModel); - document.addDocumentListener(new IDocumentListener() { - public void documentAboutToBeChanged(DocumentEvent event) { - } - public void documentChanged(DocumentEvent event) { - modifyText(null); - } - }); - + sourceViewer.setDocument(fDocument, annotationModel); + fDocument.addDocumentListener(this); fTextField.addTraverseListener(this); fTextField.addModifyListener(this); fTextField.addFocusListener(this); @@ -296,10 +289,12 @@ public class CommitCommentArea extends DialogArea { return; fTextField.removeModifyListener(this); + fDocument.removeDocumentListener(this); try { fTextField.setText(fText); } finally { fTextField.addModifyListener(this); + fDocument.addDocumentListener(this); } } @@ -309,11 +304,13 @@ public class CommitCommentArea extends DialogArea { return; fTextField.removeModifyListener(this); + fDocument.removeDocumentListener(this); try { fTextField.setText(fMessage); fTextField.selectAll(); } finally { fTextField.addModifyListener(this); + fDocument.addDocumentListener(this); } } @@ -342,7 +339,14 @@ public class CommitCommentArea extends DialogArea { public void setFocus() { fTextField.setFocus(); } - } + + public void documentAboutToBeChanged(DocumentEvent event) { + } + + public void documentChanged(DocumentEvent event) { + modifyText(null); + } + } private static class ComboBox extends Observable implements SelectionListener, FocusListener { |