Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributesInTableExtension.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributesInTableExtension.java	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/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);
-
-    }
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/config.xml
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/config.xml	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/config.xml	(revision 44011)
@@ -694,22 +694,22 @@
                 accelerator=""
             />
             <action
-                name="selection2-by-attributes-table"
-                label="_Select_by_attributes"
+                name="selection-by-attributes-table-old"
+                label="_Select_by_attributes_old"
                 tooltip="_Select_by_attributes"
                 position="300400001"
-                action-command="selection2-by-attributes-table"
+                action-command="selection-by-attributes-table-old"
                 icon="selection-by-attributes"
                 accelerator=""
             />
             <menu
+                name="selection-by-attributes-table-old"
+                text="Selection/_Select_by_attributes_old"
+            />
+            <menu
                 name="selection-by-attributes-table"
                 text="Selection/_Select_by_attributes"
             />
-            <menu
-                name="selection2-by-attributes-table"
-                text="Selection/_Select_by_attributes_new"
-            />
 
             <tool-bar name="table">
                 <action-tool
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text.properties
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text.properties	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text.properties	(revision 44011)
@@ -54,6 +54,7 @@
 locale=Idioma
 locale_XcolonX=Idioma\:
 _Select_by_attributes=Selecci\u00f3n por atributos
+_Select_by_attributes_old=Selecci\u00f3n por atributos (antig\u00fco)
 _Column_information_XcolonX=Informaci\u00f3n de columna\:
 _Select_table_duplicates=Seleccionar duplicados tabla
 _Select_all_duplicates=Seleccionar todos los duplicados
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties	(revision 44011)
@@ -54,6 +54,7 @@
 locale=Locale
 locale_XcolonX=Locale\:
 _Select_by_attributes=Select by attributes
+_Select_by_attributes_old=Select by attributes (old)
 _Column_information_XcolonX=Column information\:
 _Select_table_duplicates=Select table duplicates
 _Select_all_duplicates=Select all duplicates
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml	(revision 44011)
@@ -815,32 +815,32 @@
       active="true">
 
       <action
-        name="selection-by-attributes-layer"
-        label="_Select_by_attributes"
+        name="selection-by-attributes-layer-old"
+        label="_Select_by_attributes_old"
         position="300080000"
         icon="selection-by-attributes"
-        tooltip="_Select_by_attributes"
-        action-command="selection-by-attributes-layer"
+        tooltip="_Select_by_attributes_old"
+        action-command="selection-by-attributes-layer-old"
         accelerator=""
         />
 
       <action
-        name="selection-by-attributes-layer2"
+        name="selection-by-attributes-layer"
         label="_Select_by_attributes"
         position="300080001"
         icon="selection-by-attributes"
         tooltip="_Select_by_attributes"
-        action-command="selection-by-attributes-layer2"
+        action-command="selection-by-attributes-layer"
         accelerator=""
         />
 
       <menu
-        name="selection-by-attributes-layer"
+        name="selection-by-attributes-layer-old"
         text="Selection/_Select_by_attributes_old"
         />
 
       <menu
-        name="selection-by-attributes-layer2"
+        name="selection-by-attributes-layer"
         text="Selection/_Select_by_attributes"
         />
 
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties	(revision 44011)
@@ -1150,6 +1150,10 @@
 _Undo_redo_history=Undo/redo history
 
 _Selection_by_attributes=Selecci\u00f3n por atributos
+_Select_by_attributes_old=Select by attributes )old)
+_Set_selection=Set selection
+_Add_to_selection=Add to selection
+_Filter_selection=Filter selection
 text_editor=Text editor
 first=First
 last=Last
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/i18n/text.properties	(revision 44011)
@@ -1228,6 +1228,10 @@
 _Undo_redo_history=Historial de hacer/deshacer
 
 _Selection_by_attributes=Selecci\u00f3n por atributos
+_Select_by_attributes_old=Selecci\u00f3n por atributos (antig\u00fco)
+_Set_selection=Asignar a la selecci\u00f3n
+_Add_to_selection=A\u00f1adir a la selecci\u00f3n
+_Filter_selection=Filtrar la selecci\u00f3n
 text_editor=Editor de texto
 first=Primero
 last=Ultimo
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/expressionevaluator/ViewElement.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/expressionevaluator/ViewElement.java	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/expressionevaluator/ViewElement.java	(revision 44011)
@@ -7,6 +7,7 @@
 import org.gvsig.expressionevaluator.swing.Element;
 import org.gvsig.expressionevaluator.swing.Element.GroupElement;
 import org.gvsig.expressionevaluator.swing.spi.AbstractElement;
