Examples of IPackageFragmentRoot


Examples of org.aspectj.org.eclipse.jdt.core.IPackageFragmentRoot

  // Optimization: cache package fragment root handle and package handles
  if (this.lastPkgFragmentRootPath == null
      || this.lastPkgFragmentRootPath.length() > resourcePath.length()
      || !resourcePath.startsWith(this.lastPkgFragmentRootPath)) {
    String jarPath= resourcePath.substring(0, separatorIndex);
    IPackageFragmentRoot root= ((JavaSearchScope)this.scope).packageFragmentRoot(resourcePath);
    if (root == null) return null;
    this.lastPkgFragmentRootPath= jarPath;
    this.lastPkgFragmentRoot= root;
    this.packageHandles= new HashtableOfArrayToObject(5);
  }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IPackageFragmentRoot

  int rootPathLength = -1;
  if (this.lastPkgFragmentRootPath == null
    || !(resourcePath.startsWith(this.lastPkgFragmentRootPath)
      && (rootPathLength = this.lastPkgFragmentRootPath.length()) > 0
      && resourcePath.charAt(rootPathLength) == '/')) {
    IPackageFragmentRoot root = ((JavaSearchScope)this.scope).packageFragmentRoot(resourcePath);
    if (root == null) return null;
    this.lastPkgFragmentRoot = root;
    this.lastPkgFragmentRootPath = this.lastPkgFragmentRoot.getPath().toString();
    this.packageHandles = new HashtableOfArrayToObject(5);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

        IJavaProject project = javaProjects[i];
        traceBuffer.append("  -> Compute SourceContainers for " + project.getProject().getName() + " :\n");

        IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
        for (int ri = 0; ri < roots.length; ri++) {
          IPackageFragmentRoot root = roots[ri];         
          if (root.isExternal()) {
            IPath location = root.getPath();
            if (external.contains(location)) {
              continue;
            }
            external.add(location);
          }
          sourceContainers.add(new PackageFragmentRootSourceContainer(root));
          traceBuffer.append("     RootSourceContainer created for : " + root.getPath().toPortableString() + "\n");
        }
      }     
    }
   
    // Last add DefaultSourceContainer, classes in jar files added to classpath will be visible
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

      }
    } else {
      status.setWarning("The use of the default package is discouraged.");
    }

    IPackageFragmentRoot root = getPackageFragmentRoot();
    if (root != null) {
      if (root.getJavaProject().exists() && packName.length() > 0) {
        try {
          IPath rootPath = root.getPath();
          IPath outputPath = root.getJavaProject().getOutputLocation();
          if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
            // if the bin folder is inside of our root, don't allow
            // to name a package
            // like the bin folder
            IPath packagePath = rootPath.append(packName.replace('.', '/'));
            if (outputPath.isPrefixOf(packagePath)) {
              status.setError("Package clashes with project output folder.");
              return status;
            }
          }
        } catch (JavaModelException e) {
          JavaPlugin.log(e);
          // let pass
        }
      }

      fPackageFragment = root.getPackageFragment(packName);
    } else {
      status.setError(""); //$NON-NLS-1$
    }
    return status;
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

  /**
   * @return Package selected by the user in a separate dialog
   */
  protected IPackageFragment choosePackage() {
    IPackageFragmentRoot froot = getPackageFragmentRoot();
    IJavaElement[] packages = null;
    try {
      if (froot != null && froot.exists()) {
        packages = froot.getChildren();
      }
    } catch (JavaModelException e) {
      JavaPlugin.log(e);
    }
    if (packages == null) {
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

    monitor.beginTask("Creating aspect...", 10);

    ICompilationUnit createdWorkingCopy = null;
    try {
      // Step 1: Process package fragment.
      IPackageFragmentRoot root = getPackageFragmentRoot();
      IPackageFragment pack = getPackageFragment();
      if (pack == null) {
        pack = root.getPackageFragment(""); //$NON-NLS-1$
      }
      if (!pack.exists()) {
        String packName = pack.getElementName();
        pack = root.createPackageFragment(packName, true, null);
      }
      monitor.worked(1);

      // Step 2: Create aspect if not already existent.
      boolean needsCommit = false;
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

        LayoutUtil.setWidthHint(text, convertWidthInCharsToPixels(40));
    }

    protected IStatus updateTargetClass() {
        StatusInfo status = new StatusInfo();
        IPackageFragmentRoot root = getMainPage().getPackageFragmentRoot();
        fTargetClassDialogField.enableButton(root != null);

        fTargetClass = null;

        String targetClassName = getTargetClassName();
        if (targetClassName.length() == 0) {
            // accept the empty field (stands for java.lang.Object)
            return status;
        }
        IStatus val = JavaConventions.validateJavaTypeName(targetClassName);
        if (val.getSeverity() == IStatus.ERROR) {
            status.setError("Target class name is not valid.");
            return status;
        }
        if (root != null) {
            try {
                IType type = resolveClassName(root.getJavaProject(), targetClassName);
                if (type == null) {
                    status.setWarning("Target class does not exist in current project.");
                    return status;
                }
                fTargetClass = type;
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

        }
        return status;
    }

    protected IType chooseTargetClass() {
        IPackageFragmentRoot root = getMainPage().getPackageFragmentRoot();
        if (root == null) { return null; }

        IJavaElement[] elements = new IJavaElement[] { root.getJavaProject() };
        IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);

        SelectionDialog dialog;
    try {
      dialog = JavaUI.createTypeDialog(
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

        source.append(" target");
    }

    protected IStatus updateTargetException() {
        StatusInfo status = new StatusInfo();
        IPackageFragmentRoot root = getMainPage().getPackageFragmentRoot();
        fTargetExceptionDialogField.enableButton(root != null);

        fTargetException = null;

        String targetClassName = getTargetExceptionName();
        if (targetClassName.length() == 0) {
            // accept the empty field (stands for java.lang.Object)
            return status;
        }
        IStatus val = JavaConventions.validateJavaTypeName(targetClassName);
        if (val.getSeverity() == IStatus.ERROR) {
            status.setError("Target exception name is not valid.");
            return status;
        }
        if (root != null) {
            try {
                IType type = resolveClassName(root.getJavaProject(), targetClassName);
                if (type == null) {
                    status.setWarning("Target exception does not exist in current project.");
                    return status;
                }
                // TODO Check if exception is subclass of Throwable
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

        return status;

    }

    protected IType chooseTargetException() {
        IPackageFragmentRoot root = getMainPage().getPackageFragmentRoot();
        if (root == null) {
            return null;
        }

        IJavaElement[] elements = new IJavaElement[] { root.getJavaProject()};
        IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
        // TODO Filter for subclasses of Throwable
       
        SelectionDialog dialog;
    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.