-
Notifications
You must be signed in to change notification settings - Fork 2
/
DlgInstallingPackages.java
60 lines (50 loc) · 1.89 KB
/
DlgInstallingPackages.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tappas;
import javafx.scene.Cursor;
import javafx.scene.control.ProgressIndicator;
import javafx.stage.Stage;
import javafx.stage.Window;
import java.nio.file.Path;
/**
*
* @author Hector del Risco - [email protected] & Pedro Salguero - [email protected]
*/
public class DlgInstallingPackages extends DlgBase {
private boolean res = false;
ProgressIndicator pg;
public DlgInstallingPackages(Project project, Window window) {
super(project, null);
this.window = window;
}
public void closeAction(){
// get a handle to the stage
Stage stage = (Stage) pg.getScene().getWindow();
// do what you have to do
stage.close();
}
public boolean showAndWait(App app, AppFXMLDocumentController fxdc) {
if(createDialog("InstallingPackages.fxml", "Installing all packages you need...", false, false, null)) {
try {
Path path = app.data.getTmpScriptFileFromResource("tappas_downloadPackages.R");
res = app.runDownloadPackages(path.toString());
Utils.removeFile(path);
}catch(Exception e) {
app.logWarning("Unable to install R packages: " + e.getMessage());
}
Tappas.getScene().setCursor(Cursor.DEFAULT);
if(res)
showDlgMsg("All packages installed.");
else
showDlgMsg("There seems to have been an error installing the packages. We recommend you install them manually by following our manual which you will find on: http://app.tappas.org/downloads/");
return res;
}
return false;
}
//
// Internal Functions
//
}