Revision 43189 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/gui/ProjectWindow.java

View differences:

ProjectWindow.java
60 60
import org.gvsig.andami.PluginServices;
61 61
import org.gvsig.andami.help.Help;
62 62
import org.gvsig.andami.messages.NotificationManager;
63
import org.gvsig.andami.preferences.IPreference;
64 63
import org.gvsig.andami.ui.mdiManager.IWindow;
65 64
import org.gvsig.andami.ui.mdiManager.MDIManager;
66 65
import org.gvsig.andami.ui.mdiManager.SingletonWindow;
67 66
import org.gvsig.andami.ui.mdiManager.WindowInfo;
67
import org.gvsig.app.ApplicationLocator;
68
import org.gvsig.app.ApplicationManager;
68 69
import org.gvsig.app.extension.ProjectExtension;
69 70
import org.gvsig.app.project.Project;
70 71
import org.gvsig.app.project.ProjectManager;
......
415 416
     * Borra un project element
416 417
     */
417 418
    private void borrar() {
418
        int res =
419
            JOptionPane.showConfirmDialog(
420
                (Component) PluginServices.getMainFrame(),
421
                PluginServices.getText(this, "confirmar_borrar"),
422
                PluginServices.getText(this, "borrar"),
423
                JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);
424

  
419
        ApplicationManager application = ApplicationLocator.getManager();
420
        I18nManager i18n = ToolsLocator.getI18nManager();
421
        int res = application.confirmDialog(
422
                i18n.getTranslation("confirmar_borrar"),
423
                i18n.getTranslation("borrar"),
424
                JOptionPane.YES_NO_OPTION, 
425
                JOptionPane.INFORMATION_MESSAGE,
426
                "Confirm remove document from project"
427
        );
425 428
        int lastremoved = 0;
426 429
        if (res == JOptionPane.YES_OPTION) {
427 430
            int[] indexes = lstDocs.getSelectedIndices();
......
431 434
                List<Document> documents = project.getDocuments(s);
432 435
                Document doc = documents.get(index);
433 436
                if (doc.isLocked()) {
434
                    JOptionPane.showMessageDialog(this, PluginServices.getText(
435
                        this, "locked_element_it_cannot_be_deleted"));
437
                    application.messageDialog(
438
                        i18n.getTranslation("locked_element_it_cannot_be_deleted"), 
439
                        i18n.getTranslation("Information"), 
440
                        JOptionPane.INFORMATION_MESSAGE
441
                    );
436 442
                    return;
437 443
                }
438 444
                PluginServices.getMDIManager().closeSingletonWindow(doc);
439
                project.remove(doc);
445
                project.removeDocument(doc);
440 446
                lastremoved = index;
441 447
            }
442 448
            if (lastremoved > lstDocs.getModel().getSize()) {
......
445 451
            if (lastremoved >= 0) {
446 452
                lstDocs.setSelectedIndex(lastremoved);
447 453
            }
448
            // refreshList();
449 454
            project.setModified(true);
450 455
        }
451 456
    }

Also available in: Unified diff