Revision 41311 trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/Launcher.java

View differences:

Launcher.java
697 697
		/*
698 698
		 * Executes additional tasks required by plugins
699 699
		 */
700
		PluginsLocator.getManager().executeAdditionalTasks();
700
		PluginsLocator.getManager().executeOnStartupTasks();
701 701

  
702 702
	}
703 703
	
......
952 952
		theme.setDefaultIcon(loader.getResource("images/main/default-icon.png" ));
953 953
	}
954 954

  
955
        private Properties loadProperties(File f) {
956
            FileInputStream fin = null;
957
            Properties p = null;
958
            try {
959
                fin = new FileInputStream(f);
960
                p = new Properties();
961
                p.load(fin);
962
            } catch (IOException ex) {
963
                // Do nothing
964
            }
965
            return p;
966
        }
967
        
955 968
	/**
956 969
	 * Obtiene la personalizaci�n de los iconos, splash, fondo y el nombre de la
957 970
	 * aplicaci�n.
......
959 972
	 * @return Theme
960 973
	 */
961 974
	private Theme getTheme(String pluginsDirectory) {
962
		File themeFile = null;
963
		Theme theme = new Theme();
975
            File infoFile = new File(Launcher.getApplicationFolder(),"package.info");
976
            File themeFile = null;
977
            Theme theme = new Theme(loadProperties(infoFile));
964 978

  
965 979
		// Try to get theme from args
966 980
		String name = PluginServices.getArgumentByName("andamiTheme");
......
3050 3064
        ClassLoader i18nClassLoader = new URLClassLoader(i18nURLs);
3051 3065
        org.gvsig.i18n.Messages.addResourceFamily("text", i18nClassLoader,
3052 3066
                "Andami Launcher");
3067
        
3053 3068

  
3054 3069
        // Los ficheros de traducciones estan ahora fuera del jar, en la
3055 3070
        // Carpeta i18n/andami de la instalacion, asi que esto ya no hace falta.
......
3221 3236
		 * Finishes the application without asking user if want or not to save
3222 3237
		 * unsaved data.
3223 3238
		 */
3224
		public void closeAndami() {
3225
			try {
3226
				saveAndamiConfig();
3227
			} catch (Exception ex) {
3228
				logger
3229
						.error(
3230
								"There was an error exiting application, can't save andami-config.xml",
3231
								ex);
3232
			}
3239
            public void closeAndami() {
3240
                PluginsManager pluginsManager = PluginsLocator.getManager();
3241
                pluginsManager.executeOnShutdownTasks();
3233 3242

  
3234
			try {
3235
				// Persistencia de los plugins
3236
				savePluginPersistence();
3237
				savePluginsProperties();
3238
			} catch (Exception ex) {
3239
				logger
3240
						.error(
3241
								"There was an error exiting application, can't save plugins properties",
3242
								ex);
3243
			}
3243
                try {
3244
                    saveAndamiConfig();
3245
                } catch (Exception ex) {
3246
                    logger.error(
3247
                            "There was an error exiting application, can't save andami-config.xml",
3248
                            ex
3249
                    );
3250
                }
3244 3251

  
3245
			// Finalize all the extensions
3246
			finalizeExtensions();
3252
                try {
3253
                    // Persistencia de los plugins
3254
                    savePluginPersistence();
3255
                    savePluginsProperties();
3256
                } catch (Exception ex) {
3257
                    logger.error(
3258
                            "There was an error exiting application, can't save plugins properties",
3259
                            ex
3260
                    );
3261
                }
3247 3262

  
3248
			try {
3249
				// Clean any temp data created
3250
				Utilities.cleanUpTempFiles();
3251
			} catch (Exception ex) {
3252
				logger
3253
						.error(
3254
								"There was an error exiting application, can't remove temporary files",
3255
								ex);
3256
			}
3263
                // Finalize all the extensions
3264
                finalizeExtensions();
3257 3265

  
3258
			logger.info("Quiting application.");
3266
                try {
3267
                    // Clean any temp data created
3268
                    Utilities.cleanUpTempFiles();
3269
                } catch (Exception ex) {
3270
                    logger.error(
3271
                            "There was an error exiting application, can't remove temporary files",
3272
                            ex
3273
                    );
3274
                }
3259 3275

  
3260
			// Para la depuraci�n de memory leaks
3261
			System.gc();
3276
                logger.info("Quiting application.");
3262 3277

  
3263
			System.exit(0);
3264
		}
3278
                // Para la depuraci�n de memory leaks
3279
                System.gc();
3265 3280

  
3266
		/**
3267
         * 
3268
         */
3281
                System.exit(0);
3282
            }
3283

  
3269 3284
		public void saveAndamiConfig() {
3270 3285
			// Configuraci�n de Andami
3271 3286
			try {

Also available in: Unified diff