Example usage for org.eclipse.jdt.core JavaModelException JavaModelException

List of usage examples for org.eclipse.jdt.core JavaModelException JavaModelException

Introduction

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

Prototype

public JavaModelException(IStatus status) 

Source Link

Document

Creates a Java model exception for the given status object.

Usage

From source file:com.codenvy.ide.ext.java.server.core.search.SearchEngine.java

License:Open Source License

/**
 * Searches for the Java element determined by the given signature. The signature
 * can be incomplete. For example, a call like
 * <code>search(ws, "run()", METHOD,REFERENCES, col)</code>
 * searches for all references to the method <code>run</code>.
 *
 * Note that by default the pattern will be case insensitive. For specifying case s
 * sensitive search, use <code>search(workspace, createSearchPattern(patternString, searchFor, limitTo, true), scope, resultCollector);</code>
 *
 * @param workspace the workspace/* w w  w. jav  a2s.co  m*/
 * @param patternString the pattern to be searched for
 * @param searchFor a hint what kind of Java element the string pattern represents.
 *  Look into {@link IJavaSearchConstants} for valid values
 * @param limitTo one of the following values:
 *   <ul>
 *     <li>{@link IJavaSearchConstants#DECLARATIONS}: search
 *        for declarations only </li>
 *     <li>{@link IJavaSearchConstants#REFERENCES}: search
 *        for all references </li>
 *     <li>{@link IJavaSearchConstants#ALL_OCCURRENCES}: search
 *        for both declarations and all references </li>
 *     <li>{@link IJavaSearchConstants#IMPLEMENTORS}: for types, will find all types
 *         which directly implement/extend a given interface.<br>
 *         Note that types may be only classes or only interfaces if respectively {@link IJavaSearchConstants#CLASS} or
 *         {@link IJavaSearchConstants#INTERFACE} is used for searchFor parameter instead of {@link IJavaSearchConstants#TYPE}.
 *     </li>
 * </ul>
 * @param scope the search result has to be limited to the given scope
 * @param resultCollector a callback object to which each match is reported
 * @exception org.eclipse.jdt.core.JavaModelException if the search failed. Reasons include:
 *   <ul>
 *      <li>the classpath is incorrectly set</li>
 *   </ul>
 * @deprecated Use {@link  #search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, org.eclipse.core.runtime.IProgressMonitor)} instead.
 */
public void search(IWorkspace workspace, String patternString, int searchFor, int limitTo,
        IJavaSearchScope scope, IJavaSearchResultCollector resultCollector) throws JavaModelException {
    try {
        int matchMode = patternString.indexOf('*') != -1 || patternString.indexOf('?') != -1
                ? SearchPattern.R_PATTERN_MATCH
                : SearchPattern.R_EXACT_MATCH;
        search(SearchPattern.createPattern(patternString, searchFor, limitTo,
                matchMode | SearchPattern.R_CASE_SENSITIVE),
                new SearchParticipant[] { getDefaultSearchParticipant(indexManager) }, scope,
                new ResultCollectorAdapter(resultCollector), resultCollector.getProgressMonitor());
    } catch (CoreException e) {
        if (e instanceof JavaModelException)
            throw (JavaModelException) e;
        throw new JavaModelException(e);
    }
}

From source file:com.codenvy.ide.ext.java.server.core.search.SearchEngine.java

License:Open Source License

/**
 * Searches for matches of a given search pattern. Search patterns can be created using helper
 * methods (from a String pattern or a Java element) and encapsulate the description of what is
 * being searched (for example, search method declarations in a case sensitive way).
 *
 * @param workspace the workspace//from   w w  w . j  a  v  a  2s .c  o  m
 * @param searchPattern the pattern to be searched for
 * @param scope the search result has to be limited to the given scope
 * @param resultCollector a callback object to which each match is reported
 * @exception org.eclipse.jdt.core.JavaModelException if the search failed. Reasons include:
 *   <ul>
 *      <li>the classpath is incorrectly set</li>
 *   </ul>
 * @deprecated Use {@link  #search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, org.eclipse.core.runtime.IProgressMonitor)} instead.
 */
public void search(IWorkspace workspace, ISearchPattern searchPattern, IJavaSearchScope scope,
        IJavaSearchResultCollector resultCollector) throws JavaModelException {
    try {
        search(((SearchPatternAdapter) searchPattern).pattern,
                new SearchParticipant[] { getDefaultSearchParticipant(indexManager) }, scope,
                new ResultCollectorAdapter(resultCollector), resultCollector.getProgressMonitor());
    } catch (CoreException e) {
        if (e instanceof JavaModelException)
            throw (JavaModelException) e;
        throw new JavaModelException(e);
    }
}

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));
}