[Pydev-cvs] org.python.pydev.core/src/org/python/pydev/core DeltaSaver.java, 1.9, 1.10 IModule.java
Brought to you by:
fabioz
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19948/src/org/python/pydev/core Modified Files: DeltaSaver.java IModule.java FullRepIterable.java ExtensionHelper.java IToken.java IInterpreterManager.java ISourceModule.java ICodeCompletionASTManager.java Tuple.java ObjectsPool.java StringMatcher.java ModulesKey.java CorePlugin.java REF.java TupleN.java IProjectModulesManager.java IPythonPartitions.java IPythonNature.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: IInterpreterManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/IInterpreterManager.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IInterpreterManager.java 8 Jul 2007 21:14:58 -0000 1.8 --- IInterpreterManager.java 27 Sep 2008 19:57:34 -0000 1.9 *************** *** 120,130 **** * @return the Persisted string with the information on this interpreter manager. */ ! public String getPersistedString(); ! /** ! * Set the string to be persisted with the information on this interpreter manager ! * @param s ! */ ! public void setPersistedString(String s); /** --- 120,130 ---- * @return the Persisted string with the information on this interpreter manager. */ ! public String getPersistedString(); ! /** ! * Set the string to be persisted with the information on this interpreter manager ! * @param s ! */ ! public void setPersistedString(String s); /** *************** *** 147,163 **** //caches for the builtin tokens and module ! public void setBuiltinCompletions(IToken[] comps); ! public IToken[] getBuiltinCompletions(); ! public IModule getBuiltinMod(); ! public void setBuiltinMod(IModule mod); ! public void clearCaches(); ! /** ! * Saves the system modules managers info so that it can be restored later (it's restored when the plugin is started). ! */ public void saveInterpretersInfoModulesManager(); --- 147,163 ---- //caches for the builtin tokens and module ! public void setBuiltinCompletions(IToken[] comps); ! public IToken[] getBuiltinCompletions(); ! public IModule getBuiltinMod(); ! public void setBuiltinMod(IModule mod); ! public void clearCaches(); ! /** ! * Saves the system modules managers info so that it can be restored later (it's restored when the plugin is started). ! */ public void saveInterpretersInfoModulesManager(); Index: DeltaSaver.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/DeltaSaver.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DeltaSaver.java 27 Oct 2007 12:42:55 -0000 1.9 --- DeltaSaver.java 27 Sep 2008 19:57:34 -0000 1.10 *************** *** 174,190 **** */ private void loadDeltas() { ! synchronized(this.commands){ ! ArrayList<File> deltasFound = findDeltas(); ! for (File file : deltasFound) { ! try { ! DeltaCommand cmd = (DeltaCommand) IOUtils.readFromFile(file, this.readFromFileMethod); ! if(cmd != null && cmd.data != null){ ! addRestoredCommand(cmd); ! } ! } catch (Exception e) { ! Log.log(e); ! } ! } ! } } --- 174,190 ---- */ private void loadDeltas() { ! synchronized(this.commands){ ! ArrayList<File> deltasFound = findDeltas(); ! for (File file : deltasFound) { ! try { ! DeltaCommand cmd = (DeltaCommand) IOUtils.readFromFile(file, this.readFromFileMethod); ! if(cmd != null && cmd.data != null){ ! addRestoredCommand(cmd); ! } ! } catch (Exception e) { ! Log.log(e); ! } ! } ! } } *************** *** 230,245 **** */ public void addCommand(DeltaCommand command) { ! synchronized(this.commands){ ! File file = new File(this.dirToSaveDeltas, nCommands+suffix); ! nCommands++; ! try { ! file.createNewFile(); ! } catch (IOException e) { ! throw new RuntimeException(e); ! } ! //always write the command and its data separately ! IOUtils.writeToFile(command, command.data, file); ! this.commands.add(command); ! } } --- 230,245 ---- */ public void addCommand(DeltaCommand command) { ! synchronized(this.commands){ ! File file = new File(this.dirToSaveDeltas, nCommands+suffix); ! nCommands++; ! try { ! file.createNewFile(); ! } catch (IOException e) { ! throw new RuntimeException(e); ! } ! //always write the command and its data separately ! IOUtils.writeToFile(command, command.data, file); ! this.commands.add(command); ! } } *************** *** 248,254 **** */ public int availableDeltas() { ! synchronized(this.commands){ ! return this.commands.size(); ! } } --- 248,254 ---- */ public int availableDeltas() { ! synchronized(this.commands){ ! return this.commands.size(); ! } } *************** *** 260,266 **** ArrayList<File> deltas = findDeltas(); for (File file : deltas) { ! if(file.exists()){ ! file.delete(); ! } } this.commands.clear(); --- 260,266 ---- ArrayList<File> deltas = findDeltas(); for (File file : deltas) { ! if(file.exists()){ ! file.delete(); ! } } this.commands.clear(); *************** *** 287,305 **** synchronized(this.commands){ ArrayList<DeltaCommand> commandsToProcess = new ArrayList<DeltaCommand>(this.commands); ! boolean processed = false; ! for (DeltaCommand cmd : commandsToProcess) { ! try { ! cmd.processWith(deltaProcessor); ! processed = false; ! } catch (Exception e) { ! Log.log(e); ! } ! } ! if(processed){ ! //if nothing happened, we don't end the processing (no need to do it) ! deltaProcessor.endProcessing(); ! } ! this.clearAll(); ! } } --- 287,305 ---- synchronized(this.commands){ ArrayList<DeltaCommand> commandsToProcess = new ArrayList<DeltaCommand>(this.commands); ! boolean processed = false; ! for (DeltaCommand cmd : commandsToProcess) { ! try { ! cmd.processWith(deltaProcessor); ! processed = false; ! } catch (Exception e) { ! Log.log(e); ! } ! } ! if(processed){ ! //if nothing happened, we don't end the processing (no need to do it) ! deltaProcessor.endProcessing(); ! } ! this.clearAll(); ! } } *************** *** 335,362 **** public static Object readFromFile(File astOutputFile, ICallback<Object, ObjectInputStream> readFromFileMethod) { try { ! boolean deletFile = false; ! //the file is not even there ! if(!astOutputFile.exists()){ ! return null; ! } InputStream input = new FileInputStream(astOutputFile); ObjectInputStream in = new ObjectInputStream(input); DeltaSaver.DeltaCommand o = null; try { ! o = (DeltaSaver.DeltaCommand) in.readObject(); ! o.readData(readFromFileMethod, in); } catch (Exception e) { ! //the format has changed (no real problem here... just erase the file) ! deletFile = true; ! o = null; ! } finally { ! in.close(); ! input.close(); ! } ! if(deletFile){ ! if(astOutputFile.exists()){ ! astOutputFile.delete(); ! } ! } return o; } catch (Exception e) { --- 335,362 ---- public static Object readFromFile(File astOutputFile, ICallback<Object, ObjectInputStream> readFromFileMethod) { try { ! boolean deletFile = false; ! //the file is not even there ! if(!astOutputFile.exists()){ ! return null; ! } InputStream input = new FileInputStream(astOutputFile); ObjectInputStream in = new ObjectInputStream(input); DeltaSaver.DeltaCommand o = null; try { ! o = (DeltaSaver.DeltaCommand) in.readObject(); ! o.readData(readFromFileMethod, in); } catch (Exception e) { ! //the format has changed (no real problem here... just erase the file) ! deletFile = true; ! o = null; ! } finally { ! in.close(); ! input.close(); ! } ! if(deletFile){ ! if(astOutputFile.exists()){ ! astOutputFile.delete(); ! } ! } return o; } catch (Exception e) { Index: IProjectModulesManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/IProjectModulesManager.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IProjectModulesManager.java 31 Jul 2008 01:47:54 -0000 1.5 --- IProjectModulesManager.java 27 Sep 2008 19:57:34 -0000 1.6 *************** *** 30,40 **** public abstract void endProcessing(); ! public abstract void rebuildModule(File f, IDocument doc, IProject project, IProgressMonitor monitor, IPythonNature nature); ! public abstract void removeModule(File file, IProject project, IProgressMonitor monitor); ! /** ! * @return a given module only if it's actually controlled in the given modules manager (not considering any dependencies) ! */ public abstract IModule getModuleInDirectManager(String name, IPythonNature nature, boolean dontSearchInit); --- 30,40 ---- public abstract void endProcessing(); ! public abstract void rebuildModule(File f, IDocument doc, IProject project, IProgressMonitor monitor, IPythonNature nature); ! public abstract void removeModule(File file, IProject project, IProgressMonitor monitor); ! /** ! * @return a given module only if it's actually controlled in the given modules manager (not considering any dependencies) ! */ public abstract IModule getModuleInDirectManager(String name, IPythonNature nature, boolean dontSearchInit); Index: ObjectsPool.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ObjectsPool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ObjectsPool.java 13 Apr 2007 19:47:37 -0000 1.4 --- ObjectsPool.java 27 Sep 2008 19:57:34 -0000 1.5 *************** *** 30,53 **** */ @SuppressWarnings("unchecked") ! public synchronized S getFromPool(S o){ ! synchronized(weakHashMap){ WeakReference<S> w = (WeakReference<S>)weakHashMap.get(o); if(w == null){ ! //garbage collected or still not there... ! weakHashMap.put(o, new WeakReference<S>(o)); ! return o; ! }else{ ! final S ret = w.get(); ! if(ret == null && o != null){ ! //garbage collected just in time hum? ! weakHashMap.put(o, new WeakReference<S>(o)); ! return o; ! ! }else{ ! return ret; ! } } ! } } } --- 30,53 ---- */ @SuppressWarnings("unchecked") ! public synchronized S getFromPool(S o){ ! synchronized(weakHashMap){ WeakReference<S> w = (WeakReference<S>)weakHashMap.get(o); if(w == null){ ! //garbage collected or still not there... ! weakHashMap.put(o, new WeakReference<S>(o)); ! return o; ! }else{ ! final S ret = w.get(); ! if(ret == null && o != null){ ! //garbage collected just in time hum? ! weakHashMap.put(o, new WeakReference<S>(o)); ! return o; ! ! }else{ ! return ret; ! } } ! } } } Index: IModule.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/IModule.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** IModule.java 25 Jan 2008 01:53:49 -0000 1.12 --- IModule.java 27 Sep 2008 19:57:34 -0000 1.13 *************** *** 50,54 **** public abstract IToken[] getLocalTokens(int line, int col, ILocalScope localScope); ! public abstract boolean isInDirectGlobalTokens(String tok, ICompletionCache completionCache); public abstract boolean isInGlobalTokens(String tok, IPythonNature nature, ICompletionCache completionCache) throws CompletionRecursionException; --- 50,54 ---- public abstract IToken[] getLocalTokens(int line, int col, ILocalScope localScope); ! public abstract boolean isInDirectGlobalTokens(String tok, ICompletionCache completionCache); public abstract boolean isInGlobalTokens(String tok, IPythonNature nature, ICompletionCache completionCache) throws CompletionRecursionException; Index: IToken.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/IToken.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IToken.java 20 Oct 2007 23:26:19 -0000 1.7 --- IToken.java 27 Sep 2008 19:57:34 -0000 1.8 *************** *** 164,168 **** * e.g.: if it was import from coilib.test import Exceptions, it would return coilib.test */ ! public String getOriginalWithoutRep(); /** --- 164,168 ---- * e.g.: if it was import from coilib.test import Exceptions, it would return coilib.test */ ! public String getOriginalWithoutRep(); /** Index: FullRepIterable.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/FullRepIterable.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** FullRepIterable.java 18 May 2008 20:02:26 -0000 1.20 --- FullRepIterable.java 27 Sep 2008 19:57:34 -0000 1.21 *************** *** 158,244 **** * @return the name of the parent module of the module represented by currentModuleName */ ! public static String getParentModule(String currentModuleName) { ! return headAndTail(currentModuleName, true)[0]; ! } ! /** ! * @return All that is after the last dot (or the whole string if there is no dot) ! */ ! public static String getLastPart(String tokToCheck) { ! int i = tokToCheck.lastIndexOf('.'); ! if(i == -1){ ! return tokToCheck; ! } ! return tokToCheck.substring(i+1); ! } ! /** ! * @return All that is before the first dot (or the whole string if there is no dot) ! */ ! public static String getFirstPart(String tokToCheck) { ! int i = tokToCheck.indexOf('.'); ! if(i == -1){ ! return tokToCheck; ! } ! return tokToCheck.substring(0, i); ! } ! ! /** ! * @return All that is before the first dot (or the whole string if there is no dot) ! */ ! public static String getFirstPart(String tokToCheck, char[] toks) { String ret = tokToCheck; for(char c: toks){ ! int i = tokToCheck.indexOf(c); ! if(i != -1){ String s = tokToCheck.substring(0, i); if(s.length() < ret.length()){ ret = s; } ! } } ! return ret; ! } ! ! /** ! * @return All that is before the last dot (or an empty string if there is no dot) ! */ ! public static String getWithoutLastPart(String currentModuleName) { ! int i = currentModuleName.lastIndexOf('.'); ! if(i == -1){ ! return ""; ! } ! return currentModuleName.substring(0, i); ! } ! public static String joinParts(String[] actToks, int parts) { ! StringBuffer buffer = new StringBuffer(); ! for (int i = 0; i < parts; i++) { ! if(i > 0){ ! buffer.append('.'); ! } ! buffer.append(actToks[i]); ! } ! return buffer.toString(); } ! public static String joinFirstParts(String[] actToks) { return joinParts(actToks, actToks.length-1); ! } ! /** ! * @return whether the foundRep contains some part with the nameToFind ! */ ! public static boolean containsPart(String foundRep, String nameToFind) { ! String[] strings = StringUtils.dotSplit(foundRep); ! for (String string : strings) { ! if(string.equals(nameToFind)){ ! return true; ! } ! } ! return false; ! } ! } --- 158,244 ---- * @return the name of the parent module of the module represented by currentModuleName */ ! public static String getParentModule(String currentModuleName) { ! return headAndTail(currentModuleName, true)[0]; ! } ! /** ! * @return All that is after the last dot (or the whole string if there is no dot) ! */ ! public static String getLastPart(String tokToCheck) { ! int i = tokToCheck.lastIndexOf('.'); ! if(i == -1){ ! return tokToCheck; ! } ! return tokToCheck.substring(i+1); ! } ! /** ! * @return All that is before the first dot (or the whole string if there is no dot) ! */ ! public static String getFirstPart(String tokToCheck) { ! int i = tokToCheck.indexOf('.'); ! if(i == -1){ ! return tokToCheck; ! } ! return tokToCheck.substring(0, i); ! } ! ! /** ! * @return All that is before the first dot (or the whole string if there is no dot) ! */ ! public static String getFirstPart(String tokToCheck, char[] toks) { String ret = tokToCheck; for(char c: toks){ ! int i = tokToCheck.indexOf(c); ! if(i != -1){ String s = tokToCheck.substring(0, i); if(s.length() < ret.length()){ ret = s; } ! } } ! return ret; ! } ! ! /** ! * @return All that is before the last dot (or an empty string if there is no dot) ! */ ! public static String getWithoutLastPart(String currentModuleName) { ! int i = currentModuleName.lastIndexOf('.'); ! if(i == -1){ ! return ""; ! } ! return currentModuleName.substring(0, i); ! } ! public static String joinParts(String[] actToks, int parts) { ! StringBuffer buffer = new StringBuffer(); ! for (int i = 0; i < parts; i++) { ! if(i > 0){ ! buffer.append('.'); ! } ! buffer.append(actToks[i]); ! } ! return buffer.toString(); } ! public static String joinFirstParts(String[] actToks) { return joinParts(actToks, actToks.length-1); ! } ! /** ! * @return whether the foundRep contains some part with the nameToFind ! */ ! public static boolean containsPart(String foundRep, String nameToFind) { ! String[] strings = StringUtils.dotSplit(foundRep); ! for (String string : strings) { ! if(string.equals(nameToFind)){ ! return true; ! } ! } ! return false; ! } ! } Index: StringMatcher.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/StringMatcher.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StringMatcher.java 21 Mar 2008 21:57:28 -0000 1.2 --- StringMatcher.java 27 Sep 2008 19:57:34 -0000 1.3 *************** *** 74,84 **** * @param ignoreCase if true, case is ignored * @param ignoreWildCards if true, wild cards and their escape sequences are ignored ! * (everything is taken literally). */ public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) { if (pattern == null) { ! throw new IllegalArgumentException(); ! } fIgnoreCase = ignoreCase; fIgnoreWildCards = ignoreWildCards; --- 74,84 ---- * @param ignoreCase if true, case is ignored * @param ignoreWildCards if true, wild cards and their escape sequences are ignored ! * (everything is taken literally). */ public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) { if (pattern == null) { ! throw new IllegalArgumentException(); ! } fIgnoreCase = ignoreCase; fIgnoreWildCards = ignoreWildCards; *************** *** 108,132 **** public StringMatcher.Position find(String text, int start, int end) { if (text == null) { ! throw new IllegalArgumentException(); ! } int tlen = text.length(); if (start < 0) { ! start = 0; ! } if (end > tlen) { ! end = tlen; ! } if (end < 0 || start >= end) { ! return null; ! } if (fLength == 0) { ! return new Position(start, start); ! } if (fIgnoreWildCards) { int x = posIn(text, start, end); if (x < 0) { ! return null; ! } return new Position(x, x + fLength); } --- 108,132 ---- public StringMatcher.Position find(String text, int start, int end) { if (text == null) { ! throw new IllegalArgumentException(); ! } int tlen = text.length(); if (start < 0) { ! start = 0; ! } if (end > tlen) { ! end = tlen; ! } if (end < 0 || start >= end) { ! return null; ! } if (fLength == 0) { ! return new Position(start, start); ! } if (fIgnoreWildCards) { int x = posIn(text, start, end); if (x < 0) { ! return null; ! } return new Position(x, x + fLength); } *************** *** 134,139 **** int segCount = fSegments.length; if (segCount == 0) { ! return new Position(start, end); ! } int curPos = start; --- 134,139 ---- int segCount = fSegments.length; if (segCount == 0) { ! return new Position(start, end); ! } int curPos = start; *************** *** 144,157 **** int nextMatch = regExpPosIn(text, curPos, end, current); if (nextMatch < 0) { ! return null; ! } if (i == 0) { ! matchStart = nextMatch; ! } curPos = nextMatch + current.length(); } if (i < segCount) { ! return null; ! } return new Position(matchStart, curPos); } --- 144,157 ---- int nextMatch = regExpPosIn(text, curPos, end, current); if (nextMatch < 0) { ! return null; ! } if (i == 0) { ! matchStart = nextMatch; ! } curPos = nextMatch + current.length(); } if (i < segCount) { ! return null; ! } return new Position(matchStart, curPos); } *************** *** 176,215 **** public boolean match(String text, int start, int end) { if (null == text) { ! throw new IllegalArgumentException(); ! } if (start > end) { ! return false; ! } if (fIgnoreWildCards) { ! return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength); ! } int segCount = fSegments.length; if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) { ! return true; ! } if (start == end) { ! return fLength == 0; ! } if (fLength == 0) { ! return start == end; ! } int tlen = text.length(); if (start < 0) { ! start = 0; ! } if (end > tlen) { ! end = tlen; ! } int tCurPos = start; int bound = end - fBound; if (bound < 0) { ! return false; ! } int i = 0; String current = fSegments[i]; --- 176,215 ---- public boolean match(String text, int start, int end) { if (null == text) { ! throw new IllegalArgumentException(); ! } if (start > end) { ! return false; ! } if (fIgnoreWildCards) { ! return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength); ! } int segCount = fSegments.length; if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) { ! return true; ! } if (start == end) { ! return fLength == 0; ! } if (fLength == 0) { ! return start == end; ! } int tlen = text.length(); if (start < 0) { ! start = 0; ! } if (end > tlen) { ! end = tlen; ! } int tCurPos = start; int bound = end - fBound; if (bound < 0) { ! return false; ! } int i = 0; String current = fSegments[i]; *************** *** 238,248 **** currentMatch = textPosIn(text, tCurPos, end, current); if (currentMatch < 0) { ! return false; ! } } else { currentMatch = regExpPosIn(text, tCurPos, end, current); if (currentMatch < 0) { ! return false; ! } } tCurPos = currentMatch + current.length(); --- 238,248 ---- currentMatch = textPosIn(text, tCurPos, end, current); if (currentMatch < 0) { ! return false; ! } } else { currentMatch = regExpPosIn(text, tCurPos, end, current); if (currentMatch < 0) { ! return false; ! } } tCurPos = currentMatch + current.length(); *************** *** 274,279 **** private void parseWildCards() { if (fPattern.startsWith("*")) { //$NON-NLS-1$ ! fHasLeadingStar = true; ! } if (fPattern.endsWith("*")) {//$NON-NLS-1$ /* make sure it's not an escaped wildcard */ --- 274,279 ---- private void parseWildCards() { if (fPattern.startsWith("*")) { //$NON-NLS-1$ ! fHasLeadingStar = true; ! } if (fPattern.endsWith("*")) {//$NON-NLS-1$ /* make sure it's not an escaped wildcard */ *************** *** 344,349 **** int i = text.indexOf(fPattern, start); if (i == -1 || i > max) { ! return -1; ! } return i; } --- 344,349 ---- int i = text.indexOf(fPattern, start); if (i == -1 || i > max) { ! return -1; ! } return i; } *************** *** 351,356 **** for (int i = start; i <= max; ++i) { if (text.regionMatches(true, i, fPattern, 0, fLength)) { ! return i; ! } } --- 351,356 ---- for (int i = start; i <= max; ++i) { if (text.regionMatches(true, i, fPattern, 0, fLength)) { ! return i; ! } } *************** *** 371,376 **** for (int i = start; i <= max; ++i) { if (regExpRegionMatches(text, i, p, 0, plen)) { ! return i; ! } } return -1; --- 371,376 ---- for (int i = start; i <= max; ++i) { if (regExpRegionMatches(text, i, p, 0, plen)) { ! return i; ! } } return -1; *************** *** 384,388 **** * @param p String, String, a simple regular expression that may contain '?' * @param pStart ! * @param plen */ protected boolean regExpRegionMatches(String text, int tStart, String p, --- 384,388 ---- * @param p String, String, a simple regular expression that may contain '?' * @param pStart ! * @param plen */ protected boolean regExpRegionMatches(String text, int tStart, String p, *************** *** 400,416 **** } if (pchar == tchar) { ! continue; ! } if (fIgnoreCase) { if (Character.toUpperCase(tchar) == Character .toUpperCase(pchar)) { ! continue; ! } // comparing after converting to upper case doesn't handle all cases; // also compare after converting to lower case if (Character.toLowerCase(tchar) == Character .toLowerCase(pchar)) { ! continue; ! } } return false; --- 400,416 ---- } if (pchar == tchar) { ! continue; ! } if (fIgnoreCase) { if (Character.toUpperCase(tchar) == Character .toUpperCase(pchar)) { ! continue; ! } // comparing after converting to upper case doesn't handle all cases; // also compare after converting to lower case if (Character.toLowerCase(tchar) == Character .toLowerCase(pchar)) { ! continue; ! } } return false; *************** *** 434,439 **** int i = text.indexOf(p, start); if (i == -1 || i > max) { ! return -1; ! } return i; } --- 434,439 ---- int i = text.indexOf(p, start); if (i == -1 || i > max) { ! return -1; ! } return i; } *************** *** 441,446 **** for (int i = start; i <= max; ++i) { if (text.regionMatches(true, i, p, 0, plen)) { ! return i; ! } } --- 441,446 ---- for (int i = start; i <= max; ++i) { if (text.regionMatches(true, i, p, 0, plen)) { ! return i; ! } } Index: Tuple.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/Tuple.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Tuple.java 31 May 2006 19:45:23 -0000 1.6 --- Tuple.java 27 Sep 2008 19:57:34 -0000 1.7 *************** *** 29,47 **** Tuple t2 = (Tuple) obj; if(o1 == t2.o1 && o2 == t2.o2){ //all the same ! return true; } ! if(o1 == null && t2.o1 != null){ ! return false; ! } ! if(o2 == null && t2.o2 != null){ ! return false; ! } ! if(o1 != null && t2.o1 == null){ ! return false; ! } ! if(o2 != null && t2.o2 == null){ ! return false; ! } --- 29,47 ---- Tuple t2 = (Tuple) obj; if(o1 == t2.o1 && o2 == t2.o2){ //all the same ! return true; } ! if(o1 == null && t2.o1 != null){ ! return false; ! } ! if(o2 == null && t2.o2 != null){ ! return false; ! } ! if(o1 != null && t2.o1 == null){ ! return false; ! } ! if(o2 != null && t2.o2 == null){ ! return false; ! } *************** *** 57,70 **** @Override public int hashCode() { ! if(o1 != null && o2 != null){ ! return o1.hashCode() * o2.hashCode(); ! } ! if(o1 != null){ ! return o1.hashCode(); ! } ! if(o2 != null){ ! return o2.hashCode(); ! } ! return 7; } --- 57,70 ---- @Override public int hashCode() { ! if(o1 != null && o2 != null){ ! return o1.hashCode() * o2.hashCode(); ! } ! if(o1 != null){ ! return o1.hashCode(); ! } ! if(o2 != null){ ! return o2.hashCode(); ! } ! return 7; } Index: REF.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/REF.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** REF.java 6 Jul 2008 14:11:40 -0000 1.41 --- REF.java 27 Sep 2008 19:57:34 -0000 1.42 *************** *** 80,89 **** */ public static Field getAttrFromClass(Class<? extends Object> c, String attr){ ! try { ! return c.getDeclaredField(attr); ! } catch (SecurityException e) { ! } catch (NoSuchFieldException e) { ! } ! return null; } --- 80,89 ---- */ public static Field getAttrFromClass(Class<? extends Object> c, String attr){ ! try { ! return c.getDeclaredField(attr); ! } catch (SecurityException e) { ! } catch (NoSuchFieldException e) { ! } ! return null; } *************** *** 399,420 **** */ public static Object readFromFile(File file){ ! try { ! InputStream in = new BufferedInputStream(new FileInputStream(file)); ! try { ! ObjectInputStream stream = new ObjectInputStream(in); ! try { ! Object o = stream.readObject(); ! return o; ! } finally { ! stream.close(); ! } ! } finally { ! in.close(); ! } ! } catch (Exception e) { ! Log.log(e); ! return null; ! } ! } --- 399,420 ---- */ public static Object readFromFile(File file){ ! try { ! InputStream in = new BufferedInputStream(new FileInputStream(file)); ! try { ! ObjectInputStream stream = new ObjectInputStream(in); ! try { ! Object o = stream.readObject(); ! return o; ! } finally { ! stream.close(); ! } ! } finally { ! in.close(); ! } ! } catch (Exception e) { ! Log.log(e); ! return null; ! } ! } *************** *** 552,556 **** public static IDocument getDocFromFile(java.io.File f) throws IOException { ! return getDocFromFile(f, true); } --- 552,556 ---- public static IDocument getDocFromFile(java.io.File f) throws IOException { ! return getDocFromFile(f, true); } *************** *** 684,689 **** }catch(Throwable e){//NoSuchMethod/NoClassDef exception if(e instanceof ClassNotFoundException || e instanceof LinkageError || e instanceof NoSuchMethodException || ! e instanceof NoSuchMethodError || e instanceof NoClassDefFoundError){ ! ITextFileBufferManager textFileBufferManager = FileBuffers.getTextFileBufferManager(); --- 684,689 ---- }catch(Throwable e){//NoSuchMethod/NoClassDef exception if(e instanceof ClassNotFoundException || e instanceof LinkageError || e instanceof NoSuchMethodException || ! e instanceof NoSuchMethodError || e instanceof NoClassDefFoundError){ ! ITextFileBufferManager textFileBufferManager = FileBuffers.getTextFileBufferManager(); *************** *** 710,714 **** } return null; ! } } /** --- 710,714 ---- } return null; ! } } /** *************** *** 717,725 **** */ public static IDocument getDocFromPath(IPath path) { ! ITextFileBuffer buffer = getBufferFromPath(path); ! if(buffer != null){ ! return buffer.getDocument(); ! } ! return null; } --- 717,725 ---- */ public static IDocument getDocFromPath(IPath path) { ! ITextFileBuffer buffer = getBufferFromPath(path); ! if(buffer != null){ ! return buffer.getDocument(); ! } ! return null; } *************** *** 748,753 **** return doc; }catch(CoreException e){ ! //it may stop existing from the initial exists check to the getContents call ! return null; } catch (Exception e) { Log.log(e); --- 748,753 ---- return doc; }catch(CoreException e){ ! //it may stop existing from the initial exists check to the getContents call ! return null; } catch (Exception e) { Log.log(e); *************** *** 773,784 **** try { final FileInputStream fileInputStream = new FileInputStream(f); ! try { ! Reader inputStreamReader = new InputStreamReader(new BufferedInputStream(fileInputStream)); ! String pythonFileEncoding = getPythonFileEncoding(inputStreamReader, f.getAbsolutePath()); ! return pythonFileEncoding; ! } finally { ! //NOTE: the reader will be closed at 'getPythonFileEncoding'. ! try { fileInputStream.close(); } catch (Exception e) {Log.log(e); } ! } } catch (FileNotFoundException e) { return null; --- 773,784 ---- try { final FileInputStream fileInputStream = new FileInputStream(f); ! try { ! Reader inputStreamReader = new InputStreamReader(new BufferedInputStream(fileInputStream)); ! String pythonFileEncoding = getPythonFileEncoding(inputStreamReader, f.getAbsolutePath()); ! return pythonFileEncoding; ! } finally { ! //NOTE: the reader will be closed at 'getPythonFileEncoding'. ! try { fileInputStream.close(); } catch (Exception e) {Log.log(e); } ! } } catch (FileNotFoundException e) { return null; *************** *** 904,908 **** isWinCache = Platform.getOS().equals(Constants.OS_WIN32); } catch (NullPointerException e) { ! String env = System.getProperty("os.name"); if(env.toLowerCase().indexOf("win") != -1){ isWinCache = true; --- 904,908 ---- isWinCache = Platform.getOS().equals(Constants.OS_WIN32); } catch (NullPointerException e) { ! String env = System.getProperty("os.name"); if(env.toLowerCase().indexOf("win") != -1){ isWinCache = true; Index: CorePlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/CorePlugin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CorePlugin.java 16 Mar 2006 18:21:13 -0000 1.3 --- CorePlugin.java 27 Sep 2008 19:57:34 -0000 1.4 *************** *** 11,75 **** */ public class CorePlugin extends AbstractUIPlugin { ! //The shared instance. ! private static CorePlugin plugin; ! //Resource bundle. ! private ResourceBundle resourceBundle; ! ! /** ! * The constructor. ! */ ! public CorePlugin() { ! super(); ! plugin = this; ! try { ! resourceBundle = ResourceBundle.getBundle("org.python.pydev.core.CorePluginResources"); ! } catch (MissingResourceException x) { ! resourceBundle = null; ! } ! } public static String getPluginID() { ! return getDefault().getBundle().getSymbolicName(); } ! /** ! * This method is called upon plug-in activation ! */ ! public void start(BundleContext context) throws Exception { ! super.start(context); ! } ! /** ! * This method is called when the plug-in is stopped ! */ ! public void stop(BundleContext context) throws Exception { ! super.stop(context); ! } ! /** ! * Returns the shared instance. ! */ ! public static CorePlugin getDefault() { ! return plugin; ! } ! /** ! * Returns the string from the plugin's resource bundle, ! * or 'key' if not found. ! */ ! public static String getResourceString(String key) { ! ResourceBundle bundle = CorePlugin.getDefault().getResourceBundle(); ! try { ! return (bundle != null) ? bundle.getString(key) : key; ! } catch (MissingResourceException e) { ! return key; ! } ! } ! /** ! * Returns the plugin's resource bundle, ! */ ! public ResourceBundle getResourceBundle() { ! return resourceBundle; ! } } --- 11,75 ---- */ public class CorePlugin extends AbstractUIPlugin { ! //The shared instance. ! private static CorePlugin plugin; ! //Resource bundle. ! private ResourceBundle resourceBundle; ! ! /** ! * The constructor. ! */ ! public CorePlugin() { ! super(); ! plugin = this; ! try { ! resourceBundle = ResourceBundle.getBundle("org.python.pydev.core.CorePluginResources"); ! } catch (MissingResourceException x) { ! resourceBundle = null; ! } ! } public static String getPluginID() { ! return getDefault().getBundle().getSymbolicName(); } ! /** ! * This method is called upon plug-in activation ! */ ! public void start(BundleContext context) throws Exception { ! super.start(context); ! } ! /** ! * This method is called when the plug-in is stopped ! */ ! public void stop(BundleContext context) throws Exception { ! super.stop(context); ! } ! /** ! * Returns the shared instance. ! */ ! public static CorePlugin getDefault() { ! return plugin; ! } ! /** ! * Returns the string from the plugin's resource bundle, ! * or 'key' if not found. ! */ ! public static String getResourceString(String key) { ! ResourceBundle bundle = CorePlugin.getDefault().getResourceBundle(); ! try { ! return (bundle != null) ? bundle.getString(key) : key; ! } catch (MissingResourceException e) { ! return key; ! } ! } ! /** ! * Returns the plugin's resource bundle, ! */ ! public ResourceBundle getResourceBundle() { ! return resourceBundle; ! } } Index: IPythonPartitions.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/IPythonPartitions.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IPythonPartitions.java 18 Mar 2008 02:55:21 -0000 1.2 --- IPythonPartitions.java 27 Sep 2008 19:57:34 -0000 1.3 *************** *** 5,9 **** public interface IPythonPartitions { ! //this is just so that we don't have to break the interface public final static String PY_COMMENT = "__python_comment"; public final static String PY_SINGLELINE_STRING1 = "__python_singleline_string1";//' --- 5,9 ---- public interface IPythonPartitions { ! //this is just so that we don't have to break the interface public final static String PY_COMMENT = "__python_comment"; public final static String PY_SINGLELINE_STRING1 = "__python_singleline_string1";//' *************** *** 14,20 **** public final static String PY_DEFAULT = IDocument.DEFAULT_CONTENT_TYPE; ! public final static String[] types = {PY_COMMENT, PY_SINGLELINE_STRING1, PY_SINGLELINE_STRING2, ! PY_MULTILINE_STRING1, PY_MULTILINE_STRING2, PY_BACKQUOTES}; ! public static final String PYTHON_PARTITION_TYPE = "__PYTHON_PARTITION_TYPE"; } --- 14,20 ---- public final static String PY_DEFAULT = IDocument.DEFAULT_CONTENT_TYPE; ! public final static String[] types = {PY_COMMENT, PY_SINGLELINE_STRING1, PY_SINGLELINE_STRING2, ! PY_MULTILINE_STRING1, PY_MULTILINE_STRING2, PY_BACKQUOTES}; ! public static final String PYTHON_PARTITION_TYPE = "__PYTHON_PARTITION_TYPE"; } Index: IPythonNature.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/IPythonNature.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** IPythonNature.java 2 May 2008 23:24:18 -0000 1.18 --- IPythonNature.java 27 Sep 2008 19:57:34 -0000 1.19 *************** *** 104,113 **** * Rebuilds the path with the current path information (just to refresh it). */ ! void rebuildPath(); ! /** ! * Rebuilds the path with the current path information, but using the interpreter passed ! */ ! void rebuildPath(String defaultSelectedInterpreter, IProgressMonitor monitor); IInterpreterManager getRelatedInterpreterManager(); --- 104,113 ---- * Rebuilds the path with the current path information (just to refresh it). */ ! void rebuildPath(); ! /** ! * Rebuilds the path with the current path information, but using the interpreter passed ! */ ! void rebuildPath(String defaultSelectedInterpreter, IProgressMonitor monitor); IInterpreterManager getRelatedInterpreterManager(); *************** *** 123,147 **** * @param toks those are the tokens that are set as builtin completions. */ ! void setBuiltinCompletions(IToken[] toks); ! /** ! * @return the module for the builtins (may return null if not set) ! */ ! IModule getBuiltinMod(); ! /** ! * @param mod the builtion module ! */ ! void setBuiltinMod(IModule mod); ! /** ! * Checks if the given resource is in the pythonpath ! */ ! boolean isResourceInPythonpath(IResource resource); ! boolean isResourceInPythonpath(String resource); ! /** ! * @return true if it is ok to use the nature ! */ ! boolean startRequests(); ! void endRequests(); } --- 123,147 ---- * @param toks those are the tokens that are set as builtin completions. */ ! void setBuiltinCompletions(IToken[] toks); ! /** ! * @return the module for the builtins (may return null if not set) ! */ ! IModule getBuiltinMod(); ! /** ! * @param mod the builtion module ! */ ! void setBuiltinMod(IModule mod); ! /** ! * Checks if the given resource is in the pythonpath ! */ ! boolean isResourceInPythonpath(IResource resource); ! boolean isResourceInPythonpath(String resource); ! /** ! * @return true if it is ok to use the nature ! */ ! boolean startRequests(); ! void endRequests(); } Index: ExtensionHelper.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ExtensionHelper.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ExtensionHelper.java 13 Aug 2008 21:12:29 -0000 1.17 --- ExtensionHelper.java 27 Sep 2008 19:57:34 -0000 1.18 *************** *** 71,91 **** @SuppressWarnings("unchecked") ! public static Object getParticipant(String type) { ! //only one participant may be used for this ! List<Object> participants = getParticipants(type); ! if(participants.size() == 1){ ! return participants.get(0); ! } ! ! if(participants.size() == 0){ ! return null; ! } ! ! if(participants.size() > 1){ ! throw new RuntimeException("More than one participant is registered for type:"+type); ! } ! ! throw new RuntimeException("Should never get here!"); ! } --- 71,91 ---- @SuppressWarnings("unchecked") ! public static Object getParticipant(String type) { ! //only one participant may be used for this ! List<Object> participants = getParticipants(type); ! if(participants.size() == 1){ ! return participants.get(0); ! } ! ! if(participants.size() == 0){ ! return null; ! } ! ! if(participants.size() > 1){ ! throw new RuntimeException("More than one participant is registered for type:"+type); ! } ! ! throw new RuntimeException("Should never get here!"); ! } Index: ModulesKey.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ModulesKey.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ModulesKey.java 18 May 2008 20:02:26 -0000 1.6 --- ModulesKey.java 27 Sep 2008 19:57:34 -0000 1.7 *************** *** 75,79 **** return this.name.hashCode(); } ! @Override public String toString() { --- 75,79 ---- return this.name.hashCode(); } ! @Override public String toString() { Index: ICodeCompletionASTManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ICodeCompletionASTManager.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ICodeCompletionASTManager.java 31 Jul 2008 01:47:54 -0000 1.18 --- ICodeCompletionASTManager.java 27 Sep 2008 19:57:34 -0000 1.19 *************** *** 195,200 **** * @param completions OUT this is were completions are added. * @param wildImport this is the token identifying the wild import */ ! public List<IToken> getCompletionsForWildImport(ICompletionState state, IModule current, List<IToken> completions, IToken wildImport); /** --- 195,202 ---- * @param completions OUT this is were completions are added. * @param wildImport this is the token identifying the wild import + * + * @return true if it was able to find the module and get its completions and false otherwise */ ! public boolean getCompletionsForWildImport(ICompletionState state, IModule current, List<IToken> completions, IToken wildImport); /** Index: TupleN.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/TupleN.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TupleN.java 25 Jan 2008 01:53:49 -0000 1.1 --- TupleN.java 27 Sep 2008 19:57:34 -0000 1.2 *************** *** 44,48 **** ret *= o1[i].hashCode(); } ! return 7 * ret; } --- 44,48 ---- ret *= o1[i].hashCode(); } ! return 7 * ret; } Index: ISourceModule.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ISourceModule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ISourceModule.java 27 Feb 2007 16:44:56 -0000 1.1 --- ISourceModule.java 27 Sep 2008 19:57:34 -0000 1.2 *************** *** 3,9 **** public interface ISourceModule extends IModule{ ! /** ! * @return a Module (it is declared as object because in the core we do not have access to the SimpleNode or Module) ! */ ! public Object getAst(); } --- 3,9 ---- public interface ISourceModule extends IModule{ ! /** ! * @return a Module (it is declared as object because in the core we do not have access to the SimpleNode or Module) ! */ ! public Object getAst(); } |