Skip to content

Commit

Permalink
enable global search by default in prefs (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
plaird authored Jul 7, 2021
1 parent d91d236 commit 0037e55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class BazelPreferenceKeys {

// path the the bazel executable
public static final String BAZEL_PATH_PREF_NAME = "BAZEL_PATH";
{
static {
String defaultExecutablePath = BazelCommandManager.getDefaultBazelExecutablePath();
defaultValues.put(BAZEL_PATH_PREF_NAME, defaultExecutablePath);
}
Expand All @@ -31,8 +31,8 @@ public class BazelPreferenceKeys {
// to look for the local cache of downloaded jars.
public static final String GLOBALCLASSPATH_SEARCH_PREF_NAME = "GLOBALCLASSPATH_SEARCH_ENABLED";
public static final String EXTERNAL_JAR_CACHE_PATH_PREF_NAME = "EXTERNAL_JAR_CACHE_PATH";
{
defaultValues.put(GLOBALCLASSPATH_SEARCH_PREF_NAME, "false");
static {
defaultValues.put(GLOBALCLASSPATH_SEARCH_PREF_NAME, "true");
}

// *********************************************************************
Expand All @@ -44,7 +44,7 @@ public class BazelPreferenceKeys {
// out this is the case. This flag disables this feature, in case that logic causes problems for some users.
// https://github.com/salesforce/bazel-eclipse/issues/164
public static final String DISABLE_UNRESOLVE_WORKSPACEFILE_SOFTLINK = "DISABLE_UNRESOLVE_WORKSPACEFILE_SOFTLINK";
{
static {
defaultValues.put(DISABLE_UNRESOLVE_WORKSPACEFILE_SOFTLINK, "false");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Copyright 2016 The Bazel Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
Expand Down Expand Up @@ -56,7 +56,7 @@ public class BazelPreferencePage extends FieldEditorPreferencePage implements IW
private static class BazelBinaryFieldEditor extends FileFieldEditor {
BazelBinaryFieldEditor(Composite parent) {
super(BazelPreferenceKeys.BAZEL_PATH_PREF_NAME, "Path to the &Bazel binary:", true, VALIDATE_ON_KEY_STROKE,
parent);
parent);
}

@Override
Expand Down Expand Up @@ -89,14 +89,14 @@ private static class BazelGlobalClasspathSearchEnabledFieldEditor extends Boolea

public BazelGlobalClasspathSearchEnabledFieldEditor(Composite parent) {
super(BazelPreferenceKeys.GLOBALCLASSPATH_SEARCH_PREF_NAME,
"Enable &global classpath search? (experimental)", SEPARATE_LABEL, parent);
"Enable &global classpath search?", SEPARATE_LABEL, parent);
}
}

private static class BazelExternalDownloadCachePathEditor extends DirectoryFieldEditor {
BazelExternalDownloadCachePathEditor(Composite parent) {
super(BazelPreferenceKeys.EXTERNAL_JAR_CACHE_PATH_PREF_NAME,
"Optional: path to the local &cache of downloaded jar files:", parent);
"Optional: path to the local &cache of downloaded jar files:", parent);
}

@Override
Expand Down Expand Up @@ -129,6 +129,7 @@ public BazelPreferencePage() {
super(GRID);
}

@Override
public void createFieldEditors() {
addField(new BazelBinaryFieldEditor(getFieldEditorParent()));
addField(new BazelGlobalClasspathSearchEnabledFieldEditor(getFieldEditorParent()));
Expand Down
10 changes: 4 additions & 6 deletions docs/using_the_feature_classpath.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ You may then manually configure the JDK by configuring the Build Path of any Ecl

### Global Search Classpath

Currently, this is an experimental feature.
See [Global Search Classpath](https://github.com/salesforce/bazel-eclipse/issues/161) issue for status.

This feature provides a benefit when working with large Bazel workspaces.
With a large workspace, during import you will likely only choose to import a handful of packages.
BEF will configure an Eclipse project for each of those packages, with the proper classpath.
Expand All @@ -69,12 +66,13 @@ It scans the external jar directory of the Bazel build, and adds all found jars
nested under the Bazel Workspace project in the Package Explorer.
By having them appear in a classpath object, JDT can now find all enclosed types.

To enable this feature do the following *before* importing packages into your workspace:
To disable this feature do the following *before* importing packages into your workspace:
- *Eclipse -> Preferences -> Bazel* (exact menu varies by platform)
- Click the *Enable global classpath search* option.
- Uncheck the *Enable global classpath search* option.

Note that the feature may not work for all use cases.
Check the Issue linked above for details.
See the [Global Search Classpath](https://github.com/salesforce/bazel-eclipse/issues/161) issue for status
and open issues.

### Next Topic: Launching binaries and tests from Eclipse

Expand Down

0 comments on commit 0037e55

Please sign in to comment.