org.eclipse.jdt.internal.codeassist.select.SelectionOnExplicitConstructorCall Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.codeassist.select;
/*
* Selection node build by the parser in any case it was intending to
* reduce an explicit constructor call containing the cursor.
* e.g.
*
* class X {
* void foo() {
* Y.[start]super[end](1, 2)
* }
* }
*
* ---> class X {
* void foo() {
*
* }
* }
*/
import org.eclipse.jdt.internal.compiler.ast.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
public class SelectionOnExplicitConstructorCall extends ExplicitConstructorCall {
public SelectionOnExplicitConstructorCall(int accessMode) {
super(accessMode);
}
@Override
public StringBuilder printStatement(int tab, StringBuilder output) {
printIndent(tab, output);
output.append(" 0) output.append(", "); //$NON-NLS-1$
this.arguments[i].printExpression(0, output);
}
}
return output.append(")>;"); //$NON-NLS-1$
}
@Override
public void resolve(BlockScope scope) {
super.resolve(scope);
// tolerate some error cases
if (this.binding == null ||
!(this.binding.isValidBinding() ||
this.binding.problemId() == ProblemReasons.NotVisible))
throw new SelectionNodeFound();
else
throw new SelectionNodeFound(this.binding);
}
}