.getActiveShell(), "Error", exception
.getMessage());
}
};
TitleAreaDialog tid = new TitleAreaDialog(Display
.getDefault().getActiveShell()) {
private Combo combo;
private org.eclipse.swt.widgets.Label l1;
private org.eclipse.swt.widgets.Text txt;
private org.eclipse.swt.widgets.Label l2;
private String[] realm;
protected Control createDialogArea(
org.eclipse.swt.widgets.Composite parent) {
org.eclipse.swt.widgets.Composite p = new org.eclipse.swt.widgets.Composite(
(org.eclipse.swt.widgets.Composite) super
.createDialogArea(parent), SWT.NONE);
Collection<String> fs = getFullRealm();
if (fs.size() == 0) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error",
"Properties list should not be empty.");
return p;
}
p.setLayout(new GridLayout(2, false));
p.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
realm = fs.toArray(new String[fs.size()]);
l1 = new Label(p, SWT.NONE);
l1.setText("Available properties:");
l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
false, true));
combo = new Combo(p, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setItems(realm);
combo.setLayoutData(new GridData(SWT.FILL,
SWT.FILL, true, true));
combo.select(0);
l2 = new Label(p, SWT.NONE);
l2.setText("New name:");
l2.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
false, true));
txt = new org.eclipse.swt.widgets.Text(p,
SWT.BORDER);
txt.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
return p;// p;
}
protected void okPressed() {
int oldS = combo.getSelectionIndex();
if (oldS >= 0) {
String oldSelected = realm[oldS];
String newProp = txt.getText();
if (newProp != null && newProp.length() != 0) {
facade.renameProperty(oldSelected, newProp,
callback);
}
}
super.okPressed();
}
};
tid.create();
// tid.getShell().setSize(350, 200);
tid.setTitle("Parameters dialod");
tid.setMessage("Please choose property and enter new name for it.");
tid.getShell().pack(true);
tid.open();
}
});
mm.add(new Action("Remove property") {
public void run() {
final OperationCallback callback = new OperationCallback() {
public void passed(Object object) {
facade.updateFields();
doRefresh();
}
public void failed(Exception exception) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error", exception
.getMessage());
}
};
TitleAreaDialog tid = new TitleAreaDialog(Display
.getDefault().getActiveShell()) {
private Combo combo;
private org.eclipse.swt.widgets.Label l1;
private String[] realm;
protected Control createDialogArea(
org.eclipse.swt.widgets.Composite parent) {
org.eclipse.swt.widgets.Composite p = new org.eclipse.swt.widgets.Composite(
(org.eclipse.swt.widgets.Composite) super
.createDialogArea(parent), SWT.NONE);
Collection<String> fs = getFullRealm();
if (fs.size() == 0) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error",
"Properties list should not be empty.");
return p;
}
p.setLayout(new GridLayout(2, false));
p.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
realm = fs.toArray(new String[fs.size()]);
l1 = new Label(p, SWT.NONE);
l1.setText("Available properties:");
l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
false, true));
combo = new Combo(p, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL,
SWT.FILL, true, true));
combo.setItems(realm);
combo.select(0);
return p;// p;
}
protected void okPressed() {
int oldS = combo.getSelectionIndex();
if (oldS >= 0) {
String oldSelected = realm[oldS];
facade.removeProperty(oldSelected, callback);
}
super.okPressed();
}
};
tid.create();
// tid.getShell().setSize(350, 190);
tid.setTitle("Parameters dialog");
tid.setMessage("Please choose property for removing.");
tid.getShell().pack(true);
tid.open();
}
});
mm.add(new Action("Make property indexed") {
public void run() {
final Binding binding = new Binding("");
final OperationCallback callback = new OperationCallback() {
public void passed(Object object) {
facade.updateFields();
doRefresh();
}
public void failed(Exception exception) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error", exception
.getMessage());
}
};
TitleAreaDialog tid = new TitleAreaDialog(Display
.getDefault().getActiveShell()) {
private Combo combo;
private org.eclipse.swt.widgets.Label l1;
private String[] realm;
protected Control createDialogArea(
org.eclipse.swt.widgets.Composite parent) {
org.eclipse.swt.widgets.Composite p = new org.eclipse.swt.widgets.Composite(
(org.eclipse.swt.widgets.Composite) super
.createDialogArea(parent), SWT.NONE);
Field[] f = facade.getFields();
ArrayList<String> fs = new ArrayList();
for (Field tmp : f) {
if (!(tmp instanceof PGAEField)
&& !(tmp instanceof CGAEField)) {
if (!tmp.name
.equals(Entity.KEY_RESERVED_PROPERTY)) {
if (tmp.getType() != null
&& (tmp.getType() == Blob.class || tmp
.getType() == Text.class)) {
continue;
}
fs.add(tmp.name);
}
}
}
if (fs.size() == 0) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error",
"Properties list should not be empty.");
return p;
}
p.setLayout(new GridLayout(2, false));
p.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
realm = fs.toArray(new String[fs.size()]);
l1 = new Label(p, SWT.NONE);
l1.setText("Available properties:");
l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
false, true));
combo = new Combo(p, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL,
SWT.FILL, true, true));
combo.setItems(realm);
combo.select(0);
return p;// p;
}
protected void okPressed() {
int oldS = combo.getSelectionIndex();
if (oldS >= 0) {
String selected = realm[oldS];
facade.changeIndexation(selected, false,
callback);
}
super.okPressed();
}
};
tid.create();
// tid.getShell().setSize(350, 170);
tid.setTitle("Parameters dialog");
tid.setMessage("Please choose property which will be marked as 'indexed'");
tid.getShell().pack(true);
tid.open();
}
});
mm.add(new Action("Make property unindexed") {
public void run() {
final Binding binding = new Binding("");
final OperationCallback callback = new OperationCallback() {
public void passed(Object object) {
facade.updateFields();
doRefresh();
}
public void failed(Exception exception) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error", exception
.getMessage());
}
};
TitleAreaDialog tid = new TitleAreaDialog(Display
.getDefault().getActiveShell()) {
private Combo combo;
private org.eclipse.swt.widgets.Label l1;
private String[] realm;
protected Control createDialogArea(
org.eclipse.swt.widgets.Composite parent) {
org.eclipse.swt.widgets.Composite p = new org.eclipse.swt.widgets.Composite(
(org.eclipse.swt.widgets.Composite) super
.createDialogArea(parent), SWT.NONE);
Field[] f = facade.getFields();
ArrayList<String> fs = new ArrayList();
for (Field tmp : f) {
if (!(tmp instanceof PGAEField)) {
if (!tmp.name
.equals(Entity.KEY_RESERVED_PROPERTY)) {
if (tmp.getType() != null
&& (tmp.getType() == Blob.class || tmp
.getType() == Text.class)) {
continue;
}
fs.add(tmp.name);
}
}
}
if (fs.size() == 0) {
MessageDialog.openError(Display.getDefault()
.getActiveShell(), "Error",
"Properties list should not be empty.");
return p;
}
p.setLayout(new GridLayout(2, false));
p.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
realm = fs.toArray(new String[fs.size()]);
l1 = new Label(p, SWT.NONE);
l1.setText("Available properties:");
l1.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
false, true));
combo = new Combo(p, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL,
SWT.FILL, true, true));
combo.setItems(realm);
combo.select(0);
return p;// p;
}
protected void okPressed() {
int oldS = combo.getSelectionIndex();
if (oldS >= 0) {
String selected = realm[oldS];
facade.changeIndexation(selected, true,
callback);
}
super.okPressed();
}
};
tid.create();
// tid.getShell().setSize(350, 170);
tid.setTitle("Parameters dialog");
tid.setMessage("Please choose property which will be marked as 'unindexed'");
tid.getShell().pack(true);
tid.open();
}
});
mm.add(new Action("Set value for property") {
public void run() {