* refactor
This commit is contained in:
parent
376881f77c
commit
02e2b9f4d1
|
@ -89,7 +89,7 @@ public class MediaBindingBean {
|
|||
@Define(undefined)
|
||||
public <T> T undefined(String name) {
|
||||
// omit expressions that depend on undefined values
|
||||
throw new BindingException(name, "undefined");
|
||||
throw new BindingException(name, EXCEPTION_UNDEFINED);
|
||||
}
|
||||
|
||||
@Define("n")
|
||||
|
@ -746,7 +746,7 @@ public class MediaBindingBean {
|
|||
public File getMediaFile() {
|
||||
// make sure file is not null, and that it is an existing file
|
||||
if (mediaFile == null) {
|
||||
throw new IllegalStateException("Sample file has not been set. Click \"Change Sample\" to select a sample file.");
|
||||
throw new IllegalStateException(EXCEPTION_SAMPLE_FILE_NOT_SET);
|
||||
}
|
||||
|
||||
return mediaFile;
|
||||
|
@ -1004,4 +1004,8 @@ public class MediaBindingBean {
|
|||
public String toString() {
|
||||
return String.format("%s ⇔ %s", infoObject, mediaFile == null ? null : mediaFile.getName());
|
||||
}
|
||||
|
||||
public static final String EXCEPTION_UNDEFINED = "undefined";
|
||||
public static final String EXCEPTION_SAMPLE_FILE_NOT_SET = "Sample file has not been set. Click \"Change Sample\" to select a sample file.";
|
||||
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ public class FormatDialog extends JDialog {
|
|||
|
||||
// initialize window properties
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
setMinimumSize(new Dimension(715, 470));
|
||||
setMinimumSize(new Dimension(650, 470));
|
||||
|
||||
// initialize data
|
||||
setState(initMode, lockOnBinding != null ? lockOnBinding : restoreSample(initMode), lockOnBinding != null);
|
||||
|
@ -544,10 +544,12 @@ public class FormatDialog extends JDialog {
|
|||
// ignore, cancelled tasks are obsolete anyway
|
||||
} catch (Exception e) {
|
||||
BindingException issue = findCause(e, BindingException.class);
|
||||
if (issue != null) {
|
||||
String msg = getMessage(issue);
|
||||
status.setText(msg);
|
||||
status.setIcon(ResourceManager.getIcon(msg.contains("Change Sample") ? "action.variables" : "status.info"));
|
||||
if (issue != null && getMessage(issue).contains(MediaBindingBean.EXCEPTION_SAMPLE_FILE_NOT_SET)) {
|
||||
status.setText(getMessage(issue));
|
||||
status.setIcon(ResourceManager.getIcon("action.variables"));
|
||||
} else if (issue != null) {
|
||||
status.setText(getMessage(issue));
|
||||
status.setIcon(ResourceManager.getIcon("status.info"));
|
||||
} else {
|
||||
status.setText(String.format("%s: %s", e.getClass().getSimpleName(), e.getMessage()));
|
||||
status.setIcon(ResourceManager.getIcon("status.warning"));
|
||||
|
|
Loading…
Reference in New Issue