use of org.jkiss.dbeaver.ui.preferences.PreferenceStoreDelegate in project dbeaver by serge-rider.
the class ConfirmationDialog method open.
public static int open(int kind, int imageKind, Shell parent, String title, String message, String toggleMessage, boolean toggleState, String key) {
DBPPreferenceStore prefStore = DBWorkbench.getPlatform().getPreferenceStore();
if (toggleMessage != null) {
if (ConfirmationDialog.ALWAYS.equals(prefStore.getString(key))) {
if (kind == QUESTION || kind == QUESTION_WITH_CANCEL) {
return IDialogConstants.YES_ID;
} else {
return IDialogConstants.OK_ID;
}
} else if (ConfirmationDialog.NEVER.equals(prefStore.getString(key))) {
if (kind == QUESTION || kind == QUESTION_WITH_CANCEL) {
return IDialogConstants.NO_ID;
} else {
return IDialogConstants.CANCEL_ID;
}
}
}
ConfirmationDialog dialog = new ConfirmationDialog(parent == null ? UIUtils.getActiveWorkbenchShell() : parent, title, // accept the default window icon
null, message, imageKind, getButtonLabels(kind), getDefaultIndex(kind, imageKind), toggleMessage, toggleState);
dialog.setPrefStore(new PreferenceStoreDelegate(prefStore));
dialog.setPrefKey(key);
return dialog.open();
}
use of org.jkiss.dbeaver.ui.preferences.PreferenceStoreDelegate in project dbeaver by dbeaver.
the class ConfirmationDialog method open.
public static int open(int kind, int imageKind, Shell parent, String title, String message, String toggleMessage, boolean toggleState, String key) {
DBPPreferenceStore prefStore = DBWorkbench.getPlatform().getPreferenceStore();
if (toggleMessage != null) {
if (ConfirmationDialog.ALWAYS.equals(prefStore.getString(key))) {
if (kind == QUESTION || kind == QUESTION_WITH_CANCEL) {
return IDialogConstants.YES_ID;
} else {
return IDialogConstants.OK_ID;
}
} else if (ConfirmationDialog.NEVER.equals(prefStore.getString(key))) {
if (kind == QUESTION || kind == QUESTION_WITH_CANCEL) {
return IDialogConstants.NO_ID;
} else {
return IDialogConstants.CANCEL_ID;
}
}
}
ConfirmationDialog dialog = new ConfirmationDialog(parent == null ? UIUtils.getActiveWorkbenchShell() : parent, title, // accept the default window icon
null, message, imageKind, getButtonLabels(kind), getDefaultIndex(kind, imageKind), toggleMessage, toggleState);
dialog.setPrefStore(new PreferenceStoreDelegate(prefStore));
dialog.setPrefKey(key);
return dialog.open();
}
Aggregations