pydev-cvs Mailing List for PyDev for Eclipse (Page 310)
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: Fabio Z. <fa...@us...> - 2004-07-19 18:06:03
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14505/src/org/python/pydev/editor/model Modified Files: ModelMaker.java Added Files: StrNode.java PassNode.java Log Message: Code folding capabilities added. --- NEW FILE: PassNode.java --- /* * Created on Jul 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.model; import org.python.parser.ast.Pass; /** * @author Fabio Zadrozny */ public class PassNode extends AbstractNode { Pass astNode; /** * * @param parent * @param astNode */ public PassNode(AbstractNode parent, Pass astNode) { super(parent); this.astNode = astNode; this.setStart(new Location(astNode.beginLine-1, astNode.beginColumn-1)); this.setEnd(new Location(astNode.beginLine-1, astNode.beginColumn + 22)); } public String getName() { return "pass"; } } --- NEW FILE: StrNode.java --- /* * Created on Jul 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.model; import org.python.parser.ast.Str; /** * @author Fabio Zadrozny */ public class StrNode extends AbstractNode { Str astNode; /** * * @param parent * @param astNode */ public StrNode(AbstractNode parent, Str astNode) { super(parent); this.astNode = astNode; this.setStart(new Location(astNode.beginLine-1, astNode.beginColumn-1)); this.setEnd(new Location(astNode.beginLine-1, astNode.beginColumn + 22)); } public String getName() { return "astNode"; } } Index: ModelMaker.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model/ModelMaker.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ModelMaker.java 22 Apr 2004 10:35:22 -0000 1.3 --- ModelMaker.java 19 Jul 2004 18:05:54 -0000 1.4 *************** *** 139,142 **** --- 139,150 ---- } + void processPass(Pass node) { + new PassNode(parent, node); + } + + void processStr(Str node) { + new StrNode(parent, node); + } + private void processAttribute(Attribute node) { new AttributeNode(parent, node, getLineText(node)); *************** *** 144,148 **** protected Object unhandled_node(SimpleNode node) throws Exception { ! // System.err.println("Unhandled: " + node.getClass().toString() + " L:" + Integer.toString(node.beginLine)); return null; } --- 152,156 ---- protected Object unhandled_node(SimpleNode node) throws Exception { ! System.err.println("Unhandled: " + node.getClass().toString() + " L:" + Integer.toString(node.beginLine)); return null; } *************** *** 152,155 **** --- 160,173 ---- } + public Object visitPass(Pass node) throws Exception { + processPass(node); + return null; + } + + public Object visitStr(Str node) throws Exception { + processStr(node); + return null; + } + public Object visitClassDef(ClassDef node) throws Exception { processClassDef(node); |
From: Fabio Z. <fa...@us...> - 2004-07-19 17:59:51
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codefolding In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13181/src/org/python/pydev/editor/codefolding Added Files: PyEditProjection.java PyProjectionAnnotation.java CodeFoldingSetter.java Log Message: Code folding capabilities added. --- NEW FILE: PyEditProjection.java --- /* * Created on Jul 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.codefolding; import org.eclipse.jface.text.DefaultInformationControl; import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.text.source.projection.ProjectionSupport; import org.eclipse.jface.text.source.projection.ProjectionViewer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.editors.text.TextEditor; import org.python.pydev.parser.IParserListener; /** * @author Fabio Zadrozny * * The code below has been implemented after the following build notes: * * http://download2.eclipse.org/downloads/drops/S-3.0M9-200405211200/buildnotes/buildnotes_text.html */ public abstract class PyEditProjection extends TextEditor implements IParserListener { private ProjectionSupport fProjectionSupport; /* * (non-Javadoc) * * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite, * org.eclipse.jface.text.source.IVerticalRuler, int) */ protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { return new ProjectionViewer(parent, ruler, getOverviewRuler(), true, styles); } public void createPartControl(Composite parent) { super.createPartControl(parent); try { ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors()); fProjectionSupport .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); fProjectionSupport .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); fProjectionSupport .setHoverControlCreator(new IInformationControlCreator() { public IInformationControl createInformationControl( Shell shell) { return new DefaultInformationControl(shell); } }); fProjectionSupport.install(); if (isFoldingEnabled()) projectionViewer.doOperation(ProjectionViewer.TOGGLE); } catch (Exception e) { e.printStackTrace(); } } /** * @return */ private boolean isFoldingEnabled() { // TODO Auto-generated method stub return true; } public Object getAdapter(Class required) { if (fProjectionSupport != null) { Object adapter = fProjectionSupport.getAdapter(getSourceViewer(), required); if (adapter != null) return adapter; } return super.getAdapter(required); } } --- NEW FILE: PyProjectionAnnotation.java --- /* * Created on Jul 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.codefolding; import org.eclipse.jface.text.source.projection.ProjectionAnnotation; import org.python.pydev.editor.model.AbstractNode; /** * This class was created so that we can check if some annotation reappears * (if this happens, we don't want to delete it). * * @author Fabio Zadrozny */ public class PyProjectionAnnotation extends ProjectionAnnotation{ public AbstractNode node; public PyProjectionAnnotation(AbstractNode node){ this.node = node; } /** * @param node2 * @return */ public boolean appearsSame(AbstractNode node2) { if(node2.getClass().equals(node.getClass()) == false) return false; if(getCompleteName(node2).equals(getCompleteName(node)) == false) return false; return true; } /** * @param node2 */ private String getCompleteName(AbstractNode node2) { String ret = node2.getName(); while(node2.getParent() != null){ ret = node2.getParent().getName() + "."+ ret; node2 = node2.getParent(); } return ret; } } --- NEW FILE: CodeFoldingSetter.java --- /* * Created on Jul 19, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.codefolding; import java.util.ArrayList; import java.util.Iterator; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.projection.ProjectionAnnotation; import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel; import org.eclipse.ui.editors.text.TextEditor; import org.python.pydev.editor.model.AbstractNode; import org.python.pydev.editor.model.ClassNode; import org.python.pydev.editor.model.FunctionNode; import org.python.pydev.editor.model.IModelListener; import org.python.pydev.editor.model.ModelUtils; /** * @author Fabio Zadrozny * * This class is used to set the code folding markers. */ public class CodeFoldingSetter implements IModelListener { private TextEditor editor; public CodeFoldingSetter(TextEditor editor) { this.editor = editor; } /* * (non-Javadoc) * * @see org.python.pydev.editor.model.IModelListener#modelChanged(org.python.pydev.editor.model.AbstractNode) */ public void modelChanged(AbstractNode root) { IAnnotationModel model = (IAnnotationModel) editor .getAdapter(ProjectionAnnotationModel.class); try{ if (model != null) { ArrayList collapsed = new ArrayList(); //put annotations in array list. Iterator iter = model.getAnnotationIterator(); while ( iter != null && iter.hasNext()) { PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next(); collapsed.add(element); } //(re) insert annotations. AbstractNode current = ModelUtils.getNextNode(root); while (current != null) { if (current instanceof FunctionNode || current instanceof ClassNode) { addFoldingMark(current, model, collapsed); } current = ModelUtils.getNextNode(current); } //remove the annotations that have not been reinserted. for (Iterator it = collapsed.iterator(); it.hasNext();) { PyProjectionAnnotation element = (PyProjectionAnnotation) it.next(); model.removeAnnotation(element); } } }catch (Exception e) { e.printStackTrace(); } } /** * @param node * @param model * @throws BadLocationException */ private void addFoldingMark(AbstractNode node, IAnnotationModel model, ArrayList collapsed) throws BadLocationException { int start = node.getStart().line; int end = start; int size = node.getChildren().size(); if(size > 0){ end = ((AbstractNode)node.getChildren().get(size-1)).getScope().getEnd().line+1; }else{ throw new BadLocationException("Invalid location"); } try { IDocument document = editor.getDocumentProvider().getDocument( editor.getEditorInput()); int offset = document.getLineOffset(start); int endOffset = document.getLineOffset(end); Position position = new Position(offset, endOffset - offset); model.addAnnotation(getAnnotationToAdd(position, node, model, collapsed), position); } catch (BadLocationException x) { x.printStackTrace(); } } /** * We have to be careful not to remove collapsed annotations because if this happens, * previous code folding is not correct. * * @param position * @param node * @param model * @param collapsed * @return */ private ProjectionAnnotation getAnnotationToAdd(Position position, AbstractNode node, IAnnotationModel model, ArrayList collapsed){ for (Iterator iter = collapsed.iterator(); iter.hasNext();) { PyProjectionAnnotation element = (PyProjectionAnnotation) iter.next(); if (element.appearsSame(node)){ collapsed.remove(element); //after getting it, remove it, so we don't accidentally get it again. return element; } } return new PyProjectionAnnotation(node ); } } |
From: Fabio Z. <fa...@us...> - 2004-07-19 17:57:21
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codefolding In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12918/src/org/python/pydev/editor/codefolding Log Message: Directory /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codefolding added to the repository |
From: Fabio Z. <fa...@us...> - 2004-07-16 15:40:40
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5467 Modified Files: plugin.xml Log Message: Added correct path for launch class. Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** plugin.xml 2 Jul 2004 02:26:01 -0000 1.12 --- plugin.xml 16 Jul 2004 15:40:29 -0000 1.13 *************** *** 64,69 **** icon="icons/python.gif" modes="run, debug" ! class="org.python.pydev.debug.launching.LaunchShortcut" ! id="org.python.pydev.debug.launchShortcut"> <perspective id="org.eclipse.debug.ui.DebugPerspective"/> </shortcut> --- 64,69 ---- icon="icons/python.gif" modes="run, debug" ! class="org.python.pydev.debug.ui.launching.LaunchShortcut" ! id="org.python.pydev.debug.ui.launchShortcut"> <perspective id="org.eclipse.debug.ui.DebugPerspective"/> </shortcut> |
From: Fabio Z. <fa...@us...> - 2004-07-16 15:38:20
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5027 Modified Files: plugin.xml Log Message: Added backspace action. Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** plugin.xml 2 Jul 2004 02:50:37 -0000 1.20 --- plugin.xml 16 Jul 2004 15:38:11 -0000 1.21 *************** *** 113,116 **** --- 113,123 ---- </action> <action + definitionId="org.python.pydev.editor.actions.pybackspace" + label="Python Backspace (considers indentation)" + class="org.python.pydev.editor.actions.PyBackspace" + menubarPath="org.python.pydev.editor.actions.sourceMenu/editGroup" + id="org.python.pydev.editor.actions.pybackspace"> + </action> + <action definitionId="org.python.pydev.editor.actions.convertSpaceToTab" label="Convert space-tabs to tabs" *************** *** 275,279 **** id="org.python.pydev.ui.category.source"> </category> ! <!-- command: next method / class--> <command name="First char" --- 282,286 ---- id="org.python.pydev.ui.category.source"> </category> ! <!-- command: goto first char--> <command name="First char" *************** *** 288,291 **** --- 295,311 ---- configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> </keyBinding> + <!-- command: backspace considering indentation--> + <command + name="Python Backspace (with indentation)" + description="Backspace considering indentation for Python." + category="org.python.pydev.ui.category.source" + id="org.python.pydev.editor.actions.pybackspace"> + </command> + <keyBinding + string="Backspace" + scope="org.python.pydev.ui.editor.scope" + command="org.python.pydev.editor.actions.pybackspace" + configuration="org.eclipse.ui.defaultAcceleratorConfiguration"> + </keyBinding> <!-- command: next method / class--> <command |
From: Fabio Z. <fa...@us...> - 2004-07-16 15:36:14
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4676/src/org/python/pydev/editor/actions Modified Files: PySelection.java Log Message: Minor changes. Index: PySelection.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PySelection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PySelection.java 21 Jun 2004 21:36:29 -0000 1.1 --- PySelection.java 16 Jul 2004 15:36:04 -0000 1.2 *************** *** 40,43 **** --- 40,45 ---- /* Original cursor line */ public int cursorLine; + /* Text editor */ + public ITextEditor textEditor; /** *************** *** 70,79 **** textEditor.getDocumentProvider().getDocument( textEditor.getEditorInput()); ! // Grab the selection ! ITextSelection selection = ! (ITextSelection) textEditor ! .getSelectionProvider() ! .getSelection(); // Set data --- 72,78 ---- textEditor.getDocumentProvider().getDocument( textEditor.getEditorInput()); ! this.textEditor = textEditor; // Grab the selection ! ITextSelection selection = getITextSelection(); // Set data *************** *** 98,101 **** --- 97,111 ---- /** + * @param textEditor + * @return + */ + public ITextSelection getITextSelection() { + return (ITextSelection) textEditor + .getSelectionProvider() + .getSelection(); + } + + + /** * Alt constructor for PySelection. Takes in a document, starting line, ending line, and * length of selection, as well as a boolean indicating how to handle an empty selection. *************** *** 135,141 **** endLineIndex = 0; selLength = 0; - selection = new String ( ); selection = ""; - endLineDelim = new String ( ); endLineDelim = ""; startLine = null; --- 145,149 ---- *************** *** 252,256 **** /** ! * Gets cursor offset to go to. * * @return int Offset to put cursor at --- 260,264 ---- /** ! * Gets cursor offset within a line. * * @return int Offset to put cursor at |
From: Fabio Z. <fa...@us...> - 2004-07-16 15:34:47
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4287/src/org/python/pydev/editor/actions Modified Files: PyAction.java Log Message: Added some auxiliary functions. Index: PyAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyAction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyAction.java 21 Jun 2004 21:36:29 -0000 1.5 --- PyAction.java 16 Jul 2004 15:34:39 -0000 1.6 *************** *** 115,121 **** int i = 0; while (i < src.length()) { ! if (!Character.isWhitespace(src.charAt(i++))) { break; } } setCaretPosition(offset + i - 1); --- 115,122 ---- int i = 0; while (i < src.length()) { ! if (!Character.isWhitespace(src.charAt(i))) { break; } + i++; } setCaretPosition(offset + i - 1); *************** *** 128,140 **** /** ! * Returns the position of the first char. * @param doc * @param cursorOffset ! * @return position of the first character of the line * @throws BadLocationException */ protected int getFirstCharPosition(IDocument doc, int cursorOffset) throws BadLocationException { ! IRegion region; region = doc.getLineInformationOfOffset(cursorOffset); int offset = region.getOffset(); --- 129,157 ---- /** ! * Returns the position of the first non whitespace char in the current line. * @param doc * @param cursorOffset ! * @return position of the first character of the line (returned as an absolute ! * offset) * @throws BadLocationException */ protected int getFirstCharPosition(IDocument doc, int cursorOffset) throws BadLocationException { ! IRegion region; ! region = doc.getLineInformationOfOffset(cursorOffset); ! int offset = region.getOffset(); ! return offset + getFirstCharRelativePosition(doc, cursorOffset); ! } ! ! ! ! /** ! * @param doc ! * @param cursorOffset ! * @return ! * @throws BadLocationException ! */ ! protected int getFirstCharRelativePosition(IDocument doc, int cursorOffset) throws BadLocationException { ! IRegion region; region = doc.getLineInformationOfOffset(cursorOffset); int offset = region.getOffset(); *************** *** 142,151 **** int i = 0; while (i < src.length()) { ! if (!Character.isWhitespace(src.charAt(i++))) { break; } } ! return (offset + i - 1); } --- 159,207 ---- int i = 0; + boolean breaked = false; while (i < src.length()) { ! if ( Character.isWhitespace(src.charAt(i)) == false && src.charAt(i) != '\t' ) { ! i++; ! breaked = true; break; } + i++; } ! if (!breaked){ ! i++; ! } ! return (i - 1); ! } ! ! /** ! * Returns the position of the last non whitespace char in the current line. ! * @param doc ! * @param cursorOffset ! * @return position of the last character of the line (returned as an absolute ! * offset) ! * ! * @throws BadLocationException ! */ ! protected int getLastCharPosition(IDocument doc, int cursorOffset) ! throws BadLocationException { ! IRegion region; ! region = doc.getLineInformationOfOffset(cursorOffset); ! int offset = region.getOffset(); ! String src = doc.get(offset, region.getLength()); ! ! int i = src.length(); ! boolean breaked = false; ! while (i > 0 ) { ! i--; ! //we have to break if we find a character that is not a whitespace or a tab. ! if ( Character.isWhitespace(src.charAt(i)) == false && src.charAt(i) != '\t' ) { ! breaked = true; ! break; ! } ! } ! if (!breaked){ ! i--; ! } ! return (offset + i); } |
From: Fabio Z. <fa...@us...> - 2004-07-16 15:34:06
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4161/src/org/python/pydev/editor/actions Added Files: PyBackspace.java Log Message: Added some strategy to apply on backspaces (still not complete, but should be better than regular backspace). --- NEW FILE: PyBackspace.java --- /* * @author: Fabio Zadrozny * Created: July 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.IRegion; import org.eclipse.jface.text.ITextSelection; import org.python.pydev.plugin.PydevPrefs; /** * @author Fabio Zadrozny * * Makes a backspace happen... * * We can: * - go to the indentation from some uncommented previous line (if we only * have whitespaces in the current line). * * - erase all whitespace characters until we find some character. * * - erase a single character. */ public class PyBackspace extends PyAction{ /** * Makes a backspace happen... * * We can: * - go to the indentation from some uncommented previous line (if we only * have whitespaces in the current line). * * - erase all whitespace characters until we find some character. * * - erase a single character. */ public void run(IAction action) { // Select from text editor PySelection ps = new PySelection ( getTextEditor ( ), false ); // Perform the action try { ITextSelection textSelection = ps.getITextSelection(); if( textSelection.getLength() != 0){ eraseSelection(ps); return ; } int lastCharPosition = getLastCharPosition(ps.doc, ps.getCursorOffset()); int cursorOffset = textSelection.getOffset(); IRegion lastCharRegion = ps.doc.getLineInformationOfOffset(lastCharPosition+1); //System.out.println("cursorOffset: "+ cursorOffset); //System.out.println("lastCharPosition: "+lastCharPosition); //System.out.println("lastCharRegion.getOffset(): " +lastCharRegion.getOffset()); // IRegion cursorRegion = ps.doc.getLineInformationOfOffset(cursorOffset); if( cursorOffset == lastCharRegion.getOffset()){ //System.out.println("We are in the beggining of the line."); //in this situation, we are in the first character of the line... //so, we have to get the end of the other line and delete it. if (cursorOffset != 0) //we only want to erase if we are not in the first line. eraseLineDelimiter(ps); } else if(cursorOffset <= lastCharPosition){ //System.out.println("cursorOffset <= lastCharPosition"); //this situation is: // |a (delete to previous indentation - considers cursor position) //or // as | as (delete single char) //or // | a (delete to previous indentation - considers cursor position) //so, we have to treat it carefully eraseToPreviousIndentation(ps,false); } else if(lastCharRegion.getOffset() == lastCharPosition+1){ //System.out.println("Only whitespaces in the line."); //in this situation, this line only has whitespaces, //so, we have to erase depending on the previous indentation. eraseToPreviousIndentation(ps,true); }else{ if (cursorOffset - lastCharPosition == 1){ //System.out.println("Erase single char."); //last char and cursor are in the same line. //this situation is: // a| eraseSingleChar(ps); }else if (cursorOffset - lastCharPosition > 1){ //this situation is: // a | //System.out.println("Erase until last char is found."); eraseUntilLastChar(ps,lastCharPosition); } } } catch ( Exception e ) { beep ( e ); } } /** * @param ps * @param hasOnlyWhitespaces * @throws BadLocationException */ private void eraseToPreviousIndentation(PySelection ps, boolean hasOnlyWhitespaces) throws BadLocationException { ITextSelection textSelection = ps.getITextSelection(); int indentation = getPreviousIndentation(ps,textSelection); if(indentation == -1){ //System.out.println("erasing single char"); eraseSingleChar(ps); }else{ if(hasOnlyWhitespaces){ //System.out.println("only whitespaces"); eraseToIndentation(ps, indentation); }else{ //System.out.println("not only whitespaces"); //this situation is: // |a (delete to previous indentation - considers cursor position) //or // as | as (delete single char) //or // | a (delete to previous indentation - considers cursor position) //so, we have to treat it carefully //TODO: use the conditions above and not just erase a single char. eraseSingleChar(ps); } } } /** * * @param ps * @param textSelection * @return offset of the indentation on the previous non-commented line or -1 * if we are not able to get it (if this happens, we delete 1 char). * @throws BadLocationException */ private int getPreviousIndentation(PySelection ps, ITextSelection textSelection) throws BadLocationException { int currentLine = textSelection.getStartLine(); if(currentLine == 0){ //we are in the first line, so, we have no basis to get indentation. return -1; }else{ for (int i = currentLine-1; i >=0 ; i++) { int currentLineOffset = ps.doc.getLineOffset(i); if(ps.doc.getChar(currentLineOffset+1) != '#'){ int currentLineFirstCharPos = getFirstCharRelativePosition(ps.doc, currentLineOffset); return currentLineFirstCharPos; } } } return -1; } /** * * @param ps * @throws BadLocationException */ private void eraseSingleChar(PySelection ps) throws BadLocationException{ ITextSelection textSelection = ps.getITextSelection(); ps.doc.replace ( textSelection.getOffset() -1, 1, "" ); } /** * * @param ps * @throws BadLocationException */ private void eraseLineDelimiter(PySelection ps) throws BadLocationException{ ITextSelection textSelection = ps.getITextSelection(); int length = getDelimiter(ps.doc, 1).length(); int offset = textSelection.getOffset() - length; //System.out.println("Replacing offset: "+(offset) +" lenght: "+ (length)); ps.doc.replace ( offset, length, "" ); } /** * * @param ps * @throws BadLocationException */ private void eraseSelection(PySelection ps) throws BadLocationException{ ITextSelection textSelection = ps.getITextSelection(); ps.doc.replace ( textSelection.getOffset() , textSelection.getLength(), "" ); } /** * @param ps * @param lastCharPosition * @throws BadLocationException */ private void eraseUntilLastChar(PySelection ps, int lastCharPosition) throws BadLocationException { ITextSelection textSelection = ps.getITextSelection(); int cursorOffset = textSelection.getOffset(); int offset = lastCharPosition+1; int length = cursorOffset - lastCharPosition-1; //System.out.println("Replacing offset: "+(offset) +" lenght: "+ (length)); ps.doc.replace ( offset , length, "" ); } /** * TODO: Make use of the indentation gotten previously. This implementation just * uses the indentation string and erases the number of chars from it. * * @param ps * @param indentation - this is in number of characters. * @throws BadLocationException */ private void eraseToIndentation(PySelection ps, int indentation) throws BadLocationException { ITextSelection textSelection = ps.getITextSelection(); int cursorOffset = textSelection.getOffset(); String indentationString = getIndentationString(); int length = indentationString.length(); int offset = cursorOffset - length; IRegion region = ps.doc.getLineInformationOfOffset(cursorOffset); int dif = region.getOffset() - offset; //System.out.println("dif = "+dif); if (dif > 0){ offset += dif; length -= dif; } //we have to be careful not to erase more than the current line. //System.out.println("Replacing offset: "+(offset) +" lenght: "+ (length)); ps.doc.replace ( offset , length, "" ); } //CODE BELOW GOTTEN FROM PyAutoIndentStrategy.java. //TODO: Software enginner this (Ctrl-C / Ctrl-V is not a good strategy) String identString = null; // should tab be converted to spaces? boolean useSpaces = PydevPrefs.getPreferences().getBoolean(PydevPrefs.SUBSTITUTE_TABS); int tabWidth = PydevPrefs.getPreferences().getInt(PydevPrefs.TAB_WIDTH); boolean forceTabs = false; private String createSpaceString(int width) { StringBuffer b = new StringBuffer(width); while (tabWidth-- > 0) b.append(" "); return b.toString(); } private String getIndentationString() { if (identString == null || tabWidth != PydevPrefs.getPreferences().getInt(PydevPrefs.TAB_WIDTH) || useSpaces != PydevPrefs.getPreferences().getBoolean(PydevPrefs.SUBSTITUTE_TABS)) { tabWidth = PydevPrefs.getPreferences().getInt(PydevPrefs.TAB_WIDTH); useSpaces = PydevPrefs.getPreferences().getBoolean(PydevPrefs.SUBSTITUTE_TABS); if (useSpaces && !forceTabs) identString = createSpaceString(tabWidth); else identString = "\t"; } return identString; } //END TODO. } |
From: Fabio Z. <fa...@us...> - 2004-07-16 15:32:46
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3929/src/org/python/pydev/editor Modified Files: PyAutoIndentStrategy.java Log Message: Changed so that we get the indentation string when we press tab and not only a single space. Index: PyAutoIndentStrategy.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyAutoIndentStrategy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyAutoIndentStrategy.java 14 Jun 2004 12:50:10 -0000 1.4 --- PyAutoIndentStrategy.java 16 Jul 2004 15:32:37 -0000 1.5 *************** *** 85,89 **** text = indentString; else ! text = " "; // contains a char (pasted text) } else { --- 85,89 ---- text = indentString; else ! text = indentString; // contains a char (pasted text) } else { *************** *** 179,189 **** command.text = autoIndentNewline( document, command.length, command.text, command.offset); ! if (PydevPrefs.getPreferences().getBoolean(PydevPrefs.SUBSTITUTE_TABS)) command.text = convertTabs( document, command.length, command.text, command.offset, getIndentationString()); ! else command.text = convertSpaces( document, command.length, command.text, command.offset, getIndentationString()); } catch (BadLocationException e) { e.printStackTrace(); --- 179,191 ---- command.text = autoIndentNewline( document, command.length, command.text, command.offset); ! if (PydevPrefs.getPreferences().getBoolean(PydevPrefs.SUBSTITUTE_TABS)){ command.text = convertTabs( document, command.length, command.text, command.offset, getIndentationString()); ! }else { ! command.text = convertSpaces( document, command.length, command.text, command.offset, getIndentationString()); + } } catch (BadLocationException e) { e.printStackTrace(); |
From: Fabio Z. <fa...@us...> - 2004-07-16 15:31:29
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3697/src/org/python/pydev/editor Modified Files: PyEditConfiguration.java Log Message: Changed so that we always get python indentation strategy. (even on comments). Index: PyEditConfiguration.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEditConfiguration.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PyEditConfiguration.java 2 Jul 2004 02:50:38 -0000 1.12 --- PyEditConfiguration.java 16 Jul 2004 15:31:20 -0000 1.13 *************** *** 19,24 **** import org.eclipse.jface.text.TextAttribute; import org.eclipse.jface.text.TextPresentation; - import org.eclipse.jface.text.contentassist.ContentAssistant; - import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContentAssistant; import org.eclipse.jface.text.presentation.IPresentationReconciler; --- 19,22 ---- *************** *** 38,42 **** import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.graphics.Color; - import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; --- 36,39 ---- *************** *** 80,93 **** /** * Cache the result, because we'll get asked for it multiple times ! * * @return PyAutoIndentStrategy which deals with spaces/tabs */ public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer,String contentType) { ! if (autoIndentStrategy == null) autoIndentStrategy = new PyAutoIndentStrategy(); ! if (contentType == null || contentType.equals(IDocument.DEFAULT_CONTENT_TYPE)) ! return autoIndentStrategy; ! else ! return super.getAutoIndentStrategy(sourceViewer, contentType); } --- 77,88 ---- /** * Cache the result, because we'll get asked for it multiple times ! * Now, we always return the PyAutoIndentStrategy. (even on commented lines). * @return PyAutoIndentStrategy which deals with spaces/tabs */ public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer,String contentType) { ! if (autoIndentStrategy == null){ autoIndentStrategy = new PyAutoIndentStrategy(); ! } ! return autoIndentStrategy; } |
From: Aleksandar T. <at...@us...> - 2004-07-12 18:22:41
|
Update of /cvsroot/pydev/org.python.pydev.help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13402 Modified Files: toc_main.xml Log Message: Remove superfluous commenting Index: toc_main.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/toc_main.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** toc_main.xml 21 Jun 2004 21:36:52 -0000 1.5 --- toc_main.xml 12 Jul 2004 18:22:32 -0000 1.6 *************** *** 6,30 **** <topic label="Preferences" href="html/db_prefs.html"/> </topic> - <topic label="User Guide" href="html/userguide/index.html"> - <topic label="Editor"> - <topic label="Auto Indentation" href="html/userguide/editor_autoi.html"/> - <topic label="Block Comment" href="html/userguide/editor_blockc.html"/> - <topic label="Bulk Comment" href="html/userguide/editor_comment.html"/> - <topic label="Convert Space to Tab" href="html/userguide/editor_convertstt.html"/> - <topic label="Convert Tab to Space" href="html/userguide/editor_converttts.html"/> - <topic label="Error Parsing" href="html/userguide/editor_parsing.html"/> - <topic label="Go to First Character" href="html/userguide/editor_gotofc.html"/> - <topic label="Go to Previous Method/Class" href="html/userguide/editor_gotopmc.html"/> - <topic label="Go to Next Method/Class" href="html/userguide/editor_gotonmc.html"/> - <topic label="Hyperlinks" href="html/userguide/editor_hyperlinks.html"/> - <topic label="Outline View" href="html/userguide/editor_outline.html"/> - <topic label="Strip Trailing Whitespace" href="html/userguide/editor_stripw.html"/> - <topic label="Syntax Highlighting" href="html/userguide/editor_syntaxh.html"/> - </topic> - <topic label="Preferences" href="html/userguide/preferences.html"/> - <topic label="Debugger" href="html/userguide/debug.html"> - <topic label="Preferences" href="html/userguide/debug_preferences.html"/> - </topic> - <topic label="About" href="html/userguide/about.html"/> - </topic> </toc> \ No newline at end of file --- 6,8 ---- |
From: Aleksandar T. <at...@us...> - 2004-07-12 18:22:40
|
Update of /cvsroot/pydev/org.python.pydev.help/html/userguide/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13402/html/userguide/includes Removed Files: script.js style.css Log Message: Remove superfluous commenting --- style.css DELETED --- --- script.js DELETED --- |
Update of /cvsroot/pydev/org.python.pydev.help/html/userguide In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13402/html/userguide Removed Files: editor.html preferences.html debug_preferences.html editor_converttts.html index.html editor_gotonmc.html editor_hyperlinks.html editor_gotopmc.html editor_syntaxh.html editor_outline.html editor_autoi.html editor_stripw.html editor_convertstt.html editor_comment.html editor_autoc.html debug.html editor_parsing.html editor_gotofc.html about.html editor_blockc.html Log Message: Remove superfluous commenting --- editor_autoc.html DELETED --- --- index.html DELETED --- --- editor_parsing.html DELETED --- --- editor_convertstt.html DELETED --- --- debug.html DELETED --- --- editor_autoi.html DELETED --- --- editor_converttts.html DELETED --- --- editor_outline.html DELETED --- --- editor_gotonmc.html DELETED --- --- debug_preferences.html DELETED --- --- editor_gotopmc.html DELETED --- --- editor_gotofc.html DELETED --- --- preferences.html DELETED --- --- about.html DELETED --- --- editor_syntaxh.html DELETED --- --- editor_comment.html DELETED --- --- editor_hyperlinks.html DELETED --- --- editor.html DELETED --- --- editor_blockc.html DELETED --- --- editor_stripw.html DELETED --- |
Update of /cvsroot/pydev/org.python.pydev.help/html/userguide/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13402/html/userguide/images Removed Files: editor_gotomc_02.jpg editor_blockc_03.jpg editor_gotofc_03.jpg editor_blockc_02.jpg editor_gotomc_01.jpg editor_blockc_05.jpg editor_gotofc_01.jpg editor_blockc_04.jpg editor_error_01.jpg editor_error_02.jpg editor_blockc_06.jpg editor_gotomc_03.jpg editor_blockc_01.jpg editor_tab_02.jpg editor_outline_01.jpg editor_gotofc_02.jpg menu.jpg editor_syntax_01.jpg editor_outline_02.jpg editor_gotomc_04.jpg editor_tab_01.jpg Log Message: Remove superfluous commenting --- editor_blockc_03.jpg DELETED --- --- editor_error_02.jpg DELETED --- --- editor_tab_02.jpg DELETED --- --- editor_gotomc_02.jpg DELETED --- --- editor_gotofc_03.jpg DELETED --- --- menu.jpg DELETED --- --- editor_gotofc_01.jpg DELETED --- --- editor_gotofc_02.jpg DELETED --- --- editor_blockc_06.jpg DELETED --- --- editor_gotomc_04.jpg DELETED --- --- editor_blockc_02.jpg DELETED --- --- editor_tab_01.jpg DELETED --- --- editor_blockc_04.jpg DELETED --- --- editor_syntax_01.jpg DELETED --- --- editor_gotomc_03.jpg DELETED --- --- editor_blockc_01.jpg DELETED --- --- editor_outline_01.jpg DELETED --- --- editor_gotomc_01.jpg DELETED --- --- editor_error_01.jpg DELETED --- --- editor_outline_02.jpg DELETED --- --- editor_blockc_05.jpg DELETED --- |
Update of /cvsroot/pydev/org.python.pydev.help/html/userguide In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24819/html/userguide Modified Files: preferences.html debug_preferences.html editor_converttts.html index.html editor_gotonmc.html editor_hyperlinks.html editor_gotopmc.html editor_syntaxh.html editor_outline.html editor_autoi.html editor_stripw.html editor_convertstt.html editor_comment.html editor_autoc.html debug.html editor_parsing.html editor_gotofc.html editor_blockc.html Added Files: editor.html Log Message: All pages in the editor user guide have content. I filled in what I knew of parts I didn't work on. Index: editor_autoc.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_autoc.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editor_autoc.html 14 Jun 2004 20:22:13 -0000 1.1 --- editor_autoc.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Auto Completion'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Auto Completion'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,80 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'Upon entering a . or (, the editor pops up possible completions ' + ! 'based on your body of code.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: index.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 21 Jun 2004 21:36:51 -0000 1.3 --- index.html 9 Jul 2004 13:00:36 -0000 1.4 *************** *** 41,45 **** <ul> ! <li>Features <ul> <li><a href="editor_autoc.html">Auto Completion</a> --- 41,45 ---- <ul> ! <li><a href="editor.html">Editor Features</a> <ul> <li><a href="editor_autoc.html">Auto Completion</a> Index: editor_parsing.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_parsing.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editor_parsing.html 14 Jun 2004 20:22:13 -0000 1.1 --- editor_parsing.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Error Parsing'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Error Parsing'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,87 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'The PyDev editor performs real-time error parsing. As you enter code, ' + ! 'the parser will inform you of errors which are displayed with red markings.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'Errors are parsed as code is entered. For example, the following code ' + ! 'lacks proper indentation and expression after the method declaration ' + ! 'for barfoo:<br><br>' + ! '<img src="images/editor_error_01.jpg"><br><br>' + ! 'Markers will demonstrate the location of the error by underlining ' + ! 'problem areas and showing the error symbol on the editor frame, as well ' + ! 'as giving detailed descriptions in Eclipse\'s Task/Error list:<br><br>' + ! '<img src="images/editor_error_02.jpg">'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: editor_convertstt.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_convertstt.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editor_convertstt.html 21 Jun 2004 21:36:51 -0000 1.1 --- editor_convertstt.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Convert Space To Tab'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Convert Space To Tab'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,87 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'This action allows one to convert lines of code from using a set ' + ! 'number of spaces for indentation to code using tab indentation.' + ! 'The number of spaces used can be changed in the ' + ! '<a href="preferences.html">Preferences</a> page.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! rows[0] = 11; ! ! hotkeys[0] = 'Ctrl+Shift+Tab'; ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = 'Highlight a body of text in the editor to transform all included ' + ! 'lines from using set space indentation to using tab indentation.'; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: debug.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/debug.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** debug.html 14 Jun 2004 20:22:13 -0000 1.1 --- debug.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 47,58 **** </ul> <p>The debugger can be invoked from the standard Eclipse debugger menus in the debug perspective, or through a context menu inside Navigator:</p> ! <p><img src="images/debugdialog.jpg" width="274" height="214"> or <img src="images/debug_menu.gif" width="328" height="373"></p> <p>Debug settings are configured in the standard dialog </p> ! <p><img src="images/debug_dialog.gif" width="612" height="434"> </p> <p>Here you can pick your program arguments, etc. The dialog will try to verify that your python interpreter is present. If it is not, go to Preferences:Pydev:Debug and configure a valid python executable.</p> <p>The program output is displayed in the console, and the errors in the console are hyperlinked back to the file:</p> ! <p><img src="images/debug_console.gif" width="600" height="498"> </p> <p>If you are running under the debugger, you'll get the standard debug interface:</p> ! <p><img src="images/debugger.gif" width="816" height="543"> </p> <p>See the <a href="http://pydev.sf.net/">pydev website</a> for the latest debugging info. </p> --- 47,58 ---- </ul> <p>The debugger can be invoked from the standard Eclipse debugger menus in the debug perspective, or through a context menu inside Navigator:</p> ! <p><img src="../images/debugdialog.jpg" width="274" height="214"> or <img src="../images/debug_menu.gif" width="328" height="373"></p> <p>Debug settings are configured in the standard dialog </p> ! <p><img src="../images/debug_dialog.gif" width="612" height="434"> </p> <p>Here you can pick your program arguments, etc. The dialog will try to verify that your python interpreter is present. If it is not, go to Preferences:Pydev:Debug and configure a valid python executable.</p> <p>The program output is displayed in the console, and the errors in the console are hyperlinked back to the file:</p> ! <p><img src="../images/debug_console.gif" width="600" height="498"> </p> <p>If you are running under the debugger, you'll get the standard debug interface:</p> ! <p><img src="../images/debugger.gif" width="816" height="543"> </p> <p>See the <a href="http://pydev.sf.net/">pydev website</a> for the latest debugging info. </p> Index: editor_autoi.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_autoi.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editor_autoi.html 21 Jun 2004 21:36:51 -0000 1.3 --- editor_autoi.html 9 Jul 2004 13:00:36 -0000 1.4 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Auto Indentation'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Auto Indentation'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,90 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'Indentation is important in programming in general, but more so in Python, ' + ! 'which uses indentation to separate logical blocks of code. The PyDev ' + ! 'editor intelligently indents after if, else, etc. statements, as well as ' + ! 'after method and class declarations.<br><br>' + ! 'The PyDev editor similarly offers smart indent/dedent (through Tab and ' + ! 'Shift+Tab), that will preserve and utilize correct indentation of ' + ! 'selected code.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'Pressing enter with the cursor as shown below:<br><br>' + ! '<img src="images/editor_tab_01.jpg"><br><br>' + ! 'Will result in the cursor intelligently indenting to this:<br><br>' + ! '<img src="images/editor_tab_02.jpg"><br><br>' + ! 'This will similarly function after class, if, else, etc. declarations, ' + ! 'and maintain indentation while the code continues.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: editor_converttts.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_converttts.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editor_converttts.html 21 Jun 2004 21:36:51 -0000 1.1 --- editor_converttts.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Convert Tab to Space'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Convert Tab to Space'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,87 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'This action allows one to convert lines of code from using a tab ' + ! 'indentation to code using a set number of spaces for indentation. ' + ! 'The number of spaces used can be changed in the ' + ! '<a href="preferences.html">Preferences</a> page.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! rows[0] = 10; ! ! hotkeys[0] = 'Ctrl+Tab'; ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = 'Highlight a body of text in the editor to transform all included ' + ! 'lines from using tab indentation to using set-space indentation.'; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: editor_outline.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_outline.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editor_outline.html 14 Jun 2004 20:22:13 -0000 1.1 --- editor_outline.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Outline View'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Outline View'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,90 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'Outline view displays a hierarchal structure of classes, methods, and imports ' + ! 'within the active file, and is updated real-time as code is entered. ' + ! 'Selecting a class or method within the outline view jumps to and highlights ' + ! 'that particular class or method in the file.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! var desc = 'If the Outline view is not showing, you may open it through the ' + ! 'Eclipse menu via Window -> Show View -> Outline.'; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'The Outline View shows a hierarchal view of your code\'s classes, methods, ' + ! 'and imports, and is updated while you enter in code.<br><br>' + ! 'Suppose the code and outline initially looks as follows:<br><br>' + ! '<img src="images/editor_outline_01.jpg"><br><br>' + ! 'If I decided to dedent method barfoo, shortly after the dedent the ' + ! 'outline would update to reflect that barfoo is no longer a method within ' + ! 'class foo, and change to the following:<br><br>' + ! '<img src="images/editor_outline_02.jpg">'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: editor_gotonmc.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_gotonmc.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editor_gotonmc.html 21 Jun 2004 21:36:51 -0000 1.2 --- editor_gotonmc.html 9 Jul 2004 13:00:36 -0000 1.3 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Go to Next Method/Class'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Go to Next Method/Class'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,93 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = '...'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! rows[0] = 6; ! ! hotkeys[0] = 'Ctrl+Shift+Arrow_Down'; ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'From the location your cursor is positioned, invoking this action will ' + ! 'cause the cursor to jump to and highlight the next method or class in ' + ! 'the document.<br><br>' + ! 'Invoking the action with the cursor here within method foobar:<br><br>' + ! '<img src="images/editor_gotomc_01.jpg"><br><br>' + ! 'Jumps to and highlights method barfoo:<br><br>' + ! '<img src="images/editor_gotomc_02.jpg"><br><br>' + ! 'From here, invoking the action again jumps to class blah:<br><br>' + ! '<img src="images/editor_gotomc_03.jpg">'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = 'Highlighting or locating the cursor in a region within a method or class ' + ! 'and invoking this action causes the cursor to jump to the next method or ' + ! 'class.'; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: debug_preferences.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/debug_preferences.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** debug_preferences.html 14 Jun 2004 20:22:13 -0000 1.1 --- debug_preferences.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 44,48 **** <p>Configure your python executables here. By default, pydev will try to run "python".</p> ! <p><img src="images/db_prefs.gif" width="599" height="326"></p> </body> --- 44,48 ---- <p>Configure your python executables here. By default, pydev will try to run "python".</p> ! <p><img src="../images/db_prefs.gif" width="599" height="326"></p> </body> Index: editor_gotopmc.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_gotopmc.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editor_gotopmc.html 21 Jun 2004 21:36:51 -0000 1.2 --- editor_gotopmc.html 9 Jul 2004 13:00:36 -0000 1.3 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Go to Previous Method/Class'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Go to Previous Method/Class'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,91 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = '...'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! rows[0] = 5; ! ! hotkeys[0] = 'Ctrl+Shift+Arrow_Up'; ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'From the location your cursor is positioned, invoking this action will ' + ! 'cause the cursor to jump to and highlight the previous method or class in ' + ! 'the document.<br><br>' + ! 'Invoking the action with the cursor here within class blah:<br><br>' + ! '<img src="images/editor_gotomc_04.jpg"><br><br>' + ! 'Jumps to and highlights method barfoo:<br><br>' + ! '<img src="images/editor_gotomc_02.jpg">'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = 'Highlighting or locating the cursor in a region within a method or class ' + ! 'and invoking this action causes the cursor to jump to the previous method or ' + ! 'class.'; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: editor_gotofc.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_gotofc.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** editor_gotofc.html 21 Jun 2004 21:36:51 -0000 1.2 --- editor_gotofc.html 9 Jul 2004 13:00:36 -0000 1.3 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Go to First Character'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Go to First Character'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,100 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'This action allows the user to go to the first non-whitespace character ' + ! 'on the line their cursor is on. If the cursor is already at that ' + ! 'character, it jumps to the first character on the line (including ' + ! 'whitespace.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! rows[0] = 3; ! ! hotkeys[0] = 'Home'; ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'From the location your cursor is positioned, invoking this action will ' + ! 'cause the cursor to jump to the first non-whitespace character in that ' + ! 'line.<br><br>' + ! 'Invoking the action with the cursor here within method foobar:<br><br>' + ! '<img src="images/editor_gotomc_01.jpg"><br><br>' + ! 'Or with the cursor on whitespace on the same line:<br><br>' + ! '<img src="images/editor_gotofc_01.jpg"><br><br>' + ! 'Jumps the cursor to the first non-whitespace:<br><br>' + ! '<img src="images/editor_gotofc_02.jpg"><br><br>' + ! 'Invoking the action again jumps to the first character in the line:<br><br>' + ! '<img src="images/editor_gotofc_03.jpg">'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = 'If the cursor is on a single line, highlighted or otherwise, it will ' + ! 'jump to the first non-whitespace character on that line. If the cursor ' + ! 'is already at that character, it will jump to the first character on the ' + ! 'line. If a group of lines are highlighted, the cursor will act as if ' + ! 'only the first line in the group has been selected.'; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: preferences.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/preferences.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** preferences.html 21 Jun 2004 21:36:51 -0000 1.3 --- preferences.html 9 Jul 2004 13:00:36 -0000 1.4 *************** *** 40,44 **** </script> ! <p><img src="images/ed_prefs.gif" width="600" height="260"></p> <p> --- 40,44 ---- </script> ! <p><img src="../images/ed_prefs.gif" width="600" height="260"></p> <p> *************** *** 69,85 **** <strong><u>Block comment separator</u></strong> <br> ! Used with the Add Block Comment feature (in the Source menu, or by pressing Ctrl+4). This feature adds a comment separator block to code that changes this: ! <br><br> ! print "foo"<br> ! print "bar" ! <br><br> ! Into: ! <br><br> ! #======<br> ! #print "foo"<br> ! #print "bar"<br> ! #======<br> ! <br> ! The comment separator (in this case ======, but it can be changed by the user's preference) is added to the beginning and end of the comment block. You can also select the blocked code and remove the block comment format with the Remove Block Comment feature in the Source menu, or by pressing Ctrl+5. </p> --- 69,74 ---- <strong><u>Block comment separator</u></strong> <br> ! Used with the <a href="editor_blockc.html">Add Block Comment</a> feature, changing ! the desired separator token (default: ==============). </p> Index: editor_syntaxh.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_syntaxh.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editor_syntaxh.html 21 Jun 2004 21:36:51 -0000 1.3 --- editor_syntaxh.html 9 Jul 2004 13:00:36 -0000 1.4 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Syntax Highlighting'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Syntax Highlighting'; *************** *** 43,49 **** </script> ! <p> ! ... ! </p> </body> --- 43,82 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'The PyDev editor supports user-customized Syntax Highlighting, which ' + ! 'colorizes keywords, comments, and strings according to adjustable colors ' + ! 'in the <a href="preferences.html">Preferences</a> page.<br><br>' + ! '<img src="images/editor_syntax_01.jpg">'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = ''; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: editor_comment.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_comment.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editor_comment.html 21 Jun 2004 21:36:51 -0000 1.3 --- editor_comment.html 9 Jul 2004 13:00:36 -0000 1.4 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Bulk Comment'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Bulk Comment'; *************** *** 43,71 **** </script> ! <p> ! Besides regular commenting, PyDev allows you to comment out sections of code easily.<br> ! <br> ! From this:<br> ! <br> ! <img src="images/editor_blockc_06.jpg"><br> ! <br> ! To this:<br> ! <br> ! <img src="images/editor_blockc_05.jpg"><br> ! <br> ! In order to make bulk comments, highlight a body of text in the editor, and do one of the following:<br> ! <ul> ! <li>Source Menu -> Comment ! <li>Right-Click -> Source -> Comment ! <li>Ctrl+/ ! </ul> ! You may remove a selected bulk comment with:<br> ! <ul> ! <li>Source -> Comment ! <li>Right-Click -> Source -> Uncomment ! <li>Ctrl+\ ! </ul> ! </p> </body> --- 43,95 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'Bulk Comments are lines of code with the <strong>#</strong> token ' + ! 'preceding them, which can be formed by selecting lines of code ' + ! 'and calling the Comment action within the editor.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! rows[0] = 1; ! rows[1] = 2; ! ! hotkeys[0] = 'Ctrl+/'; ! hotkeys[1] = 'Ctrl+\\'; ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'Will convert a selected body of text from this:<br><br>' + ! '<img src="images/editor_blockc_06.jpg"><br><br>' + ! 'To this:<br><br>' + ! '<img src="images/editor_blockc_05.jpg"><br><br>' + ! 'And vice-versa (through the Uncomment command).'; ! ! writeGeneric ( headline, desc ); ! </script> + <!-- Selection --> + <script language="javascript"> + var headline = 'Selection'; + var desc = 'Highlight a body of text in the editor to transform all included ' + + 'lines into a Comment region. If you select no lines, the ' + + 'line the cursor is on will be turned into a Comment region. This ' + + 'works the same in reverse, with the Uncomment action.'; + + writeGeneric ( headline, desc ); + </script> + </body> Index: editor_hyperlinks.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_hyperlinks.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** editor_hyperlinks.html 14 Jun 2004 20:22:12 -0000 1.1 --- editor_hyperlinks.html 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Hyperlinks'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Hyperlinks'; *************** *** 43,46 **** --- 43,80 ---- </script> + <!-- Description --> + <script language="javascript"> + var headline = 'Description'; + var desc = '...'; + + writeGeneric ( headline, desc ); + </script> + + <!-- Invocation --> + <script language="javascript"> + var rows = new Array ( ); + var hotkeys = new Array ( ); + + var desc = ''; + + writeInvocation ( rows, hotkeys, desc ); + </script> + + <!-- Process --> + <script language="javascript"> + var headline = 'Process'; + var desc = ''; + + writeGeneric ( headline, desc ); + </script> + + <!-- Selection --> + <script language="javascript"> + var headline = 'Selection'; + var desc = ''; + + writeGeneric ( headline, desc ); + </script> + <p>If you press CTRL while mousing over function & import names you'll get a hyperlink to their definition. The hyperlinking only works for:</p> <ul> *************** *** 48,52 **** <li>imports that are on your import path. The import path includes python.exe/Lib, if you've defined python executable in your pydev:debug preferences.</li> </ul> ! <p><img src="images/hyperanim.gif" width="300" height="170" border="1"> </p> <p> </p> <p> </p> --- 82,86 ---- <li>imports that are on your import path. The import path includes python.exe/Lib, if you've defined python executable in your pydev:debug preferences.</li> </ul> ! <p><img src="../images/hyperanim.gif" width="300" height="170" border="1"> </p> <p> </p> <p> </p> --- NEW FILE: editor.html --- <!--=============================================================================================== File: editor Author: Parhaum Toofanian, Copyright 2004 Contact: pto...@an... Created: 2004-06-14 Modified: 2004-06-14 Part of PyDev User Guide in Eclipse. Index page of the Editor features. ================================================================================================--> <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <script src = "includes/script.js" language="javascript" type="text/javascript"></script> <link rel = stylesheet href = "includes/style.css" type = "text/css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>PyDev User Guide</title> </head> <body> <script language="javascript"> var heads = new Array ( ); var links = new Array ( ); var i = 0; heads[i] = 'PyDev User Guide'; links[i++] = 'index.html'; heads[i] = 'Editor'; links[i++] = 'editor.html'; writeHeading ( heads, links ); </script> <p> Editor features available within this IDE: </p> <ul> <li><a href="editor_autoc.html">Auto Completion</a> <li><a href="editor_autoi.html">Auto-Indentation</a> <li><a href="editor_blockc.html">Block Commenting</a> <li><a href="editor_comment.html">Bulk Commenting</a> <li><a href="editor_convertstt.html">Convert Space to Tab</a> <li><a href="editor_converttts.html">Convert Tab to Space</a> <li><a href="editor_parsing.html">Error Parsing</a> <li><a href="editor_gotofc.html">Go to First Character</a> <li><a href="editor_gotopmc.html">Go to Previous Method/Class</a> <li><a href="editor_gotonmc.html">Go to Next Method/Class</a> <li><a href="editor_hyperlinks.html">Hyperlinks</a> <li><a href="editor_outline.html">Outline View</a> <li><a href="editor_stripw.html">Strip Whitespace</a> <li><a href="editor_syntaxh.html">Syntax Highlighting</a> </ul> </body> </html> Index: editor_blockc.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_blockc.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editor_blockc.html 21 Jun 2004 21:36:51 -0000 1.3 --- editor_blockc.html 9 Jul 2004 13:00:36 -0000 1.4 *************** *** 26,29 **** --- 26,30 ---- <body class = BlueGray> + <!-- Header --> <script language="javascript"> var heads = new Array ( ); *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Block Comment'; --- 35,40 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Block Comment'; *************** *** 43,71 **** </script> ! <p> ! Block Comments are lines of code with the <strong>#</strong> token preceding them, and with separators to make them stand out.<br> ! <br> ! From this:<br> ! <br> ! <img src="images/editor_blockc_06.jpg"><br> ! <br> ! To this:<br> ! <br> ! <img src="images/editor_blockc_01.jpg"><br> ! <br> ! In order to make block comments, highlight a body of text in the editor, and do one of the following:<br> ! <ul> ! <li>Source Menu -> Add Comment Block ! <li>Right-Click -> Source -> Add Comment Block ! <li>Ctrl+4 ! </ul> ! You may remove a selected comment block with:<br> ! <ul> ! <li>Source -> Remove Comment Block ! <li>Right-Click -> Source -> Remove Comment Block ! <li>Ctrl+5 ! </ul> ! The separator string (the =====) can be changed in the <a href="preferences.html">Preferences page</a>. <br> ! </p> </body> --- 44,98 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'Block Comments are lines of code with the <strong>#</strong> token ' + ! 'preceding them, and with separators to make them stand out. This ' + ! 'is similar to Bulk Commenting, but with the addition of the ' + ! 'separator lines, which can be useful in viewing clarity. The ' + ! 'separator string (=====) can be changed in the ' + ! '<a href="preferences.html">Preferences</a> page.'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Invocation --> ! <script language="javascript"> ! var rows = new Array ( ); ! var hotkeys = new Array ( ); ! ! rows[0] = 7; ! rows[1] = 8; ! ! hotkeys[0] = 'Ctrl+4'; ! hotkeys[1] = 'Ctrl+5'; ! ! var desc = ''; ! ! writeInvocation ( rows, hotkeys, desc ); ! </script> ! ! <!-- Process --> ! <script language="javascript"> ! var headline = 'Process'; ! var desc = 'Will convert a selected body of text from this:<br><br>' + ! '<img src="images/editor_blockc_06.jpg"><br><br>' + ! 'To this:<br><br>' + ! '<img src="images/editor_blockc_01.jpg"><br><br>' + ! 'And vice-versa (through the Remove Block Comment command).'; ! ! writeGeneric ( headline, desc ); ! </script> ! ! <!-- Selection --> ! <script language="javascript"> ! var headline = 'Selection'; ! var desc = 'Highlight a body of text in the editor to transform all included ' + ! 'lines into a Block Comment region. If you select no lines, the ' + ! 'line the cursor is on will be turned into a Block Comment region. ' + ! 'This works the same in reverse with the Remove Block Comment action.'; ! ! writeGeneric ( headline, desc ); ! </script> </body> Index: editor_stripw.html =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/editor_stripw.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** editor_stripw.html 21 Jun 2004 21:36:51 -0000 1.3 --- editor_stripw.html 9 Jul 2004 13:00:36 -0000 1.4 *************** *** 34,39 **** links[i++] = 'index.html'; ! heads[i] = 'Features'; ! links[i++] = ''; heads[i] = 'Strip Trailing Whitespace'; --- 34,39 ---- links[i++] = 'index.html'; ! heads[i] = 'Editor'; ! links[i++] = 'editor.html'; heads[i] = 'Strip Trailing Whitespace'; *************** *** 43,56 **** </script> ! <p> ! Trailing whitespace is any tab, space, etc characters at the end of a line. ! <br><br> ! In order to strip whitespace, you can highlight a body of text in the editor, or select nothing and it will strip whitespace in the entire document. Do one of the following:<br> ! <ul> ! <li>Source Menu -> Strip Trailing Whitespace ! <li>Right-Click -> Source -> Strip Trailing Whitespace ! <li>Shift+Space ! </p> </body> --- 43,87 ---- </script> ! <!-- Description --> ! <script language="javascript"> ! var headline = 'Description'; ! var desc = 'This action strips trailing whitespace (space, tab) from the end ' + ! 'of selected lines.'; + writeGeneric ( headline, desc ); + </script> + + <!-- Invocation --> + <script language="javascript"> + var rows = new Array ( ); + var hotkeys = new Array ( ); + + rows[0] = 9; + + hotkeys[0] = 'Shift+Space'; + + var desc = ''; + + writeInvocation ( rows, hotkeys, desc ); + </script> + + <!-- Process --> + <script language="javascript"> + var headline = 'Process'; + var desc = ''; + + writeGeneric ( headline, desc ); + </script> + + <!-- Selection --> + <script language="javascript"> + var headline = 'Selection'; + var desc = 'Highlight a body of text in the editor to strip trailing whitespace ' + + 'from selected lines. If no lines are selected, the entire document ' + + 'is stripped of trailing whitespace.'; + + writeGeneric ( headline, desc ); + </script> + </body> |
From: Parhaum T. <dre...@us...> - 2004-07-09 13:00:54
|
Update of /cvsroot/pydev/org.python.pydev.help/html/userguide/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24819/html/userguide/includes Modified Files: script.js style.css Log Message: All pages in the editor user guide have content. I filled in what I knew of parts I didn't work on. Index: style.css =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/includes/style.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** style.css 14 Jun 2004 20:22:13 -0000 1.1 --- style.css 9 Jul 2004 13:00:37 -0000 1.2 *************** *** 94,488 **** ! ! ! ! ! ! ! ! ! ! .MenuTable ! { ! border: 1px solid black; ! } ! ! .BannerTable ! { ! font-size: 24pt; ! color: white; ! background-color: #276295; ! border: 1px solid black; ! font-family: tahoma; ! cursor: default; ! } ! ! .LogoTable ! { ! font-size: 24pt; ! color: #276295; ! background-color: white; ! border: 1px solid white; ! font-family: tahoma; ! cursor: default; ! } ! ! .MenuRowInverse ! { ! font-size: 8pt; ! font-style: bold; ! font-weight: 800; ! color: #FF8A00; ! background-color: white; ! border: 1px solid black; ! cursor: default; ! } ! ! .CopyrightRowInverse ! { ! font-size: 8pt; ! color: #276295; ! background-color: white; ! border: 1px solid black; ! cursor: default; ! } ! ! .MenuRow ! { ! font-size: 9pt; ! color: white; ! background-color: #4D8CC2; ! border: 1px solid black; ! cursor: default; ! } ! ! .MenuRowOff ! { ! font-family: verdana; ! font-size: 8pt; ! color: white; ! background-color: #4D8CC2; ! border: 1px solid #4D8CC2; ! cursor: default; ! } ! ! .MenuRowOver ! { ! font-family: verdana; ! font-size: 8pt; ! color: white; ! background-color: #FF8A00; ! border: 1px solid black; ! cursor: hand; ! } ! ! .MenuBox ! { ! font-size: 9pt; ! color: white; ! background-color: #4D8CC2; ! border: 1px solid black; ! cursor: default; ! } ! ! .TheaterName ! { ! font-size: 14pt; ! font-style: bold; ! font-weight: 800; ! color: #26659B; ! background-color: white; ! border: 1px solid black; ! } ! ! .MovieName ! { ! font-family: verdana; ! font-size: 10pt; ! font-style: bold; ! color: white; ! background-color: gray; ! border: 1px solid black; ! } ! ! .ShowingText ! { ! font-family: verdana; ! font-size: 8pt; ! color: black; ! background-color: white; ! } ! ! .ShowingTextSoldOut ! { ! font-family: arial; ! font-size: 10pt; ! color: red; ! background-color: white; ! } ! ! .FormText { - font-family: verdana; font-size: 12pt; ! font-style: bold; ! color: black; ! background-color: white; ! } ! ! .FormContents ! { ! font-family: verdana; ! font-size: 8pt; ! color: white; ! background-color: #4D8CC2; ! border: 1px solid black; ! } ! ! ! .Error ! { ! font-family: verdana; ! font-size: 10pt; ! color: red; ! background-color: white; ! } ! ! .Main ! { ! font-family: arial; ! font-size: 9pt; ! text-decoration: none; ! color: black; ! } ! ! ! A.Main ! { ! font-family: arial; ! font-size: 9pt; ! text-decoration: none; ! color: #26659B; ! } ! ! A.Main:Visited ! { ! font-family: arial; ! font-size: 9pt; ! text-decoration: none; ! color: #26659B; ! } ! ! A.Main:Hover ! { ! font-family: arial; ! font-size: 9pt; ! text-decoration: none; ! color: #4D8CC2; ! } ! ! ! A.Error ! { ! font-family: arial; ! font-size: 9pt; ! text-decoration: none; ! color: red; ! } ! ! A.Error:Visited ! { ! font-family: arial; ! font-size: 9pt; ! text-decoration: none; ! color: red; ! } ! ! A.Error:Hover ! { ! font-family: arial; ! font-size: 9pt; ! text-decoration: none; ! color: #FF4545; ! } ! ! .SoldOut ! { ! font-family: arial; ! font-size: 10pt; ! text-decoration: none; ! color: red; ! } ! ! .MovieTime ! { ! font-family: verdana; ! font-size: 8pt; ! color: black; ! background-color: white; ! text-decoration: none; ! } ! ! ! ! ! ! ! ! .Button ! { ! text-decoration: none; ! font-size: 8pt; ! font-family: verdana; ! color: #4D8CC2; ! background-color: white; ! border: 1px solid #4D8CC2; ! } ! ! A.Menu ! { ! text-decoration: none; ! color: white; ! } ! ! A.Menu:Visited ! { ! text-decoration: none; ! color: white; ! } ! ! A.Menu:Hover ! { ! text-decoration: none; ! color: white; ! } ! ! ! ! ! .MenuOff ! { ! text-decoration: none; ! font-size: 10pt; ! font-family: Arial; ! font-weight: 800; ! font-style: bold; ! color: white; ! background-color: #0067F6; ! background-image: url(../images/menu-off.jpg); ! /*background-image: url(../images/menu-off.jpg);*/ ! border: 1px solid black; ! cursor: hand; ! } ! ! .MenuCurrent ! { ! text-decoration: none; ! font-size: 10pt; ! font-family: Arial; ! font-weight: 800; ! font-style: bold; ! color: white; ! background-color: #FBA144; ! background-image: url(../images/menu-on.jpg); ! /*background-image: url(../images/menu-on.jpg);*/ ! border: 1px solid black; ! cursor: hand; ! } ! ! .MenuOver ! { ! text-decoration: none; ! font-size: 10pt; ! font-family: Arial; font-weight: 800; ! font-style: bold; ! color: white; ! background-color: #FBA144; ! background-image: url(../images/menu-on.jpg); ! /*background-image: url(../images/menu-on.jpg);*/ ! border: 1px solid black; ! cursor: hand; ! } ! ! .MenuTable ! { ! border: 1px solid black; ! } ! ! .LegalTable ! { ! font-size: 8pt; ! font-family: arial; ! font-weight: 400; ! color: black; ! border: 1px solid black; ! background-color: white; ! /*background-color: 005BA8; ! background-image: url(../images/menu-on.jpg);*/ ! margin: 0px; ! cursor: hand; ! } ! ! .Text-Content ! { ! font-size: 9pt; ! font-family: arial; ! color: black; ! background-color: white; ! } ! ! ! .Text-Headline ! { ! font-size: 9pt; ! font-family: arial; ! color: black; ! background-color: white; ! } ! ! .GalleryText ! { ! font-size: 9pt; ! font-family: arial; ! color: black; ! } ! ! .Gallery-Off ! { ! font-size: 9pt; ! font-family: arial; ! color: black; ! border: 1px solid white; ! } ! ! .Gallery-Curr ! { ! font-size: 9pt; ! font-family: arial; ! color: black; ! border: 1px solid #005eb5; cursor: default; } - .Gallery-On - { - font-size: 9pt; - font-family: arial; - color: black; - border: 1px solid #005eb5; - cursor: hand; - } - - .Tiny - { - font-size: 40pt; - } - TABLE.Text - { - font-size: 9pt; - font-family: arial; - color: black; - } --- 94,107 ---- ! .Pointer { font-size: 12pt; ! font-style: normal; font-weight: 800; ! font-family: tahoma; cursor: default; + color: orange; } Index: script.js =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.help/html/userguide/includes/script.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** script.js 14 Jun 2004 20:22:13 -0000 1.1 --- script.js 9 Jul 2004 13:00:36 -0000 1.2 *************** *** 31,54 **** // links[0] = 'foo.html'; // // writeHeading ( heads, links ); // </script> /////////////////////////////////////////////////////////////////////////////////////////////////// function writeHeading ( heads, links ) { ! document.write ( '<p class="Heading">' ); for ( var i = 0; i < heads.length; i++ ) { if ( links[i] != '' && i < heads.length - 1 ) ! document.write ( '<a class="Heading" href="' + links[i] + '">' ); ! document.write ( heads[i] ); if ( links[i] != '' && i < heads.length - 1 ) ! document.write ( '</a>' ); if ( i < heads.length - 1 ) ! document.write ( ' :: ' ); } ! document.write ( '</p>' ); ! document.write ( '<hr>' ); } //////////////////////////////////////////////////////////////////////////////[ writeHeading ]///// --- 31,197 ---- // links[0] = 'foo.html'; // + // heads[1] = 'Bar'; + // links[1] = 'bar.html'; + // // writeHeading ( heads, links ); // </script> + // + // Will produce: + // + // <a href=foo.html>Foo</a> » Bar /////////////////////////////////////////////////////////////////////////////////////////////////// function writeHeading ( heads, links ) { ! var doc = document; ! ! doc.write ( '<p class="Heading" name="top">' ); for ( var i = 0; i < heads.length; i++ ) { if ( links[i] != '' && i < heads.length - 1 ) ! doc.write ( '<a class="Heading" href="' + links[i] + '">' ); ! doc.write ( heads[i] ); if ( links[i] != '' && i < heads.length - 1 ) ! doc.write ( '</a>' ); if ( i < heads.length - 1 ) ! doc.write ( ' » ' ); } ! doc.write ( '</p>' ); ! doc.write ( '<hr>' ); } //////////////////////////////////////////////////////////////////////////////[ writeHeading ]///// + ///////////////////////////////////////////////////////////////////////////[ writeInvocation ]///// + // Name: writeInvocation + // + // Desc: Writes a table with an invocation description of a given feature, including an image + // of the Source menu and hotkeys. + // + // In: rows Array Stores which row(s) to point to on menu image + // hotkeys Array Stores hotkey(s) + // desc String Description of invocation, could be used with or as opposed + // to the menu image and hotkeys. + // Out: - + // + // Sample usage: + // + // <script language="javascript"> + // var rows = new Array ( ); + // var hotkeys = new Array ( ); + // + // rows[0] = 2; + // rows[1] = 5; + // + // hotkeys[0] = 'Ctrl+4'; + // hotkeys[1] = 'Ctrl+5'; + // + // var desc = ''; + // + // writeInvocation ( rows, hotkeys, desc ); + // </script> + // + // Will produce: + // + // (A table with pointers to the 2nd and 5th rows, as well as a list of the applicable + // hotkeys.) + /////////////////////////////////////////////////////////////////////////////////////////////////// + function writeInvocation ( rows, hotkeys, desc ) + { + // Check if there's anything at all to show + if ( rows.length == 0 && hotkeys.length == 0 && desc == '' ) + return; + + var doc = document; + + doc.write ( '<b><u>Invocation</u></b>' ); + doc.write ( ' <a href="#top">[top]</a>' ); + doc.write ( '<ul>' ); + + if ( rows.length > 0 ) + { + doc.write ( '<li>Main Menu or Source Menu (right-click in editor):' ); + doc.write ( '<br><br>' ); + doc.write ( '<table>' ); + doc.write ( ' <tr>' ); + doc.write ( ' <td width = 15 align=left valign=top class=Pointer>' ); + doc.write ( ' <br>' ); + + // Draw row pointers + var j = 0; + for ( var i = 0; i < rows.length; i++ ) + { + for ( ; j < rows[i] - 1; j++ ) + { + doc.write ( '<br>' ); + } + doc.write ( '»' ); + } + + doc.write ( ' </td>' ); + doc.write ( ' <td>' ); + doc.write ( ' <img src="images/menu.jpg">' ); + doc.write ( ' </td>' ); + doc.write ( ' </tr>' ); + doc.write ( '</table>' ); + } + if ( rows.length > 0 && hotkeys.length > 0 ) + doc.write ( '<br>' ); + if ( hotkeys.length > 0 ) + { + doc.write ( '<li>Hotkeys: ' ); + + for ( var i = 0; i < hotkeys.length; i++ ) + { + doc.write ( hotkeys[i] ); + if ( i < hotkeys.length - 1 ) + doc.write ( ', ' ); + } + } + if ( desc != '' ) + { + doc.write ( '<li>' + desc ); + } + doc.write ( '</ul><br>' ); + } + //////////////////////////////////////////////////////////////////////////[ writeInvocation ]////// + + + /////////////////////////////////////////////////////////////////////////////[ writeGeneric ]///// + // Name: writeGeneric + // + // Desc: Writes a general topic with headline and description. + // + // In: headline String Headline of topic + // desc String Description + // Out: - + // + // Sample usage: + // + // <script language="javascript"> + // var headline = 'Headliner'; + // var desc = 'Do this and do that.'; + // + // writeProcess ( process ); + // </script> + // + // Will produce: + // + // <i>Headliner</i> + // + // Do this and do that. + /////////////////////////////////////////////////////////////////////////////////////////////////// + function writeGeneric ( headline, desc ) + { + // Check if anything to write + if ( desc == '' ) + return; + + var doc = document; + + doc.write ( '<b><u>' + headline + '</u></b>' ); + doc.write ( ' <a href="#top">[top]</a>' ); + doc.write ( '<ul>' ); + doc.write ( desc ); + doc.write ( '</ul><br>' ); + } + /////////////////////////////////////////////////////////////////////////////[ writeGeneric ]////// |
Update of /cvsroot/pydev/org.python.pydev.help/html/userguide/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24819/html/userguide/images Added Files: editor_gotomc_02.jpg editor_gotofc_03.jpg editor_gotomc_01.jpg editor_gotofc_01.jpg editor_error_01.jpg editor_error_02.jpg editor_gotomc_03.jpg editor_tab_02.jpg editor_outline_01.jpg editor_gotofc_02.jpg menu.jpg editor_syntax_01.jpg editor_outline_02.jpg editor_gotomc_04.jpg editor_tab_01.jpg Log Message: All pages in the editor user guide have content. I filled in what I knew of parts I didn't work on. --- NEW FILE: editor_error_02.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_tab_02.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_gotomc_02.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_gotofc_03.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: menu.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_gotofc_01.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_gotofc_02.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_gotomc_04.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_tab_01.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_syntax_01.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_gotomc_03.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_outline_01.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_gotomc_01.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_error_01.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: editor_outline_02.jpg --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar T. <at...@us...> - 2004-07-06 17:52:18
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26170/src/org/python/pydev/debug/model Modified Files: PyThread.java Log Message: Simplified bundle path handling after newsgroup discussion Index: PyThread.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyThread.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyThread.java 2 Jul 2004 02:26:00 -0000 1.6 --- PyThread.java 6 Jul 2004 17:52:06 -0000 1.7 *************** *** 199,206 **** || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class) || adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class) ! ) return super.getAdapter(adapter); else { ! System.err.println("PythonThread Need adapter " + adapter.toString()); Platform.getAdapterManager().getAdapter(this, adapter); } --- 199,209 ---- || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class) || adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class) ! || adapter.equals(org.eclipse.ui.IContributorResourceAdapter.class) ! || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class) ! || adapter.equals(org.eclipse.ui.IActionFilter.class) ! ) return super.getAdapter(adapter); else { ! // System.err.println("PythonThread Need adapter " + adapter.toString()); Platform.getAdapterManager().getAdapter(this, adapter); } |
From: Aleksandar T. <at...@us...> - 2004-07-06 17:52:18
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26170/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunnerConfig.java Log Message: Simplified bundle path handling after newsgroup discussion Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PythonRunnerConfig.java 2 Jul 2004 02:26:01 -0000 1.6 --- PythonRunnerConfig.java 6 Jul 2004 17:52:07 -0000 1.7 *************** *** 99,108 **** URL fileURL; try { ! fileURL = Platform.resolve( bundleURL); ! String fixmePath = fileURL.getPath(); // this gets you /D:/eclipse3/workspace/org.python.pydev.debug/pysrc/pydevd.py ! if (fixmePath.charAt(2) == ':') // Windows path, fix remove the front slash ! fixmePath = fixmePath.substring(1); ! IPath fullPath = new Path(fixmePath); ! return fullPath.toOSString(); } catch (IOException e) { throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Can't find python debug script", null)); --- 99,105 ---- URL fileURL; try { ! fileURL = Platform.asLocalURL( bundleURL); ! String filePath = new File(fileURL.getPath()).getAbsolutePath(); ! return filePath; } catch (IOException e) { throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Can't find python debug script", null)); |
From: Aleksandar T. <at...@us...> - 2004-07-02 02:51:17
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18059/src/org/python/pydev/plugin Modified Files: PydevPlugin.java PydevPrefs.java Log Message: 3.0 port Index: PydevPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPlugin.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PydevPlugin.java 7 May 2004 21:49:00 -0000 1.8 --- PydevPlugin.java 2 Jul 2004 02:50:38 -0000 1.9 *************** *** 8,19 **** import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; - import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; - import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Status; ! import org.eclipse.ui.*; import org.eclipse.ui.plugin.AbstractUIPlugin; /** --- 8,25 ---- import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Status; ! import org.eclipse.ui.IEditorDescriptor; ! import org.eclipse.ui.IEditorInput; ! import org.eclipse.ui.IEditorPart; ! import org.eclipse.ui.IEditorRegistry; ! import org.eclipse.ui.IWorkbenchPage; ! import org.eclipse.ui.PartInitException; ! import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; + import org.osgi.framework.BundleContext; + import org.eclipse.ui.ide.IDE; /** *************** *** 32,42 **** * The constructor. */ ! public PydevPlugin(IPluginDescriptor descriptor) { ! super(descriptor); plugin = this; } ! public void startup() throws CoreException { ! super.startup(); try { resourceBundle= ResourceBundle.getBundle("org.python.pydev.PyDevPluginResources"); --- 38,48 ---- * The constructor. */ ! public PydevPlugin() { ! super(); plugin = this; } ! public void start(BundleContext context) throws Exception { ! super.start(context); try { resourceBundle= ResourceBundle.getBundle("org.python.pydev.PyDevPluginResources"); *************** *** 48,55 **** } ! public void shutdown() throws CoreException { Preferences preferences = plugin.getPluginPreferences(); preferences.removePropertyChangeListener(this); ! super.shutdown(); } --- 54,61 ---- } ! public void stop(BundleContext context) throws Exception { Preferences preferences = plugin.getPluginPreferences(); preferences.removePropertyChangeListener(this); ! super.stop(context); } *************** *** 59,63 **** public static String getPluginID() { ! return getDefault().getDescriptor().getUniqueIdentifier(); } --- 65,69 ---- public static String getPluginID() { ! return getDefault().getBundle().getSymbolicName(); } *************** *** 119,123 **** if (file != null && file.exists()) { // File is inside the workspace ! return wp.openEditor(file, null, activate); } else { IStorage storage = new FileStorage(path); --- 125,129 ---- if (file != null && file.exists()) { // File is inside the workspace ! return IDE.openEditor(wp, file, activate); } else { IStorage storage = new FileStorage(path); *************** *** 125,129 **** IEditorDescriptor desc = registry.getDefaultEditor(path.lastSegment()); if (desc == null) ! desc = registry.getDefaultEditor(); IEditorInput input = new ExternalEditorInput(storage); return wp.openEditor(input, desc.getId()); --- 131,135 ---- IEditorDescriptor desc = registry.getDefaultEditor(path.lastSegment()); if (desc == null) ! desc = registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); IEditorInput input = new ExternalEditorInput(storage); return wp.openEditor(input, desc.getId()); Index: PydevPrefs.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPrefs.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PydevPrefs.java 11 Jun 2004 20:03:56 -0000 1.8 --- PydevPrefs.java 2 Jul 2004 02:50:38 -0000 1.9 *************** *** 51,57 **** public static final String HYPERLINK_COLOR = "HYPERLINK_COLOR"; private static final RGB DEFAULT_HYPERLINK_COLOR = new RGB(0, 0, 238); - // TODO Handle changes to block separator string? - // If user changes this, it needs to update all files with that in it, because the - // undo-er replaces that string, not the first and last lines of a comment block public static final String BLOCK_COMMENT = "BLOCK_COMMENT"; public static final String DEFAULT_BLOCK_COMMENT_STRING = "======================================="; --- 51,54 ---- *************** *** 92,97 **** addField(ife); - StringFieldEditor sfe = new StringFieldEditor ( BLOCK_COMMENT, "Block comment separator", p ); - addField(sfe); addField(new ColorFieldEditor( --- 89,92 ---- *************** *** 103,106 **** --- 98,104 ---- addField(new ColorFieldEditor( COMMENT_COLOR, "Comments", p)); + + StringFieldEditor sfe = new StringFieldEditor ( BLOCK_COMMENT, "Block comment separator", p ); + addField(sfe); } *************** *** 113,117 **** prefs.setDefault(GUESS_TAB_SUBSTITUTION, DEFAULT_GUESS_TAB_SUBSTITUTION); prefs.setDefault(TAB_WIDTH, DEFAULT_TAB_WIDTH); - prefs.setDefault(BLOCK_COMMENT, DEFAULT_BLOCK_COMMENT_STRING); prefs.setDefault(CODE_COLOR,StringConverter.asString(DEFAULT_CODE_COLOR)); prefs.setDefault(KEYWORD_COLOR,StringConverter.asString(DEFAULT_KEYWORD_COLOR)); --- 111,114 ---- *************** *** 119,122 **** --- 116,120 ---- prefs.setDefault(COMMENT_COLOR,StringConverter.asString(DEFAULT_COMMENT_COLOR)); prefs.setDefault(HYPERLINK_COLOR, StringConverter.asString(DEFAULT_HYPERLINK_COLOR)); + prefs.setDefault(BLOCK_COMMENT, DEFAULT_BLOCK_COMMENT_STRING); } } |
From: Aleksandar T. <at...@us...> - 2004-07-02 02:51:17
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18059/src/org/python/pydev/parser Modified Files: PyParser.java Log Message: 3.0 port Index: PyParser.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/parser/PyParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PyParser.java 15 Apr 2004 23:19:22 -0000 1.7 --- PyParser.java 2 Jul 2004 02:50:38 -0000 1.8 *************** *** 18,21 **** --- 18,23 ---- import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IFileEditorInput; + import org.python.parser.CharStream; + import org.python.parser.IParserHost; import org.python.parser.ParseException; import org.python.parser.PythonGrammar; *************** *** 161,165 **** StringReader inString = new StringReader(document.get()); ReaderCharStream in = new ReaderCharStream(inString); ! PythonGrammar grammar = new PythonGrammar(in, new CompilerAPI()); IEditorInput input = editorView.getEditorInput(); --- 163,171 ---- StringReader inString = new StringReader(document.get()); ReaderCharStream in = new ReaderCharStream(inString); ! IParserHost host = new CompilerAPI(); ! ! PythonGrammar g1 = new PythonGrammar((CharStream)null, (IParserHost)null); ! ! PythonGrammar grammar = new PythonGrammar(in, host); IEditorInput input = editorView.getEditorInput(); |
From: Aleksandar T. <at...@us...> - 2004-07-02 02:51:17
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18059/src/org/python/pydev/editor Modified Files: Hyperlink.java PyEdit.java PyDocumentProvider.java PyEditConfiguration.java Log Message: 3.0 port Index: PyEditConfiguration.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEditConfiguration.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PyEditConfiguration.java 14 Jun 2004 01:12:30 -0000 1.11 --- PyEditConfiguration.java 2 Jul 2004 02:50:38 -0000 1.12 *************** *** 278,282 **** */ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ! final String PY_SINGLELINE_STRING = "__python_singleline_string"; final String PY_MULTILINE_STRING = "__python_multiline_string"; // create a content assistant: --- 278,284 ---- */ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ! return null; ! /* ! final String PY_SINGLELINE_STRING = "__python_singleline_string"; final String PY_MULTILINE_STRING = "__python_multiline_string"; // create a content assistant: *************** *** 295,299 **** assistant.setProposalSelectorBackground(bgColor); return assistant; ! } --- 297,301 ---- assistant.setProposalSelectorBackground(bgColor); return assistant; ! */ } Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PyEdit.java 14 Jun 2004 12:50:10 -0000 1.16 --- PyEdit.java 2 Jul 2004 02:50:38 -0000 1.17 *************** *** 30,33 **** --- 30,34 ---- import org.eclipse.ui.IStorageEditorInput; import org.eclipse.ui.PartInitException; + import org.eclipse.ui.editors.text.ILocationProvider; import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.texteditor.DefaultRangeIndicator; *************** *** 293,301 **** try { filePath = ((IStorageEditorInput)input).getStorage().getFullPath(); ! filePath = ((IPath)filePath).makeAbsolute(); } catch (CoreException e2) { PydevPlugin.log(IStatus.ERROR, "unexpected error getting path", e2); } ! else PydevPlugin.log(IStatus.ERROR, "unexpected type of editor input " + input.getClass().toString(), null); --- 294,306 ---- try { filePath = ((IStorageEditorInput)input).getStorage().getFullPath(); ! filePath = filePath.makeAbsolute(); } catch (CoreException e2) { PydevPlugin.log(IStatus.ERROR, "unexpected error getting path", e2); } ! else if (input instanceof ILocationProvider) { ! filePath = ((ILocationProvider)input).getPath(input); ! filePath = filePath.makeAbsolute(); ! } ! else PydevPlugin.log(IStatus.ERROR, "unexpected type of editor input " + input.getClass().toString(), null); Index: PyDocumentProvider.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyDocumentProvider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyDocumentProvider.java 12 Mar 2004 00:18:40 -0000 1.3 --- PyDocumentProvider.java 2 Jul 2004 02:50:38 -0000 1.4 *************** *** 7,16 **** --- 7,23 ---- package org.python.pydev.editor; + import java.io.File; + import java.io.FileInputStream; + import java.io.FileNotFoundException; + import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; + import org.eclipse.core.runtime.IPath; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.rules.DefaultPartitioner; + import org.eclipse.ui.IEditorInput; import org.eclipse.ui.editors.text.FileDocumentProvider; + import org.eclipse.ui.editors.text.ILocationProvider; import org.eclipse.ui.part.FileEditorInput; import org.python.pydev.plugin.PythonNature; *************** *** 57,59 **** return partitioner; } ! } \ No newline at end of file --- 64,92 ---- return partitioner; } ! ! ! /** ! * Implementation of Open External File functionality ! */ ! protected boolean setDocumentContent(IDocument document, ! IEditorInput editorInput, String encoding) throws CoreException { ! boolean retVal = super.setDocumentContent(document, editorInput, encoding); ! // Dealing with external files ! if (retVal == false) { ! // for Open External File, we get JavaFile, which we have no access to ! // luckily, this object is also a ILocationProvider ! if (editorInput instanceof ILocationProvider) { ! IPath path = ((ILocationProvider)editorInput).getPath(editorInput); ! path = path.makeAbsolute(); ! File f = path.toFile(); ! try { ! setDocumentContent(document, new FileInputStream(f), encoding); ! } catch (FileNotFoundException e) { ! return false; ! } ! return true; ! } ! } ! return true; ! } ! } Index: Hyperlink.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/Hyperlink.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Hyperlink.java 14 Jun 2004 12:50:10 -0000 1.6 --- Hyperlink.java 2 Jul 2004 02:50:38 -0000 1.7 *************** *** 20,24 **** import org.eclipse.jface.text.ITextInputListener; import org.eclipse.jface.text.ITextViewerExtension2; ! import org.eclipse.jface.text.ITextViewerExtension3; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; --- 20,24 ---- import org.eclipse.jface.text.ITextInputListener; import org.eclipse.jface.text.ITextViewerExtension2; ! import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; *************** *** 237,242 **** // remove underline ! if (viewer instanceof ITextViewerExtension3) { ! ITextViewerExtension3 extension= (ITextViewerExtension3) viewer; offset= extension.modelOffset2WidgetOffset(offset); } else { --- 237,242 ---- // remove underline ! if (viewer instanceof ITextViewerExtension5) { ! ITextViewerExtension5 extension= (ITextViewerExtension5) viewer; offset= extension.modelOffset2WidgetOffset(offset); } else { *************** *** 334,339 **** int widgetOffset= text.getOffsetAtLocation(relativePosition); ! if (viewer instanceof ITextViewerExtension3) { ! ITextViewerExtension3 extension= (ITextViewerExtension3) viewer; return extension.widgetOffset2ModelOffset(widgetOffset); } else { --- 334,339 ---- int widgetOffset= text.getOffsetAtLocation(relativePosition); ! if (viewer instanceof ITextViewerExtension5) { ! ITextViewerExtension5 extension= (ITextViewerExtension5) viewer; return extension.widgetOffset2ModelOffset(widgetOffset); } else { *************** *** 361,366 **** int length= 0; ! if (viewer instanceof ITextViewerExtension3) { ! ITextViewerExtension3 extension= (ITextViewerExtension3) viewer; IRegion widgetRange= extension.modelRange2WidgetRange(region); if (widgetRange == null) --- 361,366 ---- int length= 0; ! if (viewer instanceof ITextViewerExtension5) { ! ITextViewerExtension5 extension= (ITextViewerExtension5) viewer; IRegion widgetRange= extension.modelRange2WidgetRange(region); if (widgetRange == null) *************** *** 634,640 **** int length= 0; ! if (viewer instanceof ITextViewerExtension3) { ! ITextViewerExtension3 extension= (ITextViewerExtension3) viewer; IRegion widgetRange= extension.modelRange2WidgetRange(new Region(offset, length)); if (widgetRange == null) --- 634,640 ---- int length= 0; ! if (viewer instanceof ITextViewerExtension5) { ! ITextViewerExtension5 extension= (ITextViewerExtension5) viewer; IRegion widgetRange= extension.modelRange2WidgetRange(new Region(offset, length)); if (widgetRange == null) |
From: Aleksandar T. <at...@us...> - 2004-07-02 02:51:17
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18059 Modified Files: .project plugin.xml .classpath .cvsignore Log Message: 3.0 port Index: .cvsignore =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 8 Jan 2004 22:43:39 -0000 1.2 --- .cvsignore 2 Jul 2004 02:50:37 -0000 1.3 *************** *** 3,4 **** --- 3,5 ---- pydev.jar bin + build.xml Index: .project =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/.project,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** .project 21 Jun 2004 21:36:29 -0000 1.4 --- .project 2 Jul 2004 02:50:37 -0000 1.5 *************** *** 4,12 **** <comment></comment> <projects> - <project>org.eclipse.core.resources</project> - <project>org.eclipse.jdt.ui</project> - <project>org.eclipse.ui</project> - <project>org.eclipse.ui.views</project> - <project>org.pydev.jython</project> </projects> <buildSpec> --- 4,7 ---- Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** plugin.xml 21 Jun 2004 21:36:29 -0000 1.19 --- plugin.xml 2 Jul 2004 02:50:37 -0000 1.20 *************** *** 1,7 **** <?xml version="1.0" encoding="UTF-8"?> <plugin id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.4.2" provider-name="AleksTotic" class="org.python.pydev.plugin.PydevPlugin"> --- 1,8 ---- <?xml version="1.0" encoding="UTF-8"?> + <?eclipse version="3.0"?> <plugin id="org.python.pydev" name="Pydev - Python Development Environment" ! version="0.5" provider-name="AleksTotic" class="org.python.pydev.plugin.PydevPlugin"> *************** *** 18,25 **** <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"/> - <import plugin="org.eclipse.jdt.ui"/> - <import plugin="org.pydev.jython"/> </requires> --- 19,25 ---- <import plugin="org.eclipse.ui.editors"/> <import plugin="org.eclipse.ui.views"/> + <import plugin="org.eclipse.ui.ide"/> <import plugin="org.eclipse.ui.workbench.texteditor"/> <import plugin="org.eclipse.jface.text"/> </requires> *************** *** 49,53 **** </extension> <extension ! point="org.eclipse.ui.projectNatureImages"> <image icon="icons/pythonNature.gif" --- 49,53 ---- </extension> <extension ! point="org.eclipse.ui.ide.projectNatureImages"> <image icon="icons/pythonNature.gif" *************** *** 448,452 **** <!-- filter out .pyc files in the navigation view --> <extension ! point="org.eclipse.ui.resourceFilters"> <filter selected="True" --- 448,452 ---- <!-- filter out .pyc files in the navigation view --> <extension ! point="org.eclipse.ui.ide.resourceFilters"> <filter selected="True" Index: .classpath =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/.classpath,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** .classpath 21 Jun 2004 21:36:29 -0000 1.7 --- .classpath 2 Jul 2004 02:50:37 -0000 1.8 *************** *** 1,8 **** <?xml version="1.0" encoding="UTF-8"?> <classpath> ! <classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/> ! <classpathentry kind="src" path="src/"/> ! <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> ! <classpathentry kind="lib" path="C:/eclipse2.1.3/plugins/org.junit_3.8.1/junit.jar"/> ! <classpathentry kind="output" path="bin"/> </classpath> --- 1,7 ---- <?xml version="1.0" encoding="UTF-8"?> <classpath> ! <classpathentry excluding="org/python/pydev/editor/PythonCompletionProcessor.java" 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"/> </classpath> |
From: Aleksandar T. <at...@us...> - 2004-07-02 02:50:59
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18059/src/org/python/pydev/outline Modified Files: PyOutlinePage.java Log Message: 3.0 port Index: PyOutlinePage.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/outline/PyOutlinePage.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyOutlinePage.java 7 May 2004 02:07:20 -0000 1.8 --- PyOutlinePage.java 2 Jul 2004 02:50:39 -0000 1.9 *************** *** 7,11 **** --- 7,14 ---- import java.net.MalformedURLException; + import java.net.URL; + import org.eclipse.core.runtime.Path; + import org.eclipse.core.runtime.Platform; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; *************** *** 24,27 **** --- 27,31 ---- import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.views.contentoutline.ContentOutlinePage; + import org.osgi.framework.Bundle; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.model.AbstractNode; *************** *** 60,64 **** super(); this.editorView = editorView; ! imageCache = new ImageCache(PydevPlugin.getDefault().getDescriptor().getInstallURL()); } --- 64,70 ---- super(); this.editorView = editorView; ! Bundle bundle = PydevPlugin.getDefault().getBundle(); ! URL bundleURL = Platform.find( bundle, new Path("/")); ! imageCache = new ImageCache(PydevPlugin.getDefault().getBundle().getEntry("/")); } |
From: Aleksandar T. <at...@us...> - 2004-07-02 02:50:46
|
Update of /cvsroot/pydev/org.python.pydev/doc/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18059/doc/test Added Files: PyConvertTabToSpaceTest.java PyAddBlockCommentTest.java AllTests.java PyStripTrailingWhitespaceTest.java PyConvertSpaceToTabTest.java PyUncommentTest.java PyRemoveBlockCommentTest.java PyCommentTest.java Log Message: 3.0 port --- NEW FILE: PyConvertTabToSpaceTest.java --- /* * Created on Jun 21, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.actions.PyConvertTabToSpace; import org.python.pydev.editor.actions.PySelection; import org.python.pydev.editor.actions.PyStripTrailingWhitespace; import junit.framework.TestCase; /** * @author Dreamer * * Tests the 'Convert Tab to Space' editor feature. It performs 3 checks. * * The first fakes a selection of a couple lines in a fake document, and checks * to see that the proper tabs are converted to spaces. * * The second fakes a selection but stops in the middle of a line, to make sure that the * whole line is considered. * * The third selects nothing, and makes sure that the whole document is affected by * the conversion. */ public class PyConvertTabToSpaceTest extends TestCase { /* The document that will fake an editor environment */ IDocument document; /* Lines of 'code' in the fake document */ String [] documentLines; /* For my own debugging edification, to output the name later */ static final String TestFileName = "PyConvertTabToSpaceTest"; /** * Constructor for PyConvertTabToSpaceTest. * @param arg0 */ public PyConvertTabToSpaceTest(String arg0) { super(arg0); } /* * Sets up the document 'code' and adds it to the document. * * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); int i = -1; int length = 7; documentLines = new String[length]; // The X will be used to interchange tabs/spaces documentLines[++i] = "def bar ( self ):"; documentLines[++i] = "X" + "print \"foo1\"X "; documentLines[++i] = "X" + "print \"bar1\""; documentLines[++i] = "X "; documentLines[++i] = "def foo ( self ):X"; documentLines[++i] = "X" + "print \"foo2\"X "; documentLines[++i] = "X" + "print \"bar2\" "; StringBuffer doc = new StringBuffer ( ); for ( i = 0; i < documentLines.length; i++ ) { doc.append ( documentLines[i] + ( i < documentLines.length - 1 ? "\n" : "" ) ); } document = new Document ( doc.toString ( ) ); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /* * Just for this and the vice versa case, to make things easier * * @return String Space string */ public String from ( ) { return "\t"; } /* * Just for this and the vice versa case, to make things easier * * @return String Tab string */ public String to ( ) { return PyConvertTabToSpace.getTabSpace ( ); } /* * Just to shorten the lines in the later tests, this calls the action's get tab width * function * * @return int Tab width */ public int getTabWidth ( ) { return PyConvertTabToSpace.getTabWidth ( ); } /* * Just to shorten the lines in the later tests, this calls the action's trim function * * @param in Line of 'code' to be stripped * @return String Stripped 'code' line */ public String callTrim ( String in ) { return PyStripTrailingWhitespace.trimTrailingWhitespace ( in ); } /* * Checks multiple-line selection. */ public void testPerform1 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def String [] strArr = document.get ( ).replaceAll ( "X", from ( ) ).split ( "\n" ); int len = 0; len += strArr[++i].length ( ) + 1; // "def bar ( self ):\n" len += strArr[++i].length ( ) + 1; // "\tprint \"foo1\"\t \n" len += strArr[++i].length ( ) + 1; // "\tprint \"bar1\"\n" len += strArr[++i].length ( ) + 1; // "\n \n" startLineIndex = i + 1; selBegin = len; len += strArr[++i].length ( ) + 1; // "def foo ( self ): len += strArr[++i].length ( ) + 1; // "\tprint \"foo2\"\t \n" len += strArr[++i].length ( ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = len - selBegin; // Create result document i = -1; result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) ); // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data document.set ( document.get ( ).replaceAll ( "X", from ( ) ) ); long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyConvertTabToSpace.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform1: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform2 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def String [] strArr = document.get ( ).replaceAll ( "X", from ( ) ).split ( "\n" ); int len = 0; len += strArr[++i].length ( ) + 1; // "def bar ( self ):\n" len += strArr[++i].length ( ) + 1; // "\tprint \"foo1\"\t \n" len += strArr[++i].length ( ) + 1; // "\tprint \"bar1\"\n" len += strArr[++i].length ( ) + 1; // "\n \n" startLineIndex = i + 1; selBegin = len; len += strArr[++i].length ( ) + 1; // "def foo ( self ): len += strArr[++i].length ( ) + 1; // "\tprint \"foo2\"\t \n" len += strArr[++i].length ( ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = len - selBegin - 6; // Create result document i = -1; result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) ); // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data document.set ( document.get ( ).replaceAll ( "X", from ( ) ) ); long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyConvertTabToSpace.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform2: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks empty selection to affect cursor line. */ public void testPerform3 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def startLineIndex = endLineIndex = 1; selBegin = 1; selLength = 0; // Our expected result IDocument resultDoc = new Document ( document.get ( ).toString ( ).replaceAll ( "X", to ( ) ) ); // For timing data document.set ( document.get ( ).replaceAll ( "X", from ( ) ) ); long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyConvertTabToSpace.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform3: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } } --- NEW FILE: PyStripTrailingWhitespaceTest.java --- /* * Created on Jun 16, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.actions.PySelection; import org.python.pydev.editor.actions.PyStripTrailingWhitespace; import junit.framework.TestCase; /** * @author Dreamer * * Tests the 'Strip Trailing Whitespace' editor feature. It performs 4 checks. * * The first checks to see if the simple String-input 'trim' feature works properly. * * The other 3 are code-based checks. * * The first fakes a selection of a couple lines in a fake document, and checks * to see that the proper whitespace is removed. * * The second fakes a selection but stops in the * middle of a line, to make sure that the Whitespace handler doesn't just strip whitespace from * the partial selection unless that line has whitespace to be stripped. * * The third selects * nothing, and makes sure that the whole document is affected by whitespace stripping. */ public class PyStripTrailingWhitespaceTest extends TestCase { /* The document that will fake an editor environment */ IDocument document; /* Lines of 'code' in the fake document */ String [] documentLines; /* For my own debugging edification, to output the name later */ static final String TestFileName = "PyStripTrailingWhitespaceTest"; /** * Constructor for PyStripTrailingWhitespaceTest. * @param arg0 */ public PyStripTrailingWhitespaceTest(String arg0) { super(arg0); } /* * Sets up the document 'code' and adds it to the document. * * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); int i = -1; int length = 7; documentLines = new String[length]; documentLines[++i] = "def bar ( self ):"; documentLines[++i] = "\tprint \"foo1\"\t "; documentLines[++i] = "\tprint \"bar1\""; documentLines[++i] = "\t "; documentLines[++i] = "def foo ( self ): "; documentLines[++i] = "\tprint \"foo2\"\t "; documentLines[++i] = "\tprint \"bar2\" "; StringBuffer doc = new StringBuffer ( ); for ( i = 0; i < documentLines.length; i++ ) { doc.append ( documentLines[i] + ( i < documentLines.length - 1 ? "\n" : "" ) ); } document = new Document ( doc.toString ( ) ); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /* * Just to shorten the lines in the later tests, this calls the action's trim function * * @param in Line of 'code' to be stripped * @return String Stripped 'code' line */ public String callTrim ( String in ) { return PyStripTrailingWhitespace.trimTrailingWhitespace ( in ); } /* * Checks single-line trimming. */ public void testTrimTrailingWhitespace ( ) { // Preserves everything but last whitespace assertEquals ( "\tprint \"foo\"", callTrim ( "\tprint \"foo\"\t" ) ); // Ditto, without tab in front assertEquals ( "print \"foo\"", callTrim ( "print \"foo\" \t" ) ); // Full line blank assertEquals ( "", callTrim ( "\t \t" ) ); // Null input assertEquals ( "", callTrim ( null ) ); } /* * Checks multiple-line selection. */ public void testPerform1 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "def foo ( self ): \n" result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( callTrim ( documentLines[++i] ) ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyStripTrailingWhitespace.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform1: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform2 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' part of the last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "def foo ( self ): \n" result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( documentLines[++i] ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin - 6; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyStripTrailingWhitespace.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform2: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks empty selection to affect cursor line. */ public void testPerform3 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' nothing, which should call action on the whole thing result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "def bar ( self ):\n" result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "\tprint \"bar1\"\n" result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "\n \n" result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "def foo ( self ): \n" result.append ( callTrim ( documentLines[++i] ) + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( callTrim ( documentLines[++i] ) ); // "\tprint \"bar2\" \n" endLineIndex = i; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyStripTrailingWhitespace.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform3: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } } --- NEW FILE: PyCommentTest.java --- /* * Created on Jun 17, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.actions.PyComment; import org.python.pydev.editor.actions.PySelection; import junit.framework.TestCase; /** * @author Dreamer * * Tests the 'Comment' editor feature. It performs 3 checks. * * The first fakes a selection of a couple lines in a fake document, and checks to see that the * code is properly commented. * * The second fakes a selection but stops in the middle of a line, to make sure that the proper * lines are commented, including the beginning of partial lines. * * The third selects nothing, and makes sure that the only line affected is the one the cursor * is on. */ public class PyCommentTest extends TestCase { /* The document that will fake an editor environment */ IDocument document; /* Lines of 'code' in the fake document */ String [] documentLines; /* For my own debugging edification, to output the name later */ static final String TestFileName = "PyCommentTest"; /** * Constructor for PyCommentTest. * @param arg0 */ public PyCommentTest(String arg0) { super(arg0); } /* * Sets up the document 'code' and adds it to the document. * * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); int i = -1; int length = 7; documentLines = new String[length]; documentLines[++i] = "def bar ( self ):"; documentLines[++i] = "\tprint \"foo1\"\t "; documentLines[++i] = "\tprint \"bar1\""; documentLines[++i] = "\t "; documentLines[++i] = "def foo ( self ): "; documentLines[++i] = "\tprint \"foo2\"\t "; documentLines[++i] = "\tprint \"bar2\" "; StringBuffer doc = new StringBuffer ( ); for ( i = 0; i < documentLines.length; i++ ) { doc.append ( documentLines[i] + ( i < documentLines.length - 1 ? "\n" : "" ) ); } document = new Document ( doc.toString ( ) ); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /* * Just to shorten the lines in the later tests, this calls the action's comment function * * @param in Line of 'code' to be commented * @return String Commented 'code' line */ public boolean callComment ( PySelection ps ) { return PyComment.perform ( ps ); } /* * Checks multiple-line selection. */ public void testPerform1 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, false ); PyComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform1: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform2 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' part of the last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin - 6; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, false ); PyComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform2: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks empty selection to affect cursor line. */ public void testPerform3 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' in middle of one line, show that it blocks that whole line only result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" result.append ( documentLines[++i] + "\n" ); // "def foo ( self ): \n" selBegin = result.toString ( ).length ( ) + 5; result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" startLineIndex = i; endLineIndex = startLineIndex; result.append ( documentLines[++i] ); // "\tprint \"bar2\" \n" // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, false ); PyComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform3: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } } --- NEW FILE: PyRemoveBlockCommentTest.java --- /* * Created on Jun 17, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.actions.PyAddBlockComment; import org.python.pydev.editor.actions.PyRemoveBlockComment; import org.python.pydev.editor.actions.PySelection; import junit.framework.TestCase; /** * @author Dreamer * * Tests the 'Remove Block Comment' editor feature. It performs 3 checks. * * The first fakes a selection of a couple lines in a fake document, and checks to see that the * code is properly un-commented. * * The second fakes a selection but stops in the middle of a line, to make sure that the proper * lines are un-commented, including the beginning of partial lines. * * The third selects nothing, and makes sure that the no lines are otherwise affected. * TODO Maybe in the future, selecting anything within a comment block and calling the action will remove the entire surrounding block comment */ public class PyRemoveBlockCommentTest extends TestCase { /* The document that will fake an editor environment */ IDocument document; /* Lines of 'code' in the fake document */ String [] documentLines; /* For my own debugging edification, to output the name later */ static final String TestFileName = "PyRemoveBlockCommentTest"; /** * Constructor for PyAddBlockCommentTest. * @param arg0 */ public PyRemoveBlockCommentTest(String arg0) { super(arg0); } /* * Sets up the document 'code' and adds it to the document. * * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); int i = -1; int length = 7; documentLines = new String[length]; documentLines[++i] = "def bar ( self ):"; documentLines[++i] = "\tprint \"foo1\"\t "; documentLines[++i] = "\tprint \"bar1\""; documentLines[++i] = "\t "; documentLines[++i] = "def foo ( self ): "; documentLines[++i] = "\tprint \"foo2\"\t "; documentLines[++i] = "\tprint \"bar2\" "; StringBuffer doc = new StringBuffer ( ); for ( i = 0; i < documentLines.length; i++ ) { doc.append ( documentLines[i] + ( i < documentLines.length - 1 ? "\n" : "" ) ); } document = new Document ( doc.toString ( ) ); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /* * Just to shorten the lines in the later tests, this calls the action's get comment line * function * * @return String Comment line */ public String getFullCommentLine ( ) { return PyAddBlockComment.getFullCommentLine ( ); } /* * Just to shorten the lines in the later tests, this calls the action's comment function * * @param in Line of 'code' to be commented * @return String Commented 'code' line */ public boolean callComment ( PySelection ps ) { return PyRemoveBlockComment.perform ( ps ); } /* * Checks multiple-line selection. */ public void testPerform1 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"bar2\" \n" result.append ( "#" + getFullCommentLine ( ) ); endLineIndex = i + 2; selLength = result.toString ( ).length ( ) - selBegin; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( resultDoc, startLineIndex, endLineIndex, selLength, false ); PyRemoveBlockComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform1: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform2 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' part of the last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"bar2\" \n" result.append ( "#" + getFullCommentLine ( ) ); endLineIndex = i + 2; selLength = result.toString ( ).length ( ) - selBegin - 6; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( resultDoc, startLineIndex, endLineIndex, selLength, false ); PyRemoveBlockComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform2: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform3 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' in middle of one line, show that it blocks that whole line result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" result.append ( documentLines[++i] + "\n" ); // "def foo ( self ): \n" selBegin = result.toString ( ).length ( ) + 5; result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" startLineIndex = i + 1; endLineIndex = startLineIndex; result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( documentLines[++i] ); // "\tprint \"bar2\" \n" // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( resultDoc, startLineIndex, endLineIndex, selLength, false ); PyRemoveBlockComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform3: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( result.toString ( ), resultDoc.get ( ) ); } } --- NEW FILE: AllTests.java --- /* * Created on Jun 17, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import junit.framework.Test; import junit.framework.TestSuite; /** * @author Dreamer * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class AllTests { public static String TestFileName = "Editor.Actions"; public static Test suite() { TestSuite suite = new TestSuite("Test for org.python.pydev.editor.actions"); //$JUnit-BEGIN$ suite.addTest(new TestSuite(PyCommentTest.class)); suite.addTest(new TestSuite(PyUncommentTest.class)); suite.addTest(new TestSuite(PyAddBlockCommentTest.class)); suite.addTest(new TestSuite(PyRemoveBlockCommentTest.class)); suite.addTest(new TestSuite(PyStripTrailingWhitespaceTest.class)); suite.addTest(new TestSuite(PyConvertSpaceToTabTest.class)); suite.addTest(new TestSuite(PyConvertTabToSpaceTest.class)); //$JUnit-END$ System.out.println ( "Running Test Suite '" + TestFileName + "'..." ); return suite; } } --- NEW FILE: PyUncommentTest.java --- /* * Created on Jun 17, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.actions.PySelection; import org.python.pydev.editor.actions.PyUncomment; import junit.framework.TestCase; /** * @author Dreamer * * Tests the 'Uncomment' editor feature. It performs 3 checks. * * The first fakes a selection of a couple lines in a fake document, and checks to see that the * code is properly un-commented. * * The second fakes a selection but stops in the middle of a line, to make sure that the proper * lines are un-commented, including the beginning of partial lines. * * The third selects nothing, and makes sure that the only line affected is the one the cursor * is on. */ public class PyUncommentTest extends TestCase { /* The document that will fake an editor environment */ IDocument document; /* Lines of 'code' in the fake document */ String [] documentLines; /* For my own debugging edification, to output the name later */ static final String TestFileName = "PyUncommentTest"; /** * Constructor for PyUncommentTest. * @param arg0 */ public PyUncommentTest(String arg0) { super(arg0); } /* * Sets up the document 'code' and adds it to the document. * * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); int i = -1; int length = 7; documentLines = new String[length]; documentLines[++i] = "def bar ( self ):"; documentLines[++i] = "\tprint \"foo1\"\t "; documentLines[++i] = "\tprint \"bar1\""; documentLines[++i] = "\t "; documentLines[++i] = "def foo ( self ): "; documentLines[++i] = "\tprint \"foo2\"\t "; documentLines[++i] = "\tprint \"bar2\" "; StringBuffer doc = new StringBuffer ( ); for ( i = 0; i < documentLines.length; i++ ) { doc.append ( documentLines[i] + ( i < documentLines.length - 1 ? "\n" : "" ) ); } document = new Document ( doc.toString ( ) ); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /* * Just to shorten the lines in the later tests, this calls the action's uncomment function * * @param in Line of 'code' to be commented * @return String Commented 'code' line */ public boolean callComment ( PySelection ps ) { return PyUncomment.perform ( ps ); } /* * Checks multiple-line selection. */ public void testPerform1 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( resultDoc, startLineIndex, endLineIndex, selLength, false ); PyUncomment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform1: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform2 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' part of the last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin - 6; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( resultDoc, startLineIndex, endLineIndex, selLength, false ); PyUncomment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform2: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks empty selection to affect cursor line. */ public void testPerform3 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' in middle of one line, show that it blocks that whole line only result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" result.append ( documentLines[++i] + "\n" ); // "def foo ( self ): \n" selBegin = result.toString ( ).length ( ) + 5; result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" startLineIndex = i; endLineIndex = startLineIndex; result.append ( documentLines[++i] ); // "\tprint \"bar2\" \n" // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( resultDoc, startLineIndex, endLineIndex, selLength, false ); PyUncomment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform3: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } } --- NEW FILE: PyAddBlockCommentTest.java --- /* * Created on Jun 17, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.actions.PyAddBlockComment; import org.python.pydev.editor.actions.PySelection; import junit.framework.TestCase; /** * @author Dreamer * * Tests the 'Block Comment' editor feature. It performs 3 checks. * * The first fakes a selection of a couple lines in a fake document, and checks to see that the * code is properly commented. * * The second fakes a selection but stops in the middle of a line, to make sure that the proper * lines are commented, including the beginning of partial lines. * * The third selects nothing, and makes sure that the only line affected is the one the cursor * is on. */ public class PyAddBlockCommentTest extends TestCase { /* The document that will fake an editor environment */ IDocument document; /* Lines of 'code' in the fake document */ String [] documentLines; /* For my own debugging edification, to output the name later */ static final String TestFileName = "PyAddBlockCommentTest"; /** * Constructor for PyAddBlockCommentTest. * @param arg0 */ public PyAddBlockCommentTest(String arg0) { super(arg0); } /* * Sets up the document 'code' and adds it to the document. * * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); int i = -1; int length = 7; documentLines = new String[length]; documentLines[++i] = "def bar ( self ):"; documentLines[++i] = "\tprint \"foo1\"\t "; documentLines[++i] = "\tprint \"bar1\""; documentLines[++i] = "\t "; documentLines[++i] = "def foo ( self ): "; documentLines[++i] = "\tprint \"foo2\"\t "; documentLines[++i] = "\tprint \"bar2\" "; StringBuffer doc = new StringBuffer ( ); for ( i = 0; i < documentLines.length; i++ ) { doc.append ( documentLines[i] + ( i < documentLines.length - 1 ? "\n" : "" ) ); } document = new Document ( doc.toString ( ) ); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /* * Just to shorten the lines in the later tests, this calls the action's get comment line * function * * @return String Comment line */ public String getFullCommentLine ( ) { return PyAddBlockComment.getFullCommentLine ( ); } /* * Just to shorten the lines in the later tests, this calls the action's comment function * * @param in Line of 'code' to be commented * @return String Commented 'code' line */ public boolean callComment ( PySelection ps ) { return PyAddBlockComment.perform ( ps ); } /* * Checks multiple-line selection. */ public void testPerform1 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"bar2\" \n" result.append ( "#" + getFullCommentLine ( ) ); endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, false ); PyAddBlockComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform1: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform2 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' part of the last def result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" startLineIndex = i + 1; selBegin = result.toString ( ).length ( ); result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( "#" + documentLines[++i] + "\n" ); // "def foo ( self ): \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"bar2\" \n" result.append ( "#" + getFullCommentLine ( ) ); endLineIndex = i; selLength = document.get ( ).length ( ) - selBegin - 6; // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, false ); PyAddBlockComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform2: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform3 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' in middle of one line, show that it blocks that whole line result.append ( documentLines[++i] + "\n" ); // "def bar ( self ):\n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"foo1\"\t \n" result.append ( documentLines[++i] + "\n" ); // "\tprint \"bar1\"\n" result.append ( documentLines[++i] + "\n" ); // "\n \n" result.append ( documentLines[++i] + "\n" ); // "def foo ( self ): \n" selBegin = result.toString ( ).length ( ) + 5; result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( "#" + documentLines[++i] + "\n" ); // "\tprint \"foo2\"\t \n" startLineIndex = i; endLineIndex = startLineIndex; result.append ( "#" + getFullCommentLine ( ) + "\n" ); result.append ( documentLines[++i] ); // "\tprint \"bar2\" \n" // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, false ); PyAddBlockComment.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform3: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } } --- NEW FILE: PyConvertSpaceToTabTest.java --- /* * Created on Jun 21, 2004 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.python.pydev.editor.actions.PyConvertSpaceToTab; import org.python.pydev.editor.actions.PySelection; import org.python.pydev.editor.actions.PyStripTrailingWhitespace; import junit.framework.TestCase; /** * @author Dreamer * * Tests the 'Convert Space To Tab' editor feature. It performs 3 checks. * * The first fakes a selection of a couple lines in a fake document, and checks * to see that the proper spaces are converted to tabs. * * The second fakes a selection but stops in the middle of a line, to make sure that the * whole line is considered. * * The third selects nothing, and makes sure that the whole document is affected by * the conversion. */ public class PyConvertSpaceToTabTest extends TestCase { /* The document that will fake an editor environment */ IDocument document; /* Lines of 'code' in the fake document */ String [] documentLines; /* For my own debugging edification, to output the name later */ static final String TestFileName = "PyConvertSpaceToTabTest"; /** * Constructor for PyConvertSpaceToTabTest. * @param arg0 */ public PyConvertSpaceToTabTest(String arg0) { super(arg0); } /* * Sets up the document 'code' and adds it to the document. * * @see TestCase#setUp() */ protected void setUp() throws Exception { super.setUp(); int i = -1; int length = 7; documentLines = new String[length]; // The X will be used to interchange tabs/spaces documentLines[++i] = "def bar ( self ):"; documentLines[++i] = "X" + "print \"foo1\"X "; documentLines[++i] = "X" + "print \"bar1\""; documentLines[++i] = "X "; documentLines[++i] = "def foo ( self ):X"; documentLines[++i] = "X" + "print \"foo2\"X "; documentLines[++i] = "X" + "print \"bar2\" "; StringBuffer doc = new StringBuffer ( ); for ( i = 0; i < documentLines.length; i++ ) { doc.append ( documentLines[i] + ( i < documentLines.length - 1 ? "\n" : "" ) ); } document = new Document ( doc.toString ( ) ); } /* * @see TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); } /* * Just for this and the vice versa case, to make things easier * * @return String Space string */ public String from ( ) { return PyConvertSpaceToTab.getTabSpace ( ); } /* * Just for this and the vice versa case, to make things easier * * @return String Tab string */ public String to ( ) { return "\t"; } /* * Just to shorten the lines in the later tests, this calls the action's get tab width * function * * @return int Tab width */ public int getTabWidth ( ) { return PyConvertSpaceToTab.getTabWidth ( ); } /* * Just to shorten the lines in the later tests, this calls the action's trim function * * @param in Line of 'code' to be stripped * @return String Stripped 'code' line */ public String callTrim ( String in ) { return PyStripTrailingWhitespace.trimTrailingWhitespace ( in ); } /* * Checks multiple-line selection. */ public void testPerform1 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def String [] strArr = document.get ( ).replaceAll ( "X", from ( ) ).split ( "\n" ); int len = 0; len += strArr[++i].length ( ) + 1; // "def bar ( self ):\n" len += strArr[++i].length ( ) + 1; // "\tprint \"foo1\"\t \n" len += strArr[++i].length ( ) + 1; // "\tprint \"bar1\"\n" len += strArr[++i].length ( ) + 1; // "\n \n" startLineIndex = i + 1; selBegin = len; len += strArr[++i].length ( ) + 1; // "def foo ( self ): len += strArr[++i].length ( ) + 1; // "\tprint \"foo2\"\t \n" len += strArr[++i].length ( ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = len - selBegin; // Create result document i = -1; result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) ); // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data document.set ( document.get ( ).replaceAll ( "X", from ( ) ) ); long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyConvertSpaceToTab.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform1: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks multiple-line selection with the last line partially selected. */ public void testPerform2 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def String [] strArr = document.get ( ).replaceAll ( "X", from ( ) ).split ( "\n" ); int len = 0; len += strArr[++i].length ( ) + 1; // "def bar ( self ):\n" len += strArr[++i].length ( ) + 1; // "\tprint \"foo1\"\t \n" len += strArr[++i].length ( ) + 1; // "\tprint \"bar1\"\n" len += strArr[++i].length ( ) + 1; // "\n \n" startLineIndex = i + 1; selBegin = len; len += strArr[++i].length ( ) + 1; // "def foo ( self ): len += strArr[++i].length ( ) + 1; // "\tprint \"foo2\"\t \n" len += strArr[++i].length ( ); // "\tprint \"bar2\" \n" endLineIndex = i; selLength = len - selBegin - 6; // Create result document i = -1; result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", from ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) + "\n" ); result.append ( documentLines[++i].replaceAll ( "X", to ( ) ) ); // Our expected result IDocument resultDoc = new Document ( result.toString ( ) ); // For timing data document.set ( document.get ( ).replaceAll ( "X", from ( ) ) ); long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyConvertSpaceToTab.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform2: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } /* * Checks empty selection to affect cursor line. */ public void testPerform3 ( ) { StringBuffer result = new StringBuffer ( ); int i = -1; int startLineIndex = 0; int endLineIndex = 0; int selBegin = 0; int selLength = 0; // 'Select' the entire last def startLineIndex = endLineIndex = 1; selBegin = 1; selLength = 0; // Our expected result IDocument resultDoc = new Document ( document.get ( ).toString ( ).replaceAll ( "X", to ( ) ) ); // For timing data document.set ( document.get ( ).replaceAll ( "X", from ( ) ) ); long begin = System.currentTimeMillis ( ); PySelection ps = new PySelection ( document, startLineIndex, endLineIndex, selLength, true ); PyConvertSpaceToTab.perform ( ps ); long end = System.currentTimeMillis ( ); // Timing result System.err.print ( TestFileName + " :: " ); System.err.println ( "testPerform3: " + ( end - begin ) + "ms" ); // Document affected properly? assertEquals ( document.get ( ), resultDoc.get ( ) ); } } |