mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow a button to be marked as 'download', which causes it to be hidden when patch is available
This commit is contained in:
@@ -23,10 +23,12 @@ import org.jdom.Element;
|
||||
public class ButtonInfo {
|
||||
private final String myName;
|
||||
private final String myUrl;
|
||||
private final boolean myDownload;
|
||||
|
||||
public ButtonInfo(Element element) {
|
||||
myName = element.getAttributeValue("name");
|
||||
myUrl = element.getAttributeValue("url");
|
||||
myDownload = element.getAttributeValue("download") != null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -36,4 +38,13 @@ public class ButtonInfo {
|
||||
public String getUrl() {
|
||||
return myUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The button marked with 'download=true' attribute is hidden if patch is available.
|
||||
*
|
||||
* @return true if the button should be hidden when the patch is available.
|
||||
*/
|
||||
public boolean isDownload() {
|
||||
return myDownload;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -66,11 +66,14 @@ class UpdateInfoDialog extends AbstractUpdateDialog {
|
||||
}
|
||||
else {
|
||||
for (ButtonInfo info : buttons) {
|
||||
actions.add(new ButtonAction(info));
|
||||
if (!info.isDownload()) {
|
||||
actions.add(new ButtonAction(info));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// the first button replaces the OK action
|
||||
for (int i = 1; i < buttons.size(); i++) {
|
||||
actions.add(new ButtonAction(buttons.get(i)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user