Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.JavaModelException


   * @param group
   * @return the edit or null if no sorting is required
   */
  public TextEdit calculateEdit(org.eclipse.jdt.core.dom.CompilationUnit unit, TextEditGroup group) throws JavaModelException {
    if (this.elementsToProcess.length != 1)
      throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.NO_ELEMENTS_TO_PROCESS));

    if (!(this.elementsToProcess[0] instanceof ICompilationUnit))
      throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this.elementsToProcess[0]));

    try {
      beginTask(Messages.operation_sortelements, getMainAmountOfWork());

      ICompilationUnit cu= (ICompilationUnit)this.elementsToProcess[0];
View Full Code Here


        computeTypeRange();
      }
    }
   
    if (this.typeDocRange != null) {
      if (this.typeDocRange == UNKNOWN_FORMAT) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, this.type));
      return String.valueOf(CharOperation.subarray(this.content, this.typeDocRange[0], this.typeDocRange[1]));
    }
    return null;
  }
View Full Code Here

        this.fieldDocRanges.put(child, range);
      }
    }
   
    if (range != null) {
      if (range == UNKNOWN_FORMAT) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, child));
      return String.valueOf(CharOperation.subarray(this.content, range[0], range[1]));
    }
    return null;
  }
View Full Code Here

      }
    }
   
    if (range != null) {
      if (range == UNKNOWN_FORMAT) {
        throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, child));
      }
      return String.valueOf(CharOperation.subarray(this.content, range[0], range[1]));
    }
    return null;
  }
View Full Code Here

    char[] genericSignature = info.getGenericSignature();
    String anchor = null;
    if (genericSignature != null) {
      genericSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.');
      anchor = Util.toAnchor(0, genericSignature, methodName, Flags.isVarargs(method.getFlags()));
      if (anchor == null) throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, method));
    } else {
      anchor = Signature.toString(method.getSignature().replace('/', '.'), methodName, null, true, false, Flags.isVarargs(method.getFlags()));
    }
    IType declaringType = this.type;
    if (declaringType.isMember()) {
View Full Code Here

      Object folderPath = iterator.next();
      if (oldFolders == null || !oldFolders.remove(folderPath) || foldersManager.removePendingFolder(folderPath)) {
        try {
          foldersManager.createLinkFolder((IPath) folderPath, refreshIfExistAlready, monitor);
        } catch (CoreException e) {
          throw new JavaModelException(e);
        }
      }
    }
    // removal of linked folders is done during save
  }
View Full Code Here

              stream,
              this.force,
              this.progressMonitor);
          }
        } catch (CoreException e) {
          throw new JavaModelException(e);
        } catch (UnsupportedEncodingException e) {
          throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
        }

      }

      setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
View Full Code Here

          }
        }
      }
    }
  } catch (CoreException e) {
    throw new JavaModelException(e);
  }

  if (kind == IPackageFragmentRoot.K_SOURCE) {
    // add primary compilation units
    ICompilationUnit[] primaryCompilationUnits = getCompilationUnits(DefaultWorkingCopyOwner.PRIMARY);
View Full Code Here

            delta.changed(this.resultElements[i], IJavaElementDelta.F_CONTENT);
          }
          addDelta(delta);
        }
      } else {
        throw new JavaModelException(new JavaModelStatus(
          IJavaModelStatusConstants.NAME_COLLISION,
          Messages.bind(Messages.status_nameCollision, compilationUnitFile.getFullPath().toString())));
      }
    } else {
      try {
        String encoding = null;
        try {
          encoding = folder.getDefaultCharset(); // get folder encoding as file is not accessible
        }
        catch (CoreException ce) {
          // use no encoding
        }
        InputStream stream = new ByteArrayInputStream(encoding == null ? this.source.getBytes() : this.source.getBytes(encoding));
        createFile(folder, unit.getElementName(), stream, this.force);
        this.resultElements = new IJavaElement[] {unit};
        if (!Util.isExcluded(unit)
            && unit.getParent().exists()) {
          for (int i = 0; i < this.resultElements.length; i++) {
            delta.added(this.resultElements[i]);
          }
          addDelta(delta);
        }
      } catch (IOException e) {
        throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION);
      }
    }
    worked(1);
  } finally {
    done();
View Full Code Here

  super((PackageFragment) classFile.getParent(), ((BinaryType) classFile.getType()).getSourceFileName(null/*no info available*/), owner);
  this.classFile = classFile;
}

public void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException {
  throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, this));
}
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.JavaModelException

Copyright © 2018 www.massapicom. 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.