1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-09 22:24:14 +03:00

Fix indent and typos on FindReplace.java

This commit is contained in:
Cristian Maglie
2014-07-25 12:10:42 +02:00
parent cd75cc24a2
commit 82401c84bb

View File

@@ -44,6 +44,7 @@ import javax.swing.*;
* <A HREF="http://dev.processing.org/bugs/show_bug.cgi?id=244"> Bug 244</A>
* should anyone have clues about how to fix.
*/
@SuppressWarnings("serial")
public class FindReplace extends JFrame implements ActionListener {
static final int EDGE = Base.isMacOS() ? 20 : 13;
@@ -77,37 +78,31 @@ public class FindReplace extends JFrame implements ActionListener {
setResizable(false);
this.editor = editor;
FlowLayout searchLayout = new FlowLayout(FlowLayout.RIGHT,5,0);
Container pain = getContentPane();
pain.setLayout(searchLayout);
Container pane = getContentPane();
pane.setLayout(searchLayout);
JLabel findLabel = new JLabel(_("Find:"));
JLabel replaceLabel = new JLabel(_("Replace with:"));
Dimension labelDimension = replaceLabel.getPreferredSize();
JPanel find = new JPanel();
find.add(findLabel);
find.add(findField = new JTextField(20));
pain.add(find);
pane.add(find);
JPanel replace = new JPanel();
replace.add(replaceLabel);
replace.add(replaceField = new JTextField(20));
pain.add(replace);
pane.add(replace);
int fieldHeight = findField.getPreferredSize().height;
JPanel checkbox = new JPanel();
// Fill the findString with selected text if no previous value
if(editor.getSelectedText()!=null && editor.getSelectedText().length()>0)
if (editor.getSelectedText() != null &&
editor.getSelectedText().length() > 0)
findString = editor.getSelectedText();
if (findString != null) findField.setText(findString);
@@ -142,10 +137,9 @@ public class FindReplace extends JFrame implements ActionListener {
searchAllFilesBox.setSelected(searchAllFiles);
checkbox.add(searchAllFilesBox);
pain.add(checkbox);
pane.add(checkbox);
JPanel buttons = new JPanel();
buttons.setLayout(new FlowLayout(FlowLayout.CENTER, BUTTONGAP, 0));
// ordering is different on mac versus pc
@@ -163,7 +157,7 @@ public class FindReplace extends JFrame implements ActionListener {
buttons.add(replaceButton = new JButton(_("Replace")));
buttons.add(replaceAllButton = new JButton(_("Replace All")));
}
pain.add(buttons);
pane.add(buttons);
// to fix ugliness.. normally macosx java 1.3 puts an
// ugly white border around this object, so turn it off.
@@ -370,32 +364,27 @@ public class FindReplace extends JFrame implements ActionListener {
if (nextIndex == -1) {
// Nothing found on this tab: Search other tabs if required
if(searchTabs)
{
if (searchTabs) {
// editor.
Sketch sketch = editor.getSketch();
if(sketch.getCodeCount()>1)
{
if (sketch.getCodeCount() > 1) {
int realCurrentTab = sketch.getCodeIndex(sketch.getCurrentCode());
if(originTab!=realCurrentTab)
{
if (originTab != realCurrentTab) {
if (originTab < 0)
originTab = realCurrentTab;
if (!wrap)
if((!backwards && realCurrentTab+1 >= sketch.getCodeCount()) || (backwards && realCurrentTab-1 < 0))
if ((!backwards && realCurrentTab + 1 >= sketch.getCodeCount()) ||
(backwards && realCurrentTab - 1 < 0))
return false; // Can't continue without wrap
if(backwards)
{
if (backwards) {
sketch.handlePrevCode();
this.setVisible(true);
int l = editor.getText().length() - 1;
editor.setSelection(l, l);
}
else
{
} else {
sketch.handleNextCode();
this.setVisible(true);
editor.setSelection(0, 0);
@@ -428,7 +417,8 @@ public class FindReplace extends JFrame implements ActionListener {
return;
int newpos = editor.getSelectionStart() - findField.getText().length();
if (newpos < 0) newpos = 0;
if (newpos < 0)
newpos = 0;
editor.setSelection(newpos, newpos);
boolean foundAtLeastOne = false;