mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Bug 536381. Add propertyChange() method to Preference Page
Change-Id: Ib0631251feaa1f0c33eac523e3c203713e9443fb Signed-off-by: Manish Khurana <mkmanishkhurana98@gmail.com>
This commit is contained in:
parent
2bcd06f097
commit
33e15fae72
2 changed files with 14 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
@ -46,6 +49,16 @@ public class CPPLanguageServerPreferencePage extends FieldEditorPreferencePage i
|
|||
addField(serverOptions);
|
||||
}
|
||||
|
||||
@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) {
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue