Example usage for org.eclipse.jdt.internal.core JavaModelStatus JavaModelStatus

List of usage examples for org.eclipse.jdt.internal.core JavaModelStatus JavaModelStatus

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core JavaModelStatus JavaModelStatus.

Prototype

public JavaModelStatus(int code, IJavaElement element) 

Source Link

Document

Constructs an Java model status with the given corresponding element.

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryMember.java

License:Open Source License

public void copy(IJavaElement container, IJavaElement sibling, String rename, boolean force,
        IProgressMonitor monitor) throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryMember.java

License:Open Source License

public void move(IJavaElement container, IJavaElement sibling, String rename, boolean force,
        IProgressMonitor monitor) throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryMember.java

License:Open Source License

public void rename(String newName, boolean force, IProgressMonitor monitor) throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryMember.java

License:Open Source License

public void setContents(String contents, IProgressMonitor monitor) throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryType.java

License:Open Source License

public IField createField(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
        throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryType.java

License:Open Source License

public IInitializer createInitializer(String contents, IJavaElement sibling, IProgressMonitor monitor)
        throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryType.java

License:Open Source License

public IMethod createMethod(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
        throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.BinaryType.java

License:Open Source License

public IType createType(String contents, IJavaElement sibling, boolean force, IProgressMonitor monitor)
        throws JavaModelException {
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.READ_ONLY, this));
}

From source file:com.codenvy.ide.ext.java.server.internal.core.ClassFile.java

License:Open Source License

public byte[] getBytes() throws JavaModelException {
    JavaElement pkg = (JavaElement) getParent();
    if (pkg instanceof JarPackageFragment) {
        JarPackageFragmentRoot root = (JarPackageFragmentRoot) pkg.getParent();
        ZipFile zip = null;/*from   w w w . j av a  2s.co  m*/
        try {
            zip = root.getJar();
            String entryName = Util.concatWith(((PackageFragment) pkg).names, getElementName(), '/');
            ZipEntry ze = zip.getEntry(entryName);
            if (ze != null) {
                return org.eclipse.jdt.internal.compiler.util.Util.getZipEntryByteContent(ze, zip);
            }
            throw new JavaModelException(
                    new JavaModelStatus(IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST, this));
        } catch (IOException ioe) {
            throw new JavaModelException(ioe, IJavaModelStatusConstants.IO_EXCEPTION);
        } catch (CoreException e) {
            if (e instanceof JavaModelException) {
                throw (JavaModelException) e;
            } else {
                throw new JavaModelException(e);
            }
        } finally {
            manager.closeZipFile(zip);
        }
    } else {
        IFile file = (IFile) resource();
        return Util.getResourceContentsAsByteArray(file);
    }
}

From source file:com.codenvy.ide.ext.java.server.internal.core.ClassFile.java

License:Open Source License

private IStatus validateClassFile() {
    IPackageFragmentRoot root = getPackageFragmentRoot();
    try {//from  w  ww .  ja v  a 2  s  .c  o  m
        if (root.getKind() != IPackageFragmentRoot.K_BINARY)
            return new JavaModelStatus(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, root);
    } catch (JavaModelException e) {
        return e.getJavaModelStatus();
    }
    IJavaProject project = getJavaProject();
    if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(getElementName())) {
        return Status.OK_STATUS;
    }
    return Status.CANCEL_STATUS;
    //   return JavaConventions.validateClassFileName(getElementName(), project.getOption(JavaCore.COMPILER_SOURCE, true),
    //                                     project.getOption(JavaCore.COMPILER_COMPLIANCE, true));
}