/*
* Copyright (C) 2014 Vinu K.N
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.domainmath.gui.Util;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.filechooser.FileView;
public class ScriptFileView extends FileView {
ImageIcon iconMScript = new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/mime/mscript.png"));
ImageIcon iconHpp = new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/mime/mscript.png"));
ImageIcon iconCpp= new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/mime/mscript.png"));
ImageIcon iconCxx = new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/mime/mscript.png"));
ImageIcon iconFortran = new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/mime/fortran.png"));
@Override
public String getName(File f) {
return null;
}
@Override
public String getDescription(File f) {
return null;
}
@Override
public Boolean isTraversable(File f) {
return null;
}
@Override
public String getTypeDescription(File f) {
String type = "Script";
return type;
}
@Override
public ImageIcon getIcon(File f) {
String name= f.getName();
if(name.endsWith(".m")){
return iconMScript;
}else if(name.endsWith(".cpp")){
return iconCpp;
}else if(name.endsWith(".c")){
return iconCxx;
}else if(name.endsWith(".h")){
return iconHpp;
}else if(name.endsWith(".f") ||
name.endsWith(".f90")){
return iconFortran;
}
return null;
}
}