summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-04 06:04:27 (EDT)
committerEike Stepper2007-10-04 06:04:27 (EDT)
commit46b49ec6795edb1d1a6a9c6fcbdec9938f4395af (patch)
tree547c8e090be58fbc50c53f4b28237468fbf4f63a
parent472ba195981fd5996148ca2b80f1e740fe6a7a4c (diff)
downloadcdo-46b49ec6795edb1d1a6a9c6fcbdec9938f4395af.zip
cdo-46b49ec6795edb1d1a6a9c6fcbdec9938f4395af.tar.gz
cdo-46b49ec6795edb1d1a6a9c6fcbdec9938f4395af.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java99
2 files changed, 117 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
index 2cc49d9..c79f23c 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
@@ -2,6 +2,7 @@ package org.eclipse.emf.cdo.internal.ui.actions;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.internal.ui.SharedIcons;
+import org.eclipse.emf.cdo.internal.ui.dialogs.OpenAuditDialog;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
@@ -13,6 +14,8 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public final class OpenAuditAction extends AbstractOpenViewAction
{
+ private long timeStamp;
+
public OpenAuditAction(IWorkbenchPage page, CDOSession session)
{
super(page, "Open Audit", "Open a historical CDO view", SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR),
@@ -20,8 +23,22 @@ public final class OpenAuditAction extends AbstractOpenViewAction
}
@Override
+ protected void preRun() throws Exception
+ {
+ OpenAuditDialog dialog = new OpenAuditDialog(getPage());
+ if (dialog.open() == OpenAuditDialog.OK)
+ {
+ timeStamp = dialog.getTimeStamp();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
protected void doRun(IProgressMonitor monitor) throws Exception
{
- getSession().openAudit(new ResourceSetImpl(), System.currentTimeMillis());
+ getSession().openAudit(new ResourceSetImpl(), timeStamp);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
new file mode 100644
index 0000000..96b445d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
@@ -0,0 +1,99 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.SharedIcons;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+/**
+ * @author Eike Stepper
+ */
+public class OpenAuditDialog extends TitleAreaDialog
+{
+ public static final String TITLE = "Open Audit";
+
+ private IWorkbenchPage page;
+
+ private DateTime dateControl;
+
+ private DateTime timeControl;
+
+ private long timeStamp;
+
+ public OpenAuditDialog(IWorkbenchPage page)
+ {
+ super(new Shell(page.getWorkbenchWindow().getShell()));
+ this.page = page;
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return page;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayout(new GridLayout(3, false));
+
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
+
+ new Label(composite, SWT.NONE).setText("Target Time:");
+ dateControl = new DateTime(composite, SWT.DATE);
+ timeControl = new DateTime(composite, SWT.TIME);
+
+ return composite;
+ }
+
+ @Override
+ protected void okPressed()
+ {
+ GregorianCalendar calendar = new GregorianCalendar();
+ calendar.set(Calendar.YEAR, dateControl.getYear());
+ calendar.set(Calendar.MONTH, dateControl.getMonth());
+ calendar.set(Calendar.DATE, dateControl.getDay());
+ calendar.set(Calendar.HOUR_OF_DAY, timeControl.getHours());
+ calendar.set(Calendar.MINUTE, timeControl.getMinutes());
+ calendar.set(Calendar.SECOND, timeControl.getSeconds());
+
+ timeStamp = calendar.getTimeInMillis();
+ super.okPressed();
+ }
+}