diff options
author | Martin Fluegge | 2010-09-05 17:49:59 +0000 |
---|---|---|
committer | Martin Fluegge | 2010-09-05 17:49:59 +0000 |
commit | 02332b1da70cb1351ba3fe689e4e601f0632f529 (patch) | |
tree | 131c799a540a8396766c0f829f58828580a680b1 | |
parent | db774de81f770c928e9ed8a430ea3d2fe9b16aa7 (diff) | |
download | cdo-02332b1da70cb1351ba3fe689e4e601f0632f529.tar.gz cdo-02332b1da70cb1351ba3fe689e4e601f0632f529.tar.xz cdo-02332b1da70cb1351ba3fe689e4e601f0632f529.zip |
enhanced CDOProjectImportWizard
5 files changed, 66 insertions, 75 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.efs/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui.efs/META-INF/MANIFEST.MF index 6fcca97e5a..685647a25c 100644 --- a/plugins/org.eclipse.emf.cdo.ui.efs/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.ui.efs/META-INF/MANIFEST.MF @@ -16,6 +16,5 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", org.eclipse.ui.navigator;bundle-version="[3.3.0,4.0.0)";visibility:=reexport, org.eclipse.ui.navigator.resources;bundle-version="[3.3.0,4.0.0)";visibility:=reexport, org.eclipse.emf.cdo.ui;bundle-version="[4.0.0,5.0.0)";visibility:=reexport -Export-Package: org.eclipse.emf.cdo.ui.efs.factories;version="4.0.0", - org.eclipse.emf.cdo.ui.efs.wizards;version="4.0.0", +Export-Package: org.eclipse.emf.cdo.ui.efs.wizards;version="4.0.0", org.eclipse.emf.cdo.ui.internal.efs.bundle;version="4.0.0";x-internal:=true diff --git a/plugins/org.eclipse.emf.cdo.ui.efs/plugin.xml b/plugins/org.eclipse.emf.cdo.ui.efs/plugin.xml index 498059d58d..030dfc46c8 100644 --- a/plugins/org.eclipse.emf.cdo.ui.efs/plugin.xml +++ b/plugins/org.eclipse.emf.cdo.ui.efs/plugin.xml @@ -22,19 +22,5 @@ name="%wizard.name.0"> </wizard> </extension> - - <extension - point="org.eclipse.net4j.util.factories"> - <factory - class="org.eclipse.emf.cdo.ui.efs.factories.TCPElementWizardFactory" - productGroup="test.connectors" - type="tcp"> - </factory> - <factory - class="org.eclipse.emf.cdo.ui.efs.factories.JVMElementWizardFactory" - productGroup="test.connectors" - type="tcp"> - </factory> - </extension> - + </plugin> diff --git a/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/factories/JVMElementWizardFactory.java b/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/factories/JVMElementWizardFactory.java deleted file mode 100644 index f35f4b1c0f..0000000000 --- a/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/factories/JVMElementWizardFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.emf.cdo.ui.efs.factories; - -import org.eclipse.net4j.util.factory.ProductCreationException; -import org.eclipse.net4j.util.ui.container.ElementWizardFactory; -import org.eclipse.net4j.util.ui.container.IElementWizard; - -/** - * @author Martin Fluegge - */ -public class JVMElementWizardFactory extends ElementWizardFactory -{ - public JVMElementWizardFactory(String elementProductGroup, String elementFactoryType) - { - super(elementProductGroup, elementFactoryType); - } - - @Override - public String getDescriptionFor(Object product) - { - return null; - } - - @Override - public IElementWizard create(String description) throws ProductCreationException - { - return null; - } -} diff --git a/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/factories/TCPElementWizardFactory.java b/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/factories/TCPElementWizardFactory.java deleted file mode 100644 index 9b870382bc..0000000000 --- a/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/factories/TCPElementWizardFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.emf.cdo.ui.efs.factories; - -import org.eclipse.net4j.util.factory.ProductCreationException; -import org.eclipse.net4j.util.ui.container.ElementWizardFactory; -import org.eclipse.net4j.util.ui.container.IElementWizard; - -/** - * @author Martin Fluegge - */ -public class TCPElementWizardFactory extends ElementWizardFactory -{ - public TCPElementWizardFactory(String elementProductGroup, String elementFactoryType) - { - super(elementProductGroup, elementFactoryType); - } - - @Override - public String getDescriptionFor(Object product) - { - return null; - } - - @Override - public IElementWizard create(String description) throws ProductCreationException - { - return null; - } -} diff --git a/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/wizards/CDOProjectImportWizard.java b/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/wizards/CDOProjectImportWizard.java index c6c2e1c037..e3eb1f0654 100644 --- a/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/wizards/CDOProjectImportWizard.java +++ b/plugins/org.eclipse.emf.cdo.ui.efs/src/org/eclipse/emf/cdo/ui/efs/wizards/CDOProjectImportWizard.java @@ -1,20 +1,32 @@ package org.eclipse.emf.cdo.ui.efs.wizards; +import org.eclipse.net4j.util.ui.UIUtil; import org.eclipse.net4j.util.ui.container.ElementWizardComposite; import org.eclipse.net4j.util.ui.container.IElementWizard.ValidationContext; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IImportWizard; import org.eclipse.ui.IWorkbench; +import java.net.URI; + /** * @author Martin Fluegge */ @@ -31,7 +43,33 @@ public class CDOProjectImportWizard extends Wizard implements IImportWizard @Override public boolean performFinish() { - return false; + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + + String projectName = "cdo_test1"; + IProject project = workspace.getRoot().getProject(projectName); + if (project.exists()) + { + return false; + } + + IProjectDescription description = workspace.newProjectDescription(projectName); + description.setLocationURI(URI.create("cdo.net4j.tcp://localhost/repo1/MAIN/@")); + + try + { + project.create(description, new NullProgressMonitor()); + if (!project.isOpen()) + { + project.open(new NullProgressMonitor()); + } + } + catch (CoreException ex) + { + ex.printStackTrace(); + return false; + } + + return true; } @Override @@ -52,14 +90,38 @@ public class CDOProjectImportWizard extends Wizard implements IImportWizard public void createControl(Composite parent) { - Group group = new Group(parent, SWT.NONE); + Composite composite = new Composite(parent, SWT.FILL); + // FillLayout layout = new FillLayout(SWT.VERTICAL); + GridLayout layout = new GridLayout(1, true); + + composite.setLayout(layout); + // composite.setLayout(new GridLayout(1, true)); + + Group repositoryGroup = new Group(composite, SWT.NONE); + repositoryGroup.setLayout(new GridLayout(2, false)); + repositoryGroup.setLayoutData(UIUtil.createGridData(true, false)); + + createRepositoryControl(repositoryGroup); + + Group group = new Group(composite, SWT.NONE); group.setText("Connection"); group.setLayout(new FillLayout()); + group.setLayoutData(UIUtil.createGridData(true, true)); new ElementWizardComposite.WithRadios(group, SWT.NONE, "org.eclipse.net4j.connectors", "Type:"); setControl(group); } + private void createRepositoryControl(Composite parent) + { + Label repositoryLabel = new Label(parent, SWT.NONE); + repositoryLabel.setText("Repository:"); + repositoryLabel.setLayoutData(UIUtil.createGridData(false, false)); + + Text repositoryText = new Text(parent, SWT.BORDER); + repositoryText.setLayoutData(UIUtil.createGridData(true, false)); + } + public void setValidationOK() { setMessage(null); |