Examples of IJavaModel


Examples of org.eclipse.jdt.core.IJavaModel

   * @return all package fragment roots
   */
  public static Set<IPackageFragmentRoot> getWorkspaceScope()
      throws JavaModelException {
    final Set<IPackageFragmentRoot> scope = new HashSet<IPackageFragmentRoot>();
    final IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace()
        .getRoot());
    for (IJavaProject p : model.getJavaProjects()) {
      scope.addAll(Arrays.asList(p.getPackageFragmentRoots()));
    }
    return filterJREEntries(scope);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

  /*
   * The overall scope are all plug-in projects in the workspace.
   */
  public Set<IPackageFragmentRoot> getOverallScope(
      ILaunchConfiguration configuration) throws CoreException {
    final IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace()
        .getRoot());
    final Set<IPackageFragmentRoot> result = new HashSet<IPackageFragmentRoot>();
    for (final IJavaProject project : model.getJavaProjects()) {
      if (project.getProject().hasNature(PLUGIN_NATURE)) {
        result.addAll(Arrays.asList(project.getPackageFragmentRoots()));
      }
    }
    return ScopeUtils.filterJREEntries(result);
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

  /*
   * We list all source based class files of all plugins in the workspace.
   */
  public IClassFiles[] getClassFiles(ILaunchConfiguration configuration, boolean includebinaries) throws CoreException {
    IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
    IJavaProject[] projects = model.getJavaProjects();
    List l = new ArrayList();
    for (int i = 0; i < projects.length; i++) {
      if (projects[i].getProject().hasNature(PLUGIN_NATURE)) {
        IClassFiles[] cf = EclEmmaCorePlugin.getInstance().getClassFiles(projects[i]);
        for (int j = 0; j < cf.length; j++) {
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

  }

  private IRuntimeClasspathEntry[] filterWebInfLibs(
      IRuntimeClasspathEntry[] defaults, ILaunchConfiguration configuration) {

    IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace()
        .getRoot());
    String projectName = null;
    String webAppDirName = null;
    try {
      projectName = configuration.getAttribute(
          IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
      webAppDirName = configuration.getAttribute(Plugin.ATTR_WEBAPPDIR, "");
    } catch (CoreException e) {
      Plugin.logError(e);
    }

    if (projectName == null || projectName.trim().equals("")
        || webAppDirName == null || webAppDirName.trim().equals("")) {
      return defaults;
    }

    IJavaProject project = javaModel.getJavaProject(projectName);
    if (project == null) {
      return defaults;
    }

    // this should be fine since the plugin checks whether WEB-INF exists
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

    }
    return result;
  }
 
  public static IFolder getWebInfLib(ILaunchConfiguration configuration){
    IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace()
        .getRoot());
    String projectName = null;
    String webAppDirName = null;
    try {
      projectName = configuration.getAttribute(
          IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
      webAppDirName = configuration.getAttribute(Plugin.ATTR_WEBAPPDIR,
          "");
    } catch (CoreException e) {
      Plugin.logError(e);
    }

    if (projectName == null || projectName.trim().equals("")
        || webAppDirName == null || webAppDirName.trim().equals("")) {
      return null;
    }

    IJavaProject project = javaModel.getJavaProject(projectName);
    if (project == null) {
      return null;
    }

    // this should be fine since the plugin checks whether WEB-INF exists
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

   */
  protected void collectRequiredProjects(IJavaProject proj, List<IJavaProject> res) throws JavaModelException {
    if (!res.contains(proj)) {
      res.add(proj);

      IJavaModel model= proj.getJavaModel();

      IClasspathEntry[] entries= proj.getRawClasspath();
      for (int i= 0; i < entries.length; i++) {
        IClasspathEntry curr= entries[i];
        if (curr.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
          IJavaProject ref= model.getJavaProject(curr.getPath().segment(0));
          if (ref.exists()) {
            collectRequiredProjects(ref, res);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

   */
  protected void collectRequiredProjects(IJavaProject proj, List<IJavaProject> res) throws JavaModelException {
    if (!res.contains(proj)) {
      res.add(proj);

      IJavaModel model= proj.getJavaModel();

      IClasspathEntry[] entries= proj.getRawClasspath();
      for (int i= 0; i < entries.length; i++) {
        IClasspathEntry curr= entries[i];
        if (curr.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
          IJavaProject ref= model.getJavaProject(curr.getPath().segment(0));
          if (ref.exists()) {
            collectRequiredProjects(ref, res);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

   */
  protected void collectRequiredProjects(IJavaProject proj, List<IJavaProject> res) throws JavaModelException {
    if (!res.contains(proj)) {
      res.add(proj);

      IJavaModel model= proj.getJavaModel();

      IClasspathEntry[] entries= proj.getRawClasspath();
      for (int i= 0; i < entries.length; i++) {
        IClasspathEntry curr= entries[i];
        if (curr.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
          IJavaProject ref= model.getJavaProject(curr.getPath().segment(0));
          if (ref.exists()) {
            collectRequiredProjects(ref, res);
          }
        }
      }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

 
  @BeforeClass
  public static void setUpBeforeClass() throws Exception{
    setUpProject();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IJavaModel model =  JavaCore.create(workspace.getRoot());
    IJavaProject project = model.getJavaProject("TestProject");
    List<IJavaElement> selection = new ArrayList<IJavaElement>();
    selection.add(project);
    ProjectParser parser = new ProjectParser(selection);
    parser.parse(null);
    fModel = parser.getModel();
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModel

 
  @BeforeClass
  public static void setUpBeforeClass() throws Exception{
    setUpProject();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IJavaModel model =  JavaCore.create(workspace.getRoot());
    IJavaProject project = model.getJavaProject("TestProject");
    List<IJavaElement> selection = new ArrayList<IJavaElement>();
    selection.add(project);
    ProjectParser parser = new ProjectParser(selection);
    parser.parse(null);
    fModel = parser.getModel();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.