&& !getPreferenceStore().getBoolean("MAKE_WRITABLE")) {
String[] labels = new String[2];
labels[0] = "OK";
labels[1] = "Make writable";
MessageDialogWithToggle msg = new MessageDialogWithToggle(
this.getEditorSite().getShell(),
"Warning!",
null,
"You are opening a read only file. You will not be able to make or save any changes.",
MessageDialog.WARNING, labels, 0,
"Don't show this warning in future.", false);
//MessageBox msg = new MessageBox(this.getEditorSite().getShell());
//msg.setText("Warning!");
//msg.setMessage("You are opening a read only file. You will not be
// able to make or save any changes.");
if (msg.open() == 0) {
if (msg.getToggleState()) {
// Don't show warning in future.
getPreferenceStore().setValue(
EditorPreferenceConstants.P_WARN_READ_ONLY_FILES, false);
}
} else {
if (msg.getToggleState()) {
// Don't show warning in future.
getPreferenceStore().setValue("MAKE_WRITABLE", true);
}
setReadOnly(false);
}