From b6362d48a5de17960701ab89a0530b5b97c73759 Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Sat, 24 Aug 2013 20:30:39 +0530 Subject: [PATCH] Getter for astgen --- .../src/processing/mode/experimental/CompletionPanel.java | 8 ++++---- pdex/src/processing/mode/experimental/DebugEditor.java | 6 +++--- .../processing/mode/experimental/ErrorCheckerService.java | 5 +++++ pdex/src/processing/mode/experimental/TextArea.java | 6 +++--- .../src/processing/mode/experimental/TextAreaPainter.java | 4 ++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/pdex/src/processing/mode/experimental/CompletionPanel.java b/pdex/src/processing/mode/experimental/CompletionPanel.java index 55e66c430..ff2b7384a 100644 --- a/pdex/src/processing/mode/experimental/CompletionPanel.java +++ b/pdex/src/processing/mode/experimental/CompletionPanel.java @@ -56,7 +56,7 @@ public class CompletionPanel { scrollPane.setViewportView(completionList = createSuggestionList(position, items)); popupMenu.add(scrollPane, BorderLayout.CENTER); popupMenu.setPopupSize(280, 250); //TODO: Eradicate this evil - this.textarea.errorCheckerService.astGenerator + this.textarea.errorCheckerService.getASTGenerator() .updateJavaDoc((CompletionCandidate) completionList.getSelectedValue()); popupMenu.show(textarea, location.x, textarea.getBaseline(0, 0) + location.y); @@ -145,7 +145,7 @@ public class CompletionPanel { public void hideSuggestion() { popupMenu.setVisible(false); log("Suggestion hidden" + System.nanoTime()); - //textarea.errorCheckerService.astGenerator.jdocWindowVisible(false); + //textarea.errorCheckerService.getASTGenerator().jdocWindowVisible(false); } public void moveUp() { @@ -163,7 +163,7 @@ public class CompletionPanel { .getVerticalScrollBar() .getValue() - step); - textarea.errorCheckerService.astGenerator + textarea.errorCheckerService.getASTGenerator() .updateJavaDoc((CompletionCandidate) completionList.getSelectedValue()); } @@ -178,7 +178,7 @@ public class CompletionPanel { .getSize() - 1); selectIndex(index); } - textarea.errorCheckerService.astGenerator + textarea.errorCheckerService.getASTGenerator() .updateJavaDoc((CompletionCandidate) completionList.getSelectedValue()); int step = scrollPane.getVerticalScrollBar().getMaximum() / completionList.getModel().getSize(); diff --git a/pdex/src/processing/mode/experimental/DebugEditor.java b/pdex/src/processing/mode/experimental/DebugEditor.java index ad0936e52..34e02d598 100755 --- a/pdex/src/processing/mode/experimental/DebugEditor.java +++ b/pdex/src/processing/mode/experimental/DebugEditor.java @@ -612,7 +612,7 @@ public class DebugEditor extends JavaEditor implements ActionListener { toggleVariableInspector(); } else if (source.equals(showOutline)){ log("Show Outline :D"); - errorCheckerService.astGenerator.showSketchOutline(); + errorCheckerService.getASTGenerator().showSketchOutline(); } } @@ -1259,13 +1259,13 @@ public class DebugEditor extends JavaEditor implements ActionListener { private void handleRefactor() { log("Caret at:"); log(ta.getLineText(ta.getCaretLine())); - errorCheckerService.astGenerator.handleRefactor(); + errorCheckerService.getASTGenerator().handleRefactor(); } private void handleShowUsage() { log("Caret at:"); log(ta.getLineText(ta.getCaretLine())); - errorCheckerService.astGenerator.handleShowUsage(); + errorCheckerService.getASTGenerator().handleShowUsage(); } /** diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index 5f6d1479a..1d04be341 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -302,6 +302,11 @@ public class ErrorCheckerService implements Runnable{ } protected ASTGenerator astGenerator; + + public ASTGenerator getASTGenerator() { + return astGenerator; + } + /** * This thing acts as an event queue counter of sort. * Since error checking happens on demand, anytime this counter diff --git a/pdex/src/processing/mode/experimental/TextArea.java b/pdex/src/processing/mode/experimental/TextArea.java index d5caef4d7..4468951dd 100644 --- a/pdex/src/processing/mode/experimental/TextArea.java +++ b/pdex/src/processing/mode/experimental/TextArea.java @@ -251,7 +251,7 @@ public class TextArea extends JEditTextArea { if (Character.isDigit(word.charAt(0))) return null; log("Mouse click, word: " + word.trim()); - errorCheckerService.astGenerator.setLastClickedWord(line + errorCheckerService.getASTGenerator().setLastClickedWord(line + errorCheckerService.mainClassOffset, word, xLS); return word.trim(); } @@ -302,7 +302,7 @@ public class TextArea extends JEditTextArea { if (word.endsWith(".")) word = word.substring(0, word.length() - 1); if(word.length() > 1) - errorCheckerService.astGenerator.preparePredictions(word, line + errorCheckerService.getASTGenerator().preparePredictions(word, line + errorCheckerService.mainClassOffset,0); return word; } @@ -380,7 +380,7 @@ public class TextArea extends JEditTextArea { // word = word.substring(0, word.length() - 1); int lineStartNonWSOffset = 0; if(word.length() > 1) - errorCheckerService.astGenerator.preparePredictions(word, line + errorCheckerService.getASTGenerator().preparePredictions(word, line + errorCheckerService.mainClassOffset,lineStartNonWSOffset); //showSuggestionLater(); return word; diff --git a/pdex/src/processing/mode/experimental/TextAreaPainter.java b/pdex/src/processing/mode/experimental/TextAreaPainter.java index f8db484bb..382501202 100644 --- a/pdex/src/processing/mode/experimental/TextAreaPainter.java +++ b/pdex/src/processing/mode/experimental/TextAreaPainter.java @@ -143,7 +143,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter { log(errorCheckerService.mainClassOffset + line + "|" + line + "| offset " + xLS + word + " <= \n"); - errorCheckerService.astGenerator.scrollToDeclaration(line + errorCheckerService.getASTGenerator().scrollToDeclaration(line + errorCheckerService.mainClassOffset, word, xLS); } } @@ -472,7 +472,7 @@ public class TextAreaPainter extends processing.app.syntax.TextAreaPainter { } if (Character.isDigit(word.charAt(0))) return null; - String tooltipText = errorCheckerService.astGenerator + String tooltipText = errorCheckerService.getASTGenerator() .getLabelForASTNode(line + errorCheckerService.mainClassOffset, word, xLS);