Skip to content

Commit 3f45960

Browse files
author
jan
committed
Change default folder to src from root
Also externalize the text messages
1 parent 0b30f30 commit 3f45960

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

io.sloeber.ui/src/io/sloeber/ui/Messages.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ public class Messages extends NLS {
161161
public static String ui_put_in_version_control;
162162
public static String target_maintain;
163163
public static String Add_Targets_To_force_serial_disconnect_when_run;
164+
public static String NewProjectSourceLocationPage_CodeInCustomFolder;
165+
166+
public static String NewProjectSourceLocationPage_CodeInRootFolder;
167+
168+
public static String NewProjectSourceLocationPage_CodeInSrcFolder;
169+
170+
public static String NewProjectSourceLocationPage_CustomSourceTextFieldError;
171+
172+
public static String NewProjectSourceLocationPage_ExplainText;
173+
164174
public static String ui_new_sketch_sketch_source_folder;
165175

166176
public static String yes;

io.sloeber.ui/src/io/sloeber/ui/messages.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,8 @@ ui_put_in_version_control=Share in version control?
136136
target_maintain=Targets
137137
Add_Targets_To_force_serial_disconnect_when_run=Add targets that require the serial connection to be closed when build.
138138
Build_Error_Before_Upload=Build failed before upload.
139+
NewProjectSourceLocationPage_CodeInCustomFolder=put code in a custom folder
140+
NewProjectSourceLocationPage_CodeInRootFolder=Put Code in the root of the project
141+
NewProjectSourceLocationPage_CodeInSrcFolder=put code in the src folder
142+
NewProjectSourceLocationPage_CustomSourceTextFieldError=You must provide a text in the text field that matches a valid folder name
143+
NewProjectSourceLocationPage_ExplainText=You can separate the source code from the rest of the project content by putting it in a source folder.

io.sloeber.ui/src/io/sloeber/ui/wizard/newsketch/NewProjectSourceLocationPage.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected NewProjectSourceLocationPage(String pageName) {
2727
super(pageName);
2828
setTitle(Messages.ui_new_sketch_sketch_source_folder);
2929
setDescription(
30-
"You can seperate the source code from the rest of the project content by putting it in a source folder.");
30+
Messages.NewProjectSourceLocationPage_ExplainText);
3131
}
3232

3333
@Override
@@ -52,22 +52,22 @@ public void widgetDefaultSelected(SelectionEvent e) {
5252
}
5353
};
5454

55-
RootFolderButton = new Button(usercomp, SWT.RADIO);
56-
RootFolderButton.setText("Put Code in the root of the project");
57-
RootFolderButton.addSelectionListener(selectionListener);
58-
5955
srcFolderButton = new Button(usercomp, SWT.RADIO);
60-
srcFolderButton.setText("put code in the src folder");
56+
srcFolderButton.setText(Messages.NewProjectSourceLocationPage_CodeInSrcFolder);
6157
srcFolderButton.addSelectionListener(selectionListener);
6258

59+
RootFolderButton = new Button(usercomp, SWT.RADIO);
60+
RootFolderButton.setText(Messages.NewProjectSourceLocationPage_CodeInRootFolder);
61+
RootFolderButton.addSelectionListener(selectionListener);
62+
6363
customFolderButton = new Button(usercomp, SWT.RADIO);
64-
customFolderButton.setText("put code in a custom folder");
64+
customFolderButton.setText(Messages.NewProjectSourceLocationPage_CodeInCustomFolder);
6565
customFolderButton.addSelectionListener(new SelectionListener() {
6666
@Override
6767
public void widgetSelected(SelectionEvent e) {
6868
customFolderText.setEditable(true);
6969
if (customFolderText.getText().isBlank()) {
70-
setErrorMessage("You must provide a text in the text field that matches a valid folder name");
70+
setErrorMessage(Messages.NewProjectSourceLocationPage_CustomSourceTextFieldError);
7171
setPageComplete(false);
7272
}
7373
}
@@ -84,7 +84,7 @@ public void widgetDefaultSelected(SelectionEvent e) {
8484
@Override
8585
public void modifyText(ModifyEvent e) {
8686
if (customFolderText.getText().isBlank()) {
87-
setErrorMessage("You must provide a text in the text field that matches a valid folder name");
87+
setErrorMessage(Messages.NewProjectSourceLocationPage_CustomSourceTextFieldError);
8888
setPageComplete(false);
8989
} else {
9090
setErrorMessage(null);
@@ -93,7 +93,7 @@ public void modifyText(ModifyEvent e) {
9393
}
9494
});
9595

96-
String storedValue = ConfigurationPreferences.getString(LAST_USED_SOURCE_LOCATION, null);
96+
String storedValue = ConfigurationPreferences.getString(LAST_USED_SOURCE_LOCATION, DEFAULT_FOLDER);
9797
if (DEFAULT_FOLDER.equals(storedValue)) {
9898
srcFolderButton.setSelection(true);
9999
} else {

0 commit comments

Comments
 (0)