diff -r adea235f456a -r 346e69619e34 java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java
--- a/java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java Sat Aug 18 13:27:00 2012 +0200
+++ b/java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java Sat Aug 18 13:38:58 2012 +0200
@@ -1,26 +1,30 @@
/**
* Rozšířené atributy – program na správu rozšířených atributů souborů
* Copyright © 2012 František Kučera (frantovo.cz)
- *
+ *
* 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
+ * 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 .
+ * along with this program. If not, see .
*/
package cz.frantovo.rozsireneAtributy.jedit;
+import cz.frantovo.rozsireneAtributy.gui.Model;
+import cz.frantovo.rozsireneAtributy.gui.Panel;
+import java.awt.BorderLayout;
+import java.io.File;
+import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
-import javax.swing.JTextArea;
import org.gjt.sp.jedit.Buffer;
import org.gjt.sp.jedit.EBComponent;
import org.gjt.sp.jedit.EBMessage;
@@ -35,12 +39,12 @@
public class DokovatelnyPanel extends JPanel implements EBComponent {
private static final Logger log = Logger.getLogger(DokovatelnyPanel.class.getName());
- private JTextArea pokus = new JTextArea("...");
private View view;
public DokovatelnyPanel(final View view, final String position) {
this.view = view;
- add(pokus);
+ setLayout(new BorderLayout());
+ změňSoubor(view.getBuffer());
}
/**
@@ -86,6 +90,19 @@
}
private void změňSoubor(Buffer b) {
- pokus.setText(b.getPath());
+ try {
+ File s = new File(b.getPath());
+
+ if (s.isFile() && s.canRead()) {
+ Model m = new Model(s);
+ Panel p = new Panel(m);
+ removeAll();
+ add(p, BorderLayout.CENTER);
+ } else {
+ // TODO: zobrazit chybu
+ }
+ } catch (IOException e) {
+ log.log(Level.WARNING, "Chyba při změně souboru.", e);
+ }
}
}