+ select item after add or select next item after delete
* global definition for data-file-extension in DATAEXT
This commit is contained in:
parent
d3056cd422
commit
99e0d89ce3
@ -24,6 +24,7 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
final int WND_W=208, WND_H=276; // initial window size
|
final int WND_W=208, WND_H=276; // initial window size
|
||||||
final String APPNAME="jUninstaller";
|
final String APPNAME="jUninstaller";
|
||||||
final String APPVERSION="1.0";
|
final String APPVERSION="1.0";
|
||||||
|
final String DATAEXT=".jun.gz";
|
||||||
|
|
||||||
private static JUninstaller jUninstaller = null;
|
private static JUninstaller jUninstaller = null;
|
||||||
|
|
||||||
@ -126,13 +127,13 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
String selItem = ltApps.getSelectedItem();
|
String selItem = ltApps.getSelectedItem();
|
||||||
if (selItem != null) {
|
if (selItem != null) {
|
||||||
if (MQ.yesnoBox("Are you sure?", "Do you really want to delete this entry without uninstall?") == MQ.YES) {
|
if (MQ.yesnoBox("Are you sure?", "Do you really want to delete this entry without uninstall?") == MQ.YES) {
|
||||||
File flDelMe = new File(selItem+".jun.gz");
|
File flDelMe = new File(selItem+DATAEXT);
|
||||||
if (flDelMe.delete()) {
|
if (flDelMe.delete()) {
|
||||||
MIP.infoPrint("Deleted!");
|
MIP.infoPrint("Deleted!");
|
||||||
} else {
|
} else {
|
||||||
MIP.infoPrint("Can't delete!");
|
MIP.infoPrint("Can't delete!");
|
||||||
}
|
}
|
||||||
updateList();
|
updateList(selItem+DATAEXT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MIP.infoPrint("Select one entry!");
|
MIP.infoPrint("Select one entry!");
|
||||||
@ -160,7 +161,7 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
lbView.setText("Details of "+selItem);
|
lbView.setText("Details of "+selItem);
|
||||||
ltView.removeAll();
|
ltView.removeAll();
|
||||||
MIP.busy("Reading...");
|
MIP.busy("Reading...");
|
||||||
String[] entries = mfs.getEntries(selItem+".jun.gz");
|
String[] entries = mfs.getEntries(selItem+DATAEXT);
|
||||||
MIP.busy("Building list (" + entries.length + ")...");
|
MIP.busy("Building list (" + entries.length + ")...");
|
||||||
for (int i=0;i<entries.length;i++) {
|
for (int i=0;i<entries.length;i++) {
|
||||||
ltView.add(entries[i]);
|
ltView.add(entries[i]);
|
||||||
@ -175,13 +176,13 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
if (selItem != null) {
|
if (selItem != null) {
|
||||||
boolean okay;
|
boolean okay;
|
||||||
File flNew;
|
File flNew;
|
||||||
File flTemp = new File(selItem+".jun.gz");
|
File flTemp = new File(selItem+DATAEXT);
|
||||||
String newname = "";
|
String newname = "";
|
||||||
do {
|
do {
|
||||||
okay = false;
|
okay = false;
|
||||||
newname = MQ.inputBox("Enter name", "Enter new name for this entry:", ((newname!="")?newname:selItem));
|
newname = MQ.inputBox("Enter name", "Enter new name for this entry:", ((newname!="")?newname:selItem));
|
||||||
if (newname != null) {
|
if (newname != null) {
|
||||||
flNew = new File(newname+".jun.gz");
|
flNew = new File(newname+DATAEXT);
|
||||||
if (newname.equals("")) {
|
if (newname.equals("")) {
|
||||||
MIP.infoPrint("Enter a name");
|
MIP.infoPrint("Enter a name");
|
||||||
} else if (flNew.exists()) {
|
} else if (flNew.exists()) {
|
||||||
@ -193,7 +194,7 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!okay && newname!=null);
|
} while (!okay && newname!=null);
|
||||||
updateList();
|
updateList(newname+DATAEXT);
|
||||||
} else {
|
} else {
|
||||||
MIP.infoPrint("Select one entry!");
|
MIP.infoPrint("Select one entry!");
|
||||||
}
|
}
|
||||||
@ -235,7 +236,7 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
btRena.addActionListener(this);
|
btRena.addActionListener(this);
|
||||||
btView.addActionListener(this);
|
btView.addActionListener(this);
|
||||||
|
|
||||||
updateList();
|
updateList(null);
|
||||||
|
|
||||||
pnMain.setFont(ftPlain8);
|
pnMain.setFont(ftPlain8);
|
||||||
btAbout.setFont(ftBold12);
|
btAbout.setFont(ftBold12);
|
||||||
@ -319,12 +320,19 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
lbLast.setText("Last scan: "+mfs.getDumpDate());
|
lbLast.setText("Last scan: "+mfs.getDumpDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateList() {
|
private void updateList(String selItem) {
|
||||||
String[] apps = mfs.getMonitored(".jun.gz");
|
String[] apps = mfs.getMonitored(DATAEXT);
|
||||||
ltApps.removeAll();
|
ltApps.removeAll();
|
||||||
|
int selIdx = 0;
|
||||||
for (int i=0;i<apps.length;i++) {
|
for (int i=0;i<apps.length;i++) {
|
||||||
ltApps.add(apps[i]);
|
ltApps.add(apps[i]);
|
||||||
|
if (selItem!=null && selItem.compareTo(apps[i])>=0) {
|
||||||
|
selIdx = ltApps.getItemCount();
|
||||||
|
selItem = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ltApps.select(selIdx);
|
||||||
|
ltApps.makeVisible(selIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compareFilesys(boolean redump) {
|
private void compareFilesys(boolean redump) {
|
||||||
@ -355,7 +363,7 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
okay = false;
|
okay = false;
|
||||||
newname = MQ.inputBox("Enter name", "Enter a name for this entry:", newname);
|
newname = MQ.inputBox("Enter name", "Enter a name for this entry:", newname);
|
||||||
if (newname != null) {
|
if (newname != null) {
|
||||||
flNew = new File(newname+".jun.gz");
|
flNew = new File(newname+DATAEXT);
|
||||||
if (newname.equals("")) {
|
if (newname.equals("")) {
|
||||||
MIP.infoPrint("Enter a name");
|
MIP.infoPrint("Enter a name");
|
||||||
} else if (flNew.exists()) {
|
} else if (flNew.exists()) {
|
||||||
@ -373,7 +381,7 @@ public class JUninstaller extends Frame implements ActionListener {
|
|||||||
MIP.infoPrint("Could not delete!");
|
MIP.infoPrint("Could not delete!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateList();
|
updateList(newname+DATAEXT);
|
||||||
clMain.show(pnMain, "1");
|
clMain.show(pnMain, "1");
|
||||||
} else {
|
} else {
|
||||||
MIP.infoPrint("No diffs found.");
|
MIP.infoPrint("No diffs found.");
|
||||||
|
Reference in New Issue
Block a user