Examples of IProjectFragment


Examples of org.eclipse.dltk.core.IProjectFragment

  }
 
  public static IProjectFragment getFolderProjectFragment(String path) {
    IFolder member = scriptProject.getProject().getFolder(path);
    assertTrue(member.exists());
    IProjectFragment element = scriptProject.getProjectFragment(member);
    assertTrue(element.exists());
    return element;
  }
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

  }
 
  /** Setup the given folder as a source folder. */
  public static IProjectFragment addSourceFolder(IContainer folder) throws CoreException {
    IScriptProject dltkProj = DLTKCore.create(folder.getProject());
    IProjectFragment fragment = dltkProj.getProjectFragment(folder);
    if(!fragment.exists()) {
      IBuildpathEntry[] bpentries = dltkProj.getRawBuildpath();
      IBuildpathEntry entry = DLTKCore.newSourceEntry(fragment.getPath());
      dltkProj.setRawBuildpath(ArrayUtil.concat(bpentries, entry), null);
    }
    return fragment;
  }
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

      public void createPackage(IProgressMonitor monitor) throws CoreException,
              InterruptedException {
        if (monitor == null) {
          monitor = new NullProgressMonitor();
        }
        IProjectFragment root = getProjectFragment();
        String packName = getPackageText();
        packName = packName.replaceAll("[.]", "/");
        fCreatedScriptFolder = root.createScriptFolder(packName, true, monitor);
        if (monitor.isCanceled()) {
          throw new InterruptedException();
        }
      }
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

   
    protected IModelElement[] createTreeModel() {
      IScriptModel model = DLTKUtils.getDLTKModel();
      IScriptProject scriptProj = model.getScriptProject("#__PreviewProject");
     
      IProjectFragment projectFragment = scriptProj.getProjectFragment(scriptProj.getProject().getFolder("src"));
      assertNotNull(projectFragment);
      IScriptFolder scriptFolder = projectFragment.getScriptFolder("pack.sub");
      String[] ns = array("pack", "sub");
      assertNotNull(scriptFolder);
      ISourceModule sourceModule1 = scriptFolder.getSourceModule("sourceModule.d");
      assertNotNull(sourceModule1);
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

            && hasReadOnlyResourcesAndSubResources((IResource) object))
          return true;
      }
      return hasReadOnlyResourcesAndSubResources(pack.getChildren());
    case IModelElement.PROJECT_FRAGMENT:
      IProjectFragment root = (IProjectFragment) modelElement;
      if (root.isArchive())
        return false;
      IResource pfrResource = ReorgUtils.getResource(modelElement);
      if (pfrResource == null)
        return false;
      if (Resources.isReadOnly(pfrResource))
        return true;
      Object[] nonScript1 = root.getForeignResources();
      for (int i = 0; i < nonScript1.length; i++) {
        Object object = nonScript1[i];
        if (object instanceof IResource
            && hasReadOnlyResourcesAndSubResources((IResource) object))
          return true;
      }
      return hasReadOnlyResourcesAndSubResources(root.getChildren());

    case IModelElement.FIELD:
      // case IModelElement.IMPORT_CONTAINER:
      // case IModelElement.IMPORT_DECLARATION:
      // case IModelElement.INITIALIZER:
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

            && hasReadOnlyResourcesAndSubResources((IResource) object))
          return true;
      }
      return hasReadOnlyResourcesAndSubResources(pack.getChildren());
    case IModelElement.PROJECT_FRAGMENT:
      IProjectFragment root = (IProjectFragment) modelElement;
      if (root.isArchive())
        return false;
      IResource pfrResource = ReorgUtils.getResource(modelElement);
      if (pfrResource == null)
        return false;
      if (Resources.isReadOnly(pfrResource))
        return true;
      Object[] nonScript1 = root.getForeignResources();
      for (int i = 0; i < nonScript1.length; i++) {
        Object object = nonScript1[i];
        if (object instanceof IResource
            && hasReadOnlyResourcesAndSubResources((IResource) object))
          return true;
      }
      return hasReadOnlyResourcesAndSubResources(root.getChildren());

    case IModelElement.FIELD:
      // case IModelElement.IMPORT_CONTAINER:
      // case IModelElement.IMPORT_DECLARATION:
      // case IModelElement.INITIALIZER:
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

   * a project relative path. The empty path refers to the default package
   * fragment.
   */
  public IScriptFolder getScriptFolder(String projectName,
      String fragmentPath, IPath path) throws ModelException {
    IProjectFragment root = getProjectFragment(projectName, fragmentPath);
    if (root == null) {
      return null;
    }
    return root.getScriptFolder(path);
  }
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

  }

  private IProject getProjectFromSelectedElement(Object firstElement) {
    if (firstElement instanceof IModelElement) {
      IModelElement element = (IModelElement) firstElement;
      IProjectFragment root = ScriptModelUtil.getProjectFragment(element);

      if (root != null && root != element && root.isArchive()) {
        return null;
      }
      IScriptProject project = element.getScriptProject();
      if (project != null) {
        return project.getProject();
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

    IPath path = new Path(fragmentPath);
    if (path.isAbsolute()) {
      IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace()
          .getRoot();
      IResource resource = workspaceRoot.findMember(path);
      IProjectFragment root;
      // resource in the workspace
      root = project.getProjectFragment(resource);
      return root;
    } else {
      IProjectFragment[] roots = project.getProjectFragments();
      if (roots == null || roots.length == 0) {
        return null;
      }
      for (int i = 0; i < roots.length; i++) {
        IProjectFragment root = roots[i];
        if (root.getUnderlyingResource().getProjectRelativePath()
            .equals(path)) {
          return root;
        }
      }
    }
View Full Code Here

Examples of org.eclipse.dltk.core.IProjectFragment

            projFragment.getBuildpathEntry());
      } catch (ModelException e) {
        Logger.logException("Could not remove buildPathEntry", e); //$NON-NLS-1$
      }
    } else if (object instanceof IProjectFragment) {
      IProjectFragment root = (IProjectFragment) object;
    } else {
      assert object instanceof IncludePath;

      IncludePath includePath = (IncludePath) object;
      try {
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.