use of com.mucommander.commons.file.PermissionAccess in project mucommander by mucommander.
the class ChangePermissionsDialog method updatePermCheckBoxes.
/**
* Updates the permission checkboxes' values to reflect the octal permissions text field.
*/
private void updatePermCheckBoxes() {
JCheckBox permCheckBox;
String octalStr = octalPermTextField.getText();
int perms = octalStr.equals("") ? 0 : Integer.parseInt(octalStr, 8);
for (PermissionAccess a : PermissionAccess.reverseValues()) {
for (PermissionType p : PermissionType.reverseValues()) {
permCheckBox = permCheckBoxes[a.toInt()][p.toInt()];
// if(permCheckBox.isEnabled())
permCheckBox.setSelected((perms & (p.toInt() << a.toInt() * 3)) != 0);
}
}
}
use of com.mucommander.commons.file.PermissionAccess in project mucommander by mucommander.
the class ChangePermissionsDialog method getPermInt.
/**
* Creates and returns a permissions int using the values of the permission checkboxes.
*/
private int getPermInt() {
JCheckBox permCheckBox;
int perms = 0;
for (PermissionAccess a : PermissionAccess.reverseValues()) {
for (PermissionType p : PermissionType.reverseValues()) {
permCheckBox = permCheckBoxes[a.toInt()][p.toInt()];
if (permCheckBox.isSelected())
perms |= (p.toInt() << a.toInt() * 3);
}
}
return perms;
}
Aggregations