protected String getPathInFragmentRoot(final ITypeRoot derivedResource) { return derivedResource.getParent().getElementName().replace('.', '/') + "/"; }
public boolean equals(Object o) { if (this == o) return true; /* I see cases where equal lambdas are dismissed as unequal on account of working copy owner. This results in spurious failures. See JavaSearchBugs8Tests.testBug400905_0021() For now exclude the working copy owner and compare */ if (o instanceof LambdaExpression) { LambdaExpression that = (LambdaExpression) o; if (this.sourceStart != that.sourceStart) return false; ITypeRoot thisTR = this.getTypeRoot(); ITypeRoot thatTR = that.getTypeRoot(); return thisTR.getElementName().equals(thatTR.getElementName()) && thisTR.getParent().equals(thatTR.getParent()); } return false; }
public boolean equals(Object o) { if (this == o) return true; /* I see cases where equal lambdas are dismissed as unequal on account of working copy owner. This results in spurious failures. See JavaSearchBugs8Tests.testBug400905_0021() For now exclude the working copy owner and compare */ if (o instanceof LambdaExpression) { LambdaExpression that = (LambdaExpression) o; if (this.sourceStart != that.sourceStart) return false; ITypeRoot thisTR = this.getTypeRoot(); ITypeRoot thatTR = that.getTypeRoot(); return thisTR.getElementName().equals(thatTR.getElementName()) && thisTR.getParent().equals(thatTR.getParent()); } return false; }
public boolean equals(Object o) { if (this == o) return true; /* I see cases where equal lambdas are dismissed as unequal on account of working copy owner. This results in spurious failures. See JavaSearchBugs8Tests.testBug400905_0021() For now exclude the working copy owner and compare */ if (o instanceof LambdaExpression) { LambdaExpression that = (LambdaExpression) o; if (this.sourceStart != that.sourceStart) return false; ITypeRoot thisTR = this.getTypeRoot(); ITypeRoot thatTR = that.getTypeRoot(); return thisTR.getElementName().equals(thatTR.getElementName()) && thisTR.getParent().equals(thatTR.getParent()); } return false; }
@Override public boolean equals(Object o) { if (this == o) return true; /* I see cases where equal lambdas are dismissed as unequal on account of working copy owner. This results in spurious failures. See JavaSearchBugs8Tests.testBug400905_0021() For now exclude the working copy owner and compare */ if (o instanceof LambdaExpression) { LambdaExpression that = (LambdaExpression) o; if (this.sourceStart != that.sourceStart) return false; ITypeRoot thisTR = this.getTypeRoot(); ITypeRoot thatTR = that.getTypeRoot(); return thisTR.getElementName().equals(thatTR.getElementName()) && thisTR.getParent().equals(thatTR.getParent()); } return false; }
public boolean equals(Object o) { if (this == o) return true; /* I see cases where equal lambdas are dismissed as unequal on account of working copy owner. This results in spurious failures. See JavaSearchBugs8Tests.testBug400905_0021() For now exclude the working copy owner and compare */ if (o instanceof LambdaExpression) { LambdaExpression that = (LambdaExpression) o; if (this.sourceStart != that.sourceStart) return false; ITypeRoot thisTR = this.getTypeRoot(); ITypeRoot thatTR = that.getTypeRoot(); return thisTR.getElementName().equals(thatTR.getElementName()) && thisTR.getParent().equals(thatTR.getParent()); } return false; }
protected IPath getSourcePath(final ITypeRoot derivedJavaType) { IJavaElement current = derivedJavaType.getParent(); while (current != null) { if (current instanceof IPackageFragmentRoot) { IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot) current; try { IPath attachmentPath = fragmentRoot.getSourceAttachmentPath(); if (attachmentPath != null) return attachmentPath; } catch (JavaModelException e) { } if (current instanceof JarPackageFragmentRoot) return fragmentRoot.getPath(); } current = current.getParent(); } return null; }
IPackageFragment packageFragment = (IPackageFragment) unit.getParent(); IJavaElement found = Stream
private void addOverlaysWithSearchEngine(ITypeRoot element, String typeName, IDecoration decoration) { SearchEngine engine= new SearchEngine(); IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { element }); class Result extends RuntimeException { private static final long serialVersionUID= 1L; int modifiers; public Result(int modifiers) { this.modifiers= modifiers; } } TypeNameRequestor requestor= new TypeNameRequestor() { @Override public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { if (enclosingTypeNames.length == 0 /*&& Flags.isPublic(modifiers)*/) { throw new Result(modifiers); } } }; try { String packName = element.getParent().getElementName(); int matchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE; engine.searchAllTypeNames(packName.toCharArray(), matchRule, typeName.toCharArray(), matchRule, IJavaSearchConstants.TYPE, scope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH , null); } catch (Result e) { addOverlaysFromFlags(e.modifiers, decoration); } catch (JavaModelException e) { JavaPlugin.log(e); } }
String packName = element.getParent().getElementName(); int matchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE; engine.searchAllTypeNames(packName.toCharArray(), matchRule, typeName.toCharArray(), matchRule, IJavaSearchConstants.TYPE, scope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH , null);
private void addOverlaysWithSearchEngine(ITypeRoot element, String typeName, IDecoration decoration) { SearchEngine engine= new SearchEngine(); IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { element }); class Result extends RuntimeException { private static final long serialVersionUID= 1L; int modifiers; public Result(int modifiers) { this.modifiers= modifiers; } } TypeNameRequestor requestor= new TypeNameRequestor() { @Override public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { if (enclosingTypeNames.length == 0 /*&& Flags.isPublic(modifiers)*/) { throw new Result(modifiers); } } }; try { String packName = element.getParent().getElementName(); int matchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE; engine.searchAllTypeNames(packName.toCharArray(), matchRule, typeName.toCharArray(), matchRule, IJavaSearchConstants.TYPE, scope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH , null); } catch (Result e) { addOverlaysFromFlags(e.modifiers, decoration); } catch (JavaModelException e) { JavaPlugin.log(e); } }
ITypeRoot moduleRoot= getModuleRoot(root); if (moduleRoot != null) { IJavaElement defaultPackage= moduleRoot.getParent(); if (!JavaModelUtil.containsOrdinaryCompilationUnit((IPackageFragment) defaultPackage)) {
throw new IllegalStateException(); PackageFragment packageFragment = (PackageFragment) this.typeRoot.getParent(); BinaryType type = (BinaryType) this.typeRoot.findPrimaryType(); String fileNameString = null;
IPackageFragment packageFragment= (IPackageFragment) typeRoot.getParent(); try { ICompilationUnit[] compilationUnits= packageFragment.getCompilationUnits();
ITypeRoot typeRoot= (ITypeRoot) ((IPackageDeclaration) curr).getParent(); Region hoverRegion= new Region(nameRange.getOffset(), nameRange.getLength()); JavadocHover.addAnnotations(buffer, typeRoot.getParent(), typeRoot, hoverRegion);
IPackageFragment packageFragment= (IPackageFragment) typeRoot.getParent(); try { ICompilationUnit[] compilationUnits= packageFragment.getCompilationUnits();
ITypeRoot typeRoot= (ITypeRoot) ((IPackageDeclaration) curr).getParent(); Region hoverRegion= new Region(nameRange.getOffset(), nameRange.getLength()); JavadocHover.addAnnotations(buffer, typeRoot.getParent(), typeRoot, hoverRegion);
element = ((IOrdinaryClassFile) packageInfo).getType(); } else { element = packageInfo.getParent(); // parent is the IPackageFragment
element= ((IClassFile) packageInfo).getType(); } else { element= packageInfo.getParent(); // parent is the IPackageFragment
element= ((IOrdinaryClassFile) packageInfo).getType(); } else { element= packageInfo.getParent(); // parent is the IPackageFragment