# HG changeset patch # User František Kučera # Date 1345289938 -7200 # Node ID bf328b11088110562e128e153f2b9633b3991216 # Parent c20edbed09c32016df4d771a95fec8cd8b3b0a7b První fungující verze doplňku pro jEdit. diff -r c20edbed09c3 -r bf328b110881 java/rozsirene-atributy-jedit/nbproject/project.properties --- a/java/rozsirene-atributy-jedit/nbproject/project.properties Sat Aug 18 13:27:00 2012 +0200 +++ b/java/rozsirene-atributy-jedit/nbproject/project.properties Sat Aug 18 13:38:58 2012 +0200 @@ -33,7 +33,8 @@ jar.compress=false jar.index=${jnlp.enabled} javac.classpath=\ - ${file.reference.jedit.jar} + ${file.reference.jedit.jar}:\ + ${reference.rozsirene-atributy.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false @@ -73,8 +74,7 @@ reference.rozsirene-atributy.jar=${project.rozsirene-atributy}/dist/rozsirene-atributy.jar run.classpath=\ ${javac.classpath}:\ - ${build.classes.dir}:\ - ${reference.rozsirene-atributy.jar} + ${build.classes.dir} # Space-separated list of JVM arguments used when running the project # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value # or test-sys-prop.name=value to set system properties for unit tests): diff -r c20edbed09c3 -r bf328b110881 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); + } } }