From 6992ac56a3cb7641c00d3f99cbafb4ee7d502021 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Wed, 6 Aug 2014 16:36:38 -0400 Subject: [PATCH 01/11] todo items --- todo.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/todo.txt b/todo.txt index cc4c1dd75..8ebd3ceac 100644 --- a/todo.txt +++ b/todo.txt @@ -5,6 +5,8 @@ X split Preferences and PreferencesFrame X https://github.com/processing/processing/issues/68 X http://code.google.com/p/processing/issues/detail?id=29 X https://github.com/processing/processing/pull/2716 +X shouldn't write sketch.properties unless it's a non-default mode +X https://github.com/processing/processing/issues/2531 _ Fix OS X menu to be the same order as the other File menu _ remove toolbar menu references and code to rebuild @@ -18,6 +20,10 @@ X temp folders not always deleting X https://github.com/processing/processing/issues/2606 X problem when removing a mode X https://github.com/processing/processing/issues/2507 +X autocompletion dialog box sticking +X https://github.com/processing/processing/issues/2741 +X Line warning indicators next to scrollbar break after moving around text +X https://github.com/processing/processing/issues/2655 _ remove dependency on oscp5 library for tweak mode _ https://github.com/processing/processing/issues/2730 @@ -46,6 +52,11 @@ X Add thread names for easier debugging and profiling X https://github.com/processing/processing/pull/2729 X Add missing translations for OS X menu X https://github.com/processing/processing/pull/2726 +X fix firstLine when modifying lines above it +X https://github.com/processing/processing/issues/2654 +X https://github.com/processing/processing/pull/2674 +X Style completion panel when using Nimbus LAF +X https://github.com/processing/processing/pull/2718 languages X Japanese https://github.com/processing/processing/pull/2688 @@ -55,6 +66,7 @@ X French https://github.com/processing/processing/pull/2695 X Portugese https://github.com/processing/processing/pull/2701 X Korean https://github.com/processing/processing/commit/7b60e2ded9ca81f6a5a08a818aaf84ee4bb029e3 X Turkish https://github.com/processing/processing/pull/2740 +X Chinese https://github.com/processing/processing/pull/2748 earlier X repo cleanup @@ -93,8 +105,6 @@ _ IllegalArgumentException when clicking between editor windows _ https://github.com/processing/processing/issues/2530 _ "String index out of range" error _ https://github.com/processing/processing/issues/1940 -_ shouldn't write sketch.properties unless it's a non-default mode -_ https://github.com/processing/processing/issues/2531 _ closing the color selector makes things freeze (only Linux and Windows?) _ https://github.com/processing/processing/issues/2381 _ move sketchbook into its own window From 5efffa923fcd7727442b8f0ac4231b8163cac3e5 Mon Sep 17 00:00:00 2001 From: AmnonOwed Date: Wed, 6 Aug 2014 23:21:16 +0200 Subject: [PATCH 02/11] Add new localization Strings for Dutch language --- .../app/languages/PDE_nl.properties | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/app/src/processing/app/languages/PDE_nl.properties b/app/src/processing/app/languages/PDE_nl.properties index 23c182c2b..f3b825ea9 100644 --- a/app/src/processing/app/languages/PDE_nl.properties +++ b/app/src/processing/app/languages/PDE_nl.properties @@ -14,6 +14,7 @@ menu.file = Bestand menu.file.new = Nieuw menu.file.open = Openen... menu.file.sketchbook = Schetsboek +menu.file.sketchbook.empty = Leeg Schetsboek menu.file.recent = Recent menu.file.examples = Voorbeelden... menu.file.close = Sluiten @@ -117,11 +118,20 @@ preferences = Instellingen preferences.button.width = 90 preferences.requires_restart = herstart van Processing vereist preferences.sketchbook_location = Schetsboek locatie +preferences.sketchbook_location.popup = Schetsboek locatie preferences.language = Taal preferences.editor_and_console_font = Editor en Console lettertype +preferences.editor_and_console_font.tip = \ +Selecteer het gebruikte lettertype in de Editor en de Console.
\ +Alleen monospace lettertypes (dezelfde breedte voor elk karakter)
\ +mogen gebruikt worden, ook al is de lijst wellicht niet geheel correct. preferences.editor_font_size = Editor lettergrootte preferences.console_font_size = Console lettergrootte preferences.background_color = Achtergrond kleur in Presenteer modus +preferences.background_color.tip = \ +Selecteer de achtergrond kleur in Presenteer modus.
\ +De Presenteer modus (te vinden in het Schets menu) wordt gebruikt
\ +om een schets op het volledige scherm te tonen. preferences.use_smooth_text = Gebruik duidelijke tekst in Editor venster preferences.enable_complex_text_input = Complexe tekstkarakters mogelijk maken preferences.enable_complex_text_input_example = i.e. Japans @@ -149,6 +159,13 @@ preferences.file.hint = alleen aanpassen wanneer Processing niet actief is # Sketchbook Location (Frame) sketchbook_location = Selecteer nieuwe schetsboek locatie +# Sketchbook (Frame) +sketchbook = Schetsboek +sketchbook.tree = Schetsboek + +# examples (Frame) +examples = Examples + # Export (Frame) export = Exporteer Opties export.platforms = Platforms @@ -213,9 +230,80 @@ editor.header.next_tab = Volgende Tabblad editor.header.delete.warning.title = Waarschuwing editor.header.delete.warning.text = U kunt het laatste tabblad van de laatst geopende schets niet verwijderen. +# Tabs +editor.tab.new = Nieuwe Naam +editor.tab.new.description = Naam voor nieuw bestand +editor.tab.rename = Nieuwe Naam +editor.tab.rename.description = Nieuwe naam voor bestand + +# Sketch +editor.sketch.rename.description = Nieuwe naam voor schets + +editor.status.autoformat.no_changes = Geen wijzigingen nodig voor Automatische Opmaak. +editor.status.autoformat.finished = Automatische Opmaak gereed. +editor.status.find_reference.select_word_first = Selecteer eerst een woord om te zoeken in de handleiding. +editor.status.find_reference.not_available = Geen handleiding beschikbaar voor "%s". +editor.status.drag_and_drop.files_added.0 = Er zijn geen bestanden toegevoegd aan de schets. +editor.status.drag_and_drop.files_added.1 = Een bestand toegevoegd aan de schets. +editor.status.drag_and_drop.files_added.n = %d bestanden toegevoegd aan de schets. +editor.status.saving = Bezig met opslaan... +editor.status.saving.done = Opslaan gereed. +editor.status.saving.canceled = Opslaan geannuleerd. +editor.status.printing = Bezig met printen... +editor.status.printing.done = Printen gereed. +editor.status.printing.error = Fout tijdens het printen. +editor.status.printing.canceled = Printen geannuleerd. + # --------------------------------------- # Contribution Panel +contrib = Bijdragen Manager contrib.category = Categorie: contrib.filter_your_search = Filter zoekresultaten... +contrib.restart = Processing herstarten +contrib.unsaved_changes = Niet opgeslagen wijzigingen gevonden +contrib.unsaved_changes.prompt = Weet u zeker dat u Processing wil herstarten zonder eerst op te slaan? +contrib.messages.remove_restart = Herstart Processing om het verwijderen van dit item te voltooien. +contrib.messages.install_restart = Herstart Processing om het installeren van dit item te voltooien. +contrib.messages.update_restart = Herstart Processing om het updaten van dit item te voltooien. +contrib.errors.list_download = De lijst met beschikbare bijdragen kon niet worden gedownload. +contrib.errors.list_download.timeout = Verbinding time out bij het downloaden van de lijst met bijdragen. +contrib.errors.download_and_install = Fout bij het downloaden en installeren. +contrib.errors.description_unavailable = Beschrijving niet beschikbaar. +contrib.errors.malformed_url = "De van Processing.org verkregen link is niet correct.\nU kunt nog steeds de bibliotheek handmatig installeren door\nde website van de bibliotheek te bezoeken +contrib.errors.needs_repackage = %s moet opnieuw worden ingepakt volgens de %s richtlijnen. +contrib.errors.no_contribution_found = Kan geen %s vinden in het gedownloade bestand. +contrib.errors.overwriting_properties = Fout bij het overschrijven van het .properties bestand. +contrib.errors.install_failed = Installatie mislukt. +contrib.errors.update_on_restart_failed = Update bij herstart van %s mislukt. +contrib.errors.temporary_directory = Kan niet schrijven naar een tijdelijke map. +contrib.all = Alles +contrib.undo = Ongedaan maken +contrib.remove = Verwijderen +contrib.install = Installeren +contrib.progress.installing = Bezig met installeren +contrib.progress.starting = Bezig met starten +contrib.progress.downloading = Bezig met downloaden +contrib.download_error = Fout bij het downloaden van de bijdrage. +contrib.unsupported_operating_system = Uw besturingssyteem wordt schijnbaar niet ondersteund. U kunt de website van de %s bibliotheek bezoeken voor meer informatie. + + +# --------------------------------------- +# Warnings + +warn.delete = Verwijderen +warn.delete.sketch = Weet u zeker dat u deze schets wil verwijderen? +warn.delete.file = Weet u zeker dat u "%s" wil verwijderen? + + +# --------------------------------------- +# Update Check +update_check = Update +update_check.updates_available.core = Een nieuwe versie van Processing is beschikbaar,\nwilt u de Processing download pagina bezoeken? +update_check.updates_available.contributions = Er zijn updates beschikbaar voor sommige van de door u geïnstalleerde bijdragen,\nwilt u nu de Bijdragen Manager openen? + + +# --------------------------------------- +# Color Chooser +color_chooser = Kies een kleur... From 38a35ec8db9c63927910847247f646725422beee Mon Sep 17 00:00:00 2001 From: AmnonOwed Date: Wed, 6 Aug 2014 23:25:40 +0200 Subject: [PATCH 03/11] Finetune Dutch language file --- app/src/processing/app/languages/PDE_nl.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/languages/PDE_nl.properties b/app/src/processing/app/languages/PDE_nl.properties index f3b825ea9..61931278c 100644 --- a/app/src/processing/app/languages/PDE_nl.properties +++ b/app/src/processing/app/languages/PDE_nl.properties @@ -249,10 +249,10 @@ editor.status.drag_and_drop.files_added.n = %d bestanden toegevoegd aan de schet editor.status.saving = Bezig met opslaan... editor.status.saving.done = Opslaan gereed. editor.status.saving.canceled = Opslaan geannuleerd. -editor.status.printing = Bezig met printen... -editor.status.printing.done = Printen gereed. -editor.status.printing.error = Fout tijdens het printen. -editor.status.printing.canceled = Printen geannuleerd. +editor.status.printing = Bezig met afdrukken... +editor.status.printing.done = Afdrukken gereed. +editor.status.printing.error = Fout tijdens het afdrukken. +editor.status.printing.canceled = Afdrukken geannuleerd. # --------------------------------------- From 3915f48f5b79646375fc9a25716060b4407685c3 Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Thu, 7 Aug 2014 11:08:41 +0530 Subject: [PATCH 04/11] Fixes #2753 --- .../mode/experimental/TextArea.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pdex/src/processing/mode/experimental/TextArea.java b/pdex/src/processing/mode/experimental/TextArea.java index c02babfca..a7ed964ae 100644 --- a/pdex/src/processing/mode/experimental/TextArea.java +++ b/pdex/src/processing/mode/experimental/TextArea.java @@ -193,7 +193,6 @@ public class TextArea extends JEditTextArea { log("BK Key"); break; case KeyEvent.VK_SPACE: - System.out.println("space: " + evt); if (suggestion != null) if (suggestion.isVisible()) { log("Space bar, hide completion list"); @@ -231,11 +230,8 @@ public class TextArea extends JEditTextArea { if (ExperimentalMode.codeCompletionsEnabled && ExperimentalMode.ccTriggerEnabled) { getDocument().remove(getCaretPosition() - 1, 1); // Remove the typed space - log("[KeyEvent]" + evt2.getKeyChar() - + " |Prediction started: " + System.currentTimeMillis()); - log("Typing: " + fetchPhrase(evt2) + " " - + (evt2.getKeyChar() == KeyEvent.VK_ENTER) + " T: " - + System.currentTimeMillis()); + log("[KeyEvent]" + evt2.getKeyChar() + " |Prediction started"); + log("Typing: " + fetchPhrase(evt2)); } return null; } @@ -253,11 +249,8 @@ public class TextArea extends JEditTextArea { // Provide completions only if it's enabled if (ExperimentalMode.codeCompletionsEnabled && (!ExperimentalMode.ccTriggerEnabled || suggestion.isVisible())) { - log("[KeyEvent]" + evt2.getKeyChar() + " |Prediction started: " - + System.currentTimeMillis()); - log("Typing: " + fetchPhrase(evt2) + " " - + (evt2.getKeyChar() == KeyEvent.VK_ENTER) + " T: " - + System.currentTimeMillis()); + log("[KeyEvent]" + evt2.getKeyChar() + " |Prediction started"); + log("Typing: " + fetchPhrase(evt2)); } return null; } @@ -361,7 +354,14 @@ public class TextArea extends JEditTextArea { int x = getCaretPosition() - getLineStartOffset(line) - 1, x1 = x - 1; if(x >= s.length() || x < 0) return null; //TODO: Does this check cause problems? Verify. + log2(" x char: " + s.charAt(x)); + + if (!(Character.isLetterOrDigit(s.charAt(x)) || s.charAt(x) == '_')) { + log("Char before caret isn't a letter/digit/_ so no predictions"); + return null; + } + //int xLS = off - getLineStartNonWhiteSpaceOffset(line); String word = (x < s.length() ? s.charAt(x) : "") + ""; From 24365e7deaba8c8c0124d969476bf7f4bbf41c9e Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Thu, 7 Aug 2014 12:01:49 +0530 Subject: [PATCH 05/11] CC dot recognized again --- pdex/src/processing/mode/experimental/TextArea.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdex/src/processing/mode/experimental/TextArea.java b/pdex/src/processing/mode/experimental/TextArea.java index a7ed964ae..7556b4430 100644 --- a/pdex/src/processing/mode/experimental/TextArea.java +++ b/pdex/src/processing/mode/experimental/TextArea.java @@ -357,8 +357,9 @@ public class TextArea extends JEditTextArea { log2(" x char: " + s.charAt(x)); - if (!(Character.isLetterOrDigit(s.charAt(x)) || s.charAt(x) == '_')) { - log("Char before caret isn't a letter/digit/_ so no predictions"); + if (!(Character.isLetterOrDigit(s.charAt(x)) || s.charAt(x) == '_' + || s.charAt(x) == '(' || s.charAt(x) == '.')) { + log("Char before caret isn't a letter/digit/_(. so no predictions"); return null; } From cd5a96785fa357f05cbd81fb598c2a802d3c5ddf Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Thu, 7 Aug 2014 12:58:27 +0530 Subject: [PATCH 06/11] Initial implementation of #2755 --- .../mode/experimental/ASTGenerator.java | 53 +++++++++++++-- .../experimental/CompletionCandidate.java | 66 ++++++++++++++++++- 2 files changed, 111 insertions(+), 8 deletions(-) diff --git a/pdex/src/processing/mode/experimental/ASTGenerator.java b/pdex/src/processing/mode/experimental/ASTGenerator.java index 723ba302c..139436122 100644 --- a/pdex/src/processing/mode/experimental/ASTGenerator.java +++ b/pdex/src/processing/mode/experimental/ASTGenerator.java @@ -1045,13 +1045,14 @@ public class ASTGenerator { if (sketchOutline.isVisible()) return; Collections.sort(candidates); // CompletionCandidate[][] candi = new CompletionCandidate[candidates.size()][1]; - DefaultListModel defListModel = new DefaultListModel(); - - for (int i = 0; i < candidates.size(); i++) { -// candi[i][0] = candidates.get(i); - defListModel.addElement(candidates.get(i)); - } - log("Total preds = " + candidates.size()); +// DefaultListModel defListModel = new DefaultListModel(); +// +// for (int i = 0; i < candidates.size(); i++) { +//// candi[i][0] = candidates.get(i); +// defListModel.addElement(candidates.get(i)); +// } +// log("Total preds = " + candidates.size()); + DefaultListModel defListModel = filterPredictions(); // DefaultTableModel tm = new DefaultTableModel(candi, // new String[] { "Suggestions" }); // if (tableAuto.isVisible()) { @@ -1063,6 +1064,44 @@ public class ASTGenerator { .showSuggestion(defListModel, word); } + private DefaultListModel filterPredictions(){ + DefaultListModel defListModel = new DefaultListModel(); + if (candidates.isEmpty()) + return defListModel; + // check if first & last CompCandidate are the same methods, only then show all overloaded methods + if (candidates.get(0).getElementName() + .equals(candidates.get(candidates.size() - 1).getElementName())) { + log("All CC are methods only: " + candidates.get(0).getElementName()); + for (int i = 0; i < candidates.size(); i++) { + candidates.get(i).regenerateCompletionString(); + defListModel.addElement(candidates.get(i)); + } + } + else { + boolean ignoredSome = false; + for (int i = 0; i < candidates.size(); i++) { + if(i > 0 && (candidates.get(i).getElementName() + .equals(candidates.get(i - 1).getElementName()))){ + if (candidates.get(i).getType() == CompletionCandidate.LOCAL_METHOD + || candidates.get(i).getType() == CompletionCandidate.PREDEF_METHOD) { + CompletionCandidate cc = candidates.get(i - 1); + String label = cc.getLabel(); + int x = label.lastIndexOf(')'); + cc.setLabel(cc.getElementName() + "(...)" + label.substring(x + 1)); + cc.setCompletionString(cc.getElementName()); + ignoredSome = true; + continue; + } + } + defListModel.addElement(candidates.get(i)); + } + if (ignoredSome) { + log("Some suggestions hidden"); + } + } + return defListModel; + } + /** * Loads classes from .jar files in sketch classpath * diff --git a/pdex/src/processing/mode/experimental/CompletionCandidate.java b/pdex/src/processing/mode/experimental/CompletionCandidate.java index cf7ad5c40..44584319f 100644 --- a/pdex/src/processing/mode/experimental/CompletionCandidate.java +++ b/pdex/src/processing/mode/experimental/CompletionCandidate.java @@ -63,7 +63,8 @@ public class CompletionCandidate implements Comparable{ type = LOCAL_FIELD; else type = LOCAL_VAR; - label = svd.getName() + " : " + svd.getType(); + label = svd.getName() + " : " + svd.getType(); + wrappedObject = svd; } public CompletionCandidate(VariableDeclarationFragment vdf) { @@ -74,6 +75,7 @@ public class CompletionCandidate implements Comparable{ else type = LOCAL_VAR; label = vdf.getName() + " : " + ASTGenerator.extracTypeInfo2(vdf); + wrappedObject = vdf; } public CompletionCandidate(MethodDeclaration method) { @@ -100,6 +102,7 @@ public class CompletionCandidate implements Comparable{ cstr.append(")"); this.label = label.toString(); this.completionString = cstr.toString(); + wrappedObject = method; } public CompletionCandidate(TypeDeclaration td){ @@ -107,6 +110,7 @@ public class CompletionCandidate implements Comparable{ elementName = td.getName().toString(); label = elementName; completionString = elementName; + wrappedObject = td; } public CompletionCandidate(Field f) { @@ -148,6 +152,18 @@ public class CompletionCandidate implements Comparable{ public int getType() { return type; } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public void setCompletionString(String completionString) { + this.completionString = completionString; + } public int compareTo(CompletionCandidate cc) { if(type != cc.getType()){ @@ -155,5 +171,53 @@ public class CompletionCandidate implements Comparable{ } return (elementName.compareTo(cc.getElementName())); } + + public void regenerateCompletionString(){ + if(wrappedObject instanceof MethodDeclaration) { + MethodDeclaration method = (MethodDeclaration)wrappedObject; + List params = (List) method + .getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); + StringBuffer label = new StringBuffer(elementName + "("); + StringBuffer cstr = new StringBuffer(method.getName() + "("); + for (int i = 0; i < params.size(); i++) { + label.append(params.get(i).toString()); + if (i < params.size() - 1) { + label.append(","); + cstr.append(","); + } + } + if (params.size() == 1) { + cstr.append(' '); + } + label.append(")"); + if (method.getReturnType2() != null) + label.append(" : " + method.getReturnType2()); + cstr.append(")"); + this.label = label.toString(); + this.completionString = cstr.toString(); + } + else if (wrappedObject instanceof Method) { + Method method = (Method)wrappedObject; + StringBuffer label = new StringBuffer(method.getName() + "("); + StringBuffer cstr = new StringBuffer(method.getName() + "("); + for (int i = 0; i < method.getParameterTypes().length; i++) { + label.append(method.getParameterTypes()[i].getSimpleName()); + if (i < method.getParameterTypes().length - 1) { + label.append(","); + cstr.append(","); + } + } + if(method.getParameterTypes().length == 1) { + cstr.append(' '); + } + label.append(")"); + if(method.getReturnType() != null) + label.append(" : " + method.getReturnType().getSimpleName()); + label.append(" - " + method.getDeclaringClass().getSimpleName()); + cstr.append(")"); + this.label = label.toString(); + this.completionString = cstr.toString(); + } + } } From c55ccf7e7cdf573cd0d339c1c269d984bd189a15 Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Thu, 7 Aug 2014 15:27:22 +0530 Subject: [PATCH 07/11] get rid of warnings --- pdex/src/processing/mode/experimental/CompletionPanel.java | 2 +- pdex/src/processing/mode/experimental/TextArea.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pdex/src/processing/mode/experimental/CompletionPanel.java b/pdex/src/processing/mode/experimental/CompletionPanel.java index 99b98c7e8..9f371b2d3 100644 --- a/pdex/src/processing/mode/experimental/CompletionPanel.java +++ b/pdex/src/processing/mode/experimental/CompletionPanel.java @@ -97,7 +97,7 @@ public class CompletionPanel { * @param dedit */ public CompletionPanel(final JEditTextArea textarea, int position, String subWord, - DefaultListModel items, final Point location, DebugEditor dedit) { + DefaultListModel items, final Point location, DebugEditor dedit) { this.textarea = (TextArea) textarea; editor = dedit; this.insertionPosition = position; diff --git a/pdex/src/processing/mode/experimental/TextArea.java b/pdex/src/processing/mode/experimental/TextArea.java index 7556b4430..c5c8b2066 100644 --- a/pdex/src/processing/mode/experimental/TextArea.java +++ b/pdex/src/processing/mode/experimental/TextArea.java @@ -774,7 +774,7 @@ public class TextArea extends JEditTextArea { * @param defListModel * @param subWord */ - protected void showSuggestion(DefaultListModel defListModel,String subWord) { + protected void showSuggestion(DefaultListModel defListModel,String subWord) { hideSuggestion(); if (defListModel.size() == 0) { log("TextArea: No suggestions to show."); From f220c3d50013e2a7086fdfa44f1fca7e0883cb8e Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Thu, 7 Aug 2014 15:35:17 +0530 Subject: [PATCH 08/11] get rid of warnings in ASTGen --- .../mode/experimental/ASTGenerator.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/pdex/src/processing/mode/experimental/ASTGenerator.java b/pdex/src/processing/mode/experimental/ASTGenerator.java index 139436122..f830dd0a2 100644 --- a/pdex/src/processing/mode/experimental/ASTGenerator.java +++ b/pdex/src/processing/mode/experimental/ASTGenerator.java @@ -629,7 +629,7 @@ public class ASTGenerator { /*The type wasn't found in local code, so it might be something like * System.console()., or maybe belonging to super class, etc. */ - Class tehClass = findClassIfExists(((SimpleName)mi.getExpression()).toString()); + Class tehClass = findClassIfExists(((SimpleName)mi.getExpression()).toString()); if (tehClass != null) { // Method Expression is a simple name and wasn't located locally, but found in a class // so look for method in this class. @@ -643,7 +643,7 @@ public class ASTGenerator { ASTNode typeDec = findDeclaration2(stp.getName(),nearestNode); if(typeDec == null){ log(stp.getName() + " couldn't be found locally.."); - Class tehClass = findClassIfExists(stp.getName().toString()); + Class tehClass = findClassIfExists(stp.getName().toString()); if (tehClass != null) { // Method Expression is a simple name and wasn't located locally, but found in a class // so look for method in this class. @@ -684,7 +684,7 @@ public class ASTGenerator { /*The type wasn't found in local code, so it might be something like * log(), or maybe belonging to super class, etc. */ - Class tehClass = findClassIfExists(qn.getQualifier().toString()); + Class tehClass = findClassIfExists(qn.getQualifier().toString()); if (tehClass != null) { // note how similar thing is called on line 690. Check check. return definedIn3rdPartyClass(new ClassMember(tehClass), qn @@ -699,7 +699,7 @@ public class ASTGenerator { if(typeDec == null){ log(stp.getName() + " couldn't be found locally.."); - Class tehClass = findClassIfExists(stp.getName().toString()); + Class tehClass = findClassIfExists(stp.getName().toString()); if (tehClass != null) { // note how similar thing is called on line 690. Check check. return definedIn3rdPartyClass(new ClassMember(tehClass), qn @@ -1295,11 +1295,11 @@ public class ASTGenerator { * @param className * @return */ - protected Class findClassIfExists(String className){ + protected Class findClassIfExists(String className){ if(className == null){ return null; } - Class tehClass = null; + Class tehClass = null; // First, see if the classname is a fully qualified name and loads straightaway tehClass = loadClass(className); @@ -1367,8 +1367,8 @@ public class ASTGenerator { return tehClass; } - protected Class loadClass(String className){ - Class tehClass = null; + protected Class loadClass(String className){ + Class tehClass = null; if (className != null) { try { tehClass = Class.forName(className, false, @@ -1882,7 +1882,7 @@ public class ASTGenerator { @Override public void valueChanged(TreeSelectionEvent e) { log(e); - SwingWorker worker = new SwingWorker() { + SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { @@ -1940,7 +1940,7 @@ public class ASTGenerator { public void actionPerformed(ActionEvent e) { if(txtRenameField.getText().length() == 0) return; - SwingWorker worker = new SwingWorker() { + SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { @@ -1959,7 +1959,7 @@ public class ASTGenerator { @Override public void actionPerformed(ActionEvent e) { - SwingWorker worker = new SwingWorker() { + SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { @@ -1979,7 +1979,7 @@ public class ASTGenerator { @Override public void valueChanged(TreeSelectionEvent e) { log(e); - SwingWorker worker = new SwingWorker() { + SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { @@ -2274,13 +2274,13 @@ public class ASTGenerator { } public void dfsNameOnly(DefaultMutableTreeNode tnode,ASTNode decl, String name) { - Stack temp = new Stack(); + Stack temp = new Stack(); temp.push(codeTree); while(!temp.isEmpty()){ DefaultMutableTreeNode cnode = (DefaultMutableTreeNode) temp.pop(); for (int i = 0; i < cnode.getChildCount(); i++) { - temp.push(cnode.getChildAt(i)); + temp.push((DefaultMutableTreeNode) cnode.getChildAt(i)); } if(!(cnode.getUserObject() instanceof ASTNodeWrapper)) @@ -2373,13 +2373,13 @@ public class ASTGenerator { // Find the first node with this line number, return its offset - jOffset line = pdeLineNumToJavaLineNum(line); log("Looking for line: " + line + ", jOff " + jOffset); - Stack temp = new Stack(); + Stack temp = new Stack(); temp.push(codeTree); while (!temp.isEmpty()) { DefaultMutableTreeNode cnode = (DefaultMutableTreeNode) temp.pop(); for (int i = 0; i < cnode.getChildCount(); i++) { - temp.push(cnode.getChildAt(i)); + temp.push((DefaultMutableTreeNode) cnode.getChildAt(i)); } if (!(cnode.getUserObject() instanceof ASTNodeWrapper)) @@ -3061,9 +3061,9 @@ public class ASTGenerator { private Method method; - private Constructor cons; + private Constructor cons; - private Class thisclass; + private Class thisclass; private String stringVal; @@ -3073,7 +3073,7 @@ public class ASTGenerator { private ASTNode declaringNode; - public ClassMember(Class m) { + public ClassMember(Class m) { thisclass = m; stringVal = "Predefined Class " + m.getName(); classType = m.getName(); @@ -3093,7 +3093,7 @@ public class ASTGenerator { classType = m.getType().getName(); } - public ClassMember(Constructor m) { + public ClassMember(Constructor m) { cons = m; stringVal = "Cons " + " " + m.getName() + " defined in " + m.getDeclaringClass().getName(); @@ -3126,7 +3126,7 @@ public class ASTGenerator { } } - public Class getClass_() { + public Class getClass_() { return thisclass; } @@ -3142,7 +3142,7 @@ public class ASTGenerator { return method; } - public Constructor getCons() { + public Constructor getCons() { return cons; } @@ -3360,7 +3360,7 @@ public class ASTGenerator { .substring(0, candidates.get(i).length() - 6); } if (resources.length >= 1) { - final JList classList = new JList(resources); + final JList classList = new JList(resources); classList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); frmImportSuggest = new JFrame(); frmImportSuggest.setSize(350, 200); From db199532329e78dcf7eaa81cd98522cd2be13254 Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Thu, 7 Aug 2014 15:39:18 +0530 Subject: [PATCH 09/11] get rid of warnings in CompPanel, EMS --- .../mode/experimental/CompletionPanel.java | 12 ++++++------ .../mode/experimental/ErrorMessageSimplifier.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pdex/src/processing/mode/experimental/CompletionPanel.java b/pdex/src/processing/mode/experimental/CompletionPanel.java index 9f371b2d3..4745a9974 100644 --- a/pdex/src/processing/mode/experimental/CompletionPanel.java +++ b/pdex/src/processing/mode/experimental/CompletionPanel.java @@ -61,7 +61,7 @@ public class CompletionPanel { /** * The completion list generated by ASTGenerator */ - private JList completionList; + private JList completionList; /** * The popup menu in which the suggestion list is shown @@ -202,10 +202,10 @@ public class CompletionPanel { * @param items * @return */ - private JList createSuggestionList(final int position, - final DefaultListModel items) { + private JList createSuggestionList(final int position, + final DefaultListModel items) { - JList list = new JList(items); + JList list = new JList(items); //list.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); @@ -224,7 +224,7 @@ public class CompletionPanel { } // possibly defunct - public boolean updateList(final DefaultListModel items, String newSubword, + public boolean updateList(final DefaultListModel items, String newSubword, final Point location, int position) { this.subWord = new String(newSubword); if (subWord.indexOf('.') != -1) @@ -456,7 +456,7 @@ public class CompletionPanel { javax.swing.DefaultListCellRenderer { //protected final ImageIcon classIcon, fieldIcon, methodIcon; - public Component getListCellRendererComponent(JList list, Object value, + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { diff --git a/pdex/src/processing/mode/experimental/ErrorMessageSimplifier.java b/pdex/src/processing/mode/experimental/ErrorMessageSimplifier.java index 20a737dc4..61e3d2e6c 100644 --- a/pdex/src/processing/mode/experimental/ErrorMessageSimplifier.java +++ b/pdex/src/processing/mode/experimental/ErrorMessageSimplifier.java @@ -32,7 +32,7 @@ public class ErrorMessageSimplifier { private static void prepareConstantsList() { constantsMap = new TreeMap(); - Class probClass = DefaultProblem.class; + Class probClass = DefaultProblem.class; Field f[] = probClass.getFields(); for (Field field : f) { if (Modifier.isStatic(field.getModifiers())) From ce24ead73a2923cd082db458f5d6d892e1fda6dc Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Thu, 7 Aug 2014 02:32:29 -0300 Subject: [PATCH 10/11] Remove unused title in ContributionManagerDialog --- app/src/processing/app/contrib/ContributionManagerDialog.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java index 85ce796b5..61858df62 100644 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ b/app/src/processing/app/contrib/ContributionManagerDialog.java @@ -44,7 +44,6 @@ public class ContributionManagerDialog { static final String ANY_CATEGORY = Language.text("contrib.all"); JFrame dialog; - String title; ContributionFilter filter; JComboBox categoryChooser; JScrollPane scrollPane; @@ -101,6 +100,9 @@ public class ContributionManagerDialog { .showYesNoQuestion(editor, title, Language.text("contrib.unsaved_changes"), Language.text("contrib.unsaved_changes.prompt")); + .showYesNoQuestion(editor, Language.text("contributions"), + Language.text("contributions.unsaved_changes"), + Language.text("contributions.unsaved_changes.prompt")); if (option == JOptionPane.NO_OPTION) return; From f30256c3ead5e4be588bf197b876f96b5f1607c2 Mon Sep 17 00:00:00 2001 From: Daniel Shiffman Date: Thu, 7 Aug 2014 09:51:45 -0400 Subject: [PATCH 11/11] fixing a bug introduced by #2754 --- app/src/processing/app/contrib/ContributionManagerDialog.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/processing/app/contrib/ContributionManagerDialog.java b/app/src/processing/app/contrib/ContributionManagerDialog.java index 61858df62..14377a0a0 100644 --- a/app/src/processing/app/contrib/ContributionManagerDialog.java +++ b/app/src/processing/app/contrib/ContributionManagerDialog.java @@ -97,9 +97,6 @@ public class ContributionManagerDialog { Editor ed = iter.next(); if (ed.getSketch().isModified()) { int option = Base - .showYesNoQuestion(editor, title, - Language.text("contrib.unsaved_changes"), - Language.text("contrib.unsaved_changes.prompt")); .showYesNoQuestion(editor, Language.text("contributions"), Language.text("contributions.unsaved_changes"), Language.text("contributions.unsaved_changes.prompt"));