Revision 104 org.gvsig.gazetteer/trunk/org.gvsig.gazetteer/org.gvsig.gazetteer.extension/src/main/java/org/gvsig/gazetteer/DeleteSearchesExtension.java

View differences:

DeleteSearchesExtension.java
97 97
 * @autor Jorge Piera Llodr? (piera_jor@gva.es)
98 98
 */
99 99
public class DeleteSearchesExtension extends Extension{
100
	private static Hashtable views = new Hashtable();
101
	
100
	private static Hashtable graphics = new Hashtable();
101

  
102 102
	/*
103 103
	 * (non-Javadoc)
104 104
	 * @see com.iver.andami.plugins.Extension#inicializar()
......
107 107
		// TODO Auto-generated method stub
108 108
		registerIcons();
109 109
	}
110
	
110

  
111 111
	private void registerIcons(){
112 112
        IconThemeHelper.registerIcon("gazetteer", "catalog-clear-point", this);
113 113
	}
......
117 117
	 * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
118 118
	 */
119 119
	public void execute(String actionCommand) {
120
		deteleAllFeatures();		
120
		deteleAllFeatures();
121 121
	}
122 122

  
123 123
	/*
......
135 135
	public boolean isVisible() {
136 136
		org.gvsig.andami.ui.mdiManager.IWindow activeView = PluginServices.getMDIManager()
137 137
		.getActiveWindow();
138
		
138

  
139 139
		if (activeView == null) {
140 140
			return false;
141 141
		}
142
		
142

  
143 143
		if (activeView instanceof AbstractViewPanel){
144
			Boolean bool = (Boolean)views.get(activeView);
144
			GraphicLayer graphicsLayer = ((AbstractViewPanel)activeView).getMapControl().getMapContext().getGraphicsLayer();
145
            Boolean bool = (Boolean)graphics.get(graphicsLayer);
145 146
			if (bool == null){
146 147
				return false;
147 148
			}else{
......
150 151
		}else{
151 152
			return false;
152 153
		}
153
	
154
	
154

  
155

  
155 156
	}
156 157

  
157 158
	/**
......
159 160
	 *
160 161
	 */
161 162
	public static void deteleAllFeatures(){
162
		AbstractViewPanel activeView = 
163
		AbstractViewPanel activeView =
163 164
			(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
164
		GraphicLayer lyr = activeView.getMapControl().getMapContext().getGraphicsLayer();
165
		lyr.clearAllGraphics();
165
		GraphicLayer graphicsLayer = activeView.getMapControl().getMapContext().getGraphicsLayer();
166
		graphicsLayer.clearAllGraphics();
166 167
		activeView.getMapControl().getViewPort().setEnvelope(activeView.getMapControl().getViewPort().getAdjustedExtent());
167
		views.put(activeView,new Boolean(false));
168
		graphics.put(graphicsLayer,new Boolean(false));
168 169
	}
169
	
170

  
170 171
	/**
171 172
	 * Sets the extension enabled
172 173
	 *
173 174
	 */
174 175
	public static void setVisible(){
175
		AbstractViewPanel activeView = 
176
		AbstractViewPanel activeView =
176 177
			(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
177
		views.put(activeView,new Boolean(true));
178
		GraphicLayer graphicsLayer = activeView.getMapControl().getMapContext().getGraphicsLayer();
179
        graphics.put(graphicsLayer,new Boolean(true));
178 180
	}
179 181

  
180 182
}

Also available in: Unified diff