+import org.gvsig.tools.ToolsLocator;
 
 /**
  *
@@ -20,7 +21,7 @@
     private final List<Element> childs;
     
     public ViewElement() {
-        super("View", null, "expressionbuilder-element-view");
+        super(ToolsLocator.getI18nManager().getTranslation("View"), null, "expressionbuilder-element-view");
         this.childs = new ArrayList<>();
         this.childs.add(new ViewCaptureRectangleElement());
         this.childs.add(new ViewCapturePointElement());
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/expressionevaluator/ViewElementFactory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/expressionevaluator/ViewElementFactory.java	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/expressionevaluator/ViewElementFactory.java	(revision 44011)
@@ -1,13 +1,10 @@
 package org.gvsig.app.project.documents.view.expressionevaluator;
 
-import java.net.URL;
 import org.gvsig.andami.IconThemeHelper;
 import org.gvsig.expressionevaluator.swing.Element;
 import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator;
 import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager;
 import org.gvsig.expressionevaluator.swing.spi.AbstractElementFactory;
-import org.gvsig.tools.swing.api.ToolsSwingLocator;
-import org.gvsig.tools.swing.icontheme.IconTheme;
 
 /**
  *
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributes.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributes.java	(revision 0)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributes.java	(revision 44011)
@@ -0,0 +1,150 @@
+package org.gvsig.app.extension;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import org.gvsig.expressionevaluator.Expression;
+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.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.swing.DataSwingManager;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.i18n.I18nManager;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.windowmanager.WindowManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author jjdelcerro
+ */
+@SuppressWarnings("UseSpecificCatch")
+public class SelectByAttributes {
+    
+    private static final Logger LOGGER = LoggerFactory.getLogger(SelectByAttributes.class);
+
+    public SelectByAttributes() {
+        
+    }
+    
+    public void showWindow(String title, final FeatureStore store, WindowManager.MODE mode) {
+        I18nManager i18n = ToolsLocator.getI18nManager();
+        WindowManager windowManager = ToolsSwingLocator.getWindowManager();
+        ExpressionEvaluatorSwingManager swingManager = ExpressionEvaluatorSwingLocator.getManager();
+
+        final JPanel panel = new JPanel();
+        panel.setLayout(new BorderLayout());
+
+        final JExpressionBuilder builder = swingManager.createJExpressionBuilder();
+        builder.addSymbolTable(DataManager.FEATURE_SYMBOL_TABLE);
+        Element element = swingManager.createElement("View");
+        if (element != null) {
+            builder.getElements().add(element);
+        }
+        element = swingManager.createElement(
+                DataSwingManager.FEATURE_STORE_EXPRESSION_ELEMENT,
+                builder,
+                store
+        );
+        if (element != null) {
+            builder.getElements().add(element);
+        }
+        panel.add(builder.asJComponent(), BorderLayout.CENTER);
+        JPanel buttons = new JPanel();
+        buttons.setLayout(new FlowLayout(FlowLayout.RIGHT, 4, 4));
+        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Set_selection")) {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                setSelection(store, builder.getExpression());
+            }
+        }));
+        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Add_to_selection")) {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                addToSelection(store, builder.getExpression());
+            }
+        }));
+        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Filter_selection")) {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                filterSelection(store, builder.getExpression());
+            }
+        }));
+        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Close")) {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                panel.setVisible(false);
+            }
+        }));
+        panel.add(buttons, BorderLayout.SOUTH);
+        
+        windowManager.showWindow(
+                panel,
+                title,
+                mode
+        );
+
+    }
+
+    public void setSelection(FeatureStore store, Expression expression) {
+        try {
+            DataManager manager = DALLocator.getDataManager();
+
+            FeatureSelection currentSelection = store.getFeatureSelection();
+            FeatureQuery query = store.createFeatureQuery();
+            query.setFilter(manager.createExpresion(expression));
+            FeatureSet selection = store.getFeatureSet(query);
+            currentSelection.deselectAll();
+            currentSelection.select(selection);
+        } catch (Exception ex) {
+            LOGGER.warn("Can't build selecction from filter expression.", ex);
+        }
+    }
+
+    public void addToSelection(FeatureStore store, Expression expression) {
+        try {
+            DataManager manager = DALLocator.getDataManager();
+
+            FeatureSelection currentSelection = store.getFeatureSelection();
+            FeatureQuery query = store.createFeatureQuery();
+            query.setFilter(manager.createExpresion(expression));
+            FeatureSet selection = store.getFeatureSet(query);
+            currentSelection.select(selection);
+        } catch (Exception ex) {
+            LOGGER.warn("Can't build selecction from filter expression.", ex);
+        }
+    }
+
+    public void filterSelection(FeatureStore store, Expression expression) {
+        try {
+            DataManager manager = DALLocator.getDataManager();
+
+            FeatureSelection currentSelection = store.getFeatureSelection();
+            FeatureQuery query = store.createFeatureQuery();
+            query.setFilter(manager.createExpresion(expression));
+            FeatureSet set = store.getFeatureSet(query);
+            FeatureSelection newSelection = store.createFeatureSelection();
+            for (Feature feature : set) {
+                if( currentSelection.isSelected(feature) ) {
+                    newSelection.select(feature);
+                }
+            }
+            store.setSelection(newSelection);
+        } catch (Exception ex) {
+            LOGGER.warn("Can't build selecction from filter expression.", ex);
+        }
+    }
+    
+}
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributesExtension.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributesExtension.java	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributesExtension.java	(revision 44011)
@@ -22,15 +22,9 @@
  */
 package org.gvsig.app.extension;
 
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
 import java.util.Iterator;
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
 
 import javax.swing.JOptionPane;
