Search in sources :

Example 6 with PreferenceManager

use of org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager in project eclipse.jdt.ls by eclipse.

the class CodeLensHandlerTest method setup.

@Before
public void setup() throws Exception {
    importProjects("eclipse/hello");
    project = WorkspaceHelper.getProject("hello");
    preferenceManager = mock(PreferenceManager.class);
    when(preferenceManager.getPreferences()).thenReturn(new Preferences());
    handler = new CodeLensHandler(preferenceManager);
}
Also used : Preferences(org.eclipse.jdt.ls.core.internal.preferences.Preferences) PreferenceManager(org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager) Before(org.junit.Before)

Example 7 with PreferenceManager

use of org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager in project eclipse.jdt.ls by eclipse.

the class ReferencesHandlerTest method setup.

@Before
public void setup() throws Exception {
    importProjects("eclipse/hello");
    project = WorkspaceHelper.getProject("hello");
    preferenceManager = mock(PreferenceManager.class);
    when(preferenceManager.getPreferences()).thenReturn(new Preferences());
    handler = new ReferencesHandler(preferenceManager);
}
Also used : Preferences(org.eclipse.jdt.ls.core.internal.preferences.Preferences) PreferenceManager(org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager) Before(org.junit.Before)

Example 8 with PreferenceManager

use of org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager in project eclipse.jdt.ls by eclipse.

the class RenameHandlerTest method setup.

@Before
public void setup() throws Exception {
    IJavaProject javaProject = newEmptyProject();
    sourceFolder = javaProject.getPackageFragmentRoot(javaProject.getProject().getFolder("src"));
    preferenceManager = mock(PreferenceManager.class);
    Preferences p = mock(Preferences.class);
    when(preferenceManager.getPreferences()).thenReturn(p);
    when(p.isRenameEnabled()).thenReturn(true);
    handler = new RenameHandler(preferenceManager);
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) Preferences(org.eclipse.jdt.ls.core.internal.preferences.Preferences) PreferenceManager(org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager) Before(org.junit.Before)

Example 9 with PreferenceManager

use of org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager in project eclipse.jdt.ls by eclipse.

the class SignatureHelpHandlerTest method setup.

@Override
@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);
    Preferences p = mock(Preferences.class);
    when(preferenceManager.getPreferences(null)).thenReturn(p);
    when(p.isSignatureHelpEnabled()).thenReturn(true);
    handler = new SignatureHelpHandler(preferenceManager);
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) Preferences(org.eclipse.jdt.ls.core.internal.preferences.Preferences) PreferenceManager(org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager) Before(org.junit.Before)

Example 10 with PreferenceManager

use of org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager in project eclipse.jdt.ls by eclipse.

the class MavenProjectImporter method applies.

@Override
public boolean applies(IProgressMonitor monitor) throws OperationCanceledException, CoreException {
    PreferenceManager preferencesManager = JavaLanguageServerPlugin.getPreferencesManager();
    if (preferencesManager != null && !preferencesManager.getPreferences().isImportMavenEnabled()) {
        return false;
    }
    Set<MavenProjectInfo> files = getMavenProjectInfo(monitor);
    if (files != null) {
        Iterator<MavenProjectInfo> iter = files.iterator();
        while (iter.hasNext()) {
            MavenProjectInfo projectInfo = iter.next();
            File dir = projectInfo.getPomFile() == null ? null : projectInfo.getPomFile().getParentFile();
            if (dir != null && exclude(dir.toPath())) {
                iter.remove();
            }
        }
    }
    return files != null && !files.isEmpty();
}
Also used : MavenProjectInfo(org.eclipse.m2e.core.project.MavenProjectInfo) PreferenceManager(org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager) File(java.io.File)

Aggregations

PreferenceManager (org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager)10 Preferences (org.eclipse.jdt.ls.core.internal.preferences.Preferences)7 Before (org.junit.Before)7 IJavaProject (org.eclipse.jdt.core.IJavaProject)3 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ContentProviderManager (org.eclipse.jdt.ls.core.internal.managers.ContentProviderManager)1 ProjectsManager (org.eclipse.jdt.ls.core.internal.managers.ProjectsManager)1 MavenProjectInfo (org.eclipse.m2e.core.project.MavenProjectInfo)1 BundleException (org.osgi.framework.BundleException)1