Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / toc / actions / ChangeNameTocMenuEntry.java @ 40558

History | View | Annotate | Download (3.9 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.app.project.documents.view.toc.actions;
25

    
26
import org.gvsig.andami.PluginServices;
27
import org.gvsig.app.extension.ProjectExtension;
28
import org.gvsig.app.project.Project;
29
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction;
30
import org.gvsig.app.project.documents.view.toc.ITocItem;
31
import org.gvsig.app.project.documents.view.toc.gui.ChangeName;
32
import org.gvsig.fmap.mapcontext.layers.FLayer;
33

    
34

    
35

    
36
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
37
 *
38
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
39
 *
40
 * This program is free software; you can redistribute it and/or
41
 * modify it under the terms of the GNU General Public License
42
 * as published by the Free Software Foundation; either version 2
43
 * of the License, or (at your option) any later version.
44
 *
45
 * This program is distributed in the hope that it will be useful,
46
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
48
 * GNU General Public License for more details.
49
 *
50
 * You should have received a copy of the GNU General Public License
51
 * along with this program; if not, write to the Free Software
52
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
53
 *
54
 * For more information, contact:
55
 *
56
 *  Generalitat Valenciana
57
 *   Conselleria d'Infraestructures i Transport
58
 *   Av. Blasco Ib??ez, 50
59
 *   46010 VALENCIA
60
 *   SPAIN
61
 *
62
 *      +34 963862235
63
 *   gvsig@gva.es
64
 *      www.gvsig.gva.es
65
 *
66
 *    or
67
 *
68
 *   IVER T.I. S.A
69
 *   Salamanca 50
70
 *   46005 Valencia
71
 *   Spain
72
 *
73
 *   +34 963163400
74
 *   dac@iver.es
75
 */
76
/* CVS MESSAGES:
77
 *
78
 * $Id: ChangeNameTocMenuEntry.java 29598 2009-06-29 16:09:14Z jpiera $
79
 * $Log$
80
 * Revision 1.2  2007-01-04 07:24:31  caballero
81
 * isModified
82
 *
83
 * Revision 1.1  2006/09/15 10:41:30  caballero
84
 * extensibilidad de documentos
85
 *
86
 * Revision 1.1  2006/09/12 15:58:14  jorpiell
87
 * "Sacadas" las opcines del men? de FPopupMenu
88
 *
89
 *
90
 */
91
/**
92
 * Realiza un cambio de nombre en la capa seleccionada
93
 *
94
 * @author Vicente Caballero Navarro
95
 */
96
public class ChangeNameTocMenuEntry extends AbstractTocContextMenuAction {
97
        public String getGroup() {
98
                return "group1"; //FIXME
99
        }
100

    
101
        public int getGroupOrder() {
102
                return 10;
103
        }
104

    
105
        public int getOrder() {
106
                return 1;
107
        }
108

    
109
        public String getText() {
110
                return PluginServices.getText(this, "cambio_nombre");
111
        }
112

    
113
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
114
                return selectedItems.length == 1;
115
        }
116

    
117
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
118
                return isTocItemBranch(item);
119
        }
120

    
121

    
122
        public void execute(ITocItem item, FLayer[] selectedItems) {
123
                FLayer lyr = getNodeLayer(item);
124
                if (!lyr.isAvailable()) return;
125
                ChangeName chn=new ChangeName(lyr.getName());
126
                PluginServices.getMDIManager().addWindow(chn);
127
                lyr.setName(chn.getName());
128
                Project project=((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject();
129
                project.setModified(true);
130
        }
131
}