org.eclipse.jdt.core.dom.TypeDeclarationStatement Java Examples

The following examples show how to use org.eclipse.jdt.core.dom.TypeDeclarationStatement. 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: UnusedCodeFix.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModel linkedModel) throws CoreException {
	ASTRewrite rewrite= cuRewrite.getASTRewrite();
	IBinding binding= fUnusedName.resolveBinding();
	CompilationUnit root= (CompilationUnit) fUnusedName.getRoot();
	String displayString= FixMessages.UnusedCodeFix_RemoveUnusedTypeParameter_description;
	TextEditGroup group= createTextEditGroup(displayString, cuRewrite);

	if (binding.getKind() == IBinding.TYPE) {
		ITypeBinding decl= ((ITypeBinding) binding).getTypeDeclaration();
		ASTNode declaration= root.findDeclaringNode(decl);
		if (declaration.getParent() instanceof TypeDeclarationStatement) {
			declaration= declaration.getParent();
		}
		rewrite.remove(declaration, group);
	}
}
 
Example #2
Source File: ScopeAnalyzer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	if (hasFlag(TYPES, fFlags) && node.getStartPosition() + node.getLength() < fPosition) {
		fBreak= fRequestor.acceptBinding(node.resolveBinding());
		return false;
	}
	return !fBreak && isInside(node);
}
 
Example #3
Source File: StyledStringVisitor.java    From JDeodorant with MIT License 5 votes vote down vote up
public boolean visit(TypeDeclarationStatement stmnt){
	/*
	 * TypeDeclaration
   		or EnumDeclaration
	 */
	return false;
}
 
Example #4
Source File: FlowAnalyzer.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void endVisit(TypeDeclarationStatement node) {
	if (skipNode(node)) {
		return;
	}
	assignFlowInfo(node, node.getDeclaration());
}
 
Example #5
Source File: JavaASTFlattener.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean visit(final TypeDeclarationStatement node) {
  boolean _isNotSupportedInnerType = this._aSTFlattenerUtils.isNotSupportedInnerType(node);
  if (_isNotSupportedInnerType) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("/*FIXME Non-static inner classes are not supported. */");
    this.appendToBuffer(_builder.toString());
    this.addProblem(node, "Non-static inner classes are not supported.");
  }
  node.getDeclaration().accept(this);
  return false;
}
 
Example #6
Source File: ScopeAnalyzer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	if (hasFlag(TYPES, fFlags) && fPosition < node.getStartPosition()) {
		fBreak= fRequestor.acceptBinding(node.resolveBinding());
	}
	return false;
}
 
Example #7
Source File: InlineConstantRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @param scope not a TypeDeclaration
 * @return Set containing Strings representing simple names
 */
private Set<String> getLocallyDeclaredNames(BodyDeclaration scope) {
	Assert.isTrue(!(scope instanceof AbstractTypeDeclaration));

	final Set<String> result= new HashSet<String>();

	if (scope instanceof FieldDeclaration)
		return result;

	scope.accept(new HierarchicalASTVisitor() {

		@Override
		public boolean visit(AbstractTypeDeclaration node) {
			Assert.isTrue(node.getParent() instanceof TypeDeclarationStatement);

			result.add(node.getName().getIdentifier());
			return false;
		}

		@Override
		public boolean visit(AnonymousClassDeclaration anonDecl) {
			return false;
		}

		@Override
		public boolean visit(VariableDeclaration varDecl) {
			result.add(varDecl.getName().getIdentifier());
			return false;
		}
	});
	return result;
}
 
Example #8
Source File: ImplementOccurrencesFinder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	// don't dive into local type declarations.
	return false;
}
 
Example #9
Source File: GenericVisitor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void endVisit(TypeDeclarationStatement node) {
	endVisitNode(node);
}
 
Example #10
Source File: GenericVisitor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	return visitNode(node);
}
 
Example #11
Source File: CodeScopeBuilder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	fScope.addName(node.getDeclaration().getName().getIdentifier());
	return false;
}
 
Example #12
Source File: ExceptionOccurrencesFinder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	// don't dive into local type declarations.
	return false;
}
 
