Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/historical.gifbin0 -> 243 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/transactional.gifbin0 -> 210 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/delete_repository.gifbin3047 -> 3046 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_checkout.gifbin0 -> 2762 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo.gifbin0 -> 3106 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_clone.gif (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_clone.gif)bin864 -> 864 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_local.gif (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_local.gif)bin799 -> 799 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_remote.gif (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_remote.gif)bin805 -> 805 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_wizban.pngbin3558 -> 0 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml25
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java129
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRepositoryPage.java163
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRootObjectPage.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutTypePage.java132
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java156
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizardPage.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewBinaryResourceWizard.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewFolderWizard.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewResourceWizard.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewTextResourceWizard.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/AbstractNewWizard.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizardPage.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoriesView.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoryItemProvider.java71
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/AbstractRepositoryPage.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryLocalPage.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryTypePage.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java81
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/plugin.xml8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/AbstractBranchPointDialog.java123
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/CreateBranchDialog.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/ComposeBranchPointComposite.java245
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectBranchComposite.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectTimeStampComposite.java42
40 files changed, 1325 insertions, 291 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/historical.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/historical.gif
new file mode 100644
index 0000000000..b7ca6397fa
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/historical.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/transactional.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/transactional.gif
new file mode 100644
index 0000000000..feb8e94a74
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/transactional.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/delete_repository.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/delete_repository.gif
index 00a8ec41ab..f6caf6dd46 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/delete_repository.gif
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/delete_repository.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_checkout.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_checkout.gif
new file mode 100644
index 0000000000..4ea8b1c49c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_checkout.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo.gif
new file mode 100644
index 0000000000..85ec4825a7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_clone.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_clone.gif
index b14710d66f..b14710d66f 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_clone.gif
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_clone.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_local.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_local.gif
index 666ff32776..666ff32776 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_local.gif
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_local.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_remote.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_remote.gif
index 984c768e51..984c768e51 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_remote.gif
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/new_repo_remote.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_wizban.png b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_wizban.png
deleted file mode 100644
index 6f3bd40600..0000000000
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/wiz/repo_wizban.png
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
index 38dd336391..a4fc98e8c4 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
@@ -109,6 +109,19 @@
</view>
</extension>
+ <extension point="org.eclipse.ui.importWizards">
+ <wizard
+ category="org.eclipse.emf.cdo.category"
+ class="org.eclipse.emf.cdo.explorer.ui.checkouts.wizards.CheckoutWizard"
+ icon="icons/checkout.gif"
+ id="org.eclipse.emf.cdo.explorer.ui.checkout"
+ name="Checkout from CDO">
+ <description>
+ Connect to or checkout from a CDO model repository.
+ </description>
+ </wizard>
+ </extension>
+
<extension point="org.eclipse.ui.newWizards">
<wizard
category="org.eclipse.emf.cdo.category"
@@ -117,6 +130,9 @@
icon="icons/CDOResourceFolder.gif"
id="org.eclipse.emf.cdo.explorer.ui.new.folder"
name="Folder">
+ <description>
+ Create a new folder.
+ </description>
</wizard>
<wizard
category="org.eclipse.emf.cdo.category"
@@ -125,6 +141,9 @@
icon="icons/CDOResource.gif"
id="org.eclipse.emf.cdo.explorer.ui.new.resource"
name="Model Resource">
+ <description>
+ Create a new model resource.
+ </description>
</wizard>
<wizard
category="org.eclipse.emf.cdo.category"
@@ -133,6 +152,9 @@
icon="icons/CDOBinaryResource.gif"
id="org.eclipse.emf.cdo.explorer.ui.new.resource.binary"
name="Binary File">
+ <description>
+ Create a new binary file.
+ </description>
</wizard>
<wizard
category="org.eclipse.emf.cdo.category"
@@ -141,6 +163,9 @@
icon="icons/CDOTextResource.gif"
id="org.eclipse.emf.cdo.explorer.ui.new.resource.text"
name="Text File">
+ <description>
+ Create a new text file.
+ </description>
</wizard>
</extension>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java
index bf1d676175..264584fe60 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java
@@ -17,7 +17,7 @@ import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutContentProvider;
-import org.eclipse.emf.cdo.explorer.ui.checkouts.wizards.AbstractNewWizard;
+import org.eclipse.emf.cdo.explorer.ui.checkouts.wizards.NewWizard;
import org.eclipse.emf.cdo.internal.ui.actions.TransactionalBackgroundAction;
import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor.NewRootMenuPopulator;
@@ -380,9 +380,9 @@ public class NewActionProvider extends CommonActionProvider implements ISelectio
public IWorkbenchWizard createWizard() throws CoreException
{
IWorkbenchWizard wizard = delegate.createWizard();
- if (wizard instanceof AbstractNewWizard)
+ if (wizard instanceof NewWizard)
{
- AbstractNewWizard newWizard = (AbstractNewWizard)wizard;
+ NewWizard newWizard = (NewWizard)wizard;
newWizard.setContentProvider(contentProvider);
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java
new file mode 100644
index 0000000000..e56401c012
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * 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.explorer.ui.checkouts.wizards;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.widgets.ComposeBranchPointComposite;
+
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public class CheckoutBranchPointPage extends CheckoutWizardPage
+{
+ private CDOBranchPoint branchPoint;
+
+ private ComposeBranchPointComposite branchPointComposite;
+
+ private String timeStampError;
+
+ public CheckoutBranchPointPage()
+ {
+ super("New Checkout", "Select the type of the new checkout.");
+ }
+
+ public final CDOBranchPoint getBranchPoint()
+ {
+ return branchPoint;
+ }
+
+ public final void setBranchPoint(CDOBranchPoint branchPoint)
+ {
+ if (this.branchPoint != branchPoint)
+ {
+ this.branchPoint = branchPoint;
+ branchPointChanged(branchPoint);
+ }
+ }
+
+ public void setBranchPoint(int branchID, long timeStamp)
+ {
+ CheckoutRepositoryPage repositoryPage = getWizard().getRepositoryPage();
+ CDOSession session = repositoryPage.getSession();
+
+ CDOBranchManager branchManager = session.getBranchManager();
+ CDOBranch branch = branchManager.getBranch(branchID);
+
+ setBranchPoint(branch.getPoint(timeStamp));
+ }
+
+ @Override
+ protected void createUI(Composite parent)
+ {
+ branchPointComposite = new ComposeBranchPointComposite(parent, true, branchPoint)
+ {
+ @Override
+ protected void timeStampError(String message)
+ {
+ timeStampError = message;
+ validate();
+ }
+
+ @Override
+ protected void branchPointChanged(CDOBranchPoint branchPoint)
+ {
+ validate();
+ }
+
+ @Override
+ protected void doubleClicked()
+ {
+ if (isPageComplete())
+ {
+ getContainer().showPage(getNextPage());
+ }
+ }
+ };
+
+ branchPointComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
+ CDOBranch branch = branchPoint.getBranch();
+
+ TreeViewer branchViewer = branchPointComposite.getBranchViewer();
+ branchViewer.setSelection(new StructuredSelection(branch));
+ branchViewer.setExpandedState(branch, true);
+ }
+
+ @Override
+ protected void repositoryChanged(CDORepository repository)
+ {
+ super.repositoryChanged(repository);
+ setBranchPoint(CDOBranch.MAIN_BRANCH_ID, CDOBranchPoint.UNSPECIFIED_DATE);
+ }
+
+ @Override
+ protected boolean doValidate() throws Exception
+ {
+ if (timeStampError != null)
+ {
+ throw new Exception(timeStampError);
+ }
+
+ return true;
+ }
+
+ @Override
+ protected void fillProperties(Properties properties)
+ {
+ properties.setProperty("branchID", Integer.toString(branchPoint.getBranch().getID()));
+ properties.setProperty("timeStamp", Long.toString(branchPoint.getTimeStamp()));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java
new file mode 100644
index 0000000000..5a615b8d8b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * 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.explorer.ui.checkouts.wizards;
+
+import org.eclipse.swt.widgets.Composite;
+
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public class CheckoutLabelPage extends CheckoutWizardPage
+{
+ private String label;
+
+ public CheckoutLabelPage()
+ {
+ super("New Checkout", "Select the type of the new checkout.");
+ }
+
+ public final String getLabel()
+ {
+ return label;
+ }
+
+ public final void setLabel(String label)
+ {
+ this.label = label;
+ }
+
+ @Override
+ protected void createUI(Composite parent)
+ {
+ }
+
+ @Override
+ protected boolean doValidate() throws Exception
+ {
+ return true;
+ }
+
+ @Override
+ protected void fillProperties(Properties properties)
+ {
+ properties.setProperty("label", label);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRepositoryPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRepositoryPage.java
new file mode 100644
index 0000000000..ccf0b60c96
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRepositoryPage.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * 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.explorer.ui.checkouts.wizards;
+
+import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.explorer.ui.repositories.CDORepositoriesView;
+import org.eclipse.emf.cdo.explorer.ui.repositories.CDORepositoryItemProvider;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public class CheckoutRepositoryPage extends CheckoutWizardPage
+{
+ private CDORepository repository;
+
+ private CDOSession session;
+
+ private TableViewer tableViewer;
+
+ public CheckoutRepositoryPage()
+ {
+ super("Repository", "Select the CDO model repository from which to checkout.");
+ }
+
+ public final CDORepository getRepository()
+ {
+ return repository;
+ }
+
+ public final void setRepository(CDORepository repository)
+ {
+ if (this.repository != repository)
+ {
+ if (this.repository != null && session != null)
+ {
+ this.repository.releaseSession();
+ }
+
+ this.repository = repository;
+ repositoryChanged(repository);
+ }
+ }
+
+ public CDOSession getSession()
+ {
+ if (session == null && repository != null)
+ {
+ session = repository.acquireSession();
+ }
+
+ return session;
+ }
+
+ @Override
+ protected void createUI(final Composite parent)
+ {
+ TableColumnLayout tableLayout = new TableColumnLayout();
+
+ Composite tableComposite = new Composite(parent, SWT.NONE);
+ tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ tableComposite.setLayout(tableLayout);
+
+ CDORepositoryItemProvider itemProvider = new CDORepositoryItemProvider();
+
+ tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION);
+ tableViewer.setContentProvider(itemProvider);
+ tableViewer.setLabelProvider(itemProvider);
+ tableViewer.setInput(CDOExplorerUtil.getRepositoryManager());
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ validate();
+ }
+ });
+
+ Table table = tableViewer.getTable();
+ table.setHeaderVisible(true);
+
+ TableColumn repositoryColumn = new TableColumn(table, SWT.NONE);
+ repositoryColumn.setText("Repository");
+ tableLayout.setColumnData(repositoryColumn, new ColumnWeightData(100, 150, true));
+
+ TableColumn modeColumn = new TableColumn(table, SWT.NONE);
+ modeColumn.setText("Versioning Mode");
+ tableLayout.setColumnData(modeColumn, new ColumnWeightData(0, 100, true));
+
+ TableColumn idColumn = new TableColumn(table, SWT.NONE);
+ idColumn.setText("ID Generation");
+ tableLayout.setColumnData(idColumn, new ColumnWeightData(0, 90, true));
+
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
+ buttonComposite.setLayout(gridLayout);
+
+ Button newButton = new Button(buttonComposite, SWT.NONE);
+ newButton.setText("New Repository...");
+ newButton.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ Shell shell = parent.getShell();
+ CDORepositoriesView.newRepository(shell);
+ }
+ });
+ }
+
+ @Override
+ protected boolean doValidate() throws Exception
+ {
+ IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
+ if (selection.size() == 1)
+ {
+ setRepository((CDORepository)selection.getFirstElement());
+ }
+ else
+ {
+ setRepository(null);
+ }
+
+ return repository != null;
+ }
+
+ @Override
+ protected void fillProperties(Properties properties)
+ {
+ properties.setProperty("repository", repository.getID());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRootObjectPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRootObjectPage.java
new file mode 100644
index 0000000000..c678e63dd9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutRootObjectPage.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * 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.explorer.ui.checkouts.wizards;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutImpl;
+
+import org.eclipse.swt.widgets.Composite;
+
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public class CheckoutRootObjectPage extends CheckoutWizardPage
+{
+ private CDOID rootID;
+
+ public CheckoutRootObjectPage()
+ {
+ super("New Checkout", "Select the type of the new checkout.");
+ }
+
+ public final CDOID getRootID()
+ {
+ return rootID;
+ }
+
+ public final void setRootID(CDOID rootID)
+ {
+ this.rootID = rootID;
+ }
+
+ @Override
+ protected void createUI(Composite parent)
+ {
+ }
+
+ @Override
+ protected boolean doValidate() throws Exception
+ {
+ return true;
+ }
+
+ @Override
+ protected void fillProperties(Properties properties)
+ {
+ properties.setProperty("rootID", CDOCheckoutImpl.getCDOIDString(rootID));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutTypePage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutTypePage.java
new file mode 100644
index 0000000000..98290572bf
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutTypePage.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * 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.explorer.ui.checkouts.wizards;
+
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
+import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public class CheckoutTypePage extends CheckoutWizardPage
+{
+ private String type = CDOCheckout.TYPE_ONLINE;
+
+ private boolean readOnly;
+
+ public CheckoutTypePage()
+ {
+ super("New Checkout", "Select the type of the new checkout.");
+ }
+
+ public final String getType()
+ {
+ return type;
+ }
+
+ public final void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public final boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public final void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ @Override
+ protected GridData createCompositeGridData()
+ {
+ return new GridData(SWT.CENTER, SWT.CENTER, true, true);
+ }
+
+ @Override
+ protected void createUI(Composite parent)
+ {
+ addChoice(parent, "Online Transactional", "icons/transactional.gif", CDOCheckout.TYPE_ONLINE, false);
+ addChoice(parent, "Online Historical", "icons/historical.gif", CDOCheckout.TYPE_ONLINE, true);
+ addChoice(parent, "Offline", "icons/disconnect.gif", CDOCheckout.TYPE_OFFLINE, false);
+ }
+
+ private Button addChoice(Composite composite, String text, String imagePath, final String type, final boolean readOnly)
+ {
+ final SelectionListener listener = new SelectionListener()
+ {
+ public void widgetSelected(SelectionEvent e)
+ {
+ CheckoutTypePage.this.type = type;
+ CheckoutTypePage.this.readOnly = readOnly;
+ validate();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ widgetSelected(e);
+ getContainer().showPage(getNextPage());
+ }
+ };
+
+ Button button = new Button(composite, SWT.RADIO);
+ button.setText(text);
+ button.addSelectionListener(listener);
+ button.addMouseListener(new MouseAdapter()
+ {
+ @Override
+ public void mouseDoubleClick(MouseEvent e)
+ {
+ listener.widgetDefaultSelected(null);
+ }
+ });
+
+ Label imageLabel = new Label(composite, SWT.NONE);
+ imageLabel.setImage(OM.getImage(imagePath));
+
+ new Label(composite, SWT.NONE);
+ return button;
+ }
+
+ @Override
+ protected void repositoryChanged(CDORepository repository)
+ {
+ super.repositoryChanged(repository);
+ }
+
+ @Override
+ protected boolean doValidate() throws Exception
+ {
+ return true;
+ }
+
+ @Override
+ protected void fillProperties(Properties properties)
+ {
+ properties.setProperty("type", type);
+ properties.setProperty("readOnly", Boolean.toString(readOnly));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java
new file mode 100644
index 0000000000..1d8c2fc3c8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2009-2013 Eike Stepper (Berlin, Germany) and others.
+ * 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.explorer.ui.checkouts.wizards;
+
+import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckoutManager;
+import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.explorer.repositories.CDORepositoryElement;
+import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
+
+import org.eclipse.net4j.util.AdapterUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public class CheckoutWizard extends Wizard implements IImportWizard
+{
+ private CDORepositoryElement selectedElement;
+
+ private CheckoutRepositoryPage repositoryPage;
+
+ private CheckoutTypePage typePage;
+
+ private CheckoutBranchPointPage branchPointPage;
+
+ private CheckoutRootObjectPage rootObjectPage;
+
+ private CheckoutLabelPage labelPage;
+
+ public CheckoutWizard()
+ {
+ }
+
+ public final CheckoutRepositoryPage getRepositoryPage()
+ {
+ return repositoryPage;
+ }
+
+ public final CheckoutTypePage getTypePage()
+ {
+ return typePage;
+ }
+
+ public final CheckoutBranchPointPage getBranchPointPage()
+ {
+ return branchPointPage;
+ }
+
+ public final CheckoutRootObjectPage getRootObjectPage()
+ {
+ return rootObjectPage;
+ }
+
+ public final CheckoutLabelPage getLabelPage()
+ {
+ return labelPage;
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection)
+ {
+ if (selection.size() == 1)
+ {
+ Object element = selection.getFirstElement();
+ selectedElement = AdapterUtil.adapt(element, CDORepositoryElement.class);
+ }
+ }
+
+ @Override
+ public void addPages()
+ {
+ addPage(repositoryPage = new CheckoutRepositoryPage());
+ addPage(typePage = new CheckoutTypePage());
+ addPage(branchPointPage = new CheckoutBranchPointPage());
+ addPage(rootObjectPage = new CheckoutRootObjectPage());
+ addPage(labelPage = new CheckoutLabelPage());
+
+ if (selectedElement != null)
+ {
+ CDORepository repository = selectedElement.getRepository();
+ repositoryPage.setRepository(repository);
+
+ int branchID = selectedElement.getBranchID();
+ long timeStamp = selectedElement.getTimeStamp();
+ branchPointPage.setBranchPoint(branchID, timeStamp);
+ }
+ }
+
+ @Override
+ public boolean performFinish()
+ {
+ final Properties properties = new Properties();
+ repositoryPage.fillProperties(properties);
+ typePage.fillProperties(properties);
+ branchPointPage.fillProperties(properties);
+ rootObjectPage.fillProperties(properties);
+ labelPage.fillProperties(properties);
+
+ new Job("Checkout")
+ {
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ try
+ {
+ CDOCheckoutManager checkoutManager = CDOExplorerUtil.getCheckoutManager();
+ CDOCheckout checkout = checkoutManager.addCheckout(properties);
+ checkout.open();
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+
+ final IStatus status = new Status(IStatus.ERROR, OM.BUNDLE_ID, ex.getMessage(), ex);
+ UIUtil.getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ ErrorDialog.openError(getShell(), "Error", "An error occured while creating the checkout.", status);
+ }
+ });
+
+ return Status.OK_STATUS;
+ }
+ finally
+ {
+ }
+
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizardPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizardPage.java
new file mode 100644
index 0000000000..be84552227
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizardPage.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * 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.explorer.ui.checkouts.wizards;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
+
+import org.eclipse.jface.wizard.WizardPage;
+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.Layout;
+
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CheckoutWizardPage extends WizardPage
+{
+ public CheckoutWizardPage(String title, String message)
+ {
+ super("wizardPage");
+ setImageDescriptor(OM.getImageDescriptor("icons/wiz/new_checkout.gif"));
+ setTitle(title);
+ setMessage(message);
+ }
+
+ @Override
+ public final CheckoutWizard getWizard()
+ {
+ return (CheckoutWizard)super.getWizard();
+ }
+
+ public final void createControl(Composite parent)
+ {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout containerGridLayout = new GridLayout();
+ container.setLayout(containerGridLayout);
+ setControl(container);
+
+ Composite composite = new Composite(container, SWT.NONE);
+ composite.setLayoutData(createCompositeGridData());
+ composite.setLayout(createCompositeLayout());
+
+ createUI(composite);
+ validate();
+ }
+
+ protected GridData createCompositeGridData()
+ {
+ return new GridData(SWT.FILL, SWT.FILL, true, true);
+ }
+
+ protected Layout createCompositeLayout()
+ {
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ return gridLayout;
+ }
+
+ protected abstract void createUI(Composite parent);
+
+ protected void repositoryChanged(CDORepository repository)
+ {
+ CheckoutWizardPage nextPage = (CheckoutWizardPage)getNextPage();
+ if (nextPage != null)
+ {
+ nextPage.repositoryChanged(repository);
+ }
+ }
+
+ protected void typeChanged(String type, boolean readOnly)
+ {
+ CheckoutWizardPage nextPage = (CheckoutWizardPage)getNextPage();
+ if (nextPage != null)
+ {
+ nextPage.typeChanged(type, readOnly);
+ }
+ }
+
+ protected void branchPointChanged(CDOBranchPoint branchPoint)
+ {
+ CheckoutWizardPage nextPage = (CheckoutWizardPage)getNextPage();
+ if (nextPage != null)
+ {
+ nextPage.branchPointChanged(branchPoint);
+ }
+ }
+
+ protected void rootObjectChanged(CDOID rootID)
+ {
+ CheckoutWizardPage nextPage = (CheckoutWizardPage)getNextPage();
+ if (nextPage != null)
+ {
+ nextPage.rootObjectChanged(rootID);
+ }
+ }
+
+ protected final void validate()
+ {
+ try
+ {
+ boolean valid = doValidate();
+ setErrorMessage(null);
+ setPageComplete(valid);
+ }
+ catch (Exception ex)
+ {
+ setErrorMessage(ex.getMessage());
+ setPageComplete(false);
+ }
+ }
+
+ protected abstract boolean doValidate() throws Exception;
+
+ protected abstract void fillProperties(Properties properties);
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewBinaryResourceWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewBinaryResourceWizard.java
index 6756844100..2f53ee388b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewBinaryResourceWizard.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewBinaryResourceWizard.java
@@ -16,7 +16,7 @@ import org.eclipse.emf.cdo.eresource.EresourceFactory;
/**
* @author Eike Stepper
*/
-public class NewBinaryResourceWizard extends AbstractNewWizard
+public class NewBinaryResourceWizard extends NewWizard
{
public NewBinaryResourceWizard()
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewFolderWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewFolderWizard.java
index 0f751a3dd7..5b14b790bc 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewFolderWizard.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewFolderWizard.java
@@ -16,7 +16,7 @@ import org.eclipse.emf.cdo.eresource.EresourceFactory;
/**
* @author Eike Stepper
*/
-public class NewFolderWizard extends AbstractNewWizard
+public class NewFolderWizard extends NewWizard
{
public NewFolderWizard()
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewResourceWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewResourceWizard.java
index 903f33315d..10c095cbc2 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewResourceWizard.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewResourceWizard.java
@@ -16,7 +16,7 @@ import org.eclipse.emf.cdo.eresource.EresourceFactory;
/**
* @author Eike Stepper
*/
-public class NewResourceWizard extends AbstractNewWizard
+public class NewResourceWizard extends NewWizard
{
public NewResourceWizard()
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewTextResourceWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewTextResourceWizard.java
index 457d3a65d2..29c36418d9 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewTextResourceWizard.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewTextResourceWizard.java
@@ -16,7 +16,7 @@ import org.eclipse.emf.cdo.eresource.EresourceFactory;
/**
* @author Eike Stepper
*/
-public class NewTextResourceWizard extends AbstractNewWizard
+public class NewTextResourceWizard extends NewWizard
{
public NewTextResourceWizard()
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/AbstractNewWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java
index 58f2cc7282..d447907b74 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/AbstractNewWizard.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java
@@ -37,7 +37,7 @@ import org.eclipse.ui.IWorkbench;
/**
* @author Eike Stepper
*/
-public abstract class AbstractNewWizard extends Wizard implements INewWizard
+public abstract class NewWizard extends Wizard implements INewWizard
{
private final String resourceType;
@@ -49,7 +49,7 @@ public abstract class AbstractNewWizard extends Wizard implements INewWizard
private NewWizardPage page;
- protected AbstractNewWizard(String resourceType, String title)
+ protected NewWizard(String resourceType, String title)
{
this.resourceType = resourceType;
this.title = title;
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizardPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizardPage.java
index 804df47180..965d81ef11 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizardPage.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizardPage.java
@@ -79,9 +79,9 @@ public class NewWizardPage extends WizardPage
}
@Override
- public AbstractNewWizard getWizard()
+ public NewWizard getWizard()
{
- return (AbstractNewWizard)super.getWizard();
+ return (NewWizard)super.getWizard();
}
public final Object getParent()
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoriesView.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoriesView.java
index 03b6f3bcac..e7f69cc17d 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoriesView.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoriesView.java
@@ -17,10 +17,9 @@ import org.eclipse.emf.cdo.explorer.repositories.CDORepository.State;
import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
import org.eclipse.emf.cdo.explorer.ui.checkouts.actions.ShowInActionProvider;
import org.eclipse.emf.cdo.explorer.ui.repositories.wizards.NewRepositoryWizard;
+import org.eclipse.emf.cdo.internal.explorer.repositories.CDORepositoryImpl;
import org.eclipse.emf.cdo.internal.explorer.repositories.CDORepositoryManagerImpl;
import org.eclipse.emf.cdo.internal.explorer.repositories.LocalCDORepository;
-import org.eclipse.emf.cdo.internal.explorer.repositories.LocalCDORepository.IDGeneration;
-import org.eclipse.emf.cdo.internal.explorer.repositories.LocalCDORepository.VersioningMode;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
@@ -140,8 +139,9 @@ public class CDORepositoriesView extends ContainerView
properties.setProperty(LocalCDORepository.PROP_TYPE, CDORepository.TYPE_LOCAL);
properties.setProperty(LocalCDORepository.PROP_LABEL, "repo2");
properties.setProperty(LocalCDORepository.PROP_NAME, "repo2");
- properties.setProperty(LocalCDORepository.PROP_VERSIONING_MODE, VersioningMode.Branching.toString());
- properties.setProperty(LocalCDORepository.PROP_ID_GENERATION, IDGeneration.UUID.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_VERSIONING_MODE,
+ CDORepository.VersioningMode.Branching.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_ID_GENERATION, CDORepository.IDGeneration.UUID.toString());
properties.setProperty(LocalCDORepository.PROP_TCP_DISABLED, "false");
properties.setProperty(LocalCDORepository.PROP_TCP_PORT, "2037");
@@ -250,6 +250,20 @@ public class CDORepositoriesView extends ContainerView
itemProvider.connectRepository(repository);
}
+ public static void newRepository(Shell shell)
+ {
+ try
+ {
+ WizardDialog dialog = new WizardDialog(shell, new NewRepositoryWizard());
+ dialog.open();
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ throw ex;
+ }
+ }
+
/**
* @author Eike Stepper
*/
@@ -347,17 +361,8 @@ public class CDORepositoriesView extends ContainerView
@Override
public void run()
{
- try
- {
- Shell shell = getSite().getShell();
- WizardDialog dialog = new WizardDialog(shell, new NewRepositoryWizard());
- dialog.open();
- }
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- throw ex;
- }
+ Shell shell = getSite().getShell();
+ newRepository(shell);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoryItemProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoryItemProvider.java
index bbe04deaee..d73f443c9d 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoryItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/CDORepositoryItemProvider.java
@@ -29,6 +29,7 @@ import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
@@ -43,7 +44,7 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* @author Eike Stepper
*/
-public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<Object>>
+public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<Object>> implements ITableLabelProvider
{
private static final Image IMAGE_REPO = SharedIcons.getImage(SharedIcons.OBJ_REPO);
@@ -91,26 +92,37 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
private void updatePropertySheetPage(final Object element)
{
- getDisplay().asyncExec(new Runnable()
+ if (repositoriesView != null)
{
- public void run()
+ getDisplay().asyncExec(new Runnable()
{
- IStructuredSelection selection = (IStructuredSelection)repositoriesView.getSelection();
- for (Object object : selection.toArray())
+ public void run()
{
- if (object == element)
+ IStructuredSelection selection = (IStructuredSelection)repositoriesView.getSelection();
+ for (Object object : selection.toArray())
{
- repositoriesView.refreshPropertySheetPage();
- return;
+ if (object == element)
+ {
+ repositoriesView.refreshPropertySheetPage();
+ return;
+ }
}
}
- }
- });
+ });
+ }
}
};
private final CDORepositoriesView repositoriesView;
+ private boolean grayOutDisconnectedRepositories = true;
+
+ public CDORepositoryItemProvider()
+ {
+ this(null);
+ grayOutDisconnectedRepositories = false;
+ }
+
public CDORepositoryItemProvider(CDORepositoriesView repositoriesView)
{
this.repositoriesView = repositoriesView;
@@ -269,13 +281,40 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
return super.getText(element);
}
+ public String getColumnText(Object element, int columnIndex)
+ {
+ switch (columnIndex)
+ {
+ case 0:
+ return getText(element);
+
+ case 1:
+ if (element instanceof CDORepository)
+ {
+ CDORepository repository = (CDORepository)element;
+ return repository.getVersioningMode().toString();
+ }
+
+ break;
+
+ case 2:
+ if (element instanceof CDORepository)
+ {
+ CDORepository repository = (CDORepository)element;
+ return repository.getIDGeneration().toString();
+ }
+ }
+
+ return "";
+ }
+
@Override
public Image getImage(Object obj)
{
if (obj instanceof CDORepository)
{
CDORepository repository = (CDORepository)obj;
- if (!repository.isConnected())
+ if (!repository.isConnected() && grayOutDisconnectedRepositories)
{
return imageRepoDisconnected;
}
@@ -291,6 +330,16 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
return super.getImage(obj);
}
+ public Image getColumnImage(Object element, int columnIndex)
+ {
+ if (columnIndex == 0)
+ {
+ return getImage(element);
+ }
+
+ return null;
+ }
+
@Override
protected boolean isSlow(IContainer<Object> container)
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/AbstractRepositoryPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/AbstractRepositoryPage.java
index d0f2bf8ca8..79d6b3d1e6 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/AbstractRepositoryPage.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/AbstractRepositoryPage.java
@@ -42,7 +42,7 @@ public abstract class AbstractRepositoryPage extends WizardPage implements Selec
public AbstractRepositoryPage(String pageName, String defaultLabel)
{
super(pageName);
- setImageDescriptor(OM.getImageDescriptor("icons/wiz/repo_wizban.png"));
+ setImageDescriptor(OM.getImageDescriptor("icons/wiz/new_repo.gif"));
this.defaultLabel = defaultLabel;
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryLocalPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryLocalPage.java
index 999da2d4fb..6ccd089487 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryLocalPage.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryLocalPage.java
@@ -13,9 +13,8 @@ package org.eclipse.emf.cdo.explorer.ui.repositories.wizards;
import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
import org.eclipse.emf.cdo.explorer.repositories.CDORepositoryManager;
+import org.eclipse.emf.cdo.internal.explorer.repositories.CDORepositoryImpl;
import org.eclipse.emf.cdo.internal.explorer.repositories.LocalCDORepository;
-import org.eclipse.emf.cdo.internal.explorer.repositories.LocalCDORepository.IDGeneration;
-import org.eclipse.emf.cdo.internal.explorer.repositories.LocalCDORepository.VersioningMode;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.io.IOUtil;
@@ -160,24 +159,24 @@ public class RepositoryLocalPage extends AbstractRepositoryPage
if (normalButton.getSelection())
{
- properties.setProperty(LocalCDORepository.PROP_VERSIONING_MODE, VersioningMode.Normal.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_VERSIONING_MODE, CDORepository.VersioningMode.Normal.toString());
}
else if (auditingButton.getSelection())
{
- properties.setProperty(LocalCDORepository.PROP_VERSIONING_MODE, VersioningMode.Auditing.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_VERSIONING_MODE, CDORepository.VersioningMode.Auditing.toString());
}
else if (branchingButton.getSelection())
{
- properties.setProperty(LocalCDORepository.PROP_VERSIONING_MODE, VersioningMode.Branching.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_VERSIONING_MODE, CDORepository.VersioningMode.Branching.toString());
}
if (counterButton.getSelection())
{
- properties.setProperty(LocalCDORepository.PROP_ID_GENERATION, IDGeneration.Counter.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_ID_GENERATION, CDORepository.IDGeneration.Counter.toString());
}
else if (uuidButton.getSelection())
{
- properties.setProperty(LocalCDORepository.PROP_ID_GENERATION, IDGeneration.UUID.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_ID_GENERATION, CDORepository.IDGeneration.UUID.toString());
}
boolean tcpPortDisabled = portText.isDisabled();
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryTypePage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryTypePage.java
index db9b1fd6db..6749225843 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryTypePage.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/repositories/wizards/RepositoryTypePage.java
@@ -34,10 +34,9 @@ public class RepositoryTypePage extends WizardPage
public RepositoryTypePage()
{
super("wizardPage");
- setImageDescriptor(OM.getImageDescriptor("icons/wiz/repo_wizban.png"));
+ setImageDescriptor(OM.getImageDescriptor("icons/wiz/new_repo.gif"));
setTitle("New Repository");
setMessage("Select the type of the new repository.");
- setDescription("Wizard Page description");
}
public void createControl(Composite parent)
@@ -54,13 +53,13 @@ public class RepositoryTypePage extends WizardPage
NewRepositoryWizard wizard = getWizard();
RepositoryRemotePage remotePage = wizard.getRemotePage();
- addChoice(composite, "Connect to an existing remote repository.", "icons/wiz/repo_remote.gif", remotePage, true);
+ addChoice(composite, "Connect to an existing remote repository.", "icons/wiz/new_repo_remote.gif", remotePage, true);
RepositoryClonePage clonePage = wizard.getClonePage();
- addChoice(composite, "Clone an existing remote repository.", "icons/wiz/repo_clone.gif", clonePage, false);
+ addChoice(composite, "Clone an existing remote repository.", "icons/wiz/new_repo_clone.gif", clonePage, false);
RepositoryLocalPage localPage = wizard.getLocalPage();
- addChoice(composite, "Create a new local repository.", "icons/wiz/repo_local.gif", localPage, true);
+ addChoice(composite, "Create a new local repository.", "icons/wiz/new_repo_local.gif", localPage, true);
nextPage = remotePage;
setPageComplete(true);
@@ -71,10 +70,7 @@ public class RepositoryTypePage extends WizardPage
{
this.nextPage = nextPage;
- Button button = new Button(composite, SWT.RADIO);
- button.setText(text);
- button.setEnabled(enabled);
- button.addSelectionListener(new SelectionListener()
+ final SelectionListener listener = new SelectionListener()
{
public void widgetSelected(SelectionEvent e)
{
@@ -86,15 +82,18 @@ public class RepositoryTypePage extends WizardPage
widgetSelected(e);
getContainer().showPage(nextPage);
}
- });
+ };
+ Button button = new Button(composite, SWT.RADIO);
+ button.setText(text);
+ button.setEnabled(enabled);
+ button.addSelectionListener(listener);
button.addMouseListener(new MouseAdapter()
{
@Override
public void mouseDoubleClick(MouseEvent e)
{
- RepositoryTypePage.this.nextPage = nextPage;
- getContainer().showPage(nextPage);
+ listener.widgetDefaultSelected(null);
}
});
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java
index d237b1d525..7d8b9bcf93 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/repositories/CDORepository.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.explorer.repositories;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.explorer.CDOExplorerElement;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
@@ -49,6 +50,10 @@ public interface CDORepository extends CDOExplorerElement, IContainer<CDOBranch>
public String getURI();
+ public VersioningMode getVersioningMode();
+
+ public IDGeneration getIDGeneration();
+
public State getState();
public boolean isConnected();
@@ -68,6 +73,54 @@ public interface CDORepository extends CDOExplorerElement, IContainer<CDOBranch>
/**
* @author Eike Stepper
*/
+ public enum VersioningMode
+ {
+ Normal(false, false), Auditing(true, false), Branching(true, true);
+
+ private boolean supportingAudits;
+
+ private boolean supportingBranches;
+
+ private VersioningMode(boolean supportingAudits, boolean supportingBranches)
+ {
+ this.supportingAudits = supportingAudits;
+ this.supportingBranches = supportingBranches;
+ }
+
+ public boolean isSupportingAudits()
+ {
+ return supportingAudits;
+ }
+
+ public boolean isSupportingBranches()
+ {
+ return supportingBranches;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum IDGeneration
+ {
+ Counter(IDGenerationLocation.STORE), UUID(IDGenerationLocation.CLIENT);
+
+ private IDGenerationLocation location;
+
+ private IDGeneration(IDGenerationLocation location)
+ {
+ this.location = location;
+ }
+
+ public final IDGenerationLocation getLocation()
+ {
+ return location;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
public enum State
{
Connecting, Connected, Disconnecting, Disconnected
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
index 318545ccc7..feaaecc14c 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
@@ -317,9 +317,18 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
return readOnly;
}
- public final void setReadOnly(boolean readOnly)
+ public void setReadOnly(boolean readOnly)
{
- this.readOnly = readOnly;
+ if (state != State.Open)
+ {
+ throw new IllegalStateException("Checkout is not closed: " + this);
+ }
+
+ if (this.readOnly != readOnly)
+ {
+ this.readOnly = readOnly;
+ save();
+ }
}
public final CDOID getRootID()
@@ -717,7 +726,7 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
branchPath = properties.getProperty(PROP_BRANCH_PATH);
branchPoints = properties.getProperty(PROP_BRANCH_POINTS);
timeStamp = Long.parseLong(properties.getProperty(PROP_TIME_STAMP));
- readOnly = Boolean.parseBoolean(properties.getProperty(PROP_READ_ONLY));
+ readOnly = isOnline() ? Boolean.parseBoolean(properties.getProperty(PROP_READ_ONLY)) : false;
rootID = CDOIDUtil.read(properties.getProperty(PROP_ROOT_ID));
((CDORepositoryImpl)repository).addCheckout(this);
@@ -730,7 +739,7 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
properties.setProperty(PROP_REPOSITORY, repository.getID());
properties.setProperty(PROP_BRANCH_ID, Integer.toString(branchID));
properties.setProperty(PROP_TIME_STAMP, Long.toString(timeStamp));
- properties.setProperty(PROP_READ_ONLY, Boolean.toString(readOnly));
+ properties.setProperty(PROP_READ_ONLY, Boolean.toString(isOnline() ? readOnly : false));
if (branchPath != null)
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
index 71c16d7a79..c978daee29 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
@@ -109,6 +109,12 @@ public class OfflineCDOCheckout extends CDOCheckoutImpl
return false;
}
+ @Override
+ public void setReadOnly(boolean readOnly)
+ {
+ throw new IllegalStateException("Checkout is offline: " + this);
+ }
+
public final InternalCDOWorkspace getWorkspace()
{
return workspace;
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java
index 00513f3001..00c5e1d733 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/CDORepositoryImpl.java
@@ -107,6 +107,10 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
private String name;
+ private CDORepository.VersioningMode versioningMode;
+
+ private CDORepository.IDGeneration idGeneration;
+
private State state = State.Disconnected;
private boolean explicitelyConnected;
@@ -115,6 +119,10 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
private CDOSession session;
+ public static final String PROP_VERSIONING_MODE = "versioningMode";
+
+ public static final String PROP_ID_GENERATION = "idGeneration";
+
public CDORepositoryImpl()
{
}
@@ -135,6 +143,16 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
return name;
}
+ public final CDORepository.VersioningMode getVersioningMode()
+ {
+ return versioningMode;
+ }
+
+ public final CDORepository.IDGeneration getIDGeneration()
+ {
+ return idGeneration;
+ }
+
public final State getState()
{
return state;
@@ -463,6 +481,9 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
{
super.init(folder, type, properties);
name = properties.getProperty(PROP_NAME);
+ versioningMode = CDORepository.VersioningMode.valueOf(properties
+ .getProperty(CDORepositoryImpl.PROP_VERSIONING_MODE));
+ idGeneration = CDORepository.IDGeneration.valueOf(properties.getProperty(CDORepositoryImpl.PROP_ID_GENERATION));
}
@Override
@@ -470,6 +491,8 @@ public abstract class CDORepositoryImpl extends AbstractElement implements CDORe
{
super.collectProperties(properties);
properties.setProperty(PROP_NAME, name);
+ properties.setProperty(CDORepositoryImpl.PROP_VERSIONING_MODE, versioningMode.toString());
+ properties.setProperty(CDORepositoryImpl.PROP_ID_GENERATION, idGeneration.toString());
}
protected IConnector getConnector()
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java
index 5a48ac4c7d..22b346c717 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/repositories/LocalCDORepository.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.internal.explorer.repositories;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.db.CDODBUtil;
@@ -38,18 +37,10 @@ import java.util.Properties;
*/
public class LocalCDORepository extends CDORepositoryImpl
{
- public static final String PROP_VERSIONING_MODE = "versioningMode";
-
- public static final String PROP_ID_GENERATION = "idGeneration";
-
public static final String PROP_TCP_DISABLED = "tcpDisabled";
public static final String PROP_TCP_PORT = "tcpPort";
- private VersioningMode versioningMode;
-
- private IDGeneration idGeneration;
-
private boolean tcpDisabled;
private int tcpPort;
@@ -97,16 +88,6 @@ public class LocalCDORepository extends CDORepositoryImpl
return "tcp://localhost:" + tcpPort + "/" + getName();
}
- public final VersioningMode getVersioningMode()
- {
- return versioningMode;
- }
-
- public final IDGeneration getIDGeneration()
- {
- return idGeneration;
- }
-
public final boolean isTCPDisabled()
{
return tcpDisabled;
@@ -121,8 +102,6 @@ public class LocalCDORepository extends CDORepositoryImpl
protected void init(File folder, String type, Properties properties)
{
super.init(folder, type, properties);
- versioningMode = VersioningMode.valueOf(properties.getProperty(PROP_VERSIONING_MODE));
- idGeneration = IDGeneration.valueOf(properties.getProperty(PROP_ID_GENERATION));
tcpDisabled = Boolean.parseBoolean(properties.getProperty(PROP_TCP_DISABLED));
if (!tcpDisabled)
{
@@ -134,8 +113,6 @@ public class LocalCDORepository extends CDORepositoryImpl
protected void collectProperties(Properties properties)
{
super.collectProperties(properties);
- properties.setProperty(PROP_VERSIONING_MODE, versioningMode.toString());
- properties.setProperty(PROP_ID_GENERATION, idGeneration.toString());
properties.setProperty(PROP_TCP_DISABLED, Boolean.toString(tcpDisabled));
properties.setProperty(PROP_TCP_PORT, Integer.toString(tcpPort));
}
@@ -149,8 +126,8 @@ public class LocalCDORepository extends CDORepositoryImpl
JdbcDataSource dataSource = new JdbcDataSource();
dataSource.setURL("jdbc:h2:" + folder);
- IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(versioningMode.isSupportingAudits(),
- versioningMode.isSupportingBranches(), false);
+ IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(getVersioningMode()
+ .isSupportingAudits(), getVersioningMode().isSupportingBranches(), false);
mappingStrategy.setProperties(getMappingStrategyProperties());
IDBAdapter dbAdapter = DBUtil.getDBAdapter("h2");
@@ -175,9 +152,9 @@ public class LocalCDORepository extends CDORepositoryImpl
{
Map<String, String> props = new HashMap<String, String>();
props.put(IRepository.Props.OVERRIDE_UUID, "");
- props.put(IRepository.Props.SUPPORTING_AUDITS, Boolean.toString(versioningMode.isSupportingAudits()));
- props.put(IRepository.Props.SUPPORTING_BRANCHES, Boolean.toString(versioningMode.isSupportingBranches()));
- props.put(IRepository.Props.ID_GENERATION_LOCATION, idGeneration.getLocation().toString());
+ props.put(IRepository.Props.SUPPORTING_AUDITS, Boolean.toString(getVersioningMode().isSupportingAudits()));
+ props.put(IRepository.Props.SUPPORTING_BRANCHES, Boolean.toString(getVersioningMode().isSupportingBranches()));
+ props.put(IRepository.Props.ID_GENERATION_LOCATION, getIDGeneration().getLocation().toString());
return props;
}
@@ -200,52 +177,4 @@ public class LocalCDORepository extends CDORepositoryImpl
LifecycleUtil.deactivate(repository);
repository = null;
}
-
- /**
- * @author Eike Stepper
- */
- public enum VersioningMode
- {
- Normal(false, false), Auditing(true, false), Branching(true, true);
-
- private boolean supportingAudits;
-
- private boolean supportingBranches;
-
- private VersioningMode(boolean supportingAudits, boolean supportingBranches)
- {
- this.supportingAudits = supportingAudits;
- this.supportingBranches = supportingBranches;
- }
-
- public boolean isSupportingAudits()
- {
- return supportingAudits;
- }
-
- public boolean isSupportingBranches()
- {
- return supportingBranches;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public enum IDGeneration
- {
- Counter(IDGenerationLocation.STORE), UUID(IDGenerationLocation.CLIENT);
-
- private IDGenerationLocation location;
-
- private IDGeneration(IDGenerationLocation location)
- {
- this.location = location;
- }
-
- public final IDGenerationLocation getLocation()
- {
- return location;
- }
- }
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
index 8ffee77ecb..306fae6a6c 100644
--- a/plugins/org.eclipse.emf.cdo.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
@@ -88,6 +88,14 @@
</editor>
</extension>
+ <extension
+ point="org.eclipse.ui.importWizards">
+ <category
+ id="org.eclipse.emf.cdo.category"
+ name="CDO">
+ </category>
+ </extension>
+
<extension
point="org.eclipse.ui.newWizards">
<category
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/AbstractBranchPointDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/AbstractBranchPointDialog.java
index 04bcc508d6..59fd81649b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/AbstractBranchPointDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/AbstractBranchPointDialog.java
@@ -12,19 +12,10 @@ package org.eclipse.emf.cdo.internal.ui.dialogs;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.ui.CDOItemProvider;
-import org.eclipse.emf.cdo.ui.widgets.SelectTimeStampComposite;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.ui.ValidationContext;
+import org.eclipse.emf.cdo.ui.widgets.ComposeBranchPointComposite;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
@@ -34,7 +25,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
/**
@@ -44,11 +34,9 @@ public abstract class AbstractBranchPointDialog extends TitleAreaDialog
{
private final boolean allowTimeStamp;
- private CDOBranchPoint branchPoint;
-
- private TreeViewer branchViewer;
+ private final CDOBranchPoint branchPoint;
- private SelectTimeStampComposite timeStampComposite;
+ private ComposeBranchPointComposite branchPointComposite;
private String timeStampError;
@@ -68,6 +56,11 @@ public abstract class AbstractBranchPointDialog extends TitleAreaDialog
public final CDOBranchPoint getBranchPoint()
{
+ if (branchPointComposite != null)
+ {
+ return branchPointComposite.getBranchPoint();
+ }
+
return branchPoint;
}
@@ -99,72 +92,40 @@ public abstract class AbstractBranchPointDialog extends TitleAreaDialog
protected void createUI(Composite container)
{
- CDOBranch branch = branchPoint.getBranch();
- CDOItemProvider itemProvider = new CDOItemProvider(null);
-
- branchViewer = new TreeViewer(container, SWT.BORDER | SWT.SINGLE);
- branchViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
- branchViewer.setLabelProvider(itemProvider);
- branchViewer.setContentProvider(itemProvider);
- branchViewer.setInput(branch.getBranchManager());
- branchViewer.addSelectionChangedListener(new ISelectionChangedListener()
+ branchPointComposite = new ComposeBranchPointComposite(container, allowTimeStamp, branchPoint)
{
- public void selectionChanged(SelectionChangedEvent event)
+ @Override
+ protected void timeStampError(String message)
{
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- CDOBranch branch = (CDOBranch)selection.getFirstElement();
+ timeStampError = message;
+ validate();
+ }
- if (timeStampComposite != null)
+ @Override
+ protected void branchPointChanged(CDOBranchPoint branchPoint)
+ {
+ if (validate())
{
- timeStampComposite.setBranch(branch);
+ AbstractBranchPointDialog.this.branchPointChanged(branchPoint);
}
-
- composeBranchPoint();
- validate();
}
- });
- branchViewer.addDoubleClickListener(new IDoubleClickListener()
- {
- public void doubleClick(DoubleClickEvent event)
+ @Override
+ protected void doubleClicked()
{
- doubleClicked();
+ AbstractBranchPointDialog.this.doubleClicked();
}
- });
+ };
+
+ branchPointComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
+ CDOBranch branch = branchPoint.getBranch();
+ TreeViewer branchViewer = branchPointComposite.getBranchViewer();
branchViewer.setSelection(new StructuredSelection(branch));
branchViewer.setExpandedState(branch, true);
-
- if (allowTimeStamp)
- {
- Group timeStampGroup = new Group(container, SWT.NONE);
- timeStampGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
- timeStampGroup.setLayout(new GridLayout(1, false));
- timeStampGroup.setText("Time Stamp:");
-
- timeStampComposite = new SelectTimeStampComposite(timeStampGroup, SWT.NONE, branch, branchPoint.getTimeStamp())
- {
- @Override
- protected void timeStampChanged(long timeStamp)
- {
- composeBranchPoint();
- }
- };
-
- timeStampComposite.getTimeBrowseButton().setVisible(false);
- timeStampComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- timeStampComposite.setValidationContext(new ValidationContext()
- {
- public void setValidationError(Object source, String message)
- {
- timeStampError = message;
- validate();
- }
- });
- }
}
- protected final void validate()
+ protected final boolean validate()
{
String error = timeStampError;
@@ -187,6 +148,8 @@ public abstract class AbstractBranchPointDialog extends TitleAreaDialog
{
button.setEnabled(error == null);
}
+
+ return error == null;
}
protected void doValidate() throws Exception
@@ -194,33 +157,9 @@ public abstract class AbstractBranchPointDialog extends TitleAreaDialog
// Do nothing.
}
- private void composeBranchPoint()
- {
- if (branchViewer == null)
- {
- return;
- }
-
- CDOBranchPoint oldBranchPoint = branchPoint;
-
- IStructuredSelection selection = (IStructuredSelection)branchViewer.getSelection();
- CDOBranch branch = (CDOBranch)selection.getFirstElement();
-
- long timeStamp = CDOBranchPoint.UNSPECIFIED_DATE;
- if (timeStampComposite != null)
- {
- timeStamp = timeStampComposite.getTimeStamp();
- }
-
- branchPoint = branch.getPoint(timeStamp);
- if (!ObjectUtil.equals(branchPoint, oldBranchPoint))
- {
- branchPointChanged(branchPoint);
- }
- }
-
protected void branchPointChanged(CDOBranchPoint branchPoint)
{
+ // Do nothing.
}
protected void doubleClicked()
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/CreateBranchDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/CreateBranchDialog.java
index e0b92a2496..1124746111 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/CreateBranchDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/CreateBranchDialog.java
@@ -95,7 +95,7 @@ public class CreateBranchDialog extends AbstractBranchPointDialog
if (name.contains("/") || name.contains("\\"))
{
- throw new Exception("Name constains a path separator.");
+ throw new Exception("Name contains a path separator.");
}
CDOBranch baseBranch = getBranchPoint().getBranch();
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/ComposeBranchPointComposite.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/ComposeBranchPointComposite.java
index bca62d669b..2f63457ae6 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/ComposeBranchPointComposite.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/ComposeBranchPointComposite.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2012 Eike Stepper (Berlin, Germany) and others.
* 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
@@ -13,83 +13,207 @@ package org.eclipse.emf.cdo.ui.widgets;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.CDOItemProvider;
import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.ValidationContext;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
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.Group;
/**
* Composed UI widget offering functionality for users to select {@link org.eclipse.emf.cdo.common.branch.CDOBranch
* branches} and a {@link org.eclipse.emf.cdo.common.branch.CDOBranchPoint timestamp} within a branch for a particular
* {@link org.eclipse.emf.cdo.session.CDOSession CDOSession}
- *
+ *
* @author Eike Stepper
* @since 4.0
*/
public class ComposeBranchPointComposite extends Composite
{
- private CDOSession session;
+ private final boolean allowTimeStamp;
private CDOBranchPoint branchPoint;
- private SelectBranchComposite selectBranchComposite;
+ private TreeViewer branchViewer;
- private SelectTimeStampComposite selectTimeStampComposite;
+ private SelectTimeStampComposite timeStampComposite;
+ /**
+ * @since 4.4
+ */
+ public ComposeBranchPointComposite(Composite parent, boolean allowTimeStamp, CDOBranchPoint branchPoint)
+ {
+ this(parent, SWT.NONE, null, branchPoint, allowTimeStamp);
+ }
+
+ /**
+ * @deprecated as of 4.4 use {@link #ComposeBranchPointComposite(Composite, boolean, CDOBranchPoint)}.
+ */
+ @Deprecated
public ComposeBranchPointComposite(Composite parent, int style, CDOSession session, CDOBranchPoint branchPoint,
boolean allowTimeStamp)
{
super(parent, style);
- this.session = session;
+ this.allowTimeStamp = allowTimeStamp;
this.branchPoint = branchPoint;
- GridLayout gridLayout = UIUtil.createGridLayout(1);
- gridLayout.verticalSpacing = 5;
+ GridLayout containerGridLayout = new GridLayout(1, false);
+ containerGridLayout.marginWidth = 0;
+ containerGridLayout.marginHeight = 0;
+ containerGridLayout.verticalSpacing = 10;
- setLayout(gridLayout);
+ setLayout(containerGridLayout);
+ createUI();
+ }
- CDOBranch branch = branchPoint == null ? session.getBranchManager().getMainBranch() : branchPoint.getBranch();
- if (session.getRepositoryInfo().isSupportingBranches())
- {
- selectBranchComposite = createSelectBranchComposite(session, branch);
- selectBranchComposite.setLayoutData(UIUtil.createGridData());
- selectBranchComposite.getBranchViewer().expandAll();
- }
+ /**
+ * @since 4.4
+ */
+ public boolean isAllowTimeStamp()
+ {
+ return allowTimeStamp;
+ }
- if (allowTimeStamp)
+ public CDOBranchPoint getBranchPoint()
+ {
+ return branchPoint;
+ }
+
+ /**
+ * @since 4.4
+ */
+ public void setBranchPoint(CDOBranchPoint branchPoint)
+ {
+ this.branchPoint = branchPoint;
+ if (branchPoint != null)
{
- long timeStamp = branchPoint == null ? CDOBranchPoint.UNSPECIFIED_DATE : branchPoint.getTimeStamp();
- selectTimeStampComposite = createSelectTimeStampComposite(branch, timeStamp);
- selectTimeStampComposite.setLayoutData(UIUtil.createGridData(true, false));
+ CDOBranch branch = branchPoint.getBranch();
+ long timeStamp = branchPoint.getTimeStamp();
+
+ if (branchViewer != null)
+ {
+ branchViewer.setSelection(new StructuredSelection(branch));
+ }
+
+ if (timeStampComposite != null)
+ {
+ timeStampComposite.setBranch(branch);
+ timeStampComposite.setTimeStamp(timeStamp);
+ }
}
}
- public CDOSession getSession()
+ /**
+ * @since 4.4
+ */
+ public TreeViewer getBranchViewer()
{
- return session;
+ return branchViewer;
}
- public CDOBranchPoint getBranchPoint()
+ public SelectTimeStampComposite getSelectTimeComposite()
{
- return branchPoint;
+ return timeStampComposite;
}
+ /**
+ * @deprecated as of 4.4 use {@link #getBranchViewer()}.
+ */
+ @Deprecated
public SelectBranchComposite getSelectBranchComposite()
{
- return selectBranchComposite;
+ throw new UnsupportedOperationException();
}
- public SelectTimeStampComposite getSelectTimeComposite()
+ /**
+ * @deprecated as of 4.4 no longer supported.
+ */
+ @Deprecated
+ public CDOSession getSession()
{
- return selectTimeStampComposite;
+ return null;
}
- protected SelectTimeStampComposite createSelectTimeStampComposite(CDOBranch branch, long timeStamp)
+ /**
+ * @since 4.4
+ */
+ protected void createUI()
+ {
+ branchViewer = createBranchViewer();
+ branchViewer.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ CDOBranch branch = (CDOBranch)selection.getFirstElement();
+
+ if (timeStampComposite != null)
+ {
+ timeStampComposite.setBranch(branch);
+ }
+
+ composeBranchPoint();
+ }
+ });
+
+ if (allowTimeStamp)
+ {
+ timeStampComposite = createSelectTimeStampComposite();
+ timeStampComposite.setValidationContext(new ValidationContext()
+ {
+ public void setValidationError(Object source, String message)
+ {
+ timeStampError(message);
+ }
+ });
+ }
+ }
+
+ /**
+ * @since 4.4
+ */
+ protected TreeViewer createBranchViewer()
+ {
+ CDOItemProvider itemProvider = new CDOItemProvider(null);
+
+ TreeViewer branchViewer = new TreeViewer(this, SWT.BORDER | SWT.SINGLE);
+ branchViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ branchViewer.setLabelProvider(itemProvider);
+ branchViewer.setContentProvider(itemProvider);
+
+ branchViewer.addDoubleClickListener(new IDoubleClickListener()
+ {
+ public void doubleClick(DoubleClickEvent event)
+ {
+ doubleClicked();
+ }
+ });
+
+ return branchViewer;
+ }
+
+ /**
+ * @since 4.4
+ */
+ protected SelectTimeStampComposite createSelectTimeStampComposite()
{
- return new SelectTimeStampComposite(this, SWT.NONE, branch, timeStamp)
+ Group timeStampGroup = new Group(this, SWT.NONE);
+ timeStampGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ timeStampGroup.setLayout(new GridLayout(1, false));
+ timeStampGroup.setText("Time Stamp:");
+
+ SelectTimeStampComposite timeStampComposite = new SelectTimeStampComposite(timeStampGroup, SWT.NONE)
{
@Override
protected void timeStampChanged(long timeStamp)
@@ -97,8 +221,25 @@ public class ComposeBranchPointComposite extends Composite
composeBranchPoint();
}
};
+
+ timeStampComposite.getTimeBrowseButton().setVisible(false);
+ timeStampComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ return timeStampComposite;
+ }
+
+ /**
+ * @deprecated as of 4.4 use {@link #createSelectTimeStampComposite()}.
+ */
+ @Deprecated
+ protected SelectTimeStampComposite createSelectTimeStampComposite(CDOBranch branch, long timeStamp)
+ {
+ return createSelectTimeStampComposite();
}
+ /**
+ * @deprecated as of 4.4 use {@link #createSelectBranchComposite(Composite)}.
+ */
+ @Deprecated
protected SelectBranchComposite createSelectBranchComposite(CDOSession session, CDOBranch branch)
{
return new SelectBranchComposite(this, SWT.NONE, session, branch)
@@ -106,9 +247,9 @@ public class ComposeBranchPointComposite extends Composite
@Override
protected void branchChanged(CDOBranch newBranch)
{
- if (selectTimeStampComposite != null)
+ if (timeStampComposite != null)
{
- selectTimeStampComposite.setBranch(newBranch);
+ timeStampComposite.setBranch(newBranch);
}
composeBranchPoint();
@@ -116,30 +257,46 @@ public class ComposeBranchPointComposite extends Composite
};
}
- protected void branchPointChanged(CDOBranchPoint newBranchPoint)
- {
- }
-
private void composeBranchPoint()
{
- CDOBranchPoint oldBranchPoint = branchPoint;
-
- CDOBranch branch = session.getBranchManager().getMainBranch();
- if (selectBranchComposite != null)
+ if (branchViewer == null)
{
- branch = selectBranchComposite.getBranch();
+ return;
}
+ CDOBranchPoint oldBranchPoint = branchPoint;
+
+ IStructuredSelection selection = (IStructuredSelection)branchViewer.getSelection();
+ CDOBranch branch = (CDOBranch)selection.getFirstElement();
+
long timeStamp = CDOBranchPoint.UNSPECIFIED_DATE;
- if (selectTimeStampComposite != null)
+ if (timeStampComposite != null)
{
- timeStamp = selectTimeStampComposite.getTimeStamp();
+ timeStamp = timeStampComposite.getTimeStamp();
}
- branchPoint = branch == null ? null : branch.getPoint(timeStamp);
+ branchPoint = branch.getPoint(timeStamp);
if (!ObjectUtil.equals(branchPoint, oldBranchPoint))
{
branchPointChanged(branchPoint);
}
}
+
+ /**
+ * @since 4.4
+ */
+ protected void timeStampError(String message)
+ {
+ }
+
+ protected void branchPointChanged(CDOBranchPoint branchPoint)
+ {
+ }
+
+ /**
+ * @since 4.4
+ */
+ protected void doubleClicked()
+ {
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectBranchComposite.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectBranchComposite.java
index dad1a86107..d1a3ea73fd 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectBranchComposite.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectBranchComposite.java
@@ -42,7 +42,9 @@ import org.eclipse.swt.widgets.Listener;
*
* @author Eike Stepper
* @since 4.0
+ * @deprecated as of 4.4 no longer supported.
*/
+@Deprecated
public class SelectBranchComposite extends Composite implements ValidationParticipant
{
private ValidationContext validationContext;
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectTimeStampComposite.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectTimeStampComposite.java
index ed23e5ca74..9657f1e827 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectTimeStampComposite.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectTimeStampComposite.java
@@ -68,6 +68,14 @@ public class SelectTimeStampComposite extends Composite implements ValidationPar
private Button timeBrowseButton;
+ /**
+ * @since 4.4
+ */
+ public SelectTimeStampComposite(Composite parent, int style)
+ {
+ this(parent, style, null, CDOBranchPoint.UNSPECIFIED_DATE);
+ }
+
public SelectTimeStampComposite(Composite parent, int style, CDOBranch branch, long timeStamp)
{
super(parent, style);
@@ -80,23 +88,6 @@ public class SelectTimeStampComposite extends Composite implements ValidationPar
pointGroup = new Composite(this, SWT.NONE);
pointGroup.setLayout(layout);
- headRadio = new Button(pointGroup, SWT.RADIO);
- headRadio.setText(Messages.getString("BranchSelectionDialog.1")); //$NON-NLS-1$
- headRadio.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- if (headRadio.getSelection())
- {
- setTimeStamp(CDOBranchPoint.UNSPECIFIED_DATE);
- }
- }
- });
-
- new Label(pointGroup, SWT.NONE);
- new Label(pointGroup, SWT.NONE);
-
baseRadio = new Button(pointGroup, SWT.RADIO);
baseRadio.setText(Messages.getString("BranchSelectionDialog.2")); //$NON-NLS-1$
baseRadio.addSelectionListener(new SelectionAdapter()
@@ -166,6 +157,23 @@ public class SelectTimeStampComposite extends Composite implements ValidationPar
}
});
+ headRadio = new Button(pointGroup, SWT.RADIO);
+ headRadio.setText(Messages.getString("BranchSelectionDialog.1")); //$NON-NLS-1$
+ headRadio.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ if (headRadio.getSelection())
+ {
+ setTimeStamp(CDOBranchPoint.UNSPECIFIED_DATE);
+ }
+ }
+ });
+
+ new Label(pointGroup, SWT.NONE);
+ new Label(pointGroup, SWT.NONE);
+
setBranch(branch);
setTimeStamp(timeStamp);
}

Back to the top