Commit 74136f8b authored by Piotr Różański's avatar Piotr Różański Committed by Marian Dovgialo

#45487 Removed "Save All" menu entry

parent f432dcd7
/* SaveAllDocumentsAction.java created 2007-09-10
*
*/
package org.signalml.app.action.document;
import static org.signalml.app.util.i18n.SvarogI18n._;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.signalml.app.document.DocumentFlowIntegrator;
import org.signalml.app.view.common.dialogs.errors.Dialogs;
import org.signalml.plugin.export.SignalMLException;
import org.signalml.plugin.export.view.AbstractSignalMLAction;
/** SaveAllDocumentsAction
*
*
* @author Michal Dobaczewski © 2007-2008 CC Otwarte Systemy Komputerowe Sp. z o.o.
*/
public class SaveAllDocumentsAction extends AbstractSignalMLAction {
private static final long serialVersionUID = 1L;
protected static final Logger logger = Logger.getLogger(SaveAllDocumentsAction.class);
private DocumentFlowIntegrator documentFlowIntegrator;
public SaveAllDocumentsAction() {
super();
setText(_("Save All"));
setIconPath("org/signalml/app/icon/save_all.png");
setToolTip(_("Save all unsaved documents"));
setMnemonic(KeyEvent.VK_S);
}
@Override
public void actionPerformed(ActionEvent ev) {
logger.debug("Save all documents");
try {
documentFlowIntegrator.saveAllDocuments();
} catch (SignalMLException ex) {
logger.error("Failed to save all documents", ex);
Dialogs.showExceptionDialog((Window) null, ex);
return;
} catch (IOException ex) {
logger.error("Failed to save all documents - i/o exception", ex);
Dialogs.showExceptionDialog((Window) null, ex);
return;
}
}
@Override
public void setEnabledAsNeeded() {
if (documentFlowIntegrator != null) {
setEnabled(documentFlowIntegrator.getDocumentManager().getDocumentCount() > 0);
} else {
setEnabled(false);
}
}
public DocumentFlowIntegrator getDocumentFlowIntegrator() {
return documentFlowIntegrator;
}
public void setDocumentFlowIntegrator(DocumentFlowIntegrator documentFlowIntegrator) {
this.documentFlowIntegrator = documentFlowIntegrator;
}
}
......@@ -524,40 +524,6 @@ public boolean saveDocument(Document document, boolean saveAsOnly) throws IOExce
}
/**
* {@link #saveDocument(Document, boolean) Saves} all documents stored
* in the {@link DocumentManager document manager}.
* @return {@code true} if the operation is successful,
* {@code false} if saving any of the files failed
* @throws IOException TODO never thrown (???)
* @throws SignalMLException if save worker failed to save the document or
* if {@link SignalChecksumWorker checksum worker} was interrupted or
* failed to calculate the checksum
*/
public boolean saveAllDocuments() throws IOException, SignalMLException {
boolean allOk = true;
int count;
Document document;
int i;
boolean savedOk;
synchronized (documentManager) {
count = documentManager.getDocumentCount();
for (i=0; i<count; i++) {
document = documentManager.getDocumentAt(i);
synchronized (document) {
savedOk = saveDocument(document, false);
}
allOk &= savedOk;
}
}
return allOk;
}
/**
* Creates a {@link OpenDocumentDescriptor descriptor} of a file based
* on a given {@link MRUDEntry} and uses this descriptor to
......
......@@ -39,7 +39,6 @@
import org.signalml.app.action.components.CloseWindowAction;
import org.signalml.app.action.document.CloseDocumentAction;
import org.signalml.app.action.document.OpenSignalWizardAction;
import org.signalml.app.action.document.SaveAllDocumentsAction;
import org.signalml.app.action.document.monitor.CheckSignalAction;
import org.signalml.app.action.document.monitor.StartMonitorRecordingAction;
import org.signalml.app.action.document.monitor.StopMonitorRecordingAction;
......@@ -273,7 +272,6 @@ public ViewerElementManager(SignalMLOperationMode mode) {
private ShowBottomPanelAction showBottomPanelAction;
private OpenBookDocumentAction openBookDocumentAction;
private CloseDocumentAction closeActiveDocumentAction;
private SaveAllDocumentsAction saveAllDocumentsAction;
private NewTagAction newTagAction;
private OpenTagAction openTagAction;
private CloseTagAction closeTagAction;
......@@ -593,7 +591,6 @@ public JMenu getFileMenu() {
fileMenu.add(getOpenSignalWizardAction());
fileMenu.add(getOpenBookDocumentAction());
fileMenu.add(getSaveAllDocumentsAction());
fileMenu.add(getCloseActiveDocumentAction());
fileMenu.addSeparator();
......@@ -793,7 +790,6 @@ public JToolBar getMainToolBar() {
mainToolBar.setFloatable(false);
mainToolBar.add(getOpenSignalWizardAction());
mainToolBar.add(getSaveAllDocumentsAction());
mainToolBar.add(getCloseActiveDocumentAction());
mainToolBar.add(Box.createHorizontalGlue());
......@@ -1377,14 +1373,6 @@ public CloseDocumentAction getCloseActiveDocumentAction() {
return closeActiveDocumentAction;
}
public SaveAllDocumentsAction getSaveAllDocumentsAction() {
if (saveAllDocumentsAction == null) {
saveAllDocumentsAction = new SaveAllDocumentsAction();
saveAllDocumentsAction.setDocumentFlowIntegrator(getDocumentFlowIntegrator());
}
return saveAllDocumentsAction;
}
public NewTagAction getNewTagAction() {
if (newTagAction == null) {
newTagAction = new NewTagAction(getActionFocusManager());
......@@ -1759,7 +1747,6 @@ public void configureAcceletators() {
getOpenTagAction().setAccelerator("alt O");
getOpenBookDocumentAction().setAccelerator("alt B");
getCloseTagAction().setAccelerator("ctrl alt F4");
getSaveAllDocumentsAction().setAccelerator("ctrl alt S");
getSaveTagAction().setAccelerator("alt S");
getSaveTagAsAction().setAccelerator("ctrl alt shift S");
getEditPreferencesAction().setAccelerator("ctrl P");
......
......@@ -75,7 +75,7 @@
*
* @author Michal Dobaczewski &copy; 2007-2008 CC Otwarte Systemy Komputerowe Sp. z o.o.
*/
public class ViewerMainFrame extends JFrame implements View, DocumentManagerListener, ViewFocusSelector {
public class ViewerMainFrame extends JFrame implements View, ViewFocusSelector {
private static final long serialVersionUID = 1L;
......@@ -218,8 +218,6 @@ private void bindListeners() {
documentManager.addDocumentManagerListener(elementManager.getTagTreeModel());
documentManager.addDocumentManagerListener(elementManager.getBookTreeModel());
documentManager.addDocumentManagerListener(this);
actionFocusManager.addActionFocusListener(documentTabbedPane);
actionFocusManager.addActionFocusListener(elementManager.getWorkspaceTree());
......@@ -751,21 +749,6 @@ public void setElementManager(ViewerElementManager elementManager) {
this.elementManager = elementManager;
}
@Override
public void documentAdded(DocumentManagerEvent e) {
elementManager.getSaveAllDocumentsAction().setEnabledAsNeeded();
}
@Override
public void documentPathChanged(DocumentManagerEvent e) {
// this is not interesting
}
@Override
public void documentRemoved(DocumentManagerEvent e) {
elementManager.getSaveAllDocumentsAction().setEnabledAsNeeded();
}
public void addBootstrap(MainWindowBootstrapTask task) {
bootstrapList.add(task);
}
......
......@@ -4447,10 +4447,6 @@ msgstr "Spełnienie dowolnego (OR)"
msgid "Save"
msgstr "Zapisz"
#: org/signalml/app/action/document/SaveAllDocumentsAction.java:34
msgid "Save All"
msgstr "Zapisz wszystko"
#: org/signalml/app/method/mp5/MP5SaveForLaterUseDialog.java:73
msgid "Save MP configuration"
msgstr "Zapisz konfigurację MP"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment