You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: Christopher W. <caw...@us...> - 2006-05-12 21:56:16
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3940/src/org/rubypeople/rdt/internal/ui/text Modified Files: TS_InternalUiText.java Added Files: RubyPartitionScannerTest.java Log Message: try to fix up the tests to compile (though they're still broken), add more tests for our partition scanner (needs to be integrated with our already existing tests) Index: TS_InternalUiText.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TS_InternalUiText.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TS_InternalUiText.java 16 Oct 2005 23:52:40 -0000 1.1 --- TS_InternalUiText.java 12 May 2006 21:56:13 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- TestSuite suite = new TestSuite("org.rubypeople.rdt.internal.ui.text"); suite.addTestSuite(TC_RubyPartitionScanner.class); + suite.addTestSuite(RubyPartitionScannerTest.class); return suite; } --- NEW FILE: RubyPartitionScannerTest.java --- package org.rubypeople.rdt.internal.ui.text; import junit.framework.TestCase; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; // FIXME Integrate this with already existing PartitionScanner tests public class RubyPartitionScannerTest extends TestCase { private RubyPartitionScanner scanner; protected void setUp() throws Exception { super.setUp(); scanner = new RubyPartitionScanner(); } private void setDocument(String text) { IDocument document = new Document(text); scanner.setRange(document, 0, document.getLength()); } public void testSingleLineComment() { setDocument("# comment"); assertEquals(IRubyPartitions.RUBY_SINGLE_LINE_COMMENT, scanner .nextToken().getData()); } public void testMultiLineComment() { setDocument("=begin\nSome comment text\n=end\n"); assertEquals(IRubyPartitions.RUBY_MULTI_LINE_COMMENT, scanner .nextToken().getData()); } public void testMultiLineCommentMustStartAtFirstColumn() { setDocument(" =begin\nSome comment text\n=end\n"); assertFalse(IRubyPartitions.RUBY_MULTI_LINE_COMMENT.equals(scanner .nextToken().getData())); assertNull(scanner.nextToken().getData()); } public void testPoundCharacterIsntAComment() { setDocument("?#"); assertNull(scanner.nextToken().getData()); } public void testDoubleQuotedString() { setDocument("\"double quoted string\""); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); } public void testSingleQuotedString() { setDocument("'single quoted string'"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); } public void testCommand() { setDocument("`command`"); assertEquals(IRubyPartitions.RUBY_COMMAND, scanner.nextToken() .getData()); assertTrue(scanner.nextToken().isEOF()); } public void testRegularExpression() { setDocument("/regex/"); assertEquals(IRubyPartitions.RUBY_REGEX, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); } public void testRegularExpressionWithPercentSyntax() { setDocument("%r(regex)"); assertEquals(IRubyPartitions.RUBY_REGEX, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); setDocument("%r!regex!"); assertEquals(IRubyPartitions.RUBY_REGEX, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); setDocument("%r{regex}"); assertEquals(IRubyPartitions.RUBY_REGEX, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); } public void testCommandWithPercentSyntax() { setDocument("%x(command)"); assertEquals(IRubyPartitions.RUBY_COMMAND, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); setDocument("%x!command!"); assertEquals(IRubyPartitions.RUBY_COMMAND, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); setDocument("%x{command}"); assertEquals(IRubyPartitions.RUBY_COMMAND, scanner.nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); } public void testStringWithPercentSyntax() { setDocument("%q(command) # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%q!command! # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%q{command} # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%Q(command) # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%Q!command! # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%Q[command] # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%/command/ # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%!command! # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); setDocument("%[command] # Comment"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertCommentFollows(); } private void assertCommentFollows() { assertNull(scanner.nextToken().getData()); assertEquals(IRubyPartitions.RUBY_SINGLE_LINE_COMMENT, scanner .nextToken().getData()); assertTrue(scanner.nextToken().isEOF()); } public void testRegularExpressionClosesProperly() { setDocument("/regex/ # Comment"); assertEquals(IRubyPartitions.RUBY_REGEX, scanner.nextToken().getData()); assertCommentFollows(); } public void testRegularExpressionWithOptions() { setDocument("/regex/i"); assertEquals(IRubyPartitions.RUBY_REGEX, scanner.nextToken().getData()); assertTrue("Failed to gobble up option/flag as part of regular expression",scanner.nextToken().isEOF()); setDocument("/regex/i # Comment"); assertEquals(IRubyPartitions.RUBY_REGEX, scanner.nextToken().getData()); assertNull(scanner.nextToken().getData()); assertEquals(IRubyPartitions.RUBY_SINGLE_LINE_COMMENT, scanner .nextToken().getData()); } public void testStringWithEscapedEndChar() { setDocument("%q(ain\\)# blah)"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertTrue("failed to skip escaped end character", scanner.nextToken().isEOF()); setDocument("%(ain\\)# blah)"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertTrue("failed to skip escaped end character", scanner.nextToken().isEOF()); setDocument("%Q(ain\\)# blah)"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertTrue("failed to skip escaped end character", scanner.nextToken().isEOF()); } public void testExpressionSubstitution() { setDocument("%{There are #{count} monkeys}"); assertEquals(IRubyPartitions.RUBY_STRING, scanner.nextToken().getData()); assertTrue("failed to gobble up expression substiution", scanner.nextToken().isEOF()); } } |
|
From: Christopher W. <caw...@us...> - 2006-05-12 21:39:39
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv31010/src/org/rubypeople/rdt/ui/text Modified Files: RubySourceViewerConfiguration.java Log Message: Index: RubySourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RubySourceViewerConfiguration.java 5 May 2006 21:45:24 -0000 1.7 --- RubySourceViewerConfiguration.java 12 May 2006 21:39:35 -0000 1.8 *************** *** 41,44 **** --- 41,45 ---- import org.rubypeople.rdt.internal.ui.rubyeditor.IRubyScriptDocumentProvider; import org.rubypeople.rdt.internal.ui.rubyeditor.RubyAbstractEditor; + import org.rubypeople.rdt.internal.ui.text.ContentAssistPreference; import org.rubypeople.rdt.internal.ui.text.HTMLTextPresenter; import org.rubypeople.rdt.internal.ui.text.IRubyColorConstants; *************** *** 47,51 **** import org.rubypeople.rdt.internal.ui.text.RubyAnnotationHover; import org.rubypeople.rdt.internal.ui.text.RubyCommentScanner; - import org.rubypeople.rdt.internal.ui.text.RubyContentAssistPreference; import org.rubypeople.rdt.internal.ui.text.RubyDoubleClickSelector; import org.rubypeople.rdt.internal.ui.text.RubyPartitionScanner; --- 48,51 ---- *************** *** 321,325 **** contentAssistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE); ! RubyContentAssistPreference.configure(contentAssistant, getPreferenceStore()); return contentAssistant; } --- 321,325 ---- contentAssistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE); ! ContentAssistPreference.configure(contentAssistant, getPreferenceStore()); return contentAssistant; } *************** *** 376,396 **** */ public IReconciler getReconciler(ISourceViewer sourceViewer) { ! final ITextEditor editor = getEditor(); ! if (editor != null && editor.isEditable()) { ! RubyReconciler reconciler = new RubyReconciler(editor, ! new RubyReconcilingStrategy( ! (RubyAbstractEditor) fTextEditor), true); ! reconciler.setIsIncrementalReconciler(false); ! // TODO Uncomment when we move to Eclipse 3.2 ! // ECLIPSE 3.2 ! // reconciler.setIsAllowedToModifyDocument(false); ! reconciler.setProgressMonitor(new NullProgressMonitor()); ! reconciler.setDelay(500); ! return reconciler; ! } ! return null; } ! ! private IRubyProject getProject() { ITextEditor editor= getEditor(); if (editor == null) --- 376,391 ---- */ public IReconciler getReconciler(ISourceViewer sourceViewer) { ! RubyReconciler reconciler = new RubyReconciler(fTextEditor, new RubyReconcilingStrategy( ! (RubyAbstractEditor) fTextEditor), true); ! reconciler.setIsIncrementalReconciler(false); ! // TODO Uncomment when we move to Eclipse 3.2 ! // ECLIPSE 3.2 ! //reconciler.setIsAllowedToModifyDocument(false); ! reconciler.setProgressMonitor(new NullProgressMonitor()); ! reconciler.setDelay(500); ! return reconciler; } ! ! private IRubyProject getProject() { ITextEditor editor= getEditor(); if (editor == null) *************** *** 410,414 **** return element.getRubyProject(); } ! public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { --- 405,409 ---- return element.getRubyProject(); } ! public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { *************** *** 451,461 **** return (String[]) vector.toArray(new String[vector.size()]); } - - /* - * @see SourceViewerConfiguration#getTabWidth(ISourceViewer) - */ - public int getTabWidth(ISourceViewer sourceViewer) { - return CodeFormatterUtil.getTabWidth(getProject()); - } public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, --- 446,449 ---- *************** *** 466,469 **** --- 454,464 ---- return fRubyDoubleClickSelector; } + + /* + * @see SourceViewerConfiguration#getTabWidth(ISourceViewer) + */ + public int getTabWidth(ISourceViewer sourceViewer) { + return CodeFormatterUtil.getTabWidth(getProject()); + } public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { |
|
From: Christopher W. <caw...@us...> - 2006-05-12 21:39:39
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv31010/src/org/rubypeople/rdt/internal/ui/text Modified Files: RubyPartitionScanner.java IRubyPartitions.java Added Files: PercentSyntaxRule.java Removed Files: RubyContentAssistPreference.java Log Message: --- NEW FILE: PercentSyntaxRule.java --- package org.rubypeople.rdt.internal.ui.text; import org.eclipse.jface.text.rules.ICharacterScanner; import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.Token; public class PercentSyntaxRule implements IRule { public IToken evaluate(ICharacterScanner scanner) { int c = scanner.read(); if (((char) c) == '%') { c = scanner.read(); // get next char switch ((char) c) { case 'r': // regular expression return detectToken(scanner, IRubyPartitions.RUBY_REGEX); case 'x': // commands return detectToken(scanner, IRubyPartitions.RUBY_COMMAND); case 'q': case 'Q': // strings return detectToken(scanner, IRubyPartitions.RUBY_STRING); default: // special case of string (no letter following percent) scanner.unread(); return detectToken(scanner, IRubyPartitions.RUBY_STRING); } } scanner.unread(); return Token.UNDEFINED; } private IToken detectToken(ICharacterScanner scanner, String tokenType) { int c = scanner.read(); // get delimeter int lastChar = c; char endChar = getMatchingBracket((char) c); // Read until EOF, End character or EOL while (true) { c = scanner.read(); // FIXME This is a big hack. Expression substitution actually needs to be returned as normal ruby code (and repartitioned) if ((char) c == '#') { // Try to handle expression substitution char d = (char) scanner.read(); if (d == '{') { // read until '}' do { d = (char)scanner.read(); } while (d != '}'); continue; } else if (d == '@' || d == '$') { // read until whitespace do { d = (char) scanner.read(); } while (d != ' '); continue; } else {// not expression subst. scanner.unread(); } } // TODO Stop at EOL,char[][] originalDelimiters= // scanner.getLegalLineDelimiters(); if (c == ICharacterScanner.EOF) break; // we're done if ((char) c == endChar && ((char) lastChar != '\\')) break; // we found matching bracket lastChar = c; } return new Token(tokenType); } /** * Returns whether the next characters to be read by the character scanner * are an exact match with the given sequence. No escape characters are * allowed within the sequence. If specified the sequence is considered to * be found when reading the EOF character. * * @param scanner * the character scanner to be used * @param sequence * the sequence to be detected * @param eofAllowed * indicated whether EOF terminates the pattern * @return <code>true</code> if the given sequence has been detected */ protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) { for (int i = 1; i < sequence.length; i++) { int c = scanner.read(); if (c == ICharacterScanner.EOF && eofAllowed) { return true; } else if (c != sequence[i]) { // Non-matching character detected, rewind the scanner back to // the start. // Do not unread the first character. scanner.unread(); for (int j = i - 1; j > 0; j--) scanner.unread(); return false; } } return true; } private char getMatchingBracket(char c) { switch (c) { case '(': return ')'; case '{': return '}'; case '[': return ']'; case '<': return '>'; default: return c; } } } --- RubyContentAssistPreference.java DELETED --- Index: RubyPartitionScanner.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RubyPartitionScanner.java 24 Apr 2006 21:24:21 -0000 1.11 --- RubyPartitionScanner.java 12 May 2006 21:39:35 -0000 1.12 *************** *** 4,28 **** import java.util.List; import org.eclipse.jface.text.rules.EndOfLineRule; import org.eclipse.jface.text.rules.IPredicateRule; import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.MultiLineRule; ! import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; import org.eclipse.jface.text.rules.SingleLineRule; import org.eclipse.jface.text.rules.Token; import org.eclipse.jface.text.rules.WordPatternRule; ! public class RubyPartitionScanner extends RuleBasedPartitionScanner { - public final static String RUBY_STRING = IRubyPartitions.RUBY_STRING; public final static String RUBY_MULTI_LINE_COMMENT = IRubyPartitions.RUBY_MULTI_LINE_COMMENT; public static final String RUBY_SINGLE_LINE_COMMENT = IRubyPartitions.RUBY_SINGLE_LINE_COMMENT; ! public static final String RUBY_REGULAR_EXPRESSION = "partition_scanner_ruby_regular_expression"; ! public static final String RUBY_COMMAND = "partition_scanner_ruby_command"; public static final String HERE_DOC = "partition_scanner_here_doc"; ! ! public static final String[] LEGAL_CONTENT_TYPES = {RUBY_STRING, RUBY_MULTI_LINE_COMMENT, RUBY_SINGLE_LINE_COMMENT, RUBY_REGULAR_EXPRESSION, RUBY_COMMAND}; ! public RubyPartitionScanner() { super(); --- 4,45 ---- import java.util.List; + import org.eclipse.jface.text.IDocument; + import org.eclipse.jface.text.rules.BufferedRuleBasedScanner; import org.eclipse.jface.text.rules.EndOfLineRule; + import org.eclipse.jface.text.rules.IPartitionTokenScanner; import org.eclipse.jface.text.rules.IPredicateRule; + import org.eclipse.jface.text.rules.IRule; import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.MultiLineRule; ! import org.eclipse.jface.text.rules.PatternRule; import org.eclipse.jface.text.rules.SingleLineRule; import org.eclipse.jface.text.rules.Token; import org.eclipse.jface.text.rules.WordPatternRule; ! public class RubyPartitionScanner extends BufferedRuleBasedScanner implements ! IPartitionTokenScanner { ! ! /** The content type of the partition in which to resume scanning. */ ! protected String fContentType; ! ! /** The offset of the partition inside which to resume. */ ! protected int fPartitionOffset; public final static String RUBY_STRING = IRubyPartitions.RUBY_STRING; + public final static String RUBY_MULTI_LINE_COMMENT = IRubyPartitions.RUBY_MULTI_LINE_COMMENT; + public static final String RUBY_SINGLE_LINE_COMMENT = IRubyPartitions.RUBY_SINGLE_LINE_COMMENT; ! ! public static final String RUBY_REGULAR_EXPRESSION = IRubyPartitions.RUBY_REGEX; ! ! public static final String RUBY_COMMAND = IRubyPartitions.RUBY_COMMAND; ! public static final String HERE_DOC = "partition_scanner_here_doc"; ! ! public static final String[] LEGAL_CONTENT_TYPES = { RUBY_STRING, ! RUBY_MULTI_LINE_COMMENT, RUBY_SINGLE_LINE_COMMENT, ! RUBY_REGULAR_EXPRESSION, RUBY_COMMAND }; ! public RubyPartitionScanner() { super(); *************** *** 36,40 **** IToken regexp = new Token(RUBY_REGULAR_EXPRESSION); IToken command = new Token(RUBY_COMMAND); ! IToken hereDoc = new Token(RUBY_STRING) ; List rules = new ArrayList(); --- 53,57 ---- IToken regexp = new Token(RUBY_REGULAR_EXPRESSION); IToken command = new Token(RUBY_COMMAND); ! IToken hereDoc = new Token(RUBY_STRING); List rules = new ArrayList(); *************** *** 43,89 **** // strings (and therefore have quotes inside them which don't end the // partition) ! // Strings ! rules.add(new SingleLineRule("\"", "\"", string, '\\')); ! rules.add(new SingleLineRule("'", "'", string, '\\')); ! createGeneralDelimitedRules(rules, "%q", string, '\\'); ! createGeneralDelimitedRules(rules, "%Q", string, '\\'); ! createGeneralDelimitedRules(rules, "%", string, '\\'); // Regular expressions ! createRuleWithOptionalEndChars(rules, "/", "/", new char[] {'s', 'u', 'e', 'n', 'x', 'm', 'o', 'i'}, regexp, '\\'); ! rules.add(new SingleLineRule("/", "/", regexp, '\\')); ! createGeneralDelimitedRules(rules, "%r", regexp, '\\'); ! // Commands rules.add(new SingleLineRule("`", "`", command, '\\')); ! createGeneralDelimitedRules(rules, "%x", command, '\\'); ! ! // Single line comments ! // ?# evaluates to the asiic value of # ! rules.add(new WordPatternRule(new NumberSignDetector(),"?", "#", Token.UNDEFINED)) ; rules.add(new EndOfLineRule("#", singleLineComment)); // Multiline comments ! MultiLineRule multiLineCommentRule = new MultiLineRule("=begin", "=end", multiLineComment) ; ! multiLineCommentRule.setColumnConstraint(0) ; rules.add(multiLineCommentRule); ! ! rules.add(new HereDocPatternRule(hereDoc)) ; ! ! IPredicateRule[] result = new IPredicateRule[rules.size()]; rules.toArray(result); ! setPredicateRules(result); } ! private void createRuleWithOptionalEndChars(List rules, String prefix, String endString, char[] options, IToken token, char escapeChar) { ! for (int i = 0; i < options.length; i++) { ! rules.add(new SingleLineRule(prefix, endString + options[i], token, escapeChar)); } } ! private void createGeneralDelimitedRules(List rules, String prefix, IToken token, char escapeChar) { ! rules.add(new MultiLineRule(prefix + "[", "]", token, escapeChar)); ! rules.add(new MultiLineRule(prefix + "{", "}", token, escapeChar)); ! rules.add(new MultiLineRule(prefix + "(", ")", token, escapeChar)); ! rules.add(new MultiLineRule(prefix + "<", ">", token, escapeChar)); } } \ No newline at end of file --- 60,168 ---- // strings (and therefore have quotes inside them which don't end the // partition) ! // Strings ! rules.add(new PatternRule("\"", "\"", string, '\\', false, false)); ! rules.add(new PatternRule("'", "'", string, '\\', false, false)); ! // Regular expressions ! // TODO Work with options: 's', 'u', 'e', 'n', 'x', 'm', 'o', 'i' ! rules.add(new SingleLineRule("/", "/", regexp, '\\')); ! // Commands rules.add(new SingleLineRule("`", "`", command, '\\')); ! ! // Catch all the wacky Percent Syntax (Strings/commands/regexps) ! rules.add(new PercentSyntaxRule()); ! ! // Single line comments ! // ?# evaluates to the ascii value of # ! rules.add(new WordPatternRule(new NumberSignDetector(), "?", "#", ! Token.UNDEFINED)); rules.add(new EndOfLineRule("#", singleLineComment)); // Multiline comments ! MultiLineRule multiLineCommentRule = new MultiLineRule("=begin", ! "=end", multiLineComment); ! multiLineCommentRule.setColumnConstraint(0); rules.add(multiLineCommentRule); ! ! rules.add(new HereDocPatternRule(hereDoc)); ! ! // FIXME Create Hyrbid of RuleBasedPartitionScanner which allows IRule ! // or IPredicateRule and will only evaluate IPredicateRules if success ! // token matches content type ! IRule[] result = new IRule[rules.size()]; rules.toArray(result); ! setRules(result); } ! /* ! * @see ITokenScanner#setRange(IDocument, int, int) ! */ ! public void setRange(IDocument document, int offset, int length) { ! setPartialRange(document, offset, length, null, -1); ! } ! ! /* ! * @see IPartitionTokenScanner#setPartialRange(IDocument, int, int, String, ! * int) ! */ ! public void setPartialRange(IDocument document, int offset, int length, ! String contentType, int partitionOffset) { ! fContentType = contentType; ! fPartitionOffset = partitionOffset; ! if (partitionOffset > -1) { ! int delta = offset - partitionOffset; ! if (delta > 0) { ! super.setRange(document, partitionOffset, length + delta); ! fOffset = offset; ! return; ! } } + super.setRange(document, offset, length); } ! /* ! * @see ITokenScanner#nextToken() ! */ ! public IToken nextToken() { ! ! if (fContentType == null || fRules == null) { ! // don't try to resume ! return super.nextToken(); ! } ! ! // inside a partition ! ! fColumn = UNDEFINED; ! boolean resume = (fPartitionOffset > -1 && fPartitionOffset < fOffset); ! fTokenOffset = resume ? fPartitionOffset : fOffset; ! ! IRule rule; ! IToken token; ! ! for (int i = 0; i < fRules.length; i++) { ! rule = (IRule) fRules[i]; ! if (rule instanceof IPredicateRule) { ! IPredicateRule predRule = (IPredicateRule) rule; ! token = predRule.getSuccessToken(); ! if (fContentType.equals(token.getData())) { ! token = predRule.evaluate(this, resume); ! if (!token.isUndefined()) { ! fContentType = null; ! return token; ! } ! } ! } else { ! token= rule.evaluate(this); ! if (!token.isUndefined()) ! return token; ! } ! } ! ! // haven't found any rule for this type of partition ! fContentType = null; ! if (resume) ! fOffset = fPartitionOffset; ! return super.nextToken(); } } \ No newline at end of file Index: IRubyPartitions.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/IRubyPartitions.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IRubyPartitions.java 10 Feb 2006 20:14:43 -0000 1.3 --- IRubyPartitions.java 12 May 2006 21:39:35 -0000 1.4 *************** *** 17,20 **** --- 17,24 ---- */ public final static String RUBY_PARTITIONING= "___ruby_partitioning"; //$NON-NLS-1$ + + public static final String RUBY_REGEX = "__ruby_regular_expression"; //$NON-NLS-1$ + + public static final String RUBY_COMMAND = "__ruby_command"; //$NON-NLS-1$ /** |
|
From: Christopher W. <caw...@us...> - 2006-05-05 21:48:50
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12976/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: IRubyScriptDocumentProvider.java Log Message: remove reference to 3.2 specific interface (until we get the build machine compiling against 3.2) Index: IRubyScriptDocumentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/IRubyScriptDocumentProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IRubyScriptDocumentProvider.java 5 May 2006 01:13:28 -0000 1.1 --- IRubyScriptDocumentProvider.java 5 May 2006 21:48:46 -0000 1.2 *************** *** 19,23 **** import org.eclipse.ui.texteditor.IDocumentProviderExtension2; import org.eclipse.ui.texteditor.IDocumentProviderExtension3; - import org.eclipse.ui.texteditor.IDocumentProviderExtension5; import org.rubypeople.rdt.core.IRubyScript; --- 19,22 ---- *************** *** 25,29 **** * @since 3.0 */ ! public interface IRubyScriptDocumentProvider extends IDocumentProvider, IDocumentProviderExtension2, IDocumentProviderExtension3, IDocumentProviderExtension5 { /** --- 24,30 ---- * @since 3.0 */ ! public interface IRubyScriptDocumentProvider extends IDocumentProvider, IDocumentProviderExtension2, IDocumentProviderExtension3 { ! // FIXME When we've got our continuous build updated to 3.2, uncomment this ! //public interface IRubyScriptDocumentProvider extends IDocumentProvider, IDocumentProviderExtension2, IDocumentProviderExtension3, IDocumentProviderExtension5 { /** |
|
From: Christopher W. <caw...@us...> - 2006-05-05 21:46:09
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11583 Modified Files: plugin.properties plugin.xml Log Message: fix ticket #121 - complaints about surround with begin...rescue block command not being defined should be fixed Index: plugin.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.properties,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** plugin.properties 23 Apr 2006 19:43:30 -0000 1.34 --- plugin.properties 5 May 2006 21:46:05 -0000 1.35 *************** *** 89,92 **** --- 89,95 ---- ActionDefinition.gotoMatchingBracket.description= Moves the cursor to the matching bracket + ActionDefinition.gotoMatchingBracket.name= Surround with begin/rescue Block + ActionDefinition.gotoMatchingBracket.description= Surround the selected text with a begin/rescue block + scope.rubyEditor.name=Ruby Editor scope.rubyEditor.description=Ruby Editor Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.xml,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** plugin.xml 21 Apr 2006 21:13:29 -0000 1.82 --- plugin.xml 5 May 2006 21:46:05 -0000 1.83 *************** *** 464,470 **** name="%ActionDefinition.toggleComment.name" description="%ActionDefinition.toggleComment.description" ! categoryId="org.eubypeople.rdt.ui.category.source" id="org.rubypeople.rdt.ui.edit.text.ruby.toggle.comment "> </command> </extension> <extension --- 464,476 ---- name="%ActionDefinition.toggleComment.name" description="%ActionDefinition.toggleComment.description" ! categoryId="org.rubypeople.rdt.ui.category.source" id="org.rubypeople.rdt.ui.edit.text.ruby.toggle.comment "> </command> + <command + name="%ActionDefinition.surroundWith.beginRescue.name" + description="%ActionDefinition.surroundWith.beginRescue.description" + categoryId="org.rubypeople.rdt.ui.category.source" + id="org.rubypeople.rdt.ui.edit.text.ruby.surround.with.begin.rescue"> + </command> </extension> <extension |
|
From: Christopher W. <caw...@us...> - 2006-05-05 21:45:27
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11380/src/org/rubypeople/rdt/ui/text Modified Files: RubySourceViewerConfiguration.java Log Message: fix null pointer exceptions we're getting on code preview windows inside preference pages Index: RubySourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RubySourceViewerConfiguration.java 5 May 2006 01:13:28 -0000 1.6 --- RubySourceViewerConfiguration.java 5 May 2006 21:45:24 -0000 1.7 *************** *** 376,388 **** */ public IReconciler getReconciler(ISourceViewer sourceViewer) { ! RubyReconciler reconciler = new RubyReconciler(fTextEditor, new RubyReconcilingStrategy( ! (RubyAbstractEditor) fTextEditor), true); ! reconciler.setIsIncrementalReconciler(false); ! // TODO Uncomment when we move to Eclipse 3.2 ! // ECLIPSE 3.2 ! //reconciler.setIsAllowedToModifyDocument(false); ! reconciler.setProgressMonitor(new NullProgressMonitor()); ! reconciler.setDelay(500); ! return reconciler; } --- 376,393 ---- */ public IReconciler getReconciler(ISourceViewer sourceViewer) { ! final ITextEditor editor = getEditor(); ! if (editor != null && editor.isEditable()) { ! RubyReconciler reconciler = new RubyReconciler(editor, ! new RubyReconcilingStrategy( ! (RubyAbstractEditor) fTextEditor), true); ! reconciler.setIsIncrementalReconciler(false); ! // TODO Uncomment when we move to Eclipse 3.2 ! // ECLIPSE 3.2 ! // reconciler.setIsAllowedToModifyDocument(false); ! reconciler.setProgressMonitor(new NullProgressMonitor()); ! reconciler.setDelay(500); ! return reconciler; ! } ! return null; } |
|
From: Christopher W. <caw...@us...> - 2006-05-05 21:45:10
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10971/src/org/rubypeople/rdt/internal/ui/text/ruby Modified Files: AbstractRubyScanner.java Log Message: add ability to set background color on a token basis (ticket #122) Index: AbstractRubyScanner.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/AbstractRubyScanner.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractRubyScanner.java 12 Apr 2006 21:26:25 -0000 1.6 --- AbstractRubyScanner.java 5 May 2006 21:44:59 -0000 1.7 *************** *** 25,28 **** --- 25,29 ---- private String[] fPropertyNamesColor; + private String[] fPropertyNamesBgColor; private String[] fPropertyNamesBold; private String[] fPropertyNamesItalic; *************** *** 92,95 **** --- 93,97 ---- fPropertyNamesColor = getTokenProperties(); int length = fPropertyNamesColor.length; + fPropertyNamesBgColor = new String[length]; fPropertyNamesBold = new String[length]; fPropertyNamesItalic = new String[length]; *************** *** 98,101 **** --- 100,104 ---- for (int i= 0; i < length; i++) { + fPropertyNamesBgColor[i]= getBGKey(fPropertyNamesColor[i]); fPropertyNamesBold[i]= getBoldKey(fPropertyNamesColor[i]); fPropertyNamesItalic[i]= getItalicKey(fPropertyNamesColor[i]); *************** *** 107,113 **** for (int i = 0; i < length; i++) { if (fNeedsLazyColorLoading) ! addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); else ! addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } --- 110,116 ---- for (int i = 0; i < length; i++) { if (fNeedsLazyColorLoading) ! addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBgColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); else ! addToken(fPropertyNamesColor[i], fPropertyNamesBgColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } *************** *** 118,121 **** --- 121,128 ---- return colorKey + PreferenceConstants.EDITOR_BOLD_SUFFIX; } + + protected String getBGKey(String colorKey) { + return colorKey + PreferenceConstants.EDITOR_BG_SUFFIX; + } protected String getItalicKey(String colorKey) { *************** *** 131,136 **** } ! private void addTokenWithProxyAttribute(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { ! fTokenMap.put(colorKey, new Token(createTextAttribute(null, boldKey, italicKey, strikethroughKey, underlineKey))); } --- 138,143 ---- } ! private void addTokenWithProxyAttribute(String colorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { ! fTokenMap.put(colorKey, new Token(createTextAttribute(null, null, boldKey, italicKey, strikethroughKey, underlineKey))); } *************** *** 138,142 **** if (fNeedsLazyColorLoading && Display.getCurrent() != null) { for (int i = 0; i < fPropertyNamesColor.length; i++) { ! addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } fNeedsLazyColorLoading = false; --- 145,149 ---- if (fNeedsLazyColorLoading && Display.getCurrent() != null) { for (int i = 0; i < fPropertyNamesColor.length; i++) { ! addToken(fPropertyNamesColor[i], fPropertyNamesBgColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } fNeedsLazyColorLoading = false; *************** *** 144,150 **** } ! private void addToken(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { if (fColorManager != null && colorKey != null && fColorManager.getColor(colorKey) == null) { RGB rgb = PreferenceConverter.getColor(fPreferenceStore, colorKey); if (fColorManager instanceof IColorManagerExtension) { IColorManagerExtension ext = (IColorManagerExtension) fColorManager; --- 151,171 ---- } ! private void addToken(String colorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { ! bindColor(colorKey); ! bindColor(bgColorKey); ! ! if (!fNeedsLazyColorLoading) ! fTokenMap.put(colorKey, new Token(createTextAttribute(colorKey, bgColorKey, boldKey, italicKey, strikethroughKey, underlineKey))); ! else { ! Token token = ((Token) fTokenMap.get(colorKey)); ! if (token != null) token.setData(createTextAttribute(colorKey, bgColorKey, boldKey, italicKey, strikethroughKey, underlineKey)); ! } ! } ! ! private void bindColor(String colorKey) { if (fColorManager != null && colorKey != null && fColorManager.getColor(colorKey) == null) { RGB rgb = PreferenceConverter.getColor(fPreferenceStore, colorKey); + if (rgb == PreferenceConverter.COLOR_DEFAULT_DEFAULT) return; + if (fColorManager instanceof IColorManagerExtension) { IColorManagerExtension ext = (IColorManagerExtension) fColorManager; *************** *** 153,163 **** } } - - if (!fNeedsLazyColorLoading) - fTokenMap.put(colorKey, new Token(createTextAttribute(colorKey, boldKey, italicKey, strikethroughKey, underlineKey))); - else { - Token token = ((Token) fTokenMap.get(colorKey)); - if (token != null) token.setData(createTextAttribute(colorKey, boldKey, italicKey, strikethroughKey, underlineKey)); - } } --- 174,177 ---- *************** *** 173,176 **** --- 187,192 ---- * @param colorKey * the color preference key + * @param colorKey + * the color preference key * @param boldKey * the bold preference key *************** *** 184,191 **** * @since 0.9.0 */ ! private TextAttribute createTextAttribute(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { Color color= null; if (colorKey != null) color= fColorManager.getColor(colorKey); int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL; --- 200,211 ---- * @since 0.9.0 */ ! private TextAttribute createTextAttribute(String colorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { Color color= null; if (colorKey != null) color= fColorManager.getColor(colorKey); + + Color bgColor= null; + if (bgColorKey != null) + bgColor= fColorManager.getColor(bgColorKey); int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL; *************** *** 199,203 **** style |= TextAttribute.UNDERLINE; ! return new TextAttribute(color, null, style); } --- 219,223 ---- style |= TextAttribute.UNDERLINE; ! return new TextAttribute(color, bgColor, style); } *************** *** 213,216 **** --- 233,238 ---- if (fPropertyNamesColor[index].equals(p)) adaptToColorChange(token, event); + if (fPropertyNamesBgColor[index].equals(p)) + adaptToBgColorChange(token, event); else if (fPropertyNamesBold[index].equals(p)) adaptToStyleChange(token, event, SWT.BOLD); *************** *** 239,242 **** --- 261,272 ---- private void adaptToColorChange(Token token, PropertyChangeEvent event) { + adaptToSomeColorChange(token, event, true); + } + + private void adaptToBgColorChange(Token token, PropertyChangeEvent event) { + adaptToSomeColorChange(token, event, false); + } + + private void adaptToSomeColorChange(Token token, PropertyChangeEvent event, boolean isForeground) { RGB rgb = null; *************** *** 263,267 **** if (data instanceof TextAttribute) { TextAttribute oldAttr = (TextAttribute) data; ! token.setData(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle())); } } --- 293,306 ---- if (data instanceof TextAttribute) { TextAttribute oldAttr = (TextAttribute) data; ! Color foreGround; ! Color backGround; ! if (!isForeground) { ! foreGround = oldAttr.getForeground(); ! backGround = color; ! } else { ! foreGround = color; ! backGround = oldAttr.getBackground(); ! } ! token.setData(new TextAttribute(foreGround, backGround, oldAttr.getStyle())); } } *************** *** 272,276 **** int length = fPropertyNamesColor.length; for (int i = 0; i < length; i++) { ! if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]) || property.equals(fPropertyNamesStrikethrough[i]) || property.equals(fPropertyNamesUnderline[i])) return i; } } --- 311,315 ---- int length = fPropertyNamesColor.length; for (int i = 0; i < length; i++) { ! if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBgColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]) || property.equals(fPropertyNamesStrikethrough[i]) || property.equals(fPropertyNamesUnderline[i])) return i; } } |
|
From: Christopher W. <caw...@us...> - 2006-05-05 21:45:09
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10971/src/org/rubypeople/rdt/ui Modified Files: PreferenceConstants.java Log Message: add ability to set background color on a token basis (ticket #122) Index: PreferenceConstants.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PreferenceConstants.java 5 May 2006 01:13:28 -0000 1.19 --- PreferenceConstants.java 5 May 2006 21:44:59 -0000 1.20 *************** *** 97,100 **** --- 97,107 ---- /** + * Preference key suffix for background text style preference keys. + * + * @since 2.1 + */ + public static final String EDITOR_BG_SUFFIX = "_background"; //$NON-NLS-1$ + + /** * Preference key suffix for bold text style preference keys. * |
|
From: Christopher W. <caw...@us...> - 2006-05-05 21:45:08
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10971/src/org/rubypeople/rdt/internal/ui/preferences Modified Files: PreferencesMessages.java PreferencesMessages.properties ColorSettingPreviewCode.txt RubyEditorColoringConfigurationBlock.java Log Message: add ability to set background color on a token basis (ticket #122) Index: PreferencesMessages.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PreferencesMessages.java 21 Apr 2006 21:13:28 -0000 1.7 --- PreferencesMessages.java 5 May 2006 21:44:59 -0000 1.8 *************** *** 119,122 **** --- 119,123 ---- public static String RubyEditorPreferencePage_closeBrackets; public static String RubyEditorPreferencePage_closeBraces; + public static String RubyEditorPreferencePage_background_color; static { Index: PreferencesMessages.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PreferencesMessages.properties 23 Apr 2006 19:58:24 -0000 1.11 --- PreferencesMessages.properties 5 May 2006 21:44:59 -0000 1.12 *************** *** 91,94 **** --- 91,95 ---- RubyEditorPreferencePage_coloring_element=&Element: RubyEditorPreferencePage_color= C&olor: + RubyEditorPreferencePage_background_color= Background Color: RubyEditorPreferencePage_bold= &Bold RubyEditorPreferencePage_italic= &Italic Index: ColorSettingPreviewCode.txt =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/ColorSettingPreviewCode.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ColorSettingPreviewCode.txt 12 Apr 2006 21:26:25 -0000 1.1 --- ColorSettingPreviewCode.txt 5 May 2006 21:44:59 -0000 1.2 *************** *** 3,7 **** =end class ClassName < SuperClass ! CLASS_CONSTANT = 123 $global = 'around the world' # This comment may span only this line --- 3,7 ---- =end class ClassName < SuperClass ! CLASS_CONSTANT = 123 $global = 'around the world' # This comment may span only this line *************** *** 10,13 **** --- 10,14 ---- def initialize(value) @field = value + @char = ?a end Index: RubyEditorColoringConfigurationBlock.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/RubyEditorColoringConfigurationBlock.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubyEditorColoringConfigurationBlock.java 12 Apr 2006 21:26:25 -0000 1.1 --- RubyEditorColoringConfigurationBlock.java 5 May 2006 21:44:59 -0000 1.2 *************** *** 23,30 **** import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.resource.JFaceResources; - import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; - import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; --- 23,28 ---- *************** *** 88,91 **** --- 86,91 ---- /** Bold preference key */ private String fBoldKey; + /** Background preference key */ + private String fBackgroundKey; /** Italic preference key */ private String fItalicKey; *************** *** 103,107 **** * Initialize the item with the given values. * @param displayName the display name ! * @param colorKey the color preference key * @param boldKey the bold preference key * @param italicKey the italic preference key --- 103,108 ---- * Initialize the item with the given values. * @param displayName the display name ! * @param colorKey the color preference key\ ! * @param bgColorKey the color preference key * @param boldKey the bold preference key * @param italicKey the italic preference key *************** *** 109,115 **** * @param underlineKey the underline preference key */ ! public HighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { fDisplayName= displayName; fColorKey= colorKey; fBoldKey= boldKey; fItalicKey= italicKey; --- 110,117 ---- * @param underlineKey the underline preference key */ ! public HighlightingColorListItem(String displayName, String colorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { fDisplayName= displayName; fColorKey= colorKey; + fBackgroundKey = bgColorKey; fBoldKey= boldKey; fItalicKey= italicKey; *************** *** 126,129 **** --- 128,138 ---- /** + * @return the background preference key + */ + public String getBackgroundKey() { + return fBackgroundKey; + } + + /** * @return the bold preference key */ *************** *** 172,175 **** --- 181,185 ---- * @param displayName the display name * @param colorKey the color preference key + * @param bgColorKey the color preference key * @param boldKey the bold preference key * @param italicKey the italic preference key *************** *** 178,183 **** * @param enableKey the enable preference key */ ! public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey, String enableKey) { ! super(displayName, colorKey, boldKey, italicKey, strikethroughKey, underlineKey); fEnableKey= enableKey; } --- 188,193 ---- * @param enableKey the enable preference key */ ! public SemanticHighlightingColorListItem(String displayName, String colorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey, String enableKey) { ! super(displayName, colorKey, bgColorKey, boldKey, italicKey, strikethroughKey, underlineKey); fEnableKey= enableKey; } *************** *** 254,257 **** --- 264,268 ---- private static final String BOLD= PreferenceConstants.EDITOR_BOLD_SUFFIX; + private static final String BACKGROUND= PreferenceConstants.EDITOR_BG_SUFFIX; /** * Preference key suffix for italic preferences. *************** *** 293,297 **** --- 304,310 ---- private ColorSelector fSyntaxForegroundColorEditor; + private ColorSelector fSyntaxBackgroundColorEditor; private Label fColorEditorLabel; + private Label fBackgroundColorEditorLabel; private Button fBoldCheckBox; private Button fEnableCheckbox; *************** *** 343,347 **** for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++) ! fListModel.add(new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1], fSyntaxColorListModel[i][1] + BOLD, fSyntaxColorListModel[i][1] + ITALIC, fSyntaxColorListModel[i][1] + STRIKETHROUGH, fSyntaxColorListModel[i][1] + UNDERLINE)); store.addKeys(createOverlayStoreKeys()); --- 356,360 ---- for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++) ! fListModel.add(new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1], fSyntaxColorListModel[i][1] + BACKGROUND, fSyntaxColorListModel[i][1] + BOLD, fSyntaxColorListModel[i][1] + ITALIC, fSyntaxColorListModel[i][1] + STRIKETHROUGH, fSyntaxColorListModel[i][1] + UNDERLINE)); store.addKeys(createOverlayStoreKeys()); *************** *** 453,456 **** --- 466,470 ---- fEnableCheckbox.setEnabled(false); fSyntaxForegroundColorEditor.getButton().setEnabled(false); + fSyntaxBackgroundColorEditor.getButton().setEnabled(false); fColorEditorLabel.setEnabled(false); fBoldCheckBox.setEnabled(false); *************** *** 461,465 **** } RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey()); ! fSyntaxForegroundColorEditor.setColorValue(rgb); fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey())); fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey())); --- 475,482 ---- } RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey()); ! fSyntaxForegroundColorEditor.setColorValue(rgb); ! rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getBackgroundKey()); ! // TODO If we get back default color, show the default text editor bg color. ! fSyntaxBackgroundColorEditor.setColorValue(rgb); fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey())); fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey())); *************** *** 471,474 **** --- 488,492 ---- fEnableCheckbox.setSelection(enable); fSyntaxForegroundColorEditor.getButton().setEnabled(enable); + fSyntaxBackgroundColorEditor.getButton().setEnabled(enable); fColorEditorLabel.setEnabled(enable); fBoldCheckBox.setEnabled(enable); *************** *** 478,481 **** --- 496,500 ---- } else { fSyntaxForegroundColorEditor.getButton().setEnabled(true); + fSyntaxBackgroundColorEditor.getButton().setEnabled(true); fColorEditorLabel.setEnabled(true); fBoldCheckBox.setEnabled(true); *************** *** 582,585 **** --- 601,620 ---- foregroundColorButton.setLayoutData(gd); + + // Background color + // TODO Create an enable/system default checkbox for background + fBackgroundColorEditorLabel= new Label(stylesComposite, SWT.LEFT); + fBackgroundColorEditorLabel.setText(PreferencesMessages.RubyEditorPreferencePage_background_color); + gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); + gd.horizontalIndent= 20; + fBackgroundColorEditorLabel.setLayoutData(gd); + + fSyntaxBackgroundColorEditor= new ColorSelector(stylesComposite); + Button backgroundColorButton= fSyntaxBackgroundColorEditor.getButton(); + gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); + backgroundColorButton.setLayoutData(gd); + + + fBoldCheckBox= new Button(stylesComposite, SWT.CHECK); fBoldCheckBox.setText(PreferencesMessages.RubyEditorPreferencePage_bold); *************** *** 635,638 **** --- 670,683 ---- } }); + + backgroundColorButton.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + // do nothing + } + public void widgetSelected(SelectionEvent e) { + HighlightingColorListItem item= getHighlightingColorListItem(); + PreferenceConverter.setValue(getPreferenceStore(), item.getBackgroundKey(), fSyntaxBackgroundColorEditor.getColorValue()); + } + }); fBoldCheckBox.addSelectionListener(new SelectionListener() { *************** *** 686,689 **** --- 731,735 ---- fEnableCheckbox.setSelection(enable); fSyntaxForegroundColorEditor.getButton().setEnabled(enable); + fSyntaxBackgroundColorEditor.getButton().setEnabled(enable); fColorEditorLabel.setEnabled(enable); fBoldCheckBox.setEnabled(enable); |
|
From: Christopher W. <caw...@us...> - 2006-05-05 01:13:33
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13792/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyAbstractEditor.java RubyEditor.java RubyDocumentProvider.java RubySourceViewer.java Added Files: IRubyScriptDocumentProvider.java Removed Files: TabExpander.java Log Message: fix formatting to respect tab conversion to spaces and tab/indentation size (from our new formatter page - I was still referring to old preferences that no longer are used/exist) Index: RubySourceViewer.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubySourceViewer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RubySourceViewer.java 10 Feb 2006 20:14:31 -0000 1.5 --- RubySourceViewer.java 5 May 2006 01:13:27 -0000 1.6 *************** *** 9,14 **** import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; - import org.eclipse.jface.text.DocumentCommand; - import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.source.IOverviewRuler; import org.eclipse.jface.text.source.IVerticalRuler; --- 9,12 ---- *************** *** 24,38 **** import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.AbstractTextEditor; - import org.rubypeople.rdt.core.RubyCore; - import org.rubypeople.rdt.core.formatter.DefaultCodeFormatterConstants; - import org.rubypeople.rdt.core.formatter.Indents; - import org.rubypeople.rdt.internal.ui.RubyPlugin; - import org.rubypeople.rdt.ui.PreferenceConstants; public class RubySourceViewer extends ProjectionViewer implements IPropertyChangeListener { - private boolean isTabReplacing = false; private boolean fIgnoreTextConverters = false; - private TabExpander tabExpander; /** --- 22,29 ---- *************** *** 75,79 **** super(composite, verticalRuler, overviewRuler, overviewRulerVisible, styles); setPreferenceStore(store); - initializeTabReplace(); } --- 66,69 ---- *************** *** 248,296 **** public void doOperation(int operation) { if (getTextWidget() == null || !redraws()) { return; } - - switch (operation) { - case UNDO: - fIgnoreTextConverters = true; - break; - case REDO: - fIgnoreTextConverters = true; - break; - } - super.doOperation(operation); } - - protected void customizeDocumentCommand(DocumentCommand command) { - super.customizeDocumentCommand(command); - if (!fIgnoreTextConverters) { - convertTabs(command, getDocument()); - } - fIgnoreTextConverters = false; - } - - void initializeTabReplace() { - this.isTabReplacing = !RubyPlugin.getDefault().getPreferenceStore().getBoolean( - PreferenceConstants.FORMAT_USE_TAB); - if (this.isTabReplacing) { - int length = Indents.getTabWidth(RubyCore.getOptions()); - tabExpander = new TabExpander(length); - } - } - - protected void convertTabs(DocumentCommand command, IDocument document) { - if (!isTabReplacing) - return; - - if (command.text.equals("\t")) - tabExpander.expandTab(command, document); - } - - public boolean isTabReplacing() { - return isTabReplacing; - } - - public String getIndentString() { - return tabExpander.getFullIndent(); - } - } --- 238,242 ---- --- NEW FILE: IRubyScriptDocumentProvider.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.rubyeditor; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ILineTracker; import org.eclipse.jface.text.source.IAnnotationModelListener; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.IDocumentProviderExtension2; import org.eclipse.ui.texteditor.IDocumentProviderExtension3; import org.eclipse.ui.texteditor.IDocumentProviderExtension5; import org.rubypeople.rdt.core.IRubyScript; /** * @since 3.0 */ public interface IRubyScriptDocumentProvider extends IDocumentProvider, IDocumentProviderExtension2, IDocumentProviderExtension3, IDocumentProviderExtension5 { /** * Shuts down this provider. */ void shutdown(); /** * Returns the working copy for the given element. * * @param element the element * @return the working copy for the given element */ IRubyScript getWorkingCopy(Object element); /** * Saves the content of the given document to the given element. This method has * only an effect if it is called when directly or indirectly inside <code>saveDocument</code>. * * @param monitor the progress monitor * @param element the element to which to save * @param document the document to save * @param overwrite <code>true</code> if the save should be enforced */ void saveDocumentContent(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException; /** * Creates a line tracker for the given element. It is of the same kind as the one that would be * used for a newly created document for the given element. * * @param element the element * @return a line tracker for the given element */ ILineTracker createLineTracker(Object element); /** * Sets the document provider's save policy. * * @param savePolicy the save policy */ void setSavePolicy(ISavePolicy savePolicy); /** * Adds a listener that reports changes from all compilation unit annotation models. * * @param listener the listener */ void addGlobalAnnotationModelListener(IAnnotationModelListener listener); /** * Removes the listener. * * @param listener the listener */ void removeGlobalAnnotationModelListener(IAnnotationModelListener listener); } Index: RubyDocumentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyDocumentProvider.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** RubyDocumentProvider.java 30 Mar 2006 03:16:39 -0000 1.22 --- RubyDocumentProvider.java 5 May 2006 01:13:27 -0000 1.23 *************** *** 10,21 **** --- 10,25 ---- import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; + import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.util.ListenerList; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.SubProgressMonitor; + import org.eclipse.core.runtime.content.IContentType; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.Assert; import org.eclipse.jface.text.BadLocationException; + import org.eclipse.jface.text.DefaultLineTracker; import org.eclipse.jface.text.IDocument; + import org.eclipse.jface.text.ILineTracker; import org.eclipse.jface.text.ISynchronizable; import org.eclipse.jface.text.Position; *************** *** 43,46 **** --- 47,51 ---- import org.eclipse.ui.texteditor.AnnotationPreferenceLookup; import org.eclipse.ui.texteditor.IDocumentProvider; + import org.eclipse.ui.texteditor.IElementStateListener; import org.eclipse.ui.texteditor.MarkerAnnotation; import org.eclipse.ui.texteditor.MarkerUtilities; *************** *** 56,60 **** import org.rubypeople.rdt.ui.PreferenceConstants; ! public class RubyDocumentProvider extends TextFileDocumentProvider { /** --- 61,65 ---- import org.rubypeople.rdt.ui.PreferenceConstants; ! public class RubyDocumentProvider extends TextFileDocumentProvider implements IRubyScriptDocumentProvider { /** *************** *** 1062,1066 **** } } ! } \ No newline at end of file --- 1067,1079 ---- } } ! ! ! public ILineTracker createLineTracker(Object element) { ! return new DefaultLineTracker(); ! } ! ! public void setSavePolicy(ISavePolicy savePolicy) { ! fSavePolicy= savePolicy; ! } } \ No newline at end of file Index: RubyEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** RubyEditor.java 23 Apr 2006 19:58:23 -0000 1.45 --- RubyEditor.java 5 May 2006 01:13:27 -0000 1.46 *************** *** 21,28 **** --- 21,30 ---- import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.BadPositionCategoryException; + import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentExtension; import org.eclipse.jface.text.IDocumentListener; + import org.eclipse.jface.text.ILineTracker; import org.eclipse.jface.text.IPositionUpdater; import org.eclipse.jface.text.IRegion; *************** *** 47,51 **** import org.eclipse.jface.text.source.IOverviewRuler; import org.eclipse.jface.text.source.ISourceViewer; - import org.eclipse.jface.text.source.ISourceViewerExtension2; import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.text.source.SourceViewerConfiguration; --- 49,52 ---- *************** *** 227,231 **** public void createPartControl(Composite parent) { super.createPartControl(parent); ! ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); --- 228,232 ---- public void createPartControl(Composite parent) { super.createPartControl(parent); ! ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); *************** *** 646,664 **** super.handlePreferenceStoreChanged(event); String property = event.getProperty(); - - if (PreferenceConstants.FORMAT_USE_TAB.equals(property) - || PreferenceConstants.FORMAT_INDENTATION.equals(property)) { - // TODO Shouldn't the indent stuff really be in the source viewer - // configuration? - if (getSourceViewer() instanceof RubySourceViewer) { - ((RubySourceViewer) getSourceViewer()).initializeTabReplace(); - } - // for rereading the indentPrefixes for shift left/right from the - // RubySourceViewerConfiguration - if (getSourceViewer() instanceof ISourceViewerExtension2) { - ((ISourceViewerExtension2) getSourceViewer()).unconfigure(); - this.getSourceViewer().configure(this.getSourceViewerConfiguration()); - } - } if (CLOSE_BRACKETS.equals(property)) { --- 647,650 ---- *************** *** 1403,1405 **** --- 1389,1471 ---- public void partInputChanged(IWorkbenchPartReference partRef) {} } + + interface ITextConverter { + void customizeDocumentCommand(IDocument document, DocumentCommand command); + } + + static class TabConverter implements ITextConverter { + + private int fTabRatio; + private ILineTracker fLineTracker; + + public TabConverter() { + } + + public void setNumberOfSpacesPerTab(int ratio) { + fTabRatio= ratio; + } + + public void setLineTracker(ILineTracker lineTracker) { + fLineTracker= lineTracker; + } + + private int insertTabString(StringBuffer buffer, int offsetInLine) { + + if (fTabRatio == 0) + return 0; + + int remainder= offsetInLine % fTabRatio; + remainder= fTabRatio - remainder; + for (int i= 0; i < remainder; i++) + buffer.append(' '); + return remainder; + } + + public void customizeDocumentCommand(IDocument document, DocumentCommand command) { + String text= command.text; + if (text == null) + return; + + int index= text.indexOf('\t'); + if (index > -1) { + + StringBuffer buffer= new StringBuffer(); + + fLineTracker.set(command.text); + int lines= fLineTracker.getNumberOfLines(); + + try { + + for (int i= 0; i < lines; i++) { + + int offset= fLineTracker.getLineOffset(i); + int endOffset= offset + fLineTracker.getLineLength(i); + String line= text.substring(offset, endOffset); + + int position= 0; + if (i == 0) { + IRegion firstLine= document.getLineInformationOfOffset(command.offset); + position= command.offset - firstLine.getOffset(); + } + + int length= line.length(); + for (int j= 0; j < length; j++) { + char c= line.charAt(j); + if (c == '\t') { + position += insertTabString(buffer, position); + } else { + buffer.append(c); + ++ position; + } + } + + } + + command.text= buffer.toString(); + + } catch (BadLocationException x) { + } + } + } + } } \ No newline at end of file --- TabExpander.java DELETED --- Index: RubyAbstractEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** RubyAbstractEditor.java 21 Apr 2006 21:13:29 -0000 1.28 --- RubyAbstractEditor.java 5 May 2006 01:13:24 -0000 1.29 *************** *** 10,14 **** --- 10,16 ---- import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.jface.preference.IPreferenceStore; + import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.ITextViewerExtension5; + import org.eclipse.jface.text.IWidgetTokenKeeper; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.text.contentassist.ContentAssistant; *************** *** 17,20 **** --- 19,23 ---- import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.IVerticalRuler; + import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.ListenerList; *************** *** 32,39 **** --- 35,44 ---- import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; + import org.eclipse.ui.PlatformUI; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.ChainedPreferenceStore; + import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; import org.eclipse.ui.views.contentoutline.ContentOutline; *************** *** 51,55 **** --- 56,63 ---- import org.rubypeople.rdt.core.RubyModelException; import org.rubypeople.rdt.core.formatter.DefaultCodeFormatterConstants; + import org.rubypeople.rdt.internal.corext.util.CodeFormatterUtil; import org.rubypeople.rdt.internal.ui.RubyPlugin; + import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor.ITextConverter; + import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor.TabConverter; import org.rubypeople.rdt.internal.ui.text.ContentAssistPreference; import org.rubypeople.rdt.internal.ui.text.IRubyPartitions; *************** *** 58,61 **** --- 66,70 ---- import org.rubypeople.rdt.ui.IWorkingCopyManager; import org.rubypeople.rdt.ui.PreferenceConstants; + import org.rubypeople.rdt.ui.RubyUI; import org.rubypeople.rdt.ui.text.RubySourceViewerConfiguration; import org.rubypeople.rdt.ui.text.RubyTextTools; *************** *** 72,76 **** protected AbstractSelectionChangedListener fOutlineSelectionChangedListener = new OutlineSelectionChangedListener(); private RubyOutlinePage fOutlinePage; ! /** Preference key for matching brackets */ --- 81,86 ---- protected AbstractSelectionChangedListener fOutlineSelectionChangedListener = new OutlineSelectionChangedListener(); private RubyOutlinePage fOutlinePage; ! /** The editor's tab converter */ ! private TabConverter fTabConverter; /** Preference key for matching brackets */ *************** *** 78,81 **** --- 88,95 ---- /** Preference key for matching brackets color */ protected final static String MATCHING_BRACKETS_COLOR= PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR; + /** Preference key for code formatter tab size */ + private final static String CODE_FORMATTER_TAB_SIZE= DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE; + /** Preference key for inserting spaces rather than tabs */ + private final static String SPACES_FOR_TABS= DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR; protected final static char[] BRACKETS= { '{', '}', '(', ')', '[', ']' }; *************** *** 206,209 **** --- 220,224 ---- protected void doSetInput(IEditorInput input) throws CoreException { super.doSetInput(input); + configureTabConverter(); setOutlinePageInput(fOutlinePage, input); } *************** *** 237,250 **** ((RubySourceViewerConfiguration)getSourceViewerConfiguration()).handlePropertyChangeEvent(event); ! if (DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE.equals(property) ! || DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE.equals(property) ! || DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR.equals(property)) { ! StyledText textWidget= sourceViewer.getTextWidget(); ! int tabWidth= getSourceViewerConfiguration().getTabWidth(sourceViewer); ! if (textWidget.getTabs() != tabWidth) ! textWidget.setTabs(tabWidth); return; } IContentAssistant c= sourceViewer.getContentAssistant(); if (c instanceof ContentAssistant) --- 252,269 ---- ((RubySourceViewerConfiguration)getSourceViewerConfiguration()).handlePropertyChangeEvent(event); ! if (SPACES_FOR_TABS.equals(property)) { ! if (isTabConversionEnabled()) ! startTabConversion(); ! else ! stopTabConversion(); return; } + if (CODE_FORMATTER_TAB_SIZE.equals(property)) { + sourceViewer.updateIndentationPrefixes(); + if (fTabConverter != null) + fTabConverter.setNumberOfSpacesPerTab(getTabSize()); + } + IContentAssistant c= sourceViewer.getContentAssistant(); if (c instanceof ContentAssistant) *************** *** 270,273 **** --- 289,361 ---- } } + + private int getTabSize() { + IRubyElement element= getInputRubyElement(); + IRubyProject project= element == null ? null : element.getRubyProject(); + return CodeFormatterUtil.getTabWidth(project); + } + + private void startTabConversion() { + if (fTabConverter == null) { + fTabConverter= new TabConverter(); + configureTabConverter(); + fTabConverter.setNumberOfSpacesPerTab(getTabSize()); + AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); + asv.addTextConverter(fTabConverter); + // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270 + asv.updateIndentationPrefixes(); + } + } + + private void configureTabConverter() { + if (fTabConverter != null) { + IDocumentProvider provider= getDocumentProvider(); + if (provider instanceof IRubyScriptDocumentProvider) { + IRubyScriptDocumentProvider cup= (IRubyScriptDocumentProvider) provider; + fTabConverter.setLineTracker(cup.createLineTracker(getEditorInput())); + } + } + } + + /** + * Returns the Ruby element wrapped by this editors input. + * + * @return the Ruby element wrapped by this editors input. + * @since 3.0 + */ + protected IRubyElement getInputRubyElement() { + IEditorInput editorInput= getEditorInput(); + if (editorInput == null) + return null; + return RubyUI.getEditorInputRubyElement(getEditorInput()); + } + + private void stopTabConversion() { + if (fTabConverter != null) { + AdaptedSourceViewer asv= (AdaptedSourceViewer) getSourceViewer(); + asv.removeTextConverter(fTabConverter); + // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270 + asv.updateIndentationPrefixes(); + fTabConverter= null; + } + } + + public void createPartControl(Composite parent) { + super.createPartControl(parent); + + if (isTabConversionEnabled()) + startTabConversion(); + } + + private boolean isTabConversionEnabled() { + IRubyElement element= getInputRubyElement(); + IRubyProject project= element == null ? null : element.getRubyProject(); + String option; + if (project == null) + option= RubyCore.getOption(SPACES_FOR_TABS); + else + option= project.getOption(SPACES_FOR_TABS, true); + return RubyCore.SPACE.equals(option); + } protected void handleOutlinePageSelection(SelectionChangedEvent event) { *************** *** 844,847 **** --- 932,993 ---- return fContentAssistant; } + + public void addTextConverter(ITextConverter textConverter) { + if (fTextConverters == null) { + fTextConverters= new ArrayList(1); + fTextConverters.add(textConverter); + } else if (!fTextConverters.contains(textConverter)) + fTextConverters.add(textConverter); + } + + public void removeTextConverter(ITextConverter textConverter) { + if (fTextConverters != null) { + fTextConverters.remove(textConverter); + if (fTextConverters.size() == 0) + fTextConverters= null; + } + } + + /* + * @see TextViewer#customizeDocumentCommand(DocumentCommand) + */ + protected void customizeDocumentCommand(DocumentCommand command) { + super.customizeDocumentCommand(command); + if (!fIgnoreTextConverters && fTextConverters != null) { + for (Iterator e = fTextConverters.iterator(); e.hasNext();) + ((ITextConverter) e.next()).customizeDocumentCommand(getDocument(), command); + } + } + + // http://dev.eclipse.org/bugs/show_bug.cgi?id=19270 + public void updateIndentationPrefixes() { + SourceViewerConfiguration configuration= getSourceViewerConfiguration(); + String[] types= configuration.getConfiguredContentTypes(this); + for (int i= 0; i < types.length; i++) { + String[] prefixes= configuration.getIndentPrefixes(this, types[i]); + if (prefixes != null && prefixes.length > 0) + setIndentPrefixes(prefixes, types[i]); + } + } + + /* + * @see IWidgetTokenOwner#requestWidgetToken(IWidgetTokenKeeper) + */ + public boolean requestWidgetToken(IWidgetTokenKeeper requester) { + if (PlatformUI.getWorkbench().getHelpSystem().isContextHelpDisplayed()) + return false; + return super.requestWidgetToken(requester); + } + + /* + * @see IWidgetTokenOwnerExtension#requestWidgetToken(IWidgetTokenKeeper, int) + * @since 3.0 + */ + public boolean requestWidgetToken(IWidgetTokenKeeper requester, int priority) { + if (PlatformUI.getWorkbench().getHelpSystem().isContextHelpDisplayed()) + return false; + return super.requestWidgetToken(requester, priority); + } + } } \ No newline at end of file |
|
From: Christopher W. <caw...@us...> - 2006-05-05 01:13:32
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13792/src/org/rubypeople/rdt/ui Modified Files: RubyUI.java PreferenceConstants.java Log Message: fix formatting to respect tab conversion to spaces and tab/indentation size (from our new formatter page - I was still referring to old preferences that no longer are used/exist) Index: PreferenceConstants.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PreferenceConstants.java 21 Apr 2006 21:13:29 -0000 1.18 --- PreferenceConstants.java 5 May 2006 01:13:28 -0000 1.19 *************** *** 18,23 **** public static final String RDOC_PATH = "rdocDirectoryPath"; - public static final String FORMAT_INDENTATION = "formatIndentation"; //$NON-NLS-1$ - public static final String FORMAT_USE_TAB = "formatUseTab"; //$NON-NLS-1$ public static final String TEMPLATES_USE_CODEFORMATTER = "templatesUseCodeFormatter"; //$NON-NLS-1$ --- 18,21 ---- *************** *** 500,506 **** store.setDefault(PreferenceConstants.APPEARANCE_ENABLE_VISIBILITY_SORT_ORDER, false); - store.setDefault(PreferenceConstants.FORMAT_INDENTATION, 2); - store.setDefault(PreferenceConstants.FORMAT_USE_TAB, false); - // AppearancePreferencePage store.setDefault(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES, false); --- 498,501 ---- Index: RubyUI.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/RubyUI.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubyUI.java 25 Mar 2006 02:37:44 -0000 1.2 --- RubyUI.java 5 May 2006 01:13:28 -0000 1.3 *************** *** 11,14 **** --- 11,19 ---- package org.rubypeople.rdt.ui; + import org.eclipse.jface.util.Assert; + import org.eclipse.ui.IEditorInput; + import org.rubypeople.rdt.core.IRubyElement; + import org.rubypeople.rdt.internal.ui.RubyPlugin; + /** * Central access point for the Ruby UI plug-in (id *************** *** 28,32 **** private RubyUI() { ! // prevent instantiation of RubyUI. } --- 33,37 ---- private RubyUI() { ! // prevent instantiation of RubyUI. } *************** *** 35,70 **** */ public static final String ID_PLUGIN = "org.rubypeople.rdt.ui"; //$NON-NLS-1$ public static final String ID_ACTION_SET = null; ! /** ! * The view part id of the Ruby Browsing Projects view ! * (value <code>"org.rubypeople.rdt.ui.ProjectsView"</code>). * * @since 0.8.0 */ ! public static String ID_PROJECTS_VIEW= "org.rubypeople.rdt.ui.ProjectsView"; //$NON-NLS-1$ ! /** ! * The view part id of the Ruby Browsing Types view ! * (value <code>"org.rubypeople.rdt.ui.TypesView"</code>). * * @since 0.8.0 */ ! public static String ID_TYPES_VIEW= "org.rubypeople.rdt.ui.TypesView"; //$NON-NLS-1$ ! /** ! * The view part id of the Ruby Browsing Memberss view ! * (value <code>"org.rubypeople.rdt.ui.MembersView"</code>). * * @since 0.8.0 */ ! public static String ID_MEMBERS_VIEW= "org.rubypeople.rdt.ui.MembersView"; //$NON-NLS-1$ ! /** ! * The id of the Ruby Element Creation action set ! * (value <code>"org.rubypeople.rdt.ui.RubyElementCreationActionSet"</code>). * * @since 0.8.0 */ ! public static final String ID_ELEMENT_CREATION_ACTION_SET= "org.rubypeople.rdt.ui.RubyElementCreationActionSet"; //$NON-NLS-1$ } \ No newline at end of file --- 40,108 ---- */ public static final String ID_PLUGIN = "org.rubypeople.rdt.ui"; //$NON-NLS-1$ + public static final String ID_ACTION_SET = null; ! /** ! * The view part id of the Ruby Browsing Projects view (value ! * <code>"org.rubypeople.rdt.ui.ProjectsView"</code>). * * @since 0.8.0 */ ! public static String ID_PROJECTS_VIEW = "org.rubypeople.rdt.ui.ProjectsView"; //$NON-NLS-1$ ! /** ! * The view part id of the Ruby Browsing Types view (value ! * <code>"org.rubypeople.rdt.ui.TypesView"</code>). * * @since 0.8.0 */ ! public static String ID_TYPES_VIEW = "org.rubypeople.rdt.ui.TypesView"; //$NON-NLS-1$ ! /** ! * The view part id of the Ruby Browsing Memberss view (value ! * <code>"org.rubypeople.rdt.ui.MembersView"</code>). * * @since 0.8.0 */ ! public static String ID_MEMBERS_VIEW = "org.rubypeople.rdt.ui.MembersView"; //$NON-NLS-1$ ! /** ! * The id of the Ruby Element Creation action set (value ! * <code>"org.rubypeople.rdt.ui.RubyElementCreationActionSet"</code>). * * @since 0.8.0 */ ! public static final String ID_ELEMENT_CREATION_ACTION_SET = "org.rubypeople.rdt.ui.RubyElementCreationActionSet"; //$NON-NLS-1$ ! ! /** ! * Returns the Ruby element wrapped by the given editor input. ! * ! * @param editorInput ! * the editor input ! * @return the Ruby element wrapped by <code>editorInput</code> or ! * <code>null</code> if none ! * @since 3.2 ! */ ! public static IRubyElement getEditorInputRubyElement( ! IEditorInput editorInput) { ! Assert.isNotNull(editorInput); ! IRubyElement je = getWorkingCopyManager().getWorkingCopy(editorInput); ! if (je != null) ! return je; ! ! /* ! * This needs works, see ! * https://bugs.eclipse.org/bugs/show_bug.cgi?id=120340 ! */ ! return (IRubyElement) editorInput.getAdapter(IRubyElement.class); ! } ! ! /** ! * Returns the working copy manager for the Ruby UI plug-in. ! * ! * @return the working copy manager for the Ruby UI plug-in ! */ ! public static IWorkingCopyManager getWorkingCopyManager() { ! return RubyPlugin.getDefault().getWorkingCopyManager(); ! } } \ No newline at end of file |
|
From: Christopher W. <caw...@us...> - 2006-05-05 01:13:32
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13792/src/org/rubypeople/rdt/ui/text Modified Files: RubySourceViewerConfiguration.java Log Message: fix formatting to respect tab conversion to spaces and tab/indentation size (from our new formatter page - I was still referring to old preferences that no longer are used/exist) Index: RubySourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RubySourceViewerConfiguration.java 24 Apr 2006 21:24:21 -0000 1.5 --- RubySourceViewerConfiguration.java 5 May 2006 01:13:28 -0000 1.6 *************** *** 1,4 **** --- 1,6 ---- package org.rubypeople.rdt.ui.text; + import java.util.Vector; + import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.preference.IPreferenceStore; *************** *** 25,36 **** import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.ITextEditor; import org.rubypeople.rdt.internal.ui.RubyPlugin; import org.rubypeople.rdt.internal.ui.rubyeditor.RubyAbstractEditor; - import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor; - import org.rubypeople.rdt.internal.ui.rubyeditor.RubySourceViewer; import org.rubypeople.rdt.internal.ui.text.HTMLTextPresenter; import org.rubypeople.rdt.internal.ui.text.IRubyColorConstants; --- 27,44 ---- import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; + import org.eclipse.ui.IEditorInput; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; import org.eclipse.ui.texteditor.ChainedPreferenceStore; + import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; + import org.rubypeople.rdt.core.IRubyElement; + import org.rubypeople.rdt.core.IRubyProject; + import org.rubypeople.rdt.core.RubyCore; + import org.rubypeople.rdt.core.formatter.DefaultCodeFormatterConstants; + import org.rubypeople.rdt.internal.corext.util.CodeFormatterUtil; import org.rubypeople.rdt.internal.ui.RubyPlugin; + import org.rubypeople.rdt.internal.ui.rubyeditor.IRubyScriptDocumentProvider; import org.rubypeople.rdt.internal.ui.rubyeditor.RubyAbstractEditor; import org.rubypeople.rdt.internal.ui.text.HTMLTextPresenter; import org.rubypeople.rdt.internal.ui.text.IRubyColorConstants; *************** *** 379,393 **** } public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { ! if (!(fTextEditor instanceof RubyEditor)) { return super.getIndentPrefixes(sourceViewer, ! contentType); } ! if (sourceViewer instanceof RubySourceViewer) { ! RubySourceViewer viewer = (RubySourceViewer) sourceViewer; ! if (viewer.isTabReplacing()) { return new String[] { viewer.getIndentString(), ! "\t", " "}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ! } ! } ! return super.getIndentPrefixes(sourceViewer, contentType); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, --- 387,456 ---- } + private IRubyProject getProject() { + ITextEditor editor= getEditor(); + if (editor == null) + return null; + + IRubyElement element= null; + IEditorInput input= editor.getEditorInput(); + IDocumentProvider provider= editor.getDocumentProvider(); + if (provider instanceof IRubyScriptDocumentProvider) { + IRubyScriptDocumentProvider cudp= (IRubyScriptDocumentProvider) provider; + element= cudp.getWorkingCopy(input); + } + + if (element == null) + return null; + + return element.getRubyProject(); + } + public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) { ! ! Vector vector= new Vector(); ! ! // prefix[0] is either '\t' or ' ' x tabWidth, depending on useSpaces ! ! IRubyProject project= getProject(); ! final int tabWidth= CodeFormatterUtil.getTabWidth(project); ! final int indentWidth= CodeFormatterUtil.getIndentWidth(project); ! int spaceEquivalents= Math.min(tabWidth, indentWidth); ! boolean useSpaces; ! if (project == null) ! useSpaces= RubyCore.SPACE.equals(RubyCore.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR)) || tabWidth > indentWidth; ! else ! useSpaces= RubyCore.SPACE.equals(project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, true)) || tabWidth > indentWidth; ! ! for (int i= 0; i <= spaceEquivalents; i++) { ! StringBuffer prefix= new StringBuffer(); ! ! if (useSpaces) { ! for (int j= 0; j + i < spaceEquivalents; j++) ! prefix.append(' '); ! ! if (i != 0) ! prefix.append('\t'); ! } else { ! for (int j= 0; j < i; j++) ! prefix.append(' '); ! ! if (i != spaceEquivalents) ! prefix.append('\t'); ! } ! ! vector.add(prefix.toString()); ! } ! ! vector.add(""); //$NON-NLS-1$ ! ! return (String[]) vector.toArray(new String[vector.size()]); } + + /* + * @see SourceViewerConfiguration#getTabWidth(ISourceViewer) + */ + public int getTabWidth(ISourceViewer sourceViewer) { + return CodeFormatterUtil.getTabWidth(getProject()); + } public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, |
|
From: Markus B. <mba...@us...> - 2006-05-01 21:16:15
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14742 Removed Files: TODO.txt Log Message: see trac --- TODO.txt DELETED --- |
|
From: Markus B. <mba...@us...> - 2006-05-01 21:14:38
|
Update of /cvsroot/rubyeclipse/CVSROOT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13496 Modified Files: commitinfo Log Message: activate cvs_acls which uses the avail config file Index: commitinfo =================================================================== RCS file: /cvsroot/rubyeclipse/CVSROOT/commitinfo,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** commitinfo 1 Apr 2002 21:12:09 -0000 1.1 --- commitinfo 1 May 2006 21:14:33 -0000 1.2 *************** *** 14,15 **** --- 14,17 ---- # If the name "ALL" appears as a regular expression it is always used # in addition to the first matching regex or "DEFAULT". + + ALL /cvsroot/sitedocs/CVSROOT/cvstools/cvs_acls \ No newline at end of file |
|
From: Markus B. <mba...@us...> - 2006-05-01 21:13:45
|
Update of /cvsroot/rubyeclipse/CVSROOT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12772 Modified Files: checkoutlist Added Files: avail Log Message: positive avail list for access control (allows to add users with read-only access) Index: checkoutlist =================================================================== RCS file: /cvsroot/rubyeclipse/CVSROOT/checkoutlist,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** checkoutlist 1 Apr 2002 21:12:09 -0000 1.1 --- checkoutlist 1 May 2006 21:13:41 -0000 1.2 *************** *** 12,13 **** --- 12,14 ---- # # comment lines begin with '#' + avail --- NEW FILE: avail --- unavail avail|awilliams,cawilliams,dcorbin,kyleshank,mbarchfe,zdennis |
|
From: Markus B. <mba...@us...> - 2006-04-27 21:25:33
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.build/cruiseControl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30383 Modified Files: build-RDT.xml Log Message: added 0.8.0 target Index: build-RDT.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.build/cruiseControl/build-RDT.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build-RDT.xml 9 Apr 2006 23:42:44 -0000 1.5 --- build-RDT.xml 27 Apr 2006 21:25:29 -0000 1.6 *************** *** 60,63 **** --- 60,69 ---- </target> + <target name="0.8.0"> + <property name="cvsLabel" value="R2006-04-27_0-8-0"/> + <property name="label" value="0.8.0.604272100PRD"/> + <antcall target="release"/> + </target> + <target name="0.8.0.RC1"> <property name="cvsLabel" value="R2006-04-09_0-8-0_RC1"/> |
|
From: Markus B. <mba...@us...> - 2006-04-27 20:34:51
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.webpage/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18390/htdocs Modified Files: menu.php welcome.php Log Message: r0.8.0 Index: menu.php =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.webpage/htdocs/menu.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** menu.php 3 Jan 2005 20:21:19 -0000 1.3 --- menu.php 27 Apr 2006 20:34:46 -0000 1.4 *************** *** 23,27 **** <div class="menuEntry"> ! <a href="userdoc/html/index.html" target="rdtdoc"><img src="images/docs.gif" border="0" alt="Documentation"></a> </div> --- 23,27 ---- <div class="menuEntry"> ! <a href="http://download.rubypeople.org/release/0.8.0.604272100PRD/doc/html/index.html" target="rdtdoc"><img src="images/docs.gif" border="0" alt="Documentation"></a> </div> Index: welcome.php =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.webpage/htdocs/welcome.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** welcome.php 29 Dec 2005 09:47:33 -0000 1.7 --- welcome.php 27 Apr 2006 20:34:46 -0000 1.8 *************** *** 34,37 **** --- 34,56 ---- <tr> <td align="right" valign="top" width="20"><img src="images/arrow.gif" alt="->" border="0" height="16" width="16"></td> + <td valign="top"><font face="arial,helvetica,geneva" size="-1"><b>0.8.0 Released (2005-12-29)</b> + <br/> + The best news about this release is the Ruby Browsing perspective. Then there is the New Class wizard and + improvements on template handling and syntax highlighting. + The complete <a href="http://download.rubypeople.org/nightly/Changelog.txt">Changelog</a>. + + RDT 0.8.0 runs with Eclipse 3.1 and 3.2 (tested with RC1a). + + You definitely should <a href="http://rubyeclipse.sourceforge.net/download.rdt.html">download and install</a>. This build is available in the integration and release stream. + + + + + </font> + </td> + </tr> + + <tr> + <td align="right" valign="top" width="20"><img src="images/arrow.gif" alt="->" border="0" height="16" width="16"></td> <td valign="top"><font face="arial,helvetica,geneva" size="-1"><b>0.7.0 Release Candidate (2005-12-29)</b> <br/> |
|
From: Markus B. <mba...@us...> - 2006-04-27 18:40:22
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.doc.user In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13111 Modified Files: docbook.xml Log Message: removed upgrading to 0.6.0, added Ruby Browsing perspective Index: docbook.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.doc.user/docbook.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** docbook.xml 18 Sep 2005 18:46:03 -0000 1.19 --- docbook.xml 27 Apr 2006 18:40:17 -0000 1.20 *************** *** 3,42 **** <book> <title>Ruby Development Tools</title> - <chapter id="UpgradingTo0.6.0"> - <title>Upgrading to 0.6.0</title> - <para> - Version 0.6.0 introduces some changes to the way projects and workspace - information is represented. The changes that the user must make, and those that - happen automatically are documented here. - </para> - <section> - <title>Ruby Interpreter</title> - <para> - In versions prior to 0.6.0, ruby interpreters were specified in - the preferences page by specifying a the directory that contains - the ruby executable. Now interpreters are specified by providing - the actual ruby file, not the directory. Until edit these - preferences you will not be able to run or debug ruby applications - and tests. - </para> - </section> - <section> - <title>Ruby Project file</title> - <para> - RDT now requires a builder in the .project file for ruby projects. - When RDT is loaded, (or when a project is opened), ruby projects will - be automatically upgraded. - </para> - </section> - <section> - <title>Ruby Perspective</title> - <para> - The ruby perspective now includes the standard Eclipse views for - Problems and Tasks. Because these were not used by RDT in previous - versions, RDT will automatically show these views if a project is - upgraded. - </para> - </section> - </chapter> <chapter id="GettingStarted"> <title>Getting Started</title> --- 3,6 ---- *************** *** 133,136 **** --- 97,116 ---- </itemizedlist> </section> + <section id="RubyPerspectives_RubyBrowsing"> + <title>Ruby Browsing</title> + <para>A perspective designed for browsing the classes in your workspace. + The browsing is organized with three interconnected views: + </para> + <itemizedlist> + <listitem> Projects </listitem> + <listitem> Types </listitem> + <listitem> Members </listitem> + </itemizedlist> + Every view contains a tree view with a hierarchy of Ruby elements. The project view shows all + projects of the workspace. The selection of projects influences the content of the Types view. + In the same manner an element selection in the Types view shows its containing elements in the + Members view. + Double clicking elements which are file based opens an editor and highlights the position of the element. + </section> </section> <section id="RubyResourcesView"> |
|
From: Markus B. <mba...@us...> - 2006-04-25 22:22:23
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5134/src/org/rubypeople/rdt/internal/formatter Modified Files: OldCodeFormatter.java AbstractBlockMarker.java NoFormattingMarker.java IndentationState.java NeutralMarker.java FixLengthMarker.java Log Message: Cleaned up IndentationState, fixed errors in test suite Index: IndentationState.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/IndentationState.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IndentationState.java 10 Feb 2006 18:32:41 -0000 1.2 --- IndentationState.java 25 Apr 2006 22:22:18 -0000 1.3 *************** *** 1,26 **** package org.rubypeople.rdt.internal.formatter; public class IndentationState { ! private int lastIndentation ; private int indentationLevel ; - private int indentationLength ; private int offset ; private int pos ; ! private int indentation ; private String unformattedText ; ! public IndentationState(String unformattedText, int indentationLength, int offset, int initialIndentLevel) { this.unformattedText = unformattedText ; ! this.indentationLength = indentationLength ; ! this.offset = offset; ! indentationLevel = initialIndentLevel; pos = 0 ; ! this.calculateIndentation() ; } public void decIndentationLevel() { ! indentationLevel -= 1 ; ! this.calculateIndentation() ; } --- 1,33 ---- package org.rubypeople.rdt.internal.formatter; + import java.util.Map; + + import org.rubypeople.rdt.core.formatter.Indents; public class IndentationState { ! private String lastIndentationBasedOnLevel = ""; private int indentationLevel ; private int offset ; private int pos ; ! ! // indentation for parameter over multiple lines, like ! // method(param1 ! // .......param2) ! private int fixIndentation ; ! private String unformattedText ; + ! public IndentationState(String unformattedText, int offset, int initialIndentLevel) { this.unformattedText = unformattedText ; ! this.offset = offset ; ! indentationLevel = initialIndentLevel ; pos = 0 ; ! resetFixIndentation() ; } public void decIndentationLevel() { ! indentationLevel -= 1 ; ! resetFixIndentation() ; } *************** *** 28,32 **** public void incIndentationLevel() { indentationLevel += 1 ; ! this.calculateIndentation() ; } --- 35,39 ---- public void incIndentationLevel() { indentationLevel += 1 ; ! resetFixIndentation() ; } *************** *** 35,49 **** } ! public void calculateIndentation() { ! indentation = offset + indentationLength * indentationLevel ; ! } ! ! public int getIndentation() { ! return indentation; } ! public int getIndentationLength() { ! return indentationLength; } --- 42,52 ---- } ! public void resetFixIndentation() { ! fixIndentation = -1 ; } ! public int getIndentation() { ! return fixIndentation; } *************** *** 69,74 **** ! public void setIndentation(int indentation) { ! this.indentation = indentation; } --- 72,77 ---- ! public void setFixIndentation(int indentation) { ! this.fixIndentation = indentation; } *************** *** 76,80 **** public void setIndentationLevel(int indentationLevel) { this.indentationLevel = indentationLevel; ! this.calculateIndentation() ; } --- 79,83 ---- public void setIndentationLevel(int indentationLevel) { this.indentationLevel = indentationLevel; ! this.resetFixIndentation() ; } *************** *** 82,86 **** public void setOffset(int offset) { this.offset = offset; ! this.calculateIndentation() ; } --- 85,89 ---- public void setOffset(int offset) { this.offset = offset; ! this.resetFixIndentation() ; } *************** *** 90,100 **** } ! public void saveIndentation() { ! this.lastIndentation = indentation ; } - public int getLastIndentation() { - return lastIndentation ; - } } --- 93,112 ---- } ! protected String getIndentationString(Map options) { ! StringBuffer sb = new StringBuffer() ; ! for (int i = 0; i < this.getOffset(); i++) { ! sb.append(" "); ! } ! if (this.getIndentation() != -1) { ! sb.append(lastIndentationBasedOnLevel) ; ! sb.append(Indents.createFixIndentString(this.getIndentation(), options)); ! } ! else { ! lastIndentationBasedOnLevel = Indents.createIndentString(this.getIndentationLevel(), options); ! sb.append(lastIndentationBasedOnLevel) ; ! } ! return sb.toString() ; } } Index: AbstractBlockMarker.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/AbstractBlockMarker.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractBlockMarker.java 10 Feb 2006 18:32:41 -0000 1.2 --- AbstractBlockMarker.java 25 Apr 2006 22:22:18 -0000 1.3 *************** *** 3,8 **** import java.util.Map; - import org.rubypeople.rdt.core.formatter.Indents; - public abstract class AbstractBlockMarker { protected int pos; --- 3,6 ---- *************** *** 39,48 **** public void appendIndentedLine(StringBuffer sb, IndentationState state, String originalLine, String strippedLine, Map options) { ! String spaces = ""; ! for (int i = 0; i < state.getOffset(); i++) { ! spaces+= " "; ! } ! sb.append(spaces); ! sb.append(Indents.createIndentString(state.getIndentationLevel(), options)); sb.append(strippedLine); } --- 37,41 ---- public void appendIndentedLine(StringBuffer sb, IndentationState state, String originalLine, String strippedLine, Map options) { ! sb.append(state.getIndentationString(options)); sb.append(strippedLine); } Index: NeutralMarker.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/NeutralMarker.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NeutralMarker.java 11 Apr 2003 22:12:10 -0000 1.1 --- NeutralMarker.java 25 Apr 2006 22:22:18 -0000 1.2 *************** *** 14,18 **** protected void indentBeforePrint(IndentationState state) { ! state.calculateIndentation() ; } --- 14,18 ---- protected void indentBeforePrint(IndentationState state) { ! state.resetFixIndentation() ; } Index: NoFormattingMarker.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/NoFormattingMarker.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NoFormattingMarker.java 11 Apr 2003 22:12:10 -0000 1.1 --- NoFormattingMarker.java 25 Apr 2006 22:22:18 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- package org.rubypeople.rdt.internal.formatter; + import java.util.Map; + public class NoFormattingMarker extends AbstractBlockMarker { *************** *** 25,29 **** } ! public void appendIndentedLine(StringBuffer sb, IndentationState state, String originalLine, String strippedLine) { sb.append(originalLine) ; } --- 27,31 ---- } ! public void appendIndentedLine(StringBuffer sb, IndentationState state, String originalLine, String strippedLine, Map options) { sb.append(originalLine) ; } Index: OldCodeFormatter.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OldCodeFormatter.java 22 Feb 2006 20:03:37 -0000 1.3 --- OldCodeFormatter.java 25 Apr 2006 22:22:18 -0000 1.4 *************** *** 131,136 **** int leadingWhitespace = whitespaceMatcher.end(0); if (state == null) { ! state = new IndentationState(unformatted, preferences.indentation_size, ! leadingWhitespace, initialIndentLevel); } state.incPos(leadingWhitespace); --- 131,135 ---- int leadingWhitespace = whitespaceMatcher.end(0); if (state == null) { ! state = new IndentationState(unformatted, leadingWhitespace, initialIndentLevel); } state.incPos(leadingWhitespace); *************** *** 141,145 **** newBlockMarker.indentBeforePrint(state); newBlockMarker.appendIndentedLine(formatted, state, lines[i], strippedLine, options); - state.saveIndentation(); newBlockMarker.indentAfterPrint(state); abstractBlockMarker = newBlockMarker; --- 140,143 ---- Index: FixLengthMarker.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/FixLengthMarker.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FixLengthMarker.java 11 Apr 2003 22:12:10 -0000 1.1 --- FixLengthMarker.java 25 Apr 2006 22:22:18 -0000 1.2 *************** *** 34,38 **** protected void indentBeforePrint(IndentationState state) { ! state.setIndentation(state.getLastIndentation() + this.getPosInLine(state)) ; } --- 34,38 ---- protected void indentBeforePrint(IndentationState state) { ! state.setFixIndentation(this.getPosInLine(state)) ; } |
|
From: Markus B. <mba...@us...> - 2006-04-25 22:22:23
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5134/src/org/rubypeople/rdt/core/formatter Modified Files: Indents.java Log Message: Cleaned up IndentationState, fixed errors in test suite Index: Indents.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/formatter/Indents.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Indents.java 10 Feb 2006 18:27:42 -0000 1.1 --- Indents.java 25 Apr 2006 22:22:18 -0000 1.2 *************** *** 118,121 **** --- 118,160 ---- } + public static String createFixIndentString(int fixIndentation, Map options) { + if (options == null || fixIndentation < 0) { + throw new IllegalArgumentException(); + } + + String tabChar= getStringValue(options, DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, RubyCore.TAB); + + final int tabs, spaces; + if (RubyCore.SPACE.equals(tabChar)) { + tabs= 0; + spaces= fixIndentation; + } else if (RubyCore.TAB.equals(tabChar)) { + int tabWidth= getTabWidth(options); + tabs= fixIndentation / tabWidth; + spaces= 0; + } else if (DefaultCodeFormatterConstants.MIXED.equals(tabChar)){ + int tabWidth= getTabWidth(options); + if (tabWidth > 0) { + tabs= fixIndentation / tabWidth; + spaces= fixIndentation % tabWidth; + } else { + tabs= 0; + spaces= fixIndentation; + } + } else { + // new indent type not yet handled + Assert.isTrue(false); + return null; + } + + StringBuffer buffer= new StringBuffer(tabs + spaces); + for(int i= 0; i < tabs; i++) + buffer.append('\t'); + for(int i= 0; i < spaces; i++) + buffer.append(' '); + return buffer.toString(); + + } + private static String getStringValue(Map options, String key, String def) { Object value= options.get(key); |
|
From: Markus B. <mba...@us...> - 2006-04-25 22:22:21
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5072/src/org/rubypeople/rdt/internal/formatter Modified Files: FormatTestData.xml Log Message: Cleaned up IndentationState, fixed errors in test suite Index: FormatTestData.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/formatter/FormatTestData.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FormatTestData.xml 10 Feb 2006 19:59:55 -0000 1.4 --- FormatTestData.xml 25 Apr 2006 22:22:12 -0000 1.5 *************** *** 327,331 **** def x(a ! b) x end --- 327,332 ---- def x(a ! b, ! c) x end *************** *** 334,338 **** def x(a ! b) x end --- 335,340 ---- def x(a ! b, ! c) x end |
|
From: Christopher W. <caw...@us...> - 2006-04-24 21:30:05
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25830 Modified Files: Changelog.txt Log Message: Index: Changelog.txt =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt/Changelog.txt,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Changelog.txt 9 Apr 2006 12:53:36 -0000 1.22 --- Changelog.txt 24 Apr 2006 21:29:59 -0000 1.23 *************** *** 1,11 **** ! Changes since 0.7.0: * New Ruby Browsing Perspective * New Class Wizard * Apply code formatting (indentation) to templates * Distinct syntax highlighting of globals * Distinct syntax highlighting of instance/class variables * Goto matching bracket action * Right-clicking on "ruler" to left of ruby file's contents now allows user to add bookmark or task ! * Attempts to set ruby interpreter to common install location if no interpreter has been set * A number of bugfixes (see http://rubyeclipse.mktec.com/cgi-bin/trac.py/query?status=closed&milestone=0.8.0&type=defect&order=priority) --- 1,15 ---- ! Release 0.8.0: ! * Compatible with Eclipse 3.1 and 3.2 * New Ruby Browsing Perspective * New Class Wizard * Apply code formatting (indentation) to templates + * Auto-insertion of templates * Distinct syntax highlighting of globals * Distinct syntax highlighting of instance/class variables * Goto matching bracket action * Right-clicking on "ruler" to left of ruby file's contents now allows user to add bookmark or task ! * Auto-extend comments under particular conditions (abov method/class/module definitions, above attr_, above alias, above constant assignment, as first lines of file) ! * Allow user to customize font used by Ruby Editor ! * Allow user to turn on/off smart auto-closing of strings, brackets and braces on new preference page (was always enabled by default before) * A number of bugfixes (see http://rubyeclipse.mktec.com/cgi-bin/trac.py/query?status=closed&milestone=0.8.0&type=defect&order=priority) |
|
From: Christopher W. <caw...@us...> - 2006-04-24 21:24:24
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21910/src/org/rubypeople/rdt/internal/ui/text/comment Added Files: RubyCommentAutoIndentStrategy.java Log Message: implement ticket #74 - auto-extend comments under particular conditions --- NEW FILE: RubyCommentAutoIndentStrategy.java --- package org.rubypeople.rdt.internal.ui.text.comment; import org.eclipse.jface.text.Assert; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.TextUtilities; public class RubyCommentAutoIndentStrategy extends DefaultIndentLineAutoEditStrategy { private String fPartitioning; public RubyCommentAutoIndentStrategy(String partitioning) { fPartitioning = partitioning; } public void customizeDocumentCommand(IDocument document, DocumentCommand command) { if (command.text != null) { if (command.length == 0) { String[] lineDelimiters = document.getLegalLineDelimiters(); int index = TextUtilities .endsWith(lineDelimiters, command.text); if (index > -1) { // ends with line delimiter if (lineDelimiters[index].equals(command.text)) // just the line delimiter indentAfterNewLine(document, command); return; } } } } /** * Copies the indentation of the previous line and adds a #. * * @param d * the document to work on * @param c * the command to deal with */ private void indentAfterNewLine(IDocument d, DocumentCommand c) { int offset = c.offset; if (offset == -1 || d.getLength() == 0) return; try { int p = (offset == d.getLength() ? offset - 1 : offset); int lineNumber = d.getLineOfOffset(p); IRegion line = d.getLineInformation(lineNumber); if (lineNumber != 0) { // If first line, extend the comment String nextLine = getLine(d, lineNumber + 1); // otherwise check next line if (!(isComment(nextLine) || isClassDefinition(nextLine) || isMethodDeclaration(nextLine) || isAttributeCall(nextLine) || isAliasCall(nextLine) || isModuleDeclaration(nextLine) || isConstantAssignment(nextLine))) { // if next line is commonly documented element, continue comment String previousLine = getLine(d, lineNumber - 1); if (!isComment(previousLine)) // last, if the previous line was a comment (so two lines in a row now), extend comments return; } } int lineOffset = line.getOffset(); int firstNonWS = findEndOfWhiteSpace(d, lineOffset, offset); Assert.isTrue(firstNonWS >= lineOffset, "indentation must not be negative"); //$NON-NLS-1$ StringBuffer buf = new StringBuffer(c.text); IRegion prefix = findPrefixRange(d, line); String indentation = d.get(prefix.getOffset(), prefix.getLength()); int lengthToAdd = Math.min(offset - prefix.getOffset(), prefix .getLength()); buf.append(indentation.substring(0, lengthToAdd)); // move the caret behind the prefix, even if we do not have to // insert it. if (lengthToAdd < prefix.getLength()) c.caretOffset = offset + prefix.getLength() - lengthToAdd; c.text = buf.toString(); } catch (BadLocationException excp) { // stop work } } private boolean isComment(String nextLineText) { return nextLineText.matches("^\\s*#.*"); } private boolean isClassDefinition(String nextLineText) { return nextLineText.matches("^\\s*class\\s+.+\\s*"); } private boolean isAliasCall(String nextLineText) { return nextLineText.matches("^\\s*alias\\s+.+\\s*"); } private boolean isModuleDeclaration(String nextLineText) { return nextLineText.matches("^\\s*module\\s+.+\\s*"); } private boolean isMethodDeclaration(String nextLineText) { return nextLineText.matches("^\\s*def\\s+.+\\s*"); } private boolean isAttributeCall(String nextLineText) { return nextLineText.matches("^\\s*attr.+\\s*"); } private boolean isConstantAssignment(String nextLineText) { return nextLineText.matches("^\\s*[A-Z_]+\\s?=\\s+.+\\s*"); } private String getLine(IDocument d, int lineNum) throws BadLocationException { IRegion nextLineRegion = d.getLineInformation(lineNum + 1); return d.get(nextLineRegion.getOffset(), nextLineRegion.getLength()); } /** * Returns the range of the comment prefix on the given line in * <code>document</code>. The prefix greedily matches the following regex * pattern: <code>\w*#\w*</code>, that is, any number of whitespace * characters, followed by an pound symbol ('#'), followed by any number of * whitespace characters. * * @param document * the document to which <code>line</code> refers * @param line * the line from which to extract the prefix range * @return an <code>IRegion</code> describing the range of the prefix on * the given line * @throws BadLocationException * if accessing the document fails */ private IRegion findPrefixRange(IDocument document, IRegion line) throws BadLocationException { int lineOffset = line.getOffset(); int lineEnd = lineOffset + line.getLength(); int indentEnd = findEndOfWhiteSpace(document, lineOffset, lineEnd); if (indentEnd < lineEnd && document.getChar(indentEnd) == '#') { indentEnd++; while (indentEnd < lineEnd && document.getChar(indentEnd) == ' ') indentEnd++; } return new Region(lineOffset, indentEnd - lineOffset); } } |
|
From: Christopher W. <caw...@us...> - 2006-04-24 21:24:24
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21910/src/org/rubypeople/rdt/ui/text Modified Files: RubySourceViewerConfiguration.java Log Message: implement ticket #74 - auto-extend comments under particular conditions Index: RubySourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RubySourceViewerConfiguration.java 12 Apr 2006 21:26:25 -0000 1.4 --- RubySourceViewerConfiguration.java 24 Apr 2006 21:24:21 -0000 1.5 *************** *** 4,7 **** --- 4,8 ---- import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.DefaultInformationControl; + import org.eclipse.jface.text.IAutoEditStrategy; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IInformationControl; *************** *** 43,46 **** --- 44,48 ---- import org.rubypeople.rdt.internal.ui.text.RubyReconciler; import org.rubypeople.rdt.internal.ui.text.comment.CommentFormattingStrategy; + import org.rubypeople.rdt.internal.ui.text.comment.RubyCommentAutoIndentStrategy; import org.rubypeople.rdt.internal.ui.text.ruby.AbstractRubyScanner; import org.rubypeople.rdt.internal.ui.text.ruby.RubyCodeScanner; *************** *** 321,324 **** --- 323,334 ---- return new RubyAnnotationHover(RubyAnnotationHover.VERTICAL_RULER_HOVER); } + + public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) { + String partitioning= getConfiguredDocumentPartitioning(sourceViewer); + if (IRubyPartitions.RUBY_SINGLE_LINE_COMMENT.equals(contentType)) + return new IAutoEditStrategy[] { new RubyCommentAutoIndentStrategy(partitioning) }; + else + return super.getAutoEditStrategies(sourceViewer, contentType); + } /* |
|
From: Christopher W. <caw...@us...> - 2006-04-24 21:24:23
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21910/src/org/rubypeople/rdt/internal/ui/text Modified Files: RubyPartitionScanner.java Log Message: implement ticket #74 - auto-extend comments under particular conditions Index: RubyPartitionScanner.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RubyPartitionScanner.java 12 Dec 2005 19:59:58 -0000 1.10 --- RubyPartitionScanner.java 24 Apr 2006 21:24:21 -0000 1.11 *************** *** 16,22 **** ! public final static String RUBY_STRING = "partition_scanner_ruby_string"; ! public final static String RUBY_MULTI_LINE_COMMENT = "partition_scanner_ruby_multiline_comment"; ! public static final String RUBY_SINGLE_LINE_COMMENT = "partition_scanner_ruby_singleline_comment"; public static final String RUBY_REGULAR_EXPRESSION = "partition_scanner_ruby_regular_expression"; public static final String RUBY_COMMAND = "partition_scanner_ruby_command"; --- 16,22 ---- ! public final static String RUBY_STRING = IRubyPartitions.RUBY_STRING; ! public final static String RUBY_MULTI_LINE_COMMENT = IRubyPartitions.RUBY_MULTI_LINE_COMMENT; ! public static final String RUBY_SINGLE_LINE_COMMENT = IRubyPartitions.RUBY_SINGLE_LINE_COMMENT; public static final String RUBY_REGULAR_EXPRESSION = "partition_scanner_ruby_regular_expression"; public static final String RUBY_COMMAND = "partition_scanner_ruby_command"; |