From a3f855f205682c2831a26019e12d6334a439a37e Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Sun, 17 Aug 2014 21:06:09 +0530 Subject: [PATCH 1/6] Added pref option for import statements suggestion --- app/src/processing/app/PreferencesFrame.java | 12 ++++++++++++ app/src/processing/app/languages/PDE.properties | 1 + 2 files changed, 13 insertions(+) diff --git a/app/src/processing/app/PreferencesFrame.java b/app/src/processing/app/PreferencesFrame.java index 6ab7942ac..949e7b851 100644 --- a/app/src/processing/app/PreferencesFrame.java +++ b/app/src/processing/app/PreferencesFrame.java @@ -425,7 +425,16 @@ public class PreferencesFrame { right = Math.max(right, toggleLeft + d.width); top += d.height + GUI_BETWEEN; + // [ ] Show import suggestions - PDE X + importSuggestionsBox = + new JCheckBox(Language.text("preferences.suggest_imports")); + pain.add(importSuggestionsBox); + d = importSuggestionsBox.getPreferredSize(); + importSuggestionsBox.setBounds(left, top, d.width + 10, d.height); + right = Math.max(right, left + d.width); + top += d.height + GUI_BETWEEN; + // [ ] Increase maximum available memory to [______] MB Container memoryBox = Box.createHorizontalBox(); @@ -758,6 +767,8 @@ public class PreferencesFrame { Preferences.setBoolean("pdex.warningsEnabled", warningsCheckerBox.isSelected()); Preferences.setBoolean("pdex.ccEnabled", codeCompletionBox.isSelected()); Preferences.setBoolean("pdex.ccTriggerEnabled", codeCompletionTriggerBox.isSelected()); + Preferences.setBoolean("pdex.importSuggestEnabled", importSuggestionsBox.isSelected()); + for (Editor editor : base.getEditors()) { editor.applyPreferences(); } @@ -772,6 +783,7 @@ public class PreferencesFrame { codeCompletionBox.setSelected(Preferences.getBoolean("pdex.ccEnabled")); codeCompletionTriggerBox.setSelected(Preferences.getBoolean("pdex.ccTriggerEnabled")); codeCompletionTriggerBox.setEnabled(codeCompletionBox.isSelected()); + importSuggestionsBox.setSelected(Preferences.getBoolean("pdex.importSuggestEnabled")); deletePreviousBox. setSelected(Preferences.getBoolean("export.delete_target_folder")); //$NON-NLS-1$ diff --git a/app/src/processing/app/languages/PDE.properties b/app/src/processing/app/languages/PDE.properties index fa80b739d..f10af27c6 100644 --- a/app/src/processing/app/languages/PDE.properties +++ b/app/src/processing/app/languages/PDE.properties @@ -140,6 +140,7 @@ preferences.show_warnings = Show warnings preferences.code_completion = Code completion preferences.trigger_with = Trigger with preferences.cmd_space = space +preferences.suggest_imports = Suggest import statements preferences.increase_max_memory = Increase maximum available memory to preferences.delete_previous_folder_on_export = Delete previous folder on export preferences.hide_toolbar_background_image = Hide tab/toolbar background image From 1e41b8665b2f749f771b173a5c77283570ba64f9 Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Sun, 17 Aug 2014 21:22:19 +0530 Subject: [PATCH 2/6] Final touches to fix #2755 --- .../mode/experimental/CompletionPanel.java | 17 +++++++++++++++-- .../processing/mode/experimental/TextArea.java | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pdex/src/processing/mode/experimental/CompletionPanel.java b/pdex/src/processing/mode/experimental/CompletionPanel.java index 8987690d9..8cf1e1f0c 100644 --- a/pdex/src/processing/mode/experimental/CompletionPanel.java +++ b/pdex/src/processing/mode/experimental/CompletionPanel.java @@ -43,6 +43,7 @@ import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.Painter; import javax.swing.SwingUtilities; +import javax.swing.SwingWorker; import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.plaf.InsetsUIResource; @@ -326,12 +327,12 @@ public class CompletionPanel { } } + boolean mouseClickOnOverloadedMethods = false; if (completionSource == MOUSE_COMPLETION) { // The case of overloaded methods, displayed as 'foo(...)' // They have completion strings as 'foo('. See #2755 if (completionString.endsWith("(")) { - completionString = completionString.substring(0, completionString - .length() - 1); + mouseClickOnOverloadedMethods = true; } } @@ -365,6 +366,18 @@ public class CompletionPanel { } else { hide(); } + + if(mouseClickOnOverloadedMethods) { + // See #2755 + SwingWorker worker = new SwingWorker() { + protected Object doInBackground() throws Exception { + editor.ta.fetchPhrase(null); + return null; + } + }; + worker.execute(); + } + return true; } catch (BadLocationException e1) { e1.printStackTrace(); diff --git a/pdex/src/processing/mode/experimental/TextArea.java b/pdex/src/processing/mode/experimental/TextArea.java index 3c7f4d345..87198bf6e 100644 --- a/pdex/src/processing/mode/experimental/TextArea.java +++ b/pdex/src/processing/mode/experimental/TextArea.java @@ -360,7 +360,7 @@ public class TextArea extends JEditTextArea { * @param evt - the KeyEvent which triggered this method * @return */ - private String fetchPhrase(KeyEvent evt) { + public String fetchPhrase(KeyEvent evt) { int off = getCaretPosition(); log2("off " + off); From 17184df4af3e31a26f3d143ddbfe4f3af59ff6cd Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Sun, 17 Aug 2014 10:38:14 -0700 Subject: [PATCH 3/6] Fixes processing/processing-docs#104 by hiding PFont and PGraphics constructors from reference --- core/src/processing/core/PFont.java | 16 +++++++++++----- core/src/processing/core/PGraphics.java | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index beec7259f..93da11884 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -165,7 +165,9 @@ public class PFont implements PConstants { /** for subclasses that need to store metadata about the font */ // protected HashMap cacheMap; - + /** + * @nowebref + */ public PFont() { } // for subclasses @@ -186,7 +188,7 @@ public class PFont implements PConstants { * * ( end auto-generated ) * - * @webref typography:pfont + * @nowebref * @param font font the font object to create from * @param smooth smooth true to enable smoothing/anti-aliasing */ @@ -199,6 +201,7 @@ public class PFont implements PConstants { * Create a new image-based font on the fly. If charset is set to null, * the characters will only be created as bitmaps when they're drawn. * + * @nowebref * @param charset array of all unicode chars that should be included */ public PFont(Font font, boolean smooth, char charset[]) { @@ -323,15 +326,18 @@ public class PFont implements PConstants { /** * Adds an additional parameter that indicates the font came from a file, * not a built-in OS font. + * + * @nowebref */ public PFont(Font font, boolean smooth, char charset[], boolean stream) { this(font, smooth, charset); this.stream = stream; } -/** - * @param input InputStream - */ + /** + * @nowebref + * @param input InputStream + */ public PFont(InputStream input) throws IOException { DataInputStream is = new DataInputStream(input); diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 2d9d5df9f..b2552442a 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -680,6 +680,7 @@ public class PGraphics extends PImage implements PConstants { * as the first line of a subclass' constructor to properly set * the internal fields and defaults. * + * @nowebref */ public PGraphics() { } From 36898624d0496a45716326e2abd0a44e62b0615d Mon Sep 17 00:00:00 2001 From: Daniel Shiffman Date: Sun, 17 Aug 2014 22:19:36 -0400 Subject: [PATCH 4/6] adding missing method re #2797 --- .../libraries/sound/src/processing/sound/MethClaInterface.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/libraries/sound/src/processing/sound/MethClaInterface.java b/java/libraries/sound/src/processing/sound/MethClaInterface.java index bb1a7d4c7..c2c2a6b1c 100644 --- a/java/libraries/sound/src/processing/sound/MethClaInterface.java +++ b/java/libraries/sound/src/processing/sound/MethClaInterface.java @@ -7,6 +7,9 @@ public class MethClaInterface System.loadLibrary("MethClaInterface"); } // Functions I want + + public native int[] mixPlay(int[] input, float[] amp); + // Engine From 9fabe7cfafb0b8e1a6764f88e9b0dfa37dd1cd35 Mon Sep 17 00:00:00 2001 From: Wilm Thoben Date: Mon, 18 Aug 2014 09:37:27 -0700 Subject: [PATCH 5/6] Update Engine.java missing mix method fix --- java/libraries/sound/src/processing/sound/Engine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/libraries/sound/src/processing/sound/Engine.java b/java/libraries/sound/src/processing/sound/Engine.java index c03ca63e0..b650b4c3e 100644 --- a/java/libraries/sound/src/processing/sound/Engine.java +++ b/java/libraries/sound/src/processing/sound/Engine.java @@ -220,7 +220,7 @@ public class Engine { // Mix public static int[] mixPlay(int[] input, float[] amp){ - return methCla.mixPlay(input, amp); + // return methCla.mixPlay(input, amp); }; // Amplitude Follower @@ -269,4 +269,4 @@ public class Engine { private void welcome() { System.out.println("processing.sound v.09 by Wilm Thoben"); } -} \ No newline at end of file +} From 91679d072f7019824ff80a16dc8a76366f7a4ade Mon Sep 17 00:00:00 2001 From: REAS Date: Mon, 18 Aug 2014 15:49:53 -0700 Subject: [PATCH 6/6] Change to Sound library to re-enable building the project --- java/libraries/sound/src/processing/sound/Engine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/libraries/sound/src/processing/sound/Engine.java b/java/libraries/sound/src/processing/sound/Engine.java index b650b4c3e..95b75eea6 100644 --- a/java/libraries/sound/src/processing/sound/Engine.java +++ b/java/libraries/sound/src/processing/sound/Engine.java @@ -220,7 +220,7 @@ public class Engine { // Mix public static int[] mixPlay(int[] input, float[] amp){ - // return methCla.mixPlay(input, amp); + return methCla.mixPlay(input, amp); }; // Amplitude Follower