Example #13
Source File: CodeBlock.java    From SimFix with GNU General Public License v2.0 4 votes vote down vote up
private TypeDeclarationStmt visit(TypeDeclarationStatement node){
	int startLine = _cunit.getLineNumber(node.getStartPosition());
	int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength());
	TypeDeclarationStmt typeDeclarationStmt = new TypeDeclarationStmt(startLine, endLine, node);
	return typeDeclarationStmt;
}
 
Example #14
Source File: InstanceOfTypeDeclarationStatement.java    From JDeodorant with MIT License 4 votes vote down vote up
public boolean instanceOf(Statement statement) {
	if(statement instanceof TypeDeclarationStatement)
		return true;
	else
		return false;
}
 
Example #15
Source File: StatementCollector.java    From JDeodorant with MIT License 4 votes vote down vote up
public boolean visit(TypeDeclarationStatement node) {
	statementList.add(node);
	return false;
}
 
Example #16
Source File: ExtractStatementsVisitor.java    From JDeodorant with MIT License 4 votes vote down vote up
public boolean visit(TypeDeclarationStatement node) {
	statementsList.add(node);
	
	return false;
}
 
Example #17
Source File: IdentifierPerType.java    From codemining-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean visit(final TypeDeclarationStatement node) {
	addToMap(identifiers, node, node.getDeclaration().getName()
			.toString());
	return super.visit(node);
}
 
Example #18
Source File: ConstraintCollector.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	add(fCreator.create(node));
	return true;
}
 
Example #19
Source File: AstMatchingNodeFinder.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	if (node.subtreeMatch(fMatcher, fNodeToMatch))
		return matches(node);
	return super.visit(node);
}
 
Example #20
Source File: NameCollector.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	names.add(node.getDeclaration().getName().getIdentifier());
	return false;
}
 
Example #21
Source File: FlowAnalyzer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void endVisit(TypeDeclarationStatement node) {
	if (skipNode(node))
		return;
	assignFlowInfo(node, node.getDeclaration());
}
 
Example #22
Source File: PullUpRefactoringProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public final boolean visit(final TypeDeclarationStatement node) {
	fTypeDeclarationStatement= true;
	return super.visit(node);
}
 
Example #23
Source File: PullUpRefactoringProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public final void endVisit(final TypeDeclarationStatement node) {
	fTypeDeclarationStatement= false;
	super.endVisit(node);
}
 
Example #24
Source File: MoveInnerToTopRefactoring.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean isInLocalTypeInsideInputType(ASTNode node, AbstractTypeDeclaration declaration) {
	final TypeDeclarationStatement statement= (TypeDeclarationStatement) ASTNodes.getParent(node, TypeDeclarationStatement.class);
	return statement != null && ASTNodes.isParent(statement, declaration);
}
 
Example #25
Source File: IdentifierPerType.java    From tassal with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean visit(final TypeDeclarationStatement node) {
	addToMap(identifiers, node, node.getDeclaration().getName()
			.toString());
	return super.visit(node);
}
 
Example #26
Source File: IdentifierPerType.java    From api-mining with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean visit(final TypeDeclarationStatement node) {
	addToMap(identifiers, node, node.getDeclaration().getName()
			.toString());
	return super.visit(node);
}
 
Example #27
Source File: ASTFlattenerUtils.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public boolean isNotSupportedInnerType(final TypeDeclarationStatement it) {
  ASTNode _parent = it.getParent();
  return (_parent instanceof Block);
}
 
Example #28
Source File: CodeScopeBuilder.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public boolean visit(TypeDeclarationStatement node) {
	fScope.addName(node.getDeclaration().getName().getIdentifier());
	return false;
}
 
Example #29
Source File: CodeSearch.java    From SimFix with GNU General Public License v2.0 4 votes vote down vote up
public boolean visit(TypeDeclarationStatement node){
	return true;
}
 
Example #30
Source File: ConstraintCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * @param node the AST node
 * @return array of type constraints, may be empty
 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TypeDeclarationStatement)
 */
public ITypeConstraint[] create(TypeDeclarationStatement node) {
	return EMPTY_ARRAY;
}