Index: SelectByAttributesInTableExtension.java
===================================================================
--- SelectByAttributesInTableExtension.java	(revision 44010)
+++ SelectByAttributesInTableExtension.java	(revision 44011)
@@ -23,9 +23,6 @@
  */
 package org.gvsig.app.extension;
 
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Iterator;
 
 import javax.swing.JOptionPane;
 
@@ -38,12 +35,6 @@
 import org.gvsig.app.gui.filter.ExpressionListener;
 import org.gvsig.app.gui.filter.FilterDialog;
 import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel;
-import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
-import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
-import org.gvsig.expressionevaluator.swing.Element;
-import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator;
-import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager;
-import org.gvsig.expressionevaluator.swing.JExpressionBuilder;
 import org.gvsig.fmap.dal.DALLocator;
 import org.gvsig.fmap.dal.DataManager;
 import org.gvsig.fmap.dal.exception.DataException;
@@ -54,10 +45,7 @@
 import org.gvsig.fmap.dal.feature.FeatureStore;
 import org.gvsig.i18n.Messages;
 import org.gvsig.tools.dispose.DisposeUtils;
-import org.gvsig.tools.swing.api.ToolsSwingLocator;
-import org.gvsig.tools.swing.api.windowmanager.Dialog;
 import org.gvsig.tools.swing.api.windowmanager.WindowManager;
-import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
 import org.gvsig.utils.exceptionHandling.ExceptionListener;
 
 /**
@@ -65,12 +53,14 @@
  *
  * @author Vicente Caballero Navarro
  */
+@SuppressWarnings("UseSpecificCatch")
 public class SelectByAttributesInTableExtension extends Extension implements ExpressionListener {
 
     protected FeatureStore featureStore = null;
     protected FeatureTableDocumentPanel table;
     private String filterTitle;
 
+    @Override
     public void initialize() {
         registerIcons();
     }
@@ -79,22 +69,23 @@
         IconThemeHelper.registerIcon("action", "selection-by-attributes", this);
     }
 
+    @Override
     public void execute(String actionCommand) {
         IWindow v = PluginServices.getMDIManager().getActiveWindow();
 
         if (!(v instanceof FeatureTableDocumentPanel)) {
             return;
         }
-        if ("selection-by-attributes-table2".equals(actionCommand)) {
+        if ("selection-by-attributes-table".equals(actionCommand)) {
             table = (FeatureTableDocumentPanel) v;
 
             featureStore = table.getModel().getStore();
             filterTitle = table.getModel().getName();
             table.getModel().setModified(true);
-
-            doSelectByAttributes2(filterTitle, featureStore);
+            SelectByAttributes selector = new SelectByAttributes();
+            selector.showWindow(filterTitle, featureStore, WindowManager.MODE.TOOL);
             
-        } else if ("selection-by-attributes-table".equals(actionCommand)) {
+        } else if ("selection-by-attributes-table-old".equals(actionCommand)) {
             table = (FeatureTableDocumentPanel) v;
 
             featureStore = table.getModel().getStore();
@@ -110,6 +101,7 @@
         dlg.addExpressionListener(this);
         dlg.addExceptionListener(new ExceptionListener() {
 
+            @Override
             public void exceptionThrown(Throwable t) {
                 NotificationManager.addError(t.getMessage(), t);
             }
@@ -118,16 +110,19 @@
         PluginServices.getMDIManager().addWindow(dlg);
     }
 
+    @Override
     public boolean isEnabled() {
         return isVisible();
     }
 
+    @Override
     public boolean isVisible() {
         IWindow v = PluginServices.getMDIManager().getActiveWindow();
         return (v instanceof FeatureTableDocumentPanel);
     }
 
     // if no filter expression -> no element selected
+    @Override
     public void newSet(String expression) throws DataException {
         if (!this.filterExpressionFromWhereIsEmpty(expression)) {
             FeatureSet set = null;
@@ -199,9 +194,7 @@
                 }
                 FeatureSelection oldSelection = featureStore.getFeatureSelection();
                 FeatureSelection newSelection = featureStore.createFeatureSelection();
-                Iterator iterator = set.iterator();
-                while (iterator.hasNext()) {
-                    Feature feature = (Feature) iterator.next();
+                for (Feature feature : set) {
                     if (oldSelection.isSelected(feature)) {
                         newSelection.select(feature);
                     }
@@ -279,41 +272,4 @@
         }
         return p.getMessage();
     }
-
-    private void doSelectByAttributes2(String title, final FeatureStore store) {
-        WindowManager_v2 windowManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
-        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
-        ExpressionEvaluatorSwingManager swingManager = ExpressionEvaluatorSwingLocator.getManager();
-
-        final JExpressionBuilder panel = swingManager.createJExpressionBuilder();
-        Element element = swingManager.createElement("DAL.FeatureStoreElement", panel, store);
-        if (element != null) {
-            panel.getElements().add(element);
-        }
-        final Dialog dialog = windowManager.createDialog(
-                panel.asJComponent(),
-                title,
-                null,
-                WindowManager_v2.BUTTONS_OK_CANCEL
-        );
-        dialog.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                if (dialog.getAction() == WindowManager_v2.BUTTON_OK) {
-                    try {
-                        DataManager manager = DALLocator.getDataManager();
-
-                        FeatureQuery query = store.createFeatureQuery();
-                        query.setFilter(manager.createExpresion(panel.getExpression()));
-                        FeatureSet selection = store.getFeatureSet(query);
-                        store.getFeatureSelection().select(selection);
-                    } catch (Exception ex) {
-                        logger.warn("Can't build selecction from filter expression.", ex);
-                    }
-                }
-            }
-        });
-        dialog.show(WindowManager.MODE.WINDOW);
-
-    }
 }
