Permalink
Browse files

Refactorings and some find improvements

  • Loading branch information...
1 parent 97e6a63 commit 3ff3e1022fe109f5725d6964737f8c26ee041dc1 @kkckkc committed with kkckkc@gmail.com Aug 16, 2011
@@ -10,6 +10,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
+import javax.swing.*;
import java.awt.Dialog.ModalityType;
import java.awt.*;
import java.awt.event.ActionEvent;
@@ -112,6 +113,10 @@ private void next() {
view.getReplace().setEnabled(findCommand.isFound());
updateHistory(findCommand, true, false);
+
+ if (! findCommand.isFound()) {
+ JOptionPane.showMessageDialog(view.getJDialog(), "No more found");
+ }
}
private void previous() {
@@ -123,6 +128,10 @@ private void previous() {
view.getReplace().setEnabled(findCommand.isFound());
updateHistory(findCommand, true, false);
+
+ if (! findCommand.isFound()) {
+ JOptionPane.showMessageDialog(view.getJDialog(), "No more found");
+ }
}
private void replace() {
@@ -20,7 +20,6 @@
import kkckkc.syntaxpane.parse.grammar.textmate.ColorUtils;
import kkckkc.syntaxpane.style.*;
import kkckkc.utils.io.FileUtils;
-import org.mortbay.jetty.servlet.Context;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -102,10 +101,6 @@ public SettingsManager getSettingsManager() {
return settingsManager;
}
- public Context getHttpServer() {
- return beanFactory.getBean(Context.class);
- }
-
public ExecutorService getThreadPool() {
return threadPool;
}
@@ -12,7 +12,6 @@
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.text.JTextComponent;
-import javax.swing.text.Keymap;
import java.io.BufferedReader;
import java.io.IOException;
@@ -65,7 +64,7 @@
// Text manipulation
public String getText(Interval interval);
public void insertText(int position, String content, @Nullable Anchor[] anchors);
- public void replaceText(Interval interval, String content, Anchor[] anchors);
+ public void replaceText(Interval interval, String content, @Nullable Anchor[] anchors);
public void remove(Interval interval);
@@ -104,7 +103,7 @@
public ActionMap getActionMap();
public Finder getFinder();
- public Finder newFinder(Interval scope, String searchFor, Finder.Options options);
+ public Finder newFinder(@Nullable Interval scope, String searchFor, Finder.Options options);
public void undo();
@@ -582,7 +582,7 @@ public void scrollTo(int position, ScrollAlignment scrollAlignment) {
try {
Rectangle re = this.textComponent.modelToView(position);
if (scrollAlignment == ScrollAlignment.MIDDLE)
- re.translate(0, this.textComponent.getVisibleRect().height / 2);
+ re.translate(0, - this.textComponent.getVisibleRect().height / 2);
JViewport jvp = (JViewport) this.textComponent.getParent();
jvp.setViewPosition(re.getLocation());
} catch (BadLocationException e) {
@@ -46,6 +46,7 @@ public Interval forward(int position) {
Interval interval = findForward(position);
if (interval != null) {
buffer.setSelection(interval);
+ buffer.scrollTo(interval.getStart(), Buffer.ScrollAlignment.MIDDLE);
}
return interval;
@@ -55,6 +56,7 @@ public Interval backward(int position) {
Interval interval = findBackward(position);
if (interval != null) {
buffer.setSelection(interval);
+ buffer.scrollTo(interval.getStart(), Buffer.ScrollAlignment.MIDDLE);
}
return interval;

0 comments on commit 3ff3e10

Please sign in to comment.