aboutsummaryrefslogtreecommitdiff
path: root/inst/GUI
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-09-26 20:47:53 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-09-26 20:48:48 +0200
commit144fd10b34a885a8038cc38266cd0e188b6a4490 (patch)
tree08ce0cf86ca1024893917082757c39acec6f93bd /inst/GUI
parent04def8dc34c5557dd62b903e3249e5f5e98f289c (diff)
Disallow deleting the last dataset/model as this is not supported
Diffstat (limited to 'inst/GUI')
-rw-r--r--inst/GUI/gmkin.R32
1 files changed, 20 insertions, 12 deletions
diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R
index c85d660..5932f37 100644
--- a/inst/GUI/gmkin.R
+++ b/inst/GUI/gmkin.R
@@ -311,12 +311,16 @@ copy_dataset_handler <- function(h, ...) {
}
delete_dataset_handler <- function(h, ...) {
- ds[[ds.cur]] <<- NULL
- names(ds) <<- as.character(1:length(ds))
- ds.cur <<- names(ds)[[1]]
- update_ds.df()
- ds.gtable[,] <- ds.df
- update_ds_editor()
+ if (length(ds) > 1) {
+ ds[[ds.cur]] <<- NULL
+ names(ds) <<- as.character(1:length(ds))
+ ds.cur <<- names(ds)[[1]]
+ update_ds.df()
+ ds.gtable[,] <- ds.df
+ update_ds_editor()
+ } else {
+ galert("Deleting the last dataset is not supported", parent = w)
+ }
}
new_dataset_handler <- function(h, ...) {
@@ -540,12 +544,16 @@ copy_model_handler <- function(h, ...) {
}
delete_model_handler <- function(h, ...) {
- m[[m.cur]] <<- NULL
- names(m) <<- as.character(1:length(m))
- m.cur <<- "1"
- update_m.df()
- m.gtable[,] <- m.df
- update_m_editor()
+ if (length(m) > 1) {
+ m[[m.cur]] <<- NULL
+ names(m) <<- as.character(1:length(m))
+ m.cur <<- "1"
+ update_m.df()
+ m.gtable[,] <- m.df
+ update_m_editor()
+ } else {
+ galert("Deleting the last model is not supported", parent = w)
+ }
}
add_observed_handler <- function(h, ...) {

Contact - Imprint