1 /* 2 * Copyright (c) 2008-2019 Emmanuel Dupuy. 3 * This project is distributed under the GPLv3 license. 4 * This is a Copyleft license that gives the user the right to use, 5 * copy and modify the code freely for non-commercial purposes. 6 */ 7 8 package org.jd.gui.service.fileloader; 9 10 import org.jd.gui.api.API; 11 import org.jd.gui.util.io.TextReader; 12 import org.jd.gui.view.component.LogPage; 13 14 import java.io.File; 15 16 public class LogFileLoaderProvider extends ZipFileLoaderProvider { 17 protected static final String[] EXTENSIONS = { "log" }; 18 getExtensions()19 @Override public String[] getExtensions() { return EXTENSIONS; } getDescription()20 @Override public String getDescription() { return "Log files (*.log)"; } 21 22 @Override accept(API api, File file)23 public boolean accept(API api, File file) { 24 return file.exists() && file.isFile() && file.canRead() && file.getName().toLowerCase().endsWith(".log"); 25 } 26 27 @Override load(API api, File file)28 public boolean load(API api, File file) { 29 api.addPanel(file.getName(), null, "Location: " + file.getAbsolutePath(), new LogPage(api, file.toURI(), TextReader.getText(file))); 30 return true; 31 } 32 } 33