blob: 64196e72fd2d360c1d135dc9cbaa39f042e1451d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*
*/
package org.eclipse.jem.workbench.utility;
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jem.internal.instantiation.InstantiationFactory;
import org.eclipse.jem.internal.instantiation.PTExpression;
import org.eclipse.jem.workbench.utility.ParseTreeCreationFromAST.InvalidExpressionException;
/**
* This is used for AST Resolution, but it simply turns Name into PTName. Useful when
* just creating a parse tree where we know the names are ok and just types.
* @since 1.0.0
*/
public class NoASTResolver extends ASTBoundResolver {
/* (non-Javadoc)
* @see org.eclipse.jem.workbench.utility.ParseTreeCreationFromAST.Resolver#resolveName(org.eclipse.jdt.core.dom.Name)
*/
public PTExpression resolveName(Name name) throws InvalidExpressionException {
return InstantiationFactory.eINSTANCE.createPTName(name.toString());
}
/* (non-Javadoc)
* @see org.eclipse.jem.workbench.utility.ParseTreeCreationFromAST.Resolver#resolveType(org.eclipse.jdt.core.dom.Type)
*/
public String resolveType(Type type) {
return type.toString();
}
/* (non-Javadoc)
* @see org.eclipse.jem.workbench.utility.ParseTreeCreationFromAST.Resolver#resolveType(org.eclipse.jdt.core.dom.Name)
*/
public String resolveType(Name name) throws InvalidExpressionException {
return name.toString();
}
}