Revision 43976 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/DefaultProject.java

View differences:

DefaultProject.java
753 753
    public void loadFromState(PersistentState state)
754 754
            throws PersistenceException {
755 755
        this.clean();
756
        PersistentContext context = state.getContext();
757
        
756 758
        notifyObservers(ProjectNotification.BEFORE_LOAD_FROM_STATE, state);
757 759

  
758 760
        this.setComments(state.getString("comments"));
......
780 782
            }
781 783
        }
782 784

  
783
        List<DocumentWindowInfo> persistentWindows = (List<DocumentWindowInfo>) state.get("documentWindowsInformation");
785
        try {
786
            List<DocumentWindowInfo> persistentWindows = (List<DocumentWindowInfo>) state.get("documentWindowsInformation");
784 787

  
785
        for (int i = 0; i < persistentWindows.size(); i++) {
786
            DocumentWindowInfo persistentWindow = persistentWindows.get(i);
787
            String docName = persistentWindow.getDocumentName();
788
            String docType = persistentWindow.getDocumentType();
789
            Document doc = this.getDocument(docName, docType);
790
            IWindow win = doc.getFactory().getMainWindow(doc);
791
            if(win!=null){
792
                win.getWindowInfo().setWindowInfo(persistentWindow.getWindowInfo());
793
                PluginServices.getMDIManager().addWindow(win);
788
            for (int i = 0; i < persistentWindows.size(); i++) {
789
                try {
790
                    DocumentWindowInfo persistentWindow = persistentWindows.get(i);
791
                    String docName = persistentWindow.getDocumentName();
792
                    String docType = persistentWindow.getDocumentType();
793
                    Document doc = this.getDocument(docName, docType);
794
                    IWindow win = doc.getFactory().getMainWindow(doc);
795
                    if(win!=null){
796
                        win.getWindowInfo().setWindowInfo(persistentWindow.getWindowInfo());
797
                        PluginServices.getMDIManager().addWindow(win);
798
                    }
799
                } catch(Exception ex) {
800
                    if( !context.getCollectErrors() ) {
801
                        throw ex;
802
                    }
803
                    context.addError(ex);
804
                }
794 805
            }
795
        }
796 806

  
797
        if (state.hasValue("projectWindowInfo")) {
798
            WindowInfo projectWindowInfo = (WindowInfo) state.get("projectWindowInfo");
799
            ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(org.gvsig.app.extension.ProjectExtension.class);
800
            pe.setProject(this);
801
            pe.showProjectWindow(projectWindowInfo);
807
            if (state.hasValue("projectWindowInfo")) {
808
                WindowInfo projectWindowInfo = (WindowInfo) state.get("projectWindowInfo");
809
                ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(org.gvsig.app.extension.ProjectExtension.class);
810
                pe.setProject(this);
811
                pe.showProjectWindow(projectWindowInfo);
812
            }
813
        } catch(Exception ex) {
814
            if( !context.getCollectErrors() ) {
815
                throw ex;
816
            }
817
            context.addError(ex);
802 818
        }
803 819
        notifyObservers(ProjectNotification.AFTER_LOAD_FROM_STATE, state);
804 820
    }

Also available in: Unified diff