-import javax.swing.JPanel;
 
 import org.gvsig.andami.IconThemeHelper;
 import org.gvsig.andami.PluginServices;
@@ -42,11 +36,6 @@
 import org.gvsig.app.gui.filter.FilterDialog;
 import org.gvsig.app.project.documents.view.ViewDocument;
 import org.gvsig.app.project.documents.view.gui.IView;
-import org.gvsig.expressionevaluator.Expression;
-import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator;
-import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager;
-import org.gvsig.expressionevaluator.swing.JExpressionBuilder;
-import org.gvsig.expressionevaluator.swing.Element;
 import org.gvsig.fmap.dal.DALLocator;
 import org.gvsig.fmap.dal.DataManager;
 import org.gvsig.fmap.dal.exception.DataException;
@@ -55,13 +44,9 @@
 import org.gvsig.fmap.dal.feature.FeatureSelection;
 import org.gvsig.fmap.dal.feature.FeatureSet;
 import org.gvsig.fmap.dal.feature.FeatureStore;
-import org.gvsig.fmap.dal.swing.DataSwingManager;
 import org.gvsig.fmap.mapcontext.layers.FLayer;
 import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
 import org.gvsig.i18n.Messages;
-import org.gvsig.tools.ToolsLocator;
-import org.gvsig.tools.i18n.I18nManager;
-import org.gvsig.tools.swing.api.ToolsSwingLocator;
 import org.gvsig.tools.swing.api.windowmanager.WindowManager;
 import org.gvsig.utils.exceptionHandling.ExceptionListener;
 
@@ -89,16 +74,18 @@
         if (view == null) {
             return;
         }
-        if ("selection-by-attributes-layer2".equals(actionCommand)) {
+        if ("selection-by-attributes-layer".equals(actionCommand)) {
             ViewDocument document = view.getViewDocument();
 
             FLayer layer = document.getMapContext().getLayers().getActives()[0];
             filterTitle = layer.getName();
             featureStore = ((FLyrVect) layer).getFeatureStore();
             document.setModified(true);
-            doSelectByAttributes2(filterTitle, featureStore);
+            SelectByAttributes selector = new SelectByAttributes();
+            selector.showWindow(filterTitle, featureStore, WindowManager.MODE.TOOL);
 
-        } else if ("selection-by-attributes-layer".equals(actionCommand)) {
+
+        } else if ("selection-by-attributes-layer-old".equals(actionCommand)) {
             ViewDocument document = view.getViewDocument();
 
             FLayer layer = document.getMapContext().getLayers().getActives()[0];
@@ -296,113 +283,4 @@
         }
         return p.getMessage();
     }
