summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Khurana2018-07-04 11:10:18 -0400
committerNathan Ridge2018-07-04 11:27:00 -0400
commit33e15fae72d11b34bc148fb06dd0271b7878648b (patch)
treef0b63746798e8876ca55e0d6f41d7a8fdea1be12
parent2bcd06f097d1cc846baf8164705ff349843b8080 (diff)
downloadorg.eclipse.cdt-33e15fae72d11b34bc148fb06dd0271b7878648b.tar.gz
org.eclipse.cdt-33e15fae72d11b34bc148fb06dd0271b7878648b.tar.xz
org.eclipse.cdt-33e15fae72d11b34bc148fb06dd0271b7878648b.zip
Bug 536381. Add propertyChange() method to Preference Page
Change-Id: Ib0631251feaa1f0c33eac523e3c203713e9443fb Signed-off-by: Manish Khurana <mkmanishkhurana98@gmail.com>
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPLanguageServerPreferencePage.java13
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPStreamConnectionProvider.java2
2 files changed, 14 insertions, 1 deletions
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPLanguageServerPreferencePage.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPLanguageServerPreferencePage.java
index 0c1258f425..f3c29ea1fc 100644
--- a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPLanguageServerPreferencePage.java
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPLanguageServerPreferencePage.java
@@ -8,7 +8,10 @@
package org.eclipse.lsp4e.cpp.language;
+import java.io.File;
+
import org.eclipse.jface.preference.*;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;
@@ -47,6 +50,16 @@ public class CPPLanguageServerPreferencePage extends FieldEditorPreferencePage i
}
@Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getSource() == serverChoice && event.getProperty() == FieldEditor.VALUE) {
+ File changedLSLocation = CPPStreamConnectionProvider.getDefaultLSLocation((String) event.getNewValue());
+ if(changedLSLocation != null) {
+ serverPath.setStringValue(changedLSLocation.getAbsolutePath());
+ }
+ }
+ }
+
+ @Override
public void init(IWorkbench workbench) {
}
} \ No newline at end of file
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPStreamConnectionProvider.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPStreamConnectionProvider.java
index ba773e3a53..d2b8d110c7 100644
--- a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPStreamConnectionProvider.java
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPStreamConnectionProvider.java
@@ -124,7 +124,7 @@ public class CPPStreamConnectionProvider extends ProcessStreamConnectionProvider
return null;
}
- private static File getDefaultLSLocation(String selectedLanguageServer) {
+ static File getDefaultLSLocation(String selectedLanguageServer) {
String res = null;
String[] command = new String[] {"/bin/bash", "-c", "which " + selectedLanguageServer}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (Platform.getOS().equals(Platform.OS_WIN32)) {