Revision 42200
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/wizard/UnsavedDataPanel.java | ||
---|---|---|
37 | 37 |
import java.awt.event.MouseListener; |
38 | 38 |
import java.awt.image.BufferedImage; |
39 | 39 |
import java.util.ArrayList; |
40 |
import java.util.Arrays; |
|
40 | 41 |
import java.util.Iterator; |
42 |
import java.util.List; |
|
41 | 43 |
|
42 | 44 |
import javax.swing.BorderFactory; |
43 | 45 |
import javax.swing.ImageIcon; |
... | ... | |
84 | 86 |
private JLabel lblResourceDescription = null; |
85 | 87 |
private IUnsavedData[] unsavedDataList; |
86 | 88 |
private String windowTitle = PluginServices.getText(this, "save_resources"); |
89 |
private String prompt = PluginServices.getText(this, "select_resources_to_save_before_exit"); |
|
87 | 90 |
|
88 | 91 |
|
89 | 92 |
|
... | ... | |
96 | 99 |
this.setUnsavedDataArray(unsavedDatalist); |
97 | 100 |
} |
98 | 101 |
|
102 |
public UnsavedDataPanel(String prompt) { |
|
103 |
super(); |
|
104 |
initialize(); |
|
105 |
this.setUnsavedDataArray(new IUnsavedData[0]); |
|
106 |
this.prompt = prompt; |
|
107 |
} |
|
108 |
|
|
109 |
|
|
99 | 110 |
/** |
100 | 111 |
* This method initializes this |
101 | 112 |
* |
... | ... | |
107 | 118 |
borderLayout.setVgap(5); |
108 | 119 |
lblDescription = new JLabel(); |
109 | 120 |
lblDescription.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
110 |
lblDescription.setText(PluginServices.getText(this, "select_resources_to_save_before_exit"));
|
|
121 |
lblDescription.setText(prompt);
|
|
111 | 122 |
lblDescription.setPreferredSize(new Dimension(497, 30)); |
112 | 123 |
lblDescription.setName("lblDescription"); |
113 | 124 |
this.setLayout(borderLayout); |
... | ... | |
253 | 264 |
*/ |
254 | 265 |
private JPanel getPActionButtons() { |
255 | 266 |
if (pActionButtons == null) { |
256 |
|
|
267 |
|
|
257 | 268 |
GridLayout gl = new GridLayout(1, 3, 8, 0); |
258 | 269 |
/* |
259 | 270 |
FlowLayout flowLayout = new FlowLayout(); |
... | ... | |
293 | 304 |
pSelectionButtons.add(getBotDeselectAll()); |
294 | 305 |
pSelectionButtons.add(new JLabel()); |
295 | 306 |
pSelectionButtons.add(new JLabel()); |
296 |
|
|
307 |
|
|
297 | 308 |
} |
298 | 309 |
return pSelectionButtons; |
299 | 310 |
} |
... | ... | |
646 | 657 |
|
647 | 658 |
} |
648 | 659 |
|
660 |
/** |
|
661 |
* Set the resorces to ask for |
|
662 |
* |
|
663 |
* @param IUnsavedData[] resources pending to save |
|
664 |
*/ |
|
665 |
public void setUnsavedData(List<IUnsavedData> unsavedDatalist){ |
|
666 |
setUnsavedDataArray(unsavedDatalist.toArray(new IUnsavedData[0])); |
|
667 |
} |
|
649 | 668 |
|
669 |
public List<IUnsavedData> getSelectedsUnsavedDataList(){ |
|
670 |
return Arrays.asList(this.getSelectedsUnsavedData()); |
|
671 |
} |
|
672 |
|
|
650 | 673 |
private IUnsavedData[] getUnsavedData(boolean selected){ |
651 | 674 |
int i; |
652 | 675 |
myList theList = getList(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/Launcher.java | ||
---|---|---|
89 | 89 |
import javax.swing.SwingUtilities; |
90 | 90 |
import javax.swing.UIManager; |
91 | 91 |
|
92 |
import com.jgoodies.looks.windows.WindowsLookAndFeel; |
|
93 |
|
|
92 | 94 |
import org.apache.commons.cli.CommandLine; |
93 | 95 |
import org.apache.commons.cli.CommandLineParser; |
94 | 96 |
import org.apache.commons.cli.Options; |
... | ... | |
107 | 109 |
import org.apache.log4j.spi.ThrowableInformation; |
108 | 110 |
import org.exolab.castor.xml.MarshalException; |
109 | 111 |
import org.exolab.castor.xml.ValidationException; |
112 |
|
|
110 | 113 |
import org.gvsig.andami.actioninfo.ActionInfo; |
111 | 114 |
import org.gvsig.andami.actioninfo.ActionInfoManager; |
112 | 115 |
import org.gvsig.andami.config.generate.Andami; |
113 | 116 |
import org.gvsig.andami.config.generate.AndamiConfig; |
114 | 117 |
import org.gvsig.andami.config.generate.Plugin; |
118 |
import org.gvsig.andami.impl.UnsavedDataException; |
|
115 | 119 |
import org.gvsig.andami.messages.Messages; |
116 | 120 |
import org.gvsig.andami.messages.NotificationManager; |
117 | 121 |
import org.gvsig.andami.persistence.serverData.ServerDataPersistence; |
... | ... | |
150 | 154 |
import org.gvsig.andami.ui.splash.MultiSplashWindow; |
151 | 155 |
import org.gvsig.andami.ui.theme.Theme; |
152 | 156 |
import org.gvsig.andami.ui.wizard.UnsavedDataPanel; |
157 |
import org.gvsig.andami.ui.wizard.UnsavedDataPanel.UnsavedDataPanelListener; |
|
153 | 158 |
import org.gvsig.installer.lib.api.Dependencies; |
154 | 159 |
import org.gvsig.installer.lib.api.Dependency; |
155 | 160 |
import org.gvsig.installer.lib.api.InstallerLocator; |
... | ... | |
164 | 169 |
import org.gvsig.tools.exception.ListBaseException; |
165 | 170 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
166 | 171 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
172 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE; |
|
167 | 173 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
168 | 174 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
169 | 175 |
import org.gvsig.tools.util.FolderSet; |
... | ... | |
173 | 179 |
import org.gvsig.utils.XMLEntity; |
174 | 180 |
import org.gvsig.utils.xml.XMLEncodingUtils; |
175 | 181 |
import org.gvsig.utils.xmlEntity.generate.XmlTag; |
182 |
|
|
176 | 183 |
import org.slf4j.Logger; |
177 | 184 |
import org.slf4j.LoggerFactory; |
178 | 185 |
|
... | ... | |
2995 | 3002 |
} |
2996 | 3003 |
localeStr = normalizeLanguageCode(localeStr); |
2997 | 3004 |
locale = getLocale( |
2998 |
localeStr,
|
|
3005 |
localeStr, |
|
2999 | 3006 |
andamiConfig.getLocaleCountry(), |
3000 | 3007 |
andamiConfig.getLocaleVariant() |
3001 | 3008 |
); |
... | ... | |
3186 | 3193 |
} |
3187 | 3194 |
} |
3188 | 3195 |
|
3196 |
public static void manageUnsavedData(String prompt) throws Exception { |
|
3197 |
final UnsavedDataPanel panel = new UnsavedDataPanel(prompt); |
|
3198 |
final List <IUnsavedData> unsavedData = PluginsLocator.getManager().getUnsavedData(); |
|
3199 |
panel.setUnsavedData(unsavedData); |
|
3200 |
|
|
3201 |
panel.addActionListener(panel.new UnsavedDataPanelListener() { |
|
3202 |
|
|
3203 |
public void cancel(UnsavedDataPanel panel) { |
|
3204 |
panel.setVisible(false); |
|
3205 |
} |
|
3206 |
|
|
3207 |
public void discard(UnsavedDataPanel panel) { |
|
3208 |
panel.setVisible(false); |
|
3209 |
} |
|
3210 |
|
|
3211 |
public void accept(UnsavedDataPanel panel) { |
|
3212 |
panel.setVisible(false); |
|
3213 |
|
|
3214 |
try { |
|
3215 |
PluginsLocator.getManager().saveUnsavedData(panel.getSelectedsUnsavedDataList()); |
|
3216 |
} catch (UnsavedDataException e) { |
|
3217 |
StringBuilder msg = new StringBuilder(); |
|
3218 |
msg.append(PluginServices.getText(this,"The_following_resources_could_not_be_saved")); |
|
3219 |
msg.append("\n"); |
|
3220 |
for (Iterator iterator = e.getUnsavedData().iterator(); iterator.hasNext();) { |
|
3221 |
IUnsavedData unsavedData = (IUnsavedData) iterator.next(); |
|
3222 |
msg.append(unsavedData.getResourceName()); |
|
3223 |
msg.append(" -- "); |
|
3224 |
msg.append(unsavedData.getDescription()); |
|
3225 |
msg.append("\n"); |
|
3226 |
} |
|
3227 |
JOptionPane.showMessageDialog(panel,msg,PluginServices.getText(this,"Resources_was_not_saved"),JOptionPane.ERROR_MESSAGE); |
|
3228 |
} |
|
3229 |
} |
|
3230 |
}); |
|
3231 |
|
|
3232 |
//TODO: mostrar panel WindowManager |
|
3233 |
|
|
3234 |
ToolsSwingLocator.getWindowManager().showWindow( |
|
3235 |
panel, |
|
3236 |
PluginServices.getText(panel, "Resource_was_not_saved"), |
|
3237 |
MODE.DIALOG); |
|
3238 |
|
|
3239 |
} |
|
3240 |
|
|
3189 | 3241 |
/** |
3190 | 3242 |
* Manages Andami termination process |
3191 | 3243 |
* |
... | ... | |
3206 | 3258 |
} |
3207 | 3259 |
closeAndami(); |
3208 | 3260 |
} catch (Exception e) { |
3261 |
logger.warn("It is not possible to close the application", e); |
|
3209 | 3262 |
// It is not possible to close the application. |
3210 | 3263 |
// this exception has been registered before |
3211 | 3264 |
} |
... | ... | |
3365 | 3418 |
return panel; |
3366 | 3419 |
} |
3367 | 3420 |
|
3368 |
/**
|
|
3421 |
/**
|
|
3369 | 3422 |
* Checks if the extensions have some unsaved data, and shows a dialog |
3370 | 3423 |
* to allow saving it. This dialog also allows to don't exit Andami. |
3371 | 3424 |
* |
... | ... | |
3430 | 3483 |
+ unsavedDataArray[i] |
3431 | 3484 |
.getDescription(), |
3432 | 3485 |
PluginServices.getText(this, |
3433 |
"Resource_was_not_saved"),
|
|
3486 |
"unsaved_resources"),
|
|
3434 | 3487 |
JOptionPane.ERROR_MESSAGE); |
3435 | 3488 |
|
3436 | 3489 |
try { |
... | ... | |
3576 | 3629 |
initializeApp(myArgs, "installer"); |
3577 | 3630 |
|
3578 | 3631 |
new DefaultLibrariesInitializer().fullInitialize(true); |
3579 |
|
|
3632 |
|
|
3580 | 3633 |
initializeInstallerManager(); |
3581 | 3634 |
|
3582 | 3635 |
InstallerManager installerManager = InstallerLocator.getInstallerManager(); |
... | ... | |
3590 | 3643 |
|
3591 | 3644 |
try { |
3592 | 3645 |
logger.info("Loading plugins"); |
3593 |
this.loadPluginServices();
|
|
3646 |
this.loadPluginServices(); |
|
3594 | 3647 |
} catch (Throwable ex) { |
3595 | 3648 |
logger.warn("Can't load plugins", ex); |
3596 | 3649 |
} |
... | ... | |
3598 | 3651 |
AndamiConfig config = getAndamiConfig(); |
3599 | 3652 |
|
3600 | 3653 |
initializeIdentityManagement(new File(config.getPluginsDirectory()).getAbsoluteFile()); |
3601 |
|
|
3654 |
|
|
3602 | 3655 |
initializeLibraries(); |
3603 | 3656 |
|
3604 | 3657 |
// config.setLocaleLanguage(locale.getLanguage()); |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/PluginsManager.java | ||
---|---|---|
26 | 26 |
import java.io.File; |
27 | 27 |
import java.util.Iterator; |
28 | 28 |
import java.util.List; |
29 |
|
|
29 | 30 |
import org.gvsig.andami.firewall.FirewallConfiguration; |
30 |
|
|
31 |
import org.gvsig.andami.impl.UnsavedDataException; |
|
31 | 32 |
import org.gvsig.andami.plugins.ExclusiveUIExtension; |
32 | 33 |
import org.gvsig.andami.plugins.IExtension; |
34 |
import org.gvsig.andami.plugins.status.IUnsavedData; |
|
33 | 35 |
import org.gvsig.installer.lib.api.PackageInfo; |
34 | 36 |
import org.gvsig.installer.lib.api.Version; |
35 | 37 |
|
... | ... | |
166 | 168 |
* @return the default folder where the internationalization files are installed. |
167 | 169 |
*/ |
168 | 170 |
public File getApplicationI18nFolder(); |
169 |
|
|
171 |
|
|
170 | 172 |
/** |
171 | 173 |
* Returns the plugins folder. |
172 | 174 |
* |
... | ... | |
192 | 194 |
* all gvSIG plugins. |
193 | 195 |
* |
194 | 196 |
* Task with higher priority value are executed after. |
195 |
*
|
|
197 |
* |
|
196 | 198 |
* @param name of the task |
197 | 199 |
* @param task runnable with the code of the task |
198 | 200 |
* @param in_event_thread, true if the task shoul run in the AWT event thread. |
... | ... | |
204 | 206 |
* This method allows plugins register task to do after close the application. |
205 | 207 |
* |
206 | 208 |
* Task with higher priority value are executed after. |
207 |
*
|
|
209 |
* |
|
208 | 210 |
* @param name of the task |
209 | 211 |
* @param task runnable with the code of the task |
210 | 212 |
* @param in_event_thread, true if the task shoul run in the AWT event thread. |
... | ... | |
229 | 231 |
*/ |
230 | 232 |
public void executeShutdownTasks(); |
231 | 233 |
|
232 |
|
|
234 |
|
|
233 | 235 |
public FirewallConfiguration getFirewallConfiguration(); |
234 | 236 |
|
235 | 237 |
public Version getApplicationVersion(); |
238 |
|
|
239 |
/** |
|
240 |
* Return a list of unsaved data |
|
241 |
* |
|
242 |
* @return |
|
243 |
*/ |
|
244 |
public List<IUnsavedData> getUnsavedData(); |
|
245 |
|
|
246 |
/** |
|
247 |
* Save the provided unsaved data as parameter |
|
248 |
* |
|
249 |
* @param unsavedData |
|
250 |
* @throws UnsavedDataException |
|
251 |
*/ |
|
252 |
public void saveUnsavedData(List<IUnsavedData> unsavedData) throws UnsavedDataException; |
|
253 |
|
|
236 | 254 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/impl/UnsavedDataException.java | ||
---|---|---|
1 |
package org.gvsig.andami.impl; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import org.gvsig.andami.plugins.status.IUnsavedData; |
|
6 |
import org.gvsig.tools.exception.BaseException; |
|
7 |
|
|
8 |
public class UnsavedDataException extends BaseException { |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
*/ |
|
13 |
private static final long serialVersionUID = 7764186865062216316L; |
|
14 |
private final static String MESSAGE_FORMAT = "Has not been able to save the following data: %(errors)\n"; |
|
15 |
private final static String MESSAGE_KEY = "_UnsavedDataException"; |
|
16 |
private List<IUnsavedData> errors; |
|
17 |
|
|
18 |
public UnsavedDataException(List<IUnsavedData> errors) { |
|
19 |
super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID); |
|
20 |
this.errors = errors; |
|
21 |
|
|
22 |
StringBuilder errorsString = new StringBuilder(); |
|
23 |
for (IUnsavedData error : errors) { |
|
24 |
errorsString.append(" - "); |
|
25 |
errorsString.append(error.getResourceName()); |
|
26 |
errorsString.append(" -- "); |
|
27 |
errorsString.append(error.getDescription()); |
|
28 |
errorsString.append("\n"); |
|
29 |
} |
|
30 |
setValue("errors", errorsString); |
|
31 |
} |
|
32 |
|
|
33 |
public List<IUnsavedData> getUnsavedData(){ |
|
34 |
return errors; |
|
35 |
} |
|
36 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/impl/DefaultPluginsManager.java | ||
---|---|---|
27 | 27 |
import java.io.IOException; |
28 | 28 |
import java.lang.reflect.InvocationTargetException; |
29 | 29 |
import java.util.ArrayList; |
30 |
import java.util.Arrays; |
|
30 | 31 |
import java.util.Collections; |
31 | 32 |
import java.util.Enumeration; |
32 | 33 |
import java.util.Iterator; |
33 | 34 |
import java.util.List; |
34 | 35 |
|
35 | 36 |
import javax.swing.SwingUtilities; |
37 |
|
|
36 | 38 |
import org.apache.commons.io.FileUtils; |
39 |
import org.jfree.util.Log; |
|
37 | 40 |
|
38 | 41 |
import org.gvsig.andami.Launcher; |
39 | 42 |
import org.gvsig.andami.PluginServices; |
... | ... | |
46 | 49 |
import org.gvsig.andami.plugins.Extension; |
47 | 50 |
import org.gvsig.andami.plugins.IExtension; |
48 | 51 |
import org.gvsig.andami.plugins.PluginClassLoader; |
52 |
import org.gvsig.andami.plugins.status.IExtensionStatus; |
|
53 |
import org.gvsig.andami.plugins.status.IUnsavedData; |
|
49 | 54 |
import org.gvsig.installer.lib.api.PackageInfo; |
50 | 55 |
import org.gvsig.installer.lib.api.Version; |
51 | 56 |
import org.gvsig.tools.ToolsLocator; |
52 | 57 |
import org.gvsig.tools.packageutils.PackageManager; |
58 |
|
|
53 | 59 |
import org.slf4j.Logger; |
54 | 60 |
import org.slf4j.LoggerFactory; |
55 | 61 |
|
... | ... | |
340 | 346 |
return version; |
341 | 347 |
} |
342 | 348 |
|
349 |
public List<IUnsavedData> getUnsavedData() { |
|
350 |
List<IUnsavedData> unsavedDatas = new ArrayList<IUnsavedData>(); |
|
351 |
Iterator<IExtension> extensions = getExtensions(); |
|
352 |
while(extensions.hasNext()){ |
|
353 |
IExtension extension = extensions.next(); |
|
354 |
IExtensionStatus status = extension.getStatus(); |
|
355 |
if(status != null && status.hasUnsavedData()){ |
|
356 |
IUnsavedData[] unsavedData = status.getUnsavedData(); |
|
357 |
if (unsavedData != null){ |
|
358 |
unsavedDatas.addAll(Arrays.asList(unsavedData)); |
|
359 |
} |
|
360 |
} |
|
361 |
} |
|
362 |
return unsavedDatas; |
|
363 |
} |
|
364 |
|
|
365 |
public void saveUnsavedData(List<IUnsavedData> unsavedData) throws UnsavedDataException { |
|
366 |
List<IUnsavedData> errors = new ArrayList<IUnsavedData>(); |
|
367 |
|
|
368 |
for (Iterator iterator = unsavedData.iterator(); iterator.hasNext();) { |
|
369 |
IUnsavedData itemUnsavedData = (IUnsavedData) iterator.next(); |
|
370 |
try { |
|
371 |
itemUnsavedData.saveData(); |
|
372 |
} catch (Exception e) { |
|
373 |
errors.add(itemUnsavedData); |
|
374 |
logger.warn("Can't save "+itemUnsavedData.getResourceName()); |
|
375 |
} |
|
376 |
} |
|
377 |
if(!errors.isEmpty()){ |
|
378 |
throw new UnsavedDataException(errors); |
|
379 |
} |
|
380 |
} |
|
343 | 381 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/resources/org/gvsig/andami/text.properties | ||
---|---|---|
60 | 60 |
Unable_to_find_icon=No se pudo encontrar el icono |
61 | 61 |
y_en=y en |
62 | 62 |
No_se_encontro_la_extension_especificada_en_el_parametro_exclusiveUI=No se encontr\u00f3 la extensi\u00f3n especifiacada en el par\u00e1metro 'exclusiveUI': |
63 |
Error_reading_plugin_persinstence_New_file_created_A_backup_was_made_on_=Error leyendo plugin-persistence.xml. Se crear? un fichero nuevo. Se ha hecho una copia de seguridad en
|
|
64 |
Error_reading_andami_config_New_file_created_A_backup_was_made_on_=Error leyendo andami-config.xml. Se crear? un fichero nuevo. Se ha hecho una copia de seguridad en
|
|
63 |
Error_reading_plugin_persinstence_New_file_created_A_backup_was_made_on_=Error leyendo plugin-persistence.xml. Se crear\u00e1 un fichero nuevo. Se ha hecho una copia de seguridad en
|
|
64 |
Error_reading_andami_config_New_file_created_A_backup_was_made_on_=Error leyendo andami-config.xml. Se crear\u00e1 un fichero nuevo. Se ha hecho una copia de seguridad en
|
|
65 | 65 |
save_resources=Guardar recursos |
66 | 66 |
select_resources_to_save_before_exit=Antes de salir se guardar\u00e1n los elementos que est\u00e9n seleccionados |
67 | 67 |
deselect_all=Limpiar selecci\u00f3n |
68 | 68 |
discard_changes=Descartar cambios |
69 | 69 |
gvsig_package_installer=Instalador de paquetes de gvSIG |
70 | 70 |
usage=Uso |
71 |
error_getting_unsaved_data=Error obteniendo los datos sin guardar. Si contin?a, es posible\nque no pueda guardar todos los datos. ?Desea continuar con el proceso de cerrar?
|
|
71 |
error_getting_unsaved_data=Error obteniendo los datos sin guardar. Si contin\u00faa, es posible\nque no pueda guardar todos los datos. \u00bfDesea continuar con el proceso de cerrar?
|
|
72 | 72 |
_Unable_to_read_persistence_for_plugin=No se han podido leer datos almacenados del plugin |
73 | 73 |
_Persistence=Persistencia |
74 |
_Perhaps_saved_data_refers_to_missing_plugin=Quiz? los datos almacenados se refieren a un plugin no presente
|
|
74 |
_Perhaps_saved_data_refers_to_missing_plugin=Quiz\u00e1 los datos almacenados se refieren a un plugin no presente
|
|
75 | 75 |
_Conflicting_plugins=Plugins en conflicto |
76 | 76 |
_Close=Cerrar |
77 | 77 |
_Continue=Continuar |
78 | 78 |
_Some_of_plugins_installed_conflict_with_each_other=Hay conflictos entre los plugins instalados |
79 |
_Select_the_plugins_that_you_want_to_disable_and_click_the_continue_button=Seleccione los plugins que desea DESACTIVAR y pulse el bot?n 'Continuar'
|
|
79 |
_Select_the_plugins_that_you_want_to_disable_and_click_the_continue_button=Seleccione los plugins que desea DESACTIVAR y pulse el bot\u00f3n 'Continuar'
|
|
80 | 80 |
_You_can_click_on_continue_button_directly_if_you_dont_want_to_disable_any_plugins=Puede pulsar directamente 'Continuar' si no desea desactivar ninguno |
81 |
_Or_click_the_close_button_to_close_the_application=O bien, pulse el bot?n 'Cerrar' para salir de la aplicaci?n |
|
81 |
_Or_click_the_close_button_to_close_the_application=O bien, pulse el bot\u00f3n 'Cerrar' para salir de la aplicaci\u00f3n |
|
82 |
there_are_unsaved_resources=Hay recursos sin guardar |
|
83 |
The_following_resources_could_not_be_saved=Los siguientes recursos no han podido ser guardados |
|
84 |
unsaved_resources=Recursos no guardados |
|
82 | 85 |
|
83 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/resources/org/gvsig/andami/text_en.properties | ||
---|---|---|
65 | 65 |
discard_changes=Discard changes |
66 | 66 |
gvsig_package_installer=gvSIG packages installer |
67 | 67 |
usage=Usage |
68 |
error_getting_unsaved_data=Error getting the unsaved data. If you continue, you may not be able\nto save all data. ?Do you want to continue closing the application?
|
|
68 |
error_getting_unsaved_data=Error getting the unsaved data. If you continue, you may not be able\nto save all data. \u00bfDo you want to continue closing the application?
|
|
69 | 69 |
_Unable_to_read_persistence_for_plugin=Unable to read saved data for plugin |
70 | 70 |
_Perhaps_saved_data_refers_to_missing_plugin=Perhaps saved data refers to missing plugin |
71 | 71 |
_Persistence=Persistence |
... | ... | |
76 | 76 |
_Select_the_plugins_that_you_want_to_disable_and_click_the_continue_button=Select the plugins you wish to disable and click on the 'Continue' button |
77 | 77 |
_You_can_click_on_continue_button_directly_if_you_dont_want_to_disable_any_plugins=You can click on 'Continue' directly if you dont wish to disable any plugins |
78 | 78 |
_Or_click_the_close_button_to_close_the_application=Or click on 'Close' button to close the application |
79 |
there_are_unsaved_resources=There are unsaved resources |
|
80 |
The_following_resources_could_not_be_saved=The following resources could not be saved |
|
81 |
unsaved_resources=Unsaved resources |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/TableEditStopExtension.java | ||
---|---|---|
284 | 284 |
// m?todo "public void stopEditing()" |
285 | 285 |
private boolean executeSaveTable(TableDocument table2) { |
286 | 286 |
FeatureStore fs = table2.getStore(); |
287 |
try { |
|
288 |
fs.finishEditing(); |
|
289 |
} catch (WriteException e) { |
|
290 |
NotificationManager.addError( |
|
291 |
PluginServices.getText(this, "error_saving_table"), e); |
|
292 |
return false; |
|
293 |
} catch (ReadException e) { |
|
294 |
NotificationManager.addError( |
|
295 |
PluginServices.getText(this, "error_saving_table"), e); |
|
296 |
return false; |
|
297 |
} catch (DataException e) { |
|
298 |
NotificationManager.addError( |
|
299 |
PluginServices.getText(this, "error_saving_table"), e); |
|
300 |
return false; |
|
287 |
if (fs.isEditing()) { |
|
288 |
try { |
|
289 |
fs.finishEditing(); |
|
290 |
} catch (WriteException e) { |
|
291 |
NotificationManager.addError(PluginServices.getText(this, "error_saving_table"), e); |
|
292 |
return false; |
|
293 |
} catch (ReadException e) { |
|
294 |
NotificationManager.addError(PluginServices.getText(this, "error_saving_table"), e); |
|
295 |
return false; |
|
296 |
} catch (DataException e) { |
|
297 |
NotificationManager.addError(PluginServices.getText(this, "error_saving_table"), e); |
|
298 |
return false; |
|
299 |
} |
|
301 | 300 |
} |
302 | 301 |
// if (ies instanceof IWriteable) { |
303 | 302 |
// IWriteable w = (IWriteable) ies; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
import org.slf4j.Logger; |
38 | 38 |
import org.slf4j.LoggerFactory; |
39 |
|
|
39 | 40 |
import org.gvsig.tools.util.ArrayUtils; |
41 |
|
|
40 | 42 |
import org.apache.commons.lang.StringUtils; |
43 |
|
|
41 | 44 |
import org.gvsig.andami.IconThemeHelper; |
42 | 45 |
import org.gvsig.andami.Launcher; |
43 | 46 |
import org.gvsig.andami.Launcher.TerminationProcess; |
... | ... | |
74 | 77 |
* Extension que proporciona controles para crear proyectos nuevos, abrirlos y |
75 | 78 |
* guardarlos. Adem?s los tipos de tabla que soporta el proyecto son a?adidos en |
76 | 79 |
* esta clase. |
77 |
*
|
|
80 |
* |
|
78 | 81 |
* @author Fernando Gonz?lez Cort?s |
79 | 82 |
*/ |
80 | 83 |
public class ProjectExtension extends Extension implements IExtensionStatus { |
... | ... | |
89 | 92 |
public static final String PROJECT_FILE_CHOOSER_ID = "PROJECT_FILECHOOSER_ID"; |
90 | 93 |
/** |
91 | 94 |
* Use UTF-8 for encoding, as it can represent characters from any language. |
92 |
*
|
|
95 |
* |
|
93 | 96 |
* Another sensible option would be encoding = |
94 | 97 |
* System.getProperty("file.encoding"); but this would need some extra |
95 | 98 |
* testing. |
96 |
*
|
|
99 |
* |
|
97 | 100 |
* @deprecated see PersistentManager |
98 | 101 |
*/ |
99 | 102 |
public static String PROJECTENCODING = "UTF-8"; |
... | ... | |
106 | 109 |
initializeDocumentActionsExtensionPoint(); |
107 | 110 |
registerDocuments(); |
108 | 111 |
registerIcons(); |
109 |
|
|
112 |
|
|
110 | 113 |
File projectFile = getProjectFileFromArguments(); |
111 | 114 |
if( projectFile!=null ) { |
112 | 115 |
// Posponemos la apertura del proyecto ya que en este momento |
... | ... | |
133 | 136 |
/** |
134 | 137 |
* Returns the file to be opened or null if no parameter |
135 | 138 |
* or file does not exist |
136 |
*
|
|
139 |
* |
|
137 | 140 |
* @return |
138 | 141 |
*/ |
139 | 142 |
private File getProjectFileFromArguments() { |
... | ... | |
151 | 154 |
return null; |
152 | 155 |
} |
153 | 156 |
if (!lastArg.toLowerCase().endsWith(Project.FILE_EXTENSION.toLowerCase())) { |
154 |
LOG.info("Do not open project file, does not have the expected extension '" +
|
|
157 |
LOG.info("Do not open project file, does not have the expected extension '" + |
|
155 | 158 |
Project.FILE_EXTENSION +"' ("+lastArg+")."); |
156 | 159 |
return null; |
157 | 160 |
} |
... | ... | |
161 | 164 |
return null; |
162 | 165 |
} |
163 | 166 |
return projectFile; |
164 |
}
|
|
167 |
} |
|
165 | 168 |
|
166 | 169 |
private class OpenInitialProjectTask implements Runnable { |
167 | 170 |
private File projectFile; |
... | ... | |
247 | 250 |
prefs.get("ProjectsFolder", null)); |
248 | 251 |
|
249 | 252 |
jfc.setDialogTitle(PluginServices.getText(this, "guardar_proyecto")); |
250 |
|
|
253 |
|
|
251 | 254 |
GenericFileFilter projExtensionFilter = new GenericFileFilter( |
252 | 255 |
Project.FILE_EXTENSION, MessageFormat.format(PluginServices |
253 | 256 |
.getText(this, "tipo_fichero_proyecto"), |
... | ... | |
277 | 280 |
/** |
278 | 281 |
* Checks whether the project and related unsaved data is modified, and |
279 | 282 |
* allows the user to save it. |
280 |
*
|
|
283 |
* |
|
281 | 284 |
* @return true if the data has been correctly saved, false otherwise |
282 | 285 |
*/ |
283 | 286 |
private boolean askSave() { |
... | ... | |
310 | 313 |
public void execute(String command) { |
311 | 314 |
this.execute(command, null); |
312 | 315 |
} |
313 |
|
|
316 |
|
|
314 | 317 |
public void execute(String actionCommand, Object[] args) { |
315 | 318 |
if (actionCommand.equals("application-project-new")) { |
316 | 319 |
if (!askSave()) { |
... | ... | |
342 | 345 |
"gvsig.foldering"); |
343 | 346 |
JFileChooser jfc = new JFileChooser(PROJECT_FILE_CHOOSER_ID, |
344 | 347 |
prefs.get("ProjectsFolder", null)); |
345 |
|
|
348 |
|
|
346 | 349 |
GenericFileFilter projExtensionFilter = new GenericFileFilter( |
347 | 350 |
Project.FILE_EXTENSION, PluginServices.getText(this, |
348 | 351 |
"tipo_fichero_proyecto")); |
... | ... | |
354 | 357 |
return; |
355 | 358 |
} |
356 | 359 |
// ProjectDocument.initializeNUMS(); |
357 |
|
|
358 | 360 |
|
361 |
|
|
359 | 362 |
projectFile = jfc.getSelectedFile(); |
360 | 363 |
} |
361 |
|
|
364 |
|
|
362 | 365 |
PluginServices.getMDIManager().closeAllWindows(); |
363 | 366 |
|
364 | 367 |
Project o = readProject(projectFile); |
... | ... | |
375 | 378 |
// p.restoreWindowProperties(); |
376 | 379 |
|
377 | 380 |
} else if (actionCommand.equals("application-project-save")) { |
378 |
saveProject(); |
|
381 |
// saveProject(); |
|
382 |
try { |
|
383 |
Launcher.manageUnsavedData("there_are_unsaved_resources"); |
|
384 |
} catch (Exception e) { |
|
385 |
LOG.warn("Can't manage unsaved data", e); |
|
386 |
} |
|
379 | 387 |
} else if (actionCommand.equals("application-project-save-as")) { |
380 | 388 |
File file = (File) ArrayUtils.get(args, 0, DataTypes.FILE); |
381 | 389 |
saveAsProject(file); |
... | ... | |
383 | 391 |
|
384 | 392 |
} |
385 | 393 |
|
386 |
|
|
394 |
|
|
387 | 395 |
private void createEmptyProject() { |
388 | 396 |
setProject(ProjectManager.getInstance().createProject()); |
389 | 397 |
p.setName(PluginServices.getText(this, "untitled")); |
... | ... | |
411 | 419 |
} catch (Exception e) { |
412 | 420 |
LOG.warn("Can't load initial project.",e); |
413 | 421 |
} |
414 |
}
|
|
415 |
|
|
416 |
|
|
422 |
} |
|
423 |
|
|
424 |
|
|
417 | 425 |
/** |
418 | 426 |
* Escribe el proyecto en XML. |
419 |
*
|
|
427 |
* |
|
420 | 428 |
* @param file |
421 | 429 |
* Fichero. |
422 | 430 |
* @param p |
... | ... | |
429 | 437 |
/** |
430 | 438 |
* Escribe el proyecto en XML. Pero permite decidir si se pide confirmaci?n |
431 | 439 |
* para sobreescribir |
432 |
*
|
|
440 |
* |
|
433 | 441 |
* @param file |
434 | 442 |
* Fichero. |
435 | 443 |
* @param p |
... | ... | |
488 | 496 |
/** |
489 | 497 |
* Lee del XML el proyecto.<br> |
490 | 498 |
* <br> |
491 |
*
|
|
499 |
* |
|
492 | 500 |
* Reads the XML of the project.<br> |
493 | 501 |
* It returns a project object holding all needed info that is not linked to |
494 | 502 |
* the Project Dialog. <br> |
495 | 503 |
* In case you want the project to be linked to the window you must set this |
496 | 504 |
* object to the extension:<br> |
497 |
*
|
|
505 |
* |
|
498 | 506 |
* <b>Example:</b><br> |
499 |
*
|
|
507 |
* |
|
500 | 508 |
* ...<br> |
501 | 509 |
* ...<br> |
502 | 510 |
* Project p = ProjectExtension.readProject(projectFile);<br> |
503 | 511 |
* ProjectExtension.setProject(p); ...<br> |
504 | 512 |
* ...<br> |
505 |
*
|
|
513 |
* |
|
506 | 514 |
* @param file |
507 | 515 |
* Fichero. |
508 |
*
|
|
516 |
* |
|
509 | 517 |
* @return Project |
510 |
*
|
|
518 |
* |
|
511 | 519 |
*/ |
512 | 520 |
public Project readProject(File file) { |
513 | 521 |
Project project = ProjectManager.getInstance().createProject(); |
... | ... | |
518 | 526 |
|
519 | 527 |
/** |
520 | 528 |
* Devuelve el proyecto. |
521 |
*
|
|
529 |
* |
|
522 | 530 |
* @return Proyecto. |
523 | 531 |
*/ |
524 | 532 |
public Project getProject() { |
... | ... | |
541 | 549 |
|
542 | 550 |
/** |
543 | 551 |
* Sets the project |
544 |
*
|
|
552 |
* |
|
545 | 553 |
* @param p |
546 | 554 |
*/ |
547 | 555 |
public void setProject(Project p) { |
... | ... | |
596 | 604 |
/** |
597 | 605 |
* Implements the IUnsavedData interface to show unsaved projects in the |
598 | 606 |
* Unsavad Data dialog. |
599 |
*
|
|
607 |
* |
|
600 | 608 |
* @author Cesar Martinez Izquierdo <cesar.martinez@iver.es> |
601 | 609 |
*/ |
602 | 610 |
public class UnsavedProject extends UnsavedData { |
... | ... | |
647 | 655 |
* Adds the specified before saving listener to receive |
648 | 656 |
* "before saving file events" from this component. If l is null, no |
649 | 657 |
* exception is thrown and no action is performed. |
650 |
*
|
|
658 |
* |
|
651 | 659 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
652 |
*
|
|
660 |
* |
|
653 | 661 |
* @param l |
654 | 662 |
* the before saving listener. |
655 | 663 |
* @see SaveEvent |
... | ... | |
670 | 678 |
* Adds the specified after saving listener to receive |
671 | 679 |
* "after saving file events" from this component. If l is null, no |
672 | 680 |
* exception is thrown and no action is performed. |
673 |
*
|
|
681 |
* |
|
674 | 682 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
675 |
*
|
|
683 |
* |
|
676 | 684 |
* @param l |
677 | 685 |
* the after saving listener. |
678 | 686 |
* @see SaveEvent |
... | ... | |
694 | 702 |
/** |
695 | 703 |
* Returns an array of all the before saving listeners registered on this |
696 | 704 |
* component. |
697 |
*
|
|
705 |
* |
|
698 | 706 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
699 |
*
|
|
707 |
* |
|
700 | 708 |
* @return all of this component's <code>BeforeSavingListener</code>s or an |
701 | 709 |
* empty array if no key listeners are currently registered |
702 |
*
|
|
710 |
* |
|
703 | 711 |
* @see #addBeforeSavingListener(BeforeSavingListener) |
704 | 712 |
* @see #removeBeforeSavingListener(BeforeSavingListener) |
705 | 713 |
*/ |
... | ... | |
711 | 719 |
/** |
712 | 720 |
* Returns an array of all the after saving listeners registered on this |
713 | 721 |
* component. |
714 |
*
|
|
722 |
* |
|
715 | 723 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
716 |
*
|
|
724 |
* |
|
717 | 725 |
* @return all of this component's <code>AfterSavingListener</code>s or an |
718 | 726 |
* empty array if no key listeners are currently registered |
719 |
*
|
|
727 |
* |
|
720 | 728 |
* @see #addAfterSavingListener(AfterSavingListener) |
721 | 729 |
* @see #removeAfterSavingListener |
722 | 730 |
*/ |
... | ... | |
732 | 740 |
* the argument was not previously added to this component. If listener |
733 | 741 |
* <code>l</code> is <code>null</code>, no exception is thrown and no action |
734 | 742 |
* is performed. |
735 |
*
|
|
743 |
* |
|
736 | 744 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
737 |
*
|
|
745 |
* |
|
738 | 746 |
* @param l |
739 | 747 |
* the before saving listener |
740 | 748 |
* @see SaveEvent |
... | ... | |
756 | 764 |
* nor does it throw an exception, if the listener specified by the argument |
757 | 765 |
* was not previously added to this component. If listener <code>l</code> is |
758 | 766 |
* <code>null</code>, no exception is thrown and no action is performed. |
759 |
*
|
|
767 |
* |
|
760 | 768 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
761 |
*
|
|
769 |
* |
|
762 | 770 |
* @param l |
763 | 771 |
* the after saving listener |
764 | 772 |
* @see SaveEvent |
... | ... | |
776 | 784 |
|
777 | 785 |
/** |
778 | 786 |
* Reports a before saving file event. |
779 |
*
|
|
787 |
* |
|
780 | 788 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
781 |
*
|
|
789 |
* |
|
782 | 790 |
* @param evt |
783 | 791 |
* the before saving file event |
784 | 792 |
*/ |
... | ... | |
797 | 805 |
|
798 | 806 |
/** |
799 | 807 |
* Reports a after saving file event. |
800 |
*
|
|
808 |
* |
|
801 | 809 |
* @author Pablo Piqueras Bartolom? <pablo.piqueras@iver.es> |
802 |
*
|
|
810 |
* |
|
803 | 811 |
* @param evt |
804 | 812 |
* the after saving file event |
805 | 813 |
*/ |
Also available in: Unified diff