Revision 44088 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java

View differences:

ProjectExtension.java
28 28
import java.awt.image.AffineTransformOp;
29 29
import java.awt.image.BufferedImage;
30 30
import java.io.File;
31
import java.io.FileOutputStream;
32 31
import java.io.IOException;
33 32
import java.text.MessageFormat;
34 33
import java.util.ArrayList;
......
36 35
import java.util.List;
37 36
import java.util.Set;
38 37
import java.util.prefs.Preferences;
39
import java.util.zip.ZipEntry;
40
import java.util.zip.ZipException;
41 38
import java.util.zip.ZipFile;
42
import java.util.zip.ZipOutputStream;
43
import javax.imageio.ImageIO;
44 39

  
45 40
import javax.swing.JOptionPane;
46
import javax.swing.SwingUtilities;
47 41
import org.apache.commons.collections.CollectionUtils;
48
import org.apache.commons.io.IOUtils;
42
import org.apache.commons.io.FilenameUtils;
49 43

  
50 44
import org.slf4j.Logger;
51 45
import org.slf4j.LoggerFactory;
......
62 56
import org.gvsig.andami.PluginsManager;
63 57
import org.gvsig.andami.actioninfo.ActionInfo;
64 58
import org.gvsig.andami.actioninfo.ActionInfoManager;
65
import org.gvsig.andami.messages.NotificationManager;
66 59
import org.gvsig.andami.plugins.Extension;
67 60
import org.gvsig.andami.plugins.IExtension;
68 61
import org.gvsig.andami.plugins.status.IExtensionStatus;
......
85 78
import org.gvsig.tools.dataTypes.DataTypes;
86 79
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
87 80
import org.gvsig.tools.i18n.I18nManager;
88
import org.gvsig.tools.persistence.exception.PersistenceException;
89 81
import org.gvsig.tools.util.ToolsUtilLocator;
90 82
import org.gvsig.utils.GenericFileFilter;
91 83
import org.gvsig.utils.save.AfterSavingListener;
......
195 187
            public OpenInitialProjectTask(File projectFile) {
196 188
                this.projectFile = projectFile;
197 189
            }
190
            @Override
198 191
            public void run() {
199 192
                if (this.projectFile == null) {
200 193
                    return;
......
334 327
		return true;
335 328
	}
336 329

  
330
        @Override
337 331
	public void execute(String command) {
338 332
		this.execute(command, null);
339 333
	}
340 334

  
335
        @Override
341 336
    public void execute(String actionCommand, Object[] args) {
342 337
        if (actionCommand.equals("application-project-new")) {
343 338
            if (!askSave()) {
......
374 369
                GenericFileFilter projExtensionFilter =
375 370
                    new GenericFileFilter(Project.FILE_EXTENSION, PluginServices.getText(this, "tipo_fichero_proyecto"));
376 371
                jfc.addChoosableFileFilter(projExtensionFilter);
372
                GenericFileFilter bakExtensionFilter =
373
                    new GenericFileFilter(Project.FILE_BAK, PluginServices.getText(this, "tipo_fichero_proyecto_bak"));
374
                jfc.addChoosableFileFilter(bakExtensionFilter);
377 375
                jfc.setFileFilter(projExtensionFilter);
378 376

  
379 377
                if (jfc.showOpenDialog((Component) PluginServices.getMainFrame()) != JFileChooser.APPROVE_OPTION) {
......
387 385
            PluginServices.getMDIManager().closeAllWindows();
388 386

  
389 387
            Project o = readProject(projectFile);
390
            setPath(projectFile.getAbsolutePath());
388
            if ("bak".equals(FilenameUtils.getExtension(projectFile.getAbsolutePath()))) {
389
                setPath(null);
390
            } else {
391
                setPath(projectFile.getAbsolutePath());
392
            }
391 393
            // lastPath = getPath();
392 394
            if (o != null) {
393 395
                setProject(o);
......
596 598
		} else {
597 599
            
598 600
        }
599
		return (Project) project;
601
                return (Project) project;
600 602
	}
601 603

  
602 604
	/**
......
658 660
		return getProjectFrame();
659 661
	}
660 662

  
663
        @Override
661 664
	public IExtensionStatus getStatus() {
662 665
		return this;
663 666
	}
664 667

  
668
        @Override
665 669
	public boolean hasUnsavedData() {
666 670
		return p.hasChanged();
667 671
	}
668 672

  
673
        @Override
669 674
	public IUnsavedData[] getUnsavedData() {
670 675
		if (hasUnsavedData()) {
671 676
			UnsavedProject data = new UnsavedProject(this);
......
688 693
			super(extension);
689 694
		}
690 695

  
696
                @Override
691 697
		public String getDescription() {
692 698
			if (getPath() == null) {
693 699
				return PluginServices.getText(ProjectExtension.this,
......
698 704
			}
699 705
		}
700 706

  
707
                @Override
701 708
		public String getResourceName() {
702 709
			if (getPath() == null) {
703 710
				return PluginServices.getText(ProjectExtension.this, "Unnamed");
......
707 714

  
708 715
		}
709 716

  
717
                @Override
710 718
		public boolean saveData() {
711 719
			return saveProject();
712 720
		}
713 721

  
722
                @Override
714 723
		public String getIcon() {
715 724
			return "project-icon";
716 725
		}
717 726
	}
718 727

  
728
        @Override
719 729
	public IMonitorableTask[] getRunningProcesses() {
720 730
		// TODO Auto-generated method stub
721 731
		return null;
722 732
	}
723 733

  
734
        @Override
724 735
	public boolean hasRunningProcesses() {
725 736
		// TODO Auto-generated method stub
726 737
		return false;

Also available in: Unified diff