Search in sources :

Example 6 with UnhandledException

use of org.autorefactor.util.UnhandledException in project AutoRefactor by JnRouvignac.

the class SourceCode method computeLines.

private void computeLines() {
    try {
        final String lineSeparator = this.compilationUnit.findRecommendedLineSeparator();
        int fromIndex = 0;
        Matcher matcher = Pattern.compile(".*?" + lineSeparator).matcher(this.text);
        while (fromIndex < this.text.length() && matcher.find(fromIndex)) {
            String lineText = matcher.group();
            int offset = this.text.indexOf(lineText, fromIndex);
            int length = lineText.length();
            this.lines.add(new Line(lineText, offset, length, this));
            fromIndex += offset + length;
        }
    } catch (JavaModelException e) {
        throw new UnhandledException(astRoot, e);
    }
}
Also used : UnhandledException(org.autorefactor.util.UnhandledException) JavaModelException(org.eclipse.jdt.core.JavaModelException) Matcher(java.util.regex.Matcher)

Aggregations

UnhandledException (org.autorefactor.util.UnhandledException)6 OnEclipseVersionUpgrade (org.autorefactor.util.OnEclipseVersionUpgrade)2 SubMonitor (org.eclipse.core.runtime.SubMonitor)2 JavaModelException (org.eclipse.jdt.core.JavaModelException)2 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 ExecutionException (java.util.concurrent.ExecutionException)1 FutureTask (java.util.concurrent.FutureTask)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Matcher (java.util.regex.Matcher)1 AggregateASTVisitor (org.autorefactor.refactoring.rules.AggregateASTVisitor)1 IllegalStateException (org.autorefactor.util.IllegalStateException)1 NotImplementedException (org.autorefactor.util.NotImplementedException)1 CoreException (org.eclipse.core.runtime.CoreException)1 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)1 IJavaElement (org.eclipse.jdt.core.IJavaElement)1 IPackageBinding (org.eclipse.jdt.core.dom.IPackageBinding)1 SearchEngine (org.eclipse.jdt.core.search.SearchEngine)1