Merge lp:~alex-idereal/bzr-eclipse/bzr-eclipse into lp:bzr-eclipse

Proposed by Alexander Taler
Status: Merged
Merged at revision: 224
Proposed branch: lp:~alex-idereal/bzr-eclipse/bzr-eclipse
Merge into: lp:bzr-eclipse
Diff against target: 3815 lines (+1777/-1324)
61 files modified
.bzrignore (+4/-11)
HowToCompileAndRun.txt (+41/-1)
org.apache.commons.logging/pom.xml (+1/-1)
org.kxml2/pom.xml (+1/-1)
org.vcs.bazaar.eclipse.client/pom.xml (+1/-1)
org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF (+2/-2)
org.vcs.bazaar.eclipse.core.tests/pom.xml (+2/-2)
org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/repository/BranchFactoryTest.java (+2/-2)
org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF (+1/-1)
org.vcs.bazaar.eclipse.core/pom.xml (+1/-1)
org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/model/IBzrBranch.java (+11/-0)
org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchFactory.java (+27/-41)
org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchLocationManager.java (+1/-0)
org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranch.java (+5/-0)
org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranchLocator.java (+188/-0)
org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/LocalBranch.java (+4/-4)
org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/RemoteBranch.java (+11/-1)
org.vcs.bazaar.eclipse.feature/feature.xml (+5/-3)
org.vcs.bazaar.eclipse.feature/pom.xml (+1/-1)
org.vcs.bazaar.eclipse.site/pom.xml (+1/-1)
org.vcs.bazaar.eclipse.site/site.xml (+3/-10)
org.vcs.bazaar.eclipse.tests-feature/feature.xml (+1/-1)
org.vcs.bazaar.eclipse.tests-feature/pom.xml (+1/-1)
org.vcs.bazaar.eclipse.ui/META-INF/MANIFEST.MF (+3/-3)
org.vcs.bazaar.eclipse.ui/plugin.properties (+4/-2)
org.vcs.bazaar.eclipse.ui/plugin.xml (+29/-36)
org.vcs.bazaar.eclipse.ui/pom.xml (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java (+5/-3)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BindAction.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BranchAction.java (+2/-10)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/EditConflictsAction.java (+78/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MergeAction.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MissingAction.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PullAction.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PushAction.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/SwitchAction.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/UpdateAction.java (+39/-13)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/compare/ConflictingFileEditorInput.java (+165/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/MergeDialog.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/SendDialog.java (+1/-1)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/BranchAsProjectOperation.java (+0/-137)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CheckoutAsProjectOperation.java (+0/-70)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CreateBazaarProjectOperation.java (+198/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectAdvancedPage.java (+69/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectBranchType.java (+90/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectEntry.java (+166/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectLocation.java (+53/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectName.java (+51/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectPage.java (+115/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRemoteBranch.java (+101/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRevision.java (+106/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectWizard.java (+176/-0)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchFromProjectWizard.java (+0/-93)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizard.java (+0/-250)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardBranchLocationPage.java (+0/-143)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardProjectPage.java (+0/-176)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardSelectionPage.java (+0/-188)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutFromProjectWizard.java (+0/-57)
org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutWizard.java (+0/-45)
pom.xml (+2/-2)
redstone.xmlrpc/pom.xml (+1/-1)
To merge this branch: bzr merge lp:~alex-idereal/bzr-eclipse/bzr-eclipse
Reviewer Review Type Date Requested Status
Piotr Piastucki Approve
Review via email: mp+149207@code.launchpad.net

Description of the change

== New project creation wizard ==

The primary change was to replace the two project creation wizards (checkout
vs. branch) with a single one. The user experience was simplified by moving
many options into an advanced tab and by providing clearer explanation of what
is required. Additionally, the new wizard will discover Eclipse projects and
add them automatically.

== Other user facing changes ==

Modify menu options for resolving conflicts to be more intuitive:
  + Rename "Resolve" to "Mark Resolved"
  + Add an "Edit Conflicts" option

== Under the hood changes ==

Add documentation on how to create an update site.

Modify these Branch objects, to support other changes:
  + BranchFactory
  + LocalBranch
  + BranchLocationManager

To post a comment you must log in.
Revision history for this message
Piotr Piastucki (piastucki) wrote :

On 02/19/2013 08:31 AM, Alexander Taler wrote:
> Alexander Taler has proposed merging lp:~alex-idereal/bzr-eclipse/bzr-eclipse into lp:bzr-eclipse.
>
> Requested reviews:
> bzr-eclipse developers (bzr-eclipse)
>
> For more details, see:
> https://code.launchpad.net/~alex-idereal/bzr-eclipse/bzr-eclipse/+merge/149207
>
> == New project creation wizard ==
>
> The primary change was to replace the two project creation wizards (checkout
> vs. branch) with a single one. The user experience was simplified by moving
> many options into an advanced tab and by providing clearer explanation of what
> is required. Additionally, the new wizard will discover Eclipse projects and
> add them automatically.
>
> == Other user facing changes ==
>
> Modify menu options for resolving conflicts to be more intuitive:
> + Rename "Resolve" to "Mark Resolved"
> + Add an "Edit Conflicts" option
>
> == Under the hood changes ==
>
> Add documentation on how to create an update site.
>
> Modify these Branch objects, to support other changes:
> + BranchFactory
> + LocalBranch
> + BranchLocationManager
>

Hi Alex,

I am planning to merge a branch I create based on
lp:~alex-idereal/bzr-eclipse/bzr-eclipse some time ago.
The branch is named
lp:~piastucki/bzr-eclipse/history-and-compare.<https://code.launchpad.net/%7Epiastucki/bzr-eclipse/history-and-compare>
I kept all your changes intact, but the BzrBranchLocator. I moved most
of the code from BzrBranchLocator to BranchLocation class
(bzr-java-lib), simplified BranchFactory as much as possible and removed
BzrBranchLocator. This way no changes are required in the existing code
yet the branch creation/validation code still looks better than before.
BTW, please let me know if you plan to work on further improvements in
project creation wizards.

Cheers,
Piotr

Revision history for this message
Piotr Piastucki (piastucki) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2010-02-02 06:40:31 +0000
+++ .bzrignore 2013-02-19 07:30:34 +0000
@@ -7,15 +7,8 @@
7org.eclipse.pde.core.prefs7org.eclipse.pde.core.prefs
8.DS_Store8.DS_Store
9*.jar9*.jar
10org.vcs.bazaar.eclipse.core.tests/bin
11org.vcs.bazaar.eclipse.client/plugins/*10org.vcs.bazaar.eclipse.client/plugins/*
12org.apache.commons.logging/target11**/target
13org.kxml2/target12org.vcs.bazaar.eclipse.site/features
14org.vcs.bazaar.eclipse.client/target13org.vcs.bazaar.eclipse.site/plugins
15org.vcs.bazaar.eclipse.core/target14org.vcs.bazaar.eclipse.site/logs.zip
16org.vcs.bazaar.eclipse.core.tests/target
17org.vcs.bazaar.eclipse.feature/target
18org.vcs.bazaar.eclipse.site/target
19org.vcs.bazaar.eclipse.tests-feature/target
20org.vcs.bazaar.eclipse.ui/target
21redstone.xmlrpc/target
2215
=== modified file 'HowToCompileAndRun.txt'
--- HowToCompileAndRun.txt 2011-07-19 05:36:44 +0000
+++ HowToCompileAndRun.txt 2013-02-19 07:30:34 +0000
@@ -32,4 +32,44 @@
3232
33 ''Replace Run with Debug for debug mode''33 ''Replace Run with Debug for debug mode''
3434
35 354) Creating Plugin import site
36 4.1) Open the org.vcs.bazaar.eclipse.site project
37
38 4.2) Run Build All - this creates some files and directories
39
40 4.3) Upload created features, plugins, and site.xml
41
42
435) Update the version
44 5.1) Open org.vcs.bazaar.eclipse.core plugin overview
45 Update version and save
46 This modifies: org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF
47
48 5.2) Open org.vcs.bazaar.eclipse.core.tests plugin overview
49 Update dependencies for org.vcs.bazaar.eclipse.core
50 Update version and save
51 This modifies: org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF
52
53 5.3) Open org.vcs.bazaar.eclipse.core.ui plugin overview
54 Update dependencies for org.vcs.bazaar.eclipse.core
55 Update version and save
56 This modifies: org.vcs.bazaar.eclipse.core.ui/META-INF/MANIFEST.MF
57
58 5.4) Open org.vcs.bazaar.eclipse.feature plugin overview
59 Update version and save
60 This modifies: org.vcs.bazaar.eclipse.feature/feature.xml
61
62 5.5) Open org.vcs.bazaar.eclipse.tests-feature plugin overview
63 Update version and save
64 This modifies: org.vcs.bazaar.eclipse.tests-feature/feature.xml
65
66 5.6) Open org.vcs.bazaar.eclipse.site Site Map
67 Add a feature for the new version (Synchronize didn't work for me)
68 Remove the feature for the old version
69 This modifies: org.vcs.bazaar.eclipse.site/site.xml
70
71
72 5.7) Update the version in each of the pom.xml
73 find . -name pom.xml | xargs sed -i 's/1.1.1-SNAPSHOT/1.2.0-SNAPSHOT/'
74 This modifies all of the pom.xml -- check they are correct.
75
3676
=== modified file 'org.apache.commons.logging/pom.xml'
--- org.apache.commons.logging/pom.xml 2011-03-22 15:05:45 +0000
+++ org.apache.commons.logging/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.apache.commons.logging</groupId>10 <groupId>org.apache.commons.logging</groupId>
1111
=== modified file 'org.kxml2/pom.xml'
--- org.kxml2/pom.xml 2011-03-22 15:05:45 +0000
+++ org.kxml2/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.kxml2</groupId>10 <groupId>org.kxml2</groupId>
1111
=== modified file 'org.vcs.bazaar.eclipse.client/pom.xml'
--- org.vcs.bazaar.eclipse.client/pom.xml 2011-03-22 15:05:45 +0000
+++ org.vcs.bazaar.eclipse.client/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.vcs.bazaar.eclipse.client</groupId>10 <groupId>org.vcs.bazaar.eclipse.client</groupId>
1111
=== modified file 'org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF'
--- org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF 2011-07-30 22:37:22 +0000
+++ org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF 2013-02-19 07:30:34 +0000
@@ -2,7 +2,7 @@
2Bundle-ManifestVersion: 22Bundle-ManifestVersion: 2
3Bundle-Name: %plugin_name3Bundle-Name: %plugin_name
4Bundle-SymbolicName: org.vcs.bazaar.eclipse.core.test;singleton:=true4Bundle-SymbolicName: org.vcs.bazaar.eclipse.core.test;singleton:=true
5Bundle-Version: 1.1.1.qualifier5Bundle-Version: 1.2.0.idereal-3
6Bundle-Vendor: %provider_name6Bundle-Vendor: %provider_name
7Bundle-Localization: plugin7Bundle-Localization: plugin
8Require-Bundle: org.eclipse.core.runtime,8Require-Bundle: org.eclipse.core.runtime,
@@ -10,7 +10,7 @@
10 org.eclipse.core.resources,10 org.eclipse.core.resources,
11 org.eclipse.core.filesystem,11 org.eclipse.core.filesystem,
12 org.vcs.bazaar.eclipse.client;bundle-version="0.5.3",12 org.vcs.bazaar.eclipse.client;bundle-version="0.5.3",
13 org.vcs.bazaar.eclipse.core;bundle-version="1.1.1",13 org.vcs.bazaar.eclipse.core;bundle-version="1.2.0",
14 org.junit414 org.junit4
15Bundle-ActivationPolicy: lazy15Bundle-ActivationPolicy: lazy
16Bundle-ClassPath: .,16Bundle-ClassPath: .,
1717
=== modified file 'org.vcs.bazaar.eclipse.core.tests/pom.xml'
--- org.vcs.bazaar.eclipse.core.tests/pom.xml 2011-07-19 05:32:49 +0000
+++ org.vcs.bazaar.eclipse.core.tests/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.vcs.bazaar.eclipse.core.test</groupId>10 <groupId>org.vcs.bazaar.eclipse.core.test</groupId>
@@ -38,7 +38,7 @@
38 <artifactItem>38 <artifactItem>
39 <groupId>org.vcs.bazaar.client</groupId>39 <groupId>org.vcs.bazaar.client</groupId>
40 <artifactId>bzr-java-lib</artifactId>40 <artifactId>bzr-java-lib</artifactId>
41 <classifier>tests</classifier>41 <!-- <classifier>tests</classifier> -->
42 <type>jar</type>42 <type>jar</type>
43 <overWrite>false</overWrite>43 <overWrite>false</overWrite>
44 </artifactItem>44 </artifactItem>
4545
=== modified file 'org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/repository/BranchFactoryTest.java'
--- org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/repository/BranchFactoryTest.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/repository/BranchFactoryTest.java 2013-02-19 07:30:34 +0000
@@ -43,7 +43,7 @@
43 */43 */
44 @Test44 @Test
45 public void testFindOrCreateForURI() {45 public void testFindOrCreateForURI() {
46 IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(theFile.toURI());46 IBzrBranch branch = BranchFactory.findOrCreateFor(theFile.toURI());
47 assertNotNull(branch);47 assertNotNull(branch);
48 assertEquals(theFile.toURI(), branch.getLocation());48 assertEquals(theFile.toURI(), branch.getLocation());
49 }49 }
@@ -54,7 +54,7 @@
54 */54 */
55 @Test55 @Test
56 public void testFindOrCreateForString() throws URISyntaxException {56 public void testFindOrCreateForString() throws URISyntaxException {
57 IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(theFile.getAbsolutePath());57 IBzrBranch branch = BranchFactory.findOrCreateFor(theFile.getAbsolutePath());
58 assertNotNull(branch);58 assertNotNull(branch);
59 assertEquals(theFile.getAbsolutePath().replace(" ", "%20"), branch.getBranchLocation().toString());59 assertEquals(theFile.getAbsolutePath().replace(" ", "%20"), branch.getBranchLocation().toString());
60 }60 }
6161
=== modified file 'org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF'
--- org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF 2011-07-30 22:37:22 +0000
+++ org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF 2013-02-19 07:30:34 +0000
@@ -2,7 +2,7 @@
2Bundle-ManifestVersion: 22Bundle-ManifestVersion: 2
3Bundle-Name: %plugin_name3Bundle-Name: %plugin_name
4Bundle-SymbolicName: org.vcs.bazaar.eclipse.core;singleton:=true4Bundle-SymbolicName: org.vcs.bazaar.eclipse.core;singleton:=true
5Bundle-Version: 1.1.1.qualifier5Bundle-Version: 1.2.0.idereal-3
6Bundle-Activator: org.vcs.bazaar.eclipse.EclipseBazaarCore6Bundle-Activator: org.vcs.bazaar.eclipse.EclipseBazaarCore
7Bundle-Vendor: %provider_name7Bundle-Vendor: %provider_name
8Bundle-Localization: plugin8Bundle-Localization: plugin
99
=== modified file 'org.vcs.bazaar.eclipse.core/pom.xml'
--- org.vcs.bazaar.eclipse.core/pom.xml 2011-03-22 15:05:45 +0000
+++ org.vcs.bazaar.eclipse.core/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.vcs.bazaar.eclipse.core</groupId>10 <groupId>org.vcs.bazaar.eclipse.core</groupId>
1111
=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/model/IBzrBranch.java'
--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/model/IBzrBranch.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/model/IBzrBranch.java 2013-02-19 07:30:34 +0000
@@ -10,6 +10,8 @@
10import org.eclipse.core.resources.IProject;10import org.eclipse.core.resources.IProject;
11import org.eclipse.core.runtime.IPath;11import org.eclipse.core.runtime.IPath;
12import org.vcs.bazaar.client.core.BranchLocation;12import org.vcs.bazaar.client.core.BranchLocation;
13import org.vcs.bazaar.eclipse.internal.core.BazaarException;
14import org.vcs.bazaar.eclipse.internal.core.model.BzrBranchLocator;
1315
14/**16/**
15 * <p>17 * <p>
@@ -80,12 +82,21 @@
8082
81 /**83 /**
82 * Returns a branch location object84 * Returns a branch location object
85 * @deprecated Use getBranchLocator() instead
83 * @return86 * @return
84 * BranchLocation87 * BranchLocation
85 */88 */
86 public BranchLocation getBranchLocation();89 public BranchLocation getBranchLocation();
8790
88 /**91 /**
92 * Get a locator for this branch.
93 * @return
94 * BranchLocation
95 * @throws BazaarException
96 */
97 public BzrBranchLocator getBranchLocator() throws BazaarException;
98
99 /**
89 * <p>100 * <p>
90 * returns if this is a branch binded to a Eclipse Project, which means that a number of operations can be101 * returns if this is a branch binded to a Eclipse Project, which means that a number of operations can be
91 * performed on it which would not be possible or advisible on remote or local branches.102 * performed on it which would not be possible or advisible on remote or local branches.
92103
=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchFactory.java'
--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchFactory.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchFactory.java 2013-02-19 07:30:34 +0000
@@ -19,25 +19,19 @@
19import org.vcs.bazaar.eclipse.internal.core.model.RemoteBranch;19import org.vcs.bazaar.eclipse.internal.core.model.RemoteBranch;
2020
21/**21/**
22 * Contributor: Alexander Taler
23 *
22 * @author Guillermo Gonzalez24 * @author Guillermo Gonzalez
23 *
24 */25 */
25public class BranchFactory {26public class BranchFactory {
2627
27 private static final BranchFactory instance = new BranchFactory();
28
29 private BranchFactory(){}
30 public static BranchFactory getInstance() {
31 return instance;
32 }
33
34 /**28 /**
35 * @param URI29 * @param URI
36 *30 *
37 * @return IBzrBranch for the given URI (or null if there is no branch)31 * @return IBzrBranch for the given URI (or null if there is no branch)
38 * TODO: this method should only return RemoteBranch instances?32 * TODO: this method should only return RemoteBranch instances?
39 */33 */
40 public IBzrBranch findOrCreateFor(URI uri) {34 public static IBzrBranch findOrCreateFor(URI uri) {
41 if (uri != null) {35 if (uri != null) {
42 if(uri.getScheme() == null) {36 if(uri.getScheme() == null) {
43 // asume it's a raw path37 // asume it's a raw path
@@ -63,7 +57,7 @@
63 * as String57 * as String
64 * @return IBzrBranch for the given URI (or null if there is no branch)58 * @return IBzrBranch for the given URI (or null if there is no branch)
65 */59 */
66 public IBzrBranch findOrCreateFor(String uri) {60 public static IBzrBranch findOrCreateFor(String uri) {
67 Assert.isTrue(validateBranch(uri));61 Assert.isTrue(validateBranch(uri));
68 if (uri != null && uri.startsWith(LP_SCHEME)) {62 if (uri != null && uri.startsWith(LP_SCHEME)) {
69 return new LpBranch(uri);63 return new LpBranch(uri);
@@ -91,40 +85,32 @@
91 * @return boolean85 * @return boolean
92 */86 */
93 public static boolean validateBranch(String uri) {87 public static boolean validateBranch(String uri) {
94 return URIValidator.validateBranchLocation(uri);88 try {
95 }89 if (uri == null || uri.trim().length() == 0) {
9690 return false;
97 private static class URIValidator {91 }
9892 if (uri != null && uri.startsWith(LP_SCHEME)) {
99 private static boolean validateBranchLocation(String uri) {93 return true;
94 }
95 URI locationURI = StringUtil.getAbsoluteURI(uri);
100 try {96 try {
101 if (uri == null || uri.trim().length() == 0) {97 if(locationURI != null) {
102 return false;98 // try to create a branch from the URI
103 }99 findOrCreateFor(locationURI);
104 if (uri != null && uri.startsWith(LP_SCHEME)) {100 }
105 return true;101 // if a IBzrBranchcan be created, it's ok
106 }102 return true;
107 URI locationURI = StringUtil.getAbsoluteURI(uri);103 } catch(Exception e) {
108 try {
109 if(locationURI != null) {
110 // try to create a branch from the URI
111 getInstance().findOrCreateFor(locationURI);
112 }
113 // if a IBzrBranchcan be created, it's ok
114 return true;
115 } catch(Exception e) {
116 return false;
117 }
118 } catch (Exception e) {
119 // this is a malformed uri or a local file
120 // now we try to check if this is a valid folder location
121 File file = new File(uri);
122 if(file.exists()) {
123 return true;
124 }
125 return false;104 return false;
126 }105 }
106 } catch (Exception e) {
107 // this is a malformed uri or a local file
108 // now we try to check if this is a valid folder location
109 File file = new File(uri);
110 if(file.exists()) {
111 return true;
112 }
113 return false;
127 }114 }
128 }115 }
129
130}116}
131117
=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchLocationManager.java'
--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchLocationManager.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchLocationManager.java 2013-02-19 07:30:34 +0000
@@ -121,6 +121,7 @@
121 * Add a repository location to the database.121 * Add a repository location to the database.
122 */122 */
123 public boolean addRepoLocation(IBzrBranch branch) {123 public boolean addRepoLocation(IBzrBranch branch) {
124 if (branch == null) return false;
124 return branches.add(branch);125 return branches.add(branch);
125 }126 }
126127
127128
=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranch.java'
--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranch.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranch.java 2013-02-19 07:30:34 +0000
@@ -6,6 +6,7 @@
6import org.vcs.bazaar.client.core.BranchLocation;6import org.vcs.bazaar.client.core.BranchLocation;
7import org.vcs.bazaar.eclipse.core.model.IBzrBranch;7import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
8import org.vcs.bazaar.eclipse.core.model.IBzrResource;8import org.vcs.bazaar.eclipse.core.model.IBzrResource;
9import org.vcs.bazaar.eclipse.internal.core.BazaarException;
910
10/**11/**
11 * @author Guillermo Gonzalez12 * @author Guillermo Gonzalez
@@ -32,6 +33,10 @@
32 return new BranchLocation(getLocation());33 return new BranchLocation(getLocation());
33 }34 }
3435
36 public BzrBranchLocator getBranchLocator() throws BazaarException {
37 return new BzrBranchLocator(getLocation());
38 }
39
35 @Override40 @Override
36 public boolean equals(final Object otherRepo) {41 public boolean equals(final Object otherRepo) {
37 // make sure wrong types42 // make sure wrong types
3843
=== added file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranchLocator.java'
--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranchLocator.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranchLocator.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,188 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.internal.core.model;
12
13import java.io.File;
14import java.net.URI;
15import java.net.URISyntaxException;
16
17import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
18import org.vcs.bazaar.eclipse.internal.core.BazaarException;
19/**
20 * Like a URL for Bazaar Branches.
21 *
22 * Unfortunately the java.net.URI class isn't appropriate because
23 * LaunchPad locators, lp:, aren't valid URIs, and because Windows
24 * filenames starting with a drive letter don't parse properly.
25 *
26 * This class is a reimplementation of functionality from BranchLocation,
27 * BranchFactory, and StringUtil, because the branch locating code is spread
28 * between those classes, making it hard to understand and hard to fix. (In
29 * fact that code includes latent bugs.) This class should be moved to
30 * bzr-java-lib and replace BranchFactory and BranchLocation.
31 *
32 * @author Alexander Taler
33 */
34public class BzrBranchLocator {
35
36 Scheme scheme; // The Locator scheme
37 URI uri = null; // For schemes that have URIs, this is used.
38 String raw = null; // Otherwise the raw creation string is used.
39
40 private static class Scheme {
41 Scheme(String i, boolean w) {
42 id = i;
43 writeable = w;
44 }
45 String id;
46 boolean writeable;
47 }
48 private static final Scheme[] SCHEMES = {
49 new Scheme("file", true),
50 new Scheme("bzr+ssh", true),
51 new Scheme("lp", true),
52 new Scheme("sftp", true),
53 new Scheme("ftp", true),
54 new Scheme("rsync", true),
55 new Scheme("http", false),
56 new Scheme("https", false),
57 new Scheme("bzr+http", false),
58 new Scheme("bzr+https", false),
59 new Scheme("https+urllib", false),
60 };
61 private static Scheme lookupScheme(String schemeId) throws BazaarException {
62 for (Scheme s : SCHEMES) {
63 if (s.id.equals(schemeId)) {
64 return s;
65 }
66 }
67 throw new BazaarException("Unsupported Scheme");
68 }
69
70 /**
71 * Create a new Locator object for the given string.
72 *
73 * The string can be a path to the local filesystem, or a URI string which
74 * Bazaar would accept. The windows drive letter prefix [A-Z]: will be
75 * treated as a local file instead of a URL.
76 *
77 * @param raw
78 * @throws BazaarException if the string was not a valid locator
79 */
80 public BzrBranchLocator(String raw) throws BazaarException {
81 if (raw == null || raw.length() == 0) {
82 throw new BazaarException("Branch Not Specified");
83 }
84
85 this.raw = raw;
86
87 if (raw.startsWith("lp:")) {
88 scheme = lookupScheme("lp");
89 return;
90 }
91 if (!raw.matches("^[a-zA-Z]:")) {
92 // Try it as a URI
93 try {
94 uri = new URI(raw);
95 if (uri.getScheme() != null) {
96 scheme = lookupScheme(uri.getScheme());
97 return;
98 }
99 } catch (URISyntaxException e) {
100 // Fallback to file
101 }
102 }
103 initAsFile(raw);
104 }
105
106 /**
107 * Create a new Locator object for the given URI.
108 *
109 * If the URI has no scheme, or looks like a Windows drive letter scheme
110 * [A-Z]: then it will be treated as a local file reference.
111 *
112 * TODO: Check for the existence of file: URIs on local filesystem
113 *
114 * @param uri
115 * @throws BazaarException if the URI is not appropriate
116 */
117 public BzrBranchLocator(URI uri) throws BazaarException {
118 this.uri = uri;
119
120 if (uri == null) {
121 throw new BazaarException("Branch Not Specified");
122 }
123
124 String schemeId = uri.getScheme();
125 // If the URI is relative or looks like a Windows file, fallback to file:
126 if ((schemeId == null) || (schemeId.matches("^[a-zA-Z]$"))) {
127 initAsFile(uri.getPath());
128 } else {
129 scheme = lookupScheme(schemeId);
130 }
131 }
132
133 /**
134 * Initialise a new object as a local file reference
135 * @return
136 */
137 private void initAsFile(String path) throws BazaarException {
138 // Don't modify the object if an error is found
139
140 // Try and find the file on local filesystem
141 File file = new File(path);
142 File parent = file.getParentFile();
143 if (!file.exists() && (parent == null || !parent.exists())) {
144 throw new BazaarException("File not found");
145 }
146 scheme = lookupScheme("file");
147 raw = path;
148
149 // Create an appropriate URI for the path
150 path = path.replace(java.io.File.separator, "/");
151 // Do some URL encoding, java.net.URLEncoder seems to encode the "/"
152 // which isn't what we want.
153 path = path.replace(" ", "%20");
154 try {
155 uri = new URI("file", null, path, null);
156 } catch (URISyntaxException use) {
157 throw new BazaarException("Internal Exception", use);
158 }
159 }
160
161 public boolean isWriteable() {
162 return scheme.writeable;
163 }
164
165 /**
166 * Get a branch object for this location.
167 * @return
168 */
169 public IBzrBranch getBranch() {
170 if (scheme.id == "file") {
171 return new LocalBranch(uri);
172 }
173 if (scheme.id == "lp") {
174 return new LpBranch(raw);
175 }
176 return new RemoteBranch(uri);
177 }
178
179 /**
180 * Return a string representation of the locator which can be used to create it again.
181 */
182 public String toString() {
183 if (scheme.id == "lp" || uri == null) {
184 return raw;
185 }
186 return uri.toString();
187 }
188}
0189
=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/LocalBranch.java'
--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/LocalBranch.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/LocalBranch.java 2013-02-19 07:30:34 +0000
@@ -40,7 +40,7 @@
40public class LocalBranch extends BzrBranch implements IBzrLocalBranch {40public class LocalBranch extends BzrBranch implements IBzrLocalBranch {
4141
42 private static final long serialVersionUID = -6363525810607144655L;42 private static final long serialVersionUID = -6363525810607144655L;
43 private final URI location;43 private final URI location; // May be ignored by subclasses, use getLocation()
4444
4545
46 public LocalBranch(final URI location) {46 public LocalBranch(final URI location) {
@@ -69,7 +69,7 @@
6969
70 @Override70 @Override
71 public IPath getPath() {71 public IPath getPath() {
72 return new Path(location.toString());72 return new Path(location.getPath());
73 }73 }
7474
75 public String getNick() {75 public String getNick() {
@@ -113,7 +113,7 @@
113 }113 }
114 if(info == null || info.getRelatedBranches() == null || info.getRelatedBranches().getParentBranch() == null)114 if(info == null || info.getRelatedBranches() == null || info.getRelatedBranches().getParentBranch() == null)
115 return null;115 return null;
116 return BranchFactory.getInstance().findOrCreateFor(info.getRelatedBranches().getParentBranch());116 return BranchFactory.findOrCreateFor(info.getRelatedBranches().getParentBranch());
117 }117 }
118118
119 public IBzrBranch getPushBranch() {119 public IBzrBranch getPushBranch() {
@@ -124,7 +124,7 @@
124 if(info == null || info.getRelatedBranches() == null)124 if(info == null || info.getRelatedBranches() == null)
125 return null;125 return null;
126 if(info.getRelatedBranches().getPushBranch() != null && !"".equals(info.getRelatedBranches().getPushBranch().trim())) {126 if(info.getRelatedBranches().getPushBranch() != null && !"".equals(info.getRelatedBranches().getPushBranch().trim())) {
127 return BranchFactory.getInstance().findOrCreateFor(info.getRelatedBranches().getPushBranch());127 return BranchFactory.findOrCreateFor(info.getRelatedBranches().getPushBranch());
128 } else {128 } else {
129 return null;129 return null;
130 }130 }
131131
=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/RemoteBranch.java'
--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/RemoteBranch.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/RemoteBranch.java 2013-02-19 07:30:34 +0000
@@ -9,6 +9,7 @@
9import org.eclipse.core.resources.IProject;9import org.eclipse.core.resources.IProject;
10import org.eclipse.core.runtime.IPath;10import org.eclipse.core.runtime.IPath;
11import org.vcs.bazaar.client.core.BranchLocation;11import org.vcs.bazaar.client.core.BranchLocation;
12import org.vcs.bazaar.eclipse.internal.core.BazaarException;
1213
13/**14/**
14 * <p>15 * <p>
@@ -72,4 +73,13 @@
72 public BranchLocation getBranchLocation() {73 public BranchLocation getBranchLocation() {
73 return location;74 return location;
74 }75 }
75}
76\ No newline at end of file76\ No newline at end of file
77
78 @Override
79 public BzrBranchLocator getBranchLocator() {
80 try {
81 return new BzrBranchLocator(location.toString());
82 } catch (BazaarException e) {
83 throw new RuntimeException(e);
84 }
85 }
86}
7787
=== modified file 'org.vcs.bazaar.eclipse.feature/feature.xml'
--- org.vcs.bazaar.eclipse.feature/feature.xml 2009-09-05 15:17:53 +0000
+++ org.vcs.bazaar.eclipse.feature/feature.xml 2013-02-19 07:30:34 +0000
@@ -1,8 +1,8 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<feature2<feature
3 id="org.vcs.bazaar.eclipse.feature"3 id="org.vcs.bazaar.eclipse.feature"
4 label="Eclipse plugin for Bazaar"4 label="Eclipse plugin for Bazaar VCS"
5 version="1.1.1.qualifier"5 version="1.2.0.idereal-3"
6 provider-name="Guillermo Gonzalez"6 provider-name="Guillermo Gonzalez"
7 plugin="org.vcs.bazaar.eclipse.ui">7 plugin="org.vcs.bazaar.eclipse.ui">
88
@@ -73,17 +73,19 @@
73 download-size="0"73 download-size="0"
74 install-size="0"74 install-size="0"
75 version="0.0.0"/>75 version="0.0.0"/>
76 76
77 <plugin77 <plugin
78 id="org.apache.commons.logging"78 id="org.apache.commons.logging"
79 download-size="0"79 download-size="0"
80 install-size="0"80 install-size="0"
81 version="0.0.0"/>81 version="0.0.0"/>
82
82 <plugin83 <plugin
83 id="org.kxml2"84 id="org.kxml2"
84 download-size="0"85 download-size="0"
85 install-size="0"86 install-size="0"
86 version="0.0.0"/>87 version="0.0.0"/>
88
87 <plugin89 <plugin
88 id="redstone.xmlrpc"90 id="redstone.xmlrpc"
89 download-size="0"91 download-size="0"
9092
=== modified file 'org.vcs.bazaar.eclipse.feature/pom.xml'
--- org.vcs.bazaar.eclipse.feature/pom.xml 2011-03-22 15:05:45 +0000
+++ org.vcs.bazaar.eclipse.feature/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.vcs.bazaar.eclipse.feature</groupId>10 <groupId>org.vcs.bazaar.eclipse.feature</groupId>
1111
=== modified file 'org.vcs.bazaar.eclipse.site/pom.xml'
--- org.vcs.bazaar.eclipse.site/pom.xml 2011-03-22 15:05:45 +0000
+++ org.vcs.bazaar.eclipse.site/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.vcs.bazaar.eclipse.site</groupId>10 <groupId>org.vcs.bazaar.eclipse.site</groupId>
1111
=== modified file 'org.vcs.bazaar.eclipse.site/site.xml'
--- org.vcs.bazaar.eclipse.site/site.xml 2011-03-22 15:05:45 +0000
+++ org.vcs.bazaar.eclipse.site/site.xml 2013-02-19 07:30:34 +0000
@@ -3,15 +3,8 @@
3 <description url="http://verterok.com.ar/bzr-eclipse/update-site/">3 <description url="http://verterok.com.ar/bzr-eclipse/update-site/">
4 Update site for the Eclipse plugin for Bazaar4 Update site for the Eclipse plugin for Bazaar
5 </description>5 </description>
6 <feature url="features/org.vcs.bazaar.eclipse.feature_1.1.1.qualifier.jar" id="org.vcs.bazaar.eclipse.feature" version="1.1.1.qualifier">6 <feature url="features/org.vcs.bazaar.eclipse.feature_1.2.0.idereal-3.jar" id="org.vcs.bazaar.eclipse.feature" version="1.2.0.idereal-3">
7 <category name="bzr-eclipse (dev snapshot)"/>7 <category name="Collaboration"/>
8 </feature>8 </feature>
9 <!--feature url="features/org.vcs.bazaar.eclipse.tests-feature_1.1.1.qualifier.jar" id="org.vcs.bazaar.eclipse.tests-feature" version="1.1.1.qualifier">9 <category-def name="Collaboration" label="Collaboration"/>
10 <category name="bzr-eclipse (dev snapshot)"/>
11 </feature-->
12 <category-def name="bzr-eclipse (dev snapshot)" label="bzr-eclipse (Eclipse-3.3 dev snapshot)">
13 <description>
14 Here you can find snapshots of the current development trunk.
15 </description>
16 </category-def>
17</site>10</site>
1811
=== modified file 'org.vcs.bazaar.eclipse.tests-feature/feature.xml'
--- org.vcs.bazaar.eclipse.tests-feature/feature.xml 2010-02-02 06:40:31 +0000
+++ org.vcs.bazaar.eclipse.tests-feature/feature.xml 2013-02-19 07:30:34 +0000
@@ -2,7 +2,7 @@
2<feature2<feature
3 id="org.vcs.bazaar.eclipse.tests_feature"3 id="org.vcs.bazaar.eclipse.tests_feature"
4 label="Eclipse Tests Plugin for Bazaar"4 label="Eclipse Tests Plugin for Bazaar"
5 version="1.1.1.qualifier"5 version="1.2.0.idereal-3"
6 provider-name="Guillermo Gonzalez">6 provider-name="Guillermo Gonzalez">
77
8 <description url="https://launchpad.net/bzr-eclipse">8 <description url="https://launchpad.net/bzr-eclipse">
99
=== modified file 'org.vcs.bazaar.eclipse.tests-feature/pom.xml'
--- org.vcs.bazaar.eclipse.tests-feature/pom.xml 2011-03-22 15:05:45 +0000
+++ org.vcs.bazaar.eclipse.tests-feature/pom.xml 2013-02-19 07:30:34 +0000
@@ -9,6 +9,6 @@
9 </parent>9 </parent>
10 <groupId>org.vcs.bazaar.eclipse.tests-feature</groupId>10 <groupId>org.vcs.bazaar.eclipse.tests-feature</groupId>
11 <artifactId>org.vcs.bazaar.eclipse.tests-feature</artifactId>11 <artifactId>org.vcs.bazaar.eclipse.tests-feature</artifactId>
12 <version>1.1.1-SNAPSHOT</version>12 <version>1.2.0-SNAPSHOT</version>
13 <packaging>eclipse-test-feature</packaging>13 <packaging>eclipse-test-feature</packaging>
14</project>14</project>
1515
=== modified file 'org.vcs.bazaar.eclipse.ui/META-INF/MANIFEST.MF'
--- org.vcs.bazaar.eclipse.ui/META-INF/MANIFEST.MF 2011-07-30 00:28:03 +0000
+++ org.vcs.bazaar.eclipse.ui/META-INF/MANIFEST.MF 2013-02-19 07:30:34 +0000
@@ -2,11 +2,11 @@
2Bundle-ManifestVersion: 22Bundle-ManifestVersion: 2
3Bundle-Name: %plugin_name3Bundle-Name: %plugin_name
4Bundle-SymbolicName: org.vcs.bazaar.eclipse.ui;singleton:=true4Bundle-SymbolicName: org.vcs.bazaar.eclipse.ui;singleton:=true
5Bundle-Version: 1.1.1.qualifier5Bundle-Version: 1.2.0.idereal-3
6Bundle-Activator: org.vcs.bazaar.eclipse.ui.EclipseBazaarUI6Bundle-Activator: org.vcs.bazaar.eclipse.ui.EclipseBazaarUI
7Bundle-Vendor: %provider_name7Bundle-Vendor: %provider_name
8Bundle-Localization: plugin8Bundle-Localization: plugin
9Require-Bundle: org.vcs.bazaar.eclipse.core;bundle-version="1.1.1";visibility:=reexport,9Require-Bundle: org.vcs.bazaar.eclipse.core;bundle-version="1.2.0";visibility:=reexport,
10 org.eclipse.ui,10 org.eclipse.ui,
11 org.eclipse.core.runtime;bundle-version="3.3.0",11 org.eclipse.core.runtime;bundle-version="3.3.0",
12 org.eclipse.core.resources,12 org.eclipse.core.resources,
@@ -39,7 +39,7 @@
39 org.vcs.bazaar.eclipse.ui.views,39 org.vcs.bazaar.eclipse.ui.views,
40 org.vcs.bazaar.eclipse.ui.wizards,40 org.vcs.bazaar.eclipse.ui.wizards,
41 org.vcs.bazaar.eclipse.ui.wizards.configuration,41 org.vcs.bazaar.eclipse.ui.wizards.configuration,
42 org.vcs.bazaar.eclipse.ui.wizards.project42 org.vcs.bazaar.eclipse.ui.wizards.createproject
43Bundle-ClassPath: .,43Bundle-ClassPath: .,
44 icons/,44 icons/,
45 images/45 images/
4646
=== modified file 'org.vcs.bazaar.eclipse.ui/plugin.properties'
--- org.vcs.bazaar.eclipse.ui/plugin.properties 2009-05-05 16:55:55 +0000
+++ org.vcs.bazaar.eclipse.ui/plugin.properties 2013-02-19 07:30:34 +0000
@@ -41,6 +41,8 @@
41#Commit changes into a new revision41#Commit changes into a new revision
42ActionDiff_label=L&atest from branch42ActionDiff_label=L&atest from branch
43ActionDiff_tooltip=Show unsubmitted changes in the selected resource43ActionDiff_tooltip=Show unsubmitted changes in the selected resource
44ActionEditConflicts_label=&Edit Conflicts
45ActionEditConflicts_tooltip=Open file in conflict editor
44ActionLog_label=&Log...46ActionLog_label=&Log...
45ActionLog_tooltip=Show log of a branch, file, or directory47ActionLog_tooltip=Show log of a branch, file, or directory
46ActionNick_label=Nick...48ActionNick_label=Nick...
@@ -49,7 +51,7 @@
49ActionRemove_tooltip=Make a file unversioned.51ActionRemove_tooltip=Make a file unversioned.
50ActionIgnore_label=&Ignore...52ActionIgnore_label=&Ignore...
51ActionIgnore_tooltip=Make a file ignored by Bazaar53ActionIgnore_tooltip=Make a file ignored by Bazaar
52ActionResolve_label=Resolv&e...54ActionResolve_label=Mark Resolv&ed
53ActionResolve_tooltip=Mark a conflict as resolved.55ActionResolve_tooltip=Mark a conflict as resolved.
54ActionRevert_label=&Revert56ActionRevert_label=&Revert
55ActionRevert_tooltip=Revert files to a previous revision57ActionRevert_tooltip=Revert files to a previous revision
@@ -134,4 +136,4 @@
134#others136#others
135quickDiff_label=Latest bazaar revision137quickDiff_label=Latest bazaar revision
136138
137BzrCommandCategory_description=Bazaar
138\ No newline at end of file139\ No newline at end of file
140BzrCommandCategory_description=Bazaar
139141
=== modified file 'org.vcs.bazaar.eclipse.ui/plugin.xml'
--- org.vcs.bazaar.eclipse.ui/plugin.xml 2011-06-02 00:41:16 +0000
+++ org.vcs.bazaar.eclipse.ui/plugin.xml 2013-02-19 07:30:34 +0000
@@ -96,6 +96,15 @@
96 label="%ActionResolve_label" menubarPath="team.main/group3"96 label="%ActionResolve_label" menubarPath="team.main/group3"
97 tooltip="%ActionResolve_tooltip">97 tooltip="%ActionResolve_tooltip">
98 </action>98 </action>
99 <action
100 class="org.vcs.bazaar.eclipse.ui.actions.EditConflictsAction"
101 definitionId="org.vcs.bazaar.eclipse.ui.actions.ActionEditConflicts"
102 icon="icons/bzrlogo.png"
103 id="org.vcs.bazaar.eclipse.ui.actions.ActionEditConflicts"
104 label="%ActionEditConflicts_label"
105 menubarPath="team.main/group3"
106 tooltip="%ActionEditConflicts_tooltip">
107 </action>
99 </objectContribution>108 </objectContribution>
100109
101 <!-- Project Team menu -->110 <!-- Project Team menu -->
@@ -371,47 +380,31 @@
371 <extension point="org.eclipse.ui.newWizards">380 <extension point="org.eclipse.ui.newWizards">
372 <category id="org.vcs.bazaar.eclipse.ui.wizards.new"381 <category id="org.vcs.bazaar.eclipse.ui.wizards.new"
373 name="%NewWizard_categoryName" />382 name="%NewWizard_categoryName" />
374 <wizard383 <wizard
375 canFinishEarly="false"384 canFinishEarly="false"
376 category="org.vcs.bazaar.eclipse.ui.wizards.new"385 category="org.vcs.bazaar.eclipse.ui.wizards.new"
377 class="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard"386 class="org.vcs.bazaar.eclipse.ui.wizards.createproject.CreateProjectWizard"
378 hasPages="true"387 hasPages="true"
379 icon="icons/bzrlogo.png"388 icon="icons/bzrlogo.png"
380 id="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard"389 id="org.vcs.bazaar.eclipse.ui.wizards.project.CreateProjectWizard"
381 name="%BranchNewWizard_Name"390 name="Project From Bazaar"
382 project="true"/>391 project="true">
383 <wizard392 </wizard>
384 canFinishEarly="false"
385 category="org.vcs.bazaar.eclipse.ui.wizards.new"
386 class="org.vcs.bazaar.eclipse.ui.wizards.project.CheckoutWizard"
387 hasPages="true"
388 icon="icons/bzrlogo.png"
389 id="org.vcs.bazaar.eclipse.ui.wizards.project.CheckOutWizard"
390 name="%CheckoutNewWizard_Name"
391 project="true"/>
392 </extension>393 </extension>
393 394
394 <extension point="org.eclipse.ui.importWizards">395 <extension point="org.eclipse.ui.importWizards">
395 <category id="org.vcs.bazaar.eclipse.ui.wizards.new"396 <category id="org.vcs.bazaar.eclipse.ui.wizards.new"
396 name="%NewWizard_categoryName" />397 name="%NewWizard_categoryName" />
397 <wizard398 <wizard
398 canFinishEarly="false"399 canFinishEarly="false"
399 category="org.vcs.bazaar.eclipse.ui.wizards.new"400 category="org.vcs.bazaar.eclipse.ui.wizards.new"
400 class="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard"401 class="org.vcs.bazaar.eclipse.ui.wizards.createproject.CreateProjectWizard"
401 hasPages="true"402 hasPages="true"
402 icon="icons/bzrlogo.png"403 icon="icons/bzrlogo.png"
403 id="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard"404 id="org.vcs.bazaar.eclipse.ui.wizards.project.CreateProjectWizard"
404 name="%BranchNewWizard_Name"405 name="Project From Bazaar"
405 project="true"/>406 project="true">
406 <wizard407 </wizard>
407 canFinishEarly="false"
408 category="org.vcs.bazaar.eclipse.ui.wizards.new"
409 class="org.vcs.bazaar.eclipse.ui.wizards.project.CheckoutWizard"
410 hasPages="true"
411 icon="icons/bzrlogo.png"
412 id="org.vcs.bazaar.eclipse.ui.wizards.project.CheckOutWizard"
413 name="%CheckoutNewWizard_Name"
414 project="true"/>
415 </extension>408 </extension>
416 <extension point="org.eclipse.ui.console.consoleFactories">409 <extension point="org.eclipse.ui.console.consoleFactories">
417 <consoleFactory410 <consoleFactory
418411
=== modified file 'org.vcs.bazaar.eclipse.ui/pom.xml'
--- org.vcs.bazaar.eclipse.ui/pom.xml 2011-03-22 15:05:45 +0000
+++ org.vcs.bazaar.eclipse.ui/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>org.vcs.bazaar.eclipse.ui</groupId>10 <groupId>org.vcs.bazaar.eclipse.ui</groupId>
1111
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java 2013-02-19 07:30:34 +0000
@@ -60,6 +60,7 @@
60 */60 */
61 public EclipseBazaarUI() {61 public EclipseBazaarUI() {
62 plugin = this;62 plugin = this;
63 console = new BzrOutputConsole();
63 }64 }
6465
65 /**66 /**
@@ -237,6 +238,10 @@
237 getDefault().getLog().log(ex.getStatus());238 getDefault().getLog().log(ex.getStatus());
238 }239 }
239240
241 public static void log(Throwable t) {
242 log(t.getMessage(), t);
243 }
244
240 public static boolean isTracing(final String optionId) {245 public static boolean isTracing(final String optionId) {
241 final String option = getPluginId() + "/trace/" + optionId; //$NON-NLS-1$246 final String option = getPluginId() + "/trace/" + optionId; //$NON-NLS-1$
242 final String value = Platform.getDebugOption(option);247 final String value = Platform.getDebugOption(option);
@@ -266,9 +271,6 @@
266 }271 }
267272
268 public synchronized BzrOutputConsole getConsole() {273 public synchronized BzrOutputConsole getConsole() {
269 if(console == null){
270 console = new BzrOutputConsole();
271 }
272 return console;274 return console;
273 }275 }
274276
275277
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BindAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BindAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BindAction.java 2013-02-19 07:30:34 +0000
@@ -58,7 +58,7 @@
58 LocationInputDialog dialog = LocationInputDialog.remoteBindLocationDialog(getShell(), locations, dialogInfo);58 LocationInputDialog dialog = LocationInputDialog.remoteBindLocationDialog(getShell(), locations, dialogInfo);
59 dialog.setBlockOnOpen(true);59 dialog.setBlockOnOpen(true);
60 if (dialog.open() == LocationInputDialog.OK) {60 if (dialog.open() == LocationInputDialog.OK) {
61 return BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation());61 return BranchFactory.findOrCreateFor(dialogInfo.getLocation());
62 }62 }
63 return null;63 return null;
64 }64 }
6565
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BranchAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BranchAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BranchAction.java 2013-02-19 07:30:34 +0000
@@ -3,11 +3,8 @@
3 */3 */
4package org.vcs.bazaar.eclipse.ui.actions;4package org.vcs.bazaar.eclipse.ui.actions;
55
6import org.eclipse.core.resources.IProject;
7import org.eclipse.jface.action.IAction;6import org.eclipse.jface.action.IAction;
8import org.vcs.bazaar.eclipse.BzrWorkspaceRoot;7import org.vcs.bazaar.eclipse.ui.wizards.createproject.CreateProjectWizard;
9import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
10import org.vcs.bazaar.eclipse.ui.wizards.project.BranchFromProjectWizard;
118
12/**9/**
13 * @author Guillermo Gonzalez10 * @author Guillermo Gonzalez
@@ -23,12 +20,7 @@
23 */20 */
24 @Override21 @Override
25 public void execute(IAction action) {22 public void execute(IAction action) {
26 IProject[] projects = getSelectedProjects();23 new CreateProjectWizard(getSelection()).show(getShell());
27 if(projects != null && projects.length == 1) {
28 IProject project = projects[0];
29 IBzrBranch branch = BzrWorkspaceRoot.getBzrWorkspaceRootFor(project).getBranch();
30 BranchFromProjectWizard.open(getShell(), branch);
31 }
32 }24 }
3325
34 @Override26 @Override
3527
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/EditConflictsAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/EditConflictsAction.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/EditConflictsAction.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,78 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.actions;
12
13import org.eclipse.compare.CompareConfiguration;
14import org.eclipse.compare.CompareUI;
15import org.eclipse.core.resources.IContainer;
16import org.eclipse.core.resources.IFile;
17import org.eclipse.jface.action.IAction;
18import org.vcs.bazaar.eclipse.internal.core.BazaarException;
19import org.vcs.bazaar.eclipse.ui.compare.ConflictingFileEditorInput;
20
21/**
22 * @author Alexander Taler
23 */
24public class EditConflictsAction extends WorkbenchAction {
25
26 @Override
27 public void execute(IAction action) throws BazaarException {
28
29 IFile local = (IFile) getSelectedResources()[0];
30
31 // Find the base, other and this files
32 IContainer parent = local.getParent();
33 IFile MrgBase = (IFile) parent.findMember(local.getName() + ".BASE");
34 IFile MrgOthr = (IFile) parent.findMember(local.getName() + ".OTHER");
35 IFile MrgThis = (IFile) parent.findMember(local.getName() + ".THIS");
36
37 CompareConfiguration cc = new CompareConfiguration();
38 ConflictingFileEditorInput compare =
39 new ConflictingFileEditorInput(cc, local, local, MrgOthr, MrgBase);
40 CompareUI.openCompareEditor(compare);
41 }
42
43 @Override
44 protected boolean isEnabledForUnmanagedResources() {
45 return false;
46 }
47
48 @Override
49 protected boolean isEnabledForManagedResources() {
50 return true;
51 }
52
53 @Override
54 protected boolean isEnabledForAddedResources() {
55 return false;
56 }
57
58 @Override
59 protected boolean isEnabledForMultipleResources() {
60 return false;
61 }
62
63 @Override
64 protected boolean isEnabledForConflictedResources() {
65 return true;
66 }
67
68 @Override
69 protected boolean isEnabledForUnmodifiedResources() {
70 return false;
71 }
72
73 @Override
74 protected boolean isEnabledForModifiedResources() {
75 return false;
76 }
77
78}
079
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MergeAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MergeAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MergeAction.java 2013-02-19 07:30:34 +0000
@@ -58,7 +58,7 @@
58 MergeDialog dialog = new MergeDialog(getShell(), locations, dialogInfo);58 MergeDialog dialog = new MergeDialog(getShell(), locations, dialogInfo);
59 dialog.setBlockOnOpen(true);59 dialog.setBlockOnOpen(true);
60 if (dialog.open() == MergeDialog.OK) {60 if (dialog.open() == MergeDialog.OK) {
61 return BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation());61 return BranchFactory.findOrCreateFor(dialogInfo.getLocation());
62 }62 }
63 return null;63 return null;
64 }64 }
6565
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MissingAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MissingAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MissingAction.java 2013-02-19 07:30:34 +0000
@@ -123,7 +123,7 @@
123 if("".equals(dialogInfo.getLocation()) && parent != null) {123 if("".equals(dialogInfo.getLocation()) && parent != null) {
124 return parent;124 return parent;
125 } else {125 } else {
126 return BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation());126 return BranchFactory.findOrCreateFor(dialogInfo.getLocation());
127 }127 }
128 }128 }
129 return null;129 return null;
130130
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PullAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PullAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PullAction.java 2013-02-19 07:30:34 +0000
@@ -36,7 +36,7 @@
36 final IProject[] projects = getEnclosingProjectsForSelectedResources();36 final IProject[] projects = getEnclosingProjectsForSelectedResources();
37 final LocationDialogInfo dialogInfo = getRemoteLocation(projects[0]);37 final LocationDialogInfo dialogInfo = getRemoteLocation(projects[0]);
38 if (dialogInfo != null && dialogInfo.getLocation() != null && !"".equals(dialogInfo.getLocation().trim())) {38 if (dialogInfo != null && dialogInfo.getLocation() != null && !"".equals(dialogInfo.getLocation().trim())) {
39 final IBzrBranch location = BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation());39 final IBzrBranch location = BranchFactory.findOrCreateFor(dialogInfo.getLocation());
40 run(new WorkspaceModifyOperation() {40 run(new WorkspaceModifyOperation() {
41 @Override41 @Override
42 public void execute(IProgressMonitor monitor) throws InvocationTargetException {42 public void execute(IProgressMonitor monitor) throws InvocationTargetException {
4343
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PushAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PushAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PushAction.java 2013-02-19 07:30:34 +0000
@@ -38,7 +38,7 @@
38 protected void execute(final IProject aProject) throws InvocationTargetException, InterruptedException {38 protected void execute(final IProject aProject) throws InvocationTargetException, InterruptedException {
39 final LocationDialogInfo dialogInfo = getRemoteLocation(aProject);39 final LocationDialogInfo dialogInfo = getRemoteLocation(aProject);
40 if (dialogInfo != null && dialogInfo.getLocation() != null && !"".equals(dialogInfo.getLocation().trim())) {40 if (dialogInfo != null && dialogInfo.getLocation() != null && !"".equals(dialogInfo.getLocation().trim())) {
41 IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation().trim());41 IBzrBranch branch = BranchFactory.findOrCreateFor(dialogInfo.getLocation().trim());
42 new PushOperation(getTargetPart(), aProject, branch.getBranchLocation(), dialogInfo.isRemember(), dialogInfo.isUseExistingDir()).run();42 new PushOperation(getTargetPart(), aProject, branch.getBranchLocation(), dialogInfo.isRemember(), dialogInfo.isUseExistingDir()).run();
43 }43 }
44 }44 }
4545
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/SwitchAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/SwitchAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/SwitchAction.java 2013-02-19 07:30:34 +0000
@@ -34,7 +34,7 @@
34 // popup a input dialog to get the remote location34 // popup a input dialog to get the remote location
35 String remoteLocation = getRemoteLocation(project, dialogInfo);35 String remoteLocation = getRemoteLocation(project, dialogInfo);
36 if (remoteLocation != null) {36 if (remoteLocation != null) {
37 final IBzrBranch location = BranchFactory.getInstance().findOrCreateFor(remoteLocation);37 final IBzrBranch location = BranchFactory.findOrCreateFor(remoteLocation);
38 run(new IRunnableWithProgress() {38 run(new IRunnableWithProgress() {
39 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {39 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
40 try {40 try {
4141
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/UpdateAction.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/UpdateAction.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/UpdateAction.java 2013-02-19 07:30:34 +0000
@@ -7,6 +7,7 @@
77
8import org.eclipse.core.resources.IProject;8import org.eclipse.core.resources.IProject;
9import org.eclipse.core.resources.IResource;9import org.eclipse.core.resources.IResource;
10import org.eclipse.core.runtime.CoreException;
10import org.eclipse.core.runtime.IProgressMonitor;11import org.eclipse.core.runtime.IProgressMonitor;
11import org.eclipse.jface.action.IAction;12import org.eclipse.jface.action.IAction;
12import org.eclipse.jface.dialogs.MessageDialog;13import org.eclipse.jface.dialogs.MessageDialog;
@@ -35,19 +36,44 @@
35 protected void execute(IAction action) throws BazaarException, InvocationTargetException, InterruptedException {36 protected void execute(IAction action) throws BazaarException, InvocationTargetException, InterruptedException {
36 IProject project = getSelectedProjects()[0];37 IProject project = getSelectedProjects()[0];
37 final UpdateCommand cmd = new UpdateCommand(project);38 final UpdateCommand cmd = new UpdateCommand(project);
38 run(new WorkspaceModifyOperation() {39 String updMsg = null;
39 @Override40 try {
40 public void execute(IProgressMonitor monitor) throws InvocationTargetException {41 run(new WorkspaceModifyOperation() {
41 try {42 @Override
42 cmd.run(monitor);43 public void execute(IProgressMonitor monitor)
43 } catch (BazaarException e) {44 throws InvocationTargetException, BazaarException
44 handle(e);45 {
45 } finally {46 try {
46 monitor.done();47 cmd.run(monitor);
47 }48 } finally {
48 }49 monitor.done();
49 }, false /* no cancelable */, PROGRESS_DIALOG);50 }
50 MessageDialog.openInformation(getShell(), "Update finished", cmd.getOutputMessage());51 }
52 }, false /* no cancelable */, PROGRESS_DIALOG);
53 } catch (InvocationTargetException ite) {
54 Throwable ie = ite.getCause();
55 if (ie instanceof BazaarException) {
56 if (ie.getCause() != null) {
57 ie = ie.getCause();
58 }
59 if (ie.getMessage().contains("conflicts encountered")) {
60 updMsg = "Conflicts occurred during update.\n\n" + ie.getMessage();
61 ite = null;
62 }
63 }
64 if (ite != null) {
65 throw ite;
66 }
67 }
68 try {
69 project.refreshLocal(IResource.DEPTH_INFINITE, null);
70 } catch (CoreException e) {
71 throw new BazaarException(e);
72 }
73 if (updMsg == null) {
74 updMsg = cmd.getOutputMessage();
75 }
76 MessageDialog.openInformation(getShell(), "Update finished", updMsg);
51 }77 }
5278
53 @Override79 @Override
5480
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/compare/ConflictingFileEditorInput.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/compare/ConflictingFileEditorInput.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/compare/ConflictingFileEditorInput.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,165 @@
1/*******************************************************************************
2 * Copyright (c) 2005-2008 Polarion Software.
3 * Copyright (c) 2012 Idereal Limited
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Alexander Gurov - Initial API and implementation
11 * Alexander Taler - Copied from Subversive project to bzr-eclipse
12 *******************************************************************************/
13
14package org.vcs.bazaar.eclipse.ui.compare;
15
16import java.io.ByteArrayOutputStream;
17import java.io.InputStream;
18import java.lang.reflect.InvocationTargetException;
19
20import org.eclipse.compare.CompareConfiguration;
21import org.eclipse.compare.CompareEditorInput;
22import org.eclipse.compare.CompareUI;
23import org.eclipse.compare.ITypedElement;
24import org.eclipse.compare.internal.BufferedResourceNode;
25import org.eclipse.compare.structuremergeviewer.Differencer;
26import org.eclipse.core.resources.IFile;
27import org.eclipse.core.resources.IResource;
28import org.eclipse.core.runtime.CoreException;
29import org.eclipse.core.runtime.IProgressMonitor;
30import org.eclipse.swt.graphics.Image;
31
32/**
33 * Conflicting files merger editor input implementation
34 *
35 * @author Alexander Gurov
36 */
37public class ConflictingFileEditorInput extends CompareEditorInput {
38 protected IFile target;
39 protected IFile left;
40 protected IFile right;
41 protected IFile ancestor;
42
43 protected MergeElement targetElement;
44
45 public ConflictingFileEditorInput(CompareConfiguration configuration,
46 IFile target,
47 IFile left,
48 IFile right,
49 IFile ancestor)
50 {
51 super(configuration);
52 this.target = target;
53 this.left = left;
54 this.right = right;
55 this.ancestor = ancestor;
56 }
57
58 protected Object prepareInput(IProgressMonitor monitor)
59 throws InvocationTargetException, InterruptedException
60 {
61 CompareConfiguration cc = this.getCompareConfiguration();
62 Image img = CompareUI.getImage(this.target);
63 cc.setLeftImage(img);
64 cc.setRightImage(img);
65 cc.setAncestorImage(img);
66 cc.setLeftLabel(this.target.getName() + " Local Revision"); //$NON-NLS-1$
67 cc.setLeftEditable(true);
68 cc.setRightLabel(this.target.getName() + " Incoming Revision"); //$NON-NLS-1$
69 cc.setRightEditable(false);
70 cc.setAncestorLabel(this.target.getName() + " Common Base"); //$NON-NLS-1$
71
72 this.setTitle(this.target.getName() + " Conflicts"); //$NON-NLS-1$
73
74 InputStream stream = null;
75 try {
76 stream = this.left.getContents();
77 byte[] buf = new byte[2048];
78 int len = 0;
79 ByteArrayOutputStream output = new ByteArrayOutputStream();
80 while ((len = stream.read(buf)) > 0) {
81 output.write(buf, 0, len);
82 }
83 this.targetElement = new MergeElement(this.target, output.toByteArray(), true);
84 } catch (RuntimeException e) {
85 throw e;
86 } catch (Exception e) {
87 throw new InvocationTargetException(e);
88 } finally {
89 if (stream != null) {
90 try {
91 stream.close();
92 } catch (Exception ex) {
93 }
94 }
95 }
96
97 try {
98 MergeElement rightRef = new MergeElement(this.right);
99 rightRef.setCharsetReference(this.targetElement);
100 MergeElement ancestorRef = new MergeElement(this.ancestor);
101 ancestorRef.setCharsetReference(this.targetElement);
102 return new Differencer().findDifferences(true, monitor, null, ancestorRef,
103 this.targetElement, rightRef);
104 } finally {
105 monitor.done();
106 }
107 }
108
109 public Object getAdapter(Class adapter) {
110 if (IFile.class.equals(adapter)) {
111 // disallow auto-flush of editor content
112 return this.target;
113 }
114 return super.getAdapter(adapter);
115 }
116
117 public void saveChanges(IProgressMonitor pm) throws CoreException {
118 // flush editor content...
119 super.saveChanges(pm);
120 // ...and save it
121 this.targetElement.commit(pm);
122
123 this.setDirty(false);
124 }
125
126 protected class MergeElement extends BufferedResourceNode {
127 protected boolean editable;
128 protected BufferedResourceNode charsetReference;
129
130 public BufferedResourceNode getCharsetReference() {
131 return this.charsetReference;
132 }
133
134 public void setCharsetReference(BufferedResourceNode charsetReference) {
135 this.charsetReference = charsetReference;
136 }
137
138 public MergeElement(IResource resource) {
139 this(resource, null, false);
140 }
141
142 public MergeElement(IResource resource, byte[] initialContent, boolean editable) {
143 super(resource);
144 this.editable = editable;
145 if (initialContent != null) {
146 this.setContent(initialContent);
147 }
148 }
149
150 public String getCharset() {
151 return this.charsetReference != null ? this.charsetReference.getCharset() : super
152 .getCharset();
153 }
154
155 public String getType() {
156 String extension = ConflictingFileEditorInput.this.target.getFileExtension();
157 return extension == null ? ITypedElement.UNKNOWN_TYPE : extension;
158 }
159
160 public boolean isEditable() {
161 return this.editable;
162 }
163 }
164
165}
0166
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/MergeDialog.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/MergeDialog.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/MergeDialog.java 2013-02-19 07:30:34 +0000
@@ -101,7 +101,7 @@
101 if(url == null || "".equals(url.trim())) {101 if(url == null || "".equals(url.trim())) {
102 return;102 return;
103 }103 }
104 IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(url);104 IBzrBranch branch = BranchFactory.findOrCreateFor(url);
105 if(branch != null) {105 if(branch != null) {
106 ShowLogDialog dialog = new ShowLogDialog(getShell(), branch);106 ShowLogDialog dialog = new ShowLogDialog(getShell(), branch);
107 if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) {107 if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) {
108108
=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/SendDialog.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/SendDialog.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/SendDialog.java 2013-02-19 07:30:34 +0000
@@ -268,7 +268,7 @@
268 if(url == null || "".equals(url.trim())) {268 if(url == null || "".equals(url.trim())) {
269 return;269 return;
270 }270 }
271 IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(url);271 IBzrBranch branch = BranchFactory.findOrCreateFor(url);
272 if(branch != null) {272 if(branch != null) {
273 ShowLogDialog dialog = new ShowLogDialog(getShell(), branch);273 ShowLogDialog dialog = new ShowLogDialog(getShell(), branch);
274 if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) {274 if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) {
275275
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/BranchAsProjectOperation.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/BranchAsProjectOperation.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/BranchAsProjectOperation.java 1970-01-01 00:00:00 +0000
@@ -1,137 +0,0 @@
1/**
2 * LICENSE + COPYRIGHT
3 */
4package org.vcs.bazaar.eclipse.ui.operations;
5
6import java.lang.reflect.InvocationTargetException;
7
8import org.eclipse.core.resources.IProject;
9import org.eclipse.core.resources.IProjectDescription;
10import org.eclipse.core.resources.ResourcesPlugin;
11import org.eclipse.core.runtime.CoreException;
12import org.eclipse.core.runtime.IProgressMonitor;
13import org.eclipse.jface.operation.IRunnableContext;
14import org.eclipse.ui.IWorkbenchWindowActionDelegate;
15import org.vcs.bazaar.eclipse.core.commands.BranchCommand;
16import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
17import org.vcs.bazaar.eclipse.core.repository.BazaarTeamProviderType;
18import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager;
19import org.vcs.bazaar.eclipse.internal.core.BazaarException;
20import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
21
22/**
23 * @author Guillermo Gonzalez
24 *
25 * TODO: Test me
26 */
27public class BranchAsProjectOperation extends BzrOperation {
28 private final IBzrBranch fromLocation;
29 private final IProject project;
30 private final String revno;
31 private final IProjectDescription projectDescription;
32
33 /**
34 *
35 * @param fromLocation The parent of the project
36 * @param project
37 * @param revno
38 */
39 public BranchAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, String revno) {
40 this(context, fromLocation, project, null, revno);
41 }
42
43 public BranchAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProjectDescription description, String revno) {
44 this(context, fromLocation, null, description, revno);
45 }
46
47 public BranchAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, IProjectDescription description, String revno) {
48 super(context);
49 this.fromLocation = fromLocation;
50 if(project == null) {
51 this.project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName());
52 } else {
53 this.project = project;
54 }
55 this.projectDescription = description;
56 this.revno = revno!=null&&"".equals(revno.trim())?null:revno;
57 }
58
59 /**
60 * The action has been activated. The argument of the method represents the
61 * 'real' action sitting in the workbench UI.
62 *
63 * @see IWorkbenchWindowActionDelegate#run
64 */
65 public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
66 try {
67 runCommand(monitor);
68 if(getProjectDescription() == null) {
69 getProject().create(monitor);
70 } else {
71 getProject().create(getProjectDescription(), monitor);
72 }
73 getProject().open(monitor);
74 // Register the project with Team. This will bring all the files
75 // that we cloned into the project.
76 BazaarTeamProviderType.registerProject(getProject());
77 if (getFromLocation() != null && !BranchLocationManager.getInstance().getAllBranches().contains(getFromLocation())) {
78 BranchLocationManager.getInstance().addRepoLocation(getFromLocation());
79 }
80 } catch (BazaarException e) {
81 EclipseBazaarUI.log(e);
82 throw new InvocationTargetException(e, e.getMessage());
83 } catch (CoreException e) {
84 EclipseBazaarUI.log(e);
85 throw new InvocationTargetException(e, e.getMessage());
86 } finally {
87 monitor.done();
88 }
89 }
90
91 /**
92 * @param monitor
93 * @throws BazaarException
94 */
95 protected void runCommand(IProgressMonitor monitor) throws BazaarException {
96 BranchCommand op = null;
97 if(getProjectDescription() == null)
98 op = new BranchCommand(getFromLocation(), getProject().getWorkspace().getRoot().getLocation().append(getProject().getName()).toFile().toURI(), getRevno());
99 else
100 op = new BranchCommand(getFromLocation(), getProjectDescription().getLocationURI(), getRevno());
101 op.run(monitor);
102 }
103
104 @Override
105 protected boolean canRunAsJob() {
106 return true;
107 }
108
109 /**
110 * @return the projectDescription
111 */
112 protected IProjectDescription getProjectDescription() {
113 return projectDescription;
114 }
115
116 /**
117 * @return the fromLocation
118 */
119 protected IBzrBranch getFromLocation() {
120 return fromLocation;
121 }
122
123 /**
124 * @return the project
125 */
126 protected IProject getProject() {
127 return project;
128 }
129
130 /**
131 * @return the revno
132 */
133 protected String getRevno() {
134 return revno;
135 }
136
137}
1380
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CheckoutAsProjectOperation.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CheckoutAsProjectOperation.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CheckoutAsProjectOperation.java 1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
1/**
2 * LICENSE + COPYRIGHT
3 */
4package org.vcs.bazaar.eclipse.ui.operations;
5
6import java.util.ArrayList;
7import java.util.List;
8
9import org.eclipse.core.resources.IProject;
10import org.eclipse.core.resources.IProjectDescription;
11import org.eclipse.core.runtime.IProgressMonitor;
12import org.eclipse.jface.operation.IRunnableContext;
13import org.vcs.bazaar.client.BazaarRevision;
14import org.vcs.bazaar.client.commandline.commands.options.Option;
15import org.vcs.bazaar.client.commandline.syntax.ICheckoutOptions;
16import org.vcs.bazaar.eclipse.core.commands.CheckoutCommand;
17import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
18import org.vcs.bazaar.eclipse.internal.core.BazaarException;
19
20/**
21 * @author Guillermo Gonzalez <guillo.gonzo@gmail.com>
22 *
23 */
24public class CheckoutAsProjectOperation extends BranchAsProjectOperation {
25
26 private Option[] options;
27
28 /**
29 *
30 * @param fromLocation The parent of the project
31 * @param description
32 * @param revno
33 */
34 public CheckoutAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProjectDescription description, String revno, boolean lightweight) {
35 this(context, fromLocation, null, description, revno, lightweight);
36 }
37
38 public CheckoutAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, String revno, boolean lightweight) {
39 this(context, fromLocation, project, null, revno, lightweight);
40 }
41
42 public CheckoutAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, IProjectDescription description, String revno, boolean lightweight) {
43 super(context, fromLocation, project, description, revno);
44 List<Option> options = new ArrayList<Option>(0);
45 if(lightweight) {
46 options.add(ICheckoutOptions.LIGHTWEIGHT);
47 }
48 if(revno != null && !"".equals(revno.trim())) {
49 options.add(ICheckoutOptions.REVISION.setArgument(BazaarRevision.getRevision(BazaarRevision.Prefix.REVNO, revno).toString()));
50 }
51 this.options = options.toArray(new Option[0]);
52 }
53
54 @Override
55 protected void runCommand(IProgressMonitor monitor) throws BazaarException {
56 CheckoutCommand op = null;
57 if(getProjectDescription() == null) {
58 op = new CheckoutCommand(getFromLocation(), getProject().getWorkspace().getRoot().getLocation().append(getProject().getName()).toFile().toURI(), options);
59 } else {
60 op = new CheckoutCommand(getFromLocation(), getProjectDescription().getLocationURI(), options);
61 }
62 op.run(monitor);
63 }
64
65 @Override
66 protected boolean canRunAsJob() {
67 return true;
68 }
69
70}
710
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CreateBazaarProjectOperation.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CreateBazaarProjectOperation.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CreateBazaarProjectOperation.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,198 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.operations;
12
13import java.io.File;
14import java.io.FileFilter;
15import java.lang.reflect.InvocationTargetException;
16import java.net.URI;
17import java.net.URISyntaxException;
18import java.util.ArrayList;
19import java.util.LinkedList;
20import java.util.List;
21
22import org.eclipse.core.resources.IProject;
23import org.eclipse.core.resources.IProjectDescription;
24import org.eclipse.core.resources.IWorkspace;
25import org.eclipse.core.resources.ResourcesPlugin;
26import org.eclipse.core.runtime.CoreException;
27import org.eclipse.core.runtime.IPath;
28import org.eclipse.core.runtime.IProgressMonitor;
29import org.eclipse.core.runtime.Path;
30import org.eclipse.jface.operation.IRunnableContext;
31import org.eclipse.team.ui.TeamOperation;
32import org.vcs.bazaar.client.BazaarRevision;
33import org.vcs.bazaar.client.commandline.commands.options.Option;
34import org.vcs.bazaar.client.commandline.syntax.ICheckoutOptions;
35import org.vcs.bazaar.eclipse.core.commands.BranchCommand;
36import org.vcs.bazaar.eclipse.core.commands.CheckoutCommand;
37import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
38import org.vcs.bazaar.eclipse.core.repository.BazaarTeamProviderType;
39import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager;
40import org.vcs.bazaar.eclipse.internal.core.BazaarException;
41
42/**
43 * Operation for creating project(s) from a Bazaar branch.
44 *
45 * Influenced by earlier implementation by Guillermo Gonzalez.
46 *
47 * @author Alexander Taler alex <@> idereal <.> co <.> nz
48 */
49public class CreateBazaarProjectOperation extends TeamOperation {
50
51 public static int TYPE_CHECKOUT = 1;
52 public static int TYPE_LIGHTWEIGHT = 2;
53 public static int TYPE_BRANCH = 3;
54
55 String projectName;
56 IBzrBranch remoteBranch;
57 String projectLocation;
58 int type;
59 String revision;
60
61 /**
62 *
63 * @param context Found with getContainer()
64 * @param projectName The project to be created
65 * @param remoteBranch The branch to get code from
66 * @param projectLocation Where on disk to check out the project
67 * @param type The type of operation, one of TYPE_CHECKOUT, TYPE_LIGHTWEIGHT, TYPE_BRANCH
68 * @param revision Optional revision, null means use tip
69 */
70 public CreateBazaarProjectOperation(IRunnableContext context,
71 String projectName,
72 IBzrBranch remoteBranch,
73 String projectLocation,
74 int type,
75 String revision)
76 {
77 super(context);
78 this.projectName = projectName;
79 this.remoteBranch = remoteBranch;
80 this.projectLocation = projectLocation;
81 this.type = type;
82 this.revision = revision;
83 }
84
85 public void run(IProgressMonitor monitor)
86 throws InvocationTargetException, InterruptedException
87 {
88 try {
89 URI toDir = new URI("file", projectLocation, null);
90
91 if (type == TYPE_BRANCH) {
92 BranchCommand op = new BranchCommand(remoteBranch, toDir, revision);
93 op.run(monitor);
94 } else {
95 List<Option> options = new ArrayList<Option>(0);
96 if (type == TYPE_LIGHTWEIGHT) {
97 options.add(ICheckoutOptions.LIGHTWEIGHT);
98 }
99 if ((revision != null) && revision.trim().length() > 0) {
100 String s = BazaarRevision.getRevision(BazaarRevision.Prefix.REVNO, revision).toString();
101 options.add(ICheckoutOptions.REVISION.setArgument(s));
102 }
103 CheckoutCommand op = new CheckoutCommand(remoteBranch, toDir, options.toArray(new Option[0]));
104 op.run(monitor);
105 }
106
107 // Search the resulting checked out directory for existing Eclipse projects.
108 List<File> projDirs = findProjects(new File(projectLocation));
109
110 // If no projects were found, then just create a single project at the root.
111 if (projDirs.isEmpty()) {
112 projDirs.add(new File(projectLocation));
113 }
114
115 // Go through the list of project directories and add them all
116 for (File projDir : projDirs) {
117 createProject(projDir, monitor);
118 }
119 } catch (BazaarException e) {
120 throw new InvocationTargetException(e);
121 } catch (CoreException e) {
122 throw new InvocationTargetException(e);
123 } catch (URISyntaxException e) {
124 throw new InvocationTargetException(e);
125 }
126 }
127
128 /**
129 * Search the given location for Eclipse projects.
130 *
131 * This is done after the location has been fetched from Bazaar. The
132 * function performs the search recursively, stopping when it finds a
133 * project file.
134 *
135 * @return List of File objects, the directories containing Bazaar projects.
136 */
137 private List<File> findProjects(File location) {
138 List<File> ps = new LinkedList<File>();
139 File dotProj = new File(location, ".project");
140 if (dotProj.exists()) {
141 ps.add(location);
142 return ps;
143 }
144 // Search directories
145 File[] dirs = location.listFiles(new FileFilter() {
146 public boolean accept(File pathname) {
147 return pathname.isDirectory() && !pathname.getName().equals(".bzr");
148 }
149 });
150
151 for (File dir : dirs) {
152 ps.addAll(findProjects(dir));
153 }
154
155 return ps;
156 }
157
158 /**
159 * Create an Eclipse project at the given location.
160 *
161 * Eclipse throws an exception if a ProjectDescription is used to create
162 * a project at a location directly in the workspace root. However, if
163 * the project location has the same name as the project itself, then
164 * creating the project without a description will not throw an
165 * exception.
166 *
167 * So, as a special case if the directory is in the workspace root, but
168 * matches the project name, create is used without a description.
169 *
170 * The other error case is not checked for here, in case this
171 * undocumented Eclipse behaviour changes.
172 */
173 private void createProject(File projDir, IProgressMonitor monitor) throws CoreException {
174 IWorkspace ws = ResourcesPlugin.getWorkspace();
175 IPath projPath = new Path(projDir.toString());
176 IPath parentPath = projPath.removeLastSegments(1);
177 IProject projectHandle = null;
178
179 if (parentPath.equals(ws.getRoot().getLocation())
180 && projPath.lastSegment().equals(projectName)) {
181
182 projectHandle = ws.getRoot().getProject(projectName);
183 projectHandle.create(monitor);
184
185 } else {
186
187 // Derive a new project name based on the directory
188 String newProjectName = projectName + "-" + projPath.lastSegment();
189 projectHandle = ws.getRoot().getProject(newProjectName);
190 IProjectDescription projDesc = ws.newProjectDescription(newProjectName);
191 projDesc.setLocation(projPath);
192 projectHandle.create(projDesc, monitor);
193 }
194 projectHandle.open(monitor);
195 BazaarTeamProviderType.registerProject(projectHandle);
196 BranchLocationManager.getInstance().addRepoLocation(remoteBranch);
197 }
198}
0199
=== added directory 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject'
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectAdvancedPage.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectAdvancedPage.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectAdvancedPage.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,69 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.jface.resource.ImageDescriptor;
14import org.eclipse.jface.wizard.WizardPage;
15import org.eclipse.swt.SWT;
16import org.eclipse.swt.layout.GridLayout;
17import org.eclipse.swt.widgets.Composite;
18import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
19
20/**
21 * Advanced options for Bazaar project creation Wizard.
22 *
23 * Allows selection of:
24 * - Detached branch, checkout, or lightweight checkout
25 * - revision to fetch
26 *
27 * @author Alexander Taler alex <@> idereal <.> co <.> nz
28 */
29public class CreateProjectAdvancedPage extends WizardPage {
30
31 // The parent wizard to act as a reference
32 public CreateProjectWizard wiz;
33
34 CreateProjectBranchType branchTypeEntry = null;
35 CreateProjectRevision revision = null;
36
37 public CreateProjectAdvancedPage(String pageName, CreateProjectWizard wiz) {
38 super(pageName);
39 this.wiz = wiz;
40 setTitle("Eclipse Project from Bazaar");
41 setDescription("Advanced options for creating project from Bazaar repository");
42 ImageDescriptor titleImage = EclipseBazaarUI.getImageDescriptor("icons/bzr-eclipse.jpg");
43 setImageDescriptor(titleImage);
44 }
45
46 public void createControl(Composite parent) {
47 final Composite topComposite = new Composite(parent, SWT.NONE);
48 topComposite.setLayout(new GridLayout(1, false));
49
50 branchTypeEntry = new CreateProjectBranchType(topComposite, this, wiz, 425);
51 revision = new CreateProjectRevision(topComposite, this, wiz, 425);
52
53 setControl(topComposite);
54 setPageComplete(true);
55 }
56
57 @Override
58 public boolean isPageComplete() {
59 return true;
60 }
61
62 public int getBranchType() {
63 return branchTypeEntry.getBranchType();
64 }
65
66 public String getRevision() {
67 return revision.getValue();
68 }
69}
070
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectBranchType.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectBranchType.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectBranchType.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,90 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.jface.wizard.WizardPage;
14import org.eclipse.swt.SWT;
15import org.eclipse.swt.layout.GridLayout;
16import org.eclipse.swt.widgets.Button;
17import org.eclipse.swt.widgets.Composite;
18import org.eclipse.swt.widgets.Scrollable;
19import org.vcs.bazaar.eclipse.internal.core.BazaarException;
20import org.vcs.bazaar.eclipse.ui.operations.CreateBazaarProjectOperation;
21
22/**
23 * A specialization of CreateProjectEntry.
24 *
25 * Provides a multi selection box to choose the branch type, Branch, Checkout or
26 * Lightweight Checkout.
27 *
28 * @author Alexander Taler
29 */
30public class CreateProjectBranchType extends CreateProjectEntry {
31
32 private static String labelText = "Branch Type";
33
34 protected Button coButton;
35 protected Button lwcoButton;
36 protected Button brButton;
37
38 public CreateProjectBranchType(Composite parent,
39 WizardPage page,
40 CreateProjectWizard wiz,
41 int width) {
42 super(parent, page, wiz, labelText, width, "");
43 }
44
45 @Override
46 protected Scrollable createWidget(Composite parent) {
47 Composite compo = new Composite(parent, SWT.NONE);
48 compo.setLayout(new GridLayout(1, false));
49
50 coButton = new Button(compo, SWT.RADIO);
51 coButton.setText("Checkout");
52 coButton.setSelection(true);
53
54 lwcoButton = new Button(compo, SWT.RADIO);
55 lwcoButton.setText("Lightweight Checkout");
56
57 brButton = new Button(compo, SWT.RADIO);
58 brButton.setText("Branch");
59
60 return compo;
61 }
62
63 @Override
64 public void isValid() throws BazaarException {
65 return;
66 }
67
68 @Override
69 public String getValue() {
70 return "";
71 }
72
73 public int getBranchType() {
74 if (coButton.getSelection()) {
75 return CreateBazaarProjectOperation.TYPE_CHECKOUT;
76 }
77 if (lwcoButton.getSelection()) {
78 return CreateBazaarProjectOperation.TYPE_LIGHTWEIGHT;
79 }
80 if (brButton.getSelection()) {
81 return CreateBazaarProjectOperation.TYPE_BRANCH;
82 }
83 throw new RuntimeException("No Branch Type selected");
84 }
85
86 @Override
87 public void setValue(String newValue) {
88 throw new RuntimeException("setValue not supported");
89 }
90}
091
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectEntry.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectEntry.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectEntry.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,166 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.jface.dialogs.IMessageProvider;
14import org.eclipse.jface.wizard.WizardPage;
15import org.eclipse.swt.SWT;
16import org.eclipse.swt.layout.GridData;
17import org.eclipse.swt.widgets.Composite;
18import org.eclipse.swt.widgets.Event;
19import org.eclipse.swt.widgets.Label;
20import org.eclipse.swt.widgets.Listener;
21import org.eclipse.swt.widgets.Scrollable;
22import org.eclipse.swt.widgets.Text;
23import org.vcs.bazaar.eclipse.internal.core.BazaarException;
24
25/**
26 * A set of widgets and functionality on the project wizard page.
27 *
28 * Provides layout: creating a label and single line text box.
29 *
30 * Manages page completion by listening for events, providing isComplete()
31 * method and calling setPageComplete().
32 *
33 * Can "cascade" text to another text entry box. This allows user input to
34 * update several entries simultaneously. This is suppressed for entries which
35 * the user has edited manually.
36 *
37 * @author Alexander Taler alex <@> idereal <.> co <.> nz
38 */
39public class CreateProjectEntry implements Listener {
40
41 Scrollable textWidget; // The widget holding the text.
42 WizardPage page; // The parent page
43 CreateProjectWizard wiz; // The parent wizard to act as a reference
44 boolean touched = false; // true when the user has directly edited the field
45 CreateProjectEntry cascadeTo = null; // An entry object to cascade text to
46 String baseValue = ""; // The base value, modifiable but a useful start
47
48 protected Text text; // The text widget which holds user input. It may be null in sub classes
49
50 /**
51 * A new text entry box on a CreateProjectPage.
52 *
53 * @param parent The SWT Composite holds this.
54 * @param page The CreateProjectPage containing this.
55 * @param labelText String to display to user explaining what to enter.
56 * @param width Suggested width for the text entry box.
57 * @param baseValue Optional base value.
58 */
59 public CreateProjectEntry(Composite parent,
60 WizardPage page,
61 CreateProjectWizard wiz,
62 String labelText,
63 int width,
64 String baseValue)
65 {
66 this.page = page;
67 this.wiz = wiz;
68 if (baseValue != null) {
69 this.baseValue = baseValue;
70 }
71
72 Label label = new Label(parent, SWT.LEFT);
73 label.setText(labelText);
74
75 textWidget = createWidget(parent);
76 final GridData gridData = new GridData(SWT.VERTICAL);
77 gridData.widthHint = width;
78 textWidget.setLayoutData(gridData);
79
80 textWidget.addListener(SWT.Modify, this);
81 }
82
83 protected Scrollable createWidget(Composite parent) {
84 text = new Text(parent, SWT.SINGLE | SWT.BORDER);
85 text.setText(baseValue);
86 return text;
87 }
88
89 public void handleEvent(Event event) {
90 if (textWidget.isFocusControl()) {
91 touched = isModified();
92 page.setMessage(null);
93 }
94 if (cascadeTo != null) {
95 cascadeTo.cascade(getValue());
96 }
97 try {
98 isValid();
99 page.setPageComplete(true);
100 } catch (BazaarException be) {
101 page.setPageComplete(false);
102 // SetErrorMessage is not displaying. I have not investigated.
103 String message = be.getStatus().getMessage();
104 if ((message != null) && (message.length() > 0)) {
105 page.setMessage(message, IMessageProvider.WARNING);
106 }
107 }
108 }
109
110 public void setCascadeTo(CreateProjectEntry cascadeTo) {
111 this.cascadeTo = cascadeTo;
112 }
113
114 /**
115 * Receive text from another element used to populate this field.
116 *
117 * @param cascadeText
118 */
119 private void cascade(String cascadeText) {
120 if (touched) {
121 return;
122 }
123 // Only use the last segment assuming it's a file name or similar
124 String[] parts = cascadeText.split("[\\\\/]");
125 if (parts.length > 0) {
126 cascadeText = parts[parts.length - 1];
127 }
128 setValue(baseValue + cascadeText);
129 if (cascadeTo != null) {
130 cascadeTo.cascade(getValue());
131 }
132 }
133
134 /**
135 * Check if this field is modified from it's original value.
136 */
137 public boolean isModified() {
138 return (getValue().length() > 0) && (!getValue().equals(baseValue));
139 }
140
141 /**
142 * Check if this field is complete and valid.
143 *
144 * The default implementation just checks if it's modified. The thrown
145 * exception message explains the issue, or is empty if there's nothing
146 * interesting to say.
147 *
148 * @throws BazaarException including a message.
149 */
150 public void isValid() throws BazaarException {
151 if (!isModified()) {
152 throw new BazaarException("");
153 }
154 }
155
156 // This method is used internally in order to allow subclasses to override text
157 public String getValue() {
158 return text.getText();
159 }
160
161 // This method is used internally in order to allow subclasses to override text
162 public void setValue(String newValue) {
163 text.setText(newValue);
164 }
165
166}
0167
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectLocation.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectLocation.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectLocation.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,53 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.core.runtime.IPath;
14import org.eclipse.core.runtime.Path;
15import org.eclipse.jface.wizard.WizardPage;
16import org.eclipse.swt.widgets.Composite;
17import org.vcs.bazaar.eclipse.internal.core.BazaarException;
18
19/**
20 * A widget for entering a project location.
21 *
22 * This means checking the validity.
23 *
24 * @author Alexander Taler
25 */
26public class CreateProjectLocation extends CreateProjectEntry {
27 public CreateProjectLocation(Composite parent,
28 WizardPage page,
29 CreateProjectWizard wiz,
30 String labelText,
31 int width,
32 String baseValue)
33 {
34 super(parent, page, wiz, labelText, width, baseValue);
35 }
36
37 @Override
38 public void isValid() throws BazaarException {
39 // Ensure that it's modified.
40 super.isValid();
41 IPath loc = new Path(getValue());
42 IPath locParent = loc.removeLastSegments(1);
43 IPath workBase = new Path(baseValue);
44 IPath locDefault = new Path(baseValue + wiz.getProjectName());
45 if (loc.equals(workBase)) {
46 throw new BazaarException("Project Location cannot be directly in the workspace root");
47 }
48 if (locParent.equals(workBase) && !loc.equals(locDefault)) {
49 throw new BazaarException(
50 "Project Location cannot be a folder in the workspace root with a different name from the project.");
51 }
52 }
53}
054
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectName.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectName.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectName.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,51 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.core.resources.IProject;
14import org.eclipse.core.resources.ResourcesPlugin;
15import org.eclipse.jface.wizard.WizardPage;
16import org.eclipse.swt.widgets.Composite;
17import org.vcs.bazaar.eclipse.internal.core.BazaarException;
18
19/**
20 * A specialization of CreateProjectEntry.
21 *
22 * This boils down to one line of code: checking validity of project name. A
23 * whole class for that one line seems a bit excessive.
24 *
25 * @author Alexander Taler
26 */
27public class CreateProjectName extends CreateProjectEntry {
28 public CreateProjectName(Composite parent,
29 WizardPage page,
30 CreateProjectWizard wiz,
31 String labelText,
32 int width,
33 String baseValue) {
34 super(parent, page, wiz, labelText, width, baseValue);
35 }
36
37 @Override
38 public void isValid() throws BazaarException {
39 // Ensure that it's modified.
40 super.isValid();
41 try {
42 IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getValue());
43 if (project.exists()) {
44 throw new BazaarException("Project name already taken");
45 }
46 } catch (IllegalArgumentException iae) {
47 throw new BazaarException("Illegal project name");
48 }
49 }
50
51}
052
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectPage.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectPage.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectPage.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,115 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.core.runtime.Platform;
14import org.eclipse.jface.resource.ImageDescriptor;
15import org.eclipse.jface.wizard.WizardPage;
16import org.eclipse.swt.SWT;
17import org.eclipse.swt.layout.GridLayout;
18import org.eclipse.swt.widgets.Composite;
19import org.eclipse.swt.widgets.Label;
20import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
21
22/**
23 * The basic page for the Bazaar project creation Wizard.
24 *
25 * The page is has these entries, in order:
26 * - Remote Bazaar URL
27 * - Project Name
28 * - Local directory location
29 *
30 * @author Alexander Taler alex <@> idereal <.> co <.> nz
31 */
32public class CreateProjectPage extends WizardPage {
33
34 // The parent wizard to act as a reference
35 public CreateProjectWizard wiz;
36
37 CreateProjectRemoteBranch remoteBranch = null;
38 CreateProjectName projName = null;
39 CreateProjectLocation projLoc = null;
40
41 public CreateProjectPage(String pageName, CreateProjectWizard wiz) {
42 super(pageName);
43 this.wiz = wiz;
44 setTitle("Eclipse Project from Bazaar");
45 setDescription("Create a local Eclipse project connected to a remote Bazaar branch");
46 ImageDescriptor titleImage = EclipseBazaarUI.getImageDescriptor("icons/bzr-eclipse.jpg");
47 setImageDescriptor(titleImage);
48 }
49
50 public void createControl(Composite parent) {
51 final Composite topComposite = new Composite(parent, SWT.NONE);
52 topComposite.setLayout(new GridLayout(1, false));
53
54 ///////////////
55 // Repository Location
56 remoteBranch = new CreateProjectRemoteBranch(topComposite, this, wiz, 425, "");
57 setRepoLocation(wiz.getInitialBranch());
58
59 // Space
60 Label space1Label = new Label(topComposite, SWT.LEFT);
61 space1Label.setText("");
62
63 ///////////////
64 // Project Name
65 projName = new CreateProjectName(topComposite, this, wiz, "Name of Eclipse Project", 150, "");
66
67 // Space
68 Label space2Label = new Label(topComposite, SWT.LEFT);
69 space2Label.setText("");
70
71 ///////////////
72 // Project Location
73 String bv = Platform.getLocation().addTrailingSeparator().toOSString();
74
75 projLoc = new CreateProjectLocation(topComposite, this, wiz, "Location for Eclipse Project", 425, bv);
76
77 // Set up the connections
78 remoteBranch.setCascadeTo(projName);
79 projName.setCascadeTo(projLoc);
80
81 setControl(topComposite);
82 setPageComplete(false);
83 }
84
85 @Override
86 public boolean isPageComplete() {
87 try {
88 remoteBranch.isValid();
89 projName.isValid();
90 projLoc.isValid();
91 } catch (Exception e) {
92 // NullPointerException and BazaarException
93 return false;
94 }
95 return true;
96 }
97
98 public String getProjectName() {
99 return projName.getValue();
100 }
101
102 public String getRepoLocation() {
103 return remoteBranch.getValue();
104 }
105
106 public void setRepoLocation(String newValue) {
107 if (newValue != null) {
108 remoteBranch.setValue(newValue);
109 }
110 }
111
112 public String getProjectLocation() {
113 return projLoc.getValue();
114 }
115}
0116
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRemoteBranch.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRemoteBranch.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRemoteBranch.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,101 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.jface.wizard.WizardPage;
14import org.eclipse.swt.SWT;
15import org.eclipse.swt.events.SelectionAdapter;
16import org.eclipse.swt.events.SelectionEvent;
17import org.eclipse.swt.layout.GridLayout;
18import org.eclipse.swt.widgets.Button;
19import org.eclipse.swt.widgets.Combo;
20import org.eclipse.swt.widgets.Composite;
21import org.eclipse.swt.widgets.DirectoryDialog;
22import org.eclipse.swt.widgets.Scrollable;
23import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
24import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager;
25import org.vcs.bazaar.eclipse.internal.core.BazaarException;
26import org.vcs.bazaar.eclipse.internal.core.model.BzrBranchLocator;
27import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
28
29/**
30 * A specialization of CreateProjectEntry.
31 *
32 * It uses a Combo widget instead of a Text widget, validates that input is
33 * correctly formatted and adds a button to browse the file system for branches.
34 *
35 * @author Alexander Taler
36 */
37public class CreateProjectRemoteBranch extends CreateProjectEntry {
38
39 protected Combo combo;
40
41 private static String labelText =
42 "Repository Location\nProvide a URL to a remote repository and branch, or browse for a branch on the local machine";
43
44 public CreateProjectRemoteBranch(Composite parent,
45 WizardPage page,
46 CreateProjectWizard wiz,
47 int width,
48 String baseValue) {
49 super(parent, page, wiz, labelText, width, baseValue);
50 }
51
52 @Override
53 protected Scrollable createWidget(Composite parent) {
54 Composite compo = new Composite(parent, SWT.NONE);
55 compo.setLayout(new GridLayout(2, false));
56
57 combo = new Combo(compo, SWT.SINGLE | SWT.BORDER);
58
59 for (IBzrBranch br : BranchLocationManager.getInstance().getAllBranches()) {
60 try {
61 combo.add(br.getBranchLocator().toString());
62 } catch (BazaarException e1) {
63 // A broken branch is not critical, just log it
64 EclipseBazaarUI.log(e1);
65 }
66 }
67
68 final Button browse = new Button(compo, SWT.PUSH);
69 browse.setText("Browse for folder");
70 browse.addSelectionListener(new SelectionAdapter() {
71 @Override
72 public void widgetSelected(SelectionEvent e) {
73 final DirectoryDialog dialog = new DirectoryDialog(page.getShell());
74 dialog.setMessage("Select folder");
75 final String seldir = dialog.open();
76 if (seldir != null) {
77 combo.setText(seldir);
78 }
79 }
80 });
81
82 return combo;
83 }
84
85 @Override
86 public void isValid() throws BazaarException {
87 // Ensure that it's modified.
88 super.isValid();
89 new BzrBranchLocator(getValue());
90 }
91
92 @Override
93 public String getValue() {
94 return combo.getText();
95 }
96
97 @Override
98 public void setValue(String newValue) {
99 combo.setText(newValue);
100 }
101}
0102
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRevision.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRevision.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRevision.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,106 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import org.eclipse.jface.dialogs.Dialog;
14import org.eclipse.jface.dialogs.IMessageProvider;
15import org.eclipse.jface.wizard.WizardPage;
16import org.eclipse.swt.SWT;
17import org.eclipse.swt.events.SelectionAdapter;
18import org.eclipse.swt.events.SelectionEvent;
19import org.eclipse.swt.layout.GridData;
20import org.eclipse.swt.layout.GridLayout;
21import org.eclipse.swt.widgets.Button;
22import org.eclipse.swt.widgets.Composite;
23import org.eclipse.swt.widgets.Event;
24import org.eclipse.swt.widgets.Listener;
25import org.eclipse.swt.widgets.Scrollable;
26import org.eclipse.swt.widgets.Text;
27import org.vcs.bazaar.eclipse.internal.core.BazaarException;
28import org.vcs.bazaar.eclipse.ui.dialogs.ShowLogDialog;
29
30/**
31 * Allow selection of older revisions
32 *
33 * Provides an entry box to provide an older revision number.
34 *
35 * TODO: Add support for symbolic tags.
36 * TODO: Replace with org.vcs.bazaar.eclipse.ui.widgets.RevisionNumber
37 *
38 * @author Alexander Taler
39 */
40public class CreateProjectRevision extends CreateProjectEntry {
41
42 private static String labelText = "Fetch a specific revision";
43
44 private Button checkBox;
45 private Button showLog;
46
47 public CreateProjectRevision(Composite parent,
48 WizardPage page,
49 CreateProjectWizard wiz,
50 int width) {
51 super(parent, page, wiz, labelText, width, "");
52 }
53
54 @Override
55 protected Scrollable createWidget(Composite parent) {
56 Composite compo = new Composite(parent, SWT.NONE);
57 compo.setLayout(new GridLayout(3, false));
58
59 checkBox = new Button(compo, SWT.CHECK);
60 checkBox.setText("Use older revision");
61 checkBox.setSelection(false);
62
63 text = new Text(compo, SWT.BORDER);
64 GridData gridData = new GridData(SWT.VERTICAL);
65 gridData.widthHint = 50;
66 text.setLayoutData(gridData);
67 text.setEnabled(false);
68
69 // Enable revision text box iff it's enabled.
70 checkBox.addListener(SWT.Selection, new Listener() {
71 public void handleEvent(Event event) {
72 text.setEnabled(checkBox.getSelection());
73 }
74 });
75
76 // Add the showlog button
77 showLog = new Button(compo, SWT.PUSH);
78 showLog.setText("View Revision Log");
79 showLog.addSelectionListener(new SelectionAdapter() {
80 @Override
81 public void widgetSelected(SelectionEvent e) {
82 try {
83 checkBox.setSelection(true);
84 final ShowLogDialog dialog =
85 new ShowLogDialog(page.getShell(), wiz.getRemoteBranch());
86 if (dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) {
87 text.setText(dialog.getSelectedRevision().getValue());
88 }
89 } catch (BazaarException be) {
90 // SetErrorMessage is not displaying. I have not investigated.
91 String message = be.getStatus().getMessage();
92 if ((message != null) && (message.length() > 0)) {
93 page.setMessage(message, IMessageProvider.WARNING);
94 }
95 }
96 }
97 });
98
99 return compo;
100 }
101
102 @Override
103 public void isValid() throws BazaarException {
104 return;
105 }
106}
0107
=== added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectWizard.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectWizard.java 1970-01-01 00:00:00 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectWizard.java 2013-02-19 07:30:34 +0000
@@ -0,0 +1,176 @@
1/*******************************************************************************
2 * Copyright (c) 2012 Idereal Limited
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Alexander Taler
10 *******************************************************************************/
11package org.vcs.bazaar.eclipse.ui.wizards.createproject;
12
13import java.lang.reflect.InvocationTargetException;
14
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.runtime.CoreException;
17import org.eclipse.core.runtime.IStatus;
18import org.eclipse.jface.viewers.IStructuredSelection;
19import org.eclipse.jface.wizard.Wizard;
20import org.eclipse.jface.wizard.WizardDialog;
21import org.eclipse.swt.widgets.Shell;
22import org.eclipse.ui.INewWizard;
23import org.eclipse.ui.IWorkbench;
24import org.vcs.bazaar.eclipse.BzrWorkspaceRoot;
25import org.vcs.bazaar.eclipse.EclipseBazaarCore;
26import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
27import org.vcs.bazaar.eclipse.internal.core.BazaarException;
28import org.vcs.bazaar.eclipse.internal.core.model.BzrBranchLocator;
29import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
30import org.vcs.bazaar.eclipse.ui.operations.CreateBazaarProjectOperation;
31import org.vcs.bazaar.eclipse.ui.team.BazaarUtilities;
32
33/**
34 * A Wizard for creating a local Eclipse project from a remote Bazaar branch.
35 *
36 * It can be called from the create project and import project menus. It can
37 * also be called from the Branch action, in which case the selection is used to
38 * determine the remote Bazaar branch.
39 *
40 * @author Alexander Taler alex <@> idereal <.> co <.> nz
41 */
42public class CreateProjectWizard extends Wizard implements INewWizard {
43
44 private CreateProjectPage cpPage;
45 private CreateProjectAdvancedPage cpaPage;
46
47 // Initial branch
48 protected String initialBranch = null;
49
50 public CreateProjectWizard() {
51 super();
52 }
53
54 public CreateProjectWizard(IStructuredSelection ss) {
55 super();
56 init(null, null);
57
58 if ((ss == null) || (ss.size() < 0)) {
59 throw new RuntimeException("Selection required");
60 }
61 if (ss.size() > 1) {
62 throw new RuntimeException("Single Selection only supported");
63 }
64 if (!(ss.getFirstElement() instanceof IProject)) {
65 throw new RuntimeException("Selection must be a Project");
66 }
67 IProject project = (IProject) ss.getFirstElement();
68 IBzrBranch branch = BzrWorkspaceRoot.getBzrWorkspaceRootFor(project).getBranch();
69 try {
70 initialBranch = branch.getBranchLocator().toString();
71 } catch (BazaarException e) {
72 EclipseBazaarUI.log(e);
73 }
74 }
75
76 /**
77 * The branch that this wizard was created with.
78 */
79 String getInitialBranch() {
80 return initialBranch;
81 }
82
83 /**
84 * Display this wizard to the user.
85 *
86 * @param shell
87 */
88 public void show(Shell shell) {
89 new WizardDialog(shell, this).open();
90 }
91
92 public void init(IWorkbench workbench, IStructuredSelection selection) {
93 setWindowTitle("Bazaar Create Project Wizard");
94 setNeedsProgressMonitor(true);
95 cpPage = new CreateProjectPage("BazaarCreateProjectPage", this);
96 addPage(cpPage);
97 cpaPage = new CreateProjectAdvancedPage("BazaarCreateProjectPage", this);
98 addPage(cpaPage);
99
100 if (!EclipseBazaarCore.getDefault().isClientAvailable()) {
101 BazaarUtilities.configureExecutable();
102 }
103 }
104
105 /**
106 * Display a useful error message to the user.
107 *
108 * The message is shown on both pages of the wizard.
109 *
110 * @param e The exception to show to the user.
111 */
112 protected void setErrorMessage(Throwable e) {
113 String message = "";
114 if (e instanceof InvocationTargetException) {
115 e = e.getCause();
116 }
117 if (e instanceof BazaarException) {
118 message = ((BazaarException) e).getStatus().getMessage();
119 } else if (e instanceof CoreException) {
120 if (((CoreException) e).getStatus() != null) {
121 message = ((CoreException) e).getStatus().getMessage();
122 for (IStatus i : ((CoreException) e).getStatus().getChildren()) {
123 message += i.getMessage();
124 }
125 } else {
126 message = e.getMessage();
127 }
128 }
129 EclipseBazaarUI.log(e);
130 cpPage.setErrorMessage(message);
131 cpaPage.setErrorMessage(message);
132 }
133
134 /**
135 * Return a branch object for the branch this wizard will use.
136 *
137 * @return A branch object of the appropriate type
138 * @throws BazaarException if the user specified branch is invalid
139 */
140 public IBzrBranch getRemoteBranch() throws BazaarException {
141 return new BzrBranchLocator(cpPage.getRepoLocation()).getBranch();
142 }
143
144 /**
145 * Return the project name currently entered.
146 *
147 * @return String containing the project name
148 */
149 public String getProjectName() {
150 return cpPage.getProjectName();
151 }
152
153 @Override
154 public boolean performFinish() {
155 try {
156 CreateBazaarProjectOperation op =
157 new CreateBazaarProjectOperation(
158 this.getContainer(),
159 cpPage.getProjectName(),
160 getRemoteBranch(),
161 cpPage.getProjectLocation(),
162 cpaPage.getBranchType(),
163 cpaPage.getRevision());
164 op.run();
165 return true;
166 } catch (InvocationTargetException e) {
167 setErrorMessage(e);
168 } catch (InterruptedException e) {
169 setErrorMessage(e);
170 } catch (BazaarException e) {
171 setErrorMessage(e);
172 }
173 return false;
174 }
175}
176
0177
=== removed directory 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project'
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchFromProjectWizard.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchFromProjectWizard.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchFromProjectWizard.java 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
1/**
2 * LICENSE + COPYRIGHT
3 */
4package org.vcs.bazaar.eclipse.ui.wizards.project;
5
6import org.eclipse.core.resources.IProject;
7import org.eclipse.core.resources.IProjectDescription;
8import org.eclipse.core.resources.ResourcesPlugin;
9import org.eclipse.jface.dialogs.MessageDialog;
10import org.eclipse.jface.wizard.IWizardPage;
11import org.eclipse.jface.wizard.WizardDialog;
12import org.eclipse.swt.widgets.Shell;
13import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
14import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
15import org.vcs.bazaar.eclipse.ui.operations.BranchAsProjectOperation;
16
17/**
18 * This class implements the branch from project wizard
19 *
20 * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com>
21 */
22public class BranchFromProjectWizard extends BranchWizard {
23
24 public BranchFromProjectWizard(Shell shell, IBzrBranch branch) {
25 super();
26 setRemoteLocation(branch);
27 init(null, null);
28 }
29
30 public static BranchFromProjectWizard open(Shell shell, IBzrBranch branch) {
31 BranchFromProjectWizard wizard = new BranchFromProjectWizard(shell, branch);
32 WizardDialog dialog = new WizardDialog(shell, wizard);
33 dialog.open();
34 return wizard;
35 }
36
37
38 @Override
39 protected boolean performOperation(IProject project) {
40 BranchAsProjectOperation branchOp = null;
41 if(project == null) {
42 IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName());
43 description.setLocation(getNewProjectPage().getLocationPath());
44 branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision());
45 } else {
46 branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision());
47 }
48 try {
49 branchOp.run();
50 } catch (Exception e) {
51 MessageDialog.openError(this.getShell(), "Error while executing branch operation", e.getMessage());
52 EclipseBazaarUI.log(e.getMessage(), e);
53 return false;
54 }
55 return true;
56 }
57
58 @Override
59 public void addPages() {
60 //super.addPages();
61 addPage(getProjectPage());
62 addPage(getNewProjectPage());
63 }
64
65 @Override
66 public IWizardPage getNextPage(IWizardPage page) {
67 if(page != null) {
68 if(page.getName().equals(getProjectPage().getName())) {
69 if(getProjectPage().useNewProjectWizard()) {
70 setUseNewProjectWizard(true);
71 return null;
72 } else {
73 setUseNewProjectWizard(false);
74 return getNewProjectPage();
75 }
76 } else if(page.getName().equals(getNewProjectPage().getName())) {
77 return null;
78 }
79 }
80 return super.getNextPage(page);
81 }
82
83 @Override
84 public IWizardPage getPreviousPage(IWizardPage page) {
85 if(page != null) {
86 if(page.getName().equals(getNewProjectPage().getName())) {
87 return getProjectPage();
88 }
89 }
90 return super.getPreviousPage(page);
91 }
92
93}
940
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizard.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizard.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizard.java 1970-01-01 00:00:00 +0000
@@ -1,250 +0,0 @@
1/**
2 * LICENSE + COPYRIGHT
3 */
4package org.vcs.bazaar.eclipse.ui.wizards.project;
5
6import org.eclipse.core.resources.IProject;
7import org.eclipse.core.resources.IProjectDescription;
8import org.eclipse.core.resources.IResource;
9import org.eclipse.core.resources.IResourceChangeEvent;
10import org.eclipse.core.resources.IResourceChangeListener;
11import org.eclipse.core.resources.IResourceDelta;
12import org.eclipse.core.resources.ResourcesPlugin;
13import org.eclipse.jface.dialogs.MessageDialog;
14import org.eclipse.jface.viewers.IStructuredSelection;
15import org.eclipse.jface.wizard.IWizardPage;
16import org.eclipse.jface.wizard.Wizard;
17import org.eclipse.ui.INewWizard;
18import org.eclipse.ui.IWorkbench;
19import org.eclipse.ui.PlatformUI;
20import org.eclipse.ui.actions.NewProjectAction;
21import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
22import org.vcs.bazaar.eclipse.EclipseBazaarCore;
23import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
24import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
25import org.vcs.bazaar.eclipse.ui.UITexts;
26import org.vcs.bazaar.eclipse.ui.operations.BranchAsProjectOperation;
27import org.vcs.bazaar.eclipse.ui.team.BazaarUtilities;
28import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage;
29
30/**
31 * This class implements the new wizard extension.
32 *
33 * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com>
34 */
35public class BranchWizard extends Wizard implements INewWizard {
36
37 private BranchWizardBranchLocationPage createRepoLocationPage;
38 private BranchWizardSelectionPage selectBranchPage;
39 private WizardNewProjectCreationPage newProjectPage;
40 private BranchWizardProjectPage projectPage;
41
42 private IBzrBranch remoteLocation;
43 private boolean useNewProjectWizard;
44
45 @Override
46 public boolean canFinish() {
47 if(useNewProjectWizard) {
48 return (getRemoteLocation() != null);
49 } else if(getProjectHandle() == null){
50 return getRemoteLocation() != null && getNewProjectPage().isPageComplete();
51 } else {
52 return getRemoteLocation() != null && getProjectHandle() != null;
53 }
54 }
55
56 protected IProject getProjectHandle() {
57 try {
58 if(!getProjectPage().useNewProjectWizard() && getNewProjectPage().useDefaults())
59 return getNewProjectPage().getProjectHandle();
60 } catch(IllegalArgumentException iae) {
61 return null;
62 }
63 return null;
64 }
65
66 @Override
67 public boolean performFinish() {
68 IProject project = null;
69 if(useNewProjectWizard) {
70 ProjectListener listener = new ProjectListener();
71 ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
72 (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run();
73 ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
74 project = listener.getProject();
75 } else {
76 project = getProjectHandle();
77 }
78 return performOperation(project);
79 }
80
81 /**
82 * Perform the real stuff (in this case branching)
83 * @param project
84 * @return
85 */
86 protected boolean performOperation(IProject project) {
87 BranchAsProjectOperation branchOp = null;
88 if(project == null) {
89 IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName());
90 description.setLocation(getNewProjectPage().getLocationPath());
91 branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision());
92 } else {
93 branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision());
94 }
95 try {
96 branchOp.run();
97 } catch (Exception e) {
98 MessageDialog.openError(this.getShell(), "Error while executing branch operation", e.getMessage());
99 EclipseBazaarUI.log(e.getMessage(), e);
100 return false;
101 }
102 return true;
103 }
104
105 public void init(IWorkbench workbench, IStructuredSelection selection) {
106 setWindowTitle(UITexts.ImportWizard_wizardTitle);
107 setNeedsProgressMonitor(true);
108 selectBranchPage = new BranchWizardSelectionPage("selectBranch", "Source branch");
109 projectPage = new BranchWizardProjectPage("projectPage", isCheckout());
110 createRepoLocationPage = new BranchWizardBranchLocationPage("CreateRepoPage", "Source branch");
111 setNewProjectPage(new WizardNewProjectCreationPage("newProjectPage"));
112 getNewProjectPage().setTitle("Project");
113 getNewProjectPage().setDescription("Create a new project resource");
114 getNewProjectPage().setImageDescriptor(BzrWizardPage.getTitleImage());
115
116 if (!EclipseBazaarCore.getDefault().isClientAvailable()) {
117 BazaarUtilities.configureExecutable();
118 }
119 }
120
121 protected boolean isCheckout() {
122 return false;
123 }
124
125 @Override
126 public void addPages() {
127 super.addPages();
128 addPage(selectBranchPage);
129 addPage(createRepoLocationPage);
130 addPage(getProjectPage());
131 addPage(getNewProjectPage());
132 }
133
134 @Override
135 public IWizardPage getNextPage(IWizardPage page) {
136 if(page != null) {
137 if(page.getName().equals(selectBranchPage.getName())) {
138 if(selectBranchPage.isCreateNewBranchLocation()) {
139 return createRepoLocationPage;
140 } else {
141 setRemoteLocation(selectBranchPage.getLocation());
142 getProjectPage().setLocation(getRemoteLocation());
143 return getProjectPage();
144 }
145 } else if(page.getName().equals(getProjectPage().getName())) {
146 if(getProjectPage().useNewProjectWizard()) {
147 useNewProjectWizard = true;
148 return null;
149 } else {
150 useNewProjectWizard = false;
151 return getNewProjectPage();
152 }
153 } else if(page.getName().equals(createRepoLocationPage.getName())) {
154 setRemoteLocation(createRepoLocationPage.getLocation());
155 getProjectPage().setLocation(getRemoteLocation());
156 return super.getNextPage(page);
157 }
158 }
159 return super.getNextPage(page);
160 }
161
162 @Override
163 public IWizardPage getPreviousPage(IWizardPage page) {
164 if(page != null) {
165 if(page.getName().equals(createRepoLocationPage.getName())) {
166 return selectBranchPage;
167 } else if(page.getName().equals(getProjectPage().getName())) {
168 if(selectBranchPage.isCreateNewBranchLocation()) {
169 return createRepoLocationPage;
170 }
171 } else if(page.getName().equals(getNewProjectPage().getName())) {
172 return getProjectPage();
173 }
174 }
175 return super.getPreviousPage(page);
176 }
177
178
179 protected boolean isUseNewProjectWizard() {
180 return useNewProjectWizard;
181 }
182
183 protected void setUseNewProjectWizard(boolean useNewProjectWizard) {
184 this.useNewProjectWizard = useNewProjectWizard;
185 }
186
187 /**
188 * @param remoteLocation the remoteLocation to set
189 */
190 protected void setRemoteLocation(IBzrBranch remoteLocation) {
191 this.remoteLocation = remoteLocation;
192 }
193
194 /**
195 * @return the remoteLocation
196 */
197 protected IBzrBranch getRemoteLocation() {
198 return remoteLocation;
199 }
200
201 /**
202 * @param newProjectPage the newProjectPage to set
203 */
204 protected void setNewProjectPage(WizardNewProjectCreationPage newProjectPage) {
205 this.newProjectPage = newProjectPage;
206 }
207
208 /**
209 * @return the newProjectPage
210 */
211 protected WizardNewProjectCreationPage getNewProjectPage() {
212 return newProjectPage;
213 }
214
215 /**
216 * @param projectPage the projectPage to set
217 */
218 protected void setProjectPage(BranchWizardProjectPage projectPage) {
219 this.projectPage = projectPage;
220 }
221
222 /**
223 * @return the projectPage
224 */
225 protected BranchWizardProjectPage getProjectPage() {
226 return projectPage;
227 }
228
229 private static final class ProjectListener implements IResourceChangeListener {
230 private IProject project = null;
231
232 public void resourceChanged(IResourceChangeEvent event) {
233 IResourceDelta[] deltas = event.getDelta().getAffectedChildren();
234 for (int i = 0; i < deltas.length; i++) {
235 IResource resource = deltas[i].getResource();
236 if (resource instanceof IProject) {
237 if (deltas[i].getKind() == IResourceDelta.ADDED) {
238 project = (IProject) resource;
239 } else if (deltas[i].getKind() == IResourceDelta.REMOVED && project == resource) {
240 project = null;
241 }
242 }
243 }
244 }
245
246 public IProject getProject() {
247 return project;
248 }
249 }
250}
2510
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardBranchLocationPage.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardBranchLocationPage.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardBranchLocationPage.java 1970-01-01 00:00:00 +0000
@@ -1,143 +0,0 @@
1/*******************************************************************************
2 * Copyright (c) 2006 Software Balm Consulting Inc.
3 *
4 * This software is licensed under the zlib/libpng license.
5 *
6 * This software is provided 'as-is', without any express or implied warranty.
7 * In no event will the authors be held liable for any damages arising from the
8 * use of this software.
9 *
10 * Permission is granted to anyone to use this software for any purpose,
11 * including commercial applications, and to alter it and redistribute it freely,
12 * subject to the following restrictions:
13 *
14 * 1. The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this
16 * software in a product, an acknowledgment in the product
17 * documentation would be appreciated but is not required.
18 *
19 * 2. Altered source versions must be plainly marked as such, and must not be
20 * misrepresented as being the original software.
21 *
22 * 3. This notice may not be removed or altered from any source distribution.
23 *******************************************************************************/
24package org.vcs.bazaar.eclipse.ui.wizards.project;
25
26import org.eclipse.jface.wizard.IWizardPage;
27import org.eclipse.swt.SWT;
28import org.eclipse.swt.events.ModifyEvent;
29import org.eclipse.swt.events.ModifyListener;
30import org.eclipse.swt.events.SelectionAdapter;
31import org.eclipse.swt.events.SelectionEvent;
32import org.eclipse.swt.layout.GridData;
33import org.eclipse.swt.layout.GridLayout;
34import org.eclipse.swt.widgets.Button;
35import org.eclipse.swt.widgets.Combo;
36import org.eclipse.swt.widgets.Composite;
37import org.eclipse.swt.widgets.DirectoryDialog;
38import org.eclipse.swt.widgets.Label;
39import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
40import org.vcs.bazaar.eclipse.core.repository.BranchFactory;
41import org.vcs.bazaar.eclipse.ui.UITexts;
42import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage;
43
44/*
45 * @author Peter Hunnisett <peter_hge at softwarebalm dot com>
46 *
47 * This file implements a wizard page which will allow the user to create a
48 * repository location.
49 *
50 */
51public class BranchWizardBranchLocationPage extends BzrWizardPage implements IWizardPage {
52 private String location;
53 /**
54 *
55 * @param pageName
56 * @param title
57 */
58 public BranchWizardBranchLocationPage(String pageName, String title) {
59 super(pageName);
60 setTitle(title);
61 setDescription(UITexts.Branch_Wizard_page_description);
62 }
63
64 @Override
65 public boolean canFlipToNextPage() {
66 return isPageComplete() && (getWizard().getNextPage(this) != null);
67 }
68
69 public void createControl(Composite parent) {
70 final Composite outerContainer = new Composite(parent, SWT.NONE);
71 outerContainer.setLayout(new GridLayout(1,false));
72 outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
73
74 // Three columns for the location + browse + revno
75 final Composite locationContainer = new Composite(outerContainer, SWT.NONE);
76 locationContainer.setLayout(new GridLayout(3,false));
77 locationContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
78
79 // Box to enter the repo location
80 final Composite repoLocationContainer = new Composite(locationContainer, SWT.NONE);
81 repoLocationContainer.setLayout(new GridLayout(2,false));
82 repoLocationContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
83
84 final Label locationLabel = new Label(repoLocationContainer, SWT.NONE);
85 locationLabel.setText(UITexts.Branch_Wizard_page_branch_location_label);
86 final GridData locationData = new GridData(SWT.VERTICAL);
87 locationData.widthHint = 500;
88 final Combo locationCombo = new Combo(repoLocationContainer, SWT.DROP_DOWN);
89 locationCombo.setLayoutData(locationData);
90
91 final Button browseButton = new Button(locationContainer, SWT.PUSH);
92 browseButton.setText(UITexts.Branch_Wizard_page_branch_location_browse_button);
93 browseButton.addSelectionListener(new SelectionAdapter() {
94 @Override
95 public void widgetSelected(SelectionEvent e) {
96 final DirectoryDialog dialog = new DirectoryDialog(getShell());
97 dialog.setMessage(UITexts.Branch_Wizard_page_branch_location_dialog_message);
98 final String dir = dialog.open();
99 if (dir != null){
100 locationCombo.setText(dir);
101 }
102 }
103 });
104
105 locationCombo.addSelectionListener(new SelectionAdapter(){
106 @Override
107 public void widgetSelected(SelectionEvent e) {
108 location = locationCombo.getText();
109 setPageComplete(isPageComplete());
110 }
111 });
112 locationCombo.addModifyListener(new ModifyListener(){
113
114 public void modifyText(ModifyEvent e) {
115 location = locationCombo.getText();
116 setPageComplete(isPageComplete());
117 }
118 });
119
120 setControl(outerContainer);
121 locationCombo.setFocus();
122 setPageComplete(false);
123 }
124
125 @Override
126 public boolean isPageComplete() {
127 if(location == null || location.length() == 0){
128 setMessage(UITexts.Branch_Wizard_page_branch_location_error_location_notspecified);
129 return false;
130 }
131 if(!BranchFactory.validateBranch(location)){
132 setMessage(UITexts.Branch_Wizard_page_branch_location_error_location_invalid);
133 return false;
134 }
135 setMessage(null);
136 return true;
137 }
138
139 public IBzrBranch getLocation() {
140 return BranchFactory.getInstance().findOrCreateFor(location);
141 }
142
143}
1440
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardProjectPage.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardProjectPage.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardProjectPage.java 1970-01-01 00:00:00 +0000
@@ -1,176 +0,0 @@
1/**
2 * LICENSE + COPYRIGHT
3 */
4package org.vcs.bazaar.eclipse.ui.wizards.project;
5
6import org.eclipse.jface.dialogs.Dialog;
7import org.eclipse.jface.dialogs.IMessageProvider;
8import org.eclipse.jface.wizard.IWizardPage;
9import org.eclipse.swt.SWT;
10import org.eclipse.swt.events.SelectionAdapter;
11import org.eclipse.swt.events.SelectionEvent;
12import org.eclipse.swt.events.SelectionListener;
13import org.eclipse.swt.layout.GridData;
14import org.eclipse.swt.layout.GridLayout;
15import org.eclipse.swt.layout.RowData;
16import org.eclipse.swt.layout.RowLayout;
17import org.eclipse.swt.widgets.Button;
18import org.eclipse.swt.widgets.Composite;
19import org.eclipse.swt.widgets.Group;
20import org.eclipse.swt.widgets.Label;
21import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
22import org.vcs.bazaar.eclipse.ui.UITexts;
23import org.vcs.bazaar.eclipse.ui.dialogs.ShowLogDialog;
24import org.vcs.bazaar.eclipse.ui.widgets.RevisionNumber;
25import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage;
26
27/**
28 * @author "Guillermo Gonzalez <guillo.gonzo at gmail dot com>"
29 *
30 */
31public class BranchWizardProjectPage extends BzrWizardPage implements IWizardPage {
32
33 private Label textLabel;
34 private Button wizardButton;
35 private Button projectsButton;
36 private Group revisionGroup;
37 private RevisionNumber revision;
38 private IBzrBranch remoteLocation;
39 private final boolean isCheckout;
40 private Button lightWegithButton;
41
42 protected BranchWizardProjectPage(String pageName, boolean isCheckout) {
43 super(pageName);
44 this.isCheckout = isCheckout;
45 }
46
47 public void createControl(Composite parent) {
48 Composite outerContainer = new Composite(parent,SWT.NONE);
49 GridLayout layout = new GridLayout();
50 layout.numColumns = 1;
51 outerContainer.setLayout(layout);
52 outerContainer.setLayoutData(
53 new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
54
55 textLabel = new Label(outerContainer, SWT.NONE);
56 GridData data = new GridData();
57 data.widthHint = 300;
58 textLabel.setLayoutData(data);
59
60 wizardButton = new Button(outerContainer, SWT.RADIO);
61 wizardButton.setText(UITexts.BranchWizardProjectPage_wizard); //$NON-NLS-1$
62 wizardButton.setEnabled(true);
63
64 projectsButton = new Button(outerContainer, SWT.RADIO);
65 projectsButton.setText(UITexts.BranchWizardProjectPage_projects); //$NON-NLS-1$
66
67 SelectionListener projectWizardTypeListener = new SelectionAdapter() {
68 @Override
69 public void widgetSelected(SelectionEvent e) {
70 setPageComplete(isPageComplete());
71 }
72 };
73
74 projectsButton.addSelectionListener(projectWizardTypeListener);
75 wizardButton.addSelectionListener(projectWizardTypeListener);
76
77 if(isCheckout) {
78 lightWegithButton = new Button(outerContainer, SWT.CHECK);
79 lightWegithButton.setText(UITexts.CheckoutWizardProjectPage_lightweight);
80 lightWegithButton.setSelection(false);
81 lightWegithButton.addSelectionListener(new SelectionAdapter() {
82 @Override
83 public void widgetSelected(SelectionEvent e) {
84 BranchWizardProjectPage.this.revision.setEnabled(!lightWegithButton.getSelection());
85 }
86 });
87 }
88
89 createRevisionGroup(outerContainer);
90
91 setControl(outerContainer);
92 projectsButton.setSelection(true);
93 projectsButton.setFocus();
94 /* FIXME: TODO: Enable the project wizard
95 * temprary disabled. Until I can create the project but not the folder
96 * and can branch previous to the project folder creation
97 */
98 wizardButton.setEnabled(false);
99 setPageComplete(false);
100 }
101
102 private void createRevisionGroup(Composite parent) {
103 revisionGroup = new Group(parent, SWT.NULL);
104 revisionGroup.setText(UITexts.BranchWizardProjectPage_revision); //$NON-NLS-1$
105 GridData data = new GridData(GridData.FILL_BOTH);
106 revisionGroup.setLayoutData(data);
107 revisionGroup.setLayout(new RowLayout(SWT.VERTICAL));
108
109 revision = new RevisionNumber(revisionGroup);
110 revision.setLayoutData(new RowData());
111 revision.addShowLogButtonSelectionListener(new SelectionAdapter() {
112 @Override
113 public void widgetSelected(SelectionEvent e) {
114 showLog();
115 }
116 });
117 }
118
119 protected void showLog() {
120 if(this.remoteLocation != null && !isLigthWeight()) {
121 ShowLogDialog dialog = new ShowLogDialog(getShell(), this.remoteLocation);
122 if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) {
123 revision.setRevision(dialog.getSelectedRevision().getValue());
124 }
125 }
126 }
127
128 protected void setLocation(IBzrBranch remoteLocation) {
129 this.remoteLocation = remoteLocation;
130 }
131
132 @Override
133 public boolean isPageComplete() {
134 if(revision.isRevisionSelected()) {
135 if(revision.getRevision().trim().length() != 0){
136 setMessage(null);
137 return true;
138 }
139 setMessage("specify a revision number",IMessageProvider.ERROR);
140 return false;
141 } else if(revision.isTipSelected()) {
142 setMessage(null);
143 return true;
144 }
145 return false;
146 }
147
148 public String getRevision() {
149 return revision.getRevision();
150 }
151
152 public boolean useSpecificRevision() {
153 return revision.isRevisionSelected();
154 }
155
156 public boolean useNewProjectWizard() {
157 return wizardButton.getSelection();
158 }
159
160 public boolean isLigthWeight() {
161 if(isCheckout) {
162 return lightWegithButton.getSelection();
163 }
164 return false;
165 }
166 @Override
167 public void dispose() {
168 textLabel.dispose();
169 wizardButton.dispose();
170 projectsButton.dispose();
171 revision.dispose();
172 revisionGroup.dispose();
173 super.dispose();
174 }
175
176}
1770
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardSelectionPage.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardSelectionPage.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardSelectionPage.java 1970-01-01 00:00:00 +0000
@@ -1,188 +0,0 @@
1/*******************************************************************************
2 * Copyright (c) 2006 Software Balm Consulting Inc.
3 *
4 * This software is licensed under the zlib/libpng license.
5 *
6 * This software is provided 'as-is', without any express or implied warranty.
7 * In no event will the authors be held liable for any damages arising from the
8 * use of this software.
9 *
10 * Permission is granted to anyone to use this software for any purpose,
11 * including commercial applications, and to alter it and redistribute it freely,
12 * subject to the following restrictions:
13 *
14 * 1. The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this
16 * software in a product, an acknowledgment in the product
17 * documentation would be appreciated but is not required.
18 *
19 * 2. Altered source versions must be plainly marked as such, and must not be
20 * misrepresented as being the original software.
21 *
22 * 3. This notice may not be removed or altered from any source distribution.
23 *******************************************************************************/
24package org.vcs.bazaar.eclipse.ui.wizards.project;
25
26import java.util.Set;
27
28import org.eclipse.jface.viewers.ISelectionChangedListener;
29import org.eclipse.jface.viewers.IStructuredSelection;
30import org.eclipse.jface.viewers.LabelProvider;
31import org.eclipse.jface.viewers.ListViewer;
32import org.eclipse.jface.viewers.SelectionChangedEvent;
33import org.eclipse.jface.viewers.Viewer;
34import org.eclipse.jface.viewers.ViewerComparator;
35import org.eclipse.jface.wizard.IWizardPage;
36import org.eclipse.swt.SWT;
37import org.eclipse.swt.layout.GridData;
38import org.eclipse.swt.layout.GridLayout;
39import org.eclipse.swt.widgets.Button;
40import org.eclipse.swt.widgets.Composite;
41import org.eclipse.swt.widgets.Event;
42import org.eclipse.swt.widgets.List;
43import org.eclipse.swt.widgets.Listener;
44import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
45import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager;
46import org.vcs.bazaar.eclipse.ui.UITexts;
47import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage;
48
49/**
50 * @basedOn Peter Hunnisett <peter_hge at softwarebalm dot com>
51 * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com>
52 * This file implements a wizard page which will have the user choose a
53 * repository location or opt to create one. The creation of a repository
54 * location, if desired, is left to another wizard page.
55 *
56 */
57public class BranchWizardSelectionPage extends BzrWizardPage implements IWizardPage, ISelectionChangedListener {
58 private Button useExistingBranchLocation;
59 private Button createNewBranchLocation;
60 private ListViewer branchList;
61
62 public BranchWizardSelectionPage(String pageName, String title) {
63 super(pageName);
64 setTitle(title);
65 setDescription(UITexts.Branch_Wizard_page_description_select_source_branch);
66 setPageComplete(false);
67 }
68
69 @Override
70 public boolean canFlipToNextPage() {
71 if(useExistingBranchLocation.getSelection()) {
72 return branchList.getSelection() != null && !branchList.getSelection().isEmpty();
73 }
74 return (createNewBranchLocation != null) && (createNewBranchLocation.getSelection());
75 }
76
77 public void createControl(Composite parent) {
78 Composite outerContainer = new Composite(parent, SWT.NONE);
79 GridLayout layout = new GridLayout();
80 layout.numColumns = 1;
81 outerContainer.setLayout(layout);
82 outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
83
84 createNewBranchLocation = new Button(outerContainer, SWT.RADIO);
85 createNewBranchLocation.setText(UITexts.Branch_Wizard_page_init_new_branch);
86
87 useExistingBranchLocation = new Button(outerContainer, SWT.RADIO);
88 useExistingBranchLocation.setText(UITexts.Branch_Wizard_page_use_existing_branch);
89
90 createNewBranchLocation.addListener(SWT.Selection, new Listener() {
91 public void handleEvent(Event event) {
92 if (createNewBranchLocation.getSelection()) {
93 setPageComplete(true);
94 branchList.getControl().setEnabled(false);
95 }
96 }
97 });
98
99 useExistingBranchLocation.addListener(SWT.Selection, new Listener() {
100 public void handleEvent(Event event) {
101 if (useExistingBranchLocation.getSelection()) {
102 boolean isPageComplete = false;
103 if(branchList.getSelection() != null && !branchList.getSelection().isEmpty()) {
104 isPageComplete = true;
105 }
106 setPageComplete(isPageComplete);
107 branchList.getControl().setEnabled(true);
108 }
109 }
110 });
111
112 branchList = createBranchList(outerContainer);
113
114 setControl(outerContainer);
115
116 // This will trigger a setPageComplete call to set the next button
117 // appropriately.
118 createNewBranchLocation.setSelection(true);
119 createNewBranchLocation.setFocus();
120 useExistingBranchLocation.setSelection(false);
121 branchList.getControl().setEnabled(false);
122 }
123
124 private ListViewer createBranchList(Composite parent) {
125 ListViewer viewer = new ListViewer(parent);
126 viewer.setLabelProvider(new LabelProvider() {
127 @Override
128 public String getText(Object element) {
129 IBzrBranch branch = (IBzrBranch)element;
130 return branch.getBranchLocation().toString();
131 }
132 });
133 viewer.addSelectionChangedListener(this);
134 viewer.setComparator(new ViewerComparator() {
135 @Override
136 public int compare(Viewer viewer, Object e1, Object e2) {
137 IBzrBranch b1 = (IBzrBranch)e1;
138 IBzrBranch b2 = (IBzrBranch)e2;
139 return b1.compareTo(b2);
140 }
141 });
142 List list = viewer.getList();
143 list.setLayoutData(new GridData(GridData.FILL_BOTH));
144
145 Set<IBzrBranch> branchList = BranchLocationManager.getInstance().getAllBranches();
146 for (IBzrBranch bzrBranch : branchList) {
147 viewer.add(bzrBranch);
148 }
149 return viewer;
150 }
151
152 /*
153 * For the moment only handle the change selection in the branch list
154 *
155 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
156 */
157 public void selectionChanged(SelectionChangedEvent event) {
158 if(event.getSelection() != null) {
159 setPageComplete(true);
160 }
161 }
162
163 public boolean isCreateNewBranchLocation() {
164 if(createNewBranchLocation != null) {
165 return createNewBranchLocation.getSelection();
166 }
167 return false;
168 }
169
170 public IBzrBranch getLocation() {
171 IStructuredSelection selection = (IStructuredSelection)branchList.getSelection();
172 return (IBzrBranch)selection.getFirstElement();
173 }
174
175 @Override
176 public void dispose() {
177 if(useExistingBranchLocation != null) {
178 useExistingBranchLocation.dispose();
179 }
180 if(createNewBranchLocation != null) {
181 createNewBranchLocation.dispose();
182 }
183 if(branchList != null) {
184 branchList.getList().dispose();
185 }
186 super.dispose();
187 }
188}
1890
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutFromProjectWizard.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutFromProjectWizard.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutFromProjectWizard.java 1970-01-01 00:00:00 +0000
@@ -1,57 +0,0 @@
1/**
2 * LICENSE + COPYRIGHT
3 */
4package org.vcs.bazaar.eclipse.ui.wizards.project;
5
6import org.eclipse.core.resources.IProject;
7import org.eclipse.core.resources.IProjectDescription;
8import org.eclipse.core.resources.ResourcesPlugin;
9import org.eclipse.jface.dialogs.MessageDialog;
10import org.eclipse.jface.wizard.WizardDialog;
11import org.eclipse.swt.widgets.Shell;
12import org.vcs.bazaar.eclipse.core.model.IBzrBranch;
13import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
14import org.vcs.bazaar.eclipse.ui.operations.CheckoutAsProjectOperation;
15
16/**
17 * This class implements the checkout(and lightweight) from project wizard
18 *
19 * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com>
20 */
21public class CheckoutFromProjectWizard extends BranchFromProjectWizard {
22
23 private boolean lightweight;
24
25 public CheckoutFromProjectWizard(Shell shell, IBzrBranch branch, boolean lightweight) {
26 super(shell, branch);
27 this.lightweight = lightweight;
28 }
29
30 public static CheckoutFromProjectWizard open(Shell shell, IBzrBranch branch, boolean lightweight) {
31 CheckoutFromProjectWizard wizard = new CheckoutFromProjectWizard(shell, branch, lightweight);
32 WizardDialog dialog = new WizardDialog(shell, wizard);
33 dialog.open();
34 return wizard;
35 }
36
37
38 @Override
39 public boolean performOperation(IProject project) {
40 CheckoutAsProjectOperation checkoutOp = null;
41 if(project == null) {
42 IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName());
43 description.setLocation(getNewProjectPage().getLocationPath());
44 checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision(), lightweight);
45 } else {
46 checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision(), lightweight);
47 }
48 try {
49 checkoutOp.run();
50 } catch (Exception e) {
51 MessageDialog.openError(this.getShell(), "Error while executing branch operation", e.getMessage());
52 EclipseBazaarUI.log(e.getMessage(), e);
53 return false;
54 }
55 return true;
56 }
57}
580
=== removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutWizard.java'
--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutWizard.java 2009-11-18 08:48:22 +0000
+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutWizard.java 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
1/**
2 * LICENSE + COPYRIGHT
3 */
4package org.vcs.bazaar.eclipse.ui.wizards.project;
5
6import org.eclipse.core.resources.IProject;
7import org.eclipse.core.resources.IProjectDescription;
8import org.eclipse.core.resources.ResourcesPlugin;
9import org.eclipse.jface.dialogs.MessageDialog;
10import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
11import org.vcs.bazaar.eclipse.ui.operations.CheckoutAsProjectOperation;
12
13/**
14 * This class implements the new wizard extension.
15 *
16 * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com>
17 */
18public class CheckoutWizard extends BranchWizard {
19
20
21 @Override
22 protected boolean performOperation(IProject project) {
23 CheckoutAsProjectOperation checkoutOp = null;
24 if(project == null) {
25 IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName());
26 description.setLocation(getNewProjectPage().getLocationPath());
27 checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision(), getProjectPage().isLigthWeight());
28 } else {
29 checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision(), getProjectPage().isLigthWeight());
30 }
31 try {
32 checkoutOp.run();
33 } catch (Exception e) {
34 MessageDialog.openError(this.getShell(), "Error while executing checkout operation", e.getMessage());
35 EclipseBazaarUI.log(e.getMessage(), e);
36 return false;
37 }
38 return true;
39 }
40
41 @Override
42 protected boolean isCheckout() {
43 return true;
44 }
45}
460
=== modified file 'pom.xml'
--- pom.xml 2011-07-19 05:32:49 +0000
+++ pom.xml 2013-02-19 07:30:34 +0000
@@ -6,7 +6,7 @@
6 </prerequisites>6 </prerequisites>
7 <groupId>org.vcs.bazaar.eclipse</groupId>7 <groupId>org.vcs.bazaar.eclipse</groupId>
8 <artifactId>org.vcs.bazaar.eclipse</artifactId>8 <artifactId>org.vcs.bazaar.eclipse</artifactId>
9 <version>1.1.1-SNAPSHOT</version>9 <version>1.2.0-SNAPSHOT</version>
10 <packaging>pom</packaging>10 <packaging>pom</packaging>
11 <scm>11 <scm>
12 <connection>scm:bazaar:lp:bzr-eclipse</connection>12 <connection>scm:bazaar:lp:bzr-eclipse</connection>
@@ -17,7 +17,7 @@
17 <url>http://bugs.launchpad.net/bzr-eclipse</url>17 <url>http://bugs.launchpad.net/bzr-eclipse</url>
18 </issueManagement>18 </issueManagement>
19 <properties>19 <properties>
20 <bzr-eclipse-version>1.1.1-SNAPSHOT</bzr-eclipse-version>20 <bzr-eclipse-version>1.2.0-SNAPSHOT</bzr-eclipse-version>
21 <tycho-version>0.10.0</tycho-version>21 <tycho-version>0.10.0</tycho-version>
22 <platform-version-name>helios</platform-version-name>22 <platform-version-name>helios</platform-version-name>
23 <eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>23 <eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>
2424
=== modified file 'redstone.xmlrpc/pom.xml'
--- redstone.xmlrpc/pom.xml 2011-03-22 15:05:45 +0000
+++ redstone.xmlrpc/pom.xml 2013-02-19 07:30:34 +0000
@@ -4,7 +4,7 @@
4 <parent>4 <parent>
5 <groupId>org.vcs.bazaar.eclipse</groupId>5 <groupId>org.vcs.bazaar.eclipse</groupId>
6 <artifactId>org.vcs.bazaar.eclipse</artifactId>6 <artifactId>org.vcs.bazaar.eclipse</artifactId>
7 <version>1.1.1-SNAPSHOT</version>7 <version>1.2.0-SNAPSHOT</version>
8 <relativePath>../pom.xml</relativePath>8 <relativePath>../pom.xml</relativePath>
9 </parent>9 </parent>
10 <groupId>redstone.xmlrpc</groupId>10 <groupId>redstone.xmlrpc</groupId>

Subscribers

People subscribed via source and target branches