Skip to content

Commit

Permalink
eclipse-jdtlsGH-508: Switched from JavaPlugin to `JavaLanguageServe…
Browse files Browse the repository at this point in the history
…rPlugin`.

Also, reused the `StringMatcher` from the CA instead of `jdt.ui.util`.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
  • Loading branch information
Akos Kitta authored and testforstephen committed Dec 12, 2019
1 parent 82134ea commit c2fbe65
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import org.eclipse.jdt.internal.corext.dom.IASTSharedValues;
import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.jdt.ls.core.internal.contentassist.StringMatcher;
import org.eclipse.jface.preference.IPreferenceStore;

public class CallHierarchy {
Expand Down Expand Up @@ -124,7 +126,7 @@ private MethodWrapper[] getRoots(IMember[] members, boolean callers) {
addRoot(member, roots, callers);
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.log(e);
}
} else {
addRoot(member, roots, callers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IOpenable;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;

Expand Down Expand Up @@ -93,7 +93,7 @@ private void initCallTextAndLineNumber() {
try {
fLineNumber= document.getLineOfOffset(fStart) + 1;
} catch (BadLocationException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.logException(e);
}
}
}
Expand All @@ -112,7 +112,7 @@ private IBuffer getBufferForMember() {
buffer = openable.getBuffer();
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.log(e);
}
return buffer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.eclipse.jdt.internal.corext.dom.Bindings;
import org.eclipse.jdt.internal.corext.dom.HierarchicalASTVisitor;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;

class CalleeAnalyzerVisitor extends HierarchicalASTVisitor {
private final CallSearchResultCollector fSearchResults;
Expand All @@ -62,7 +62,7 @@ class CalleeAnalyzerVisitor extends HierarchicalASTVisitor {
this.fMethodStartPosition = sourceRange.getOffset();
this.fMethodEndPosition = fMethodStartPosition + sourceRange.getLength();
} catch (JavaModelException jme) {
JavaPlugin.log(jme);
JavaLanguageServerPlugin.log(jme);
}
}

Expand Down Expand Up @@ -268,7 +268,7 @@ protected void addMethodCall(IMethodBinding calledMethodBinding, ASTNode node) {
fSearchResults.addMember(fMember, referencedMember, position, position + node.getLength(), number < 1 ? 1 : number);
}
} catch (JavaModelException jme) {
JavaPlugin.log(jme);
JavaLanguageServerPlugin.log(jme);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
import org.eclipse.jdt.internal.corext.util.SearchUtils;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;

public class CallerMethodWrapper extends MethodWrapper {
/**
Expand Down Expand Up @@ -153,7 +153,7 @@ protected Map<String, MethodCall> findChildren(IProgressMonitor progressMonitor)
return searchRequestor.getCallers();

} catch (CoreException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.log(e);
return new HashMap<>(0);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;

/**
* The main plugin class to be used in the desktop.
Expand Down Expand Up @@ -73,7 +73,7 @@ public IJavaElement[] searchForImplementors(IJavaElement[] elements,
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.log(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;

public class JavaImplementorFinder implements IImplementorFinder {
@Override
Expand All @@ -34,7 +34,7 @@ public Collection<IType> findImplementingTypes(IType type, IProgressMonitor prog

return result;
} catch (JavaModelException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.log(e);
}

return null;
Expand All @@ -52,7 +52,7 @@ public Collection<IType> findInterfaces(IType type, IProgressMonitor progressMon

return result;
} catch (JavaModelException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.log(e);
}

return null;
Expand Down

0 comments on commit c2fbe65

Please sign in to comment.