Skip to content

Commit f520563

Browse files
committed
remove unused confirmReplace variable from install() functions for contribs
1 parent 0e63b75 commit f520563

File tree

4 files changed

+10
-37
lines changed

4 files changed

+10
-37
lines changed

app/src/processing/app/contrib/AvailableContribution.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static private AvailableContribution findContrib(File contribArchive) throws IOE
131131
static public LocalContribution install(Base base, File contribArchive) throws IOException {
132132
AvailableContribution ac = findContrib(contribArchive);
133133
if (ac != null) {
134-
return ac.install(base, contribArchive, false, null);
134+
return ac.install(base, contribArchive, null);
135135
}
136136
return null;
137137
}
@@ -140,15 +140,12 @@ static public LocalContribution install(Base base, File contribArchive) throws I
140140
/**
141141
* @param contribArchive
142142
* a zip file containing the library to install
143-
* @param confirmReplace
144-
* true to open a dialog asking the user to confirm removing/moving
145-
* the library when a library by the same name already exists
146143
* @param status
147144
* the StatusPanel. Pass null if this function is called for an
148145
* install-on-startup
149146
*/
150147
public LocalContribution install(Base base, File contribArchive,
151-
boolean confirmReplace, StatusPanel status) {
148+
StatusPanel status) {
152149
// Unzip the file into the modes, tools, or libraries folder inside the
153150
// sketchbook. Unzipping to /tmp is problematic because it may be on
154151
// another file system, so move/rename operations will break.
@@ -191,8 +188,7 @@ public LocalContribution install(Base base, File contribArchive,
191188

192189
// Check to make sure nothing has the same name already,
193190
// backup old if needed, then move things into place and reload.
194-
installedContrib =
195-
newContrib.copyAndLoad(base, confirmReplace, status);
191+
installedContrib = newContrib.copyAndLoad(base, status);
196192

197193
// Unlock all the jars if it is a mode or tool
198194
if (newContrib.getType() == ContributionType.MODE) {

app/src/processing/app/contrib/ContributionManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static void downloadAndInstall(final Base base,
157157
if (downloadProgress.notCanceled() && !downloadProgress.isException()) {
158158
installProgress.startTask(Language.text("contrib.progress.installing"));
159159
final LocalContribution installed =
160-
available.install(base, contribZip, false, status);
160+
available.install(base, contribZip, status);
161161

162162
if (installed != null) {
163163
try {
@@ -241,7 +241,7 @@ static void downloadAndInstallOnStartup(final Base base, final URL url,
241241
try {
242242
download(url, null, contribZip, null);
243243
final LocalContribution installed =
244-
available.install(base, contribZip, false, null);
244+
available.install(base, contribZip, null);
245245

246246
if (installed != null) {
247247
try {
@@ -373,7 +373,7 @@ static public void downloadAndInstallOnImport(final Base base,
373373
String arg = "contrib.import.progress.install";
374374
editor.statusNotice(Language.interpolate(arg,available.name));
375375
final LocalContribution installed =
376-
available.install(base, contribZip, false, null);
376+
available.install(base, contribZip, null);
377377

378378
if (installed != null) {
379379
try {

app/src/processing/app/contrib/LocalContribution.java

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ public String initLoader(String className) throws Exception {
164164

165165

166166
LocalContribution copyAndLoad(Base base,
167-
boolean confirmReplace,
168167
StatusPanel status) {
169168
// NOTE: null status => function is called on startup
170169
// when Editor objects, et al. aren't ready
@@ -198,33 +197,9 @@ LocalContribution copyAndLoad(Base base,
198197
} else {
199198
int result;
200199
boolean doBackup = Preferences.getBoolean("contribution.backup.on_install");
201-
if (confirmReplace) {
202-
if (doBackup) {
203-
result = Messages.showYesNoQuestion(editor, "Replace",
204-
"Replace pre-existing \"" + oldContrib.getName() + "\" library?",
205-
"A pre-existing copy of the \"" + oldContrib.getName() + "\" library<br>"+
206-
"has been found in your sketchbook. Clicking “Yes”<br>"+
207-
"will move the existing library to a backup folder<br>" +
208-
"in <i>libraries/old</i> before replacing it.");
209-
if (result != JOptionPane.YES_OPTION || !oldContrib.backup(true, status)) {
210-
return null;
211-
}
212-
} else {
213-
result = Messages.showYesNoQuestion(editor, "Replace",
214-
"Replace pre-existing \"" + oldContrib.getName() + "\" library?",
215-
"A pre-existing copy of the \"" + oldContrib.getName() + "\" library<br>"+
216-
"has been found in your sketchbook. Clicking “Yes”<br>"+
217-
"will permanently delete this library and all of its contents<br>"+
218-
"before replacing it.");
219-
if (result != JOptionPane.YES_OPTION || !oldContrib.getFolder().delete()) {
220-
return null;
221-
}
222-
}
223-
} else {
224-
if ((doBackup && !oldContrib.backup(true, status)) ||
200+
if ((doBackup && !oldContrib.backup(true, status)) ||
225201
(!doBackup && !oldContrib.getFolder().delete())) {
226-
return null;
227-
}
202+
return null;
228203
}
229204
}
230205
}

todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ X many more updates to the contribs wiki
1313
X more contribs manager concurrency problems
1414
X https://github.com/processing/processing4/issues/640
1515
X warn users about multiple libraries with the same name
16+
X remove unused confirmReplace variable from install() functions for contribs
17+
_ if contrib (library only?) folder name changes on update, old lib not removed
1618
_ Updates requiring a reboot give the false impression that they failed (in the updates tab)
1719
_ https://github.com/processing/processing4/issues/647
1820
_ lots of folders remaining in 'old' for Modes

0 commit comments

Comments
 (0)