[Pydev-cvs] org.python.pydev/src/org/python/pydev/editor IPyEditListener3.java, NONE, 1.1 PyCodeSca
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-28 12:48:17
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4313/src/org/python/pydev/editor Modified Files: PyCodeScanner.java PyEditConfiguration.java IPyEditListener.java PyColoredScanner.java PyEdit.java PyEditNotifier.java PyDoubleClickStrategy.java Added Files: IPyEditListener3.java Removed Files: ErrorDescription.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: PyEditNotifier.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEditNotifier.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyEditNotifier.java 17 Jan 2007 16:26:13 -0000 1.4 --- PyEditNotifier.java 28 Sep 2008 12:45:41 -0000 1.5 *************** *** 8,106 **** import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.PyEdit.MyResources; import org.python.pydev.plugin.PydevPlugin; public class PyEditNotifier { ! ! private WeakReference<PyEdit> pyEdit; ! public static interface INotifierRunnable{ ! public void run(IProgressMonitor monitor); ! } ! ! public PyEditNotifier(PyEdit edit){ ! this.pyEdit = new WeakReference<PyEdit>(edit); ! } ! public void notifyOnCreateActions(final MyResources resources) { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(final IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onCreateActions(resources, edit, monitor); ! } ! } catch (Exception e) { ! //must not fail ! PydevPlugin.log(e); ! } ! } ! } ! }; ! runIt(runnable); } public void notifyOnSave() { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onSave(edit, monitor); ! } ! } catch (Throwable e) { ! //must not fail ! PydevPlugin.log(e); ! } ! } ! } ! }; ! runIt(runnable); } ! private void runIt(final INotifierRunnable runnable) { ! Job job = new Job("PyEditNotifier"){ ! @Override ! protected IStatus run(IProgressMonitor monitor) { ! runnable.run(monitor); ! return Status.OK_STATUS; ! } ! ! }; ! job.setPriority(Job.BUILD); ! job.setSystem(true); ! job.schedule(); ! } public void notifyOnDispose() { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onDispose(edit, monitor); ! } ! } catch (Throwable e) { ! //no need to worry... as we're disposing, in shutdown, we may not have access to some classes anymore ! } ! } ! } ! }; ! runIt(runnable); } --- 8,126 ---- import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.text.IDocument; + import org.eclipse.ui.IEditorInput; import org.python.pydev.editor.PyEdit.MyResources; import org.python.pydev.plugin.PydevPlugin; + /** + * Helper to give notifications for the listeners of the editor. + * + * @author Fabio + */ public class PyEditNotifier { ! ! private WeakReference<PyEdit> pyEdit; ! public static interface INotifierRunnable{ ! public void run(IProgressMonitor monitor); ! } ! ! public PyEditNotifier(PyEdit edit){ ! this.pyEdit = new WeakReference<PyEdit>(edit); ! } ! ! /** ! * Notifies listeners that the actions have just been created in the editor. ! */ public void notifyOnCreateActions(final MyResources resources) { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(final IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onCreateActions(resources, edit, monitor); ! } ! } catch (Exception e) { ! //must not fail ! PydevPlugin.log(e); ! } ! } ! } ! }; ! runIt(runnable); } + /** + * Notifies listeners that the editor has just been saved + */ public void notifyOnSave() { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onSave(edit, monitor); ! } ! } catch (Throwable e) { ! //must not fail ! PydevPlugin.log(e); ! } ! } ! } ! }; ! runIt(runnable); } ! /** ! * Helper function to run the notifications of the editor in a job. ! * ! * @param runnable the runnable to be run. ! */ ! private void runIt(final INotifierRunnable runnable) { ! Job job = new Job("PyEditNotifier"){ ! @Override ! protected IStatus run(IProgressMonitor monitor) { ! runnable.run(monitor); ! return Status.OK_STATUS; ! } ! ! }; ! job.setPriority(Job.SHORT); ! job.setSystem(true); ! job.schedule(); ! } + /** + * Notifies listeners that the editor has just been disposed + */ public void notifyOnDispose() { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onDispose(edit, monitor); ! } ! } catch (Throwable e) { ! //no need to worry... as we're disposing, in shutdown, we may not have access to some classes anymore ! } ! } ! } ! }; ! runIt(runnable); } *************** *** 109,131 **** */ public void notifyOnSetDocument(final IDocument document) { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onSetDocument(document, edit, monitor); ! } ! } catch (Exception e) { ! //must not fail ! PydevPlugin.log(e); ! } ! } ! } ! }; ! runIt(runnable); } --- 129,182 ---- */ public void notifyOnSetDocument(final IDocument document) { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! try { ! if(!monitor.isCanceled()){ ! listener.onSetDocument(document, edit, monitor); ! } ! } catch (Exception e) { ! //must not fail ! PydevPlugin.log(e); ! } ! } ! } ! }; ! runIt(runnable); ! } ! ! /** ! * Notifies the available listeners that the input has changed for the editor. ! * ! * @param oldInput the old input of the editor ! * @param input the new input of the editor ! */ ! public void notifyInputChanged(final IEditorInput oldInput, final IEditorInput input) { ! final PyEdit edit = pyEdit.get(); ! if(edit == null){ ! return; ! } ! INotifierRunnable runnable = new INotifierRunnable(){ ! public void run(IProgressMonitor monitor){ ! for(IPyEditListener listener : edit.getAllListeners()){ ! if(listener instanceof IPyEditListener3){ ! IPyEditListener3 pyEditListener3 = (IPyEditListener3) listener; ! try { ! if(!monitor.isCanceled()){ ! pyEditListener3.onInputChanged(edit, oldInput, input, monitor); ! } ! } catch (Exception e) { ! //must not fail ! PydevPlugin.log(e); ! } ! } ! } ! } ! }; ! runIt(runnable); } Index: PyEditConfiguration.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEditConfiguration.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** PyEditConfiguration.java 14 Jun 2008 22:14:55 -0000 1.58 --- PyEditConfiguration.java 28 Sep 2008 12:45:40 -0000 1.59 *************** *** 115,120 **** public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { return new String[] { IDocument.DEFAULT_CONTENT_TYPE, IPythonPartitions.PY_COMMENT, ! IPythonPartitions.PY_SINGLELINE_STRING1, IPythonPartitions.PY_SINGLELINE_STRING2, ! IPythonPartitions.PY_MULTILINE_STRING1, IPythonPartitions.PY_MULTILINE_STRING2 }; } --- 115,120 ---- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { return new String[] { IDocument.DEFAULT_CONTENT_TYPE, IPythonPartitions.PY_COMMENT, ! IPythonPartitions.PY_SINGLELINE_STRING1, IPythonPartitions.PY_SINGLELINE_STRING2, ! IPythonPartitions.PY_MULTILINE_STRING1, IPythonPartitions.PY_MULTILINE_STRING2 }; } *************** *** 281,287 **** */ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ! // next create a content assistant processor to populate the completions window IContentAssistProcessor processor = new SimpleAssistProcessor(edit, ! new PythonCompletionProcessor(edit, pyContentAssistant), pyContentAssistant); PythonStringCompletionProcessor stringProcessor = new PythonStringCompletionProcessor(edit, pyContentAssistant); --- 281,287 ---- */ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ! // next create a content assistant processor to populate the completions window IContentAssistProcessor processor = new SimpleAssistProcessor(edit, ! new PythonCompletionProcessor(edit, pyContentAssistant), pyContentAssistant); PythonStringCompletionProcessor stringProcessor = new PythonStringCompletionProcessor(edit, pyContentAssistant); Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** PyEdit.java 21 Aug 2008 20:56:28 -0000 1.134 --- PyEdit.java 28 Sep 2008 12:45:40 -0000 1.135 *************** *** 10,14 **** import org.eclipse.core.resources.IFile; - import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; --- 10,13 ---- *************** *** 59,63 **** import org.eclipse.ui.texteditor.IEditorStatusLine; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; [...1015 lines suppressed...] */ ! public Font getFont(FontData descriptor) { ! Font font = getResourceManager().createFont(FontDescriptor.createFrom(descriptor)); ! ! // Old implementation (for Eclipse 3.3) // Font font = (Font) SWTResourceUtil.getFontTable().get(descriptor); // if (font == null) { *************** *** 1220,1224 **** return font; } ! //--------------------------------------------------------------------- END: actions that are activated after Ctrl+2 --- 1155,1159 ---- return font; } ! //--------------------------------------------------------------------- END: actions that are activated after Ctrl+2 --- NEW FILE: IPyEditListener3.java --- /* * Created on Apr 30, 2006 */ package org.python.pydev.editor; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.ui.IEditorInput; /** * Used if the interface also wants to be notified of input changes. * * This is an extension to the IPyEditListener */ public interface IPyEditListener3 { /** * Called when the input of the editor is changed. * * @param edit the editor that had the input changed * @param oldInput the old input of the editor * @param input the new input of the editor * @param monitor the monitor for the job that's making the notifications */ void onInputChanged(PyEdit edit, IEditorInput oldInput, IEditorInput input, IProgressMonitor monitor); } Index: PyColoredScanner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyColoredScanner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyColoredScanner.java 30 Aug 2005 14:19:38 -0000 1.2 --- PyColoredScanner.java 28 Sep 2008 12:45:40 -0000 1.3 *************** *** 18,40 **** */ public class PyColoredScanner extends RuleBasedScanner { ! private ColorCache colorCache; ! private String colorName; ! private int style; ! ! public PyColoredScanner(ColorCache colorCache, String colorName, int style) { ! super(); ! this.colorCache = colorCache; ! this.colorName = colorName; ! this.style = style; ! updateColorAndStyle(); ! } public void setStyle(int style){ this.style = style; } ! ! public void updateColorAndStyle() { ! setDefaultReturnToken(new Token(new TextAttribute(colorCache.getNamedColor(colorName), null, style))); ! } --- 18,40 ---- */ public class PyColoredScanner extends RuleBasedScanner { ! private ColorCache colorCache; ! private String colorName; ! private int style; ! ! public PyColoredScanner(ColorCache colorCache, String colorName, int style) { ! super(); ! this.colorCache = colorCache; ! this.colorName = colorName; ! this.style = style; ! updateColorAndStyle(); ! } public void setStyle(int style){ this.style = style; } ! ! public void updateColorAndStyle() { ! setDefaultReturnToken(new Token(new TextAttribute(colorCache.getNamedColor(colorName), null, style))); ! } Index: PyDoubleClickStrategy.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyDoubleClickStrategy.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyDoubleClickStrategy.java 26 May 2006 13:41:32 -0000 1.7 --- PyDoubleClickStrategy.java 28 Sep 2008 12:45:41 -0000 1.8 *************** *** 19,83 **** public class PyDoubleClickStrategy implements ITextDoubleClickStrategy { ! protected PythonPairMatcher fPairMatcher = new PythonPairMatcher(DocUtils.BRACKETS); ! /** ! * @see ITextDoubleClickStrategy#doubleClicked ! */ ! public void doubleClicked(ITextViewer textViewer) { ! int offset = textViewer.getSelectedRange().x; ! if (offset < 0) ! return; ! IDocument document = textViewer.getDocument(); ! IRegion region = fPairMatcher.match(document, offset); ! if (region != null && region.getLength() >= 2){ ! textViewer.setSelectedRange(region.getOffset() + 1, region.getLength() - 2); ! }else{ ! selectWord(textViewer, document, offset); ! } ! } ! protected void selectWord(ITextViewer textViewer, IDocument document, int anchor) { ! try { ! int offset = anchor; ! char c; ! while (offset >= 0) { ! c = document.getChar(offset); ! if (!Character.isJavaIdentifierPart(c)){ ! break; ! } ! ! --offset; ! } ! int start = offset; ! offset = anchor; ! int length = document.getLength(); ! while (offset < length) { ! c = document.getChar(offset); ! if (!Character.isJavaIdentifierPart(c)){ ! break; ! } ! ++offset; ! } ! int end = offset; ! if (start == end){ ! textViewer.setSelectedRange(start, 0); ! }else{ ! textViewer.setSelectedRange(start + 1, end - start - 1); ! } ! } catch (BadLocationException x) { ! } ! } } --- 19,83 ---- public class PyDoubleClickStrategy implements ITextDoubleClickStrategy { ! protected PythonPairMatcher fPairMatcher = new PythonPairMatcher(DocUtils.BRACKETS); ! /** ! * @see ITextDoubleClickStrategy#doubleClicked ! */ ! public void doubleClicked(ITextViewer textViewer) { ! int offset = textViewer.getSelectedRange().x; ! if (offset < 0) ! return; ! IDocument document = textViewer.getDocument(); ! IRegion region = fPairMatcher.match(document, offset); ! if (region != null && region.getLength() >= 2){ ! textViewer.setSelectedRange(region.getOffset() + 1, region.getLength() - 2); ! }else{ ! selectWord(textViewer, document, offset); ! } ! } ! protected void selectWord(ITextViewer textViewer, IDocument document, int anchor) { ! try { ! int offset = anchor; ! char c; ! while (offset >= 0) { ! c = document.getChar(offset); ! if (!Character.isJavaIdentifierPart(c)){ ! break; ! } ! ! --offset; ! } ! int start = offset; ! offset = anchor; ! int length = document.getLength(); ! while (offset < length) { ! c = document.getChar(offset); ! if (!Character.isJavaIdentifierPart(c)){ ! break; ! } ! ++offset; ! } ! int end = offset; ! if (start == end){ ! textViewer.setSelectedRange(start, 0); ! }else{ ! textViewer.setSelectedRange(start + 1, end - start - 1); ! } ! } catch (BadLocationException x) { ! } ! } } Index: PyCodeScanner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyCodeScanner.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PyCodeScanner.java 14 Jun 2008 22:14:55 -0000 1.10 --- PyCodeScanner.java 28 Sep 2008 12:45:40 -0000 1.11 *************** *** 33,37 **** */ public class PyCodeScanner extends RuleBasedScanner { ! // keywords list has to be alphabetized for the keyword detector to work properly static final public String[] KEYWORDS = { --- 33,37 ---- */ public class PyCodeScanner extends RuleBasedScanner { ! // keywords list has to be alphabetized for the keyword detector to work properly static final public String[] KEYWORDS = { *************** *** 56,88 **** ! /** ! * Whitespace detector. ! * ! * I know, naming the class after a band that burned ! * is not funny, but I've got to get my brain off my ! * annoyance with the abstractions of JFace. ! * So many classes and interfaces for a single method? ! * f$%@#$!! ! */ ! static private class GreatWhite implements IWhitespaceDetector { ! public boolean isWhitespace(char c) {return Character.isWhitespace(c);} ! } ! ! /** ! * Python keyword detector ! */ ! static private class GreatKeywordDetector implements IWordDetector { ! public GreatKeywordDetector() { ! } ! public boolean isWordStart(char c) { ! return Character.isJavaIdentifierStart(c); ! } ! public boolean isWordPart(char c) { ! return Character.isJavaIdentifierPart(c); ! } ! } ! ! static private class DecoratorDetector implements IWordDetector{ /** --- 56,88 ---- ! /** ! * Whitespace detector. ! * ! * I know, naming the class after a band that burned ! * is not funny, but I've got to get my brain off my ! * annoyance with the abstractions of JFace. ! * So many classes and interfaces for a single method? ! * f$%@#$!! ! */ ! static private class GreatWhite implements IWhitespaceDetector { ! public boolean isWhitespace(char c) {return Character.isWhitespace(c);} ! } ! ! /** ! * Python keyword detector ! */ ! static private class GreatKeywordDetector implements IWordDetector { ! public GreatKeywordDetector() { ! } ! public boolean isWordStart(char c) { ! return Character.isJavaIdentifierStart(c); ! } ! public boolean isWordPart(char c) { ! return Character.isJavaIdentifierPart(c); ! } ! } ! ! static private class DecoratorDetector implements IWordDetector{ /** *************** *** 97,106 **** */ public boolean isWordPart(char c) { ! return c != '\n' && c != '\r' && c != '('; } ! ! } ! ! static public class NumberDetector implements IWordDetector{ /** --- 97,106 ---- */ public boolean isWordPart(char c) { ! return c != '\n' && c != '\r' && c != '('; } ! ! } ! ! static public class NumberDetector implements IWordDetector{ /** *************** *** 151,188 **** } } ! ! } ! ! public PyCodeScanner(ColorCache colorCache) { ! super(); ! this.colorCache = colorCache; ! ! setupRules(); ! } ! ! public void updateColors() { ! setupRules(); ! } ! private void setupRules() { ! IPreferenceStore preferences = PydevPlugin.getChainedPrefStore(); ! keywordToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.KEYWORD_COLOR), null, preferences.getInt(PydevPrefs.KEYWORD_STYLE))); ! selfToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.SELF_COLOR), null, preferences.getInt(PydevPrefs.SELF_STYLE))); ! defaultToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.CODE_COLOR), null, preferences.getInt(PydevPrefs.CODE_STYLE))); ! decoratorToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.DECORATOR_COLOR), null, preferences.getInt(PydevPrefs.DECORATOR_STYLE))); ! numberToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.NUMBER_COLOR), null, preferences.getInt(PydevPrefs.NUMBER_STYLE))); ! classNameToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.CLASS_NAME_COLOR), null, preferences.getInt(PydevPrefs.CLASS_NAME_STYLE))); ! funcNameToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.FUNC_NAME_COLOR), null, preferences.getInt(PydevPrefs.FUNC_NAME_STYLE))); ! ! setDefaultReturnToken(defaultToken); ! List<IRule> rules = new ArrayList<IRule>(); ! ! // Scanning strategy: ! // 1) whitespace ! // 2) code ! // 3) regular words? ! ! rules.add(new WhitespaceRule(new GreatWhite())); ! Map<String,IToken> defaults = new HashMap<String, IToken>(); defaults.put("self", selfToken); --- 151,188 ---- } } ! ! } ! ! public PyCodeScanner(ColorCache colorCache) { ! super(); ! this.colorCache = colorCache; ! ! setupRules(); ! } ! ! public void updateColors() { ! setupRules(); ! } ! private void setupRules() { ! IPreferenceStore preferences = PydevPlugin.getChainedPrefStore(); ! keywordToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.KEYWORD_COLOR), null, preferences.getInt(PydevPrefs.KEYWORD_STYLE))); ! selfToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.SELF_COLOR), null, preferences.getInt(PydevPrefs.SELF_STYLE))); ! defaultToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.CODE_COLOR), null, preferences.getInt(PydevPrefs.CODE_STYLE))); ! decoratorToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.DECORATOR_COLOR), null, preferences.getInt(PydevPrefs.DECORATOR_STYLE))); ! numberToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.NUMBER_COLOR), null, preferences.getInt(PydevPrefs.NUMBER_STYLE))); ! classNameToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.CLASS_NAME_COLOR), null, preferences.getInt(PydevPrefs.CLASS_NAME_STYLE))); ! funcNameToken = new Token( new TextAttribute(colorCache.getNamedColor(PydevPrefs.FUNC_NAME_COLOR), null, preferences.getInt(PydevPrefs.FUNC_NAME_STYLE))); ! ! setDefaultReturnToken(defaultToken); ! List<IRule> rules = new ArrayList<IRule>(); ! ! // Scanning strategy: ! // 1) whitespace ! // 2) code ! // 3) regular words? ! ! rules.add(new WhitespaceRule(new GreatWhite())); ! Map<String,IToken> defaults = new HashMap<String, IToken>(); defaults.put("self", selfToken); *************** *** 194,206 **** token = keywordToken; } ! wordRule.addWord( keyword, token); ! } ! rules.add(wordRule); ! rules.add(new WordRule(new DecoratorDetector(), decoratorToken)); ! rules.add(new WordRule(new NumberDetector(), numberToken)); ! ! setRules(rules.toArray(new IRule[0])); ! } } --- 194,206 ---- token = keywordToken; } ! wordRule.addWord( keyword, token); ! } ! rules.add(wordRule); ! rules.add(new WordRule(new DecoratorDetector(), decoratorToken)); ! rules.add(new WordRule(new NumberDetector(), numberToken)); ! ! setRules(rules.toArray(new IRule[0])); ! } } --- ErrorDescription.java DELETED --- Index: IPyEditListener.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/IPyEditListener.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IPyEditListener.java 17 Jan 2007 16:26:13 -0000 1.4 --- IPyEditListener.java 28 Sep 2008 12:45:40 -0000 1.5 *************** *** 9,17 **** public interface IPyEditListener { ! /** ! * Anytime a PyEdit is saved, it will notify that to its listeners. ! * @param edit the PyEdit that has just been saved. ! */ ! void onSave(PyEdit edit, IProgressMonitor monitor); /** --- 9,17 ---- public interface IPyEditListener { ! /** ! * Anytime a PyEdit is saved, it will notify that to its listeners. ! * @param edit the PyEdit that has just been saved. ! */ ! void onSave(PyEdit edit, IProgressMonitor monitor); /** *************** *** 28,31 **** --- 28,38 ---- void onDispose(PyEdit edit, IProgressMonitor monitor); + /** + * Use to notify listeners that the document that the editor was editing has just changed. + * + * @param document the document being edited + * @param edit the editor that had the document changed + * @param monitor the monitor for the change + */ void onSetDocument(IDocument document, PyEdit edit, IProgressMonitor monitor); } |