final Layer layer = (Layer) adaptableFeature.getAdapter(Layer.class);
IDrawCommand command = DrawCommandFactory.getInstance().createDrawFeatureCommand(feature,
layer);
ViewportPane pane = (ViewportPane) layer.getMapInternal().getRenderManager()
.getMapDisplay();
pane.addDrawCommand(command);
PlatformGIS.syncInDisplayThread(PlatformUI.getWorkbench().getDisplay(), new Runnable(){
public void run() {
boolean result;
result = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay()
.getActiveShell(), Messages.DeleteFeature_confirmation_title,
Messages.DeleteFeature_confirmation_text);
if (result) {
UndoableMapCommand c = EditCommandFactory.getInstance().createDeleteFeature(
feature, layer);
executeCommand(c, layer.getMap());
}
}
});
command.setValid(false);
pane.repaint();
}