if (user.hasRoleName("EDITOR")) {
writeRight = 1;
isDirty = doIt;
Widget parent = getParent();
if(parent instanceof TabItem) {
TabItem tab = (TabItem) parent;
String title = doIt ? "*"+view.getName() : view.getName();
tab.setText(modify(title));
}
save.setEnabled(doIt);
}
if (writeRight == 0) {
save.setEnabled(false);
}
}
public void onSuccess(Boolean result) {
if (result) {
writeRight = 1;
isDirty = doIt;
Widget parent = getParent();
if(parent instanceof TabItem) {
TabItem tab = (TabItem) parent;
String title = doIt ? "*"+view.getName() : view.getName();
tab.setText(modify(title));
}
save.setEnabled(doIt);
} else {
XUser user = ((Workbench)Registry.get(Workbench.ID)).getUser();
writeRight = 0;
if (user.hasRoleName("EDITOR")) {
writeRight = 1;
isDirty = doIt;
Widget parent = getParent();
if(parent instanceof TabItem) {
TabItem tab = (TabItem) parent;
String title = doIt ? "*"+view.getName() : view.getName();
tab.setText(modify(title));
}
save.setEnabled(doIt);
}
if (writeRight == 0) {
save.setEnabled(false);
}
}
}
});
} else if (writeRight == 1) {
isDirty = doIt;
Widget parent = getParent();
if(parent instanceof TabItem) {
TabItem tab = (TabItem) parent;
String title = doIt ? "*"+view.getName() : view.getName();
tab.setText(modify(title));
}
save.setEnabled(doIt);
}
}