Revision 38564 branches/v2_0_0_prep/extensions/extExpressionField/src/org/gvsig/expressionfield/ExpressionFieldExtension.java

View differences:

ExpressionFieldExtension.java
5 5
import java.util.Iterator;
6 6

  
7 7
import javax.swing.JOptionPane;
8
import javax.swing.plaf.OptionPaneUI;
9 8

  
10 9
import org.apache.bsf.BSFManager;
11
import org.slf4j.Logger;
12
import org.slf4j.LoggerFactory;
13

  
10
import org.gvsig.andami.IconThemeHelper;
14 11
import org.gvsig.andami.PluginServices;
15 12
import org.gvsig.andami.messages.NotificationManager;
16 13
import org.gvsig.andami.plugins.Extension;
......
78 75
import org.gvsig.tools.ToolsLocator;
79 76
import org.gvsig.tools.extensionpoint.ExtensionPoint;
80 77
import org.gvsig.utils.swing.threads.AbstractMonitorableTask;
78
import org.slf4j.Logger;
79
import org.slf4j.LoggerFactory;
81 80

  
82 81
/**
83 82
 * @author Vicente Caballero Navarro
......
97 96
	}
98 97

  
99 98
	public void execute(String actionCommand) {
100
		org.gvsig.andami.ui.mdiManager.IWindow window = PluginServices.getMDIManager().getActiveWindow();
101
		table=(FeatureTableDocumentPanel)window;
102
		if (!table.getModel().getStore().isEditing()){
103
			int option=JOptionPane.showConfirmDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"is_not_in_editing_are_you_sure"));
104
			if (option != JOptionPane.OK_OPTION){
105
				return;
99
		if( "table-expression-field".equalsIgnoreCase(actionCommand) ) {
100
	 		org.gvsig.andami.ui.mdiManager.IWindow window = PluginServices.getMDIManager().getActiveWindow();
101
			table=(FeatureTableDocumentPanel)window;
102
			if (!table.getModel().getStore().isEditing()){
103
				int option=JOptionPane.showConfirmDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this,"is_not_in_editing_are_you_sure"));
104
				if (option != JOptionPane.OK_OPTION){
105
					return;
106
				}
106 107
			}
108
			if (operators.isEmpty()) {
109
				PluginServices.cancelableBackgroundExecution(new EvalOperatorsTask());
110
	        }else{
111
	        	 EvalExpressionDialog eed=new EvalExpressionDialog(table,interpreter,operators);
112
			     PluginServices.getMDIManager().addWindow(eed);
113
	        }
107 114
		}
108
		if (operators.isEmpty()) {
109
			PluginServices.cancelableBackgroundExecution(new EvalOperatorsTask());
110
        }else{
111
        	 EvalExpressionDialog eed=new EvalExpressionDialog(table,interpreter,operators);
112
		     PluginServices.getMDIManager().addWindow(eed);
113
        }
114 115
	}
115 116
	public void postInitialize() {
116 117

  
......
207 208
	}
208 209

  
209 210
	 private void registerIcons(){
210
		 PluginServices.getIconTheme().registerDefault(
211
					"ext-kcalc",
212
					this.getClass().getClassLoader().getResource("images/kcalc.png")
213
				);
214

  
215
		 PluginServices.getIconTheme().registerDefault(
216
					"field-expression-kcalc",
217
					this.getClass().getClassLoader().getResource("images/FieldExpression.png")
218
				);
211
		 IconThemeHelper.registerIcon("action", "table-expression-field", this);
212
		 IconThemeHelper.registerIcon("action", "expression-field-preferences", this);
219 213
	 }
220 214

  
221 215
	 private class EvalOperatorsTask extends AbstractMonitorableTask{

Also available in: Unified diff