Skip to content

Commit

Permalink
eclipse-jdtlsGH-508: Got rid of the Eclipse workbench dependencies.
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
Akos Kitta authored and testforstephen committed Dec 18, 2019
1 parent 066f626 commit bc83f44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
import org.eclipse.jdt.core.search.SearchEngine;
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 {
private static final String PREF_USE_IMPLEMENTORS= "PREF_USE_IMPLEMENTORS"; //$NON-NLS-1$
Expand All @@ -58,15 +56,7 @@ public static CallHierarchy getDefault() {
}

public boolean isSearchUsingImplementorsEnabled() {
IPreferenceStore settings = JavaPlugin.getDefault().getPreferenceStore();

return settings.getBoolean(PREF_USE_IMPLEMENTORS);
}

public void setSearchUsingImplementorsEnabled(boolean enabled) {
IPreferenceStore settings = JavaPlugin.getDefault().getPreferenceStore();

settings.setValue(PREF_USE_IMPLEMENTORS, enabled);
return true;
}

public Collection<IJavaElement> getImplementingMethods(IMethod method) {
Expand Down Expand Up @@ -196,55 +186,14 @@ public boolean isIgnored(String fullyQualifiedName) {
return false;
}

public boolean isFilterEnabled() {
IPreferenceStore settings = JavaPlugin.getDefault().getPreferenceStore();
return settings.getBoolean(PREF_USE_FILTERS);
}

public void setFilterEnabled(boolean filterEnabled) {
IPreferenceStore settings = JavaPlugin.getDefault().getPreferenceStore();
settings.setValue(PREF_USE_FILTERS, filterEnabled);
}

/**
* Returns the current filters as a string.
* @return returns the filters
*/
public String getFilters() {
IPreferenceStore settings = JavaPlugin.getDefault().getPreferenceStore();

return settings.getString(PREF_FILTERS_LIST);
}

public void setFilters(String filters) {
fFilters = null;

IPreferenceStore settings = JavaPlugin.getDefault().getPreferenceStore();
settings.setValue(PREF_FILTERS_LIST, filters);
}

/**
* Returns filters for packages which should not be included in the search results.
*
* @return StringMatcher[]
*/
private StringMatcher[] getIgnoreFilters() {
if (fFilters == null) {
String filterString = null;

if (isFilterEnabled()) {
filterString = getFilters();

if (filterString == null) {
filterString = DEFAULT_IGNORE_FILTERS;
}
}

if (filterString != null) {
fFilters = parseList(filterString);
} else {
fFilters = null;
}
fFilters = parseList(DEFAULT_IGNORE_FILTERS);
}

return fFilters;
Expand Down Expand Up @@ -290,7 +239,7 @@ static CompilationUnit getCompilationUnitNode(IMember member, boolean resolveBin
return (CompilationUnit) parser.createAST(null);
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
JavaLanguageServerPlugin.logException(e);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.internal.ui.callhierarchy.MethodWrapperWorkbenchAdapter;
import org.eclipse.ui.model.IWorkbenchAdapter;

/**
* This class represents the general parts of a method call (either to or from a
Expand Down Expand Up @@ -70,8 +68,6 @@ public MethodWrapper(MethodWrapper parent, MethodCall methodCall) {
public <T> T getAdapter(Class<T> adapter) {
if (adapter == IJavaElement.class) {
return (T) getMember();
} else if (adapter == IWorkbenchAdapter.class){
return (T) new MethodWrapperWorkbenchAdapter(this);
} else {
return null;
}
Expand Down Expand Up @@ -146,11 +142,6 @@ public boolean equals(Object oth) {
return false;
}

if (oth instanceof MethodWrapperWorkbenchAdapter) {
//Note: A MethodWrapper is equal to a referring MethodWrapperWorkbenchAdapter and vice versa (bug 101677).
oth= ((MethodWrapperWorkbenchAdapter) oth).getMethodWrapper();
}

if (oth.getClass() != getClass()) {
return false;
}
Expand Down

0 comments on commit bc83f44

Please sign in to comment.