use of org.eclipse.jdt.core.IJavaProject in project xtext-eclipse by eclipse.
the class JdtAwareProjectByResourceProvider method getProjectContext.
@Override
public IProject getProjectContext(Resource resource) {
IProject result = super.getProjectContext(resource);
if (result != null) {
return result;
}
IJavaProject javaProject = javaProjectProvider.getJavaProject(resource.getResourceSet());
if (javaProject != null && javaProject.exists()) {
return javaProject.getProject();
}
return null;
}
use of org.eclipse.jdt.core.IJavaProject in project xtext-eclipse by eclipse.
the class AbstractXbaseContentAssistBugTest method getJavaProject.
@Override
public IJavaProject getJavaProject(final ResourceSet resourceSet) {
final String projectName = this.getProjectName();
IJavaProject javaProject = JavaProjectSetupUtil.findJavaProject(projectName);
if (((javaProject == null) || (!javaProject.exists()))) {
try {
this.demandCreateProject = AbstractXbaseUITestCase.createPluginProject(projectName);
javaProject = JavaProjectSetupUtil.findJavaProject(projectName);
} catch (final Throwable _t) {
if (_t instanceof CoreException) {
final CoreException e = (CoreException) _t;
String _message = e.getMessage();
String _plus = ("cannot create java project due to: " + _message);
String _plus_1 = (_plus + " / ");
String _plus_2 = (_plus_1 + e);
Assert.fail(_plus_2);
} else {
throw Exceptions.sneakyThrow(_t);
}
}
}
return javaProject;
}
use of org.eclipse.jdt.core.IJavaProject in project xtext-eclipse by eclipse.
the class Bug403554Test method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
final IJavaProject project = this.getJavaProject(null);
IType type = project.findType(ArrayList.class.getName());
IMethod method = type.getMethod("subList", new String[] { "I", "I" });
while ((!method.exists())) {
{
String superclassName = type.getSuperclassName();
final int idx = superclassName.indexOf("<");
if ((idx != (-1))) {
superclassName = superclassName.substring(0, idx);
}
type = project.findType(superclassName);
method = type.getMethod("subList", new String[] { "I", "I" });
}
}
this.declarator = type.getElementName();
}
use of org.eclipse.jdt.core.IJavaProject in project xtext-eclipse by eclipse.
the class ContentAssistInBlockTest method getJavaProject.
@Override
public IJavaProject getJavaProject(ResourceSet resourceSet) {
IJavaProject javaProject = findJavaProject(PROJECT_NAME);
if (javaProject == null || !javaProject.exists()) {
try {
demandCreateProject = AbstractXbaseUITestCase.createPluginProject(PROJECT_NAME);
javaProject = findJavaProject(PROJECT_NAME);
} catch (CoreException e) {
fail("cannot create java project due to: " + e.getMessage() + " / " + e);
}
}
return javaProject;
}
use of org.eclipse.jdt.core.IJavaProject in project xtext-eclipse by eclipse.
the class ContentAssistTest method getJavaProject.
@Override
public IJavaProject getJavaProject(ResourceSet resourceSet) {
IJavaProject javaProject = findJavaProject(PROJECT_NAME);
if (javaProject == null || !javaProject.exists()) {
try {
demandCreateProject = AbstractXbaseUITestCase.createPluginProject(PROJECT_NAME);
javaProject = findJavaProject(PROJECT_NAME);
} catch (CoreException e) {
fail("cannot create java project due to: " + e.getMessage() + " / " + e);
}
}
return javaProject;
}
Aggregations