-
-    private void doSelectByAttributes2(String title, final FeatureStore store) {
-        I18nManager i18n = ToolsLocator.getI18nManager();
-        WindowManager windowManager = ToolsSwingLocator.getWindowManager();
-        ExpressionEvaluatorSwingManager swingManager = ExpressionEvaluatorSwingLocator.getManager();
-
-        final JPanel panel = new JPanel();
-        panel.setLayout(new BorderLayout());
-
-        final JExpressionBuilder builder = swingManager.createJExpressionBuilder();
-        builder.addSymbolTable(DataManager.FEATURE_SYMBOL_TABLE);
-        Element element = swingManager.createElement("View");
-        if (element != null) {
-            builder.getElements().add(element);
-        }
-        element = swingManager.createElement(
-                DataSwingManager.FEATURE_STORE_EXPRESSION_ELEMENT,
-                builder,
-                store
-        );
-        if (element != null) {
-            builder.getElements().add(element);
-        }
-        panel.add(builder.asJComponent(), BorderLayout.CENTER);
-        JPanel buttons = new JPanel();
-        buttons.setLayout(new FlowLayout(FlowLayout.RIGHT, 4, 4));
-        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Set_selection")) {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                doSetSelection(store, builder.getExpression());
-            }
-        }));
-        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Add_to_selection")) {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                doAddToSelection(store, builder.getExpression());
-            }
-        }));
-        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Filter_selection")) {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                doFilterSelection(store, builder.getExpression());
-            }
-        }));
-        buttons.add(new JButton(new AbstractAction(i18n.getTranslation("_Close")) {
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                panel.setVisible(false);
-            }
-        }));
-        panel.add(buttons, BorderLayout.SOUTH);
-        
-        windowManager.showWindow(
-                panel,
-                title,
-                WindowManager.MODE.TOOL
-        );
-
-    }
-
-    private void doSetSelection(FeatureStore store, Expression expression) {
-        try {
-            DataManager manager = DALLocator.getDataManager();
-
-            FeatureSelection currentSelection = store.getFeatureSelection();
-            FeatureQuery query = store.createFeatureQuery();
-            query.setFilter(manager.createExpresion(expression));
-            FeatureSet selection = store.getFeatureSet(query);
-            currentSelection.deselectAll();
-            currentSelection.select(selection);
-        } catch (Exception ex) {
-            logger.warn("Can't build selecction from filter expression.", ex);
-        }
-    }
-
-    private void doAddToSelection(FeatureStore store, Expression expression) {
-        try {
-            DataManager manager = DALLocator.getDataManager();
-
-            FeatureSelection currentSelection = store.getFeatureSelection();
-            FeatureQuery query = store.createFeatureQuery();
-            query.setFilter(manager.createExpresion(expression));
-            FeatureSet selection = store.getFeatureSet(query);
-            currentSelection.select(selection);
-        } catch (Exception ex) {
-            logger.warn("Can't build selecction from filter expression.", ex);
-        }
-    }
-
-    private void doFilterSelection(FeatureStore store, Expression expression) {
-        try {
-            DataManager manager = DALLocator.getDataManager();
-
-            FeatureSelection currentSelection = store.getFeatureSelection();
-            FeatureQuery query = store.createFeatureQuery();
-            query.setFilter(manager.createExpresion(expression));
-            FeatureSet set = store.getFeatureSet(query);
-            FeatureSelection newSelection = store.createFeatureSelection();
-            for (Feature feature : set) {
-                if( currentSelection.isSelected(feature) ) {
-                    newSelection.select(feature);
-                }
-            }
-            store.setSelection(newSelection);
-        } catch (Exception ex) {
-            logger.warn("Can't build selecction from filter expression.", ex);
-        }
-    }
-
 }
Index: trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.swing/org.gvsig.expressionevaluator.swing.api/src/main/java/org/gvsig/expressionevaluator/swing/spi/AbstractElementFactory.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.swing/org.gvsig.expressionevaluator.swing.api/src/main/java/org/gvsig/expressionevaluator/swing/spi/AbstractElementFactory.java	(revision 44010)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.swing/org.gvsig.expressionevaluator.swing.api/src/main/java/org/gvsig/expressionevaluator/swing/spi/AbstractElementFactory.java	(revision 44011)
@@ -1,8 +1,5 @@
 package org.gvsig.expressionevaluator.swing.spi;
 
-import java.util.HashMap;
-import java.util.Map;
-import org.gvsig.expressionevaluator.swing.Element;
 import org.gvsig.expressionevaluator.swing.ElementFactory;
 import org.gvsig.tools.ToolsLocator;
 import org.gvsig.tools.i18n.I18nManager;
