Example usage for org.eclipse.jdt.core IJavaModel exists

List of usage examples for org.eclipse.jdt.core IJavaModel exists

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaModel exists.

Prototype

boolean exists();

Source Link

Document

Returns whether this Java element exists in the model.

Usage

From source file:com.google.gdt.eclipse.designer.core.util.UtilsTest.java

License:Open Source License

/**
 * Test for {@link Utils#getJavaModel()}.
 *///from  w ww .  j av  a  2  s.  c o m
public void test_getJavaModel() throws Exception {
    IJavaModel javaModel = Utils.getJavaModel();
    assertNotNull(javaModel);
    assertTrue(javaModel.exists());
}

From source file:org.fastcode.util.SourceUtil.java

License:Open Source License

/**
 *
 * @param paramType//from www .j  a  v  a2s. com
 * @return
 * @throws Exception
 */
public static IJavaProject[] getProjectsFromWorkspace() throws Exception {
    final IWorkspace workspace = ResourcesPlugin.getWorkspace();
    final IJavaModel javaModel = JavaCore.create(workspace.getRoot());
    if (javaModel == null || !javaModel.exists()) {
        return new IJavaProject[0];
    }
    final IJavaProject projects[] = javaModel.getJavaProjects();
    return projects;
}