Posted by Andrey Tarantsov Fri 2nd Mar 2007 09:20 - Syntax is Diff - 28 views
Download | New Post | Modify | Hide line numbers
  1. diff -rNu orig/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java modif/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java
  2. --- orig/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java    2007-03-01 17:56:000 +0600
  3. +++ modif/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/ExternalSourceModule.java    2007-03-02 02:29:000 +0600
  4. @@ -34,6 +34,7 @@
  5.  import org.eclipse.dltk.core.IProjectFragment;
  6.  import org.eclipse.dltk.core.ISourceElementParser;
  7.  import org.eclipse.dltk.core.ISourceModule;
  8. +import org.eclipse.dltk.core.ISourceModuleInfoCache;
  9.  import org.eclipse.dltk.core.ISourceRange;
  10.  import org.eclipse.dltk.core.IType;
  11.  import org.eclipse.dltk.core.ModelException;
  12. @@ -126,7 +127,12 @@
  13.                  throw new ModelException(new ModelStatus(ModelStatus.INVALID_NAME));
  14.              }
  15.              ISourceElementParser parser = toolkit.createSourceElementParser(requestor, null, Collections.EMPTY_MAP);
  16. -            parser.parseSourceModule(contents, null);
  17. +           
  18. +            ISourceModuleInfoCache sourceModuleInfoCache = ModelManager.getModelManager().getSourceModuleInfoCache();
  19. +//            sourceModuleInfoCache.remove(this);
  20. +            parser.parseSourceModule(contents, sourceModuleInfoCache.get(this));
  21. +           
  22. +//            parser.parseSourceModule(contents, null);
  23.              if (ExternalSourceModule.DEBUG_PRINT_MODEL) {
  24.                  System.out.println("Source Module Debug print:");
  25.                  CorePrinter printer = new CorePrinter(System.out);
  26. diff -rNu orig/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java modif/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java
  27. --- orig/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java    2007-03-02 00:10:000 +0600
  28. +++ modif/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/SourceModuleInfoCache.java    2007-03-02 02:41:000 +0600
  29. @@ -28,7 +28,7 @@
  30.          // if max memory is infinite, set the ratio to 4d which corresponds to
  31.          // the 256MB that Eclipse defaults to
  32.          // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=111299)
  33. -        double ratio = 1000; // 64000000
  34. +        double ratio = 10; // 64000000
  35.  
  36.          this.cache = new ElementCache(
  37.                  (int) (ModelCache.DEFAULT_ROOT_SIZE * ratio));
  38. @@ -41,11 +41,11 @@
  39.  
  40.      public ISourceModuleInfo get(ISourceModule module) {
  41.          Object object = this.cache.get(module);
  42. +        System.out.println("Filling ratio:" + this.cache.fillingRatio());
  43.          if (object == null) {
  44. -            System.out.print("$");
  45.              return returnAdd(module);
  46.          }
  47. -        System.out.print("!");
  48. +        this.cache.printStats();
  49.          return (ISourceModuleInfo) object;
  50.      }
  51.  
  52. diff -rNu orig/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java modif/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java
  53. --- orig/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java    2007-03-01 17:56:000 +0600
  54. +++ modif/org.eclipse.dltk.core/search/org/eclipse/dltk/core/search/indexing/SourceIndexer.java    2007-03-02 05:04:000 +0600
  55. @@ -22,6 +22,8 @@
  56.  import org.eclipse.dltk.core.IScriptFolder;
  57.  import org.eclipse.dltk.core.ISourceElementParser;
  58.  import org.eclipse.dltk.core.ISourceModule;
  59. +import org.eclipse.dltk.core.ISourceModuleInfoCache;
  60. +import org.eclipse.dltk.core.ISourceModuleInfoCache.ISourceModuleInfo;
  61.  import org.eclipse.dltk.core.search.IDLTKSearchScope;
  62.  import org.eclipse.dltk.core.search.SearchDocument;
  63.  import org.eclipse.dltk.internal.core.ModelManager;
  64. @@ -67,9 +69,11 @@
  65.              }
  66.              String pkgName = "";
  67.              IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
  68. +            ISourceModule sourceModule = null;
  69.              if (file.exists()) {
  70.                  ISourceModule module = (ISourceModule) DLTKCore.create(file);
  71.                  if (module != null) {
  72. +                    sourceModule = module;
  73.                      IScriptFolder folder = (IScriptFolder) module.getParent();
  74.                      pkgName = folder.getElementName();
  75.                  }
  76. @@ -87,7 +91,15 @@
  77.              if (source == null || name == null)
  78.                  return; // could not retrieve document info (e.g. resource was
  79.                          // discarded)
  80. +//            parser.parseSourceModule(source, null);
  81. +//            ISourceModuleInfo info = null;
  82. +//            if( sourceModule != null ) {
  83. +//                ISourceModuleInfoCache sourceModuleInfoCache = ModelManager.getModelManager().getSourceModuleInfoCache();
  84. +//                sourceModuleInfoCache.remove(sourceModule);
  85. +//                info = sourceModuleInfoCache.get(sourceModule);
  86. +//            }
  87.              parser.parseSourceModule(source, null);
  88. +           
  89.          } else { // This is for external documents               
  90.              if (parser == null || requestor == null ) {
  91.                  //parser = ModelManager.getModelManager().indexManager.getSourceElementParser(dltkProject, requestor);
  92. diff -rNu orig/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/CVS/Entries modif/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/CVS/Entries
  93. --- orig/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/CVS/Entries    2007-03-01 23:48:000 +0600
  94. +++ modif/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/CVS/Entries    2007-03-02 14:46:000 +0600
  95. @@ -7,4 +7,4 @@
  96.  /IGoalEvaluatorFactory.java/1.2/Sat Feb 24 13:52:32 2007//
  97.  /ISourceModuleContext.java/1.1/Sun Feb 25 10:35:37 2007//
  98.  /ITypeInferencer.java/1.1/Fri Feb 23 14:22:15 2007//
  99. -/TypeInferencer.java/1.4/Thu Mar  1 17:48:23 2007//
  100. +/TypeInferencer.java/1.5/Fri Mar  2 08:46:54 2007//
  101. diff -rNu orig/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/TypeInferencer.java modif/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/TypeInferencer.java
  102. --- orig/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/TypeInferencer.java    2007-03-01 23:48:000 +0600
  103. +++ modif/org.eclipse.dltk.core/typeinference/org/eclipse/dltk/ddp/TypeInferencer.java    2007-03-02 14:46:000 +0600
  104. @@ -90,6 +90,8 @@
  105.      
  106.          long endTime = System.currentTimeMillis() + timeLimit;
  107.          GoalEvaluator rootEvaluator = evaluatorFactory.createEvaluator(rootGoal);
  108. +        if (rootEvaluator == null)
  109. +            return null;
  110.          int emptyStackSize = stackSize; // there might already be some elements there
  111.          pushToStack(rootEvaluator);
  112.          IGoal lastFullyEvaluatedGoal = null;
  113. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/CVS/Entries modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/CVS/Entries
  114. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/CVS/Entries    2007-03-01 22:20:000 +0600
  115. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/CVS/Entries    2007-03-02 14:46:000 +0600
  116. @@ -2,6 +2,7 @@
  117.  /ConstantDeclaration.java/1.1/Fri Feb 16 07:46:05 2007//
  118.  /OrExpression.java/1.1/Fri Feb 23 12:26:15 2007//
  119.  /ReturnStatement.java/1.2/Wed Feb 28 15:25:03 2007//
  120. +/RubyArrayExpression.java/1.1/Fri Mar  2 08:16:13 2007//
  121.  /RubyMethodArgument.java/1.1/Wed Feb 21 06:03:40 2007//
  122.  /RubySingletonClassDeclaration.java/1.1/Thu Mar  1 09:07:08 2007//
  123.  /RubySingletonMethodDeclaration.java/1.2/Wed Feb 28 15:25:06 2007//
  124. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/RubyArrayExpression.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/RubyArrayExpression.java
  125. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/RubyArrayExpression.java    1970-01-01 07:00:000 +0700
  126. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/ast/RubyArrayExpression.java    2007-03-02 14:16:000 +0600
  127. @@ -0,0 +1,7 @@
  128. +package org.eclipse.dltk.ruby.ast;
  129. +
  130. +import org.eclipse.dltk.ast.expressions.ExpressionList;
  131. +
  132. +public class RubyArrayExpression extends ExpressionList {
  133. +
  134. +}
  135. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/RubyLanguageToolkit.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/RubyLanguageToolkit.java
  136. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/RubyLanguageToolkit.java    2007-03-01 18:36:000 +0600
  137. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/RubyLanguageToolkit.java    2007-03-02 10:40:000 +0600
  138. @@ -48,6 +48,8 @@
  139.  import org.eclipse.dltk.core.search.indexing.SourceIndexerRequestor;
  140.  import org.eclipse.dltk.core.search.matching.MatchLocator;
  141.  import org.eclipse.dltk.internal.core.util.Messages;
  142. +import org.eclipse.dltk.ruby.internal.callhierarchy.RubyCallProcessor;
  143. +import org.eclipse.dltk.ruby.internal.callhierarchy.RubyCalleeProcessor;
  144.  import org.eclipse.dltk.ruby.internal.core.codeassist.RubyCompletionEngine;
  145.  import org.eclipse.dltk.ruby.internal.core.codeassist.RubySelectionEngine;
  146.  import org.eclipse.dltk.ruby.internal.core.search.RubyMatchLocator;
  147. @@ -224,13 +226,11 @@
  148.  
  149.      public ICalleeProcessor createCalleeProcessor(IMethod method,
  150.              IProgressMonitor monitor, IDLTKSearchScope scope) {
  151. -        // TODO Auto-generated method stub
  152. -        return null;
  153. +        return new RubyCalleeProcessor( method, monitor, scope );
  154.      }
  155.  
  156.      public ICallProcessor createCallProcessor() {
  157. -        // TODO Auto-generated method stub
  158. -        return null;
  159. +        return new RubyCallProcessor();
  160.      }
  161.  
  162.      public String getDelimeterReplacerString() {
  163. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/CVS/Entries modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/CVS/Entries
  164. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/CVS/Entries    2007-02-23 19:44:000 +0600
  165. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/CVS/Entries    2007-03-02 13:35:000 +0600
  166. @@ -1 +1 @@
  167. -/RubySyntaxUtils.java/1.2/Fri Feb 23 13:44:39 2007//
  168. +/RubySyntaxUtils.java/1.3/Fri Mar  2 07:35:10 2007//
  169. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/RubySyntaxUtils.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/RubySyntaxUtils.java
  170. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/RubySyntaxUtils.java    2007-02-23 19:44:000 +0600
  171. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/core/utils/RubySyntaxUtils.java    2007-03-02 13:35:000 +0600
  172. @@ -58,7 +58,7 @@
  173.       */
  174.      public static ISourceRange getEnclosingName (CharSequence contents, int pos) {
  175.          if (pos < 0 || pos >= contents.length())
  176. -            throw new IllegalArgumentException();
  177. +            return null;
  178.          
  179.          int start = pos - 1;
  180.          int end = pos;
  181. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCalleeProcessor.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCalleeProcessor.java
  182. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCalleeProcessor.java    1970-01-01 07:00:000 +0700
  183. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCalleeProcessor.java    2007-03-02 11:27:000 +0600
  184. @@ -0,0 +1,199 @@
  185. +package org.eclipse.dltk.ruby.internal.callhierarchy;
  186. +
  187. +import java.util.ArrayList;
  188. +import java.util.HashMap;
  189. +import java.util.List;
  190. +import java.util.Map;
  191. +
  192. +import org.eclipse.core.runtime.CoreException;
  193. +import org.eclipse.core.runtime.IProgressMonitor;
  194. +import org.eclipse.dltk.ast.references.SimpleReference;
  195. +import org.eclipse.dltk.compiler.ISourceElementRequestor;
  196. +import org.eclipse.dltk.core.ICalleeProcessor;
  197. +import org.eclipse.dltk.core.IMethod;
  198. +import org.eclipse.dltk.core.IModelElement;
  199. +import org.eclipse.dltk.core.ISourceModule;
  200. +import org.eclipse.dltk.core.ISourceModuleInfoCache;
  201. +import org.eclipse.dltk.core.ModelException;
  202. +import org.eclipse.dltk.core.search.IDLTKSearchScope;
  203. +import org.eclipse.dltk.core.search.SearchEngine;
  204. +import org.eclipse.dltk.core.search.SearchParticipant;
  205. +import org.eclipse.dltk.core.search.SearchPattern;
  206. +import org.eclipse.dltk.core.search.SearchRequestor;
  207. +import org.eclipse.dltk.internal.core.ModelManager;
  208. +import org.eclipse.dltk.ruby.internal.parser.RubySourceElementParser;
  209. +
  210. +
  211. +public class RubyCalleeProcessor implements ICalleeProcessor {
  212. +    protected static int EXACT_RULE = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
  213. +   
  214. +    private Map fSearchResults = new HashMap();
  215. +
  216. +    private IMethod method;
  217. +       
  218. +    //private IDLTKSearchScope scope;
  219. +
  220. +    public RubyCalleeProcessor(IMethod method, IProgressMonitor monitor, IDLTKSearchScope scope) {
  221. +        this.method = method;
  222. +        //this.scope = scope;
  223. +    }
  224. +
  225. +    private class CaleeSourceElementRequestor implements ISourceElementRequestor {
  226. +        public void acceptFieldReference(char[] fieldName, int sourcePosition) {
  227. +        }
  228. +
  229. +        public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition, int sourceEndPosition) {
  230. +            String name = new String(methodName);
  231. +            int off = 0;
  232. +            try {
  233. +                off = method.getSourceRange().getOffset();
  234. +            } catch (ModelException e) {
  235. +                e.printStackTrace();
  236. +            }
  237. +            SimpleReference ref = new SimpleReference(off + sourcePosition, off + sourceEndPosition, name);
  238. +            IMethod[] methods = findMethods(name, argCount, off + sourceEndPosition - 1);
  239. +            fSearchResults.put(ref, methods);
  240. +        }
  241. +
  242. +        public void acceptPackage(int declarationStart, int declarationEnd, char[] name) {
  243. +            // TODO Auto-generated method stub
  244. +
  245. +        }
  246. +
  247. +        public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd) {
  248. +            // TODO Auto-generated method stub
  249. +
  250. +        }
  251. +
  252. +        public void acceptTypeReference(char[] typeName, int sourcePosition) {
  253. +            // TODO Auto-generated method stub
  254. +
  255. +        }
  256. +
  257. +        public void enterField(FieldInfo info) {
  258. +            // TODO Auto-generated method stub
  259. +
  260. +        }
  261. +
  262. +        public boolean enterFieldCheckDuplicates(FieldInfo info) {
  263. +            // TODO Auto-generated method stub
  264. +            return false;
  265. +        }
  266. +
  267. +        public void enterMethod(MethodInfo info) {
  268. +            // TODO Auto-generated method stub
  269. +
  270. +        }
  271. +
  272. +        public void enterMethodRemoveSame(MethodInfo info) {
  273. +            // TODO Auto-generated method stub
  274. +
  275. +        }
  276. +
  277. +        public boolean enterMethodWithParentType(MethodInfo info, String parentName, String delimiter) {
  278. +            // TODO Auto-generated method stub
  279. +            return false;
  280. +        }
  281. +       
  282. +        public boolean enterFieldWithParentType(FieldInfo info, String parentName, String delimiter) {
  283. +            // TODO Auto-generated method stub
  284. +            return false;
  285. +        }
  286. +
  287. +        public void enterModule() {
  288. +            // TODO Auto-generated method stub
  289. +
  290. +        }
  291. +
  292. +        public void enterType(TypeInfo info) {
  293. +            // TODO Auto-generated method stub
  294. +
  295. +        }
  296. +
  297. +        public boolean enterTypeAppend(TypeInfo info, String fullName, String delimiter) {
  298. +            // TODO Auto-generated method stub
  299. +            return false;
  300. +        }
  301. +
  302. +        public void exitField(int declarationEnd) {
  303. +            // TODO Auto-generated method stub
  304. +
  305. +        }
  306. +
  307. +        public void exitMethod(int declarationEnd) {
  308. +            // TODO Auto-generated method stub
  309. +
  310. +        }
  311. +
  312. +        public void exitModule(int declarationEnd) {
  313. +            // TODO Auto-generated method stub
  314. +
  315. +        }
  316. +
  317. +        public void exitType(int declarationEnd) {
  318. +        }
  319. +
  320. +        public void enterModuleRoot() {
  321. +            // TODO Auto-generated method stub
  322. +           
  323. +        }
  324. +
  325. +        public boolean enterTypeAppend(String fullName, String delimiter) {
  326. +            // TODO Auto-generated method stub
  327. +            return false;
  328. +        }
  329. +
  330. +        public void exitModuleRoot() {
  331. +            // TODO Auto-generated method stub
  332. +           
  333. +        }
  334. +    }
  335. +
  336. +    public Map doOperation() {
  337. +        try {
  338. +            String methodSource = method.getSource();
  339. +            CaleeSourceElementRequestor requestor = new CaleeSourceElementRequestor();
  340. +            RubySourceElementParser parser = new RubySourceElementParser(requestor, null);
  341. +           
  342. +//            parser.parseModule(null, methodSource, null );
  343. +            parser.parseSourceModule(methodSource.toCharArray(), null);
  344. +
  345. +            return fSearchResults;
  346. +        } catch (ModelException e) {
  347. +            // TODO Auto-generated catch block
  348. +            e.printStackTrace();
  349. +        }
  350. +        return fSearchResults;
  351. +    }
  352. +   
  353. +    public IMethod[] findMethods(final String methodName, int argCount, int sourcePosition) {
  354. +        final List methods = new ArrayList();
  355. +        ISourceModule module = this.method.getSourceModule();
  356. +        try {
  357. +            IModelElement[] elements = module.codeSelect(sourcePosition, /*methodName.length()*/1);
  358. +            for( int i = 0; i < elements.length; ++i ) {
  359. +                if( elements[i] instanceof IMethod ) {
  360. +                    methods.add(elements[i]);
  361. +                }
  362. +            }
  363. +        } catch (ModelException e) {
  364. +            e.printStackTrace();
  365. +        }
  366. +       
  367. +        return (IMethod[])methods.toArray(new IMethod[methods.size()]);
  368. +    }
  369. +
  370. +    protected void search(String patternString, int searchFor, int limitTo, IDLTKSearchScope scope, SearchRequestor resultCollector)
  371. +            throws CoreException {
  372. +        search(patternString, searchFor, limitTo, EXACT_RULE, scope, resultCollector);
  373. +    }
  374. +
  375. +    protected void search(String patternString, int searchFor, int limitTo, int matchRule, IDLTKSearchScope scope, SearchRequestor requestor)
  376. +            throws CoreException {
  377. +        if (patternString.indexOf('*') != -1 || patternString.indexOf('?') != -1) {
  378. +            matchRule |= SearchPattern.R_PATTERN_MATCH;
  379. +        }
  380. +        SearchPattern pattern = SearchPattern.createPattern(patternString, searchFor, limitTo, matchRule);
  381. +        new SearchEngine().search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope, requestor, null);
  382. +    }
  383. +}
  384. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCallProcessor.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCallProcessor.java
  385. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCallProcessor.java    1970-01-01 07:00:000 +0700
  386. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/callhierarchy/RubyCallProcessor.java    2007-03-02 11:40:000 +0600
  387. @@ -0,0 +1,77 @@
  388. +package org.eclipse.dltk.ruby.internal.callhierarchy;
  389. +
  390. +import java.util.HashMap;
  391. +import java.util.Map;
  392. +
  393. +import org.eclipse.core.runtime.CoreException;
  394. +import org.eclipse.core.runtime.IProgressMonitor;
  395. +import org.eclipse.dltk.ast.references.SimpleReference;
  396. +import org.eclipse.dltk.core.ICallProcessor;
  397. +import org.eclipse.dltk.core.IModelElement;
  398. +import org.eclipse.dltk.core.ISourceModule;
  399. +import org.eclipse.dltk.core.ModelException;
  400. +import org.eclipse.dltk.core.search.IDLTKSearchConstants;
  401. +import org.eclipse.dltk.core.search.IDLTKSearchScope;
  402. +import org.eclipse.dltk.core.search.SearchEngine;
  403. +import org.eclipse.dltk.core.search.SearchMatch;
  404. +import org.eclipse.dltk.core.search.SearchParticipant;
  405. +import org.eclipse.dltk.core.search.SearchPattern;
  406. +import org.eclipse.dltk.core.search.SearchRequestor;
  407. +
  408. +public class RubyCallProcessor implements ICallProcessor {
  409. +    public final static int GENERICS_AGNOSTIC_MATCH_RULE = SearchPattern.R_EXACT_MATCH
  410. +            | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH;
  411. +
  412. +    private SearchEngine searchEngine = new SearchEngine();
  413. +
  414. +    public Map process(final IModelElement parent, IModelElement element,
  415. +            IDLTKSearchScope scope, IProgressMonitor monitor) {
  416. +        final Map elements = new HashMap();
  417. +        SearchRequestor requestor = new SearchRequestor() {
  418. +
  419. +            public void acceptSearchMatch(SearchMatch match) {
  420. +                if ((match.getAccuracy() != SearchMatch.A_ACCURATE)) {
  421. +                    return;
  422. +                }
  423. +
  424. +                if (match.isInsideDocComment()) {
  425. +                    return;
  426. +                }
  427. +
  428. +                if (match.getElement() != null
  429. +                        && match.getElement() instanceof IModelElement) {
  430. +                    IModelElement member = (IModelElement) match.getElement();
  431. +                    ISourceModule module = (ISourceModule) member
  432. +                            .getAncestor(IModelElement.SOURCE_MODULE);
  433. +                    SimpleReference ref = new SimpleReference(
  434. +                            match.getOffset(), match.getOffset()
  435. +                                    + match.getLength(), "");
  436. +//                    try {
  437. +//                        IModelElement[] e = module.codeSelect(
  438. +//                                match.getOffset(), match.getLength());
  439. +//                        for (int j = 0; j < e.length; ++j) {
  440. +//                            if (e[j].equals(parent)) {
  441. +                                elements.put(ref, member);
  442. +//                            }
  443. +//                        }
  444. +//
  445. +//                    } catch (ModelException e) {
  446. +//                        e.printStackTrace();
  447. +//                    }
  448. +                }
  449. +            }
  450. +        };
  451. +
  452. +        SearchPattern pattern = SearchPattern.createPattern(element,
  453. +                IDLTKSearchConstants.REFERENCES, GENERICS_AGNOSTIC_MATCH_RULE);
  454. +        try {
  455. +            searchEngine
  456. +                    .search(pattern, new SearchParticipant[] { SearchEngine
  457. +                            .getDefaultSearchParticipant() }, scope, requestor,
  458. +                            monitor);
  459. +        } catch (CoreException e) {
  460. +            e.printStackTrace();
  461. +        }
  462. +        return elements;
  463. +    }
  464. +}
  465. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/CVS/Entries modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/CVS/Entries
  466. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/CVS/Entries    2007-03-01 23:50:000 +0600
  467. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/CVS/Entries    2007-03-02 14:46:000 +0600
  468. @@ -1,6 +1,6 @@
  469.  /IRubySelectionRequestor.java/1.1/Mon Feb 12 06:36:08 2007//
  470.  /NewTICompletionEngine.java/1.1/Thu Feb 15 12:55:33 2007//
  471.  /RubyAssistParser.java/1.2/Thu Mar  1 13:09:59 2007//
  472. -/RubyCompletionEngine.java/1.19/Thu Mar  1 17:50:52 2007//
  473. -/RubySelectionEngine.java/1.16/Thu Mar  1 14:59:51 2007//
  474. +/RubyCompletionEngine.java/1.20/Thu Mar  1 17:50:52 2007//
  475. +/RubySelectionEngine.java/1.18/Fri Mar  2 08:46:53 2007//
  476.  /RubySelectionParser.java/1.1/Mon Feb 12 06:37:07 2007//
  477. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubyCompletionEngine.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubyCompletionEngine.java
  478. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubyCompletionEngine.java    2007-03-01 23:54:000 +0600
  479. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubyCompletionEngine.java    2007-03-02 14:46:000 +0600
  480. @@ -31,6 +31,7 @@
  481.  import org.eclipse.dltk.evaluation.types.SimpleType;
  482.  import org.eclipse.dltk.internal.core.ModelElement;
  483.  import org.eclipse.dltk.ruby.ast.ColonExpression;
  484. +import org.eclipse.dltk.ruby.ast.RubyArrayExpression;
  485.  import org.eclipse.dltk.ruby.core.model.FakeMethod;
  486.  import org.eclipse.dltk.ruby.core.utils.RubySyntaxUtils;
  487.  import org.eclipse.dltk.ruby.internal.parser.JRubySourceParser;
  488. @@ -167,6 +168,9 @@
  489.                  case SimpleType.TYPE_STRING:
  490.                      meth = RubyModelUtils.getFakeMethods((ModelElement) modelModule, "String");
  491.                      break;
  492. +                case SimpleType.TYPE_ARRAY:
  493. +                    meth = RubyModelUtils.getFakeMethods((ModelElement) modelModule, "Array");
  494. +                    break;
  495.              }
  496.              return meth;
  497.          }
  498. @@ -296,6 +300,15 @@
  499.          int relevance = 424242;
  500.  
  501.          if (receiver != null) {
  502. +            if (receiver instanceof RubyArrayExpression) {
  503. +                int st = position;
  504. +                while (st >= 0 && content.charAt(st) != '.')
  505. +                    st--;
  506. +                if (st > 0) {
  507. +                    starting = content.substring(st + 1, position).trim();
  508. +                    this.setSourceRange(position - starting.length(), position);
  509. +                }
  510. +            }
  511.              methods = getMethodsForReceiver(module, moduleDeclaration, receiver);
  512.          } else {
  513.              IClassType self = RubyTypeInferencingUtils.determineSelfClass(
  514. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubySelectionEngine.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubySelectionEngine.java
  515. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubySelectionEngine.java    2007-03-01 20:59:000 +0600
  516. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/core/codeassist/RubySelectionEngine.java    2007-03-02 14:46:000 +0600
  517. @@ -410,7 +410,7 @@
  518.                  RubyClassType rubyClassType = RubyTypeInferencingUtils.resolveMethods(modelModule.getScriptProject(), (RubyClassType) type);
  519.                  availableMethods = rubyClassType.getAllMethods();               
  520.              } else if (type instanceof RubyMetaClassType) {
  521. -                RubyMetaClassType metaClassType = (RubyMetaClassType) type;
  522. +                RubyMetaClassType metaClassType = RubyTypeInferencingUtils.resolveMethods(modelModule, (RubyMetaClassType) type);               
  523.                  availableMethods = metaClassType.getMethods();
  524.              }
  525.          } else {
  526. @@ -434,6 +434,9 @@
  527.                      case SimpleType.TYPE_STRING:
  528.                          meth = RubyModelUtils.getFakeMethods((ModelElement) modelModule, "String");
  529.                          break;
  530. +                    case SimpleType.TYPE_ARRAY:
  531. +                        meth = RubyModelUtils.getFakeMethods((ModelElement) modelModule, "Array");
  532. +                        break;
  533.                  }
  534.                  availableMethods = meth;
  535.              }
  536. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parser/JRubySourceParser.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parser/JRubySourceParser.java
  537. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parser/JRubySourceParser.java    2007-03-01 18:32:000 +0600
  538. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parser/JRubySourceParser.java    2007-03-02 01:31:000 +0600
  539. @@ -160,51 +160,57 @@
  540.      }
  541.      
  542.      public ModuleDeclaration parse(String content) {// throws
  543. -        Parser parser = new Parser(new IRuby() {});
  544. -        ProxyProblemReporter proxyProblemReporter = new ProxyProblemReporter(problemReporter);
  545. -        errorState[0] = false;
  546. -       
  547. -        long timeStart = System.currentTimeMillis();
  548. -        Node node = parser.parse("", new StringReader(content), new RubyParserConfiguration(),
  549. -                proxyProblemReporter);
  550. -        fixPositions.clear();
  551. -        if (!parser.isSuccess() || errorState[0]) {
  552. -            content = fixBrokenDots(content);
  553. -            content = fixBrokenColons(content);
  554. +        try {
  555. +            Parser parser = new Parser(new IRuby() {});
  556. +            ProxyProblemReporter proxyProblemReporter = new ProxyProblemReporter(problemReporter);
  557. +            errorState[0] = false;
  558.              
  559. -            Node node2 = parser.parse("", new StringReader(content), new RubyParserConfiguration(),
  560. -                    null);
  561. -            if (node2 != null)
  562. -                node = node2;
  563. -            else
  564. -                fixPositions.clear();
  565. -        }
  566. -       
  567. -        ModuleDeclaration module = new ModuleDeclaration(content.length());
  568. -        DLTKASTBuildVisitor visitor = new DLTKASTBuildVisitor(module, content);
  569. -        if (node != null)
  570. -            node.accept(visitor);
  571. -
  572. -        if( node != null ) {
  573. -            if (TRACE_AST_JRUBY || TRACE_AST_DLTK)
  574. -                System.out.println("\n\nAST rebuilt\n");
  575. -            if (TRACE_AST_JRUBY)
  576. -                System.out.println("JRuby AST:\n" + node.toString());
  577. +            long timeStart = System.currentTimeMillis();
  578. +            Node node = parser.parse("", new StringReader(content), new RubyParserConfiguration(),
  579. +                    proxyProblemReporter);
  580. +            fixPositions.clear();
  581. +            if (!parser.isSuccess() || errorState[0]) {
  582. +                content = fixBrokenDots(content);
  583. +                content = fixBrokenColons(content);
  584. +               
  585. +                Node node2 = parser.parse("", new StringReader(content), new RubyParserConfiguration(),
  586. +                        null);
  587. +                if (node2 != null)
  588. +                    node = node2;
  589. +                else
  590. +                    fixPositions.clear();
  591. +            }
  592. +           
  593. +            ModuleDeclaration module = new ModuleDeclaration(content.length());
  594. +            DLTKASTBuildVisitor visitor = new DLTKASTBuildVisitor(module, content);
  595. +            if (node != null)
  596. +                node.accept(visitor);
  597. +   
  598. +            if( node != null ) {
  599. +                if (TRACE_AST_JRUBY || TRACE_AST_DLTK)
  600. +                    System.out.println("\n\nAST rebuilt\n");
  601. +                if (TRACE_AST_JRUBY)
  602. +                    System.out.println("JRuby AST:\n" + node.toString());
  603. +                if (TRACE_AST_DLTK)
  604. +                    System.out.println("DLTK AST:\n" + module.toString());
  605. +            }
  606. +           
  607. +            if (!fixPositions.isEmpty())
  608. +                try {
  609. +                    module.traverse(new ASTPositionsCorrector());
  610. +                } catch (Exception e) {
  611. +                    RubyPlugin.log(e);
  612. +                }
  613. +           
  614. +            long timeEnd = System.currentTimeMillis();
  615.              if (TRACE_AST_DLTK)
  616. -                System.out.println("DLTK AST:\n" + module.toString());
  617. +                System.out.println("Parsing took " + (timeEnd - timeStart) + " ms");
  618. +            return module;
  619. +        }
  620. +        catch( Throwable t ) {
  621. +            ModuleDeclaration mdl = new ModuleDeclaration(1);
  622. +            return mdl;
  623.          }
  624. -       
  625. -        if (!fixPositions.isEmpty())
  626. -            try {
  627. -                module.traverse(new ASTPositionsCorrector());
  628. -            } catch (Exception e) {
  629. -                RubyPlugin.log(e);
  630. -            }
  631. -       
  632. -        long timeEnd = System.currentTimeMillis();
  633. -        if (TRACE_AST_DLTK)
  634. -            System.out.println("Parsing took " + (timeEnd - timeStart) + " ms");
  635. -        return module;
  636.      }
  637.  
  638.      public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
  639. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/ASTUtils.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/ASTUtils.java
  640. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/ASTUtils.java    2007-03-01 23:48:000 +0600
  641. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/ASTUtils.java    2007-03-02 13:35:000 +0600
  642. @@ -143,7 +143,7 @@
  643.                      if (result != null) {
  644.                          int oldlen = calcLen(result);
  645.                          int newlen = realEnd - realStart;
  646. -                        if (newlen < oldlen )
  647. +                        if (newlen <= oldlen )
  648.                              result = s;
  649.                      } else {
  650.                          result = s;                       
  651. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/CVS/Entries modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/CVS/Entries
  652. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/CVS/Entries    2007-03-01 23:48:000 +0600
  653. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/CVS/Entries    2007-03-02 14:46:000 +0600
  654. @@ -1,2 +1,2 @@
  655. -/ASTUtils.java/1.11/Thu Mar  1 17:48:53 2007//
  656. -/DLTKASTBuildVisitor.java/1.24/Thu Mar  1 16:15:36 2007//
  657. +/ASTUtils.java/1.12/Fri Mar  2 07:35:10 2007//
  658. +/DLTKASTBuildVisitor.java/1.25/Thu Mar  1 16:15:36 2007//
  659. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/DLTKASTBuildVisitor.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/DLTKASTBuildVisitor.java
  660. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/DLTKASTBuildVisitor.java    2007-03-01 23:21:000 +0600
  661. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/parsers/jruby/DLTKASTBuildVisitor.java    2007-03-02 14:46:000 +0600
  662. @@ -31,6 +31,7 @@
  663.  import org.eclipse.dltk.ruby.ast.OrExpression;
  664.  
  665.  import org.eclipse.dltk.ruby.ast.ReturnStatement;
  666. +import org.eclipse.dltk.ruby.ast.RubyArrayExpression;
  667.  import org.eclipse.dltk.ruby.ast.RubyMethodArgument;
  668.  import org.eclipse.dltk.ruby.ast.RubySingletonClassDeclaration;
  669.  import org.eclipse.dltk.ruby.ast.RubySingletonMethodDeclaration;
  670. @@ -318,7 +319,7 @@
  671.          popState();
  672.  
  673.          ISourcePosition position = iVisited.getPosition();
  674. -        ExpressionList arr = new ExpressionList();
  675. +        RubyArrayExpression arr = new RubyArrayExpression();
  676.          arr.setEnd(position.getEndOffset());
  677.          arr.setStart(position.getStartOffset());
  678.          for (Iterator iter = coll.getList().iterator(); iter.hasNext();) {
  679. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/ArrayEvaluator.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/ArrayEvaluator.java
  680. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/ArrayEvaluator.java    1970-01-01 07:00:000 +0700
  681. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/ArrayEvaluator.java    2007-03-02 14:16:000 +0600
  682. @@ -0,0 +1,22 @@
  683. +package org.eclipse.dltk.ruby.typeinference;
  684. +
  685. +import org.eclipse.dltk.ddp.GoalEvaluator;
  686. +import org.eclipse.dltk.ddp.IGoal;
  687. +import org.eclipse.dltk.evaluation.types.IEvaluatedType;
  688. +import org.eclipse.dltk.evaluation.types.SimpleType;
  689. +
  690. +public class ArrayEvaluator extends GoalEvaluator {
  691. +   
  692. +    public ArrayEvaluator(IGoal goal) {
  693. +        super(goal);
  694. +    }
  695. +
  696. +    public IGoal produceNextSubgoal(IGoal previousGoal, IEvaluatedType previousResult) {
  697. +        return null;
  698. +    }
  699. +
  700. +    public IEvaluatedType produceType() {
  701. +        return new SimpleType(SimpleType.TYPE_ARRAY);
  702. +    }
  703. +
  704. +}
  705. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/CVS/Entries modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/CVS/Entries
  706. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/CVS/Entries    2007-03-02 00:24:000 +0600
  707. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/CVS/Entries    2007-03-02 14:46:000 +0600
  708. @@ -1,3 +1,4 @@
  709. +/ArrayEvaluator.java/1.1/Fri Mar  2 08:16:13 2007//
  710.  /AssignmentEvaluator.java/1.1/Fri Feb 23 14:22:08 2007//
  711.  /BlockEvaluator.java/1.1/Sun Feb 25 13:26:47 2007//
  712.  /BuiltinMetaTypeMethods.java/1.1/Mon Feb 26 12:14:42 2007//
  713. @@ -23,10 +24,10 @@
  714.  /NumericLiteralEvaluator.java/1.1/Fri Feb 23 14:22:08 2007//
  715.  /OffsetTargetedASTVisitor.java/1.3/Sun Feb 25 07:22:50 2007//
  716.  /RubyClassType.java/1.5/Sun Feb 25 07:22:48 2007//
  717. -/RubyEvaluatorFactory.java/1.6/Sun Feb 25 13:34:02 2007//
  718. +/RubyEvaluatorFactory.java/1.7/Fri Mar  2 08:46:54 2007//
  719.  /RubyMetaClassType.java/1.3/Sat Feb 24 19:05:37 2007//
  720.  /RubyModelUtils.java/1.13/Thu Mar  1 16:20:18 2007//
  721. -/RubyTypeInferencingUtils.java/1.19/Thu Mar  1 18:15:03 2007//
  722. +/RubyTypeInferencingUtils.java/1.20/Fri Mar  2 07:35:10 2007//
  723.  /RubyTypeUtils.java/1.2/Thu Mar  1 16:20:18 2007//
  724.  /SelfReferenceEvaluator.java/1.3/Thu Mar  1 16:20:17 2007//
  725.  /StringLiteralEvaluator.java/1.1/Sat Feb 24 13:50:33 2007//
  726. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyEvaluatorFactory.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyEvaluatorFactory.java
  727. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyEvaluatorFactory.java    2007-02-25 19:34:000 +0600
  728. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyEvaluatorFactory.java    2007-03-02 14:46:000 +0600
  729. @@ -17,6 +17,7 @@
  730.  import org.eclipse.dltk.ddp.IGoalEvaluatorFactory;
  731.  import org.eclipse.dltk.ruby.ast.ColonExpression;
  732.  import org.eclipse.dltk.ruby.ast.ConstantDeclaration;
  733. +import org.eclipse.dltk.ruby.ast.RubyArrayExpression;
  734.  import org.eclipse.dltk.ruby.ast.SelfReference;
  735.  
  736.  public class RubyEvaluatorFactory implements IGoalEvaluatorFactory {
  737. @@ -31,6 +32,8 @@
  738.                  return new NumericLiteralEvaluator(goal);
  739.              else if (expr instanceof StringLiteral)
  740.                  return new StringLiteralEvaluator(goal);
  741. +            else if (expr instanceof RubyArrayExpression)
  742. +                return new ArrayEvaluator(goal);
  743.              else if (expr instanceof Assignment)
  744.                  return new AssignmentEvaluator(goal);
  745.              else if (expr instanceof ConstantReference)
  746. diff -rNu orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyTypeInferencingUtils.java modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyTypeInferencingUtils.java
  747. --- orig/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyTypeInferencingUtils.java    2007-03-02 00:15:000 +0600
  748. +++ modif/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/typeinference/RubyTypeInferencingUtils.java    2007-03-02 13:35:000 +0600
  749. @@ -662,6 +662,16 @@
  750.                              }
  751.                          }
  752.                          
  753. +                        if (!type.getInstanceType().getTypeName().equals("Object")) {
  754. +                            RubyMetaClassType superType = getMetaType(RubyModelUtils.getSuperType(types[i]));
  755. +                            if (superType != null) {
  756. +                                superType = resolveMethods(module, superType);
  757. +                                IMethod[] allMethods = superType.getMethods();
  758. +                                for (int j = 0; j < allMethods.length; j++) {
  759. +                                    result.add(allMethods[j]);
  760. +                                }
  761. +                            }
  762. +                        }
  763.                      } catch (ModelException e) {
  764.                          e.printStackTrace();
  765.                      }
  766. diff -rNu orig/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyEditor.java modif/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyEditor.java
  767. --- orig/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyEditor.java    2007-02-22 14:40:000 +0600
  768. +++ modif/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyEditor.java    2007-03-02 10:46:000 +0600
  769. @@ -82,7 +82,7 @@
  770.      }
  771.  
  772.      public String getCallHierarchyID() {
  773. -        return null;
  774. +        return "org.eclipse.dltk.callhierarchy.view";
  775.      }
  776.  
  777.      protected void initializeKeyBindingScopes() {
  778. diff -rNu orig/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPercentStringRule.java modif/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPercentStringRule.java
  779. --- orig/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPercentStringRule.java    2007-02-22 14:39:000 +0600
  780. +++ modif/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPercentStringRule.java    2007-03-02 01:28:000 +0600
  781. @@ -161,7 +161,7 @@
  782.          int nestCount = 1;
  783.          while ((c= scanner.read()) != ICharacterScanner.EOF) {
  784.              if (c == ESCAPE) {
  785. -                System.out.println("ESCAPE " + (char) c);
  786. +//                System.out.println("ESCAPE " + (char) c);
  787.                  // Skip escaped character(s)
  788.                  if (fEscapeContinuesLine) {
  789.                      c= scanner.read();
  790. diff -rNu orig/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/CVS/Entries modif/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/CVS/Entries
  791. --- orig/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/CVS/Entries    2007-03-01 22:20:000 +0600
  792. +++ modif/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/CVS/Entries    2007-03-02 13:35:000 +0600
  793. @@ -1 +1 @@
  794. -/RubyCompletionTests.java/1.5/Thu Mar  1 16:20:17 2007//
  795. +/RubyCompletionTests.java/1.6/Fri Mar  2 07:35:10 2007//
  796. diff -rNu orig/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/RubyCompletionTests.java modif/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/RubyCompletionTests.java
  797. --- orig/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/RubyCompletionTests.java    2007-03-01 22:20:000 +0600
  798. +++ modif/org.eclipse.dltk.ruby.ui.tests/src/org/eclipse/dltk/ruby/ui/tests/text/completion/RubyCompletionTests.java    2007-03-02 13:35:000 +0600
  799. @@ -303,4 +303,15 @@
  800.                  
  801.      }
  802.      
  803. +    public void testCompletion20() throws ModelException {
  804. +        CompletionTestsRequestor requestor = new CompletionTestsRequestor();
  805. +        ISourceModule cu = getSourceModule("completion", "src", "c0.rb");
  806. +
  807. +        String str = cu.getSource();
  808. +        String completeBehind = "::";
  809. +        int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
  810. +        cu.codeComplete(cursorLocation, requestor);
  811. +       
  812. +    }
  813. +   
  814.  }
  815. diff -rNu orig/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/c0.rb modif/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/c0.rb
  816. --- orig/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/c0.rb    1970-01-01 07:00:000 +0700
  817. +++ modif/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/c0.rb    2007-03-01 23:46:000 +0600
  818. @@ -0,0 +1,2 @@
  819. +::
  820. +
  821. diff -rNu orig/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/CVS/Entries modif/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/CVS/Entries
  822. --- orig/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/CVS/Entries    2007-03-01 22:20:000 +0600
  823. +++ modif/org.eclipse.dltk.ruby.ui.tests/workspace/completion/src/CVS/Entries    2007-03-02 13:35:000 +0600
  824. @@ -1,3 +1,4 @@
  825. +/c0.rb/1.1/Thu Mar  1 17:46:37 2007//
  826.  /c1.rb/1.1/Wed Feb 28 08:48:49 2007//
  827.  /c2.rb/1.1/Wed Feb 28 08:48:49 2007//
  828.  /c3.rb/1.1/Wed Feb 28 08:48:49 2007//
  829. diff -rNu orig/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/TclLanguageToolkit.java modif/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/TclLanguageToolkit.java
  830. --- orig/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/TclLanguageToolkit.java    2007-02-25 15:47:000 +0600
  831. +++ modif/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/TclLanguageToolkit.java    2007-03-02 10:29:000 +0600
  832. @@ -260,23 +260,6 @@
  833.          return "org.eclipse.dltk.tcl.ui.editor.TclEditor";
  834.      }
  835.  
  836. -    public ModuleDeclaration createFullAST(ISourceModule module) {
  837. -        TclSourceParser parser = new TclSourceParser();
  838. -        try {
  839. -            ModuleDeclaration decl = parser.parse(module.getSource());
  840. -            decl.rebuild();
  841. -
  842. -            // this call has empty impl
  843. -            // TclASTBuilder.buildFullAST(decl);
  844. -            return decl;
  845. -        } catch (ModelException e) {
  846. -            if( DLTKCore.DEBUG ) {
  847. -                e.printStackTrace();
  848. -            }
  849. -        }
  850. -        return null;
  851. -    }
  852. -
  853.      public ISelectionEngine createSelectionEngine(ISearchableEnvironment environment, Map options) {
  854.          return new TclSelectionEngine(environment, options, this);
  855.      }
  856. diff -rNu orig/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclSourceElementParser.java modif/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclSourceElementParser.java
  857. --- orig/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclSourceElementParser.java    2007-03-01 18:34:000 +0600
  858. +++ modif/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclSourceElementParser.java    2007-03-02 03:28:000 +0600
  859. @@ -349,8 +349,13 @@
  860.              inner = ((TclBlockExpression) code)
  861.                      .parseBlock(code.sourceStart() + 1);
  862.  
  863. -            this.buildModel(inner, TYPE_NAMESPACE, parentNamespaceName + "::"
  864. -                    + sNameSpaceName);
  865. +            if(sNameSpaceName.startsWith("::") && parentNamespaceName.length() == 0 ) {
  866. +                this.buildModel(inner, TYPE_NAMESPACE, sNameSpaceName);
  867. +            }
  868. +            else {
  869. +                this.buildModel(inner, TYPE_NAMESPACE, parentNamespaceName + "::"
  870. +                        + sNameSpaceName);
  871. +            }
  872.  
  873.              exit.go();
  874.          }
  875. diff -rNu orig/org.eclipse.dltk.tcl.ui/plugin.xml modif/org.eclipse.dltk.tcl.ui/plugin.xml
  876. --- orig/org.eclipse.dltk.tcl.ui/plugin.xml    2007-02-25 15:46:000 +0600
  877. +++ modif/org.eclipse.dltk.tcl.ui/plugin.xml    2007-03-02 13:57:000 +0600
  878. @@ -120,7 +120,7 @@
  879.              name="%NewSourceFolderCreationWizard.label"
  880.              icon="/icons/newpackfolder_wiz.gif"
  881.              category="org.eclipse.dltk.tcl.ui"
  882. -            class="org.eclipse.dltk.internal.ui.wizards.NewSourceFolderCreationWizard"
  883. +            class="org.eclipse.dltk.ui.wizards.NewSourceFolderCreationWizard"
  884.              id="org.eclipse.dltk.tcl.ui.wizards.NewSourceFolderCreationWizard">
  885.          
  886.              %NewSourceFolderCreationWizard.description
  887. diff -rNu orig/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/History.java modif/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/History.java
  888. --- orig/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/History.java    2007-02-22 14:40:000 +0600
  889. +++ modif/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/History.java    2007-03-02 12:04:000 +0600
  890. @@ -37,6 +37,8 @@
  891.  import org.eclipse.core.runtime.CoreException;
  892.  import org.eclipse.core.runtime.IPath;
  893.  import org.eclipse.core.runtime.IStatus;
  894. +import org.eclipse.dltk.core.DLTKCore;
  895. +import org.eclipse.dltk.core.ModelException;
  896.  import org.eclipse.dltk.internal.ui.DLTKUIException;
  897.  import org.eclipse.dltk.internal.ui.DLTKUIStatus;
  898.  import org.eclipse.dltk.ui.DLTKUIPlugin;
  899. @@ -266,8 +268,15 @@
  900.              if (node.getNodeType() == Node.ELEMENT_NODE) {
  901.                  Element type= (Element) node;
  902.                  if (type.getNodeName().equalsIgnoreCase(fInfoNodeName)) {
  903. -                    Object object= createFromElement(type);
  904. -                    fHistory.put(getKey(object), object);
  905. +                    try {
  906. +                        Object object= createFromElement(type);
  907. +                        fHistory.put(getKey(object), object);
  908. +                    }
  909. +                    catch( Exception me ) {
  910. +                        if(DLTKCore.DEBUG) {
  911. +                            me.printStackTrace();
  912. +                        }
  913. +                    }
  914.                  }
  915.              }
  916.          }
  917.  

PermaLink to this entry https://pastebin.co.uk/11287
Posted by Andrey Tarantsov Fri 2nd Mar 2007 09:20 - Syntax is Diff - 28 views
Download | New Post | Modify | Hide line numbers

 

Comments: 0