pydev-cvs Mailing List for PyDev for Eclipse (Page 318)
Brought to you by:
fabioz
You can subscribe to this list here.
2004 |
Jan
|
Feb
(4) |
Mar
(48) |
Apr
(56) |
May
(64) |
Jun
(27) |
Jul
(66) |
Aug
(81) |
Sep
(148) |
Oct
(194) |
Nov
(78) |
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(125) |
Feb
(126) |
Mar
(163) |
Apr
(133) |
May
(115) |
Jun
(307) |
Jul
(387) |
Aug
(417) |
Sep
(283) |
Oct
(148) |
Nov
(45) |
Dec
(53) |
2006 |
Jan
(240) |
Feb
(200) |
Mar
(267) |
Apr
(231) |
May
(245) |
Jun
(361) |
Jul
(142) |
Aug
(12) |
Sep
(210) |
Oct
(99) |
Nov
(7) |
Dec
(30) |
2007 |
Jan
(161) |
Feb
(511) |
Mar
(265) |
Apr
(74) |
May
(147) |
Jun
(151) |
Jul
(94) |
Aug
(68) |
Sep
(98) |
Oct
(144) |
Nov
(26) |
Dec
(36) |
2008 |
Jan
(98) |
Feb
(107) |
Mar
(199) |
Apr
(113) |
May
(119) |
Jun
(112) |
Jul
(92) |
Aug
(71) |
Sep
(101) |
Oct
(16) |
Nov
|
Dec
|
From: Aleksandar T. <at...@us...> - 2004-03-26 23:02:13
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16474/src/org/python/pydev/parser Modified Files: PyParser.java Log Message: Better parser scheduling. Now parser will reparse: - 2 seconds after the last typing - immediately after a newline Index: PyParser.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/parser/PyParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyParser.java 31 Dec 2003 19:35:31 -0000 1.3 --- PyParser.java 26 Mar 2004 22:51:12 -0000 1.4 *************** *** 80,85 **** documentListener = new IDocumentListener() { public void documentChanged(DocumentEvent event) { ! if (parseOnThread == true) ! parsingThread.documentChanged(); else reparseDocument(); --- 80,90 ---- documentListener = new IDocumentListener() { public void documentChanged(DocumentEvent event) { ! if (parseOnThread == true) { ! if (event.getText().indexOf("\n") == -1) ! // carriage return in changed text means parse now, anything else means parse later ! parsingThread.parseLater(); ! else ! parsingThread.parseNow(); ! } else reparseDocument(); *************** *** 91,95 **** parsingThread.start(); if (parseOnThread == true) ! parsingThread.documentChanged(); else reparseDocument(); --- 96,100 ---- parsingThread.start(); if (parseOnThread == true) ! parsingThread.parseNow(); else reparseDocument(); *************** *** 174,185 **** /** ! * Utility thread that reparses document on regular intervals ! * it waits for document to get changed ! * after each reparse, thread waits a bit to avoid flicker */ class ParsingThread extends Thread { PyParser parser; - boolean docChanged = false; boolean stayingAlive = true; ParsingThread(PyParser parser) { --- 179,198 ---- /** ! * Utility thread that reparses document as needed. ! * ! * Current algorithm is: ! * - if parseLater is called, parse 10 main loops later ! * - if parseNow is called, parse immediately */ class ParsingThread extends Thread { PyParser parser; boolean stayingAlive = true; + boolean parseNow = false; + /* counter how to parse. + * 0 means do not parse, > 0 means wait this many loops in main thread + */ + int parseLater = 0; + + final static int PARSE_LATER_INTERVAL = 20; // 20 = 2 seconds ParsingThread(PyParser parser) { *************** *** 187,201 **** } public synchronized void waitForChange() throws InterruptedException { ! if (docChanged == false) wait(); - docChanged = false; } ! public synchronized void documentChanged() { ! docChanged = true; notify(); } public synchronized void diePlease() { stayingAlive = false; --- 200,227 ---- } + /** + * + * @throws InterruptedException + */ public synchronized void waitForChange() throws InterruptedException { ! if (!parseNow && parseLater == 0) wait(); } ! public synchronized void parseNow() { ! parseNow = true; ! notify(); ! } ! ! public synchronized void parseLater() { ! parseLater = PARSE_LATER_INTERVAL; // delay of 1 second notify(); } + public synchronized void doNotParse() { + parseLater = 0; + parseNow = false; + } + public synchronized void diePlease() { stayingAlive = false; *************** *** 207,218 **** try { while (stayingAlive) { ! waitForChange(); ! sleep(2000); // sleep a bit, to avoid flicker ! synchronized(this) { ! docChanged = false; ! } ! if (stayingAlive == true) { // could have been woken up by diePlease() ! parser.reparseDocument(); } } } catch (InterruptedException e) { --- 233,246 ---- try { while (stayingAlive) { ! parseLater--; ! if (parseLater == 1) ! parseNow(); ! if (parseNow) { ! doNotParse(); ! if (stayingAlive) ! parser.reparseDocument(); } + sleep(100); // sleep a bit, to avoid flicker + waitForChange(); } } catch (InterruptedException e) { |
From: Aleks T. <a...@to...> - 2004-03-12 01:07:06
|
The archives for this list have not been updated in a month. Is something broken? Aleks |
From: <at...@us...> - 2004-03-12 00:38:16
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4684 Modified Files: plugin.xml Log Message: Added python nature Added python project properties, dana will finish Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** plugin.xml 5 Mar 2004 14:43:05 -0000 1.8 --- plugin.xml 12 Mar 2004 00:19:05 -0000 1.9 *************** *** 1,286 **** <?xml version="1.0" encoding="UTF-8"?> <plugin ! id="org.python.pydev" ! name="Pydev - Python Development Environment" ! version="0.3.0" ! provider-name="AleksTotic" ! class="org.python.pydev.plugin.PydevPlugin"> ! <runtime> ! <library name="pydev.jar"/> ! </runtime> ! <requires> ! <import plugin="org.eclipse.core.resources"/> ! <import plugin="org.eclipse.core.runtime"/> ! <import plugin="org.eclipse.ui"/> ! <import plugin="org.eclipse.ui.editors"/> ! <import plugin="org.eclipse.ui.views"/> ! <import plugin="org.eclipse.ui.workbench.texteditor"/> ! <import plugin="org.eclipse.jface.text"/> ! </requires> <!-- Python editor --> ! <extension ! point="org.eclipse.ui.editors"> ! <editor ! name="Python Editor" ! icon="icons/sample.gif" ! extensions="py" ! contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor" ! class="org.python.pydev.editor.PyEdit" ! id="org.python.pydev.editor.PythonEditor"> ! </editor> ! </extension> <!-- Preference page --> ! <extension ! point="org.eclipse.ui.preferencePages"> ! <page ! name="Pydev" ! class="org.python.pydev.plugin.PydevPrefs" ! id="org.python.pydev.prefs"> ! </page> ! </extension> <!-- Editor menus --> ! <extension ! point="org.eclipse.ui.editorActions"> ! <editorContribution ! targetID="org.python.pydev.editor.PythonEditor" ! id="org.python.pydev.editor.editorContribution"> ! <menu ! label="Source" ! path="edit" ! id="org.python.pydev.editor.actions.sourceMenu"> ! <separator ! name="editGroup"> ! </separator> ! <separator ! name="addGroup"> ! </separator> ! </menu> ! <action ! definitionId="org.python.pydev.editor.actions.firstChar" ! label="Goto first char" ! class="org.python.pydev.editor.actions.FirstCharAction" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.firstChar"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.uncomment" ! label="Uncomment" ! class="org.python.pydev.editor.actions.PyUncomment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.uncomment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.comment" ! label="Comment" ! class="org.python.pydev.editor.actions.PyComment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.comment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.addBlockComment" ! label="Add comment block" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.navigation.nextMethod" ! label="Goto next method or class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.navigation.previousMethod" ! label="Goto previous method or class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </action> ! </editorContribution> ! </extension> <!-- NOTE: EditorContext part of the targetID was deduced, that is just what Eclipse expects --> <!-- Editor popup menus--> ! <extension ! point="org.eclipse.ui.popupMenus"> ! <viewerContribution ! targetID="org.python.pydev.editor.PythonEditor.EditorContext" ! id="org.python.pydev.editor.popup"> ! <menu ! label="Source" ! id="org.python.pydev.editor.actions.editorPopup"> ! <separator ! name="editGroup"> ! </separator> ! <separator ! name="addGroup"> ! </separator> ! </menu> ! <action ! label="Uncomment" ! class="org.python.pydev.editor.actions.PyUncomment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! id="org.python.pydev.editor.actions.uncomment"> ! </action> ! <action ! label="Comment" ! class="org.python.pydev.editor.actions.PyComment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! id="org.python.pydev.editor.actions.comment"> ! </action> ! <action ! label="Add comment block" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </action> ! <action ! label="Navigate to next method / class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </action> ! <action ! label="Navigate to previous method / class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </action> ! </viewerContribution> ! </extension> <!-- associates commands with keyboard shortcuts --> <!-- Commands --> ! <extension ! point="org.eclipse.ui.commands"> ! <scope ! name="Pydev editor scope" ! parent="org.eclipse.ui.textEditorScope" ! description="Pydev commands" ! id="org.python.pydev.ui.editor.scope"> ! </scope> ! <category ! name="Pydev editor commands" ! description="Pydev editor category" ! id="org.python.pydev.ui.category.source"> ! </category> ! <!-- command: next method / class--> ! <command ! name="First char" ! description="Goes to the first non space char or first char of the line depending on the cursor position." ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.firstChar"> ! </command> ! <keyBinding ! string="Home" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.firstChar" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <!-- command: next method / class--> ! <command ! name="Next Method or Class" ! description="Navigates to the next method or class declaration" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </command> ! <keyBinding ! string="Ctrl+Shift+Arrow_Down" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.navigation.nextMethod" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <!-- command: previous method / class--> ! ! <command ! name="Previous Method or Class" ! description="Navigates to the previous method or class declaration" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </command> ! <keyBinding ! string="Ctrl+Shift+Arrow_Up" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.navigation.previousMethod" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <!-- command: block--> ! <command ! name="Add Comment Block" ! description="Creates a python comment block" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </command> ! <keyBinding ! string="Ctrl+4" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.addBlockComment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! ! <!-- command: uncomment--> ! <command ! name="Python Uncomment" ! description="Uncomments a python line (Removes # from the beggining of the line)" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.uncomment"> ! </command> ! <keyBinding ! string="Ctrl+\" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.uncomment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <keyBinding ! string="Ctrl+Shift+3" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.uncomment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! ! <!-- command: comment--> ! <command ! name="Python Comment" ! description="Comments a python line (Adds # to beggining of the line)" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.comment"> ! </command> ! <keyBinding ! string="Ctrl+/" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.comment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <keyBinding ! string="Ctrl+3" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.comment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! ! </extension> <!-- file type extensions for the team (CVS) --> ! <extension ! point="org.eclipse.team.core.fileTypes"> ! <fileTypes ! type="text" ! extension="py"> ! </fileTypes> ! </extension> ! <extension ! point="org.eclipse.team.core.ignore"> ! <ignore ! enabled="true" ! pattern="*.pyc"> ! </ignore> ! </extension> ! </plugin> --- 1,307 ---- <?xml version="1.0" encoding="UTF-8"?> <plugin ! id="org.python.pydev" ! name="Pydev - Python Development Environment" ! version="0.3.0" ! provider-name="AleksTotic" ! class="org.python.pydev.plugin.PydevPlugin"> ! <runtime> ! <library name="pydev.jar"/> ! </runtime> ! <requires> ! <import plugin="org.eclipse.core.resources"/> ! <import plugin="org.eclipse.core.runtime"/> ! <import plugin="org.eclipse.ui"/> ! <import plugin="org.eclipse.ui.editors"/> ! <import plugin="org.eclipse.ui.views"/> ! <import plugin="org.eclipse.ui.workbench.texteditor"/> ! <import plugin="org.eclipse.jface.text"/> ! </requires> <!-- Python editor --> ! <extension point="org.eclipse.ui.editors"> ! <editor ! name="Python Editor" ! icon="icons/sample.gif" ! extensions="py" ! contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor" ! class="org.python.pydev.editor.PyEdit" ! id="org.python.pydev.editor.PythonEditor"> ! </editor> ! </extension> ! ! <!-- Python nature --> ! <extension point="org.eclipse.core.resources.natures" ! id="pythonNature" ! name="Python Nature"> ! <runtime> ! <run class="org.python.pydev.plugin.PythonNature"/> ! </runtime> ! </extension> ! ! <extension point="org.eclipse.ui.projectNatureImages"> ! <image ! icon="icons/pythonNature.gif" ! natureId="org.python.pydev.pythonNature" ! id="org.python.pydev.ui.projectNatureImage"> ! </image> ! </extension> ! ! <!-- Python project properties --> ! <extension point="org.eclipse.ui.propertyPages"> ! <page ! objectClass="org.eclipse.core.resources.IProject" ! name="Python" ! class="org.python.pydev.ui.ProjectProperties" ! id="org.python.pydev.ui.projectProperties"> ! <filter ! name="projectNature" ! value="org.python.pydev.pythonNature"> ! </filter> ! </page> ! </extension> ! <!-- Preference page --> ! <extension ! point="org.eclipse.ui.preferencePages"> ! <page ! name="Pydev" ! class="org.python.pydev.plugin.PydevPrefs" ! id="org.python.pydev.prefs"> ! </page> ! </extension> ! <!-- Editor menus --> ! <extension ! point="org.eclipse.ui.editorActions"> ! <editorContribution ! targetID="org.python.pydev.editor.PythonEditor" ! id="org.python.pydev.editor.editorContribution"> ! <menu ! label="Source" ! path="edit" ! id="org.python.pydev.editor.actions.sourceMenu"> ! <separator ! name="editGroup"> ! </separator> ! <separator ! name="addGroup"> ! </separator> ! </menu> ! <action ! definitionId="org.python.pydev.editor.actions.firstChar" ! label="Goto first char" ! class="org.python.pydev.editor.actions.FirstCharAction" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.firstChar"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.uncomment" ! label="Uncomment" ! class="org.python.pydev.editor.actions.PyUncomment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.uncomment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.comment" ! label="Comment" ! class="org.python.pydev.editor.actions.PyComment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.comment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.addBlockComment" ! label="Add comment block" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.navigation.nextMethod" ! label="Goto next method or class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.navigation.previousMethod" ! label="Goto previous method or class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </action> ! </editorContribution> ! </extension> <!-- NOTE: EditorContext part of the targetID was deduced, that is just what Eclipse expects --> <!-- Editor popup menus--> ! <extension ! point="org.eclipse.ui.popupMenus"> ! <viewerContribution ! targetID="org.python.pydev.editor.PythonEditor.EditorContext" ! id="org.python.pydev.editor.popup"> ! <menu ! label="Source" ! id="org.python.pydev.editor.actions.editorPopup"> ! <separator ! name="editGroup"> ! </separator> ! <separator ! name="addGroup"> ! </separator> ! </menu> ! <action ! label="Uncomment" ! class="org.python.pydev.editor.actions.PyUncomment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! id="org.python.pydev.editor.actions.uncomment"> ! </action> ! <action ! label="Comment" ! class="org.python.pydev.editor.actions.PyComment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! id="org.python.pydev.editor.actions.comment"> ! </action> ! <action ! label="Add comment block" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </action> ! <action ! label="Navigate to next method / class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </action> ! <action ! label="Navigate to previous method / class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </action> ! </viewerContribution> ! </extension> <!-- associates commands with keyboard shortcuts --> <!-- Commands --> ! <extension ! point="org.eclipse.ui.commands"> ! <scope ! name="Pydev editor scope" ! parent="org.eclipse.ui.textEditorScope" ! description="Pydev commands" ! id="org.python.pydev.ui.editor.scope"> ! </scope> ! <category ! name="Pydev editor commands" ! description="Pydev editor category" ! id="org.python.pydev.ui.category.source"> ! </category> <!-- command: next method / class--> ! <command ! name="First char" ! description="Goes to the first non space char or first char of the line depending on the cursor position." ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.firstChar"> ! </command> ! <keyBinding ! string="Home" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.firstChar" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> <!-- command: next method / class--> ! <command ! name="Next Method or Class" ! description="Navigates to the next method or class declaration" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </command> ! <keyBinding ! string="Ctrl+Shift+Arrow_Down" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.navigation.nextMethod" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> <!-- command: previous method / class--> ! <command ! name="Previous Method or Class" ! description="Navigates to the previous method or class declaration" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </command> ! <keyBinding ! string="Ctrl+Shift+Arrow_Up" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.navigation.previousMethod" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> <!-- command: block--> ! <command ! name="Add Comment Block" ! description="Creates a python comment block" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </command> ! <keyBinding ! string="Ctrl+4" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.addBlockComment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> <!-- command: uncomment--> ! <command ! name="Python Uncomment" ! description="Uncomments a python line (Removes # from the beggining of the line)" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.uncomment"> ! </command> ! <keyBinding ! string="Ctrl+\" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.uncomment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <keyBinding ! string="Ctrl+Shift+3" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.uncomment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> <!-- command: comment--> ! <command ! name="Python Comment" ! description="Comments a python line (Adds # to beggining of the line)" ! category="org.python.pydev.ui.category.source" ! id="org.python.pydev.editor.actions.comment"> ! </command> ! <keyBinding ! string="Ctrl+/" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.comment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <keyBinding ! string="Ctrl+3" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.comment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! </extension> <!-- file type extensions for the team (CVS) --> ! <extension ! point="org.eclipse.team.core.fileTypes"> ! <fileTypes ! type="text" ! extension="py"> ! </fileTypes> ! </extension> ! <extension ! point="org.eclipse.team.core.ignore"> ! <ignore ! enabled="true" ! pattern="*.pyc"> ! </ignore> ! </extension> </plugin> |
From: <at...@us...> - 2004-03-12 00:37:48
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4555/src/org/python/pydev/editor Modified Files: PyEditConfiguration.java PyDocumentProvider.java PyEdit.java Log Message: Added python nature Added python project properties, dana will finish Index: PyEditConfiguration.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEditConfiguration.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyEditConfiguration.java 8 Jan 2004 22:42:19 -0000 1.4 --- PyEditConfiguration.java 12 Mar 2004 00:18:40 -0000 1.5 *************** *** 123,127 **** ISourceViewer sourceViewer, String contentType) { ! // TODO Auto-generated method stub return super.getDoubleClickStrategy(sourceViewer, contentType); } --- 123,127 ---- ISourceViewer sourceViewer, String contentType) { ! // TODO Implement smarter double-click strategy return super.getDoubleClickStrategy(sourceViewer, contentType); } Index: PyDocumentProvider.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyDocumentProvider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyDocumentProvider.java 10 Dec 2003 10:14:27 -0000 1.2 --- PyDocumentProvider.java 12 Mar 2004 00:18:40 -0000 1.3 *************** *** 7,10 **** --- 7,11 ---- package org.python.pydev.editor; + import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.IDocument; *************** *** 12,15 **** --- 13,18 ---- import org.eclipse.jface.text.rules.DefaultPartitioner; import org.eclipse.ui.editors.text.FileDocumentProvider; + import org.eclipse.ui.part.FileEditorInput; + import org.python.pydev.plugin.PythonNature; /** *************** *** 36,39 **** --- 39,51 ---- document.setDocumentPartitioner(partitioner); } + + // Also adds Python nature to the project. + // The reason this is done here is because I want to assign python + // nature automatically to any project that has active python files. + if (element instanceof FileEditorInput) { + IFile file = (IFile)((FileEditorInput)element).getAdapter(IFile.class); + if (file != null) + PythonNature.addNature(file.getProject(), null); + } return document; } Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyEdit.java 5 Mar 2004 22:07:04 -0000 1.7 --- PyEdit.java 12 Mar 2004 00:18:40 -0000 1.8 *************** *** 77,80 **** --- 77,81 ---- indentStrategy = (PyAutoIndentStrategy)editConfiguration.getAutoIndentStrategy(null, null); setRangeIndicator(new DefaultRangeIndicator()); // enables standard vertical ruler + } |
From: <at...@us...> - 2004-03-12 00:37:48
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4555/src/org/python/pydev/plugin Added Files: PythonNature.java Log Message: Added python nature Added python project properties, dana will finish --- NEW FILE: PythonNature.java --- /* * Author: atotic * Created on Mar 11, 2004 * License: Common Public License v1.0 */ package org.python.pydev.plugin; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; /** * PythonNature is currently used as a marker class. * * When python nature is present, project gets extra properties. * Project gets assigned python nature when: * - a python file is edited * - a python project wizard is created */ public class PythonNature implements IProjectNature { public static final String PYTHON_NATURE_ID = "org.python.pydev.pythonNature"; public static final String PYTHON_NATURE_NAME = "pythonNature"; IProject project; public void configure() throws CoreException { } public void deconfigure() throws CoreException { } public IProject getProject() { return project; } public void setProject(IProject project) { this.project = project; } /** * Utility routine to add PythonNature to the project */ public static void addNature(IProject project, IProgressMonitor monitor) throws CoreException { if (project == null || project.hasNature(PYTHON_NATURE_ID)) return; IProjectDescription desc = project.getDescription(); String[] natures = desc.getNatureIds(); String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = PYTHON_NATURE_ID; desc.setNatureIds(newNatures); project.setDescription(desc, monitor); } } |
From: <at...@us...> - 2004-03-12 00:37:47
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4555/src/org/python/pydev/ui Added Files: ProjectProperties.java Log Message: Added python nature Added python project properties, dana will finish --- NEW FILE: ProjectProperties.java --- /* * Author: atotic * Created on Mar 11, 2004 * License: Common Public License v1.0 */ package org.python.pydev.ui; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.dialogs.PropertyPage; import org.python.pydev.plugin.PydevPlugin; /** * TODO just a stub for now. Dana will implement real include preferenecs */ public class ProjectProperties extends PropertyPage { Text pathText; public static QualifiedName INCLUDE_PATH_PROP = new QualifiedName("test", "INCLUDE_PATH"); /** * Sample */ protected Control createContents(Composite parent) { Composite topComp= new Composite(parent, SWT.NONE); GridLayout topLayout= new GridLayout(); topLayout.numColumns= 2; topLayout.marginWidth= 0; topLayout.marginHeight= 0; topComp.setLayout(topLayout); Label pathLabel = new Label(topComp, SWT.NONE); pathLabel.setText("Include path"); GridData data = new GridData (); data.verticalAlignment = GridData.BEGINNING; pathLabel.setLayoutData (data); pathText = new Text (topComp, SWT.BORDER); data = new GridData (); data.grabExcessHorizontalSpace = true; pathText.setLayoutData (data); return topComp; } /** * Saves values into the project */ public boolean performOk() { IProject project = (IProject)getElement().getAdapter(IProject.class); if (project != null) { try { project.setPersistentProperty(INCLUDE_PATH_PROP, pathText.getText()); } catch (CoreException e) { PydevPlugin.log(IStatus.ERROR, "Unexpected error setting project properties", e); } } return true; } } |
From: <at...@us...> - 2004-03-12 00:35:07
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3590 Added Files: Changes.txt Log Message: Added python nature Added python project properties, dana will finish --- NEW FILE: Changes.txt --- org.python.pydev Since 0.3 New features: - Added team file extensions for .py & .pyc - Added "Source" menu to the editor: comment/goto methods implemented by fabioz - Added Python nature, and nature icon. Nature get automatically added to any project that opens a python editor. - Added Python properties to projects that have Python nature Bug fixes: |
From: <at...@us...> - 2004-03-12 00:34:25
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3419 Modified Files: .classpath Log Message: cleanup Index: .classpath =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/.classpath,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** .classpath 10 Jan 2004 03:08:36 -0000 1.4 --- .classpath 12 Mar 2004 00:15:03 -0000 1.5 *************** *** 2,31 **** <classpath> <classpathentry kind="src" path="src/"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.core.resources_2.1.1/resources.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.resources_2.1.1/resourcessrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.1.1/runtime.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.runtime_2.1.1/runtimesrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.1.1/ui.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui_2.1.1/uisrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.swt.win32_2.1.2/ws/win32/swt.jar" sourcepath="ORG_ECLIPSE_PLATFORM_WIN32_SOURCE_SRC/org.eclipse.swt.win32_2.1.2/ws/win32/swtsrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.text_2.1.0/text.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.text_2.1.0/textsrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.jface_2.1.1/jface.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.jface_2.1.1/jfacesrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.jface.text_2.1.0/jfacetext.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.jface.text_2.1.0/jfacetextsrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.ui.views_2.1.0/views.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.views_2.1.0/viewssrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.ui.workbench_2.1.1/workbench.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.workbench_2.1.1/workbenchsrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.ui.win32_2.1.0/workbenchwin32.jar" sourcepath="ORG_ECLIPSE_PLATFORM_WIN32_SOURCE_SRC/org.eclipse.ui.win32_2.1.0/workbenchwin32src.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.ui.workbench.texteditor_2.1.0/texteditor.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.workbench.texteditor_2.1.0/texteditorsrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.ui.editors_2.1.0/editors.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.editors_2.1.0/editorssrc.zip"/> ! <classpathentry kind="var" ! path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.1.2/boot.jar" sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.boot_2.1.2/bootsrc.zip"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> --- 2,6 ---- <classpath> <classpathentry kind="src" path="src/"/> ! <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> |
From: <at...@us...> - 2004-03-12 00:32:54
|
Update of /cvsroot/pydev/org.python.pydev/icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2931/icons Added Files: pythonNature.gif Log Message: Added python nature Added python project properties, dana will finish --- NEW FILE: pythonNature.gif --- (This appears to be a binary file; contents omitted.) |
From: <at...@us...> - 2004-03-12 00:32:37
|
Update of /cvsroot/pydev/org.python.pydev/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2859/doc Modified Files: .cvsignore Log Message: cleanup Index: .cvsignore =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/doc/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 17 Aug 2003 04:44:22 -0000 1.1 --- .cvsignore 12 Mar 2004 00:13:28 -0000 1.2 *************** *** 1,2 **** ! IXMLColorConstants.java ! TagRule.java --- 1 ---- ! |
From: <at...@us...> - 2004-03-12 00:32:36
|
Update of /cvsroot/pydev/org.python.pydev/doc/javadoc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2798/doc/javadoc Added Files: .cvsignore Log Message: cleanup --- NEW FILE: .cvsignore --- *.html *.css package-list org resources |
From: <at...@us...> - 2004-03-12 00:30:36
|
Update of /cvsroot/pydev/org.python.pydev/doc/javadoc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2349/doc/javadoc Log Message: Directory /cvsroot/pydev/org.python.pydev/doc/javadoc added to the repository |
From: <at...@us...> - 2004-03-05 22:21:32
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11879/src/org/python/pydev/editor Modified Files: PyEdit.java Log Message: One last refactor, change setSelectionInEditor to setSelection Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyEdit.java 5 Mar 2004 22:04:44 -0000 1.6 --- PyEdit.java 5 Mar 2004 22:07:04 -0000 1.7 *************** *** 195,199 **** } ! public void selectSelectionInEditor(SelectionPosition newSel) { if (newSel.r != null) { setSelection(newSel.r.getOffset(), newSel.r.getLength()); --- 195,202 ---- } ! /** ! * Reveals the selection ! */ ! public void setSelection(SelectionPosition newSel) { if (newSel.r != null) { setSelection(newSel.r.getOffset(), newSel.r.getLength()); |
From: <at...@us...> - 2004-03-05 22:21:32
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11879/src/org/python/pydev/outline Modified Files: PyOutlinePage.java Log Message: One last refactor, change setSelectionInEditor to setSelection Index: PyOutlinePage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/PyOutlinePage.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyOutlinePage.java 5 Mar 2004 22:04:44 -0000 1.5 --- PyOutlinePage.java 5 Mar 2004 22:07:04 -0000 1.6 *************** *** 208,212 **** if (newSel == null) return; ! editorView.selectSelectionInEditor(newSel); } }; --- 208,212 ---- if (newSel == null) return; ! editorView.setSelection(newSel); } }; |
From: <at...@us...> - 2004-03-05 22:21:31
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11879/src/org/python/pydev/editor/actions/navigation Modified Files: PyMethodNavigation.java Log Message: One last refactor, change setSelectionInEditor to setSelection Index: PyMethodNavigation.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation/PyMethodNavigation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyMethodNavigation.java 5 Mar 2004 22:04:44 -0000 1.2 --- PyMethodNavigation.java 5 Mar 2004 22:07:04 -0000 1.3 *************** *** 129,133 **** // print("select = " + select); if (select != null) { ! pyEdit.selectSelectionInEditor(select); } model.dispose(); --- 129,133 ---- // print("select = " + select); if (select != null) { ! pyEdit.setSelection(select); } model.dispose(); |
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11341/src/org/python/pydev/outline Modified Files: ParsedModel.java PyOutlinePage.java IOutlineModel.java RawPartitionModel.java ParsedItem.java Added Files: SelectionPosition.java Log Message: Refactoring of the fabioz changes --- NEW FILE: SelectionPosition.java --- /* * Author: fabioz, refactored by atotic * Created on Mar 5, 2004 * License: Common Public License v1.0 */ package org.python.pydev.outline; import org.eclipse.jface.text.IRegion; /** * Simple struct class that describes what to select * */ public final class SelectionPosition { public IRegion r; public int line; public int column; // use WHOLE_LINE to select the whole line public int length; public static final int WHOLE_LINE=999; SelectionPosition(IRegion r) { this.r = r; } SelectionPosition(int line, int column, int length) { this.line = line; this.column = column; this.length = length; this.r = null; } }; Index: ParsedModel.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/ParsedModel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ParsedModel.java 5 Mar 2004 14:39:34 -0000 1.2 --- ParsedModel.java 5 Mar 2004 22:04:43 -0000 1.3 *************** *** 26,33 **** --- 26,39 ---- ParsedItem root = null; // A list of top nodes in this document. Used as a tree root + /** + * @param outline - If not null, view to notify when parser changes + * @param parser + */ public ParsedModel(PyOutlinePage outline, PyParser parser) { this.parser = parser; this.outline = outline; + // The notifications are only propagated to the outline page + // // Tell parser that we want to know about all the changes // make sure that the changes are propagated on the main thread *************** *** 53,61 **** }; parser.addParseListener(parserListener); ! root = new ParsedItem(null, parser.getRoot()); } ! public void dispose() { parser.removeParseListener(parserListener); } --- 59,67 ---- }; parser.addParseListener(parserListener); ! root = new ParsedItem(null, parser.getRoot()); } ! public void dispose() { parser.removeParseListener(parserListener); } *************** *** 104,109 **** ArrayList itemsToUpdate = new ArrayList(); patchRootHelper(root, newRoot, itemsToRefresh, itemsToUpdate, true); ! outline.updateItems(itemsToUpdate.toArray()); ! outline.refreshItems(itemsToRefresh.toArray()); } else --- 110,117 ---- ArrayList itemsToUpdate = new ArrayList(); patchRootHelper(root, newRoot, itemsToRefresh, itemsToUpdate, true); ! if (outline != null) { ! outline.updateItems(itemsToUpdate.toArray()); ! outline.refreshItems(itemsToRefresh.toArray()); ! } } else *************** *** 119,124 **** /* */ ! public IOutlineModel.SelectThis selectionChanged(StructuredSelection sel) { ! IOutlineModel.SelectThis position = null; if(sel.size() == 1) { // only sync the editing view if it is a single-selection ParsedItem p = (ParsedItem)sel.getFirstElement(); --- 127,132 ---- /* */ ! public SelectionPosition getSelectionPosition(StructuredSelection sel) { ! SelectionPosition position = null; if(sel.size() == 1) { // only sync the editing view if it is a single-selection ParsedItem p = (ParsedItem)sel.getFirstElement(); Index: PyOutlinePage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/PyOutlinePage.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyOutlinePage.java 5 Mar 2004 14:41:34 -0000 1.4 --- PyOutlinePage.java 5 Mar 2004 22:04:44 -0000 1.5 *************** *** 11,17 **** import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IToolBarManager; - import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; - import org.eclipse.jface.text.IRegion; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ISelectionChangedListener; --- 11,15 ---- *************** *** 207,214 **** public void selectionChanged(SelectionChangedEvent event) { StructuredSelection sel = (StructuredSelection)tree.getSelection(); ! IOutlineModel.SelectThis newSel = model.selectionChanged(sel); if (newSel == null) return; ! selectSelectionInEditor(newSel,editorView); } }; --- 205,212 ---- public void selectionChanged(SelectionChangedEvent event) { StructuredSelection sel = (StructuredSelection)tree.getSelection(); ! SelectionPosition newSel = model.getSelectionPosition(sel); if (newSel == null) return; ! editorView.selectSelectionInEditor(newSel); } }; *************** *** 216,240 **** createActions(); } - - public static void selectSelectionInEditor(IOutlineModel.SelectThis newSel, PyEdit editorView) { - if (newSel.r != null) { - editorView.setSelection(newSel.r.getOffset(), newSel.r.getLength()); - } - else { - IDocumentProvider provider = editorView.getDocumentProvider(); - IDocument document = provider.getDocument(editorView.getEditorInput()); - try { - IRegion r = document.getLineInformation(newSel.line - 1); - // if selecting the whole line, just use the information - if (newSel.column == IOutlineModel.SelectThis.WHOLE_LINE) { - newSel.column = 0; - newSel.length = r.getLength(); - } - editorView.setSelection(r.getOffset() + newSel.column, newSel.length); - } catch (BadLocationException e) { - e.printStackTrace(); - } - } - } } --- 214,217 ---- Index: IOutlineModel.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/IOutlineModel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IOutlineModel.java 5 Mar 2004 14:36:37 -0000 1.3 --- IOutlineModel.java 5 Mar 2004 22:04:44 -0000 1.4 *************** *** 6,10 **** package org.python.pydev.outline; - import org.eclipse.jface.text.Region; import org.eclipse.jface.viewers.StructuredSelection; --- 6,9 ---- *************** *** 27,30 **** --- 26,30 ---- */ int compare(Object e1, Object e2); + /** * this will be called in response to selection event *************** *** 32,55 **** * @return Point that contains line/column, or item to be selected */ ! SelectThis selectionChanged(StructuredSelection sel); ! ! class SelectThis { ! public Region r; ! ! int line; ! int column; // use WHOLE_LINE to select the whole line ! int length; ! ! static final int WHOLE_LINE=999; ! ! SelectThis(Region r) { ! this.r = r; ! } ! SelectThis(int line, int column, int length) { ! this.line = line; ! this.column = column; ! this.length = length; ! this.r = null; ! } ! }; } --- 32,35 ---- * @return Point that contains line/column, or item to be selected */ ! SelectionPosition getSelectionPosition(StructuredSelection sel); } Index: RawPartitionModel.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/RawPartitionModel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RawPartitionModel.java 10 Dec 2003 10:14:27 -0000 1.2 --- RawPartitionModel.java 5 Mar 2004 22:04:44 -0000 1.3 *************** *** 113,117 **** // IOutlineModel API ! public IOutlineModel.SelectThis selectionChanged(StructuredSelection sel) { Region r = null; if(sel.size() == 1) { // only sync the editing view if it is a single-selection --- 113,117 ---- // IOutlineModel API ! public SelectionPosition getSelectionPosition(StructuredSelection sel) { Region r = null; if(sel.size() == 1) { // only sync the editing view if it is a single-selection *************** *** 119,123 **** r = new Region(p.offset, p.length); } ! return new IOutlineModel.SelectThis(r); } --- 119,123 ---- r = new Region(p.offset, p.length); } ! return new SelectionPosition(r); } Index: ParsedItem.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/ParsedItem.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ParsedItem.java 5 Mar 2004 14:38:51 -0000 1.5 --- ParsedItem.java 5 Mar 2004 22:04:44 -0000 1.6 *************** *** 111,115 **** * @return where in the document is this item located */ ! public IOutlineModel.SelectThis getPosition() { return getPosition(token); } --- 111,115 ---- * @return where in the document is this item located */ ! public SelectionPosition getPosition() { return getPosition(token); } *************** *** 118,122 **** * @return where in the document is this item located */ ! public static IOutlineModel.SelectThis getPosition(SimpleNode token) { int startOffset = 0; boolean wholeLine = false; --- 118,122 ---- * @return where in the document is this item located */ ! public static SelectionPosition getPosition(SimpleNode token) { int startOffset = 0; boolean wholeLine = false; *************** *** 135,142 **** } ! IOutlineModel.SelectThis position = new IOutlineModel.SelectThis(token.beginLine, token.beginColumn+startOffset, toString(token).length()); if (wholeLine) ! position.column = IOutlineModel.SelectThis.WHOLE_LINE; return position; } --- 135,142 ---- } ! SelectionPosition position = new SelectionPosition(token.beginLine, token.beginColumn+startOffset, toString(token).length()); if (wholeLine) ! position.column = SelectionPosition.WHOLE_LINE; return position; } |
From: <at...@us...> - 2004-03-05 22:19:08
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11341/src/org/python/pydev/editor/actions Modified Files: PyAddBlockComment.java PyAction.java package.html Log Message: Refactoring of the fabioz changes Index: PyAddBlockComment.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyAddBlockComment.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyAddBlockComment.java 28 Feb 2004 05:13:16 -0000 1.1 --- PyAddBlockComment.java 5 Mar 2004 22:04:44 -0000 1.2 *************** *** 21,25 **** /** ! * Create a block #===... * # * #===... --- 21,26 ---- /** ! * Insert a comment block. ! * #===... * # * #===... Index: PyAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyAction.java 5 Mar 2004 14:43:05 -0000 1.2 --- PyAction.java 5 Mar 2004 22:04:44 -0000 1.3 *************** *** 57,61 **** * @param doc * @param startLineIndex ! * @return * @throws BadLocationException */ --- 57,61 ---- * @param doc * @param startLineIndex ! * @return delimiter for the document (\n|\r\|r\n) * @throws BadLocationException */ *************** *** 71,75 **** /** * This function returns the text editor. - * @return */ protected ITextEditor getTextEditor() { --- 71,74 ---- *************** *** 133,137 **** * @param doc * @param cursorOffset ! * @return * @throws BadLocationException */ --- 132,136 ---- * @param doc * @param cursorOffset ! * @return position of the first character of the line * @throws BadLocationException */ *************** *** 197,201 **** //================================================================ ! /** * Beep...humm... yeah....beep....ehehheheh */ --- 196,200 ---- //================================================================ ! /* * Beep...humm... yeah....beep....ehehheheh */ Index: package.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** package.html 28 Feb 2004 05:13:16 -0000 1.1 --- package.html 5 Mar 2004 22:04:44 -0000 1.2 *************** *** 9,11 **** --- 9,12 ---- <li>If you are adding your action to top-level menus, see org.eclipse.ui.editorActions <li>If you adding your action to context popup, see org.eclipse.ui.popupMenus + <li>For keyboard shortcuts see org.eclipse.ui.commands </body> \ No newline at end of file |
From: <at...@us...> - 2004-03-05 22:19:08
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11341/src/org/python/pydev/editor/actions/navigation Modified Files: PyPreviousMethod.java PyNextMethod.java PyMethodNavigation.java Log Message: Refactoring of the fabioz changes Index: PyPreviousMethod.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation/PyPreviousMethod.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyPreviousMethod.java 5 Mar 2004 14:43:05 -0000 1.1 --- PyPreviousMethod.java 5 Mar 2004 22:04:44 -0000 1.2 *************** *** 8,12 **** import org.python.pydev.outline.ParsedItem; ! import org.python.pydev.outline.IOutlineModel.SelectThis; /** --- 8,12 ---- import org.python.pydev.outline.ParsedItem; ! import org.python.pydev.outline.SelectionPosition; /** *************** *** 15,19 **** public class PyPreviousMethod extends PyMethodNavigation{ ! public SelectThis getSelect(Visitor v) { if (v.prevNode != null){ return ParsedItem.getPosition(v.prevNode); --- 15,19 ---- public class PyPreviousMethod extends PyMethodNavigation{ ! public SelectionPosition getSelect(Visitor v) { if (v.prevNode != null){ return ParsedItem.getPosition(v.prevNode); Index: PyNextMethod.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation/PyNextMethod.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyNextMethod.java 5 Mar 2004 14:43:05 -0000 1.1 --- PyNextMethod.java 5 Mar 2004 22:04:44 -0000 1.2 *************** *** 8,12 **** import org.python.pydev.outline.ParsedItem; ! import org.python.pydev.outline.IOutlineModel.SelectThis; /** --- 8,12 ---- import org.python.pydev.outline.ParsedItem; ! import org.python.pydev.outline.SelectionPosition; /** *************** *** 15,19 **** public class PyNextMethod extends PyMethodNavigation{ ! public SelectThis getSelect(Visitor v) { if (v.nextNode != null){ return ParsedItem.getPosition(v.nextNode); --- 15,19 ---- public class PyNextMethod extends PyMethodNavigation{ ! public SelectionPosition getSelect(Visitor v) { if (v.nextNode != null){ return ParsedItem.getPosition(v.nextNode); Index: PyMethodNavigation.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation/PyMethodNavigation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyMethodNavigation.java 5 Mar 2004 14:43:05 -0000 1.1 --- PyMethodNavigation.java 5 Mar 2004 22:04:44 -0000 1.2 *************** *** 10,14 **** import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; - import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.python.parser.SimpleNode; import org.python.parser.ast.ClassDef; --- 10,13 ---- *************** *** 17,23 **** import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.actions.PyAction; - import org.python.pydev.outline.IOutlineModel; import org.python.pydev.outline.ParsedItem; ! import org.python.pydev.outline.PyOutlinePage; /** --- 16,22 ---- import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.actions.PyAction; import org.python.pydev.outline.ParsedItem; ! import org.python.pydev.outline.ParsedModel; ! import org.python.pydev.outline.SelectionPosition; /** *************** *** 115,133 **** ITextSelection selection = (ITextSelection) pyEdit.getSelectionProvider().getSelection(); ! ! PyOutlinePage out = ! (PyOutlinePage) pyEdit.getAdapter(IContentOutlinePage.class); ! ParsedItem item = (ParsedItem) out.getParsedModel().getRoot(); SimpleNode node = item.getToken(); int startLine = selection.getStartLine(); Visitor v = whereAmI(startLine, node); // print (v.nextNode); ! IOutlineModel.SelectThis select = getSelect(v); // print("select = " + select); if (select != null) { ! PyOutlinePage.selectSelectionInEditor(select,pyEdit); } } --- 114,135 ---- ITextSelection selection = (ITextSelection) pyEdit.getSelectionProvider().getSelection(); ! ! ParsedModel model = new ParsedModel(null, pyEdit.getParser()); ! ParsedItem item = (ParsedItem)model.getRoot(); SimpleNode node = item.getToken(); + if (node == null) + return; + int startLine = selection.getStartLine(); Visitor v = whereAmI(startLine, node); // print (v.nextNode); ! SelectionPosition select = getSelect(v); // print("select = " + select); if (select != null) { ! pyEdit.selectSelectionInEditor(select); } + model.dispose(); } *************** *** 159,163 **** * @return */ ! public abstract IOutlineModel.SelectThis getSelect(Visitor v); } --- 161,165 ---- * @return */ ! public abstract SelectionPosition getSelect(Visitor v); } |
From: <at...@us...> - 2004-03-05 22:19:08
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11341/src/org/python/pydev/editor Modified Files: PyEdit.java Log Message: Refactoring of the fabioz changes Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyEdit.java 28 Feb 2004 05:13:16 -0000 1.5 --- PyEdit.java 5 Mar 2004 22:04:44 -0000 1.6 *************** *** 22,25 **** --- 22,26 ---- import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.texteditor.DefaultRangeIndicator; + import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.IEditorStatusLine; import org.eclipse.ui.texteditor.MarkerUtilities; *************** *** 32,35 **** --- 33,37 ---- import org.python.pydev.plugin.PydevPrefs; import org.python.pydev.outline.PyOutlinePage; + import org.python.pydev.outline.SelectionPosition; import org.python.pydev.parser.IParserListener; import org.python.pydev.parser.PyParser; *************** *** 193,196 **** --- 195,219 ---- } + public void selectSelectionInEditor(SelectionPosition newSel) { + if (newSel.r != null) { + setSelection(newSel.r.getOffset(), newSel.r.getLength()); + } + else { + IDocumentProvider provider = getDocumentProvider(); + IDocument document = provider.getDocument(getEditorInput()); + try { + IRegion r = document.getLineInformation(newSel.line - 1); + // if selecting the whole line, just use the information + if (newSel.column == SelectionPosition.WHOLE_LINE) { + newSel.column = 0; + newSel.length = r.getLength(); + } + setSelection(r.getOffset() + newSel.column, newSel.length); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + } + /** * this event comes when document was parsed without errors |
From: <fa...@us...> - 2004-03-05 16:34:47
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2085 Modified Files: plugin.xml Log Message: Short cut launching class changed package (refactored). Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** plugin.xml 10 Jan 2004 03:13:34 -0000 1.2 --- plugin.xml 5 Mar 2004 16:20:36 -0000 1.3 *************** *** 61,65 **** icon="icons/python.gif" modes="run, debug" ! class="org.python.pydev.debug.launching.LaunchShortcut" id="org.python.pydev.debug.launchShortcut"> </shortcut> --- 61,65 ---- icon="icons/python.gif" modes="run, debug" ! class="org.python.pydev.debug.ui.launching.LaunchShortcut" id="org.python.pydev.debug.launchShortcut"> </shortcut> |
From: <fa...@us...> - 2004-03-05 14:57:54
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12688 Modified Files: plugin.xml Log Message: Method navigation added and commands in the scope, so that the user can change the keybindings. Also added keybindigs for next / previous method / class. Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** plugin.xml 28 Feb 2004 05:11:46 -0000 1.7 --- plugin.xml 5 Mar 2004 14:43:05 -0000 1.8 *************** *** 1,148 **** <?xml version="1.0" encoding="UTF-8"?> <plugin ! id="org.python.pydev" ! name="Pydev - Python Development Environment" ! version="0.3.0" ! provider-name="AleksTotic" ! class="org.python.pydev.plugin.PydevPlugin"> ! <runtime> ! <library name="pydev.jar"/> ! </runtime> ! <requires> ! <import plugin="org.eclipse.core.resources"/> ! <import plugin="org.eclipse.core.runtime"/> ! <import plugin="org.eclipse.ui"/> ! <import plugin="org.eclipse.ui.editors"/> ! <import plugin="org.eclipse.ui.views"/> ! <import plugin="org.eclipse.ui.workbench.texteditor"/> ! <import plugin="org.eclipse.jface.text"/> ! </requires> <!-- Python editor --> ! <extension point="org.eclipse.ui.editors"> ! <editor ! name="Python Editor" ! icon="icons/sample.gif" ! extensions="py" ! contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor" ! class="org.python.pydev.editor.PyEdit" ! id="org.python.pydev.editor.PythonEditor"> ! </editor> ! </extension> ! <!-- Preference page --> ! <extension point="org.eclipse.ui.preferencePages"> ! <page ! name="Pydev" ! class="org.python.pydev.plugin.PydevPrefs" ! id="org.python.pydev.prefs"> ! </page> ! </extension> ! <!-- Editor menus --> ! <extension point="org.eclipse.ui.editorActions"> ! <editorContribution ! id="org.python.pydev.editor.editorContribution" ! targetID="org.python.pydev.editor.PythonEditor"> ! <menu id="org.python.pydev.editor.actions.sourceMenu" ! label="Source" ! path="edit"> ! <separator name="editGroup"/> ! <separator name="addGroup"/> ! </menu> ! <action id="org.python.pydev.editor.actions.uncomment" ! label="Uncomment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! class="org.python.pydev.editor.actions.PyUncomment" ! definitionId="org.python.pydev.editor.actions.uncomment" ! > ! </action> ! <action id="org.python.pydev.editor.actions.comment" ! label="Comment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! class="org.python.pydev.editor.actions.PyComment" ! definitionId="org.python.pydev.editor.actions.comment" ! > ! </action> ! <action id="org.python.pydev.editor.actions.addBlockComment" ! label="Add comment block" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! definitionId="org.python.pydev.editor.actions.addBlockComment" ! > ! </action> ! </editorContribution> ! </extension> ! ! <!-- Editor popup menus--> <!-- NOTE: EditorContext part of the targetID was deduced, that is just what Eclipse expects --> ! <extension point="org.eclipse.ui.popupMenus"> ! <viewerContribution id="org.python.pydev.editor.popup" ! targetID="org.python.pydev.editor.PythonEditor.EditorContext"> ! <menu id="org.python.pydev.editor.actions.editorPopup" ! label="Source" ! > ! <separator name="editGroup"/> ! <separator name="addGroup"/> ! </menu> ! <action id="org.python.pydev.editor.actions.uncomment" ! label="Uncomment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! class="org.python.pydev.editor.actions.PyUncomment" ! > ! </action> ! <action id="org.python.pydev.editor.actions.comment" ! label="Comment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! class="org.python.pydev.editor.actions.PyComment" ! > ! </action> ! <action id="org.python.pydev.editor.actions.addBlockComment" ! label="Add comment block" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! > ! </action> ! </viewerContribution> ! </extension> ! ! <!-- Commands --> <!-- associates commands with keyboard shortcuts --> ! <extension point="org.eclipse.ui.commands"> ! <category ! name="Pydev editor commands" ! description="Pydev editor category" ! id="org.python.pydev.ui.category.source"> ! </category> ! <scope ! name="Pydev editor scope" ! parent="org.eclipse.ui.textEditorScope" ! description="Pydev commands" ! id="org.python.pydev.ui.editor.scope"> ! </scope> ! <keyBinding ! string="Ctrl+/" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.comment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! <keyBinding ! string="Ctrl+\" ! scope="org.python.pydev.ui.editor.scope" ! command="org.python.pydev.editor.actions.uncomment" ! configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> ! </keyBinding> ! </extension> <!-- file type extensions for the team (CVS) --> ! <extension point="org.eclipse.team.core.fileTypes"> ! <fileTypes type="text" extension="py"/> ! </extension> ! ! <extension point="org.eclipse.team.core.ignore"> ! <ignore enabled="true" pattern="*.pyc"/> ! </extension> </plugin> --- 1,286 ---- <?xml version="1.0" encoding="UTF-8"?> <plugin ! id="org.python.pydev" ! name="Pydev - Python Development Environment" ! version="0.3.0" ! provider-name="AleksTotic" ! class="org.python.pydev.plugin.PydevPlugin"> ! <runtime> ! <library name="pydev.jar"/> ! </runtime> ! <requires> ! <import plugin="org.eclipse.core.resources"/> ! <import plugin="org.eclipse.core.runtime"/> ! <import plugin="org.eclipse.ui"/> ! <import plugin="org.eclipse.ui.editors"/> ! <import plugin="org.eclipse.ui.views"/> ! <import plugin="org.eclipse.ui.workbench.texteditor"/> ! <import plugin="org.eclipse.jface.text"/> ! </requires> <!-- Python editor --> ! <extension ! point="org.eclipse.ui.editors"> ! <editor ! name="Python Editor" ! icon="icons/sample.gif" ! extensions="py" ! contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor" ! class="org.python.pydev.editor.PyEdit" ! id="org.python.pydev.editor.PythonEditor"> ! </editor> ! </extension> <!-- Preference page --> ! <extension ! point="org.eclipse.ui.preferencePages"> ! <page ! name="Pydev" ! class="org.python.pydev.plugin.PydevPrefs" ! id="org.python.pydev.prefs"> ! </page> ! </extension> <!-- Editor menus --> ! <extension ! point="org.eclipse.ui.editorActions"> ! <editorContribution ! targetID="org.python.pydev.editor.PythonEditor" ! id="org.python.pydev.editor.editorContribution"> ! <menu ! label="Source" ! path="edit" ! id="org.python.pydev.editor.actions.sourceMenu"> ! <separator ! name="editGroup"> ! </separator> ! <separator ! name="addGroup"> ! </separator> ! </menu> ! <action ! definitionId="org.python.pydev.editor.actions.firstChar" ! label="Goto first char" ! class="org.python.pydev.editor.actions.FirstCharAction" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.firstChar"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.uncomment" ! label="Uncomment" ! class="org.python.pydev.editor.actions.PyUncomment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.uncomment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.comment" ! label="Comment" ! class="org.python.pydev.editor.actions.PyComment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" ! id="org.python.pydev.editor.actions.comment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.addBlockComment" ! label="Add comment block" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.navigation.nextMethod" ! label="Goto next method or class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </action> ! <action ! definitionId="org.python.pydev.editor.actions.navigation.previousMethod" ! label="Goto previous method or class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" ! menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </action> ! </editorContribution> ! </extension> <!-- NOTE: EditorContext part of the targetID was deduced, that is just what Eclipse expects --> ! <!-- Editor popup menus--> ! <extension ! point="org.eclipse.ui.popupMenus"> ! <viewerContribution ! targetID="org.python.pydev.editor.PythonEditor.EditorContext" ! id="org.python.pydev.editor.popup"> ! <menu ! label="Source" ! id="org.python.pydev.editor.actions.editorPopup"> ! <separator ! name="editGroup"> ! </separator> ! <separator ! name="addGroup"> ! </separator> ! </menu> ! <action ! label="Uncomment" ! class="org.python.pydev.editor.actions.PyUncomment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! id="org.python.pydev.editor.actions.uncomment"> ! </action> ! <action ! label="Comment" ! class="org.python.pydev.editor.actions.PyComment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/editGroup" ! id="org.python.pydev.editor.actions.comment"> ! </action> ! <action ! label="Add comment block" ! class="org.python.pydev.editor.actions.PyAddBlockComment" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.addBlockComment"> ! </action> ! <action ! label="Navigate to next method / class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.navigation.nextMethod"> ! </action> ! <action ! label="Navigate to previous method / class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" ! menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" ! id="org.python.pydev.editor.actions.navigation.previousMethod"> ! </action> ! </viewerContribution> ! </extension> <!-- associates commands with keyboard shortcuts --> ! <!-- Commands --> ! <extension ! point="org.eclipse.ui.commands"> ! <scope ! name="Pydev editor scope" ! parent="org.eclipse.ui.textEditorScope" ! description="Pydev commands" ! id="org.python.pydev.ui.editor.scope"> ! </scope> ! <category ! name="Pydev editor commands" ! description="Pydev editor category" ! id="org.python.pydev.ui.category.source"> ! </category> + <!-- command: next method / class--> + <command + name="First char" + description="Goes to the first non space char or first char of the line depending on the cursor position." + category="org.python.pydev.ui.category.source" + id="org.python.pydev.editor.actions.firstChar"> + </command> + <keyBinding + string="Home" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.firstChar" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + + <!-- command: next method / class--> + <command + name="Next Method or Class" + description="Navigates to the next method or class declaration" + category="org.python.pydev.ui.category.source" + id="org.python.pydev.editor.actions.navigation.nextMethod"> + </command> + <keyBinding + string="Ctrl+Shift+Arrow_Down" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.navigation.nextMethod" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + + <!-- command: previous method / class--> + + <command + name="Previous Method or Class" + description="Navigates to the previous method or class declaration" + category="org.python.pydev.ui.category.source" + id="org.python.pydev.editor.actions.navigation.previousMethod"> + </command> + <keyBinding + string="Ctrl+Shift+Arrow_Up" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.navigation.previousMethod" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + + <!-- command: block--> + <command + name="Add Comment Block" + description="Creates a python comment block" + category="org.python.pydev.ui.category.source" + id="org.python.pydev.editor.actions.addBlockComment"> + </command> + <keyBinding + string="Ctrl+4" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.addBlockComment" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + + + <!-- command: uncomment--> + <command + name="Python Uncomment" + description="Uncomments a python line (Removes # from the beggining of the line)" + category="org.python.pydev.ui.category.source" + id="org.python.pydev.editor.actions.uncomment"> + </command> + <keyBinding + string="Ctrl+\" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.uncomment" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <keyBinding + string="Ctrl+Shift+3" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.uncomment" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + + + <!-- command: comment--> + <command + name="Python Comment" + description="Comments a python line (Adds # to beggining of the line)" + category="org.python.pydev.ui.category.source" + id="org.python.pydev.editor.actions.comment"> + </command> + <keyBinding + string="Ctrl+/" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.comment" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + <keyBinding + string="Ctrl+3" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.comment" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> + + </extension> <!-- file type extensions for the team (CVS) --> ! <extension ! point="org.eclipse.team.core.fileTypes"> ! <fileTypes ! type="text" ! extension="py"> ! </fileTypes> ! </extension> ! <extension ! point="org.eclipse.team.core.ignore"> ! <ignore ! enabled="true" ! pattern="*.pyc"> ! </ignore> ! </extension> </plugin> |
From: <fa...@us...> - 2004-03-05 14:57:14
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12688/src/org/python/pydev/editor/actions Modified Files: PyAction.java Log Message: Method navigation added and commands in the scope, so that the user can change the keybindings. Also added keybindigs for next / previous method / class. Index: PyAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyAction.java 28 Feb 2004 05:13:16 -0000 1.1 --- PyAction.java 5 Mar 2004 14:43:05 -0000 1.2 *************** *** 17,20 **** --- 17,21 ---- import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; + import org.python.pydev.editor.PyEdit; /** *************** *** 81,84 **** --- 82,98 ---- /** + * This function returns the python editor. + * @return + */ + protected PyEdit getPyEdit() { + if (targetEditor instanceof PyEdit) { + return (PyEdit) targetEditor; + } else { + throw new RuntimeException("Expecting PyEdit editor. Found:"+targetEditor.getClass().getName()); + } + } + + + /** * Helper for setting caret * @param pos *************** *** 128,133 **** int offset = region.getOffset(); String src = doc.get(offset, region.getLength()); ! if ("".equals(src)) ! return 0; int i = 0; while (i < src.length()) { --- 142,146 ---- int offset = region.getOffset(); String src = doc.get(offset, region.getLength()); ! int i = 0; while (i < src.length()) { |
From: <fa...@us...> - 2004-03-05 14:57:14
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12688/src/org/python/pydev/editor/actions/navigation Added Files: PyMethodNavigation.java PyPreviousMethod.java PyNextMethod.java Log Message: Method navigation added and commands in the scope, so that the user can change the keybindings. Also added keybindigs for next / previous method / class. --- NEW FILE: PyMethodNavigation.java --- /* * @author: fabioz * Created: February 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions.navigation; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.python.parser.SimpleNode; import org.python.parser.ast.ClassDef; import org.python.parser.ast.FunctionDef; import org.python.parser.ast.VisitorBase; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.actions.PyAction; import org.python.pydev.outline.IOutlineModel; import org.python.pydev.outline.ParsedItem; import org.python.pydev.outline.PyOutlinePage; /** * The trick here is getting the outline... To do that, some refactorings had * to be done to the PyOutlinePage, to get the parsed items and the ParsedItem, * so that it is now public. * * @author Fabio Zadrozny */ public abstract class PyMethodNavigation extends PyAction { /** * This class is interested in knowing where are we... * * @author Fabio Zadrozny * */ class Visitor extends VisitorBase { /** * The initial line starts in 0 */ public int initialLine; /** * This is the previous node. */ public SimpleNode prevNode = null; /** * This is the current node. (Its begin line * starts at 1 and not 0). */ public SimpleNode currentNode = null; /** * This is the next found node. */ public SimpleNode nextNode = null; /** * We have to know the initialLine, so that we can know where we are. * @param initialLine */ public Visitor(int initialLine) { this.initialLine = initialLine; } /** * Marks the current, previous and next node... * @param node */ private void mark(SimpleNode node) { if (this.initialLine >= node.beginLine - 1) { if (this.currentNode != null) { this.prevNode = this.currentNode; } this.currentNode = node; } else if (nextNode == null) { //only sets the next node once... nextNode = node; } } public Object visitClassDef(ClassDef node) throws Exception { // print("visiting...visitClassDef"); mark(node); node.traverse(this); return null; } public Object visitFunctionDef(FunctionDef node) throws Exception { // print("visiting...visitFunctionDef"); mark(node); return null; } protected Object unhandled_node(SimpleNode node) throws Exception { return null; } public void traverse(SimpleNode node) throws Exception { } } /** * This method gets the parsed model, discovers where we are in the * document (through the visitor), and asks the implementing class * to where we should go... */ public void run(IAction action) { PyEdit pyEdit = getPyEdit(); IDocument doc = pyEdit.getDocumentProvider().getDocument(pyEdit.getEditorInput()); ITextSelection selection = (ITextSelection) pyEdit.getSelectionProvider().getSelection(); PyOutlinePage out = (PyOutlinePage) pyEdit.getAdapter(IContentOutlinePage.class); ParsedItem item = (ParsedItem) out.getParsedModel().getRoot(); SimpleNode node = item.getToken(); int startLine = selection.getStartLine(); Visitor v = whereAmI(startLine, node); // print (v.nextNode); IOutlineModel.SelectThis select = getSelect(v); // print("select = " + select); if (select != null) { PyOutlinePage.selectSelectionInEditor(select,pyEdit); } } /** * Returns a visitor that knows where we are and the nodes next to me... * * @param startLine * @param root * @return */ public Visitor whereAmI(int startLine, SimpleNode root) { Visitor v = new Visitor(startLine); try { synchronized (v) { root.traverse(v); } } catch (Exception e) { e.printStackTrace(); } return v; } /** * This method should return to where we should go, depending on * the visitor passed as a parameter (it contains the node where we * are, the next node and the previous node). * * @param v * @return */ public abstract IOutlineModel.SelectThis getSelect(Visitor v); } --- NEW FILE: PyPreviousMethod.java --- /* * @author: fabioz * Created: February 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions.navigation; import org.python.pydev.outline.ParsedItem; import org.python.pydev.outline.IOutlineModel.SelectThis; /** * @author Fabio Zadrozny */ public class PyPreviousMethod extends PyMethodNavigation{ public SelectThis getSelect(Visitor v) { if (v.prevNode != null){ return ParsedItem.getPosition(v.prevNode); } return null; } } --- NEW FILE: PyNextMethod.java --- /* * @author: fabioz * Created: February 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions.navigation; import org.python.pydev.outline.ParsedItem; import org.python.pydev.outline.IOutlineModel.SelectThis; /** * @author Fabio Zadrozny */ public class PyNextMethod extends PyMethodNavigation{ public SelectThis getSelect(Visitor v) { if (v.nextNode != null){ return ParsedItem.getPosition(v.nextNode); } return null; } } |
From: <fa...@us...> - 2004-03-05 14:56:58
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12623/src/org/python/pydev/editor/actions/navigation Log Message: Directory /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation added to the repository |
From: <fa...@us...> - 2004-03-05 14:55:47
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12322/src/org/python/pydev/outline Modified Files: PyOutlinePage.java Log Message: Minor refactorings so that some needed items for external navigation are made visible (and testing for null items). Index: PyOutlinePage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/PyOutlinePage.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyOutlinePage.java 31 Dec 2003 19:34:28 -0000 1.3 --- PyOutlinePage.java 5 Mar 2004 14:41:34 -0000 1.4 *************** *** 99,103 **** IDocumentProvider provider = editorView.getDocumentProvider(); document = provider.getDocument(editorView.getEditorInput()); ! model = new ParsedModel(this, editorView.getParser()); tree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); tree.setContentProvider(new ParsedContentProvider()); --- 99,103 ---- IDocumentProvider provider = editorView.getDocumentProvider(); document = provider.getDocument(editorView.getEditorInput()); ! model = getParsedModel(); tree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); tree.setContentProvider(new ParsedContentProvider()); *************** *** 105,108 **** --- 105,117 ---- tree.setInput(model.getRoot()); } + + /** + * + * @return the parsed model, so that it can be used elsewhere (in navigation) + */ + public ParsedModel getParsedModel() { + return new ParsedModel(this, editorView.getParser()); + } + /* *************** *** 113,130 **** public void refreshItems(Object[] items) { TreeViewer viewer = getTreeViewer(); ! Tree treeWidget = viewer.getTree(); ! ScrollBar bar = treeWidget.getVerticalBar(); ! int barPosition = 0; ! if (bar != null) { ! barPosition = bar.getSelection(); ! } ! if (items == null) ! viewer.refresh(); ! else ! for (int i=0; i< items.length; i++) { ! viewer.refresh(items[i]); } - if (barPosition != 0) { - bar.setSelection(Math.min(bar.getMaximum(), barPosition)); } } --- 122,141 ---- public void refreshItems(Object[] items) { TreeViewer viewer = getTreeViewer(); ! if (viewer != null){ ! Tree treeWidget = viewer.getTree(); ! ScrollBar bar = treeWidget.getVerticalBar(); ! int barPosition = 0; ! if (bar != null) { ! barPosition = bar.getSelection(); ! } ! if (items == null) ! viewer.refresh(); ! else ! for (int i=0; i< items.length; i++) { ! viewer.refresh(items[i]); ! } ! if (barPosition != 0) { ! bar.setSelection(Math.min(bar.getMaximum(), barPosition)); } } } *************** *** 136,140 **** */ public void updateItems(Object[] items) { ! getTreeViewer().update(items, null); } --- 147,153 ---- */ public void updateItems(Object[] items) { ! TreeViewer tree = getTreeViewer(); ! if (tree != null) ! getTreeViewer().update(items, null); } *************** *** 197,218 **** if (newSel == null) return; ! if (newSel.r != null) { ! editorView.setSelection(newSel.r.getOffset(), newSel.r.getLength()); ! } ! else { ! IDocumentProvider provider = editorView.getDocumentProvider(); ! IDocument document = provider.getDocument(editorView.getEditorInput()); ! try { ! IRegion r = document.getLineInformation(newSel.line - 1); ! // if selecting the whole line, just use the information ! if (newSel.column == IOutlineModel.SelectThis.WHOLE_LINE) { ! newSel.column = 0; ! newSel.length = r.getLength(); ! } ! editorView.setSelection(r.getOffset() + newSel.column, newSel.length); ! } catch (BadLocationException e) { ! e.printStackTrace(); ! } ! } } }; --- 210,214 ---- if (newSel == null) return; ! selectSelectionInEditor(newSel,editorView); } }; *************** *** 220,222 **** --- 216,240 ---- createActions(); } + + public static void selectSelectionInEditor(IOutlineModel.SelectThis newSel, PyEdit editorView) { + if (newSel.r != null) { + editorView.setSelection(newSel.r.getOffset(), newSel.r.getLength()); + } + else { + IDocumentProvider provider = editorView.getDocumentProvider(); + IDocument document = provider.getDocument(editorView.getEditorInput()); + try { + IRegion r = document.getLineInformation(newSel.line - 1); + // if selecting the whole line, just use the information + if (newSel.column == IOutlineModel.SelectThis.WHOLE_LINE) { + newSel.column = 0; + newSel.length = r.getLength(); + } + editorView.setSelection(r.getOffset() + newSel.column, newSel.length); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + } + } |