Java Code Examples for org.eclipse.jdt.internal.core.util.Util#equalArraysOrNull()

The following examples show how to use org.eclipse.jdt.internal.core.util.Util#equalArraysOrNull() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CopyResourceElementsOperation.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Updates the content of <code>cu</code>, modifying the type name and/or package
 * declaration as necessary.
 *
 * @return an AST rewrite or null if no rewrite needed
 */
private TextEdit updateContent(ICompilationUnit cu, PackageFragment dest, String newName) throws JavaModelException {
	String[] currPackageName = ((PackageFragment) cu.getParent()).names;
	String[] destPackageName = dest.names;
	if (Util.equalArraysOrNull(currPackageName, destPackageName) && newName == null) {
		return null; //nothing to change
	} else {
		// ensure cu is consistent (noop if already consistent)
		cu.makeConsistent(this.progressMonitor);
		this.parser.setSource(cu);
		CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
		AST ast = astCU.getAST();
		ASTRewrite rewrite = ASTRewrite.create(ast);
		updateTypeName(cu, astCU, cu.getElementName(), newName, rewrite);
		updatePackageStatement(astCU, destPackageName, rewrite, cu);
		return rewrite.rewriteAST();
	}
}
 
Example 2
Source File: TypeHierarchy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns <code>true</code> if an equivalent package fragment is included in the package
 * region. Package fragments are equivalent if they both have the same name.
 */
protected boolean packageRegionContainsSamePackageFragment(PackageFragment element) {
	IJavaElement[] pkgs = this.packageRegion.getElements();
	for (int i = 0; i < pkgs.length; i++) {
		PackageFragment pkg = (PackageFragment) pkgs[i];
		if (Util.equalArraysOrNull(pkg.names, element.names))
			return true;
	}
	return false;
}
 
Example 3
Source File: MemberValuePair.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean equals(Object obj) {
	if (!(obj instanceof MemberValuePair)) {
		return false;
	}
	MemberValuePair other = (MemberValuePair) obj;
	return
		this.valueKind == other.valueKind
		&& this.memberName.equals(other.memberName)
		&& (this.value == other.value
			|| (this.value != null && this.value.equals(other.value))
			|| (this.value instanceof Object[] && other.value instanceof Object[] && Util.equalArraysOrNull((Object[])this.value, (Object[]) other.value)));
}
 
Example 4
Source File: PackageFragment.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean equals(Object o) {
	if (this == o) return true;
	if (!(o instanceof PackageFragment)) return false;

	PackageFragment other = (PackageFragment) o;
	return Util.equalArraysOrNull(this.names, other.names) &&
			this.parent.equals(other.parent);
}
 
Example 5
Source File: SourceMethod.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public boolean equals(Object o) {
	if (!(o instanceof SourceMethod)) return false;
	return super.equals(o) && Util.equalArraysOrNull(this.parameterTypes, ((SourceMethod)o).parameterTypes);
}
 
Example 6
Source File: BinaryMethod.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public boolean equals(Object o) {
	if (!(o instanceof BinaryMethod)) return false;
	return super.equals(o) && Util.equalArraysOrNull(getErasedParameterTypes(), ((BinaryMethod)o).getErasedParameterTypes());
}