use of org.apache.sling.ide.eclipse.ui.nav.model.JcrProperty in project sling by apache.
the class MVNCellEditor method openDialogBox.
@Override
protected Object openDialogBox(Control cellEditorWindow) {
final JcrProperty property = node.getProperty(propertyName);
final MVPEditor mvpEditor = new MVPEditor(cellEditorWindow.getShell(), property);
if (mvpEditor.open() == IStatus.OK) {
return mvpEditor.getLines();
} else {
return null;
}
}
use of org.apache.sling.ide.eclipse.ui.nav.model.JcrProperty in project sling by apache.
the class JcrCellLabelProvider method update.
@Override
public void update(ViewerCell cell) {
int index = cell.getColumnIndex();
if (!isNewRow(cell)) {
if (canEdit(cell)) {
cell.setForeground(normalColor);
} else {
cell.setForeground(greyColor);
}
}
if (index == 0) {
updateName(cell);
return;
} else if (index == 1) {
final Object element = cell.getElement();
if (element instanceof NewRow) {
NewRow newRow = (NewRow) element;
int propertyType = newRow.getType();
String type = PropertyType.nameFromValue(propertyType);
cell.setText(type);
} else if (element instanceof IPropertyDescriptor) {
IPropertyDescriptor pd = (IPropertyDescriptor) element;
JcrNode jcrNode = (JcrNode) viewer.getInput();
Map.Entry me = (Entry) pd.getId();
final String propertyName = String.valueOf(me.getKey());
int propertyType = jcrNode.getPropertyType(propertyName);
if (propertyType <= -1 || propertyType == PropertyType.UNDEFINED) {
cell.setText("");
} else {
final JcrProperty property = jcrNode.getProperty(propertyName);
String type = PropertyType.nameFromValue(propertyType);
if (property != null && property.isMultiple()) {
type = type + "[]";
}
cell.setText(type);
}
} else {
cell.setText("");
}
return;
} else if (index == 2) {
updateValue(cell);
return;
} else {
final Object element = cell.getElement();
if (element instanceof NewRow) {
NewRow newRow = (NewRow) element;
cell.setText("");
} else if (element instanceof IPropertyDescriptor) {
IPropertyDescriptor pd = (IPropertyDescriptor) element;
JcrNode jcrNode = (JcrNode) viewer.getInput();
Map.Entry me = (Entry) pd.getId();
PropertyDefinition prd = jcrNode.getPropertyDefinition(String.valueOf(me.getKey()));
if (index == 3) {
// protected
if (prd != null) {
cell.setText(String.valueOf(prd.isProtected()));
} else {
cell.setText("false");
}
} else if (index == 4) {
// mandatory
if (prd != null) {
cell.setText(String.valueOf(prd.isMandatory()));
} else {
cell.setText("false");
}
} else if (index == 5) {
// multiple
if (prd != null) {
cell.setText(String.valueOf(prd.isMultiple()));
} else {
cell.setText(String.valueOf(jcrNode.getProperty(String.valueOf(me.getKey())).isMultiple()));
}
} else if (index == 6) {
// auto creatd
if (prd != null) {
cell.setText(String.valueOf(prd.isAutoCreated()));
} else {
cell.setText("false");
}
} else {
cell.setText("n/a");
return;
}
}
}
}
use of org.apache.sling.ide.eclipse.ui.nav.model.JcrProperty in project sling by apache.
the class DateTimeCellEditor method openDialogBox.
@Override
protected Object openDialogBox(Control cellEditorWindow) {
final JcrProperty property = node.getProperty(propertyName);
final DateTimeEditor dtEditor = new DateTimeEditor(cellEditorWindow.getShell(), property);
if (dtEditor.open() == IStatus.OK) {
return dtEditor.getDate();
} else {
return null;
}
}
Aggregations