java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java
changeset 23 69f49b79342e
parent 22 bf06eb899671
child 26 1d345074992c
     1.1 --- a/java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java	Sun Oct 07 15:11:42 2012 +0200
     1.2 +++ b/java/rozsirene-atributy-jedit/src/cz/frantovo/rozsireneAtributy/jedit/DokovatelnyPanel.java	Sun Oct 07 16:15:00 2012 +0200
     1.3 @@ -40,6 +40,7 @@
     1.4  
     1.5  	private static final Logger log = Logger.getLogger(DokovatelnyPanel.class.getName());
     1.6  	private View view;
     1.7 +	private Panel panel;
     1.8  
     1.9  	public DokovatelnyPanel(final View view, final String position) {
    1.10  		this.view = view;
    1.11 @@ -95,9 +96,15 @@
    1.12  
    1.13  			if (s.isFile() && s.canRead()) {
    1.14  				Model m = new Model(s);
    1.15 -				Panel p = new Panel(m);
    1.16 -				removeAll();
    1.17 -				add(p, BorderLayout.CENTER);
    1.18 +
    1.19 +				if (panel == null) {
    1.20 +					panel = new Panel(m);
    1.21 +					removeAll();
    1.22 +					add(panel, BorderLayout.CENTER);
    1.23 +				} else {
    1.24 +					panel.setModel(m);
    1.25 +				}
    1.26 +
    1.27  			} else {
    1.28  				// TODO: zobrazit chybu
    1.29  				log.log(Level.WARNING, "Soubor neexistuje nebo nemáme práva na čtení: {0}", s);