@Override
public void runWithEvent(Event event) {
Tree tree = getTreeViewer().getTree();
TreeItem[] items = tree.getSelection();
Interpolation interpolation = null;
for (int i=0; i<items.length; i++) {
TreeItem item = items[i];
if (item.getData() instanceof Interpolation) {
interpolation = (Interpolation) item.getData();
try {
SelectionDialog sd = JavaUI.createTypeDialog(new Shell(), null, SearchEngine.createWorkspaceScope(),
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES, false);
sd.open();
Object[] objects = sd.getResult();
if (null != objects && objects.length > 0) {
ConfigurationManager configuration = ConfigurationManager.getInstance(interpolation.getResource().getProject());
IType type = (IType) objects[0];
try {
configuration.addContextValue(
new ContextValue(interpolation.getFirstToken(),
configuration.getClass(type.getFullyQualifiedName()), null), interpolation.getResource());
}
catch (ClassNotFoundException e) {
Plugin.log(e);
}
}