Removed useless `showEditor` parameter from `Base.handleOpen`

Previously it was used to prevent the Editor from being displayed
when running in command-line mode. Now the Editor is not created at
all, so this parameter is useless.

This is also confirmed by the remaining calls to `handleOpen` that
all have the parameter set to `true`.
This commit is contained in:
Cristian Maglie 2016-11-07 18:03:07 +01:00
parent 1a640f6139
commit 3d52de7191
1 changed files with 8 additions and 11 deletions

View File

@ -424,10 +424,9 @@ public class Base {
}
}
boolean showEditor = parser.isGuiMode();
if (!parser.isForceSavePrefs())
PreferencesData.setDoSave(showEditor);
if (handleOpen(file, retrieveSketchLocation(".default"), showEditor, false) == null) {
PreferencesData.setDoSave(true);
if (handleOpen(file, retrieveSketchLocation(".default"), false) == null) {
String mess = I18n.format(tr("Failed to open sketch: \"{0}\""), path);
// Open failure is fatal in upload/verify mode
if (parser.isVerifyOrUploadMode())
@ -502,7 +501,7 @@ public class Base {
}
int[] location = retrieveSketchLocation("" + i);
// If file did not exist, null will be returned for the Editor
if (handleOpen(new File(path), location, nextEditorLocation(), true, false, false) != null) {
if (handleOpen(new File(path), location, nextEditorLocation(), false, false) != null) {
opened++;
}
}
@ -794,14 +793,14 @@ public class Base {
}
public Editor handleOpen(File file, boolean untitled) throws Exception {
return handleOpen(file, nextEditorLocation(), true, untitled);
return handleOpen(file, nextEditorLocation(), untitled);
}
protected Editor handleOpen(File file, int[] location, boolean showEditor, boolean untitled) throws Exception {
return handleOpen(file, location, location, showEditor, true, untitled);
protected Editor handleOpen(File file, int[] location, boolean untitled) throws Exception {
return handleOpen(file, location, location, true, untitled);
}
protected Editor handleOpen(File file, int[] storedLocation, int[] defaultLocation, boolean showEditor, boolean storeOpenedSketches, boolean untitled) throws Exception {
protected Editor handleOpen(File file, int[] storedLocation, int[] defaultLocation, boolean storeOpenedSketches, boolean untitled) throws Exception {
if (!file.exists()) return null;
// Cycle through open windows to make sure that it's not already open.
@ -834,9 +833,7 @@ public class Base {
// now that we're ready, show the window
// (don't do earlier, cuz we might move it based on a window being closed)
if (showEditor) {
SwingUtilities.invokeLater(() -> editor.setVisible(true));
}
SwingUtilities.invokeLater(() -> editor.setVisible(true));
return editor;
}