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...> - 2005-12-13 20:01:58
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8284/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyDocumentProvider.java Log Message: implement Ticket #46 (Update code folding on current working copy/editor) Index: RubyDocumentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyDocumentProvider.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** RubyDocumentProvider.java 18 Sep 2005 15:17:42 -0000 1.20 --- RubyDocumentProvider.java 13 Dec 2005 20:01:50 -0000 1.21 *************** *** 218,222 **** try { synchronized (info.fCopy) { ! info.fCopy.reconcile(null, subMonitor); } } catch (RubyModelException ex) { --- 218,222 ---- try { synchronized (info.fCopy) { ! info.fCopy.reconcile(false, null, subMonitor); } } catch (RubyModelException ex) { |
|
From: Christopher W. <caw...@us...> - 2005-12-13 20:01:37
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8207/src/org/rubypeople/rdt/internal/core Modified Files: TC_LoadPathEntry.java Log Message: implement Ticket #46 (Update code folding on current working copy/editor) Index: TC_LoadPathEntry.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/TC_LoadPathEntry.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TC_LoadPathEntry.java 1 Sep 2004 02:11:27 -0000 1.2 --- TC_LoadPathEntry.java 13 Dec 2005 20:01:29 -0000 1.3 *************** *** 14,18 **** public void testToXml() { ShamProject project = new ShamProject(new Path("myLocation"), "MyProject"); ! LoadPathEntry entry = new LoadPathEntry(project); String expected = "<pathentry type=\"project\" path=\"myLocation\"/>"; --- 14,18 ---- public void testToXml() { ShamProject project = new ShamProject(new Path("myLocation"), "MyProject"); ! LoadpathEntry entry = new LoadpathEntry(project); String expected = "<pathentry type=\"project\" path=\"myLocation\"/>"; |
|
From: Christopher W. <caw...@us...> - 2005-12-13 20:00:00
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7549/src/org/rubypeople/rdt/internal/core/util Modified Files: Util.java CharOperation.java Added Files: Messages.java Log Message: implement Ticket #46 (Update code folding on current working copy/editor) Index: CharOperation.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/CharOperation.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CharOperation.java 2 Mar 2005 00:53:59 -0000 1.2 --- CharOperation.java 13 Dec 2005 19:59:47 -0000 1.3 *************** *** 669,671 **** --- 669,735 ---- return -1; } + + /** + * Answers true if the two arrays are identical character by character, otherwise false. + * The equality is case sensitive. + * <br> + * <br> + * For example: + * <ol> + * <li><pre> + * first = null + * second = null + * result => true + * </pre> + * </li> + * <li><pre> + * first = { { } } + * second = null + * result => false + * </pre> + * </li> + * <li><pre> + * first = { { 'a' } } + * second = { { 'a' } } + * result => true + * </pre> + * </li> + * <li><pre> + * first = { { 'A' } } + * second = { { 'a' } } + * result => false + * </pre> + * </li> + * </ol> + * @param first the first array + * @param second the second array + * @return true if the two arrays are identical character by character, otherwise false + */ + public static final boolean equals(char[][] first, char[][] second) { + if (first == second) + return true; + if (first == null || second == null) + return false; + if (first.length != second.length) + return false; + + for (int i = first.length; --i >= 0;) + if (!equals(first[i], second[i])) + return false; + return true; + } + + public static final boolean equals(String[] first, String[] second) { + if (first == second) + return true; + if (first == null || second == null) + return false; + if (first.length != second.length) + return false; + + for (int i = first.length; --i >= 0;) + if (!first[i].equals(second[i])) + return false; + return true; + } } Index: Util.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Util.java 11 Mar 2005 01:59:47 -0000 1.4 --- Util.java 13 Dec 2005 19:59:47 -0000 1.5 *************** *** 13,17 **** --- 13,20 ---- import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; + import org.eclipse.core.runtime.Status; import org.rubypeople.rdt.core.RubyConventions; + import org.rubypeople.rdt.core.RubyCore; + import org.rubypeople.rdt.core.RubyModelException; /** *************** *** 21,268 **** public class Util { ! /* Bundle containing messages */ ! protected static ResourceBundle bundle; ! private final static String bundleName = "org.rubypeople.rdt.internal.core.util.messages"; //$NON-NLS-1$ ! private final static char[] DOUBLE_QUOTES = "''".toCharArray(); //$NON-NLS-1$ ! private final static char[] SINGLE_QUOTE = "'".toCharArray(); //$NON-NLS-1$ ! static { ! relocalize(); ! } ! private Util() { ! // cannot be instantiated ! } ! /** ! * Creates a NLS catalog for the given locale. ! */ ! public static void relocalize() { ! try { ! bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault()); ! } catch (MissingResourceException e) { ! System.out.println("Missing resource : " + bundleName.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$ ! throw e; ! } ! } ! /** ! * Lookup the message with the given ID in this catalog ! */ ! public static String bind(String id) { ! return bind(id, (String[]) null); ! } ! /** ! * Lookup the message with the given ID in this catalog and bind its ! * substitution locations with the given string values. ! */ ! public static String bind(String id, String[] arguments) { ! if (id == null) return "No message available"; //$NON-NLS-1$ ! String message = null; ! try { ! message = bundle.getString(id); ! } catch (MissingResourceException e) { ! // If we got an exception looking for the message, fail gracefully ! // by just returning ! // the id we were looking for. In most cases this is ! // semi-informative so is not too bad. ! return "Missing message: " + id + " in: " + bundleName; //$NON-NLS-2$ //$NON-NLS-1$ ! } ! // for compatibility with MessageFormat which eliminates double quotes ! // in original message ! char[] messageWithNoDoubleQuotes = CharOperation.replace(message.toCharArray(), DOUBLE_QUOTES, SINGLE_QUOTE); ! if (arguments == null) return new String(messageWithNoDoubleQuotes); ! int length = messageWithNoDoubleQuotes.length; ! int start = 0; ! int end = length; ! StringBuffer output = null; ! while (true) { ! if ((end = CharOperation.indexOf('{', messageWithNoDoubleQuotes, start)) > -1) { ! if (output == null) output = new StringBuffer(length + arguments.length * 20); ! output.append(messageWithNoDoubleQuotes, start, end - start); ! if ((start = CharOperation.indexOf('}', messageWithNoDoubleQuotes, end + 1)) > -1) { ! int index = -1; ! String argId = new String(messageWithNoDoubleQuotes, end + 1, start - end - 1); ! try { ! index = Integer.parseInt(argId); ! if (arguments[index] == null) { ! output.append('{').append(argId).append('}'); // leave ! // parameter ! // in ! // since ! // no ! // better ! // arg ! // '{0}' ! } else { ! output.append(arguments[index]); ! } ! } catch (NumberFormatException nfe) { // could be nested ! // message ID ! // {compiler.name} ! boolean done = false; ! if (!id.equals(argId)) { ! String argMessage = null; ! try { ! argMessage = bundle.getString(argId); ! output.append(argMessage); ! done = true; ! } catch (MissingResourceException e) { ! // unable to bind argument, ignore (will leave ! // argument in) ! } ! } ! if (!done) output.append(messageWithNoDoubleQuotes, end + 1, start - end); ! } catch (ArrayIndexOutOfBoundsException e) { ! output.append("{missing " + Integer.toString(index) + "}"); //$NON-NLS-2$ //$NON-NLS-1$ ! } ! start++; ! } else { ! output.append(messageWithNoDoubleQuotes, end, length); ! break; ! } ! } else { ! if (output == null) return new String(messageWithNoDoubleQuotes); ! output.append(messageWithNoDoubleQuotes, start, length - start); ! break; ! } ! } ! return output.toString(); ! } ! /** ! * Lookup the message with the given ID in this catalog and bind its ! * substitution locations with the given string. ! */ ! public static String bind(String id, String binding) { ! return bind(id, new String[] { binding}); ! } ! /** ! * Lookup the message with the given ID in this catalog and bind its ! * substitution locations with the given strings. ! */ ! public static String bind(String id, String binding1, String binding2) { ! return bind(id, new String[] { binding1, binding2}); ! } ! /* ! * Returns whether the given resource path matches one of the ! * inclusion/exclusion patterns. NOTE: should not be asked directly using ! * pkg root pathes ! * ! * @see IClasspathEntry#getInclusionPatterns ! * @see IClasspathEntry#getExclusionPatterns ! */ ! public final static boolean isExcluded(IPath resourcePath, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean isFolderPath) { ! if (inclusionPatterns == null && exclusionPatterns == null) return false; ! return isExcluded(resourcePath.toString().toCharArray(), inclusionPatterns, exclusionPatterns, isFolderPath); ! } ! /* ! * Returns whether the given resource matches one of the exclusion patterns. ! * NOTE: should not be asked directly using pkg root pathes ! * ! * @see IClasspathEntry#getExclusionPatterns ! */ ! public final static boolean isExcluded(IResource resource, char[][] inclusionPatterns, char[][] exclusionPatterns) { ! IPath path = resource.getFullPath(); ! // ensure that folders are only excluded if all of their children are ! // excluded ! return isExcluded(path, inclusionPatterns, exclusionPatterns, resource.getType() == IResource.FOLDER); ! } ! /* ! * TODO (philippe) should consider promoting it to CharOperation Returns ! * whether the given resource path matches one of the inclusion/exclusion ! * patterns. NOTE: should not be asked directly using pkg root pathes ! * ! * @see IClasspathEntry#getInclusionPatterns ! * @see IClasspathEntry#getExclusionPatterns ! */ ! public final static boolean isExcluded(char[] path, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean isFolderPath) { ! if (inclusionPatterns == null && exclusionPatterns == null) return false; ! inclusionCheck: if (inclusionPatterns != null) { ! for (int i = 0, length = inclusionPatterns.length; i < length; i++) { ! char[] pattern = inclusionPatterns[i]; ! char[] folderPattern = pattern; ! if (isFolderPath) { ! int lastSlash = CharOperation.lastIndexOf('/', pattern); ! if (lastSlash != -1 && lastSlash != pattern.length - 1) { // trailing ! // slash ! // -> ! // adds ! // '**' ! // for ! // free ! // (see ! // http://ant.apache.org/manual/dirtasks.html) ! int star = CharOperation.indexOf('*', pattern, lastSlash); ! if ((star == -1 || star >= pattern.length - 1 || pattern[star + 1] != '*')) { ! folderPattern = CharOperation.subarray(pattern, 0, lastSlash); ! } ! } ! } ! if (CharOperation.pathMatch(folderPattern, path, true, '/')) { ! break inclusionCheck; ! } ! } ! return true; // never included ! } ! if (isFolderPath) { ! path = CharOperation.concat(path, new char[] { '*'}, '/'); ! } ! exclusionCheck: if (exclusionPatterns != null) { ! for (int i = 0, length = exclusionPatterns.length; i < length; i++) { ! if (CharOperation.pathMatch(exclusionPatterns[i], path, true, '/')) { return true; } ! } ! } ! return false; ! } ! public static void verbose(String log) { ! verbose(log, System.out); ! } ! public static synchronized void verbose(String log, PrintStream printStream) { ! int start = 0; ! do { ! int end = log.indexOf('\n', start); ! printStream.print(Thread.currentThread()); ! printStream.print(" "); //$NON-NLS-1$ ! printStream.print(log.substring(start, end == -1 ? log.length() : end + 1)); ! start = end + 1; ! } while (start != 0); ! printStream.println(); ! } ! public static boolean isRubyLikeFileName(String name) { ! return name.endsWith(".rb") || name.endsWith(".rbw"); ! } ! /** ! * Validate the given compilation unit name. A compilation unit name must ! * obey the following rules: ! * <ul> ! * <li> it must not be null ! * <li> it must include the <code>".rb"</code> or <code>".rbw"</code> suffix ! * <li> its prefix must be a valid identifier ! * </ul> ! * </p> ! * ! * @param name ! * the name of a compilation unit ! * @return a status object with code <code>IStatus.OK</code> if the given ! * name is valid as a compilation unit name, otherwise a status ! * object indicating what is wrong with the name ! */ ! public static boolean isValidRubyScriptName(String name) { ! return RubyConventions.validateRubyScriptName(name).getSeverity() != IStatus.ERROR; ! } } --- 24,314 ---- public class Util { ! /* Bundle containing messages */ ! protected static ResourceBundle bundle; ! private final static String bundleName = "org.rubypeople.rdt.internal.core.util.messages"; //$NON-NLS-1$ ! private final static char[] DOUBLE_QUOTES = "''".toCharArray(); //$NON-NLS-1$ ! private final static char[] SINGLE_QUOTE = "'".toCharArray(); //$NON-NLS-1$ ! static { ! relocalize(); ! } ! private Util() { ! // cannot be instantiated ! } ! /** ! * Creates a NLS catalog for the given locale. ! */ ! public static void relocalize() { ! try { ! bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault()); ! } catch (MissingResourceException e) { ! System.out ! .println("Missing resource : " + bundleName.replace('.', '/') + ".properties for locale " + Locale.getDefault()); //$NON-NLS-1$//$NON-NLS-2$ ! throw e; ! } ! } ! /** ! * Lookup the message with the given ID in this catalog ! */ ! public static String bind(String id) { ! return bind(id, (String[]) null); ! } ! /** ! * Lookup the message with the given ID in this catalog and bind its ! * substitution locations with the given string values. ! */ ! public static String bind(String id, String[] arguments) { ! if (id == null) return "No message available"; //$NON-NLS-1$ ! String message = null; ! try { ! message = bundle.getString(id); ! } catch (MissingResourceException e) { ! // If we got an exception looking for the message, fail gracefully ! // by just returning ! // the id we were looking for. In most cases this is ! // semi-informative so is not too bad. ! return "Missing message: " + id + " in: " + bundleName; //$NON-NLS-2$ //$NON-NLS-1$ ! } ! // for compatibility with MessageFormat which eliminates double quotes ! // in original message ! char[] messageWithNoDoubleQuotes = CharOperation.replace(message.toCharArray(), ! DOUBLE_QUOTES, SINGLE_QUOTE); ! if (arguments == null) return new String(messageWithNoDoubleQuotes); ! int length = messageWithNoDoubleQuotes.length; ! int start = 0; ! int end = length; ! StringBuffer output = null; ! while (true) { ! if ((end = CharOperation.indexOf('{', messageWithNoDoubleQuotes, start)) > -1) { ! if (output == null) output = new StringBuffer(length + arguments.length * 20); ! output.append(messageWithNoDoubleQuotes, start, end - start); ! if ((start = CharOperation.indexOf('}', messageWithNoDoubleQuotes, end + 1)) > -1) { ! int index = -1; ! String argId = new String(messageWithNoDoubleQuotes, end + 1, start - end - 1); ! try { ! index = Integer.parseInt(argId); ! if (arguments[index] == null) { ! output.append('{').append(argId).append('}'); // leave ! // parameter ! // in ! // since ! // no ! // better ! // arg ! // '{0}' ! } else { ! output.append(arguments[index]); ! } ! } catch (NumberFormatException nfe) { // could be nested ! // message ID ! // {compiler.name} ! boolean done = false; ! if (!id.equals(argId)) { ! String argMessage = null; ! try { ! argMessage = bundle.getString(argId); ! output.append(argMessage); ! done = true; ! } catch (MissingResourceException e) { ! // unable to bind argument, ignore (will leave ! // argument in) ! } ! } ! if (!done) output.append(messageWithNoDoubleQuotes, end + 1, start - end); ! } catch (ArrayIndexOutOfBoundsException e) { ! output.append("{missing " + Integer.toString(index) + "}"); //$NON-NLS-2$ //$NON-NLS-1$ ! } ! start++; ! } else { ! output.append(messageWithNoDoubleQuotes, end, length); ! break; ! } ! } else { ! if (output == null) return new String(messageWithNoDoubleQuotes); ! output.append(messageWithNoDoubleQuotes, start, length - start); ! break; ! } ! } ! return output.toString(); ! } ! /** ! * Lookup the message with the given ID in this catalog and bind its ! * substitution locations with the given string. ! */ ! public static String bind(String id, String binding) { ! return bind(id, new String[] { binding}); ! } ! /** ! * Lookup the message with the given ID in this catalog and bind its ! * substitution locations with the given strings. ! */ ! public static String bind(String id, String binding1, String binding2) { ! return bind(id, new String[] { binding1, binding2}); ! } ! /* ! * Returns whether the given resource path matches one of the ! * inclusion/exclusion patterns. NOTE: should not be asked directly using ! * pkg root pathes ! * ! * @see IClasspathEntry#getInclusionPatterns ! * @see IClasspathEntry#getExclusionPatterns ! */ ! public final static boolean isExcluded(IPath resourcePath, char[][] inclusionPatterns, ! char[][] exclusionPatterns, boolean isFolderPath) { ! if (inclusionPatterns == null && exclusionPatterns == null) return false; ! return isExcluded(resourcePath.toString().toCharArray(), inclusionPatterns, ! exclusionPatterns, isFolderPath); ! } ! /* ! * Returns whether the given resource matches one of the exclusion patterns. ! * NOTE: should not be asked directly using pkg root pathes ! * ! * @see IClasspathEntry#getExclusionPatterns ! */ ! public final static boolean isExcluded(IResource resource, char[][] inclusionPatterns, ! char[][] exclusionPatterns) { ! IPath path = resource.getFullPath(); ! // ensure that folders are only excluded if all of their children are ! // excluded ! return isExcluded(path, inclusionPatterns, exclusionPatterns, ! resource.getType() == IResource.FOLDER); ! } ! /* ! * TODO (philippe) should consider promoting it to CharOperation Returns ! * whether the given resource path matches one of the inclusion/exclusion ! * patterns. NOTE: should not be asked directly using pkg root pathes ! * ! * @see IClasspathEntry#getInclusionPatterns ! * @see IClasspathEntry#getExclusionPatterns ! */ ! public final static boolean isExcluded(char[] path, char[][] inclusionPatterns, ! char[][] exclusionPatterns, boolean isFolderPath) { ! if (inclusionPatterns == null && exclusionPatterns == null) return false; ! inclusionCheck: if (inclusionPatterns != null) { ! for (int i = 0, length = inclusionPatterns.length; i < length; i++) { ! char[] pattern = inclusionPatterns[i]; ! char[] folderPattern = pattern; ! if (isFolderPath) { ! int lastSlash = CharOperation.lastIndexOf('/', pattern); ! if (lastSlash != -1 && lastSlash != pattern.length - 1) { // trailing ! // slash ! // -> ! // adds ! // '**' ! // for ! // free ! // (see ! // http://ant.apache.org/manual/dirtasks.html) ! int star = CharOperation.indexOf('*', pattern, lastSlash); ! if ((star == -1 || star >= pattern.length - 1 || pattern[star + 1] != '*')) { ! folderPattern = CharOperation.subarray(pattern, 0, lastSlash); ! } ! } ! } ! if (CharOperation.pathMatch(folderPattern, path, true, '/')) { ! break inclusionCheck; ! } ! } ! return true; // never included ! } ! if (isFolderPath) { ! path = CharOperation.concat(path, new char[] { '*'}, '/'); ! } ! exclusionCheck: if (exclusionPatterns != null) { ! for (int i = 0, length = exclusionPatterns.length; i < length; i++) { ! if (CharOperation.pathMatch(exclusionPatterns[i], path, true, '/')) { return true; } ! } ! } ! return false; ! } ! public static void verbose(String log) { ! verbose(log, System.out); ! } ! public static synchronized void verbose(String log, PrintStream printStream) { ! int start = 0; ! do { ! int end = log.indexOf('\n', start); ! printStream.print(Thread.currentThread()); ! printStream.print(" "); //$NON-NLS-1$ ! printStream.print(log.substring(start, end == -1 ? log.length() : end + 1)); ! start = end + 1; ! } while (start != 0); ! printStream.println(); ! } ! public static boolean isRubyLikeFileName(String name) { ! return name.endsWith(".rb") || name.endsWith(".rbw"); ! } ! /** ! * Validate the given compilation unit name. A compilation unit name must ! * obey the following rules: ! * <ul> ! * <li> it must not be null ! * <li> it must include the <code>".rb"</code> or <code>".rbw"</code> ! * suffix ! * <li> its prefix must be a valid identifier ! * </ul> ! * </p> ! * ! * @param name ! * the name of a compilation unit ! * @return a status object with code <code>IStatus.OK</code> if the given ! * name is valid as a compilation unit name, otherwise a status ! * object indicating what is wrong with the name ! */ ! public static boolean isValidRubyScriptName(String name) { ! return RubyConventions.validateRubyScriptName(name).getSeverity() != IStatus.ERROR; ! } ! ! /** ! * Compares two arrays using equals() on the elements. Either or both arrays ! * may be null. Returns true if both are null. Returns false if only one is ! * null. If both are arrays, returns true iff they have the same length and ! * all elements compare true with equals. ! */ ! public static boolean equalArraysOrNull(Object[] a, Object[] b) { ! if (a == b) return true; ! if (a == null || b == null) return false; ! ! int len = a.length; ! if (len != b.length) return false; ! for (int i = 0; i < len; ++i) { ! if (a[i] == null) { ! if (b[i] != null) return false; ! } else { ! if (!a[i].equals(b[i])) return false; ! } ! } ! return true; ! } ! ! /* ! * Add a log entry ! */ ! public static void log(Throwable e, String message) { ! Throwable nestedException; ! if (e instanceof RubyModelException ! && (nestedException = ((RubyModelException) e).getException()) != null) { ! e = nestedException; ! } ! IStatus status = new Status(IStatus.ERROR, RubyCore.PLUGIN_ID, IStatus.ERROR, message, e); ! RubyCore.getPlugin().getLog().log(status); ! } } --- NEW FILE: Messages.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.core.util; import java.text.MessageFormat; import org.eclipse.osgi.util.NLS; public final class Messages extends NLS { private static final String BUNDLE_NAME = "org.rubypeople.rdt.internal.core.util.messages";//$NON-NLS-1$ private Messages() { // Do not instantiate } public static String hierarchy_nullProject; public static String hierarchy_nullRegion; public static String hierarchy_nullFocusType; public static String hierarchy_creating; public static String hierarchy_creatingOnType; public static String element_doesNotExist; public static String element_notOnClasspath; public static String element_invalidClassFileName; public static String element_reconciling; public static String element_attachingSource; public static String element_invalidResourceForProject; public static String element_nullName; public static String element_nullType; public static String element_illegalParent; public static String sourcetype_invalidName; public static String operation_needElements; public static String operation_needName; public static String operation_needPath; public static String operation_needAbsolutePath; public static String operation_needString; public static String operation_notSupported; public static String operation_cancelled; public static String operation_nullContainer; public static String operation_nullName; public static String operation_copyElementProgress; public static String operation_moveElementProgress; public static String operation_renameElementProgress; public static String operation_copyResourceProgress; public static String operation_moveResourceProgress; public static String operation_renameResourceProgress; public static String operation_createUnitProgress; public static String operation_createFieldProgress; public static String operation_createImportsProgress; public static String operation_createInitializerProgress; public static String operation_createMethodProgress; public static String operation_createPackageProgress; public static String operation_createPackageFragmentProgress; public static String operation_createTypeProgress; public static String operation_deleteElementProgress; public static String operation_deleteResourceProgress; public static String operation_cannotRenameDefaultPackage; public static String operation_pathOutsideProject; public static String operation_sortelements; public static String workingCopy_commit; public static String build_preparingBuild; public static String build_readStateProgress; public static String build_saveStateProgress; public static String build_saveStateComplete; public static String build_readingDelta; public static String build_analyzingDeltas; public static String build_analyzingSources; public static String build_cleaningOutput; public static String build_copyingResources; public static String build_compiling; public static String build_foundHeader; public static String build_fixedHeader; public static String build_oneError; public static String build_oneWarning; public static String build_multipleErrors; public static String build_multipleWarnings; public static String build_done; public static String build_wrongFileFormat; public static String build_cannotSaveState; public static String build_cannotSaveStates; public static String build_initializationError; public static String build_serializationError; public static String build_classFileCollision; public static String build_duplicateClassFile; public static String build_duplicateResource; public static String build_inconsistentClassFile; public static String build_inconsistentProject; public static String build_incompleteClassPath; public static String build_missingSourceFile; public static String build_prereqProjectHasClasspathProblems; public static String build_prereqProjectMustBeRebuilt; public static String build_abortDueToClasspathProblems; public static String status_cannotUseDeviceOnPath; public static String status_coreException; public static String status_defaultPackageReadOnly; public static String status_evaluationError; public static String status_JDOMError; public static String status_IOException; public static String status_indexOutOfBounds; public static String status_invalidContents; public static String status_invalidDestination; public static String status_invalidName; public static String status_invalidPackage; public static String status_invalidPath; public static String status_invalidProject; public static String status_invalidResource; public static String status_invalidResourceType; public static String status_invalidSibling; public static String status_nameCollision; public static String status_noLocalContents; public static String status_OK; public static String status_readOnly; public static String status_targetException; public static String status_updateConflict; public static String classpath_buildPath; public static String classpath_cannotNestEntryInEntry; public static String classpath_cannotNestEntryInLibrary; public static String classpath_cannotNestEntryInOutput; public static String classpath_cannotNestOutputInEntry; public static String classpath_cannotNestOutputInOutput; public static String classpath_cannotReadClasspathFile; public static String classpath_cannotReferToItself; public static String classpath_cannotUseDistinctSourceFolderAsOutput; public static String classpath_cannotUseLibraryAsOutput; public static String classpath_closedProject; public static String classpath_couldNotWriteClasspathFile; public static String classpath_cycle; public static String classpath_duplicateEntryPath; public static String classpath_illegalContainerPath; public static String classpath_illegalEntryInClasspathFile; public static String classpath_illegalLibraryPath; public static String classpath_illegalLibraryArchive; public static String classpath_illegalExternalFolder; public static String classpath_illegalProjectPath; public static String classpath_illegalSourceFolderPath; public static String classpath_illegalVariablePath; public static String classpath_invalidClasspathInClasspathFile; public static String classpath_invalidContainer; public static String classpath_mustEndWithSlash; public static String classpath_unboundContainerPath; public static String classpath_unboundLibrary; public static String classpath_unboundProject; public static String classpath_settingOutputLocationProgress; public static String classpath_settingProgress; public static String classpath_unboundSourceAttachment; public static String classpath_unboundSourceFolder; public static String classpath_unboundVariablePath; public static String classpath_unknownKind; public static String classpath_xmlFormatError; public static String classpath_disabledInclusionExclusionPatterns; public static String classpath_disabledMultipleOutputLocations; public static String classpath_incompatibleLibraryJDKLevel; public static String classpath_duplicateEntryExtraAttribute; public static String file_notFound; public static String file_badFormat; public static String path_nullPath; public static String path_mustBeAbsolute; public static String cache_invalidLoadFactor; public static String savedState_jobName; public static String javamodel_initialization; public static String restrictedAccess_project; public static String restrictedAccess_library; public static String convention_unit_nullName; public static String convention_unit_notJavaName; public static String convention_classFile_nullName; public static String convention_classFile_notClassFileName; public static String convention_illegalIdentifier; public static String convention_import_nullImport; public static String convention_import_unqualifiedImport; public static String convention_type_nullName; public static String convention_type_nameWithBlanks; public static String convention_type_dollarName; public static String convention_type_lowercaseName; public static String convention_type_invalidName; public static String convention_package_nullName; public static String convention_package_emptyName; public static String convention_package_dotName; public static String convention_package_nameWithBlanks; public static String convention_package_consecutiveDotsName; public static String convention_package_uppercaseName; public static String dom_cannotDetail; public static String dom_nullTypeParameter; public static String dom_nullNameParameter; public static String dom_nullReturnType; public static String dom_nullExceptionType; public static String dom_mismatchArgNamesAndTypes; public static String dom_addNullChild; public static String dom_addIncompatibleChild; public static String dom_addChildWithParent; public static String dom_unableAddChild; public static String dom_addAncestorAsChild; public static String dom_addNullSibling; public static String dom_addSiblingBeforeRoot; public static String dom_addIncompatibleSibling; public static String dom_addSiblingWithParent; public static String dom_addAncestorAsSibling; public static String dom_addNullInterface; public static String dom_nullInterfaces; public static String correction_nullRequestor; public static String correction_nullUnit; public static String engine_searching; public static String engine_searching_indexing; public static String engine_searching_matching; public static String exception_wrongFormat; public static String process_name; public static String manager_filesToIndex; public static String manager_indexingInProgress; public static String disassembler_description; public static String disassembler_opentypedeclaration; public static String disassembler_closetypedeclaration; public static String disassembler_parametername; public static String disassembler_localvariablename; public static String disassembler_endofmethodheader; public static String disassembler_begincommentline; public static String disassembler_fieldhasconstant; public static String disassembler_endoffieldheader; public static String disassembler_sourceattributeheader; public static String disassembler_enclosingmethodheader; public static String disassembler_exceptiontableheader; public static String disassembler_linenumberattributeheader; public static String disassembler_localvariabletableattributeheader; public static String disassembler_localvariabletypetableattributeheader; public static String disassembler_arraydimensions; public static String disassembler_innerattributesheader; public static String disassembler_inner_class_info_name; public static String disassembler_outer_class_info_name; public static String disassembler_inner_name; public static String disassembler_inner_accessflags; public static String disassembler_genericattributeheader; public static String disassembler_signatureattributeheader; public static String disassembler_indentation; public static String disassembler_constantpoolindex; public static String disassembler_space; public static String disassembler_comma; public static String disassembler_openinnerclassentry; public static String disassembler_closeinnerclassentry; public static String disassembler_deprecated; public static String disassembler_constantpoolheader; public static String disassembler_constantpool_class; public static String disassembler_constantpool_double; public static String disassembler_constantpool_float; public static String disassembler_constantpool_integer; public static String disassembler_constantpool_long; public static String disassembler_constantpool_string; public static String disassembler_constantpool_fieldref; public static String disassembler_constantpool_interfacemethodref; public static String disassembler_constantpool_methodref; public static String disassembler_constantpool_name_and_type; public static String disassembler_constantpool_utf8; public static String disassembler_annotationdefaultheader; public static String disassembler_annotationdefaultvalue; public static String disassembler_annotationenumvalue; public static String disassembler_annotationclassvalue; public static String disassembler_annotationannotationvalue; public static String disassembler_annotationarrayvaluestart; public static String disassembler_annotationarrayvalueend; public static String disassembler_annotationentrystart; public static String disassembler_annotationentryend; public static String disassembler_annotationcomponent; public static String disassembler_runtimevisibleannotationsattributeheader; public static String disassembler_runtimeinvisibleannotationsattributeheader; public static String disassembler_runtimevisibleparameterannotationsattributeheader; public static String disassembler_runtimeinvisibleparameterannotationsattributeheader; public static String disassembler_parameterannotationentrystart; public static String disassembler_stackmaptableattributeheader; public static String classfileformat_versiondetails; public static String classfileformat_methoddescriptor; public static String classfileformat_fieldddescriptor; public static String classfileformat_stacksAndLocals; public static String classfileformat_superflagisnotset; public static String classfileformat_superflagisset; public static String classfileformat_clinitname; public static String classformat_classformatexception; public static String classformat_anewarray; public static String classformat_checkcast; public static String classformat_instanceof; public static String classformat_ldc_w_class; public static String classformat_ldc_w_float; public static String classformat_ldc_w_integer; public static String classformat_ldc_w_string; public static String classformat_ldc2_w_long; public static String classformat_ldc2_w_double; public static String classformat_multianewarray; public static String classformat_new; public static String classformat_iinc; public static String classformat_invokespecial; public static String classformat_invokeinterface; public static String classformat_invokestatic; public static String classformat_invokevirtual; public static String classformat_getfield; public static String classformat_getstatic; public static String classformat_putstatic; public static String classformat_putfield; public static String classformat_newarray_boolean; public static String classformat_newarray_char; public static String classformat_newarray_float; public static String classformat_newarray_double; public static String classformat_newarray_byte; public static String classformat_newarray_short; public static String classformat_newarray_int; public static String classformat_newarray_long; public static String classformat_store; public static String classformat_load; public static String classfileformat_anyexceptionhandler; public static String classfileformat_exceptiontableentry; public static String classfileformat_linenumbertableentry; public static String classfileformat_localvariabletableentry; public static String classfileformat_versionUnknown; static { NLS.initializeMessages(BUNDLE_NAME, Messages.class); } /** * Bind the given message's substitution locations with the given string values. * * @param message the message to be manipulated * @return the manipulated String */ public static String bind(String message) { return bind(message, null); } /** * Bind the given message's substitution locations with the given string values. * * @param message the message to be manipulated * @param binding the object to be inserted into the message * @return the manipulated String */ public static String bind(String message, Object binding) { return bind(message, new Object[] {binding}); } /** * Bind the given message's substitution locations with the given string values. * * @param message the message to be manipulated * @param binding1 An object to be inserted into the message * @param binding2 A second object to be inserted into the message * @return the manipulated String */ public static String bind(String message, Object binding1, Object binding2) { return bind(message, new Object[] {binding1, binding2}); } /** * Bind the given message's substitution locations with the given string values. * * @param message the message to be manipulated * @param bindings An array of objects to be inserted into the message * @return the manipulated String */ public static String bind(String message, Object[] bindings) { return MessageFormat.format(message, bindings); } } |
|
From: Christopher W. <caw...@us...> - 2005-12-13 19:59:35
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7305/src/org/rubypeople/rdt/core Modified Files: IRubyModel.java IRubyScript.java IRubyProject.java Added Files: IRubyElementDelta.java ElementChangedEvent.java IElementChangedListener.java Log Message: implement Ticket #46 (Update code folding on current working copy/editor) Index: IRubyModel.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyModel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IRubyModel.java 5 Mar 2005 15:18:45 -0000 1.3 --- IRubyModel.java 13 Dec 2005 19:58:55 -0000 1.4 *************** *** 11,15 **** * */ ! public interface IRubyModel extends IParent { /** --- 11,15 ---- * */ ! public interface IRubyModel extends IParent, IRubyElement, IOpenable { /** Index: IRubyScript.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyScript.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IRubyScript.java 29 Nov 2005 19:38:00 -0000 1.7 --- IRubyScript.java 13 Dec 2005 19:58:55 -0000 1.8 *************** *** 88,92 **** * @since 3.0 */ ! void reconcile(WorkingCopyOwner owner, IProgressMonitor monitor) throws RubyModelException; /** --- 88,92 ---- * @since 3.0 */ ! void reconcile(boolean forceProblemDetection, WorkingCopyOwner owner, IProgressMonitor monitor) throws RubyModelException; /** *************** *** 359,361 **** --- 359,376 ---- */ IType[] getTypes() throws RubyModelException; + + /** + * Returns the smallest element within this compilation unit that + * includes the given source position (that is, a method, field, etc.), or + * <code>null</code> if there is no element other than the compilation + * unit itself at the given position, or if the given position is not + * within the source range of this compilation unit. + * + * @param position a source position inside the compilation unit + * @return the innermost Ruby element enclosing a given source position or <code>null</code> + * if none (excluding the compilation unit). + * @throws RubyModelException if the compilation unit does not exist or if an + * exception occurs while accessing its corresponding resource + */ + IRubyElement getElementAt(int position) throws RubyModelException; } \ No newline at end of file --- NEW FILE: IRubyElementDelta.java --- /******************************************************************************* * Copyright (c) 2000, 2004 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.core; import org.eclipse.core.resources.IResourceDelta; import org.rubypeople.rdt.internal.core.RubyScript; /** * A Java element delta describes changes in Java element between two discrete * points in time. Given a delta, clients can access the element that has * changed, and any children that have changed. * <p> * Deltas have a different status depending on the kind of change they * represent. The list below summarizes each status (as returned by * <code>getKind</code>) and its meaning (see individual constants for a more * detailled description): * <ul> * <li><code>ADDED</code> - The element described by the delta has been * added.</li> * <li><code>REMOVED</code> - The element described by the delta has been * removed.</li> * <li><code>CHANGED</code> - The element described by the delta has been * changed in some way. Specification of the type of change is provided by * <code>getFlags</code> which returns the following values: * <ul> * <li><code>F_ADDED_TO_CLASSPATH</code> - A classpath entry corresponding to * the element has been added to the project's classpath. This flag is only * valid if the element is an <code>IPackageFragmentRoot</code>.</li> * <li><code>F_ARCHIVE_CONTENT_CHANGED</code> - The contents of an archive * has changed in some way. This flag is only valid if the element is an * <code>IPackageFragmentRoot</code> which is an archive.</li> * <li><code>F_CHILDREN</code> - A child of the element has changed in some * way. This flag is only valid if the element is an <code>IParent</code>.</li> * <li><code>F_CLASSPATH_REORDER</code> - A classpath entry corresponding to * the element has changed position in the project's classpath. This flag is * only valid if the element is an <code>IPackageFragmentRoot</code>.</li> * <li><code>F_CLOSED</code> - The underlying <code>IProject</code> has * been closed. This flag is only valid if the element is an * <code>IJavaProject</code>.</li> * <li><code>F_CONTENT</code> - The contents of the element have been * altered. This flag is only valid for elements which correspond to files.</li> * <li><code>F_FINE_GRAINED</code> - The delta is a fine-grained delta, that * is, an analysis down to the members level was done to determine if there were * structural changes to members of the element.</li> * <li><code>F_MODIFIERS</code> - The modifiers on the element have changed * in some way. This flag is only valid if the element is an * <code>IMember</code>.</li> * <li><code>F_OPENED</code> - The underlying <code>IProject</code> has * been opened. This flag is only valid if the element is an * <code>IJavaProject</code>.</li> * <li><code>F_REMOVED_FROM_CLASSPATH</code> - A classpath entry * corresponding to the element has been removed from the project's classpath. * This flag is only valid if the element is an * <code>IPackageFragmentRoot</code>.</li> * <li><code>F_SOURCEATTACHED</code> - The source attachment path or the * source attachment root path of a classpath entry corresponding to the element * was added. This flag is only valid if the element is an * <code>IPackageFragmentRoot</code>.</li> * <li><code>F_SOURCEDETACHED</code> - The source attachment path or the * source attachment root path of a classpath entry corresponding to the element * was removed. This flag is only valid if the element is an * <code>IPackageFragmentRoot</code>.</li> * <li><code>F_SUPER_TYPES</code> - One of the supertypes of an * <code>IType</code> has changed</li>. * </ul> * </li> * </ul> * </p> * <p> * Move operations are indicated by other change flags, layered on top of the * change flags described above. If element A is moved to become B, the delta * for the change in A will have status <code>REMOVED</code>, with change * flag <code>F_MOVED_TO</code>. In this case, <code>getMovedToElement</code> * on delta A will return the handle for B. The delta for B will have status * <code>ADDED</code>, with change flag <code>F_MOVED_FROM</code>, and * <code>getMovedFromElement</code> on delta B will return the handle for A. * (Note, the handle to A in this case represents an element that no longer * exists). * </p> * <p> * Note that the move change flags only describe the changes to a single * element, they do not imply anything about the parent or children of the * element. * </p> * <p> * The <code>F_ADDED_TO_CLASSPATH</code>, * <code>F_REMOVED_FROM_CLASSPATH</code> and <code>F_CLASSPATH_REORDER</code> * flags are triggered by changes to a project's classpath. They do not mean * that the underlying resource was added, removed or changed. For example, if a * project P already contains a folder src, then adding a classpath entry with * the 'P/src' path to the project's classpath will result in an * <code>IJavaElementDelta</code> with the <code>F_ADDED_TO_CLASSPATH</code> * flag for the <code>IPackageFragmentRoot</code> P/src. On the contrary, if a * resource is physically added, removed or changed and this resource * corresponds to a classpath entry of the project, then an * <code>IJavaElementDelta</code> with the <code>ADDED</code>, * <code>REMOVED</code>, or <code>CHANGED</code> kind will be fired. * </p> * <p> * Note that when a source attachment path or a source attachment root path is * changed, then the flags of the delta contain both * <code>F_SOURCEATTACHED</code> and <code>F_SOURCEDETTACHED</code>. * </p> * <p> * No assumptions should be made on whether the java element delta tree is * rooted at the <code>IJavaModel</code> level or not. * </p> * <p> * <code>IJavaElementDelta</code> object are not valid outside the dynamic * scope of the notification. * </p> * <p> * This interface is not intended to be implemented by clients. * </p> */ public interface IRubyElementDelta { /** * Status constant indicating that the element has been added. Note that an * added java element delta has no children, as they are all implicitely * added. */ public int ADDED = 1; /** * Status constant indicating that the element has been removed. Note that a * removed java element delta has no children, as they are all implicitely * removed. */ public int REMOVED = 2; /** * Status constant indicating that the element has been changed, as * described by the change flags. * * @see #getFlags() */ public int CHANGED = 4; /** * Change flag indicating that the content of the element has changed. This * flag is only valid for elements which correspond to files. */ public int F_CONTENT = 0x000001; /** * Change flag indicating that the modifiers of the element have changed. * This flag is only valid if the element is an <code>IMember</code>. */ public int F_MODIFIERS = 0x000002; /** * Change flag indicating that there are changes to the children of the * element. This flag is only valid if the element is an * <code>IParent</code>. */ public int F_CHILDREN = 0x000008; /** * Change flag indicating that the element was moved from another location. * The location of the old element can be retrieved using * <code>getMovedFromElement</code>. */ public int F_MOVED_FROM = 0x000010; /** * Change flag indicating that the element was moved to another location. * The location of the new element can be retrieved using * <code>getMovedToElement</code>. */ public int F_MOVED_TO = 0x000020; /** * Change flag indicating that a classpath entry corresponding to the * element has been added to the project's classpath. This flag is only * valid if the element is an <code>IPackageFragmentRoot</code>. */ public int F_ADDED_TO_CLASSPATH = 0x000040; /** * Change flag indicating that a classpath entry corresponding to the * element has been removed from the project's classpath. This flag is only * valid if the element is an <code>IPackageFragmentRoot</code>. */ public int F_REMOVED_FROM_CLASSPATH = 0x000080; /** * Change flag indicating that a classpath entry corresponding to the * element has changed position in the project's classpath. This flag is * only valid if the element is an <code>IPackageFragmentRoot</code>. * * @deprecated Use F_REORDER instead. */ public int F_CLASSPATH_REORDER = 0x000100; /** * Change flag indicating that the element has changed position relatively * to its siblings. If the element is an <code>IPackageFragmentRoot</code>, * a classpath entry corresponding to the element has changed position in * the project's classpath. * * @since 2.1 */ public int F_REORDER = 0x000100; /** * Change flag indicating that the underlying <code>IProject</code> has * been opened. This flag is only valid if the element is an * <code>IJavaProject</code>. */ public int F_OPENED = 0x000200; /** * Change flag indicating that the underlying <code>IProject</code> has * been closed. This flag is only valid if the element is an * <code>IJavaProject</code>. */ public int F_CLOSED = 0x000400; /** * Change flag indicating that one of the supertypes of an * <code>IType</code> has changed. */ public int F_SUPER_TYPES = 0x000800; /** * Change flag indicating that the source attachment path or the source * attachment root path of a classpath entry corresponding to the element * was added. This flag is only valid if the element is an * <code>IPackageFragmentRoot</code>. */ public int F_SOURCEATTACHED = 0x001000; /** * Change flag indicating that the source attachment path or the source * attachment root path of a classpath entry corresponding to the element * was removed. This flag is only valid if the element is an * <code>IPackageFragmentRoot</code>. */ public int F_SOURCEDETACHED = 0x002000; /** * Change flag indicating that this is a fine-grained delta, that is, an * analysis down to the members level was done to determine if there were * structural changes to members. * <p> * Clients can use this flag to find out if a compilation unit that have a * <code>F_CONTENT</code> change should assume that there are no finer * grained changes (<code>F_FINE_GRAINED</code> is set) or if finer * grained changes were not considered (<code>F_FINE_GRAINED</code> is * not set). * * @since 2.0 */ public int F_FINE_GRAINED = 0x004000; /** * Change flag indicating that the element's archive content on the * classpath has changed. This flag is only valid if the element is an * <code>IPackageFragmentRoot</code> which is an archive. * * @see IPackageFragmentRoot#isArchive() * @since 2.0 */ public int F_ARCHIVE_CONTENT_CHANGED = 0x008000; /** * Change flag indicating that a compilation unit has become a primary * working copy, or that a primary working copy has reverted to a * compilation unit. This flag is only valid if the element is an * <code>ICompilationUnit</code>. * * @since 3.0 */ public int F_PRIMARY_WORKING_COPY = 0x010000; /** * Change flag indicating that the raw classpath (or the output folder) of a * project has changed. This flag is only valid if the element is an * <code>IJavaProject</code>. * * @since 3.0 */ public int F_CLASSPATH_CHANGED = 0x020000; /** * Change flag indicating that the resource of a primary compilation unit * has changed. This flag is only valid if the element is a primary * <code>ICompilationUnit</code>. * * @since 3.0 */ public int F_PRIMARY_RESOURCE = 0x040000; /** * Change flag indicating that a reconcile operation has affected the * compilation unit AST created in a previous reconcile operation. Use * {@link #getCompilationUnitAST()} to retrieve the AST (if any is * available). This flag is only valid if the element is an * <code>ICompilationUnit</code> in working copy mode. * * @since 3.2 */ public int F_AST_AFFECTED = 0x080000; /** * Change flag indicating that the categories of the element have changed. * This flag is only valid if the element is an <code>IMember</code>. * * @since 3.2 */ public int F_CATEGORIES = 0x100000; /** * Returns deltas for the children that have been added. * * @return deltas for the children that have been added */ public IRubyElementDelta[] getAddedChildren(); /** * Returns deltas for the affected (added, removed, or changed) children. * * @return deltas for the affected (added, removed, or changed) children */ public IRubyElementDelta[] getAffectedChildren(); /** * Returns the compilation unit AST created by the last reconcile operation * on this delta's element. This returns a non-null value if and only if: * <ul> * <li>the last reconcile operation on this working copy requested an AST</li> * <li>this delta's element is an <code>ICompilationUnit</code> in * working copy mode</li> * <li>the delta comes from a <code>POST_RECONCILE</code> event * </ul> * * @return the AST created during the last reconcile operation * @see IRubyScript#reconcile(int, boolean, WorkingCopyOwner, * org.eclipse.core.runtime.IProgressMonitor) * @see #F_AST_AFFECTED * @since 3.2 */ public RubyScript getRubyScriptAST(); /** * Returns deltas for the children which have changed. * * @return deltas for the children which have changed */ public IRubyElementDelta[] getChangedChildren(); /** * Returns the element that this delta describes a change to. * * @return the element that this delta describes a change to */ public IRubyElement getElement(); /** * Returns flags that describe how an element has changed. Such flags should * be tested using the <code>&</code> operand. For example: * * <pre> * if ((delta.getFlags() & IRubyElementDelta.F_CONTENT) != 0) { * // the delta indicates a content change * } * </pre> * * @return flags that describe how an element has changed */ public int getFlags(); /** * Returns the kind of this delta - one of <code>ADDED</code>, * <code>REMOVED</code>, or <code>CHANGED</code>. * * @return the kind of this delta */ public int getKind(); /** * Returns an element describing this element before it was moved to its * current location, or <code>null</code> if the <code>F_MOVED_FROM</code> * change flag is not set. * * @return an element describing this element before it was moved to its * current location, or <code>null</code> if the * <code>F_MOVED_FROM</code> change flag is not set */ public IRubyElement getMovedFromElement(); /** * Returns an element describing this element in its new location, or * <code>null</code> if the <code>F_MOVED_TO</code> change flag is not * set. * * @return an element describing this element in its new location, or * <code>null</code> if the <code>F_MOVED_TO</code> change flag * is not set */ public IRubyElement getMovedToElement(); /** * Returns deltas for the children which have been removed. * * @return deltas for the children which have been removed */ public IRubyElementDelta[] getRemovedChildren(); /** * Returns the collection of resource deltas. * <p> * Note that resource deltas, like Ruby element deltas, are generally only * valid for the dynamic scope of an event notification. Clients must not * hang on to these objects. * </p> * * @return the underlying resource deltas, or <code>null</code> if none */ public IResourceDelta[] getResourceDeltas(); } --- NEW FILE: IElementChangedListener.java --- /******************************************************************************* * Copyright (c) 2000, 2004 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.core; /** * An element changed listener receives notification of changes to Java elements * maintained by the Java model. * <p> * This interface may be implemented by clients. * </p> */ public interface IElementChangedListener { /** * Notifies that one or more attributes of one or more Java elements have changed. * The specific details of the change are described by the given event. * * @param event the change event */ public void elementChanged(ElementChangedEvent event); } --- NEW FILE: ElementChangedEvent.java --- /******************************************************************************* * Copyright (c) 2000, 2004 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.core; import java.util.EventObject; /** * An element changed event describes a change to the structure or contents * of a tree of Java elements. The changes to the elements are described by * the associated delta object carried by this event. * <p> * This class is not intended to be instantiated or subclassed by clients. * Instances of this class are automatically created by the Java model. * </p> * * @see IElementChangedListener * @see IJavaElementDelta */ public class ElementChangedEvent extends EventObject { /** * Event type constant (bit mask) indicating an after-the-fact * report of creations, deletions, and modifications * to one or more Java element(s) expressed as a hierarchical * java element delta as returned by <code>getDelta()</code>. * * Note: this notification occurs during the corresponding POST_CHANGE * resource change notification, and contains a full delta accounting for * any JavaModel operation and/or resource change. * * @see IJavaElementDelta * @see org.eclipse.core.resources.IResourceChangeEvent * @see #getDelta() * @since 2.0 */ public static final int POST_CHANGE = 1; /** * Event type constant (bit mask) indicating an after-the-fact * report of creations, deletions, and modifications * to one or more Java element(s) expressed as a hierarchical * java element delta as returned by <code>getDelta</code>. * * Note: this notification occurs during the corresponding PRE_AUTO_BUILD * resource change notification. The delta, which is notified here, only contains * information relative to the previous JavaModel operations (in other words, * it ignores the possible resources which have changed outside Java operations). * In particular, it is possible that the JavaModel be inconsistent with respect to * resources, which got modified outside JavaModel operations (it will only be * fully consistent once the POST_CHANGE notification has occurred). * * @see IJavaElementDelta * @see org.eclipse.core.resources.IResourceChangeEvent * @see #getDelta() * @since 2.0 * @deprecated - no longer used, such deltas are now notified during POST_CHANGE */ public static final int PRE_AUTO_BUILD = 2; /** * Event type constant (bit mask) indicating an after-the-fact * report of creations, deletions, and modifications * to one or more Java element(s) expressed as a hierarchical * java element delta as returned by <code>getDelta</code>. * * Note: this notification occurs as a result of a working copy reconcile * operation. * * @see IJavaElementDelta * @see org.eclipse.core.resources.IResourceChangeEvent * @see #getDelta() * @since 2.0 */ public static final int POST_RECONCILE = 4; private static final long serialVersionUID = -8947240431612844420L; // backward compatible /* * Event type indicating the nature of this event. * It can be a combination either: * - POST_CHANGE * - PRE_AUTO_BUILD * - POST_RECONCILE */ private int type; /** * Creates an new element changed event (based on a <code>IJavaElementDelta</code>). * * @param delta the Java element delta. * @param type the type of delta (ADDED, REMOVED, CHANGED) this event contains */ public ElementChangedEvent(IRubyElementDelta delta, int type) { super(delta); this.type = type; } /** * Returns the delta describing the change. * * @return the delta describing the change */ public IRubyElementDelta getDelta() { return (IRubyElementDelta) this.source; } /** * Returns the type of event being reported. * * @return one of the event type constants * @see #POST_CHANGE * @see #PRE_AUTO_BUILD * @see #POST_RECONCILE * @since 2.0 */ public int getType() { return this.type; } } Index: IRubyProject.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IRubyProject.java 3 Sep 2005 19:05:02 -0000 1.4 --- IRubyProject.java 13 Dec 2005 19:58:55 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- import java.util.List; + import java.util.Map; import org.eclipse.core.resources.IProject; *************** *** 74,76 **** --- 75,106 ---- public boolean upgrade() throws CoreException; + /** + * Helper method for returning one option value only. Equivalent to <code>(String)this.getOptions(inheritRubyCoreOptions).get(optionName)</code> + * Note that it may answer <code>null</code> if this option does not exist, or if there is no custom value for it. + * <p> + * For a complete description of the configurable options, see <code>RubyCore#getDefaultOptions</code>. + * </p> + * + * @param optionName the name of an option + * @param inheritRubyCoreOptions - boolean indicating whether RubyCore options should be inherited as well + * @return the String value of a given option + * @see RubyCore#getDefaultOptions() + */ + String getOption(String optionName, boolean inheritRubyCoreOptions); + + /** + * Returns the table of the current custom options for this project. Projects remember their custom options, + * in other words, only the options different from the the RubyCore global options for the workspace. + * A boolean argument allows to directly merge the project options with global ones from <code>RubyCore</code>. + * <p> + * For a complete description of the configurable options, see <code>RubyCore#getDefaultOptions</code>. + * </p> + * + * @param inheritRubyCoreOptions - boolean indicating whether RubyCore options should be inherited as well + * @return table of current settings of all options + * (key type: <code>String</code>; value type: <code>String</code>) + * @see RubyCore#getDefaultOptions() + */ + Map getOptions(boolean inheritRubyCoreOptions); + } \ No newline at end of file |
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7305/src/org/rubypeople/rdt/internal/core Modified Files: RubyProjectElementInfo.java RubyElement.java RubyProject.java ReconcileWorkingCopyOperation.java RubyModelManager.java RubyScript.java Added Files: RubyElementDelta.java SimpleDelta.java RubyModelOperation.java DocumentAdapter.java RubyElementDeltaBuilder.java Assert.java DeltaProcessingState.java DeltaProcessor.java ModelUpdater.java LoadpathEntry.java Removed Files: LoadPathEntry.java Log Message: implement Ticket #46 (Update code folding on current working copy/editor) --- NEW FILE: DeltaProcessor.java --- package org.rubypeople.rdt.internal.core; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.PerformanceStats; [...1175 lines suppressed...] case IRubyElement.RUBY_MODEL: // case of a movedTo or movedFrom project (other cases are handled // in processResourceDelta(...) return IRubyElement.PROJECT; case NON_RUBY_RESOURCE: case IRubyElement.PROJECT: if (res.getType() == IResource.FOLDER) { return NON_RUBY_RESOURCE; } String fileName = res.getName(); if (Util.isValidRubyScriptName(fileName)) { return IRubyElement.SCRIPT; } else { return NON_RUBY_RESOURCE; } default: return NON_RUBY_RESOURCE; } } } --- NEW FILE: LoadpathEntry.java --- package org.rubypeople.rdt.internal.core; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; import org.rubypeople.rdt.core.ILoadpathEntry; public class LoadpathEntry implements ILoadpathEntry { private static final String TYPE_PROJECT = "project"; private String rootID; private int entryKind; private IPath path; /** * Patterns allowing to include/exclude portions of the resource tree * denoted by this entry path. */ private IPath[] inclusionPatterns; private char[][] fullInclusionPatternChars; private IPath[] exclusionPatterns; private char[][] fullExclusionPatternChars; private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray()}; //$NON-NLS-1$ /* * Default inclusion pattern set */ public final static IPath[] INCLUDE_ALL = {}; /* * Default exclusion pattern set */ public final static IPath[] EXCLUDE_NONE = {}; private IProject project; /** * The export flag */ private boolean isExported; public LoadpathEntry(IProject project) { this(ILoadpathEntry.CPE_PROJECT, project.getFullPath(), INCLUDE_ALL, EXCLUDE_NONE, true); this.project = project; } public LoadpathEntry(int entryKind, IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, boolean isExported) { this.path = path; this.entryKind = entryKind; this.inclusionPatterns = inclusionPatterns; this.exclusionPatterns = exclusionPatterns; if (inclusionPatterns != INCLUDE_ALL && inclusionPatterns.length > 0) { this.fullInclusionPatternChars = UNINIT_PATTERNS; } if (exclusionPatterns.length > 0) { this.fullExclusionPatternChars = UNINIT_PATTERNS; } this.isExported = isExported; } public IPath getPath() { return path; } // FIXME We shouldn't need this! public IProject getProject() { return this.project; } public int getEntryKind() { return this.entryKind; } /** * Returns a <code>String</code> for the kind of a class path entry. */ static String kindToString(int kind) { switch (kind) { case ILoadpathEntry.CPE_PROJECT: return TYPE_PROJECT; //$NON-NLS-1$ case ILoadpathEntry.CPE_SOURCE: return "src"; //$NON-NLS-1$ case ILoadpathEntry.CPE_LIBRARY: return "lib"; //$NON-NLS-1$ case ILoadpathEntry.CPE_VARIABLE: return "var"; //$NON-NLS-1$ case ILoadpathEntry.CPE_CONTAINER: return "con"; //$NON-NLS-1$ default: return "unknown"; //$NON-NLS-1$ } } public String toXML() { StringBuffer buffer = new StringBuffer(); buffer.append("<pathentry type=\""); buffer.append(LoadpathEntry.kindToString(entryKind) + "\" "); buffer.append("path=\"" + getPath() + "\"/>"); return buffer.toString(); } /** * Answers an ID which is used to distinguish entries during package * fragment root computations */ public String rootID() { if (this.rootID == null) { switch (this.entryKind) { case ILoadpathEntry.CPE_LIBRARY: this.rootID = "[LIB]" + this.path; //$NON-NLS-1$ break; case ILoadpathEntry.CPE_PROJECT: this.rootID = "[PRJ]" + this.path; //$NON-NLS-1$ break; case ILoadpathEntry.CPE_SOURCE: this.rootID = "[SRC]" + this.path; //$NON-NLS-1$ break; case ILoadpathEntry.CPE_VARIABLE: this.rootID = "[VAR]" + this.path; //$NON-NLS-1$ break; case ILoadpathEntry.CPE_CONTAINER: this.rootID = "[CON]" + this.path; //$NON-NLS-1$ break; default: this.rootID = ""; //$NON-NLS-1$ break; } } return this.rootID; } /* * Returns a char based representation of the exclusions patterns full path. */ public char[][] fullExclusionPatternChars() { if (this.fullExclusionPatternChars == UNINIT_PATTERNS) { int length = this.exclusionPatterns.length; this.fullExclusionPatternChars = new char[length][]; IPath prefixPath = this.path.removeTrailingSeparator(); for (int i = 0; i < length; i++) { this.fullExclusionPatternChars[i] = prefixPath.append(this.exclusionPatterns[i]).toString().toCharArray(); } } return this.fullExclusionPatternChars; } /* * Returns a char based representation of the exclusions patterns full path. */ public char[][] fullInclusionPatternChars() { if (this.fullInclusionPatternChars == UNINIT_PATTERNS) { int length = this.inclusionPatterns.length; this.fullInclusionPatternChars = new char[length][]; IPath prefixPath = this.path.removeTrailingSeparator(); for (int i = 0; i < length; i++) { this.fullInclusionPatternChars[i] = prefixPath.append(this.inclusionPatterns[i]).toString().toCharArray(); } } return this.fullInclusionPatternChars; } /** * @see ILoadpathEntry#isExported() */ public boolean isExported() { return this.isExported; } /* (non-Javadoc) * @see org.rubypeople.rdt.core.ILoadpathEntry#getExclusionPatterns() */ public IPath[] getExclusionPatterns() { // TODO Auto-generated method stub return null; } /* (non-Javadoc) * @see org.rubypeople.rdt.core.ILoadpathEntry#getInclusionPatterns() */ public IPath[] getInclusionPatterns() { // TODO Auto-generated method stub return null; } } --- NEW FILE: DocumentAdapter.java --- /******************************************************************************* * Copyright (c) 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.core; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.rubypeople.rdt.core.IBuffer; /* * Adapts an IBuffer to IDocument */ public class DocumentAdapter extends Document { private IBuffer buffer; public DocumentAdapter(IBuffer buffer) { super(buffer.getContents()); this.buffer = buffer; } public void set(String text) { super.set(text); this.buffer.setContents(text); } public void replace(int offset, int length, String text) throws BadLocationException { super.replace(offset, length, text); this.buffer.replace(offset, length, text); } } --- LoadPathEntry.java DELETED --- Index: RubyScript.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** RubyScript.java 29 Nov 2005 19:38:00 -0000 1.17 --- RubyScript.java 13 Dec 2005 19:58:56 -0000 1.18 *************** *** 155,158 **** --- 155,171 ---- } + /** + * @see IRubyScript#getElementAt(int) + */ + public IRubyElement getElementAt(int position) throws RubyModelException { + + IRubyElement e= getSourceElementAt(position); + if (e == this) { + return null; + } else { + return e; + } + } + public String getElementName() { return this.name; *************** *** 234,238 **** */ public void reconcile() throws RubyModelException { ! reconcile(null, null); } --- 247,251 ---- */ public void reconcile() throws RubyModelException { ! reconcile(false, null, null); } *************** *** 242,251 **** * @see org.rubypeople.rdt.core.IRubyScript#reconcile() */ ! public void reconcile(WorkingCopyOwner workingCopyOwner, IProgressMonitor monitor) throws RubyModelException { if (!isWorkingCopy()) return; // Reconciling is not supported on non // working copies if (workingCopyOwner == null) workingCopyOwner = DefaultWorkingCopyOwner.PRIMARY; ! ReconcileWorkingCopyOperation op = new ReconcileWorkingCopyOperation(this, workingCopyOwner); op.runOperation(monitor); } --- 255,264 ---- * @see org.rubypeople.rdt.core.IRubyScript#reconcile() */ ! public void reconcile(boolean forceProblemDetection, WorkingCopyOwner workingCopyOwner, IProgressMonitor monitor) throws RubyModelException { if (!isWorkingCopy()) return; // Reconciling is not supported on non // working copies if (workingCopyOwner == null) workingCopyOwner = DefaultWorkingCopyOwner.PRIMARY; ! ReconcileWorkingCopyOperation op = new ReconcileWorkingCopyOperation(this, forceProblemDetection, workingCopyOwner); op.runOperation(monitor); } *************** *** 521,528 **** */ public void makeConsistent(IProgressMonitor monitor) throws RubyModelException { ! if (isConsistent()) return; ! ! openWhenClosed(createElementInfo(), monitor); } /* --- 534,557 ---- */ public void makeConsistent(IProgressMonitor monitor) throws RubyModelException { ! makeConsistent(false, monitor); } + + public RubyScript makeConsistent(boolean createAST, IProgressMonitor monitor) throws RubyModelException { + if (isConsistent()) return null; + + // create a new info and make it the current info + // (this will remove the info and its children just before storing the new infos) + // TODO When createAST is specified, actually do it! + // if (createAST) { + // ASTHolderCUInfo info = new ASTHolderCUInfo(); + // openWhenClosed(info, monitor); + // RubyScript result = info.ast; + // info.ast = null; + // return result; + // } else { + openWhenClosed(createElementInfo(), monitor); + return null; + // } + } /* Index: RubyProject.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** RubyProject.java 29 Nov 2005 19:40:41 -0000 1.16 --- RubyProject.java 13 Dec 2005 19:58:55 -0000 1.17 *************** *** 1,7 **** --- 1,13 ---- package org.rubypeople.rdt.internal.core; + import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; + import java.io.File; + import java.io.FileInputStream; + import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; + import java.util.HashSet; + import java.util.Hashtable; import java.util.Iterator; import java.util.List; *************** *** 16,23 **** --- 22,34 ---- import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.resources.IResource; + import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; + import org.eclipse.core.runtime.Preferences; + import org.eclipse.core.runtime.preferences.IEclipsePreferences; + import org.eclipse.core.runtime.preferences.IScopeContext; + import org.osgi.service.prefs.BackingStoreException; import org.rubypeople.rdt.core.ILoadpathEntry; import org.rubypeople.rdt.core.IParent; *************** *** 40,43 **** --- 51,59 ---- protected List loadPathEntries; protected boolean scratched; + + /** + * Name of file containing custom project preferences + */ + private static final String PREF_FILENAME = ".rprefs"; //$NON-NLS-1$ /* *************** *** 181,184 **** --- 197,204 ---- } + private IPath getPluginWorkingLocation() { + return this.project.getWorkingLocation(RubyCore.PLUGIN_ID); + } + public IProject getProject() { return project; *************** *** 207,211 **** scratched = true; ! LoadPathEntry newEntry = new LoadPathEntry(anotherRubyProject); getLoadPathEntries().add(newEntry); } --- 227,231 ---- scratched = true; ! LoadpathEntry newEntry = new LoadpathEntry(anotherRubyProject); getLoadPathEntries().add(newEntry); } *************** *** 214,218 **** Iterator entries = getLoadPathEntries().iterator(); while (entries.hasNext()) { ! LoadPathEntry entry = (LoadPathEntry) entries.next(); if (entry.getEntryKind() == ILoadpathEntry.CPE_PROJECT && entry.getProject().getName().equals(anotherRubyProject.getName())) { --- 234,238 ---- Iterator entries = getLoadPathEntries().iterator(); while (entries.hasNext()) { ! LoadpathEntry entry = (LoadpathEntry) entries.next(); if (entry.getEntryKind() == ILoadpathEntry.CPE_PROJECT && entry.getProject().getName().equals(anotherRubyProject.getName())) { *************** *** 237,241 **** Iterator iterator = getLoadPathEntries().iterator(); while (iterator.hasNext()) { ! LoadPathEntry pathEntry = (LoadPathEntry) iterator.next(); if (pathEntry.getEntryKind() == ILoadpathEntry.CPE_PROJECT) referencedProjects.add(pathEntry.getProject()); --- 257,261 ---- Iterator iterator = getLoadPathEntries().iterator(); while (iterator.hasNext()) { ! LoadpathEntry pathEntry = (LoadpathEntry) iterator.next(); if (pathEntry.getEntryKind() == ILoadpathEntry.CPE_PROJECT) referencedProjects.add(pathEntry.getProject()); *************** *** 312,316 **** IPath referencedProjectPath = new Path(atts.getValue("path")); IProject referencedProject = getProject(referencedProjectPath.lastSegment()); ! loadPathEntries.add(new LoadPathEntry(referencedProject)); } } --- 332,336 ---- IPath referencedProjectPath = new Path(atts.getValue("path")); IProject referencedProject = getProject(referencedProjectPath.lastSegment()); ! loadPathEntries.add(new LoadpathEntry(referencedProject)); } } *************** *** 345,349 **** while (pathEntriesIterator.hasNext()) { ! LoadPathEntry entry = (LoadPathEntry) pathEntriesIterator.next(); buffer.append(entry.toXML()); } --- 365,369 ---- while (pathEntriesIterator.hasNext()) { ! LoadpathEntry entry = (LoadpathEntry) pathEntriesIterator.next(); buffer.append(entry.toXML()); } *************** *** 361,364 **** --- 381,423 ---- } + /** + * Returns the project custom preference pool. + * Project preferences may include custom encoding. + * @return IEclipsePreferences + */ + public IEclipsePreferences getEclipsePreferences(){ + if (!RubyProject.hasRubyNature(this.project)) return null; + // Get cached preferences if exist + RubyModelManager.PerProjectInfo perProjectInfo = RubyModelManager.getRubyModelManager().getPerProjectInfo(this.project, true); + if (perProjectInfo.preferences != null) return perProjectInfo.preferences; + // Init project preferences + IScopeContext context = new ProjectScope(getProject()); + final IEclipsePreferences eclipsePreferences = context.getNode(RubyCore.PLUGIN_ID); + updatePreferences(eclipsePreferences); + perProjectInfo.preferences = eclipsePreferences; + + // Listen to node removal from parent in order to reset cache (see bug 68993) + IEclipsePreferences.INodeChangeListener nodeListener = new IEclipsePreferences.INodeChangeListener() { + public void added(IEclipsePreferences.NodeChangeEvent event) { + // do nothing + } + public void removed(IEclipsePreferences.NodeChangeEvent event) { + if (event.getChild() == eclipsePreferences) { + RubyModelManager.getRubyModelManager().resetProjectPreferences(RubyProject.this); + } + } + }; + ((IEclipsePreferences) eclipsePreferences.parent()).addNodeChangeListener(nodeListener); + + // Listen to preference changes + IEclipsePreferences.IPreferenceChangeListener preferenceListener = new IEclipsePreferences.IPreferenceChangeListener() { + public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) { + RubyModelManager.getRubyModelManager().resetProjectOptions(RubyProject.this); + } + }; + eclipsePreferences.addPreferenceChangeListener(preferenceListener); + return eclipsePreferences; + } + /* * (non-Rubydoc) *************** *** 514,517 **** --- 573,704 ---- return dest; } + + /** + * @see org.rubypeople.rdt.core.IRubyProject#getOption(String, boolean) + */ + public String getOption(String optionName, boolean inheritRubyCoreOptions) { + + String propertyName = optionName; + if (RubyModelManager.getRubyModelManager().optionNames.contains(propertyName)){ + IEclipsePreferences projectPreferences = getEclipsePreferences(); + String javaCoreDefault = inheritRubyCoreOptions ? RubyCore.getOption(propertyName) : null; + if (projectPreferences == null) return javaCoreDefault; + String value = projectPreferences.get(propertyName, javaCoreDefault); + return value == null ? null : value.trim(); + } + return null; + } + + /** + * @see org.rubypeople.rdt.core.IRubyProject#getOptions(boolean) + */ + public Map getOptions(boolean inheritRubyCoreOptions) { + + // initialize to the defaults from RubyCore options pool + Map options = inheritRubyCoreOptions ? RubyCore.getOptions() : new Hashtable(5); + + // Get project specific options + RubyModelManager.PerProjectInfo perProjectInfo = null; + Hashtable projectOptions = null; + HashSet optionNames = RubyModelManager.getRubyModelManager().optionNames; + try { + perProjectInfo = getPerProjectInfo(); + projectOptions = perProjectInfo.options; + if (projectOptions == null) { + // get eclipse preferences + IEclipsePreferences projectPreferences= getEclipsePreferences(); + if (projectPreferences == null) return options; // cannot do better (non-Ruby project) + // create project options + String[] propertyNames = projectPreferences.keys(); + projectOptions = new Hashtable(propertyNames.length); + for (int i = 0; i < propertyNames.length; i++){ + String propertyName = propertyNames[i]; + String value = projectPreferences.get(propertyName, null); + if (value != null && optionNames.contains(propertyName)){ + projectOptions.put(propertyName, value.trim()); + } + } + // cache project options + perProjectInfo.options = projectOptions; + } + } catch (RubyModelException jme) { + projectOptions = new Hashtable(); + } catch (BackingStoreException e) { + projectOptions = new Hashtable(); + } + + // Inherit from RubyCore options if specified + if (inheritRubyCoreOptions) { + Iterator propertyNames = projectOptions.keySet().iterator(); + while (propertyNames.hasNext()) { + String propertyName = (String) propertyNames.next(); + String propertyValue = (String) projectOptions.get(propertyName); + if (propertyValue != null && optionNames.contains(propertyName)){ + options.put(propertyName, propertyValue.trim()); + } + } + return options; + } + return projectOptions; + } + + /* + * Update eclipse preferences from old preferences. + */ + private void updatePreferences(IEclipsePreferences preferences) { + + Preferences oldPreferences = loadPreferences(); + if (oldPreferences != null) { + String[] propertyNames = oldPreferences.propertyNames(); + for (int i = 0; i < propertyNames.length; i++){ + String propertyName = propertyNames[i]; + String propertyValue = oldPreferences.getString(propertyName); + if (!"".equals(propertyValue)) { //$NON-NLS-1$ + preferences.put(propertyName, propertyValue); + } + } + try { + // save immediately old preferences + preferences.flush(); + } catch (BackingStoreException e) { + // fails silently + } + } + } + + /** + * load preferences from a shareable format (VCM-wise) + */ + private Preferences loadPreferences() { + + Preferences preferences = new Preferences(); + IPath projectMetaLocation = getPluginWorkingLocation(); + if (projectMetaLocation != null) { + File prefFile = projectMetaLocation.append(PREF_FILENAME).toFile(); + if (prefFile.exists()) { // load preferences from file + InputStream in = null; + try { + in = new BufferedInputStream(new FileInputStream(prefFile)); + preferences.load(in); + } catch (IOException e) { // problems loading preference store - quietly ignore + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { // ignore problems with close + } + } + } + // one shot read, delete old preferences + prefFile.delete(); + return preferences; + } + } + return null; + } + + public void resetCaches() { + // TODO Auto-generated method stub + } } --- NEW FILE: ModelUpdater.java --- /******************************************************************************* * Copyright (c) 2000, 2004 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.core; import java.util.HashSet; import java.util.Iterator; import org.rubypeople.rdt.core.IRubyElement; import org.rubypeople.rdt.core.IRubyElementDelta; import org.rubypeople.rdt.core.IRubyProject; import org.rubypeople.rdt.core.RubyModelException; /** * This class is used by <code>RubyModelManager</code> to update the RubyModel * based on some <code>IRubyElementDelta</code>s. */ public class ModelUpdater { HashSet projectsToUpdate = new HashSet(); /** * Adds the given child handle to its parent's cache of children. */ protected void addToParentInfo(Openable child) { Openable parent = (Openable) child.getParent(); if (parent != null && parent.isOpen()) { try { RubyElementInfo info = (RubyElementInfo) parent.getElementInfo(); info.addChild(child); } catch (RubyModelException e) { // do nothing - we already checked if open } } } /** * Closes the given element, which removes it from the cache of open * elements. */ protected static void close(Openable element) { try { element.close(); } catch (RubyModelException e) { // do nothing } } /** * Processing for an element that has been added: * <ul> * <li>If the element is a project, do nothing, and do not process * children, as when a project is created it does not yet have any natures - * specifically a java nature. * <li>If the elemet is not a project, process it as added (see * <code>basicElementAdded</code>. * </ul> */ protected void elementAdded(Openable element) { int elementType = element.getElementType(); if (elementType == IRubyElement.PROJECT) { // project add is handled by RubyProject.configure() because // when a project is created, it does not yet have a java nature addToParentInfo(element); this.projectsToUpdate.add(element); } else { addToParentInfo(element); // Force the element to be closed as it might have been opened // before the resource modification came in and it might have a new // child // For example, in an IWorkspaceRunnable: // 1. create a package fragment p using a java model operation // 2. open package p // 3. add file X.java in folder p // When the resource delta comes in, only the addition of p is // notified, // but the package p is already opened, thus its children are not // recomputed // and it appears empty. close(element); } } /** * Generic processing for elements with changed contents: * <ul> * <li>The element is closed such that any subsequent accesses will re-open * the element reflecting its new structure. * </ul> */ protected void elementChanged(Openable element) { close(element); } /** * Generic processing for a removed element: * <ul> * <li>Close the element, removing its structure from the cache * <li>Remove the element from its parent's cache of children * <li>Add a REMOVED entry in the delta * </ul> */ protected void elementRemoved(Openable element) { if (element.isOpen()) { close(element); } removeFromParentInfo(element); int elementType = element.getElementType(); switch (elementType) { case IRubyElement.RUBY_MODEL: // TODO Reset IndexManager when we have it integrated //RubyModelManager.getRubyModelManager().getIndexManager().reset(); break; case IRubyElement.PROJECT: RubyModelManager.getRubyModelManager().removePerProjectInfo((RubyProject) element); break; } } /** * Converts a <code>IResourceDelta</code> rooted in a * <code>Workspace</code> into the corresponding set of * <code>IRubyElementDelta</code>, rooted in the relevant * <code>RubyModel</code>s. */ public void processRubyDelta(IRubyElementDelta delta) { // if (DeltaProcessor.VERBOSE){ // System.out.println("UPDATING Model with Delta: // ["+Thread.currentThread()+":" + delta + "]:"); // } try { this.traverseDelta(delta, null); // traverse delta // update package fragment roots of projects that were affected Iterator iterator = this.projectsToUpdate.iterator(); while (iterator.hasNext()) { RubyProject project = (RubyProject) iterator.next(); // TODO Update package fragemnt roots for the project?? //project.updatePackageFragmentRoots(); } } finally { this.projectsToUpdate = new HashSet(); } } /** * Removes the given element from its parents cache of children. If the * element does not have a parent, or the parent is not currently open, this * has no effect. */ protected void removeFromParentInfo(Openable child) { Openable parent = (Openable) child.getParent(); if (parent != null && parent.isOpen()) { try { RubyElementInfo info = (RubyElementInfo) parent.getElementInfo(); info.removeChild(child); } catch (RubyModelException e) { // do nothing - we already checked if open } } } /** * Converts an <code>IResourceDelta</code> and its children into the * corresponding <code>IRubyElementDelta</code>s. Return whether the * delta corresponds to a resource on the classpath. If it is not a resource * on the classpath, it will be added as a non-java resource by the sender * of this method. */ protected void traverseDelta(IRubyElementDelta delta, IRubyProject project) { boolean processChildren = true; Openable element = (Openable) delta.getElement(); switch (element.getElementType()) { case IRubyElement.PROJECT: project = (IRubyProject) element; break; case IRubyElement.SCRIPT: // filter out working copies that are not primary (we don't want to // add/remove them to/from the package fragment RubyScript cu = (RubyScript) element; if (cu.isWorkingCopy() && !cu.isPrimary()) { return; } } switch (delta.getKind()) { case IRubyElementDelta.ADDED: elementAdded(element); break; case IRubyElementDelta.REMOVED: elementRemoved(element); break; case IRubyElementDelta.CHANGED: if ((delta.getFlags() & IRubyElementDelta.F_CONTENT) != 0) { elementChanged(element); } break; } if (processChildren) { IRubyElementDelta[] children = delta.getAffectedChildren(); for (int i = 0; i < children.length; i++) { IRubyElementDelta childDelta = children[i]; this.traverseDelta(childDelta, project); } } } } Index: RubyProjectElementInfo.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProjectElementInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubyProjectElementInfo.java 2 Mar 2005 00:54:01 -0000 1.2 --- RubyProjectElementInfo.java 13 Dec 2005 19:58:55 -0000 1.3 *************** *** 62,67 **** if (projectPath.equals(entry.getPath())) { srcIsProject = true; ! inclusionPatterns = ((LoadPathEntry) entry).fullInclusionPatternChars(); ! exclusionPatterns = ((LoadPathEntry) entry).fullExclusionPatternChars(); break; } --- 62,67 ---- if (projectPath.equals(entry.getPath())) { srcIsProject = true; ! inclusionPatterns = ((LoadpathEntry) entry).fullInclusionPatternChars(); ! exclusionPatterns = ((LoadpathEntry) entry).fullExclusionPatternChars(); break; } Index: RubyModelManager.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RubyModelManager.java 16 Oct 2005 21:02:16 -0000 1.4 --- RubyModelManager.java 13 Dec 2005 19:58:55 -0000 1.5 *************** *** 7,16 **** --- 7,25 ---- import java.util.HashMap; import java.util.HashSet; + import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import org.eclipse.core.resources.IProject; + import org.eclipse.core.resources.IResourceChangeEvent; + import org.eclipse.core.resources.IWorkspace; [...1050 lines suppressed...] + if (option != null) RubyModelManager.verbose = option.equalsIgnoreCase("true"); //$NON-NLS-1$ + + option = Platform.getDebugOption(POST_ACTION_DEBUG); + if (option != null) + RubyModelOperation.POST_ACTION_VERBOSE = option.equalsIgnoreCase("true"); //$NON-NLS-1$ + + option = Platform.getDebugOption(ENABLE_NEW_FORMATTER); + if (option != null) + DefaultCodeFormatter.USE_NEW_FORMATTER = option.equalsIgnoreCase("true"); //$NON-NLS-1$ + + // configure performance options + if (PerformanceStats.ENABLED) { + DeltaProcessor.PERF = PerformanceStats.isEnabled(DELTA_LISTENER_PERF); + ReconcileWorkingCopyOperation.PERF = PerformanceStats.isEnabled(RECONCILE_PERF); + } + } + + } + } --- NEW FILE: Assert.java --- /******************************************************************************* * Copyright (c) 2000, 2004 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.core; /* This class is not intended to be instantiated. */ public final class Assert { private Assert() { // cannot be instantiated } /** Asserts that an argument is legal. If the given boolean is * not <code>true</code>, an <code>IllegalArgumentException</code> * is thrown. * * @param expression the outcode of the check * @return <code>true</code> if the check passes (does not return * if the check fails) * @exception IllegalArgumentException if the legality test failed */ public static boolean isLegal(boolean expression) { return isLegal(expression, ""); //$NON-NLS-1$ } /** Asserts that an argument is legal. If the given boolean is * not <code>true</code>, an <code>IllegalArgumentException</code> * is thrown. * The given message is included in that exception, to aid debugging. * * @param expression the outcode of the check * @param message the message to include in the exception * @return <code>true</code> if the check passes (does not return * if the check fails) * @exception IllegalArgumentException if the legality test failed */ public static boolean isLegal(boolean expression, String message) { if (!expression) throw new IllegalArgumentException(message); return expression; } /** Asserts that the given object is not <code>null</code>. If this * is not the case, some kind of unchecked exception is thrown. * * @param object the value to test * @exception IllegalArgumentException if the object is <code>null</code> */ public static void isNotNull(Object object) { isNotNull(object, ""); //$NON-NLS-1$ } /** Asserts that the given object is not <code>null</code>. If this * is not the case, some kind of unchecked exception is thrown. * The given message is included in that exception, to aid debugging. * * @param object the value to test * @param message the message to include in the exception * @exception IllegalArgumentException if the object is <code>null</code> */ public static void isNotNull(Object object, String message) { if (object == null) throw new AssertionFailedException("null argument; " + message); //$NON-NLS-1$ } /** Asserts that the given boolean is <code>true</code>. If this * is not the case, some kind of unchecked exception is thrown. * * @param expression the outcode of the check * @return <code>true</code> if the check passes (does not return * if the check fails) */ public static boolean isTrue(boolean expression) { return isTrue(expression, ""); //$NON-NLS-1$ } /** Asserts that the given boolean is <code>true</code>. If this * is not the case, some kind of unchecked exception is thrown. * The given message is included in that exception, to aid debugging. * * @param expression the outcode of the check * @param message the message to include in the exception * @return <code>true</code> if the check passes (does not return * if the check fails) */ public static boolean isTrue(boolean expression, String message) { if (!expression) throw new AssertionFailedException("Assertion failed; " + message); //$NON-NLS-1$ return expression; } public static class AssertionFailedException extends RuntimeException { private static final long serialVersionUID = -3179320974982211564L; // backward compatible public AssertionFailedException(String detail) { super(detail); } } } Index: RubyElement.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyElement.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RubyElement.java 11 Mar 2005 01:59:48 -0000 1.4 --- RubyElement.java 13 Dec 2005 19:58:55 -0000 1.5 *************** *** 31,34 **** --- 31,35 ---- import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.PlatformObject; + import org.rubypeople.rdt.core.IField; import org.rubypeople.rdt.core.IOpenable; import org.rubypeople.rdt.core.IParent; *************** *** 39,42 **** --- 40,45 ---- import org.rubypeople.rdt.core.IRubyProject; import org.rubypeople.rdt.core.IRubyScript; + import org.rubypeople.rdt.core.ISourceRange; + import org.rubypeople.rdt.core.ISourceReference; import org.rubypeople.rdt.core.RubyModelException; *************** *** 127,130 **** --- 130,182 ---- return this; } + + /** + * Returns the element that is located at the given source position + * in this element. This is a helper method for <code>IRubyScript#getElementAt</code>, + * and only works on ruby scripts and types. The position given is + * known to be within this element's source range already, and if no finer + * grained element is found at the position, this element is returned. + */ + protected IRubyElement getSourceElementAt(int position) throws RubyModelException { + if (this instanceof ISourceReference) { + IRubyElement[] children = getChildren(); + for (int i = children.length-1; i >= 0; i--) { + IRubyElement aChild = children[i]; + if (aChild instanceof SourceRefElement) { + SourceRefElement child = (SourceRefElement) children[i]; + ISourceRange range = child.getSourceRange(); + int start = range.getOffset(); + int end = start + range.getLength(); + if (start <= position && position <= end) { + if (child instanceof IField) { + // check muti-declaration case (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=39943) + int declarationStart = start; + SourceRefElement candidate = null; + do { + // check name range + range = ((IField)child).getNameRange(); + if (position <= range.getOffset() + range.getLength()) { + candidate = child; + } else { + return candidate == null ? child.getSourceElementAt(position) : candidate.getSourceElementAt(position); + } + child = --i>=0 ? (SourceRefElement) children[i] : null; + } while (child != null && child.getSourceRange().getOffset() == declarationStart); + // position in field's type: use first field + return candidate.getSourceElementAt(position); + } else if (child instanceof IParent) { + return child.getSourceElementAt(position); + } else { + return child; + } + } + } + } + } else { + // should not happen + Assert.isTrue(false); + } + return this; + } /** --- NEW FILE: DeltaProcessingState.java --- package org.rubypeople.rdt.internal.core; import java.util.HashMap; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.Platform; import org.rubypeople.rdt.core.IElementChangedListener; import org.rubypeople.rdt.core.IRubyProject; import org.rubypeople.rdt.internal.core.util.Util; public class DeltaProcessingState implements IResourceChangeListener { /* * Collection of listeners for Ruby element deltas */ public IElementChangedListener[] elementChangedListeners = new IElementChangedListener[5]; public int[] elementChangedListenerMasks = new int[5]; public int elementChangedListenerCount = 0; /* * Collection of pre Ruby resource change listeners */ public IResourceChangeListener[] preResourceChangeListeners = new IResourceChangeListener[1]; public int[] preResourceChangeEventMasks = new int[1]; public int preResourceChangeListenerCount = 0; /* * The delta processor for the current thread. */ private ThreadLocal deltaProcessors = new ThreadLocal(); public IRubyProject[] modelProjectsCache; /* A table from IRubyProject to IRubyProject[] (the list of direct dependent of the key) */ public HashMap projectDependencies = new HashMap(); /* * Need to clone defensively the listener information, in case some listener * is reacting to some notification iteration by adding/changing/removing * any of the other (for example, if it deregisters itself). */ public void addElementChangedListener(IElementChangedListener listener, int eventMask) { for (int i = 0; i < this.elementChangedListenerCount; i++) { if (this.elementChangedListeners[i].equals(listener)) { // only clone the masks, since we could be in the middle of // notifications and one listener decide to change // any event mask of another listeners (yet not notified). int cloneLength = this.elementChangedListenerMasks.length; System.arraycopy(this.elementChangedListenerMasks, 0, this.elementChangedListenerMasks = new int[cloneLength], 0, cloneLength); this.elementChangedListenerMasks[i] = eventMask; // could be // different return; } } // may need to grow, no need to clone, since iterators will have cached // original arrays and max boundary and we only add to the end. int length; if ((length = this.elementChangedListeners.length) == this.elementChangedListenerCount) { System.arraycopy(this.elementChangedListeners, 0, this.elementChangedListeners = new IElementChangedListener[length * 2], 0, length); System.arraycopy(this.elementChangedListenerMasks, 0, this.elementChangedListenerMasks = new int[length * 2], 0, length); } this.elementChangedListeners[this.elementChangedListenerCount] = listener; this.elementChangedListenerMasks[this.elementChangedListenerCount] = eventMask; this.elementChangedListenerCount++; } public void removeElementChangedListener(IElementChangedListener listener) { for (int i = 0; i < this.elementChangedListenerCount; i++) { if (this.elementChangedListeners[i].equals(listener)) { // need to clone defensively since we might be in the middle of // listener notifications (#fire) int length = this.elementChangedListeners.length; IElementChangedListener[] newListeners = new IElementChangedListener[length]; System.arraycopy(this.elementChangedListeners, 0, newListeners, 0, i); int[] newMasks = new int[length]; System.arraycopy(this.elementChangedListenerMasks, 0, newMasks, 0, i); // copy trailing listeners int trailingLength = this.elementChangedListenerCount - i - 1; if (trailingLength > 0) { System.arraycopy(this.elementChangedListeners, i + 1, newListeners, i, trailingLength); System.arraycopy(this.elementChangedListenerMasks, i + 1, newMasks, i, trailingLength); } // update manager listener state (#fire need to iterate over // original listeners through a local variable to hold onto // the original ones) this.elementChangedListeners = newListeners; this.elementChangedListenerMasks = newMasks; this.elementChangedListenerCount--; return; } } } public DeltaProcessor getDeltaProcessor() { DeltaProcessor deltaProcessor = (DeltaProcessor) this.deltaProcessors.get(); if (deltaProcessor != null) return deltaProcessor; deltaProcessor = new DeltaProcessor(this, RubyModelManager.getRubyModelManager()); this.deltaProcessors.set(deltaProcessor); return deltaProcessor; } public void resourceChanged(final IResourceChangeEvent event) { for (int i = 0; i < this.preResourceChangeListenerCount; i++) { // wrap callbacks with Safe runnable for subsequent listeners to be // called when some are causing grief final IResourceChangeListener listener = this.preResourceChangeListeners[i]; if ((this.preResourceChangeEventMasks[i] & event.getType()) != 0) Platform.run(new ISafeRunnable() { public void handleException(Throwable exception) { Util .log(exception, "Exception occurred in listener of pre Java resource change notification"); //$NON-NLS-1$ } public void run() throws Exception { listener.resourceChanged(event); } }); } try { getDeltaProcessor().resourceChanged(event); } finally { // TODO (jerome) see 47631, may want to get rid of following so as // to reuse delta processor ? if (event.getType() == IResourceChangeEvent.POST_CHANGE) { this.deltaProcessors.set(null); } } } public void initializeRoots() { // TODO Do we actually need to do anything to initialize roots? } } --- NEW FILE: SimpleDelta.java --- /******************************************************************************* * Copyright (c) 2000, 2004 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.core; import org.rubypeople.rdt.core.IRubyElementDelta; /** * A simple Ruby element delta that remembers the kind of changes only. */ public class SimpleDelta { /* * @see IRubyElementDelta#getKind() */ protected int kind = 0; /* * @see IRubyElementDelta#getFlags() */ protected int changeFlags = 0; /* * Marks this delta as added */ public void added() { this.kind = IRubyElementDelta.ADDED; } /* * Marks this delta as changed with the given change flag */ public void changed(int flags) { this.kind = IRubyElementDelta.CHANGED; this.changeFlags |= flags; } /* * @see IRubyElementDelta#getFlags() */ public int getFlags() { return this.changeFlags; } /* * @see IRubyElementDelta#getKind() */ public int getKind() { return this.kind; } /* * Mark this delta has a having a modifiers change */ public void modifiers() { changed(IRubyElementDelta.F_MODIFIERS); } /* * Marks this delta as removed */ public void removed() { this.kind = IRubyElementDelta.REMOVED; this.changeFlags = 0; } /* * Mark this delta has a having a super type change */ public void superTypes() { changed(IRubyElementDelta.F_SUPER_TYPES); } protected void toDebugString(StringBuffer buffer) { buffer.append("["); //$NON-NLS-1$ switch (getKind()) { case IRubyElementDelta.ADDED : buffer.append('+'); break; case IRubyElementDelta.REMOVED : buffer.append('-'); break; case IRubyElementDelta.CHANGED : buffer.append('*'); break; default : buffer.append('?'); break; } buffer.append("]: {"); //$NON-NLS-1$ toDebugString(buffer, getFlags()); buffer.append("}"); //$NON-NLS-1$ } protected boolean toDebugString(StringBuffer buffer, int flags) { boolean prev = false; if ((flags & IRubyElementDelta.F_MODIFIERS) != 0) { if (prev) buffer.append(" | "); //$NON-NLS-1$ buffer.append("MODIFIERS CHANGED"); //$NON-NLS-1$ prev = true; } if ((flags & IRubyElementDelta.F_SUPER_TYPES) != 0) { if (prev) buffer.append(" | "); //$NON-NLS-1$ buffer.append("SUPER TYPES CHANGED"); //$NON-NLS-1$ prev = true; } return prev; } public String toString() { StringBuffer buffer = new StringBuffer(); toDebugString(buffer); return buffer.toString(); } } --- NEW FILE: RubyElementDeltaBuilder.java --- /******************************************************************************* * Copyright (c) 2000, 2004 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.core; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.rubypeople.rdt.core.IParent; import org.rubypeople.rdt.core.IRubyElement; import org.rubypeople.rdt.core.IRubyElementDelta; import org.rubypeople.rdt.core.RubyModelException; import org.rubypeople.rdt.internal.core.util.CharOperation; import org.rubypeople.rdt.internal.core.util.Util; /** * A java element delta biulder creates a java element delta on a java element * between the version of the java element at the time the comparator was * created and the current version of the java element. * * It performs this operation by locally caching the contents of the java * element when it is created. When the method createDeltas() is called, it * creates a delta over the cached contents and the new contents. */ public class RubyElementDeltaBuilder { /** * The java element handle */ IRubyElement javaElement; /** * The maximum depth in the java element children we should look into */ int maxDepth = Integer.MAX_VALUE; /** * The old handle to info relationships */ Map infos; /** * The old position info */ Map oldPositions; /** * The new position info */ Map newPositions; /** * Change delta */ RubyElementDelta delta; /** * List of added elements */ ArrayList added; /** * List of removed elements */ ArrayList removed; /** * Doubly linked list item */ class ListItem { public IRubyElement previous; public IRubyElement next; public ListItem(IRubyElement previous, IRubyElement next) { this.previous = previous; this.next = next; } } /** * Creates a java element comparator on a java element looking as deep as * necessary. */ public RubyElementDeltaBuilder(IRubyElement javaElement) { this.javaElement = javaElement; this.initialize(); this.recordElementInfo(javaElement, (RubyModel) this.javaElement.getRubyModel(), 0); } /** * Creates a java element comparator on a java element looking only * 'maxDepth' levels deep. */ public RubyElementDeltaBuilder(IRubyElement javaElement, int maxDepth) { this.javaElement = javaElement; this.maxDepth = maxDepth; this.initialize(); this.recordElementInfo(javaElement, (RubyModel) this.javaElement.getRubyModel(), 0); } /** * Repairs the positioning information after an element has been added */ private void added(IRubyElement element) { this.added.add(element); ListItem current = this.getNewPosition(element); ListItem previous = null, next = null; if (current.previous != null) previous = this.getNewPosition(current.previous); if (current.next != null) next = this.getNewPosition(current.next); if (previous != null) previous.next = current.next; if (next != null) next.previous = current.previous; } /** * Builds the java element deltas between the old content of the compilation * unit and its new content. */ public void buildDeltas() { this.recordNewPositions(this.javaElement, 0); this.findAdditions(this.javaElement, 0); this.findDeletions(); this.findChangesInPositioning(this.javaElement, 0); this.trimDelta(this.delta); if (this.delta.getAffectedChildren().length == 0) { // this is a fine grained but not children affected -> mark as // content changed this.delta.contentChanged(); } } private boolean equals(char[][][] first, char[][][] second) { if (first == second) return true; if (first == null || second == null) return false; if (first.length != second.length) return false; for (int i = first.length; --i >= 0;) if (!CharOperation.equals(first[i], second[i])) return false; return true; } /** * Finds elements which have been added or changed. */ private void findAdditions(IRubyElement newElement, int depth) { RubyElementInfo oldInfo = this.getElementInfo(newElement); if (oldInfo == null && depth < this.maxDepth) { this.delta.added(newElement); added(newElement); } else { this.removeElementInfo(newElement); } if (depth >= this.maxDepth) { // mark element as changed this.delta.changed(newElement, IRubyElementDelta.F_CONTENT); return; } RubyElementInfo newInfo = null; try { newInfo = (RubyElementInfo) ((RubyElement) newElement).getElementInfo(); } catch (RubyModelException npe) { return; } this.findContentChange(oldInfo, newInfo, newElement); if (oldInfo != null && newElement instanceof IParent) { IRubyElement[] children = newInfo.getChildren(); if (children != null) { int length = children.length; for (int i = 0; i < length; i++) { this.findAdditions(children[i], depth + 1); } } } } /** * Looks for changed positioning of elements. */ private void findChangesInPositioning(IRubyElement element, int depth) { if (depth >= this.maxDepth || this.added.contains(element) || this.removed.contains(element)) return; if (!isPositionedCorrectly(element)) { this.delta.changed(element, IRubyElementDelta.F_REORDER); } if (element instanceof IParent) { RubyElementInfo info = null; try { info = (RubyElementInfo) ((RubyElement) element).getElementInfo(); } catch (RubyModelException npe) { return; } IRubyElement[] children = info.getChildren(); if (children != null) { int length = children.length; for (int i = 0; i < length; i++) { this.findChangesInPositioning(children[i], depth + 1); } } } } /** * The elements are equivalent, but might have content changes. */ private void findContentChange(RubyElementInfo oldInfo, RubyElementInfo newInfo, IRubyElement newElement) { if (oldInfo instanceof MemberElementInfo && newInfo instanceof MemberElementInfo) { if (oldInfo instanceof RubyMethodElementInfo && newInfo instanceof RubyMethodElementInfo) { RubyMethodElementInfo oldSourceMethodInfo = (RubyMethodElementInfo) oldInfo; ... [truncated message content] |
|
From: Christopher W. <caw...@us...> - 2005-12-13 19:59:09
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/buffer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7305/src/org/rubypeople/rdt/internal/core/buffer Modified Files: BufferManager.java Log Message: implement Ticket #46 (Update code folding on current working copy/editor) Index: BufferManager.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/buffer/BufferManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BufferManager.java 11 Mar 2005 03:21:12 -0000 1.4 --- BufferManager.java 13 Dec 2005 19:58:58 -0000 1.5 *************** *** 28,32 **** protected static BufferManager DEFAULT_BUFFER_MANAGER; ! protected static boolean VERBOSE; /** --- 28,32 ---- protected static BufferManager DEFAULT_BUFFER_MANAGER; ! public static boolean VERBOSE; /** |
|
From: Matt K. <me...@us...> - 2005-12-13 15:19:34
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5607/src/org/rubypeople/rdt/ui/extensions Added Files: IRubyTemplateProvider.java Log Message: added rubyTemplateProvider extension point for RadRails use --- NEW FILE: IRubyTemplateProvider.java --- package org.rubypeople.rdt.ui.extensions; import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; /** * Interface for extensions to the rubyTemplateProvider extension point. * * @author mkent * */ public interface IRubyTemplateProvider { /** * This method should return an array of TemplatePersistenceData objects * representing templates that the client wishes to contribute to the * primary template store. * * @return */ public TemplatePersistenceData[] getTemplateData(); } |
|
From: Matt K. <me...@us...> - 2005-12-13 15:19:34
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5607/schema Added Files: rubyTemplateProvider.exsd Log Message: added rubyTemplateProvider extension point for RadRails use --- NEW FILE: rubyTemplateProvider.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.rubypeople.rdt.ui"> <annotation> <appInfo> <meta.schema plugin="org.rubypeople.rdt.ui" id="rubyTemplateProvider" name="Ruby template provider"/> </appInfo> <documentation> Use this extension point to provide code templates to the RubyCompletionProcessor. </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="rubyTemplateProvider"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="rubyTemplateProvider"> <complexType> <attribute name="class" type="string" use="required"> <annotation> <documentation> </documentation> <appInfo> <meta.attribute kind="java"/> </appInfo> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="since"/> </appInfo> <documentation> [Enter the first release in which this extension point appears.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> [Enter extension point usage example here.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> The templates provided to this extension point must use the context id org.rubypeople.rdt.ui.templateContextType.rubyFile if they are to show up in the Ruby editor. </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> [Enter information about supplied implementation of this extension point.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> </documentation> </annotation> </schema> |
|
From: Matt K. <me...@us...> - 2005-12-13 15:19:34
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/templates In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5607/src/org/rubypeople/rdt/internal/ui/rubyeditor/templates Modified Files: RubyTemplateAccess.java Log Message: added rubyTemplateProvider extension point for RadRails use Index: RubyTemplateAccess.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/templates/RubyTemplateAccess.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubyTemplateAccess.java 2 Mar 2005 00:56:52 -0000 1.2 --- RubyTemplateAccess.java 13 Dec 2005 15:19:21 -0000 1.3 *************** *** 12,21 **** --- 12,32 ---- import java.io.IOException; + import java.util.ArrayList; + import java.util.List; + + import org.eclipse.core.runtime.CoreException; + import org.eclipse.core.runtime.IConfigurationElement; + import org.eclipse.core.runtime.IExtension; + import org.eclipse.core.runtime.IExtensionPoint; + import org.eclipse.core.runtime.IExtensionRegistry; + import org.eclipse.core.runtime.Platform; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.templates.ContextTypeRegistry; + import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; import org.eclipse.jface.text.templates.persistence.TemplateStore; import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry; import org.eclipse.ui.editors.text.templates.ContributionTemplateStore; import org.rubypeople.rdt.internal.ui.RubyPlugin; + import org.rubypeople.rdt.ui.extensions.IRubyTemplateProvider; *************** *** 60,66 **** --- 71,141 ---- RubyPlugin.log(e); } + + // Load extension templates + TemplatePersistenceData[] tempData = getExtensionTemplateData(); + for(int i = 0; i < tempData.length; i++) { + fStore.add(tempData[i]); + } } return fStore; } + + /** + * Finds all extensions to the rubyTemplateProvider extension point and return their template data. + * + * @return an array of TemplatePersistenceData + */ + private TemplatePersistenceData[] getExtensionTemplateData() { + List extensions = new ArrayList(); + IExtensionRegistry reg = Platform.getExtensionRegistry(); + + IExtensionPoint[] points = reg.getExtensionPoints(RubyPlugin.PLUGIN_ID); + IExtensionPoint point = null; + + // Search the extension registry for the rubyTemplateProvider extension point + if(points != null){ + for (int i = 0; i < points.length; i++) { + IExtensionPoint currentPoint = points[i]; + if(currentPoint.getUniqueIdentifier().endsWith("rubyTemplateProvider")){ + point = currentPoint; + break; + } + } + + // Find all extensions of the point + if(point != null){ + IExtension[] exts = point.getExtensions(); + + IRubyTemplateProvider prov = null; + + // Get the implementing class of the extension + for (int i = 0; i < exts.length; i++) { + IConfigurationElement[] elem = exts[i].getConfigurationElements(); + String attrs[] = elem[0].getAttributeNames(); + try { + Object tempProv = elem[0].createExecutableExtension("class"); + if (tempProv instanceof IRubyTemplateProvider) { + prov = (IRubyTemplateProvider) tempProv; + extensions.add(prov); + } + } catch (CoreException e) { + RubyPlugin.log(e); + } + } + } + } + + // Get the template data from the extensions + if(extensions.size() > 0){ + for(int i=0; i< extensions.size(); i++){ + IRubyTemplateProvider currentProvider = (IRubyTemplateProvider) extensions.get(i); + TemplatePersistenceData[] templates = currentProvider.getTemplateData(); + if(templates != null){ + return templates; + } + } + } + return null; + } /** |
|
From: Matt K. <me...@us...> - 2005-12-13 15:19:34
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5607 Modified Files: plugin.xml Log Message: added rubyTemplateProvider extension point for RadRails use Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.xml,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** plugin.xml 9 Dec 2005 02:05:05 -0000 1.68 --- plugin.xml 13 Dec 2005 15:19:21 -0000 1.69 *************** *** 6,9 **** --- 6,10 ---- <extension-point id="foldingStructureProviders" name="%foldingStructureProviders" schema="schema/foldingStructureProviders.exsd"/> <extension-point id="editorPopupExtender" name="%editorPopupExtender" schema="schema/org.rubypeople.rdt.ui.editorPopupExtender.exsd"/> + <extension-point id="rubyTemplateProvider" name="Ruby template provider" schema="schema/rubyTemplateProvider.exsd"/> <extension |
|
From: Christopher W. <caw...@us...> - 2005-12-13 14:58:26
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1604/src/org/rubypeople/rdt/internal/ui/text/folding Modified Files: DefaultRubyFoldingStructureProvider.java Log Message: fold singleton methods - not just instance methods (See Ticket #39) Index: DefaultRubyFoldingStructureProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DefaultRubyFoldingStructureProvider.java 12 Mar 2005 15:32:33 -0000 1.3 --- DefaultRubyFoldingStructureProvider.java 13 Dec 2005 14:58:17 -0000 1.4 *************** *** 163,166 **** --- 163,167 ---- break; case IRubyElement.METHOD: + case IRubyElement.SINGLETON_METHOD: collapse = fAllowCollapsing && fCollapseMethods; createProjection = true; |
|
From: Markus B. <mba...@us...> - 2005-12-12 23:44:26
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.build/bootstrap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30342/bootstrap Modified Files: customTargets.xml Log Message: new target for packaging, determine feature version for integration build Index: customTargets.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.build/bootstrap/customTargets.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** customTargets.xml 26 Sep 2005 22:22:46 -0000 1.13 --- customTargets.xml 12 Dec 2005 23:44:13 -0000 1.14 *************** *** 64,70 **** <format property="build.tstamp" pattern="5MMddhhmm"/> </tstamp> ! <condition property="featureVersion" value="${nightlyBuildFeatureVersionPrefix}${build.tstamp}"> <equals arg1="${buildType}" arg2="N"/> </condition> <fail unless="featureVersion" message="Property featureVersion must be set. Either directly or in case of a nightly build with nightlyBuildFeatureVersionPrefix."/> <echo message="Using featureVersion: ${featureVersion}."/> --- 64,73 ---- <format property="build.tstamp" pattern="5MMddhhmm"/> </tstamp> ! <condition property="featureVersion" value="${nightlyBuildFeatureVersionPrefix}${build.tstamp}NGT"> <equals arg1="${buildType}" arg2="N"/> </condition> + <condition property="featureVersion" value="${nightlyBuildFeatureVersionPrefix}${build.tstamp}INT"> + <equals arg1="${buildType}" arg2="I"/> + </condition> <fail unless="featureVersion" message="Property featureVersion must be set. Either directly or in case of a nightly build with nightlyBuildFeatureVersionPrefix."/> <echo message="Using featureVersion: ${featureVersion}."/> *************** *** 85,89 **** <!-- ===================================================================== --> <target name="postFetch"> ! <antcall target="replaceVersionsForNightlyBuild"/> <replace file="${buildDirectory}/features/org.rubypeople.rdt/feature.xml"> <replacefilter token="<!--@@INCLUDES@@-->" value="<includes id="org.rubypeople.rdt.source" version="${featureVersion}"/>"/> --- 88,93 ---- <!-- ===================================================================== --> <target name="postFetch"> ! ! <antcall target="replaceVersions"/> <replace file="${buildDirectory}/features/org.rubypeople.rdt/feature.xml"> <replacefilter token="<!--@@INCLUDES@@-->" value="<includes id="org.rubypeople.rdt.source" version="${featureVersion}"/>"/> *************** *** 93,101 **** </replace> </target> ! <target name="replaceVersionsForNightlyBuild" if="baseFeatureVersion"> <replace dir="${buildDirectory}/features"> <include name="org.rubypeople.*/feature.xml"/> <replacefilter token="${baseFeatureVersion}" value="${featureVersion}" /> ! <replacefilter token="http://rubyeclipse.sourceforge.net/updatesite" value="http://rubyeclipse.sourceforge.net/nightlyBuild/updateSite" /> </replace> <replace dir="${buildDirectory}/plugins"> --- 97,113 ---- </replace> </target> ! ! <target name="replaceVersions" if="baseFeatureVersion"> ! <condition property="updateSiteUrl" ! value="http://rubyeclipse.sourceforge.net/nightlyBuild/updateSite" ! else="http://updatesite.rubypeople.org/rdt/integration"> ! <isset property="isNightlyBuild"/> ! </condition> ! <echo message="Nightly or integration build: replacing version ${baseFeatureVersion} with ${featureVersion}"/> ! <echo message="Setting update-site URL: ${updateSiteUrl}"/> <replace dir="${buildDirectory}/features"> <include name="org.rubypeople.*/feature.xml"/> <replacefilter token="${baseFeatureVersion}" value="${featureVersion}" /> ! <replacefilter token="http://rubyeclipse.sourceforge.net/updatesite" value="${updateSiteUrl}" /> </replace> <replace dir="${buildDirectory}/plugins"> *************** *** 145,150 **** <property name="UpdateSiteStagingLocation" value="${buildDirectory}/updateSite"/> <property name="sitePackagePrefix" value="org.rubypeople.updatesite"/> ! <antcall target="generateUpdateSite"/> <antcall target="test"/> </target> <!-- ===================================================================== --> --- 157,163 ---- <property name="UpdateSiteStagingLocation" value="${buildDirectory}/updateSite"/> <property name="sitePackagePrefix" value="org.rubypeople.updatesite"/> ! <antcall target="generateUpdateSite"/> <antcall target="test"/> + <antcall target="package"/> </target> <!-- ===================================================================== --> *************** *** 209,212 **** --- 222,263 ---- </echo> </target> + + <target name="package"> + <echo message="Creating and filling ${buildResultsDirectory}" /> + <mkdir dir="${buildResultsDirectory}"/> + <mkdir dir="${buildResultsDirectory}/logs"/> + + <copy todir="${buildResultsDirectory}/logs" flatten="true"> + <fileset dir="${buildDirectory}"> + <include name="**/*.log"/> + </fileset> + </copy> + <copy todir="${buildResultsDirectory}" flatten="true"> + <fileset dir="${buildDirectory}"> + <include name="**/org.rubypeople.rdt-*.zip"/> + <include name="**/Changelog.txt"/> + <!-- exclude the org.rubypeople.rdt-tests-*.zip file --> + <exclude name="**/*-tests-*"/> + </fileset> + <fileset dir="${eclipseAutomatedTestHome}/results/html"> + <include name="*.html"/> + </fileset> + </copy> + <copy file="${buildDirectory}/workspace-rdt-tests/.metadata/.log" tofile="${buildResultsDirectory}/logs/testsWorkspace.log"/> + + <mkdir dir="${buildResultsDirectory}/updateSite"/> + <copy todir="${buildResultsDirectory}/updateSite"> + <fileset dir="${buildDirectory}/updateSite"/> + </copy> + + <mkdir dir="${buildResultsDirectory}/doc"/> + <copy todir="${buildResultsDirectory}/doc"> + <fileset dir="${buildDirectory}/plugins/org.rubypeople.rdt.doc.user"> + <include name="html/**/*"/> + <include name="images/**/*"/> + </fileset> + </copy> + + </target> <!-- ===================================================================== --> <!-- Steps to do to publish the build results --> |
|
From: Christopher W. <caw...@us...> - 2005-12-12 20:49:34
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22657/src/org/rubypeople/rdt/internal/ui/text Modified Files: TC_RubyPartitionScanner.java Log Message: Index: TC_RubyPartitionScanner.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TC_RubyPartitionScanner.java 3 Oct 2005 11:31:41 -0000 1.3 --- TC_RubyPartitionScanner.java 12 Dec 2005 20:49:25 -0000 1.4 *************** *** 28,34 **** String source = "# This is a comment\n"; ! assertEquals(RubyPartitionScanner.SINGLE_LINE_COMMENT, this.getContentType(source, 0)); ! assertEquals(RubyPartitionScanner.SINGLE_LINE_COMMENT, this.getContentType(source, 1)); ! assertEquals(RubyPartitionScanner.SINGLE_LINE_COMMENT, this.getContentType(source, 18)); } --- 28,34 ---- String source = "# This is a comment\n"; ! assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 0)); ! assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 1)); ! assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 18)); } *************** *** 43,48 **** String source = "=begin\nComment\n=end"; ! assertEquals(RubyPartitionScanner.MULTI_LINE_COMMENT, this.getContentType(source, 0)); ! assertEquals(RubyPartitionScanner.MULTI_LINE_COMMENT, this.getContentType(source, 10)); } --- 43,48 ---- String source = "=begin\nComment\n=end"; ! assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, 0)); ! assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, 10)); } *************** *** 59,75 **** public void testHereDocOK() { String source = "puts <<TEST\nMyName\nTEST"; ! assertEquals(RubyPartitionScanner.STRING, this.getContentType(source, 5)); source = "puts <<-TEST\nMyName\nTEST\nputs 'ab'"; ! assertEquals(RubyPartitionScanner.STRING, this.getContentType(source, 5)); source = "puts <<\"TEST\"\nMyName\nTEST"; ! assertEquals(RubyPartitionScanner.STRING, this.getContentType(source, 5)); source = "puts <<'TEST'\nMyName\nTEST"; ! assertEquals(RubyPartitionScanner.STRING, this.getContentType(source, 5)); source = "puts <<-'ax%&'\nMyName\nax%&"; ! assertEquals(RubyPartitionScanner.STRING, this.getContentType(source, 5)); } --- 59,75 ---- public void testHereDocOK() { String source = "puts <<TEST\nMyName\nTEST"; ! assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(source, 5)); source = "puts <<-TEST\nMyName\nTEST\nputs 'ab'"; ! assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(source, 5)); source = "puts <<\"TEST\"\nMyName\nTEST"; ! assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(source, 5)); source = "puts <<'TEST'\nMyName\nTEST"; ! assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(source, 5)); source = "puts <<-'ax%&'\nMyName\nax%&"; ! assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(source, 5)); } *************** *** 82,86 **** assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 5)); // normaler String ! assertEquals(RubyPartitionScanner.STRING, this.getContentType(source, 9)); // end not on first column --- 82,86 ---- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 5)); // normaler String ! assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(source, 9)); // end not on first column |
|
From: Christopher W. <caw...@us...> - 2005-12-12 20:01:10
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10682/src/org/rubypeople/rdt/internal/ui/text/ruby/hover Modified Files: RiDocHoverProvider.java Log Message: handle the case where a user hasn't selected an interpreter properly Index: RiDocHoverProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RiDocHoverProvider.java 9 Dec 2005 02:05:05 -0000 1.1 --- RiDocHoverProvider.java 12 Dec 2005 20:00:49 -0000 1.2 *************** *** 13,16 **** --- 13,17 ---- import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; + import org.rubypeople.rdt.internal.launching.RubyInterpreter; import org.rubypeople.rdt.internal.launching.RubyRuntime; import org.rubypeople.rdt.internal.ui.RubyPlugin; *************** *** 28,32 **** String symbol = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength()); args.add(symbol); ! Process p = RubyRuntime.getDefault().getSelectedInterpreter().exec(args, null); br = new BufferedReader(new InputStreamReader(p.getInputStream())); // TODO: format the documentation that was fetched from RI --- 29,35 ---- String symbol = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength()); args.add(symbol); ! RubyInterpreter selectedInterpreter = RubyRuntime.getDefault().getSelectedInterpreter(); ! if (selectedInterpreter == null) return null; ! Process p = selectedInterpreter.exec(args, null); br = new BufferedReader(new InputStreamReader(p.getInputStream())); // TODO: format the documentation that was fetched from RI |
|
From: Christopher W. <caw...@us...> - 2005-12-12 20:00:13
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10296/src/org/rubypeople/rdt/internal/ui/text Modified Files: RubySourceViewerConfiguration.java RubyPartitionScanner.java RubyWordFinder.java Added Files: RubyDoubleClickSelector.java Log Message: prefix content types with RUBY_. Change the double click strategy - reuse the RubyWordFinder used to determine the hoevr region. Change it to act more logically on Ruby tokens/words. Now double-clicking will be more likely to select what you really wanted. Index: RubyPartitionScanner.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RubyPartitionScanner.java 3 Oct 2005 11:31:34 -0000 1.9 --- RubyPartitionScanner.java 12 Dec 2005 19:59:58 -0000 1.10 *************** *** 16,27 **** ! public final static String STRING = "partition_scanner_ruby_string"; ! public final static String MULTI_LINE_COMMENT = "partition_scanner_ruby_multiline_comment"; ! public static final String SINGLE_LINE_COMMENT = "partition_scanner_ruby_singleline_comment"; ! public static final String REGULAR_EXPRESSION = "partition_scanner_ruby_regular_expression"; ! public static final String COMMAND = "partition_scanner_ruby_command"; public static final String HERE_DOC = "partition_scanner_here_doc"; ! public static final String[] LEGAL_CONTENT_TYPES = {STRING, MULTI_LINE_COMMENT, SINGLE_LINE_COMMENT, REGULAR_EXPRESSION, COMMAND}; public RubyPartitionScanner() { --- 16,27 ---- ! 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"; 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() { *************** *** 31,40 **** protected void initialize() { ! IToken string = new Token(STRING); ! IToken multiLineComment = new Token(MULTI_LINE_COMMENT); ! IToken singleLineComment = new Token(SINGLE_LINE_COMMENT); ! IToken regexp = new Token(REGULAR_EXPRESSION); ! IToken command = new Token(COMMAND); ! IToken hereDoc = new Token(STRING) ; List rules = new ArrayList(); --- 31,40 ---- protected void initialize() { ! IToken string = new Token(RUBY_STRING); ! IToken multiLineComment = new Token(RUBY_MULTI_LINE_COMMENT); ! IToken singleLineComment = new Token(RUBY_SINGLE_LINE_COMMENT); ! IToken regexp = new Token(RUBY_REGULAR_EXPRESSION); ! IToken command = new Token(RUBY_COMMAND); ! IToken hereDoc = new Token(RUBY_STRING) ; List rules = new ArrayList(); Index: RubySourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubySourceViewerConfiguration.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** RubySourceViewerConfiguration.java 9 Dec 2005 02:05:06 -0000 1.22 --- RubySourceViewerConfiguration.java 12 Dec 2005 19:59:58 -0000 1.23 *************** *** 7,10 **** --- 7,11 ---- import org.eclipse.jface.text.IInformationControlCreator; import org.eclipse.jface.text.ITextHover; + import org.eclipse.jface.text.ITextDoubleClickStrategy; import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.contentassist.IContentAssistant; *************** *** 48,69 **** dr = new DefaultDamagerRepairer(getSinglelineCommentScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.SINGLE_LINE_COMMENT); ! reconciler.setRepairer(dr, RubyPartitionScanner.SINGLE_LINE_COMMENT); dr = new DefaultDamagerRepairer(getMultilineCommentScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.MULTI_LINE_COMMENT); ! reconciler.setRepairer(dr, RubyPartitionScanner.MULTI_LINE_COMMENT); dr = new DefaultDamagerRepairer(getStringScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.STRING); ! reconciler.setRepairer(dr, RubyPartitionScanner.STRING); dr = new DefaultDamagerRepairer(getRegexpScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.REGULAR_EXPRESSION); ! reconciler.setRepairer(dr, RubyPartitionScanner.REGULAR_EXPRESSION); dr = new DefaultDamagerRepairer(getCommandScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.COMMAND); ! reconciler.setRepairer(dr, RubyPartitionScanner.COMMAND); --- 49,70 ---- dr = new DefaultDamagerRepairer(getSinglelineCommentScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT); ! reconciler.setRepairer(dr, RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT); dr = new DefaultDamagerRepairer(getMultilineCommentScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT); ! reconciler.setRepairer(dr, RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT); dr = new DefaultDamagerRepairer(getStringScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.RUBY_STRING); ! reconciler.setRepairer(dr, RubyPartitionScanner.RUBY_STRING); dr = new DefaultDamagerRepairer(getRegexpScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.RUBY_REGULAR_EXPRESSION); ! reconciler.setRepairer(dr, RubyPartitionScanner.RUBY_REGULAR_EXPRESSION); dr = new DefaultDamagerRepairer(getCommandScanner()); ! reconciler.setDamager(dr, RubyPartitionScanner.RUBY_COMMAND); ! reconciler.setRepairer(dr, RubyPartitionScanner.RUBY_COMMAND); *************** *** 96,100 **** public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { ! return new String[] { IDocument.DEFAULT_CONTENT_TYPE, RubyPartitionScanner.MULTI_LINE_COMMENT, RubyPartitionScanner.STRING, RubyPartitionScanner.SINGLE_LINE_COMMENT}; } --- 97,101 ---- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { ! return new String[] { IDocument.DEFAULT_CONTENT_TYPE, RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, RubyPartitionScanner.RUBY_STRING, RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT}; } *************** *** 167,170 **** --- 168,175 ---- return super.getIndentPrefixes(sourceViewer, contentType); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } + + public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) { + return new RubyDoubleClickSelector(); + } --- NEW FILE: RubyDoubleClickSelector.java --- package org.rubypeople.rdt.internal.ui.text; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextDoubleClickStrategy; import org.eclipse.jface.text.ITextViewer; public class RubyDoubleClickSelector implements ITextDoubleClickStrategy { public void doubleClicked(ITextViewer text) { int position = text.getSelectedRange().x; if (position < 0) return; IRegion region = RubyWordFinder.findWord(text.getDocument(), position); if (region != null && region.getLength() != 0 ) text.setSelectedRange(region.getOffset(), region.getLength()); } } Index: RubyWordFinder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyWordFinder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubyWordFinder.java 5 Mar 2005 19:38:08 -0000 1.1 --- RubyWordFinder.java 12 Dec 2005 19:59:58 -0000 1.2 *************** *** 10,14 **** *******************************************************************************/ package org.rubypeople.rdt.internal.ui.text; ! import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; --- 10,14 ---- *******************************************************************************/ package org.rubypeople.rdt.internal.ui.text; ! import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; *************** *** 17,66 **** public class RubyWordFinder { ! // FIXME Modify the rules to match ruby words! ! public static IRegion findWord(IDocument document, int offset) { ! ! int start= -1; ! int end= -1; ! ! ! try { ! ! int pos= offset; ! char c; ! ! while (pos >= 0) { ! c= document.getChar(pos); ! if (!Character.isJavaIdentifierPart(c)) ! break; ! --pos; ! } ! ! start= pos; ! ! pos= offset; ! int length= document.getLength(); ! ! while (pos < length) { ! c= document.getChar(pos); ! if (!Character.isJavaIdentifierPart(c)) ! break; ! ++pos; ! } ! ! end= pos; ! ! } catch (BadLocationException x) { ! } ! ! if (start > -1 && end > -1) { ! if (start == offset && end == offset) ! return new Region(offset, 0); ! else if (start == offset) ! return new Region(start, end - start); ! else ! return new Region(start + 1, end - start - 1); ! } ! ! return null; ! } } --- 17,82 ---- public class RubyWordFinder { ! /** ! * The characters which mark the end of a "word" in Ruby. Essentially these ! * are what break up the tokens for double-clicking and for hovers. ! */ ! private static final char[] BOUNDARIES = { ' ', '\n', '\t', '\r', '.', '(', ')', '{', '}', '[', ! ']', '=', '*', '+', '-', '"', '\'', '#'}; ! public static IRegion findWord(IDocument document, int offset) { ! int start = -1; ! int end = -1; ! ! try { ! int pos = offset; ! char c; ! ! while (pos >= 0) { ! c = document.getChar(pos); ! if (!isRubyWordPart(c)) break; ! --pos; ! } ! ! start = pos; ! ! pos = offset; ! int length = document.getLength(); ! ! while (pos < length) { ! c = document.getChar(pos); ! if (!isRubyWordPart(c)) break; ! ++pos; ! } ! ! end = pos; ! ! } catch (BadLocationException x) { ! } ! ! if (start > -1 && end > -1) { ! if (start == offset && end == offset) ! return new Region(offset, 0); ! else if (start == offset) ! return new Region(start, end - start); ! else ! return new Region(start + 1, end - start - 1); ! } ! ! return null; ! } ! ! private static boolean isRubyWordPart(char c) { ! return !isBoundary(c); ! } ! ! private static boolean isBoundary(char c) { ! return contains(BOUNDARIES, c); ! } ! ! private static boolean contains(char[] boundaries2, char c) { ! if (boundaries2 == null || boundaries2.length == 0) return false; ! for (int i = 0; i < boundaries2.length; i++) { ! if (boundaries2[i] == c) return true; ! } ! return false; ! } } |
|
From: Christopher W. <caw...@us...> - 2005-12-09 02:05:15
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695/META-INF Modified Files: MANIFEST.MF Log Message: apply the patch from murphee to allow extensions to text hovers Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MANIFEST.MF 7 Dec 2005 21:44:43 -0000 1.3 --- MANIFEST.MF 9 Dec 2005 02:05:06 -0000 1.4 *************** *** 32,35 **** --- 32,36 ---- org.rubypeople.rdt.ui, org.rubypeople.rdt.ui.actions, + org.rubypeople.rdt.ui.extensions, org.rubypeople.rdt.ui.rubyeditor, org.rubypeople.rdt.ui.text, |
|
From: Christopher W. <caw...@us...> - 2005-12-09 02:05:15
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695/schema Added Files: textHoverProvider.exsd Log Message: apply the patch from murphee to allow extensions to text hovers --- NEW FILE: textHoverProvider.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.rubypeople.rdt.ui.TextHoverProvider"> <annotation> <appInfo> <meta.schema plugin="org.rubypeople.rdt.ui" id="textHoverProvider" name="Text Hover Provider"/> </appInfo> <documentation> </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="textHoverProvider"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> </documentation> </annotation> </attribute> </complexType> </element> <element name="textHoverProvider"> <complexType> <attribute name="class" type="string" use="required"> <annotation> <documentation> The class that implements org.rubypeople.rdt.ui.extensions.ITextHoverProvider. </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.rubypeople.rdt.ui.extensions.ITextHoverProvider"/> </appInfo> </annotation> </attribute> <attribute name="fileExtension" type="string" use="optional"> <annotation> <documentation> Use this to restrict the application of this hover to particular file extensions. </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.rubypeople.rdt.ui.extensions.ITextHoverProvider"/> </appInfo> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="since"/> </appInfo> <documentation> [Enter the first release in which this extension point appears.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> [Enter extension point usage example here.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> [Enter API information here.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> [Enter information about supplied implementation of this extension point.] </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> </documentation> </annotation> </schema> |
|
From: Christopher W. <caw...@us...> - 2005-12-09 02:05:15
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695/src/org/rubypeople/rdt/ui/extensions Added Files: ITextHoverProvider.java Log Message: apply the patch from murphee to allow extensions to text hovers --- NEW FILE: ITextHoverProvider.java --- package org.rubypeople.rdt.ui.extensions; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; /** * Provides the text for a TextHover request. * * @author murphee * */ public interface ITextHoverProvider { public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion); } |
|
From: Christopher W. <caw...@us...> - 2005-12-09 02:05:15
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695/src/org/rubypeople/rdt/internal/ui/text Modified Files: RubySourceViewerConfiguration.java Log Message: apply the patch from murphee to allow extensions to text hovers Index: RubySourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubySourceViewerConfiguration.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** RubySourceViewerConfiguration.java 30 Jul 2005 21:34:54 -0000 1.21 --- RubySourceViewerConfiguration.java 9 Dec 2005 02:05:06 -0000 1.22 *************** *** 6,9 **** --- 6,10 ---- import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; + import org.eclipse.jface.text.ITextHover; import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.contentassist.IContentAssistant; *************** *** 24,27 **** --- 25,29 ---- import org.rubypeople.rdt.internal.ui.rubyeditor.RubySourceViewer; import org.rubypeople.rdt.internal.ui.text.ruby.RubyCompletionProcessor; + import org.rubypeople.rdt.internal.ui.text.ruby.hover.RubyCodeTextHover; public class RubySourceViewerConfiguration extends SourceViewerConfiguration { *************** *** 29,32 **** --- 31,35 ---- protected RubyTextTools textTools; protected ITextEditor fTextEditor; + private RubyCodeTextHover fRubyTextHover; public RubySourceViewerConfiguration(RubyTextTools theTextTools, RubyAbstractEditor theTextEditor) { *************** *** 165,167 **** --- 168,178 ---- } + + public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { + if(fRubyTextHover == null){ + fRubyTextHover = new RubyCodeTextHover(); + } + return fRubyTextHover; + } + } |
|
From: Christopher W. <caw...@us...> - 2005-12-09 02:05:14
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695 Modified Files: plugin.properties plugin.xml Log Message: apply the patch from murphee to allow extensions to text hovers Index: plugin.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.properties,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** plugin.properties 23 Oct 2005 19:47:24 -0000 1.23 --- plugin.properties 9 Dec 2005 02:05:05 -0000 1.24 *************** *** 9,12 **** --- 9,13 ---- editorPopupExtender=Editor Popup Extender foldingStructureProviders=Folding Structure Providers + textHoverProvider=TextHover Provider rubyDocumentFactory=Ruby Document Factory Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.xml,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** plugin.xml 23 Nov 2005 10:45:37 -0000 1.67 --- plugin.xml 9 Dec 2005 02:05:05 -0000 1.68 *************** *** 1,37 **** <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> ! <plugin ! id="org.rubypeople.rdt.ui" ! name="%Plugin.name" ! version="0.6.0" ! provider-name="%providerName" ! class="org.rubypeople.rdt.internal.ui.RubyPlugin"> ! ! <runtime> ! <library name="rdtui.jar"> ! <export name="*"/> ! </library> ! </runtime> ! ! <requires> ! <import plugin="org.eclipse.ui.ide"/> ! <import plugin="org.eclipse.ui.views"/> ! <import plugin="org.eclipse.jface.text"/> ! <import plugin="org.eclipse.ui.workbench.texteditor"/> ! <import plugin="org.eclipse.ui.editors"/> ! <import plugin="org.eclipse.core.runtime"/> ! <import plugin="org.eclipse.core.resources"/> ! <import plugin="org.eclipse.ui"/> ! <import plugin="org.eclipse.ui.console"/> ! <import plugin="org.eclipse.debug.ui"/> ! <import plugin="org.rubypeople.rdt.core"/> ! <import plugin="org.eclipse.ui.workbench"/> ! <import plugin="org.eclipse.core.expressions"/> ! <import plugin="org.eclipse.ui.forms"/> ! <import plugin="org.rubypeople.rdt.launching"/> ! <import plugin="org.eclipse.search"/> ! </requires> <extension-point id="foldingStructureProviders" name="%foldingStructureProviders" schema="schema/foldingStructureProviders.exsd"/> <extension-point id="editorPopupExtender" name="%editorPopupExtender" schema="schema/org.rubypeople.rdt.ui.editorPopupExtender.exsd"/> <extension point="org.eclipse.ui.preferencePages"> --- 1,10 ---- <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> ! <plugin> ! ! <extension-point id="textHoverProvider" name="%textHoverProvider" schema="schema/textHoverProvider.exsd"/> <extension-point id="foldingStructureProviders" name="%foldingStructureProviders" schema="schema/foldingStructureProviders.exsd"/> <extension-point id="editorPopupExtender" name="%editorPopupExtender" schema="schema/org.rubypeople.rdt.ui.editorPopupExtender.exsd"/> + <extension point="org.eclipse.ui.preferencePages"> *************** *** 534,536 **** --- 507,515 ---- searchResultClass="org.rubypeople.rdt.internal.ui.search.RubySearchResult"/> </extension> + + <extension + point="org.rubypeople.rdt.ui.textHoverProvider"> + <textHoverProvider class="org.rubypeople.rdt.internal.ui.text.ruby.hover.RiDocHoverProvider" /> + </extension> + </plugin> |
|
From: Christopher W. <caw...@us...> - 2005-12-09 02:05:14
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695/src/org/rubypeople/rdt/internal/ui/text/ruby/hover Added Files: RubyCodeTextHover.java RiDocHoverProvider.java Log Message: apply the patch from murphee to allow extensions to text hovers --- NEW FILE: RubyCodeTextHover.java --- package org.rubypeople.rdt.internal.ui.text.ruby.hover; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; import org.rubypeople.rdt.internal.ui.RubyPlugin; import org.rubypeople.rdt.ui.extensions.ITextHoverProvider; /** * Generic TextHover that uses installed extensions for getting information; when the TextHover is requested * then all installed TextHoverProvider extensions will be asked to provide a String to show for the location. * * @author murphee * */ public class RubyCodeTextHover extends AbstractRubyEditorTextHover { public static final String RDT_UI_NAMESPACE = "org.rubypeople.rdt.ui"; public static final String RDT_UI_TEXTHOVERPROVIDER = "textHoverProvider"; private List fExtensions; public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { List extensions = initExtensions(); try { final String symbol = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength()); // first ask the extensions if(extensions.size() > 0){ for(int i=0; i< extensions.size(); i++){ ITextHoverProvider currentProvider = (ITextHoverProvider) extensions.get(i); String hoverText = currentProvider.getHoverInfo(textViewer, hoverRegion); if(hoverText != null){ return hoverText; } } } } catch (BadLocationException e1) { RubyPlugin.log(e1); } return null; } private List initExtensions() { if(fExtensions == null){ fExtensions = new ArrayList(); IExtensionRegistry reg = Platform.getExtensionRegistry(); IExtensionPoint[] points = reg.getExtensionPoints(RDT_UI_NAMESPACE); // TODO: Look for textProvider! IExtensionPoint point = null; if(points != null){ for (int i = 0; i < points.length; i++) { IExtensionPoint currentPoint = points[i]; if(currentPoint.getUniqueIdentifier().endsWith(RDT_UI_TEXTHOVERPROVIDER)){ point = currentPoint; break; } } if(point != null){ IExtension[] exts = points[0].getExtensions(); ITextHoverProvider prov = null; for (int i = 0; i < exts.length; i++) { IConfigurationElement[] elem = exts[i].getConfigurationElements(); String attrs[] = elem[0].getAttributeNames(); try { Object tempProv = elem[0].createExecutableExtension("class"); if (tempProv instanceof ITextHoverProvider) { prov = (ITextHoverProvider) tempProv; fExtensions.add(prov); } // Object tempExtension = elem[0].getAttribute("fileExtension"); // if (tempExtension instanceof String) { // String extension = (String) tempExtension; // fileExtensionToProvider.put(extension.trim(), prov); // } } catch (Exception e) { RubyPlugin.log(e); } } } } } return fExtensions; } } --- NEW FILE: RiDocHoverProvider.java --- package org.rubypeople.rdt.internal.ui.text.ruby.hover; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; import org.rubypeople.rdt.internal.launching.RubyRuntime; import org.rubypeople.rdt.internal.ui.RubyPlugin; import org.rubypeople.rdt.ui.PreferenceConstants; import org.rubypeople.rdt.ui.extensions.ITextHoverProvider; public class RiDocHoverProvider implements ITextHoverProvider { public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion){ IPath riPath = new Path( RubyPlugin.getDefault().getPreferenceStore().getString( PreferenceConstants.RI_PATH ) ); List args = new ArrayList(); args.add(0, riPath.toString()); BufferedReader br = null; try { String symbol = textViewer.getDocument().get(hoverRegion.getOffset(), hoverRegion.getLength()); args.add(symbol); Process p = RubyRuntime.getDefault().getSelectedInterpreter().exec(args, null); br = new BufferedReader(new InputStreamReader(p.getInputStream())); // TODO: format the documentation that was fetched from RI // for now: read the first 3 lines (at most) and show them StringBuffer buf = new StringBuffer(); for(int i = 0; i < 3; i++){ String line = br.readLine(); if(line != null){ buf.append(line); buf.append("<br />"); } else { break; } } // If ambiguous, return nothing if (buf.indexOf("More than one method matched your request") > -1) return null; return "RI: " + buf.toString(); } catch (BadLocationException e) { RubyPlugin.log(e); } catch (CoreException e) { RubyPlugin.log(e); } catch (IOException e) { RubyPlugin.log(e); } finally { if(br != null){ try { br.close(); } catch (IOException e) { RubyPlugin.log(e); } } } return null; } } |
|
From: Christopher W. <caw...@us...> - 2005-12-09 02:01:38
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2761/src/org/rubypeople/rdt/ui/extensions Log Message: Directory /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/extensions added to the repository |
|
From: Christopher W. <caw...@us...> - 2005-12-07 21:44:53
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16420/META-INF Modified Files: MANIFEST.MF Log Message: make search package available to tests Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MANIFEST.MF 3 Dec 2005 02:57:01 -0000 1.2 --- MANIFEST.MF 7 Dec 2005 21:44:43 -0000 1.3 *************** *** 20,23 **** --- 20,24 ---- org.rubypeople.rdt.internal.ui.rubyeditor.outline, org.rubypeople.rdt.internal.ui.rubyeditor.templates, + org.rubypeople.rdt.internal.ui.search, org.rubypeople.rdt.internal.ui.symbols, org.rubypeople.rdt.internal.ui.text, |
|
From: Christopher W. <caw...@us...> - 2005-12-03 04:04:05
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16711/src/org/rubypeople/rdt/debug/core/tests Modified Files: FTC_DebuggerLaunch.java Log Message: Add task note that we need ot do something to fix this test fromf ailing. It's relying on a system property rdt.rubyInterpreter to be set to the full valid path to a ruby executable. This isn't happening on the nightly build (apparently) which causes the test to fail. Index: FTC_DebuggerLaunch.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerLaunch.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FTC_DebuggerLaunch.java 16 Oct 2005 23:52:50 -0000 1.2 --- FTC_DebuggerLaunch.java 3 Dec 2005 04:03:57 -0000 1.3 *************** *** 33,37 **** protected void createInterpreter() { ! RubyInterpreter rubyInterpreter = new RubyInterpreter("RubyInterpreter", new Path(FTC_DebuggerCommunicationTest.RUBY_INTERPRETER)); --- 33,37 ---- protected void createInterpreter() { ! // FIXME We rely on the RUBY_INTERPRETER to be a full path to a valid ruby executable, and it's not getting set properly so this test ends up failing (on the nightly build)! RubyInterpreter rubyInterpreter = new RubyInterpreter("RubyInterpreter", new Path(FTC_DebuggerCommunicationTest.RUBY_INTERPRETER)); |
|
From: Christopher W. <caw...@us...> - 2005-12-03 03:52:12
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14160/src/org/rubypeople/rdt/debug/core/tests Modified Files: FTC_DebuggerCommunicationTest.java Log Message: fix tests to match expected behavior now (don't suspend at exceptions by default). Add test to explicitly state this assumption. Index: FTC_DebuggerCommunicationTest.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerCommunicationTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FTC_DebuggerCommunicationTest.java 16 Oct 2005 23:52:49 -0000 1.1 --- FTC_DebuggerCommunicationTest.java 3 Dec 2005 03:52:02 -0000 1.2 *************** *** 315,318 **** --- 315,319 ---- // will suspend createSocket(new String[] { "puts 'a'", "raise 'message \\dir\\file: <xml/>\n<8>'", "puts 'c'" }); + sendRuby("catch StandardError"); sendRuby("cont"); System.out.println("Waiting for exception"); *************** *** 324,328 **** assertEquals("message \\dir\\file: <xml/> <8>", ((ExceptionSuspensionPoint) hit).getExceptionMessage()); assertEquals("RuntimeError", ((ExceptionSuspensionPoint) hit).getExceptionType()); ! sendRuby("cont"); } --- 325,330 ---- assertEquals("message \\dir\\file: <xml/> <8>", ((ExceptionSuspensionPoint) hit).getExceptionMessage()); assertEquals("RuntimeError", ((ExceptionSuspensionPoint) hit).getExceptionType()); ! sendRuby("catch off"); ! sendRuby("cont"); } *************** *** 336,339 **** --- 338,349 ---- } + public void testExceptionsIgnoredByDefault() throws Exception { + createSocket(new String[] { "puts 'a'", "raise 'dont stop'" }); + sendRuby("cont"); + System.out.println("Waiting for the program to finish without suspending at the raise command"); + SuspensionPoint hit = getSuspensionReader().readSuspension(); + assertNull(hit); + } + public void testExceptionHierarchy() throws Exception { createSocket(new String[] { "class MyError < StandardError", "end", "begin", "raise StandardError.new", "rescue", "end", "raise MyError.new"}); |