Last of the documentation / stub cleanup. Minor fixes for error reporting.

This commit is contained in:
lonnen
2010-06-21 15:59:18 +00:00
parent 55d31db396
commit f82e617e37
13 changed files with 131 additions and 95 deletions

View File

@@ -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,

View File

@@ -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());

View File

@@ -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);

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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() {

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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) {