CompositeEditor bb = new CompositeEditor(bnd);
final InputElementDialog dlg = new InputElementDialog(
bb);
bb.setLayoutManager(new OneElementOnLineLayouter());
CompositeEditor pe = new CompositeEditor();
pe.setLayout(new FillLayout());
OneLineTextElement<String> keyKind = new OneLineTextElement<String>(
kind);
pe.add(keyKind);
bb.add(pe);
CompositeEditor buttons = new CompositeEditor();
buttons.setLayoutManager(new HorizontalLayouter());
ButtonSelector ok = new ButtonSelector();
ok.setText("submit");
ok.setValue(new Runnable() {
public void run() {
kinds[0] = (String) kind.getValue();
dlg.close();
}
});
buttons.add(ok);
bb.add(buttons);
DisposeBindingListener
.linkBindingLifeCycle(bnd, bb);
dlg.open();
d.keyKind = kinds[0];
}
BaseViewer bv = new BaseViewer(action, ui, d
.getProject(), d.keyKind) {
public void selectionChanged(
IStructuredSelection selection) {
if (!selection.isEmpty()) {
Entity firstElement = (Entity) selection
.getFirstElement();
rd.getBinding().setValue(
firstElement.getKey(), null);
}
}
};
bv.createControl(c);
BaseDataFacade createFacade = d.createFacade(d.keyKind,
bv.getRefreshCallback(), bv.getSingleCallback());
String namespace = d.getFacade().getNamespace();
createFacade.setNamespace(namespace);
ui.setFacade(createFacade);
bv.getControl().setLayoutData(
GridDataFactory.fillDefaults().grab(true, true)
.create());
bv.kind = createFacade.getKind();
bv.setDataFacade(createFacade);
return c;
}
};
element.getLayoutHints().setGrabHorizontal(true);
element.getLayoutHints().setGrabVertical(true);
rd.add(element);
rd.getLayoutHints().setGrabHorizontal(true);
rd.getLayoutHints().setGrabVertical(true);
titledDialog.setResizable(true);
titledDialog.open();
return null;
}
public void kindCheck(final String[] kinds) {
Binding bnd = new Binding("Parameters");
final Binding kind = bnd.getBinding("Kind");
kind.addValidator(new ValidatorAdapter<String>() {
public CodeAndMessage isValid(IBinding context,
String object) {
if (object == null || object.length() == 0) {
return CodeAndMessage
.errorMessage("Kind should not be empty");
}
return CodeAndMessage.OK_MESSAGE;
}
});
kind.setReadOnly(false);
kind.setName("Kind for key:");
CompositeEditor bb = new CompositeEditor(bnd);
final TitledDialog dlg = new TitledDialog(bb) {
protected void okPressed() {
kinds[0] = (String) kind.getValue();
super.okPressed();
}
//
// protected void cancelPressed() {
// close();
// kindCheck(kinds);
// }
};
bb.setLayoutManager(new OneElementOnLineLayouter());
CompositeEditor pe = new CompositeEditor();
pe.setLayout(new FillLayout());
OneLineTextElement<String> keyKind = new OneLineTextElement<String>(
kind);
pe.add(keyKind);