pydev-cvs Mailing List for PyDev for Eclipse (Page 319)
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: <fa...@us...> - 2004-03-05 14:53:43
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12006/src/org/python/pydev/outline Modified Files: ParsedModel.java Log Message: Checking for null root items. Index: ParsedModel.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/ParsedModel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ParsedModel.java 17 Aug 2003 04:44:22 -0000 1.1 --- ParsedModel.java 5 Mar 2004 14:39:34 -0000 1.2 *************** *** 37,41 **** Display.getDefault().syncExec( new Runnable() { public void run() { ! setRoot(new ParsedItem(null, myRoot)); } }); --- 37,42 ---- Display.getDefault().syncExec( new Runnable() { public void run() { ! if (myRoot != null) ! setRoot(new ParsedItem(null, myRoot)); } }); |
From: <fa...@us...> - 2004-03-05 14:53:00
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11776/src/org/python/pydev/outline Modified Files: ParsedItem.java Log Message: Two methods have now static versions with parameters, so that they can be used only with those parameters and not with an instanciated class. Index: ParsedItem.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/ParsedItem.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ParsedItem.java 31 Dec 2003 19:34:07 -0000 1.4 --- ParsedItem.java 5 Mar 2004 14:38:51 -0000 1.5 *************** *** 26,30 **** * and this is then converted to a tree of ParsedItems */ ! class ParsedItem { ParsedItem parent; ParsedItem[] children = null; // array of modTypes --- 26,30 ---- * and this is then converted to a tree of ParsedItems */ ! public class ParsedItem { ParsedItem parent; ParsedItem[] children = null; // array of modTypes *************** *** 112,115 **** --- 112,122 ---- */ public IOutlineModel.SelectThis getPosition() { + return getPosition(token); + } + + /* + * @return where in the document is this item located + */ + public static IOutlineModel.SelectThis getPosition(SimpleNode token) { int startOffset = 0; boolean wholeLine = false; *************** *** 128,132 **** } ! IOutlineModel.SelectThis position = new IOutlineModel.SelectThis(token.beginLine, token.beginColumn+startOffset, toString().length()); if (wholeLine) --- 135,139 ---- } ! IOutlineModel.SelectThis position = new IOutlineModel.SelectThis(token.beginLine, token.beginColumn+startOffset, toString(token).length()); if (wholeLine) *************** *** 134,138 **** return position; } ! public ParsedItem[] getChildren() { if (children == null) { --- 141,145 ---- return position; } ! public ParsedItem[] getChildren() { if (children == null) { *************** *** 152,156 **** --- 159,168 ---- } + public String toString() { + return toString(token); + } + + public static String toString(SimpleNode token) { if (token instanceof ClassDef) { return ((ClassDef)token).name; |
From: <fa...@us...> - 2004-03-05 14:50:46
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11125/src/org/python/pydev/outline Modified Files: IOutlineModel.java Log Message: The region has been made public (In SelectThis), so that it can be accessed from outside. Index: IOutlineModel.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/IOutlineModel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IOutlineModel.java 10 Dec 2003 10:14:27 -0000 1.2 --- IOutlineModel.java 5 Mar 2004 14:36:37 -0000 1.3 *************** *** 35,39 **** class SelectThis { ! Region r; int line; --- 35,39 ---- class SelectThis { ! public Region r; int line; |
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32053/src/org/python/pydev/editor/actions Added Files: PyAddBlockComment.java FirstCharAction.java PyUncomment.java PyAction.java PyComment.java package.html Log Message: Implemented editor menus --- NEW FILE: PyAddBlockComment.java --- /* * @author: fabioz * Created: January 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextSelection; import org.eclipse.ui.texteditor.ITextEditor; /** * Creates a comment block * * @author Fabio Zadrozny */ public class PyAddBlockComment extends PyAction { /** * Create a block #===... * # * #===... * (TODO:This could be customized somewhere...) */ public void run(IAction action) { try { ITextEditor textEditor = getTextEditor(); IDocument doc = textEditor.getDocumentProvider().getDocument( textEditor.getEditorInput()); ITextSelection selection = (ITextSelection) textEditor .getSelectionProvider() .getSelection(); IRegion startLine = null; int startLineIndex = selection.getStartLine(); String endLineDelim = getDelimiter(doc, startLineIndex); startLine = doc.getLineInformation(startLineIndex); IRegion line = doc.getLineInformation(startLineIndex); int pos = line.getOffset(); StringBuffer strBuf = new StringBuffer(); strBuf.append(endLineDelim); strBuf.append( "#==============================================================================="); strBuf.append(endLineDelim); strBuf.append("# "); strBuf.append(endLineDelim); strBuf.append( "#==============================================================================="); strBuf.append(endLineDelim); strBuf.append(endLineDelim); doc.replace(pos, 0, strBuf.toString()); } catch (Exception e) { beep(e); } } } --- NEW FILE: FirstCharAction.java --- package org.python.pydev.editor.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; import org.eclipse.ui.texteditor.ITextEditor; /** * @author Fabio Zadrozny */ public class FirstCharAction extends PyAction { /** * Run to the first char (other than whitespaces) or to the real first char. */ public void run(IAction action) { try{ ITextEditor textEditor = getTextEditor(); IDocument doc = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); ITextSelection selection = (ITextSelection)textEditor.getSelectionProvider().getSelection(); boolean isAtFirstChar = isAtFirstVisibleChar(doc, selection.getOffset()); if (! isAtFirstChar){ gotoFirstVisibleChar(doc, selection.getOffset()); }else{ gotoFirstChar(doc, selection.getOffset()); } }catch(Exception e){ beep(e); } } } --- NEW FILE: PyUncomment.java --- /* * @author: fabioz * Created: January 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions; /** * @author fabioz */ public class PyUncomment extends PyComment { /** * Same as comment, but remove the first char. */ protected String replaceStr(String str,String endLineDelim){ str = str.replaceAll(endLineDelim+"#", endLineDelim ); if (str.startsWith("#")){ str = str.substring(1); } return str; } } --- NEW FILE: PyAction.java --- /* * @author: fabioz * Created: January 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IEditorActionDelegate; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; /** * @author Fabio Zadrozny * * Superclass of all our actions. Contains utility functions. * * Subclasses should implement run(IAction action) method. */ public abstract class PyAction implements IEditorActionDelegate { // Always points to the current editor protected IEditorPart targetEditor; public void setEditor(IEditorPart targetEditor) { this.targetEditor = targetEditor; } /** * This is an IEditorActionDelegate override */ public void setActiveEditor(IAction action, IEditorPart targetEditor) { setEditor(targetEditor); } /** * Activate action (if we are getting text) */ public void selectionChanged(IAction action, ISelection selection) { if (selection instanceof TextSelection) { action.setEnabled(true); return; } action.setEnabled( targetEditor instanceof ITextEditor); } /** * This method returns the delimiter for the document * @param doc * @param startLineIndex * @return * @throws BadLocationException */ protected String getDelimiter(IDocument doc, int startLineIndex) throws BadLocationException { String endLineDelim = doc.getLineDelimiter(startLineIndex); if (endLineDelim == null) { endLineDelim = doc.getLegalLineDelimiters()[0]; } return endLineDelim; } /** * This function returns the text editor. * @return */ protected ITextEditor getTextEditor() { if (targetEditor instanceof ITextEditor) { return (ITextEditor) targetEditor; } else { throw new RuntimeException("Expecting text editor. Found:"+targetEditor.getClass().getName()); } } /** * Helper for setting caret * @param pos * @throws BadLocationException */ protected void setCaretPosition(int pos) throws BadLocationException { getTextEditor().selectAndReveal(pos, 0); } /** * Are we in the first char of the line with the offset passed? * @param doc * @param cursorOffset */ protected void isInFirstVisibleChar(IDocument doc, int cursorOffset) { try { IRegion region = doc.getLineInformationOfOffset(cursorOffset); int offset = region.getOffset(); String src = doc.get(offset, region.getLength()); if ("".equals(src)) return; int i = 0; while (i < src.length()) { if (!Character.isWhitespace(src.charAt(i++))) { break; } } setCaretPosition(offset + i - 1); } catch (BadLocationException e) { beep(e); return; } } /** * Returns the position of the first char. * @param doc * @param cursorOffset * @return * @throws BadLocationException */ protected int getFirstCharPosition(IDocument doc, int cursorOffset) throws BadLocationException { IRegion region; region = doc.getLineInformationOfOffset(cursorOffset); int offset = region.getOffset(); String src = doc.get(offset, region.getLength()); if ("".equals(src)) return 0; int i = 0; while (i < src.length()) { if (!Character.isWhitespace(src.charAt(i++))) { break; } } return (offset + i - 1); } /** * Goes to first char of the line. * @param doc * @param cursorOffset */ protected void gotoFirstChar(IDocument doc, int cursorOffset) { try { IRegion region = doc.getLineInformationOfOffset(cursorOffset); int offset = region.getOffset(); setCaretPosition(offset); } catch (BadLocationException e) { beep(e); } } /** * Goes to the first visible char. * @param doc * @param cursorOffset */ protected void gotoFirstVisibleChar(IDocument doc, int cursorOffset) { try { setCaretPosition(getFirstCharPosition(doc, cursorOffset)); } catch (BadLocationException e) { beep(e); } } /** * Goes to the first visible char. * @param doc * @param cursorOffset */ protected boolean isAtFirstVisibleChar(IDocument doc, int cursorOffset) { try { return getFirstCharPosition(doc, cursorOffset) == cursorOffset; } catch (BadLocationException e) { return false; } } //================================================================ // HELPER FOR DEBBUGING... //================================================================ /** * Beep...humm... yeah....beep....ehehheheh */ protected void beep(Exception e) { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay().beep(); e.printStackTrace(); } protected void print(Object o) { System.out.println(o); } protected void print(boolean b) { System.out.println(b); } private void print(int i) { System.out.println(i); } } --- NEW FILE: PyComment.java --- /* * @author: fabioz * Created: January 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextSelection; import org.eclipse.ui.texteditor.ITextEditor; /** * @author Fabio Zadrozny */ public class PyComment extends PyAction { /** * Comment the first lines. */ public void run(IAction action) { try { ITextEditor textEditor = getTextEditor(); IDocument doc = textEditor.getDocumentProvider().getDocument( textEditor.getEditorInput()); ITextSelection selection = (ITextSelection) textEditor .getSelectionProvider() .getSelection(); int startLineIndex = selection.getStartLine(); int endLineIndex = selection.getEndLine(); //special cases...first char of the editor, last char... if (endLineIndex < startLineIndex) { endLineIndex = startLineIndex; } IRegion startLine = doc.getLineInformation(startLineIndex); IRegion endLine = doc.getLineInformation(endLineIndex); int initialPos = startLine.getOffset(); int length = (endLine.getOffset() - startLine.getOffset()) + endLine.getLength(); String endLineDelim = getDelimiter(doc, startLineIndex); startLine = doc.getLineInformation(startLineIndex); endLine = doc.getLineInformation(endLineIndex); String str = new String(doc.get(initialPos, length)); str = replaceStr(str, endLineDelim); doc.replace(initialPos, length, str); } catch (Exception e) { beep(e); } } /** * This method is called to return the text that should be replaced * by the text passed as a parameter. * * The text passed as a parameter represents the text from the whole * lines of the selection. * * @param str the string to be replaced. * @param endLineDelim delimiter used. * @return the new string. */ protected String replaceStr(String str, String endLineDelim) { return "#" + str.replaceAll(endLineDelim, endLineDelim + "#"); } } --- NEW FILE: package.html --- <body> Editor actions. Menu items and toolbar commands are all implemented here.<p> <h3>How to add a new action</h3> Implement your class as subclass of PyAction. See {@link org.python.pydev.editor.actions.PyAction PyAction} for more info.<p> Edit plugin.xml. Inside: <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 </body> |
From: <at...@us...> - 2004-02-28 05:22:29
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32053/src/org/python/pydev/editor Modified Files: PyEdit.java Log Message: Implemented editor menus Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyEdit.java 8 Jan 2004 22:41:52 -0000 1.4 --- PyEdit.java 28 Feb 2004 05:13:16 -0000 1.5 *************** *** 164,167 **** --- 164,172 ---- } + + protected void initializeKeyBindingScopes() { + setKeyBindingScopes(new String[] { "org.python.pydev.ui.editor.scope" }); //$NON-NLS-1$ + } + public PyParser getParser() { return parser; *************** *** 273,276 **** --- 278,283 ---- } + + } |
From: <at...@us...> - 2004-02-28 05:22:21
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32029/src/org/python/pydev/editor/actions Log Message: Directory /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions added to the repository |
From: <at...@us...> - 2004-02-28 05:21:00
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31838 Modified Files: plugin.xml Log Message: Implemented editor menus Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** plugin.xml 10 Jan 2004 03:08:36 -0000 1.6 --- plugin.xml 28 Feb 2004 05:11:46 -0000 1.7 *************** *** 1,45 **** <?xml version="1.0" encoding="UTF-8"?> <plugin ! id="org.python.pydev" ! name="Pydev" ! 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> ! <!-- editor --> ! <extension ! point="org.eclipse.ui.editors"> ! <editor ! name="Python Editor" ! icon="icons/sample.gif" ! extensions="py" ! contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor" ! class="org.python.pydev.editor.PyEdit" ! id="org.python.pydev.editor.PyEdit"> ! </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> </plugin> --- 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> |