Revision 6461 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/CopyPasteLayersExtension.java

View differences:

CopyPasteLayersExtension.java
92 92

  
93 93
	public void initialize(FPopupMenu m) {
94 94
		super.initialize(m);
95
		getMenu().addSeparator();
95
		if (getMenu().getComponentCount() > 0) {
96
			getMenu().addSeparator();
97
		}
96 98
		properties = addMenuEntry(PluginServices.getText(this, "copiar"));
97 99
				
98 100
		FLayer[] actives = getMapContext().getLayers().getActives();
99
		if (actives.length >= 1) {
101
		if (actives.length >= 1 && isTocItemBranch()) {
100 102
			properties.setEnabled(true);				
101 103
		} else {
102 104
			properties.setEnabled(false);
......
142 144
		properties = addMenuEntry(PluginServices.getText(this, "cortar"));
143 145
		
144 146
		FLayer[] actives = getMapContext().getLayers().getActives();
145
		if (actives.length >=1) {
147
		if (actives.length >=1 && isTocItemBranch()) {
146 148
			properties.setEnabled(true);				
147 149
		} else {
148 150
			properties.setEnabled(false);
......
209 211
	
210 212

  
211 213
	public void initialize(FPopupMenu m) {
212
		super.initialize(m);			
213
		properties = new JMenuItem(PluginServices.getText(this, "pegar"));
214
		super.initialize(m);
215
		properties = addMenuEntry(PluginServices.getText(this, "pegar"));
214 216
		
215
		properties.setFont(FPopupMenu.theFont);
216
		
217
		properties.addActionListener(this);
218
		getMenu().add( properties );
219
		//getMenu().addSeparator();
220

  
221 217
		if (isTocItemBranch()) {
222 218
			FLayer lyr = getNodeLayer();
223 219
			if (lyr instanceof FLayers) {
......
229 225
			
230 226
		} else if (isTocItemLeaf()) {
231 227
			properties.setEnabled(false);
232
		}
228
		} else {
229
			if (getNodeLayer() == null) {
230
				this.xml = this.getCheckedXMLFromClipboard();
231
				properties.setEnabled((this.xml != null));
232
			}
233
		}		
233 234

  
234 235
	}
235 236
	
......
252 253
		
253 254
		if (isTocItemBranch()) {
254 255
			root = (FLayers)getNodeLayer();
256
		} else if (getNodeLayer() == null){
257
			root = getMapContext().getLayers();
255 258
		} else {
256
			root = getMapContext().getLayers();
259
			return;
257 260
		}
258 261
		getMapContext().beginAtomicEvent();
259 262
		

Also available in: Unified diff