summaryrefslogtreecommitdiffstats
path: root/idrop-swing
diff options
context:
space:
mode:
authormconway <michael.c.conway@gmail.com>2013-02-01 15:46:14 (GMT)
committer mconway <michael.c.conway@gmail.com>2013-02-01 15:46:14 (GMT)
commite67064b6207efb50d6a4727c1f5a12226fb082de (patch)
tree15d518b706baab2bac26f8401f2483521b388eab /idrop-swing
parentf0570f1bba1b896183c01f0ddae0b9ee2cdc19bb (diff)
parentc9664527239065d005cdc2b1fac849a36512b101 (diff)
downloadQCG-Data-e67064b6207efb50d6a4727c1f5a12226fb082de.zip
QCG-Data-e67064b6207efb50d6a4727c1f5a12226fb082de.tar.gz
QCG-Data-e67064b6207efb50d6a4727c1f5a12226fb082de.tar.bz2
Merge branch '983-idrop2-phase1' into idrop-web2
Diffstat (limited to 'idrop-swing')
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form3
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java34
2 files changed, 37 insertions, 0 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form
index 4aff5b0..4cadb25 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.form
@@ -262,6 +262,9 @@
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMainToolbarSyncActionPerformed"/>
+ </Events>
</Component>
<Component class="javax.swing.JButton" name="btnMainToolbarSettings">
<Properties>
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
index da68da4..a40c623 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
@@ -66,10 +66,12 @@ import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
import org.irods.jargon.idrop.finder.FinderDeleteIRODSDialog;
import org.irods.jargon.idrop.finder.IRODSFinderDialog;
+import org.irods.jargon.transfer.dao.domain.Synchronization;
import org.irods.jargon.transfer.engine.TransferManager;
import org.irods.jargon.transfer.engine.TransferManager.ErrorStatus;
import org.irods.jargon.transfer.engine.TransferManager.RunningStatus;
import org.irods.jargon.transfer.engine.TransferManagerCallbackListener;
+import org.irods.jargon.transfer.engine.synch.SynchManagerService;
import org.netbeans.swing.outline.Outline;
import org.openide.util.Exceptions;
import org.slf4j.LoggerFactory;
@@ -1719,6 +1721,11 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
btnMainToolbarSync.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 28));
btnMainToolbarSync.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
btnMainToolbarSync.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ btnMainToolbarSync.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnMainToolbarSyncActionPerformed(evt);
+ }
+ });
pnlMainToolbarIcons.add(btnMainToolbarSync);
btnMainToolbarSettings.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon_settings.png"))); // NOI18N
@@ -2087,6 +2094,33 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
private void btnMainToolbarSearchFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMainToolbarSearchFilesActionPerformed
processSearchRequest();
}//GEN-LAST:event_btnMainToolbarSearchFilesActionPerformed
+
+ private void btnMainToolbarSyncActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMainToolbarSyncActionPerformed
+ log.info("synch now button pressed");
+
+ int result = JOptionPane.showConfirmDialog(this,
+ "Do you want to synchronize now?",
+ "Synchronize",
+ JOptionPane.OK_CANCEL_OPTION);
+ if (result == JOptionPane.OK_OPTION) {
+ try {
+ SynchManagerService synchConfigurationService = iDropCore.getTransferManager().getTransferServiceFactory().instanceSynchManagerService();
+ List<Synchronization> syncs = synchConfigurationService.listAllSynchronizations();
+ log.info("number of synchronizations to process: {}", syncs.size());
+ for (Synchronization sync: syncs) {
+ if (synchConfigurationService.isSynchRunning(sync)) {
+ MessageManager.showMessage(this, "Cannot schedule the synchronization, a synch is currently running", MessageManager.TITLE_MESSAGE);
+ return;
+ }
+ iDropCore.getTransferManager().enqueueASynch(sync, sync.buildIRODSAccountFromSynchronizationData());
+ }
+ } catch (Exception ex) {
+ log.error("error starting synch", ex);
+ MessageManager.showError(this, ex.getMessage(), MessageManager.TITLE_MESSAGE);
+ throw new IdropRuntimeException(ex);
+ }
+ }
+ }//GEN-LAST:event_btnMainToolbarSyncActionPerformed
/**
* @param args the command line arguments
*/