Spouštěcí skript a zpracování chyb.
1 package cz.frantovo.rozsireneAtributy;
3 import cz.frantovo.rozsireneAtributy.gui.Panel;
4 import java.awt.BorderLayout;
6 import java.io.IOException;
7 import java.util.logging.Level;
8 import java.util.logging.Logger;
9 import javax.swing.JFrame;
10 import javax.swing.JOptionPane;
15 * http://freedesktop.org/wiki/CommonExtendedAttributes
16 * http://download.oracle.com/javase/tutorial/essential/io/fileAttr.html#user
17 * http://today.java.net/pub/a/today/2008/07/03/jsr-203-new-file-apis.html#so-what-is-a-path-really
19 * $ setfattr -n "user.fiki.pozdrav" -v 'Dobrý den!' pokus.txt
20 * (v javě pak pracujeme s klíči bez předpony „user.“)
24 public class Startér {
26 private static final Logger log = Logger.getLogger(Startér.class.getSimpleName());
28 public static void main(String[] args) throws IOException {
30 if (args.length == 1 && args[0].length() > 0) {
31 File soubor = new File(args[0]);
33 if (soubor.exists()) {
34 log.log(Level.INFO, "Pracuji se souborem: {0}", soubor);
36 Model model = new Model(soubor);
38 JFrame f = new JFrame();
39 Panel p = new Panel(model);
41 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
42 f.setTitle("Rozšířené stributy souboru: " + soubor);
43 f.setLayout(new BorderLayout());
44 f.add(p, BorderLayout.CENTER);
47 f.setLocationRelativeTo(null);
50 ukončiChybou("Soubor neexistuje: " + soubor);
53 ukončiChybou("Očekávám právě jeden parametr – název souboru.");
57 private static void ukončiChybou(String hláška) {
58 log.log(Level.SEVERE, hláška);
59 JOptionPane.showMessageDialog(null, hláška, "Chyba", JOptionPane.ERROR_MESSAGE);