Statistics
| Revision:

root / org.gvsig.hyperlink.app / trunk / org.gvsig.hyperlink.app / org.gvsig.hyperlink.app.extension / src / main / java / org / gvsig / hyperlink / app / extension / actions / FolderFormat.java @ 412

History | View | Annotate | Download (2.82 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.hyperlink.app.extension.actions;
25

    
26
import java.awt.Desktop;
27
import java.io.File;
28
import java.io.IOException;
29
import java.io.Serializable;
30
import java.net.URI;
31
import javax.swing.JOptionPane;
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.hyperlink.app.extension.AbstractActionManager;
34
import org.gvsig.hyperlink.app.extension.AbstractHyperLinkPanel;
35
import org.gvsig.hyperlink.app.extension.LinkTarget;
36
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38

    
39
public class FolderFormat extends AbstractActionManager implements Serializable {
40

    
41
    /**
42
     *
43
     */
44
    private static final long serialVersionUID = 1L;
45
    public static final String actionCode = "Folder_format";
46
    private static Logger logger = LoggerFactory.getLogger(FolderFormat.class);
47

    
48
    public String getActionCode() {
49
        return actionCode;
50
    }
51

    
52
    public boolean hasPanel() {
53
        return false;
54
    }
55

    
56
    public void showDocument(LinkTarget doc) {
57
        File folder = new File(doc.getURL().getPath());
58
        if ( folder.exists() ) {
59
               DesktopApi.browse(doc.getURL());
60
//               DesktopApi.open(folder);
61
//             Desktop desktop = Desktop.getDesktop();
62
//             try {
63
//                desktop.open(folder);
64
//            } catch (IOException e1) {
65
//                logger.error("Can't open folder '" + folder.getAbsolutePath() + "'.", e1);
66
//            }
67

    
68
        } else {
69
            JOptionPane.showMessageDialog(null, PluginServices.getText(this, "Bad_path") + " : " + folder.getAbsolutePath());
70
        }
71
    }
72

    
73
    public String getDescription() {
74
        return PluginServices.getText(this, "Shows_Folders_in_gvSIG");
75
    }
76

    
77
    public String getName() {
78
        return PluginServices.getText(this, "Folder_formats");
79
    }
80

    
81
    public AbstractHyperLinkPanel createPanel(LinkTarget doc)
82
            throws UnsupportedOperationException {
83
        return null;
84
    }
85

    
86
}
87