use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class CodeLensHandlerTest method testEnableImplementationsCodeLensSymbols.
@Test
public void testEnableImplementationsCodeLensSymbols() throws Exception {
Preferences implementationsCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.IMPLEMENTATIONS_CODE_LENS_ENABLED_KEY, "true"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(implementationsCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String payload = createCodeLensSymbolsRequest("src/java/IFoo.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
// when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
// then
assertEquals(2, result.size());
CodeLens lens = result.get(1);
@SuppressWarnings("unchecked") List<Object> data = (List<Object>) lens.getData();
String type = (String) data.get(2);
assertEquals(type, "implementations");
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class SaveActionHandlerTest method setup.
@Override
@Before
public void setup() throws Exception {
importProjects("eclipse/hello");
project = WorkspaceHelper.getProject("hello");
preferenceManager = mock(PreferenceManager.class);
Preferences preferences = mock(Preferences.class);
when(preferences.isJavaSaveActionsOrganizeImportsEnabled()).thenReturn(Boolean.TRUE);
when(preferenceManager.getPreferences()).thenReturn(preferences);
monitor = mock(IProgressMonitor.class);
when(monitor.isCanceled()).thenReturn(false);
handler = new SaveActionHandler(preferenceManager);
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class AbstractProjectsManagerBasedTest method initProjectManager.
@Before
public void initProjectManager() throws CoreException {
clientRequests.clear();
logListener = new SimpleLogListener();
Platform.addLogListener(logListener);
preferences = new Preferences();
if (preferenceManager != null) {
when(preferenceManager.getPreferences()).thenReturn(preferences);
ClientPreferences clientPreferences = mock(ClientPreferences.class);
when(clientPreferences.isProgressReportSupported()).thenReturn(true);
when(preferenceManager.getClientPreferences()).thenReturn(clientPreferences);
}
projectsManager = new ProjectsManager(preferenceManager);
ProgressReporterManager progressManager = new ProgressReporterManager(this.client, preferenceManager);
// disable throttling to ensure we capture all events
progressManager.setReportThrottle(0);
Job.getJobManager().setProgressProvider(progressManager);
monitor = progressManager.getDefaultMonitor();
WorkingCopyOwner.setPrimaryBufferProvider(new WorkingCopyOwner() {
@Override
public IBuffer createBuffer(ICompilationUnit workingCopy) {
ICompilationUnit original = workingCopy.getPrimary();
IResource resource = original.getResource();
if (resource instanceof IFile) {
return new DocumentAdapter(workingCopy, (IFile) resource);
}
return DocumentAdapter.Null;
}
});
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class HoverHandlerTest method setup.
@Before
public void setup() throws Exception {
importProjects("eclipse/hello");
project = WorkspaceHelper.getProject("hello");
IJavaProject javaProject = JavaCore.create(project);
sourceFolder = javaProject.getPackageFragmentRoot(javaProject.getProject().getFolder("src"));
preferenceManager = mock(PreferenceManager.class);
when(preferenceManager.getPreferences()).thenReturn(new Preferences());
handler = new HoverHandler(preferenceManager);
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class InitHandlerTest method testJavaImportExclusions.
@Test
public void testJavaImportExclusions() throws Exception {
Map<String, Object> initializationOptions = createInitializationOptions();
@SuppressWarnings("unchecked") Preferences prefs = Preferences.createFrom((Map<String, Object>) (initializationOptions.get(InitHandler.SETTINGS_KEY)));
assertEquals(TEST_EXCLUSIONS, prefs.getJavaImportExclusions().get(0));
}
Aggregations