diff --git a/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java b/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java
index 40b3d7ca2..4dced3a83 100644
--- a/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java
+++ b/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletePopupWindow.java
@@ -10,6 +10,7 @@
package com.fr.design.gui.autocomplete;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.PopupWindowDecorator;
+import com.fr.general.FRLogger;
import javax.swing.*;
import javax.swing.event.CaretEvent;
@@ -301,7 +302,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
private void installKeyBindings() {
if (AutoCompletion.isDebug()) {
- System.out.println("PopupWindow: Installing keybindings");
+ FRLogger.getLogger().debug("PopupWindow: Installing keybindings");
}
if (escapeKap == null) { // Lazily create actions.
@@ -386,15 +387,16 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
// Try to position to the right first (LTR)
int x;
+ int dis = 5;
if (ac.getTextComponentOrientation().isLeftToRight()) {
- x = getX() + getWidth() + 5;
+ x = getX() + getWidth() + dis;
if (x + descWindow.getWidth() > screenBounds.x + screenBounds.width) { // doesn't fit
- x = getX() - 5 - descWindow.getWidth();
+ x = getX() - dis - descWindow.getWidth();
}
} else { // RTL
- x = getX() - 5 - descWindow.getWidth();
+ x = getX() - dis - descWindow.getWidth();
if (x < screenBounds.x) { // Doesn't fit
- x = getX() + getWidth() + 5;
+ x = getX() + getWidth() + dis;
}
}
@@ -709,7 +711,7 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
private void uninstallKeyBindings() {
if (AutoCompletion.isDebug()) {
- System.out.println("PopupWindow: Removing keybindings");
+ FRLogger.getLogger().debug("PopupWindow: Removing keybindings");
}
JTextComponent comp = ac.getTextComponent();
diff --git a/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java b/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java
index d5447880b..fb5f2b763 100644
--- a/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java
+++ b/designer_base/src/com/fr/design/gui/autocomplete/AutoCompletion.java
@@ -277,7 +277,7 @@ public class AutoCompletion {
* @return Whether to auto-complete single choices.
* @see #setAutoCompleteSingleChoices(boolean)
*/
- public boolean getAutoCompleteSingleChoices() {
+ public boolean isAutoCompleteSingleChoices() {
return autoCompleteSingleChoices;
}
@@ -730,7 +730,7 @@ public class AutoCompletion {
private boolean needSetPopupWindow(int count, int textLen) {
return (count == 1 && (isPopupVisible() || textLen == 0))
- || (count == 1 && !getAutoCompleteSingleChoices())
+ || (count == 1 && !isAutoCompleteSingleChoices())
|| count > 1;
}
@@ -809,7 +809,7 @@ public class AutoCompletion {
* be automatically inserted, without displaying the popup menu.
*
* @param autoComplete Whether to auto-complete single choices.
- * @see #getAutoCompleteSingleChoices()
+ * @see #isAutoCompleteSingleChoices()
*/
public void setAutoCompleteSingleChoices(boolean autoComplete) {
autoCompleteSingleChoices = autoComplete;
diff --git a/designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java b/designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
index 966035b89..11bab3a7e 100644
--- a/designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
+++ b/designer_base/src/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
@@ -14,6 +14,7 @@ import com.fr.design.gui.autocomplete.ParameterizedCompletionInsertionInfo.Repla
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.DocumentRange;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rtextarea.ChangeableHighlightPainter;
+import com.fr.general.FRLogger;
import javax.swing.*;
import javax.swing.event.CaretEvent;
@@ -254,7 +255,7 @@ class ParameterizedCompletionContext {
*
* @param offs The offset into the document.
* @return The text of the parameter containing the offset, or
- * null
if the offset is not in a parameter.
+ * null
if the offset is not in a parameter.
*/
public String getArgumentText(int offs) {
List paramHighlights = getParameterHighlights();
@@ -284,7 +285,7 @@ class ParameterizedCompletionContext {
* Returns the highlight of the current parameter.
*
* @return The current parameter's highlight, or null
if
- * the caret is not in a parameter's bounds.
+ * the caret is not in a parameter's bounds.
* @see #getCurrentParameterStartOffset()
*/
private Highlight getCurrentParameterHighlight() {
@@ -332,7 +333,7 @@ class ParameterizedCompletionContext {
* Returns the starting offset of the current parameter.
*
* @return The current parameter's starting offset, or -1
if
- * the caret is not in a parameter's bounds.
+ * the caret is not in a parameter's bounds.
* @see #getCurrentParameterHighlight()
*/
private int getCurrentParameterStartOffset() {
@@ -407,7 +408,7 @@ class ParameterizedCompletionContext {
* Inserts the choice selected in the parameter choices window.
*
* @return Whether the choice was inserted. This will be false
- * if the window is not visible, or no choice is selected.
+ * if the window is not visible, or no choice is selected.
*/
boolean insertSelectedChoice() {
if (paramChoicesWindow != null && paramChoicesWindow.isVisible()) {
@@ -438,11 +439,9 @@ class ParameterizedCompletionContext {
* @see #uninstallKeyBindings()
*/
private void installKeyBindings() {
-
if (AutoCompletion.isDebug()) {
- System.out.println("CompletionContext: Installing keybindings");
+ FRLogger.getLogger().debug("CompletionContext: Installing keybindings");
}
-
JTextComponent tc = ac.getTextComponent();
InputMap im = tc.getInputMap();
ActionMap am = tc.getActionMap();
@@ -489,7 +488,6 @@ class ParameterizedCompletionContext {
im.put(ks, IM_KEY_CLOSING);
oldClosingAction = am.get(IM_KEY_CLOSING);
am.put(IM_KEY_CLOSING, new ClosingAction());
-
}
@@ -513,12 +511,7 @@ class ParameterizedCompletionContext {
List highlights = getParameterHighlights();
for (int i = 0; i < highlights.size(); i++) {
Highlight hl = highlights.get(i);
- // Check "< dot", not "<= dot" as OutlineHighlightPainter paints
- // starting at one char AFTER the highlight starts, to work around
- // Java issue. Thanks to Matthew Adereth!
- if (currentNext == null || currentNext.getStartOffset() *=*/dot ||
- (hl.getStartOffset() > dot &&
- hl.getStartOffset() <= currentNext.getStartOffset())) {
+ if (needUpdate(currentNext, hl, dot)) {
currentNext = hl;
pos = i;
}
@@ -538,6 +531,15 @@ class ParameterizedCompletionContext {
}
+ private boolean needUpdate(Highlight currentNext, Highlight hl, int dot) {
+ // Check "< dot", not "<= dot" as OutlineHighlightPainter paints
+ // starting at one char AFTER the highlight starts, to work around
+ // Java issue. Thanks to Matthew Adereth!
+ return currentNext == null || currentNext.getStartOffset() *=*/dot ||
+ (hl.getStartOffset() > dot &&
+ hl.getStartOffset() <= currentNext.getStartOffset());
+ }
+
/**
* Moves to and selects the previous parameter.
@@ -562,10 +564,7 @@ class ParameterizedCompletionContext {
for (int i = 0; i < highlights.size(); i++) {
Highlight h = highlights.get(i);
- if (currentPrev == null || currentPrev.getStartOffset() >= dot ||
- (h.getStartOffset() < selStart &&
- (h.getStartOffset() > currentPrev.getStartOffset() ||
- pos == lastSelectedParam))) {
+ if (pos == lastSelectedParam || needUpdate(currentPrev, dot, h, selStart)) {
currentPrev = h;
pos = i;
}
@@ -593,6 +592,12 @@ class ParameterizedCompletionContext {
}
+ private boolean needUpdate(Highlight currentPrev, int dot, Highlight h, int selStart) {
+ return currentPrev == null
+ || currentPrev.getStartOffset() >= dot
+ || (currentPrev.getStartOffset() < h.getStartOffset() && h.getStartOffset() < selStart);
+ }
+
private void possiblyUpdateParamCopies(Document doc) {
@@ -616,7 +621,7 @@ class ParameterizedCompletionContext {
try {
replacement = doc.getText(start, len);
} catch (BadLocationException ble) {
- // Never happens
+ // Never happens
}
// Replace any param copies tracking this parameter with the
@@ -718,7 +723,7 @@ class ParameterizedCompletionContext {
return h;
} catch (BadLocationException ble) {
- // Never happens
+ // Never happens
}
return null;
@@ -734,7 +739,7 @@ class ParameterizedCompletionContext {
private void uninstallKeyBindings() {
if (AutoCompletion.isDebug()) {
- System.out.println("CompletionContext Uninstalling keybindings");
+ FRLogger.getLogger().debug("CompletionContext Uninstalling keybindings");
}
JTextComponent tc = ac.getTextComponent();
@@ -1037,7 +1042,6 @@ class ParameterizedCompletionContext {
* @see #uninstall()
*/
public void install(JTextComponent tc) {
-
boolean replaceTabs = false;
if (tc instanceof RSyntaxTextArea) {
RSyntaxTextArea textArea = (RSyntaxTextArea) tc;
@@ -1047,14 +1051,10 @@ class ParameterizedCompletionContext {
}
Highlighter h = tc.getHighlighter();
-
try {
-
// Insert the parameter text
- ParameterizedCompletionInsertionInfo info =
- pc.getInsertionInfo(tc, replaceTabs);
+ ParameterizedCompletionInsertionInfo info = pc.getInsertionInfo(tc, replaceTabs);
tc.replaceSelection(info.getTextToInsert());
-
// Add highlights around the parameters.
final int replacementCount = info.getReplacementCount();
for (int i = 0; i < replacementCount; i++) {
@@ -1067,40 +1067,31 @@ class ParameterizedCompletionContext {
for (int i = 0; i < info.getReplacementCopyCount(); i++) {
ReplacementCopy rc = info.getReplacementCopy(i);
paramCopyInfos.add(new ParamCopyInfo(rc.getId(),
- (Highlight) h.addHighlight(rc.getStart(), rc.getEnd(),
- paramCopyP)));
+ (Highlight) h.addHighlight(rc.getStart(), rc.getEnd(), paramCopyP)));
}
-
// Go back and start at the first parameter.
tc.setCaretPosition(info.getSelectionStart());
if (info.hasSelection()) {
tc.moveCaretPosition(info.getSelectionEnd());
}
-
minPos = info.getMinOffset();
maxPos = info.getMaxOffset();
try {
- defaultEndOffs = tc.getDocument().createPosition(
- info.getDefaultEndOffs());
+ defaultEndOffs = tc.getDocument().createPosition(info.getDefaultEndOffs());
} catch (BadLocationException ble) {
- // Never happens
+ // Never happens
}
-
// Listen for document events AFTER we insert
tc.getDocument().addDocumentListener(this);
-
} catch (BadLocationException ble) {
- // Never happens
+ // Never happens
}
-
// Add listeners to the text component, AFTER text insertion.
tc.addCaretListener(this);
tc.addFocusListener(this);
installKeyBindings();
-
}
-
public void removeUpdate(DocumentEvent e) {
handleDocumentEvent(e);
}
diff --git a/designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java b/designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
index ba7752352..8bb2f7b05 100644
--- a/designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
+++ b/designer_base/src/com/fr/design/gui/itabpane/UITabsHeaderIconPane.java
@@ -10,6 +10,7 @@ import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import javax.swing.AbstractAction;
@@ -145,9 +146,7 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
private void show(final JPanel panel) {
int count = centerPane.getComponentCount();// 获取centerPanel中控件数
List list = new ArrayList();//
- for (Component comp : centerPane.getComponents()) {
- list.add(comp);
- }
+ list.addAll(Arrays.asList(centerPane.getComponents()));
if (count > 0) {// 如果centerPanel中控件数大于0就执行效果
for (int i = 0; i < count; i++) {
Component comp = centerPane.getComponent(i);// 获得该位置的控件
@@ -160,14 +159,12 @@ public class UITabsHeaderIconPane extends JPanel implements UITabComponent {
public void run() {
int height = centerPane.getHeight();
int width = centerPane.getWidth();
- int step = 30;
- int x = 0;
int y = -height;
- for (int i = 0; i <= height; i += step) {
+ for (int i = 0; i <= height; i += 30) {
// 设置面板位置
- currentPanel.setBounds(x, i, width, height);
- panel.setBounds(x, y, width, height);
- y += step;
+ currentPanel.setBounds(0, i, width, height);
+ panel.setBounds(0, y, width, height);
+ y += 30;
try {
Thread.sleep(3);
} catch (InterruptedException e) {