diff --git a/editor/org.processing.editor/META-INF/MANIFEST.MF b/editor/org.processing.editor/META-INF/MANIFEST.MF index ba885d11f..e771644bf 100644 --- a/editor/org.processing.editor/META-INF/MANIFEST.MF +++ b/editor/org.processing.editor/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: org.processing.editor Bundle-SymbolicName: org.processing.editor;singleton:=true -Bundle-Version: 0.0.2 +Bundle-Version: 0.0.3 Bundle-Activator: org.processing.editor.ProcessingEditorPlugin Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, diff --git a/editor/org.processing.editor/src/org/processing/editor/PresentationAction.java b/editor/org.processing.editor/src/org/processing/editor/PresentationAction.java index f5785a5dc..839990608 100644 --- a/editor/org.processing.editor/src/org/processing/editor/PresentationAction.java +++ b/editor/org.processing.editor/src/org/processing/editor/PresentationAction.java @@ -25,12 +25,17 @@ public class PresentationAction extends TextEditorAction { * Constructs and updates the action. */ public PresentationAction() { - super(ProcessingEditorMessages.getResourceBundle(), "TogglePresentation.", null); //$NON-NLS-1$ + super(ProcessingEditorMessages.getResourceBundle(), "TogglePresentation.", null); update(); } - /* (non-Javadoc) - * Method declared on IAction + /** + * Toggles between showing the highlight range only and showing the whole + * document. This isn't currently enabled in the Processing editor, and + * was generated as stub code. I'm not sure how useful it is. I will do + * something better with this later. + * + * [lonnen] june 21 2010 */ public void run() { @@ -42,8 +47,8 @@ public class PresentationAction extends TextEditorAction { editor.showHighlightRangeOnly(!show); } - /* (non-Javadoc) - * Method declared on TextEditorAction + /** + * Changes the PresentationAction in light of changes to the editor. */ public void update() { setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly()); diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingActionContributor.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingActionContributor.java index 0e9c8f807..f69779610 100644 --- a/editor/org.processing.editor/src/org/processing/editor/ProcessingActionContributor.java +++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingActionContributor.java @@ -17,7 +17,7 @@ import org.eclipse.ui.editors.text.TextEditorActionContributor; import org.eclipse.ui.texteditor.*; /** - * Contributes interesting Java actions to the desktop's Edit menu and the toolbar. + * Contributes content assistance actions to the desktop's Edit menu and the toolbar. */ public class ProcessingActionContributor extends TextEditorActionContributor { @@ -30,15 +30,16 @@ public class ProcessingActionContributor extends TextEditorActionContributor { */ public ProcessingActionContributor() { super(); - fContentAssistProposal= new RetargetTextEditorAction(ProcessingEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$ + fContentAssistProposal= new RetargetTextEditorAction(ProcessingEditorMessages.getResourceBundle(), "ContentAssistProposal."); fContentAssistProposal.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); - fContentAssistTip= new RetargetTextEditorAction(ProcessingEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$ + fContentAssistTip= new RetargetTextEditorAction(ProcessingEditorMessages.getResourceBundle(), "ContentAssistTip."); fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION); fTogglePresentation= new PresentationAction(); } - /* - * @see IEditorActionBarContributor#init(IActionBars) + /** + * Initializes the edit menu actions invoking content assistance and the assitance tooltip + * These are functional items, but of (extremely?) limited usefulness. */ public void init(IActionBars bars) { super.init(bars); @@ -58,8 +59,8 @@ public class ProcessingActionContributor extends TextEditorActionContributor { } } - /* - * + /** + * Adds content assistance and tooltip actions to the Processing Editor */ private void doSetActiveEditor(IEditorPart part) { super.setActiveEditor(part); @@ -75,16 +76,16 @@ public class ProcessingActionContributor extends TextEditorActionContributor { fTogglePresentation.update(); } - /* - * @see IEditorActionBarContributor#setActiveEditor(IEditorPart) + /** + * @see doSetActiveEditor */ public void setActiveEditor(IEditorPart part) { super.setActiveEditor(part); doSetActiveEditor(part); } - /* - * @see IEditorActionBarContributor#dispose() + /** + * Shut it down */ public void dispose() { doSetActiveEditor(null); diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingAnnotationHover.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingAnnotationHover.java index 7fb2de6dd..80e88214b 100644 --- a/editor/org.processing.editor/src/org/processing/editor/ProcessingAnnotationHover.java +++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingAnnotationHover.java @@ -25,8 +25,9 @@ import org.eclipse.jface.text.source.ISourceViewer; public class ProcessingAnnotationHover implements IAnnotationHover { - /* (non-Javadoc) - * Method declared on IAnnotationHover + /** + * Provides info for a given mouse hover position to the tooltip. + * Currently this means retrieving the text under the mouse. */ public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) { IDocument document= sourceViewer.getDocument(); diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingContentOutlinePage.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingContentOutlinePage.java index cecf2cb13..291558f98 100644 --- a/editor/org.processing.editor/src/org/processing/editor/ProcessingContentOutlinePage.java +++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingContentOutlinePage.java @@ -81,8 +81,8 @@ public class ProcessingContentOutlinePage extends ContentOutlinePage { } } - /* - * @see IContentProvider#inputChanged(Viewer, Object, Object) + /** + * {@inheritDoc} */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != null) { @@ -109,7 +109,9 @@ public class ProcessingContentOutlinePage extends ContentOutlinePage { } } - /* + /** + * Shut it down. + * * @see IContentProvider#dispose */ public void dispose() { @@ -119,29 +121,29 @@ public class ProcessingContentOutlinePage extends ContentOutlinePage { } } - /* - * @see IContentProvider#isDeleted(Object) + /** + * {@inheritDoc} */ public boolean isDeleted(Object element) { return false; } - /* - * @see IStructuredContentProvider#getElements(Object) + /** + * {@inheritDoc} */ public Object[] getElements(Object element) { return fContent.toArray(); } - /* - * @see ITreeContentProvider#hasChildren(Object) + /** + * {@inheritDoc} */ public boolean hasChildren(Object element) { return element == fInput; } - /* - * @see ITreeContentProvider#getParent(Object) + /** + * {@inheritDoc} */ public Object getParent(Object element) { if (element instanceof Segment) @@ -149,8 +151,8 @@ public class ProcessingContentOutlinePage extends ContentOutlinePage { return null; } - /* - * @see ITreeContentProvider#getChildren(Object) + /** + * {@inheritDoc} */ public Object[] getChildren(Object element) { if (element == fInput) @@ -175,8 +177,8 @@ public class ProcessingContentOutlinePage extends ContentOutlinePage { fTextEditor= editor; } - /* (non-Javadoc) - * Method declared on ContentOutlinePage + /** + * {@inheritDoc} */ public void createControl(Composite parent) { @@ -191,8 +193,8 @@ public class ProcessingContentOutlinePage extends ContentOutlinePage { viewer.setInput(fInput); } - /* (non-Javadoc) - * Method declared on ContentOutlinePage + /** + * {@inheritDoc} */ public void selectionChanged(SelectionChangedEvent event) { diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingDocumentSetupParticipant.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingDocumentSetupParticipant.java index b72e5e133..7d079f83d 100644 --- a/editor/org.processing.editor/src/org/processing/editor/ProcessingDocumentSetupParticipant.java +++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingDocumentSetupParticipant.java @@ -17,12 +17,13 @@ import org.eclipse.jface.text.rules.FastPartitioner; public class ProcessingDocumentSetupParticipant implements IDocumentSetupParticipant { /** + * The constructor doesn't do much. */ public ProcessingDocumentSetupParticipant() { } - /* - * @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument) + /** + * {@inheritDoc} */ public void setup(IDocument document) { if (document instanceof IDocumentExtension3) { diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingPartitionScanner.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingPartitionScanner.java index 70e88efdc..4972d17d6 100644 --- a/editor/org.processing.editor/src/org/processing/editor/ProcessingPartitionScanner.java +++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingPartitionScanner.java @@ -62,14 +62,18 @@ public class ProcessingPartitionScanner extends RuleBasedPartitionScanner { addWord("/**/", fSuccessToken); //$NON-NLS-1$ } - /* + /** + * {@inheritDoc} + * * @see org.eclipse.jface.text.rules.IPredicateRule#evaluate(ICharacterScanner, boolean) */ public IToken evaluate(ICharacterScanner scanner, boolean resume) { return super.evaluate(scanner); } - /* + /** + * {@inheritDoc} + * * @see org.eclipse.jface.text.rules.IPredicateRule#getSuccessToken() */ public IToken getSuccessToken() { diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingSourceViewerConfiguration.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingSourceViewerConfiguration.java index 638e297bd..c5ff97972 100644 --- a/editor/org.processing.editor/src/org/processing/editor/ProcessingSourceViewerConfiguration.java +++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingSourceViewerConfiguration.java @@ -57,14 +57,21 @@ public class ProcessingSourceViewerConfiguration extends SourceViewerConfigurati public ProcessingSourceViewerConfiguration() { } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * Starts up the mouse hover tooltips */ public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { return new ProcessingAnnotationHover(); } - /* + /** + * Returns the auto-indent strategy used when manipulating text in the editor. To maintain backwards + * compatibility with the Eclipse RCP, this always returns an array containing the auto indent strategy. + * + * @param sourceViewer the source veiwer to be configured + * @param contentType the content type for which the strategies are applicable + * @return an auto indent strategy, or null + * @see org.processing.editor.language.ProcessingAutoIndentStrategy * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAutoEditStrategies(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) */ public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { @@ -72,15 +79,22 @@ public class ProcessingSourceViewerConfiguration extends SourceViewerConfigurati return new IAutoEditStrategy[] { strategy }; } - /* + /** + * Returns the Processing partitioning, because this editor only acts on .pde files + * + * @param sourceViewer the source viewer to be configured + * @return a Processing partitioning * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer) */ public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) { return ProcessingEditorPlugin.PROCESSING_PARTITIONING; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * Returns the partitioning types to the source viewer so it can distinguish between comments and everything else. + * + * @param sourceViewer the source viewer to be configured + * @return a string array of the content types */ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { //Removing JavaDoc support from sketches, but leave in code @@ -88,9 +102,12 @@ public class ProcessingSourceViewerConfiguration extends SourceViewerConfigurati return new String[] { IDocument.DEFAULT_CONTENT_TYPE, ProcessingPartitionScanner.JAVA_MULTILINE_COMMENT }; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration - */ + /** + * Returns content assistance + * + * @param the source viewer the be configured + * @return a content assistant of dubious utility + */ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistant assistant= new ContentAssistant(); @@ -100,7 +117,7 @@ public class ProcessingSourceViewerConfiguration extends SourceViewerConfigurati //assistant.setContentAssistProcessor(new JavaDocCompletionProcessor(), ProcessingPartitionScanner.JAVA_DOC); assistant.enableAutoActivation(true); - assistant.setAutoActivationDelay(500); + assistant.setAutoActivationDelay(500); // delay before content assist pops up assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY); assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE); assistant.setContextInformationPopupBackground(ProcessingEditorPlugin.getDefault().getProcessingColorProvider().getColor(new RGB(150, 150, 0))); @@ -108,29 +125,30 @@ public class ProcessingSourceViewerConfiguration extends SourceViewerConfigurati return assistant; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * Returns the default prefix to be used by the line-prefix operation in the editor. + * This is used for auto-commenting and uncommenting. */ public String getDefaultPrefix(ISourceViewer sourceViewer, String contentType) { return (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType) ? "//" : null); //$NON-NLS-1$ } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * {@inheritDoc} */ public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) { return new ProcessingDoubleClickSelector(); } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * {@inheritDoc} */ public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { - return new String[] { "\t", " " }; //$NON-NLS-1$ //$NON-NLS-2$ + return new String[] { "\t", " " }; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * {@inheritDoc} */ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { @@ -155,15 +173,15 @@ public class ProcessingSourceViewerConfiguration extends SourceViewerConfigurati return reconciler; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * {@inheritDoc} */ public int getTabWidth(ISourceViewer sourceViewer) { return 4; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration + /** + * {@inheritDoc} */ public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { return new ProcessingTextHover(); diff --git a/editor/org.processing.editor/src/org/processing/editor/ProcessingTextHover.java b/editor/org.processing.editor/src/org/processing/editor/ProcessingTextHover.java index 1be66a9e3..6f42e7a36 100644 --- a/editor/org.processing.editor/src/org/processing/editor/ProcessingTextHover.java +++ b/editor/org.processing.editor/src/org/processing/editor/ProcessingTextHover.java @@ -19,8 +19,8 @@ import org.eclipse.swt.graphics.Point; */ public class ProcessingTextHover implements ITextHover { - /* (non-Javadoc) - * Method declared on ITextHover + /** + * {@inheritDoc} */ public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { if (hoverRegion != null) { @@ -34,8 +34,8 @@ public class ProcessingTextHover implements ITextHover { return ProcessingEditorMessages.getString("ProcessingTextHover.emptySelection"); //$NON-NLS-1$ } - /* (non-Javadoc) - * Method declared on ITextHover + /** + * {@inheritDoc} */ public IRegion getHoverRegion(ITextViewer textViewer, int offset) { Point selection= textViewer.getSelectedRange(); diff --git a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingAutoIndentStrategy.java b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingAutoIndentStrategy.java index 449cef152..7ea312127 100644 --- a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingAutoIndentStrategy.java +++ b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingAutoIndentStrategy.java @@ -25,13 +25,13 @@ public class ProcessingAutoIndentStrategy extends DefaultIndentLineAutoEditStrat public ProcessingAutoIndentStrategy() { } - /* (non-Javadoc) - * Method declared on IAutoIndentStrategy + /** + * {@inheritDoc} */ public void customizeDocumentCommand(IDocument d, DocumentCommand c) { if (c.length == 0 && c.text != null && endsWithDelimiter(d, c.text)) smartIndentAfterNewLine(d, c); - else if ("}".equals(c.text)) { //$NON-NLS-1$ + else if ("}".equals(c.text)) { smartInsertAfterBracket(d, c); } } diff --git a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java index 24bbca222..df2914961 100644 --- a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java +++ b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java @@ -23,6 +23,7 @@ import java.util.Set; import org.eclipse.jface.text.TextAttribute; import org.eclipse.jface.text.rules.*; import org.processing.editor.ProcessingEditorPlugin; +import org.processing.editor.ProcessingLog; import org.processing.editor.util.*; /** @@ -95,12 +96,12 @@ public class ProcessingCodeScanner extends RuleBasedScanner { } } } - catch (Exception e){ - e.printStackTrace(); + catch (Exception e){ + ProcessingLog.logError("ProcessingCodeScanner init block encountered a problem while reading the keywords file.", e); } try{ - fgKeywords1= KeywordMap.containsKey("KEYWORD1") ? (String[]) KeywordMap.get("KEYWORD1").toArray(new String[KeywordMap.get("KEYWORD1").size()]) : new String[] {"test"}; + fgKeywords1= KeywordMap.containsKey("KEYWORD1") ? (String[]) KeywordMap.get("KEYWORD1").toArray(new String[KeywordMap.get("KEYWORD1").size()]) : new String[] {}; fgKeywords2= KeywordMap.containsKey("KEYWORD2") ? (String[]) KeywordMap.get("KEYWORD2").toArray(new String[KeywordMap.get("KEYWORD2").size()]) : new String[] {}; fgKeywords3= KeywordMap.containsKey("KEYWORD3") ? (String[]) KeywordMap.get("KEYWORD3").toArray(new String[KeywordMap.get("KEYWORD3").size()]) : new String[] {}; fgLiterals1= KeywordMap.containsKey("LITERAL1") ? (String[]) KeywordMap.get("LITERAL1").toArray(new String[KeywordMap.get("LITERAL1").size()]) : new String[] {}; @@ -110,7 +111,7 @@ public class ProcessingCodeScanner extends RuleBasedScanner { fgInvalids = KeywordMap.containsKey("INVALIDS") ? (String[]) KeywordMap.get("INVALIDS").toArray(new String[KeywordMap.get("INVALIDS").size()]) : new String[] {}; // unused? } catch (Exception e){ - e.printStackTrace(); + ProcessingLog.logError("ProcessingCodeScanner init block encountered a problem while initializing the string arrays.", e); } } diff --git a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java index 9cba52294..0c2ea8958 100644 --- a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java +++ b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java @@ -30,29 +30,29 @@ public class ProcessingCompletionProcessor implements IContentAssistProcessor { protected int fInstallOffset; - /* - * @see IContextInformationValidator#isContextInformationValid(int) + /** + * {@inheritDoc} */ public boolean isContextInformationValid(int offset) { return Math.abs(fInstallOffset - offset) < 5; } - /* - * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int) + /** + * {@inheritDoc} */ public void install(IContextInformation info, ITextViewer viewer, int offset) { fInstallOffset= offset; } - /* - * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation) + /** + * {@inheritDoc} */ public boolean updatePresentation(int documentPosition, TextPresentation presentation) { return false; } } - /* + /** * The list of proposals that populates the content assistance dialog box. * * Dialog assistance is not context sensitive right now, so it will always provide the same suggestions @@ -90,8 +90,8 @@ public class ProcessingCompletionProcessor implements IContentAssistProcessor { return result; } - /* (non-Javadoc) - * Method declared on IContentAssistProcessor + /** + * {@inheritDoc} */ public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) { IContextInformation[] result= new IContextInformation[5]; @@ -102,29 +102,29 @@ public class ProcessingCompletionProcessor implements IContentAssistProcessor { return result; } - /* (non-Javadoc) - * Method declared on IContentAssistProcessor + /** + * {@inheritDoc} */ public char[] getCompletionProposalAutoActivationCharacters() { return new char[] { '.', '(' }; } - /* (non-Javadoc) - * Method declared on IContentAssistProcessor + /** + * {@inheritDoc} */ public char[] getContextInformationAutoActivationCharacters() { return new char[] { '#' }; } - /* (non-Javadoc) - * Method declared on IContentAssistProcessor + /** + * {@inheritDoc} */ public IContextInformationValidator getContextInformationValidator() { return fValidator; } - /* (non-Javadoc) - * Method declared on IContentAssistProcessor + /** + * {@inheritDoc} */ public String getErrorMessage() { return null; diff --git a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingDoubleClickSelector.java b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingDoubleClickSelector.java index 653a7dee4..19baa5a36 100644 --- a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingDoubleClickSelector.java +++ b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingDoubleClickSelector.java @@ -29,15 +29,18 @@ public class ProcessingDoubleClickSelector implements ITextDoubleClickStrategy { protected static char[] fgBrackets= { '{', '}', '(', ')', '[', ']', '"', '"' }; - /* - * Create a JavaDoubleClickSelector. + /** + * Create a DoubleClickSelector. */ public ProcessingDoubleClickSelector() { super(); } - /* (non-Javadoc) - * Method declared on ITextDoubleClickStrategy + /** + * Takes action to highlight a range when the user double clicks in the editor + * if the double click happened near an opening/closing token. + * + * @param text the Processing editor that was double clicked */ public void doubleClicked(ITextViewer text) {