Examples of IJavaModelStatus


Examples of org.eclipse.jdt.core.IJavaModelStatus

* </ul>
* @see IJavaModelStatus
* @see JavaConventions
*/
public IJavaModelStatus verify() {
  IJavaModelStatus status = super.verify();
  if (!status.isOK()) {
    return status;
  }
  IJavaProject project = getParentElement().getJavaProject();
  if (JavaConventions.validateImportDeclaration(this.importName, project.getOption(JavaCore.COMPILER_SOURCE, true), project.getOption(JavaCore.COMPILER_COMPLIANCE, true)).getSeverity() == IStatus.ERROR) {
    return new JavaModelStatus(IJavaModelStatusConstants.INVALID_NAME, this.importName);
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

*  <li>INDEX_OUT_OF_BOUNDS - the number of renamings supplied to the operation
*    does not match the number of elements that were supplied.
* </ul>
*/
protected IJavaModelStatus verify() {
  IJavaModelStatus status = super.verify();
  if (!status.isOK()) {
    return status;
  }
  if (this.renamingsList != null && this.renamingsList.length != this.elementsToProcess.length) {
    return new JavaModelStatus(IJavaModelStatusConstants.INDEX_OUT_OF_BOUNDS);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

*  <li>INVALID_CONTENTS - The source is <code>null</code> or has serious syntax errors.
  *  <li>NAME_COLLISION - A name collision occurred in the destination
* </ul>
*/
public IJavaModelStatus verify() {
  IJavaModelStatus status = super.verify();
  if (!status.isOK()) {
    return status;
  }
  if (this.source == null) {
    return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

    // ensure that no specific output is coincidating with another source folder (only allowed if matching current source folder)
    // 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate)
    // perform one separate iteration so as to not take precedence over previously checked scenarii (in particular should
    // diagnose nesting source folder issue before this one, for example, [src]"Project/", [src]"Project/source/" and output="Project/" should
    // first complain about missing exclusion pattern
    IJavaModelStatus cachedStatus = null;
    for (int i = 0 ; i < length; i++) {
      IClasspathEntry entry = classpath[i];
      if (entry == null) continue;
      IPath entryPath = entry.getPath();
      int kind = entry.getEntryKind();
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

   */
  public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean referredByContainer){
    if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
      JavaModelManager.getJavaModelManager().removeFromInvalidArchiveCache(entry.getPath());
    }
    IJavaModelStatus status = validateClasspathEntry(project, entry, null, checkSourceAttachment, referredByContainer);
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171136 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136
    // Ignore class path errors from optional entries.
    int statusCode = status.getCode();
    if ( (statusCode == IJavaModelStatusConstants.INVALID_CLASSPATH ||
        statusCode == IJavaModelStatusConstants.CP_CONTAINER_PATH_UNBOUND ||
        statusCode == IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND ||
        statusCode == IJavaModelStatusConstants.INVALID_PATH) &&
        ((ClasspathEntry) entry).isOptional())
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

      // container entry check
      case IClasspathEntry.CPE_CONTAINER :
        if (path.segmentCount() >= 1){
          try {
            IJavaModelStatus status = null;
            // Validate extra attributes
            IClasspathAttribute[] extraAttributes = entry.getExtraAttributes();
            if (extraAttributes != null) {
              int length = extraAttributes.length;
              HashSet set = new HashSet(length);
              for (int i=0; i<length; i++) {
                String attName = extraAttributes[i].getName();
                if (!set.add(attName)) {
                  status = new JavaModelStatus(IJavaModelStatusConstants.NAME_COLLISION, Messages.bind(Messages.classpath_duplicateEntryExtraAttribute, new String[] {attName, entryPathMsg, projectName}));
                  break;
                }
              }
            }
            IClasspathContainer container = JavaModelManager.getJavaModelManager().getClasspathContainer(path, project);
            // container retrieval is performing validation check on container entry kinds.
            if (container == null) {
              if (status != null)
                return status;
              return new JavaModelStatus(IJavaModelStatusConstants.CP_CONTAINER_PATH_UNBOUND, project, path);
            } else if (container == JavaModelManager.CONTAINER_INITIALIZATION_IN_PROGRESS) {
              // don't create a marker if initialization is in progress (case of cp initialization batching)
              return JavaModelStatus.VERIFIED_OK;
            }
            IClasspathEntry[] containerEntries = container.getClasspathEntries();
            if (containerEntries != null){
              for (int i = 0, length = containerEntries.length; i < length; i++){
                IClasspathEntry containerEntry = containerEntries[i];
                int kind = containerEntry == null ? 0 : containerEntry.getEntryKind();
                if (containerEntry == null
                  || kind == IClasspathEntry.CPE_SOURCE
                  || kind == IClasspathEntry.CPE_VARIABLE
                  || kind == IClasspathEntry.CPE_CONTAINER){
                    return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CP_CONTAINER_ENTRY, project, path);
                }
                IJavaModelStatus containerEntryStatus = validateClasspathEntry(project, containerEntry, container, checkSourceAttachment, true/*referred by container*/);
                if (!containerEntryStatus.isOK()){
                  return containerEntryStatus;
                }
              }
            }
          } catch(JavaModelException e){
            return new JavaModelStatus(e);
          }
        } else {
          return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalContainerPath, new String[] {entryPathMsg, projectName}));
        }
        break;

      // variable entry check
      case IClasspathEntry.CPE_VARIABLE :
        if (path.segmentCount() >= 1){
          try {
            entry = JavaCore.getResolvedClasspathEntry(entry);
          } catch (AssertionFailedException e) {
            // Catch the assertion failure and throw java model exception instead
            // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992
            return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, e.getMessage());
          }
          if (entry == null){
            return new JavaModelStatus(IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, project, path);
          }

          // get validation status
          IJavaModelStatus status = validateClasspathEntry(project, entry, null, checkSourceAttachment, false/*not referred by container*/);
          if (!status.isOK()) return status;

          // return deprecation status if any
          String variableName = path.segment(0);
          String deprecatedMessage = JavaCore.getClasspathVariableDeprecationMessage(variableName);
          if (deprecatedMessage != null) {
            return new JavaModelStatus(IStatus.WARNING, IJavaModelStatusConstants.DEPRECATED_VARIABLE, project, path, deprecatedMessage);
          }
          return status;
        } else {
          return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalVariablePath, new String[] {entryPathMsg, projectName}));
        }

      // library entry check
      case IClasspathEntry.CPE_LIBRARY :
        path = ClasspathEntry.resolveDotDot(project.getProject().getLocation(), path);
       
        // do not validate entries from Class-Path: in manifest
        // (these entries are considered optional since the user cannot act on them)
        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=252392
       
        String containerInfo = null;
        if (entryContainer != null) {
          if (entryContainer instanceof UserLibraryClasspathContainer) {
            containerInfo = Messages.bind(Messages.classpath_userLibraryInfo, new String[] {entryContainer.getDescription()});
          } else {
            containerInfo = Messages.bind(Messages.classpath_containerInfo, new String[] {entryContainer.getDescription()});
          }
        }
        IJavaModelStatus status = validateLibraryEntry(path, project, containerInfo, checkSourceAttachment ? entry.getSourceAttachmentPath() : null, entryPathMsg);
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=171136, ignore class path errors from optional entries
        if (status.getCode() == IJavaModelStatusConstants.INVALID_CLASSPATH && ((ClasspathEntry) entry).isOptional())
          status = JavaModelStatus.VERIFIED_OK;
        if (!status.isOK())
          return status;
        break;

      // project entry check
      case IClasspathEntry.CPE_PROJECT :
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

                return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toString(), project.getElementName()}));
              }
            }
            // https://bugs.eclipse.org/bugs/show_bug.cgi?id=229042
            // Validate the contents of the archive
            IJavaModelStatus status = validateLibraryContents(path, project, entryPathMsg);
            if (status != JavaModelStatus.VERIFIED_OK)
              return status;
            break;
          case IResource.FOLDER :  // internal binary folder
            if (sourceAttachment != null
              && !sourceAttachment.isEmpty()
              && JavaModel.getTarget(sourceAttachment, true) == null){
              if (container != null) {
                return  new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachmentInContainedLibrary, new String [] {sourceAttachment.toString(), path.toString(), container}));
              } else {
                return  new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toString(), project.getElementName()}));
              }
            }
        }
      } else if (target instanceof File){
        File file = JavaModel.getFile(target);
        if (file == null) {
          if (container != null) {
            return  new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalExternalFolderInContainer, new String[] {path.toOSString(), container}));
          } else {
            return  new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalExternalFolder, new String[] {path.toOSString(), project.getElementName()}));
          }
        } else {
          if (sourceAttachment != null
              && !sourceAttachment.isEmpty()
              && JavaModel.getTarget(sourceAttachment, true) == null){
            if (container != null) {
              return  new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachmentInContainedLibrary, new String [] {sourceAttachment.toString(), path.toOSString(), container}));
            } else {
              return  new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toOSString(), project.getElementName()}));
            }
          }
          // https://bugs.eclipse.org/bugs/show_bug.cgi?id=229042
          // Validate the contents of the archive
          if(file.isFile()) {
            IJavaModelStatus status = validateLibraryContents(path, project, entryPathMsg);
            if (status != JavaModelStatus.VERIFIED_OK)
              return status;
          }
        }
      } else {
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

    // Note: creating local/anonymous type is not supported
  }
  return JavaModelStatus.VERIFIED_OK;
}
public IJavaModelStatus verify() {
  IJavaModelStatus status = super.verify();
  if (!status.isOK())
    return status;
  try {
    IJavaElement parent = getParentElement();
    if (this.anchorElement != null && this.anchorElement.getElementType() == IJavaElement.FIELD
        && parent.getElementType() == IJavaElement.TYPE && ((IType)parent).isEnum())
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

    buffer.append(this.newOutputLocation.toString());
    return buffer.toString();
  }

  public IJavaModelStatus verify() {
    IJavaModelStatus status = super.verify();
    if (!status.isOK())
      return status;
    this.project.flushClasspathProblemMarkers(false, false, true);
    return ClasspathEntry.validateClasspath(this.project, this.newRawClasspath, this.newOutputLocation);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaModelStatus

*  <li>INVALID_CONTENTS - The source is <code>null</code> or has serious syntax errors.
  *  <li>NAME_COLLISION - A name collision occurred in the destination
* </ul>
*/
public IJavaModelStatus verify() {
  IJavaModelStatus status = super.verify();
  if (!status.isOK()) {
    return status;
  }
  if (this.source == null) {
    return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS);
  }
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.