Skip to content

Commit 81e5a5a

Browse files
sigmaaaalirana01
andauthored
Espressif preferences for the serial monitor has no effect on it (#493)
* changed preference store for serial monitor parameters * Updated the reference to serial monitor preferences Co-authored-by: alirana01 <[email protected]>
1 parent c26a09a commit 81e5a5a

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/SerialMonitorBundle.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.espressif.idf.serial.monitor;
22

3-
import org.eclipse.jface.preference.IPreferenceStore;
43
import org.osgi.framework.BundleContext;
54
import org.osgi.framework.ServiceReference;
65

@@ -13,20 +12,11 @@
1312
public class SerialMonitorBundle extends AbstractUIActivator
1413
{
1514
public static final String PLUGIN_ID = "com.espressif.idf.serial.monitor"; //$NON-NLS-1$
16-
public static final String SERIAL_MONITOR_NUMBER_OF_CHARS_IN_LINE = "numberOfCharsInALine"; //$NON-NLS-1$
17-
public static final String SERIAL_MONITOR_NUMBER_OF_LINES = "numberOfLines"; //$NON-NLS-1$
1815

1916
private static BundleContext context;
2017

2118
private static SerialMonitorBundle fgInstance;
2219

23-
@Override
24-
protected void initializeDefaultPreferences(IPreferenceStore preferenceStore)
25-
{
26-
preferenceStore.setDefault(SERIAL_MONITOR_NUMBER_OF_CHARS_IN_LINE, 500);
27-
preferenceStore.setDefault(SERIAL_MONITOR_NUMBER_OF_LINES, 1000);
28-
}
29-
3020
public SerialMonitorBundle()
3121
{
3222
super();

bundles/com.espressif.idf.serial.monitor/src/com/espressif/idf/serial/monitor/core/LocalTerminal.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
import java.util.List;
66
import java.util.Map;
77

8-
import com.espressif.idf.serial.monitor.SerialMonitorBundle;
8+
import org.eclipse.core.runtime.Platform;
9+
10+
import com.espressif.idf.ui.UIPlugin;
11+
import com.espressif.idf.ui.preferences.EspresssifPreferencesPage;
912
import com.pty4j.PtyProcess;
1013
import com.pty4j.PtyProcessBuilder;
1114

@@ -19,7 +22,7 @@ public class LocalTerminal
1922
private List<String> arguments;
2023
private File workingDir;
2124
private Map<String, String> environment;
22-
25+
2326
public LocalTerminal(List<String> commandArgs, File projectWorkingDir, Map<String, String> environment)
2427
{
2528
this.arguments = commandArgs;
@@ -30,10 +33,8 @@ public LocalTerminal(List<String> commandArgs, File projectWorkingDir, Map<Strin
3033
public Process connect() throws IOException
3134
{
3235
String[] args = arguments.toArray(new String[arguments.size()]);
33-
int numberOfRows = SerialMonitorBundle.getInstance().getPreferenceStore()
34-
.getInt(SerialMonitorBundle.SERIAL_MONITOR_NUMBER_OF_LINES);
35-
int numberOfCols = SerialMonitorBundle.getInstance().getPreferenceStore()
36-
.getInt(SerialMonitorBundle.SERIAL_MONITOR_NUMBER_OF_CHARS_IN_LINE);
36+
int numberOfRows = Platform.getPreferencesService().getInt(UIPlugin.PLUGIN_ID, EspresssifPreferencesPage.NUMBER_OF_LINES, EspresssifPreferencesPage.DEFAULT_SERIAL_MONITOR_NUBMER_OF_LINES, null);
37+
int numberOfCols = Platform.getPreferencesService().getInt(UIPlugin.PLUGIN_ID, EspresssifPreferencesPage.NUMBER_OF_CHARS_IN_A_LINE, EspresssifPreferencesPage.DEFAULT_SERIAL_MONITOR_NUMBER_OF_CHARS_IN_LINE, null);
3738
PtyProcessBuilder ptyProcessBuilder = new PtyProcessBuilder(args).setEnvironment(environment)
3839
.setDirectory(workingDir.getAbsolutePath()).setInitialColumns(numberOfCols).setInitialRows(numberOfRows)
3940
.setConsole(false).setCygwin(false).setLogFile(null);

bundles/com.espressif.idf.ui/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11
4545
Export-Package: com.espressif.idf.ui,
4646
com.espressif.idf.ui.dialogs,
4747
com.espressif.idf.ui.handlers,
48+
com.espressif.idf.ui.preferences,
4849
com.espressif.idf.ui.tracing
4950
Bundle-ClassPath: .,
5051
lib/commonmark-0.16.1.jar,

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/preferences/EspresssifPreferencesPage.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
package com.espressif.idf.ui.preferences;
22

33
import org.eclipse.core.runtime.preferences.InstanceScope;
4-
import org.eclipse.jface.preference.FieldEditor;
5-
import org.eclipse.jface.preference.FieldEditorPreferencePage;
6-
import org.eclipse.jface.preference.IntegerFieldEditor;
74
import org.eclipse.jface.preference.PreferencePage;
85
import org.eclipse.swt.SWT;
9-
import org.eclipse.swt.layout.FillLayout;
106
import org.eclipse.swt.layout.GridData;
117
import org.eclipse.swt.layout.GridLayout;
12-
import org.eclipse.swt.layout.RowLayout;
138
import org.eclipse.swt.widgets.Composite;
149
import org.eclipse.swt.widgets.Control;
1510
import org.eclipse.swt.widgets.Group;
@@ -26,10 +21,12 @@
2621
public class EspresssifPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage
2722
{
2823

29-
private static final String NUMBER_OF_LINES = "numberOfLines"; //$NON-NLS-1$
30-
private static final String NUMBER_OF_CHARS_IN_A_LINE = "numberOfCharsInALine"; //$NON-NLS-1$
24+
public static final String NUMBER_OF_LINES = "numberOfLines"; //$NON-NLS-1$
25+
public static final String NUMBER_OF_CHARS_IN_A_LINE = "numberOfCharsInALine"; //$NON-NLS-1$
26+
public static final int DEFAULT_SERIAL_MONITOR_NUBMER_OF_LINES = 1000;
27+
public static final int DEFAULT_SERIAL_MONITOR_NUMBER_OF_CHARS_IN_LINE = 500;
28+
3129
private static final String GDB_SERVER_LAUNCH_TIMEOUT = "fGdbServerLaunchTimeout"; //$NON-NLS-1$
32-
3330
private Text numberOfCharsInLineText;
3431
private Text numberLineText;
3532
private Text gdbSettingsText;
@@ -138,7 +135,7 @@ protected void performDefaults()
138135
private void initializeDefaults()
139136
{
140137
getPreferenceStore().setDefault(GDB_SERVER_LAUNCH_TIMEOUT, 25);
141-
getPreferenceStore().setDefault(NUMBER_OF_CHARS_IN_A_LINE, 500);
142-
getPreferenceStore().setDefault(NUMBER_OF_LINES, 1000);
138+
getPreferenceStore().setDefault(NUMBER_OF_CHARS_IN_A_LINE, DEFAULT_SERIAL_MONITOR_NUMBER_OF_CHARS_IN_LINE);
139+
getPreferenceStore().setDefault(NUMBER_OF_LINES, DEFAULT_SERIAL_MONITOR_NUBMER_OF_LINES);
143140
}
144141
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/bin/
22
/screenshots/
3+
/target/

0 commit comments

Comments
 (0)