Merge lp:~alex-idereal/bzr-eclipse/bzr-eclipse into lp:bzr-eclipse
- bzr-eclipse
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Piotr Piastucki | Approve | ||
Review via email: mp+149207@code.launchpad.net |
Commit message
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
+ BranchLocationM
To post a comment you must log in.
Revision history for this message
Piotr Piastucki (piastucki) wrote : | # |
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
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-02-02 06:40:31 +0000 |
3 | +++ .bzrignore 2013-02-19 07:30:34 +0000 |
4 | @@ -7,15 +7,8 @@ |
5 | org.eclipse.pde.core.prefs |
6 | .DS_Store |
7 | *.jar |
8 | -org.vcs.bazaar.eclipse.core.tests/bin |
9 | org.vcs.bazaar.eclipse.client/plugins/* |
10 | -org.apache.commons.logging/target |
11 | -org.kxml2/target |
12 | -org.vcs.bazaar.eclipse.client/target |
13 | -org.vcs.bazaar.eclipse.core/target |
14 | -org.vcs.bazaar.eclipse.core.tests/target |
15 | -org.vcs.bazaar.eclipse.feature/target |
16 | -org.vcs.bazaar.eclipse.site/target |
17 | -org.vcs.bazaar.eclipse.tests-feature/target |
18 | -org.vcs.bazaar.eclipse.ui/target |
19 | -redstone.xmlrpc/target |
20 | +**/target |
21 | +org.vcs.bazaar.eclipse.site/features |
22 | +org.vcs.bazaar.eclipse.site/plugins |
23 | +org.vcs.bazaar.eclipse.site/logs.zip |
24 | |
25 | === modified file 'HowToCompileAndRun.txt' |
26 | --- HowToCompileAndRun.txt 2011-07-19 05:36:44 +0000 |
27 | +++ HowToCompileAndRun.txt 2013-02-19 07:30:34 +0000 |
28 | @@ -32,4 +32,44 @@ |
29 | |
30 | ''Replace Run with Debug for debug mode'' |
31 | |
32 | - |
33 | +4) Creating Plugin import site |
34 | + 4.1) Open the org.vcs.bazaar.eclipse.site project |
35 | + |
36 | + 4.2) Run Build All - this creates some files and directories |
37 | + |
38 | + 4.3) Upload created features, plugins, and site.xml |
39 | + |
40 | + |
41 | +5) Update the version |
42 | + 5.1) Open org.vcs.bazaar.eclipse.core plugin overview |
43 | + Update version and save |
44 | + This modifies: org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF |
45 | + |
46 | + 5.2) Open org.vcs.bazaar.eclipse.core.tests plugin overview |
47 | + Update dependencies for org.vcs.bazaar.eclipse.core |
48 | + Update version and save |
49 | + This modifies: org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF |
50 | + |
51 | + 5.3) Open org.vcs.bazaar.eclipse.core.ui plugin overview |
52 | + Update dependencies for org.vcs.bazaar.eclipse.core |
53 | + Update version and save |
54 | + This modifies: org.vcs.bazaar.eclipse.core.ui/META-INF/MANIFEST.MF |
55 | + |
56 | + 5.4) Open org.vcs.bazaar.eclipse.feature plugin overview |
57 | + Update version and save |
58 | + This modifies: org.vcs.bazaar.eclipse.feature/feature.xml |
59 | + |
60 | + 5.5) Open org.vcs.bazaar.eclipse.tests-feature plugin overview |
61 | + Update version and save |
62 | + This modifies: org.vcs.bazaar.eclipse.tests-feature/feature.xml |
63 | + |
64 | + 5.6) Open org.vcs.bazaar.eclipse.site Site Map |
65 | + Add a feature for the new version (Synchronize didn't work for me) |
66 | + Remove the feature for the old version |
67 | + This modifies: org.vcs.bazaar.eclipse.site/site.xml |
68 | + |
69 | + |
70 | + 5.7) Update the version in each of the pom.xml |
71 | + find . -name pom.xml | xargs sed -i 's/1.1.1-SNAPSHOT/1.2.0-SNAPSHOT/' |
72 | + This modifies all of the pom.xml -- check they are correct. |
73 | + |
74 | |
75 | === modified file 'org.apache.commons.logging/pom.xml' |
76 | --- org.apache.commons.logging/pom.xml 2011-03-22 15:05:45 +0000 |
77 | +++ org.apache.commons.logging/pom.xml 2013-02-19 07:30:34 +0000 |
78 | @@ -4,7 +4,7 @@ |
79 | <parent> |
80 | <groupId>org.vcs.bazaar.eclipse</groupId> |
81 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
82 | - <version>1.1.1-SNAPSHOT</version> |
83 | + <version>1.2.0-SNAPSHOT</version> |
84 | <relativePath>../pom.xml</relativePath> |
85 | </parent> |
86 | <groupId>org.apache.commons.logging</groupId> |
87 | |
88 | === modified file 'org.kxml2/pom.xml' |
89 | --- org.kxml2/pom.xml 2011-03-22 15:05:45 +0000 |
90 | +++ org.kxml2/pom.xml 2013-02-19 07:30:34 +0000 |
91 | @@ -4,7 +4,7 @@ |
92 | <parent> |
93 | <groupId>org.vcs.bazaar.eclipse</groupId> |
94 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
95 | - <version>1.1.1-SNAPSHOT</version> |
96 | + <version>1.2.0-SNAPSHOT</version> |
97 | <relativePath>../pom.xml</relativePath> |
98 | </parent> |
99 | <groupId>org.kxml2</groupId> |
100 | |
101 | === modified file 'org.vcs.bazaar.eclipse.client/pom.xml' |
102 | --- org.vcs.bazaar.eclipse.client/pom.xml 2011-03-22 15:05:45 +0000 |
103 | +++ org.vcs.bazaar.eclipse.client/pom.xml 2013-02-19 07:30:34 +0000 |
104 | @@ -4,7 +4,7 @@ |
105 | <parent> |
106 | <groupId>org.vcs.bazaar.eclipse</groupId> |
107 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
108 | - <version>1.1.1-SNAPSHOT</version> |
109 | + <version>1.2.0-SNAPSHOT</version> |
110 | <relativePath>../pom.xml</relativePath> |
111 | </parent> |
112 | <groupId>org.vcs.bazaar.eclipse.client</groupId> |
113 | |
114 | === modified file 'org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF' |
115 | --- org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF 2011-07-30 22:37:22 +0000 |
116 | +++ org.vcs.bazaar.eclipse.core.tests/META-INF/MANIFEST.MF 2013-02-19 07:30:34 +0000 |
117 | @@ -2,7 +2,7 @@ |
118 | Bundle-ManifestVersion: 2 |
119 | Bundle-Name: %plugin_name |
120 | Bundle-SymbolicName: org.vcs.bazaar.eclipse.core.test;singleton:=true |
121 | -Bundle-Version: 1.1.1.qualifier |
122 | +Bundle-Version: 1.2.0.idereal-3 |
123 | Bundle-Vendor: %provider_name |
124 | Bundle-Localization: plugin |
125 | Require-Bundle: org.eclipse.core.runtime, |
126 | @@ -10,7 +10,7 @@ |
127 | org.eclipse.core.resources, |
128 | org.eclipse.core.filesystem, |
129 | org.vcs.bazaar.eclipse.client;bundle-version="0.5.3", |
130 | - org.vcs.bazaar.eclipse.core;bundle-version="1.1.1", |
131 | + org.vcs.bazaar.eclipse.core;bundle-version="1.2.0", |
132 | org.junit4 |
133 | Bundle-ActivationPolicy: lazy |
134 | Bundle-ClassPath: ., |
135 | |
136 | === modified file 'org.vcs.bazaar.eclipse.core.tests/pom.xml' |
137 | --- org.vcs.bazaar.eclipse.core.tests/pom.xml 2011-07-19 05:32:49 +0000 |
138 | +++ org.vcs.bazaar.eclipse.core.tests/pom.xml 2013-02-19 07:30:34 +0000 |
139 | @@ -4,7 +4,7 @@ |
140 | <parent> |
141 | <groupId>org.vcs.bazaar.eclipse</groupId> |
142 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
143 | - <version>1.1.1-SNAPSHOT</version> |
144 | + <version>1.2.0-SNAPSHOT</version> |
145 | <relativePath>../pom.xml</relativePath> |
146 | </parent> |
147 | <groupId>org.vcs.bazaar.eclipse.core.test</groupId> |
148 | @@ -38,7 +38,7 @@ |
149 | <artifactItem> |
150 | <groupId>org.vcs.bazaar.client</groupId> |
151 | <artifactId>bzr-java-lib</artifactId> |
152 | - <classifier>tests</classifier> |
153 | + <!-- <classifier>tests</classifier> --> |
154 | <type>jar</type> |
155 | <overWrite>false</overWrite> |
156 | </artifactItem> |
157 | |
158 | === modified file 'org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/repository/BranchFactoryTest.java' |
159 | --- org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/repository/BranchFactoryTest.java 2009-11-18 08:48:22 +0000 |
160 | +++ org.vcs.bazaar.eclipse.core.tests/src/org/vcs/bazaar/eclipse/core/repository/BranchFactoryTest.java 2013-02-19 07:30:34 +0000 |
161 | @@ -43,7 +43,7 @@ |
162 | */ |
163 | @Test |
164 | public void testFindOrCreateForURI() { |
165 | - IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(theFile.toURI()); |
166 | + IBzrBranch branch = BranchFactory.findOrCreateFor(theFile.toURI()); |
167 | assertNotNull(branch); |
168 | assertEquals(theFile.toURI(), branch.getLocation()); |
169 | } |
170 | @@ -54,7 +54,7 @@ |
171 | */ |
172 | @Test |
173 | public void testFindOrCreateForString() throws URISyntaxException { |
174 | - IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(theFile.getAbsolutePath()); |
175 | + IBzrBranch branch = BranchFactory.findOrCreateFor(theFile.getAbsolutePath()); |
176 | assertNotNull(branch); |
177 | assertEquals(theFile.getAbsolutePath().replace(" ", "%20"), branch.getBranchLocation().toString()); |
178 | } |
179 | |
180 | === modified file 'org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF' |
181 | --- org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF 2011-07-30 22:37:22 +0000 |
182 | +++ org.vcs.bazaar.eclipse.core/META-INF/MANIFEST.MF 2013-02-19 07:30:34 +0000 |
183 | @@ -2,7 +2,7 @@ |
184 | Bundle-ManifestVersion: 2 |
185 | Bundle-Name: %plugin_name |
186 | Bundle-SymbolicName: org.vcs.bazaar.eclipse.core;singleton:=true |
187 | -Bundle-Version: 1.1.1.qualifier |
188 | +Bundle-Version: 1.2.0.idereal-3 |
189 | Bundle-Activator: org.vcs.bazaar.eclipse.EclipseBazaarCore |
190 | Bundle-Vendor: %provider_name |
191 | Bundle-Localization: plugin |
192 | |
193 | === modified file 'org.vcs.bazaar.eclipse.core/pom.xml' |
194 | --- org.vcs.bazaar.eclipse.core/pom.xml 2011-03-22 15:05:45 +0000 |
195 | +++ org.vcs.bazaar.eclipse.core/pom.xml 2013-02-19 07:30:34 +0000 |
196 | @@ -4,7 +4,7 @@ |
197 | <parent> |
198 | <groupId>org.vcs.bazaar.eclipse</groupId> |
199 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
200 | - <version>1.1.1-SNAPSHOT</version> |
201 | + <version>1.2.0-SNAPSHOT</version> |
202 | <relativePath>../pom.xml</relativePath> |
203 | </parent> |
204 | <groupId>org.vcs.bazaar.eclipse.core</groupId> |
205 | |
206 | === modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/model/IBzrBranch.java' |
207 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/model/IBzrBranch.java 2009-11-18 08:48:22 +0000 |
208 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/model/IBzrBranch.java 2013-02-19 07:30:34 +0000 |
209 | @@ -10,6 +10,8 @@ |
210 | import org.eclipse.core.resources.IProject; |
211 | import org.eclipse.core.runtime.IPath; |
212 | import org.vcs.bazaar.client.core.BranchLocation; |
213 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
214 | +import org.vcs.bazaar.eclipse.internal.core.model.BzrBranchLocator; |
215 | |
216 | /** |
217 | * <p> |
218 | @@ -80,12 +82,21 @@ |
219 | |
220 | /** |
221 | * Returns a branch location object |
222 | + * @deprecated Use getBranchLocator() instead |
223 | * @return |
224 | * BranchLocation |
225 | */ |
226 | public BranchLocation getBranchLocation(); |
227 | |
228 | /** |
229 | + * Get a locator for this branch. |
230 | + * @return |
231 | + * BranchLocation |
232 | + * @throws BazaarException |
233 | + */ |
234 | + public BzrBranchLocator getBranchLocator() throws BazaarException; |
235 | + |
236 | + /** |
237 | * <p> |
238 | * returns if this is a branch binded to a Eclipse Project, which means that a number of operations can be |
239 | * performed on it which would not be possible or advisible on remote or local branches. |
240 | |
241 | === modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchFactory.java' |
242 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchFactory.java 2009-11-18 08:48:22 +0000 |
243 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchFactory.java 2013-02-19 07:30:34 +0000 |
244 | @@ -19,25 +19,19 @@ |
245 | import org.vcs.bazaar.eclipse.internal.core.model.RemoteBranch; |
246 | |
247 | /** |
248 | + * Contributor: Alexander Taler |
249 | + * |
250 | * @author Guillermo Gonzalez |
251 | - * |
252 | */ |
253 | public class BranchFactory { |
254 | |
255 | - private static final BranchFactory instance = new BranchFactory(); |
256 | - |
257 | - private BranchFactory(){} |
258 | - public static BranchFactory getInstance() { |
259 | - return instance; |
260 | - } |
261 | - |
262 | /** |
263 | * @param URI |
264 | * |
265 | * @return IBzrBranch for the given URI (or null if there is no branch) |
266 | * TODO: this method should only return RemoteBranch instances? |
267 | */ |
268 | - public IBzrBranch findOrCreateFor(URI uri) { |
269 | + public static IBzrBranch findOrCreateFor(URI uri) { |
270 | if (uri != null) { |
271 | if(uri.getScheme() == null) { |
272 | // asume it's a raw path |
273 | @@ -63,7 +57,7 @@ |
274 | * as String |
275 | * @return IBzrBranch for the given URI (or null if there is no branch) |
276 | */ |
277 | - public IBzrBranch findOrCreateFor(String uri) { |
278 | + public static IBzrBranch findOrCreateFor(String uri) { |
279 | Assert.isTrue(validateBranch(uri)); |
280 | if (uri != null && uri.startsWith(LP_SCHEME)) { |
281 | return new LpBranch(uri); |
282 | @@ -91,40 +85,32 @@ |
283 | * @return boolean |
284 | */ |
285 | public static boolean validateBranch(String uri) { |
286 | - return URIValidator.validateBranchLocation(uri); |
287 | - } |
288 | - |
289 | - private static class URIValidator { |
290 | - |
291 | - private static boolean validateBranchLocation(String uri) { |
292 | + try { |
293 | + if (uri == null || uri.trim().length() == 0) { |
294 | + return false; |
295 | + } |
296 | + if (uri != null && uri.startsWith(LP_SCHEME)) { |
297 | + return true; |
298 | + } |
299 | + URI locationURI = StringUtil.getAbsoluteURI(uri); |
300 | try { |
301 | - if (uri == null || uri.trim().length() == 0) { |
302 | - return false; |
303 | - } |
304 | - if (uri != null && uri.startsWith(LP_SCHEME)) { |
305 | - return true; |
306 | - } |
307 | - URI locationURI = StringUtil.getAbsoluteURI(uri); |
308 | - try { |
309 | - if(locationURI != null) { |
310 | - // try to create a branch from the URI |
311 | - getInstance().findOrCreateFor(locationURI); |
312 | - } |
313 | - // if a IBzrBranchcan be created, it's ok |
314 | - return true; |
315 | - } catch(Exception e) { |
316 | - return false; |
317 | - } |
318 | - } catch (Exception e) { |
319 | - // this is a malformed uri or a local file |
320 | - // now we try to check if this is a valid folder location |
321 | - File file = new File(uri); |
322 | - if(file.exists()) { |
323 | - return true; |
324 | - } |
325 | + if(locationURI != null) { |
326 | + // try to create a branch from the URI |
327 | + findOrCreateFor(locationURI); |
328 | + } |
329 | + // if a IBzrBranchcan be created, it's ok |
330 | + return true; |
331 | + } catch(Exception e) { |
332 | return false; |
333 | } |
334 | + } catch (Exception e) { |
335 | + // this is a malformed uri or a local file |
336 | + // now we try to check if this is a valid folder location |
337 | + File file = new File(uri); |
338 | + if(file.exists()) { |
339 | + return true; |
340 | + } |
341 | + return false; |
342 | } |
343 | } |
344 | - |
345 | } |
346 | |
347 | === modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchLocationManager.java' |
348 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchLocationManager.java 2009-11-18 08:48:22 +0000 |
349 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/repository/BranchLocationManager.java 2013-02-19 07:30:34 +0000 |
350 | @@ -121,6 +121,7 @@ |
351 | * Add a repository location to the database. |
352 | */ |
353 | public boolean addRepoLocation(IBzrBranch branch) { |
354 | + if (branch == null) return false; |
355 | return branches.add(branch); |
356 | } |
357 | |
358 | |
359 | === modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranch.java' |
360 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranch.java 2009-11-18 08:48:22 +0000 |
361 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranch.java 2013-02-19 07:30:34 +0000 |
362 | @@ -6,6 +6,7 @@ |
363 | import org.vcs.bazaar.client.core.BranchLocation; |
364 | import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
365 | import org.vcs.bazaar.eclipse.core.model.IBzrResource; |
366 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
367 | |
368 | /** |
369 | * @author Guillermo Gonzalez |
370 | @@ -32,6 +33,10 @@ |
371 | return new BranchLocation(getLocation()); |
372 | } |
373 | |
374 | + public BzrBranchLocator getBranchLocator() throws BazaarException { |
375 | + return new BzrBranchLocator(getLocation()); |
376 | + } |
377 | + |
378 | @Override |
379 | public boolean equals(final Object otherRepo) { |
380 | // make sure wrong types |
381 | |
382 | === added file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranchLocator.java' |
383 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranchLocator.java 1970-01-01 00:00:00 +0000 |
384 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/BzrBranchLocator.java 2013-02-19 07:30:34 +0000 |
385 | @@ -0,0 +1,188 @@ |
386 | +/******************************************************************************* |
387 | + * Copyright (c) 2012 Idereal Limited |
388 | + * All rights reserved. This program and the accompanying materials |
389 | + * are made available under the terms of the Eclipse Public License v1.0 |
390 | + * which accompanies this distribution, and is available at |
391 | + * http://www.eclipse.org/legal/epl-v10.html |
392 | + * |
393 | + * Contributors: |
394 | + * Alexander Taler |
395 | + *******************************************************************************/ |
396 | +package org.vcs.bazaar.eclipse.internal.core.model; |
397 | + |
398 | +import java.io.File; |
399 | +import java.net.URI; |
400 | +import java.net.URISyntaxException; |
401 | + |
402 | +import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
403 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
404 | +/** |
405 | + * Like a URL for Bazaar Branches. |
406 | + * |
407 | + * Unfortunately the java.net.URI class isn't appropriate because |
408 | + * LaunchPad locators, lp:, aren't valid URIs, and because Windows |
409 | + * filenames starting with a drive letter don't parse properly. |
410 | + * |
411 | + * This class is a reimplementation of functionality from BranchLocation, |
412 | + * BranchFactory, and StringUtil, because the branch locating code is spread |
413 | + * between those classes, making it hard to understand and hard to fix. (In |
414 | + * fact that code includes latent bugs.) This class should be moved to |
415 | + * bzr-java-lib and replace BranchFactory and BranchLocation. |
416 | + * |
417 | + * @author Alexander Taler |
418 | + */ |
419 | +public class BzrBranchLocator { |
420 | + |
421 | + Scheme scheme; // The Locator scheme |
422 | + URI uri = null; // For schemes that have URIs, this is used. |
423 | + String raw = null; // Otherwise the raw creation string is used. |
424 | + |
425 | + private static class Scheme { |
426 | + Scheme(String i, boolean w) { |
427 | + id = i; |
428 | + writeable = w; |
429 | + } |
430 | + String id; |
431 | + boolean writeable; |
432 | + } |
433 | + private static final Scheme[] SCHEMES = { |
434 | + new Scheme("file", true), |
435 | + new Scheme("bzr+ssh", true), |
436 | + new Scheme("lp", true), |
437 | + new Scheme("sftp", true), |
438 | + new Scheme("ftp", true), |
439 | + new Scheme("rsync", true), |
440 | + new Scheme("http", false), |
441 | + new Scheme("https", false), |
442 | + new Scheme("bzr+http", false), |
443 | + new Scheme("bzr+https", false), |
444 | + new Scheme("https+urllib", false), |
445 | + }; |
446 | + private static Scheme lookupScheme(String schemeId) throws BazaarException { |
447 | + for (Scheme s : SCHEMES) { |
448 | + if (s.id.equals(schemeId)) { |
449 | + return s; |
450 | + } |
451 | + } |
452 | + throw new BazaarException("Unsupported Scheme"); |
453 | + } |
454 | + |
455 | + /** |
456 | + * Create a new Locator object for the given string. |
457 | + * |
458 | + * The string can be a path to the local filesystem, or a URI string which |
459 | + * Bazaar would accept. The windows drive letter prefix [A-Z]: will be |
460 | + * treated as a local file instead of a URL. |
461 | + * |
462 | + * @param raw |
463 | + * @throws BazaarException if the string was not a valid locator |
464 | + */ |
465 | + public BzrBranchLocator(String raw) throws BazaarException { |
466 | + if (raw == null || raw.length() == 0) { |
467 | + throw new BazaarException("Branch Not Specified"); |
468 | + } |
469 | + |
470 | + this.raw = raw; |
471 | + |
472 | + if (raw.startsWith("lp:")) { |
473 | + scheme = lookupScheme("lp"); |
474 | + return; |
475 | + } |
476 | + if (!raw.matches("^[a-zA-Z]:")) { |
477 | + // Try it as a URI |
478 | + try { |
479 | + uri = new URI(raw); |
480 | + if (uri.getScheme() != null) { |
481 | + scheme = lookupScheme(uri.getScheme()); |
482 | + return; |
483 | + } |
484 | + } catch (URISyntaxException e) { |
485 | + // Fallback to file |
486 | + } |
487 | + } |
488 | + initAsFile(raw); |
489 | + } |
490 | + |
491 | + /** |
492 | + * Create a new Locator object for the given URI. |
493 | + * |
494 | + * If the URI has no scheme, or looks like a Windows drive letter scheme |
495 | + * [A-Z]: then it will be treated as a local file reference. |
496 | + * |
497 | + * TODO: Check for the existence of file: URIs on local filesystem |
498 | + * |
499 | + * @param uri |
500 | + * @throws BazaarException if the URI is not appropriate |
501 | + */ |
502 | + public BzrBranchLocator(URI uri) throws BazaarException { |
503 | + this.uri = uri; |
504 | + |
505 | + if (uri == null) { |
506 | + throw new BazaarException("Branch Not Specified"); |
507 | + } |
508 | + |
509 | + String schemeId = uri.getScheme(); |
510 | + // If the URI is relative or looks like a Windows file, fallback to file: |
511 | + if ((schemeId == null) || (schemeId.matches("^[a-zA-Z]$"))) { |
512 | + initAsFile(uri.getPath()); |
513 | + } else { |
514 | + scheme = lookupScheme(schemeId); |
515 | + } |
516 | + } |
517 | + |
518 | + /** |
519 | + * Initialise a new object as a local file reference |
520 | + * @return |
521 | + */ |
522 | + private void initAsFile(String path) throws BazaarException { |
523 | + // Don't modify the object if an error is found |
524 | + |
525 | + // Try and find the file on local filesystem |
526 | + File file = new File(path); |
527 | + File parent = file.getParentFile(); |
528 | + if (!file.exists() && (parent == null || !parent.exists())) { |
529 | + throw new BazaarException("File not found"); |
530 | + } |
531 | + scheme = lookupScheme("file"); |
532 | + raw = path; |
533 | + |
534 | + // Create an appropriate URI for the path |
535 | + path = path.replace(java.io.File.separator, "/"); |
536 | + // Do some URL encoding, java.net.URLEncoder seems to encode the "/" |
537 | + // which isn't what we want. |
538 | + path = path.replace(" ", "%20"); |
539 | + try { |
540 | + uri = new URI("file", null, path, null); |
541 | + } catch (URISyntaxException use) { |
542 | + throw new BazaarException("Internal Exception", use); |
543 | + } |
544 | + } |
545 | + |
546 | + public boolean isWriteable() { |
547 | + return scheme.writeable; |
548 | + } |
549 | + |
550 | + /** |
551 | + * Get a branch object for this location. |
552 | + * @return |
553 | + */ |
554 | + public IBzrBranch getBranch() { |
555 | + if (scheme.id == "file") { |
556 | + return new LocalBranch(uri); |
557 | + } |
558 | + if (scheme.id == "lp") { |
559 | + return new LpBranch(raw); |
560 | + } |
561 | + return new RemoteBranch(uri); |
562 | + } |
563 | + |
564 | + /** |
565 | + * Return a string representation of the locator which can be used to create it again. |
566 | + */ |
567 | + public String toString() { |
568 | + if (scheme.id == "lp" || uri == null) { |
569 | + return raw; |
570 | + } |
571 | + return uri.toString(); |
572 | + } |
573 | +} |
574 | |
575 | === modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/LocalBranch.java' |
576 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/LocalBranch.java 2009-11-18 08:48:22 +0000 |
577 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/LocalBranch.java 2013-02-19 07:30:34 +0000 |
578 | @@ -40,7 +40,7 @@ |
579 | public class LocalBranch extends BzrBranch implements IBzrLocalBranch { |
580 | |
581 | private static final long serialVersionUID = -6363525810607144655L; |
582 | - private final URI location; |
583 | + private final URI location; // May be ignored by subclasses, use getLocation() |
584 | |
585 | |
586 | public LocalBranch(final URI location) { |
587 | @@ -69,7 +69,7 @@ |
588 | |
589 | @Override |
590 | public IPath getPath() { |
591 | - return new Path(location.toString()); |
592 | + return new Path(location.getPath()); |
593 | } |
594 | |
595 | public String getNick() { |
596 | @@ -113,7 +113,7 @@ |
597 | } |
598 | if(info == null || info.getRelatedBranches() == null || info.getRelatedBranches().getParentBranch() == null) |
599 | return null; |
600 | - return BranchFactory.getInstance().findOrCreateFor(info.getRelatedBranches().getParentBranch()); |
601 | + return BranchFactory.findOrCreateFor(info.getRelatedBranches().getParentBranch()); |
602 | } |
603 | |
604 | public IBzrBranch getPushBranch() { |
605 | @@ -124,7 +124,7 @@ |
606 | if(info == null || info.getRelatedBranches() == null) |
607 | return null; |
608 | if(info.getRelatedBranches().getPushBranch() != null && !"".equals(info.getRelatedBranches().getPushBranch().trim())) { |
609 | - return BranchFactory.getInstance().findOrCreateFor(info.getRelatedBranches().getPushBranch()); |
610 | + return BranchFactory.findOrCreateFor(info.getRelatedBranches().getPushBranch()); |
611 | } else { |
612 | return null; |
613 | } |
614 | |
615 | === modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/RemoteBranch.java' |
616 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/RemoteBranch.java 2009-11-18 08:48:22 +0000 |
617 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/internal/core/model/RemoteBranch.java 2013-02-19 07:30:34 +0000 |
618 | @@ -9,6 +9,7 @@ |
619 | import org.eclipse.core.resources.IProject; |
620 | import org.eclipse.core.runtime.IPath; |
621 | import org.vcs.bazaar.client.core.BranchLocation; |
622 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
623 | |
624 | /** |
625 | * <p> |
626 | @@ -72,4 +73,13 @@ |
627 | public BranchLocation getBranchLocation() { |
628 | return location; |
629 | } |
630 | -} |
631 | \ No newline at end of file |
632 | + |
633 | + @Override |
634 | + public BzrBranchLocator getBranchLocator() { |
635 | + try { |
636 | + return new BzrBranchLocator(location.toString()); |
637 | + } catch (BazaarException e) { |
638 | + throw new RuntimeException(e); |
639 | + } |
640 | + } |
641 | +} |
642 | |
643 | === modified file 'org.vcs.bazaar.eclipse.feature/feature.xml' |
644 | --- org.vcs.bazaar.eclipse.feature/feature.xml 2009-09-05 15:17:53 +0000 |
645 | +++ org.vcs.bazaar.eclipse.feature/feature.xml 2013-02-19 07:30:34 +0000 |
646 | @@ -1,8 +1,8 @@ |
647 | <?xml version="1.0" encoding="UTF-8"?> |
648 | <feature |
649 | id="org.vcs.bazaar.eclipse.feature" |
650 | - label="Eclipse plugin for Bazaar" |
651 | - version="1.1.1.qualifier" |
652 | + label="Eclipse plugin for Bazaar VCS" |
653 | + version="1.2.0.idereal-3" |
654 | provider-name="Guillermo Gonzalez" |
655 | plugin="org.vcs.bazaar.eclipse.ui"> |
656 | |
657 | @@ -73,17 +73,19 @@ |
658 | download-size="0" |
659 | install-size="0" |
660 | version="0.0.0"/> |
661 | - |
662 | + |
663 | <plugin |
664 | id="org.apache.commons.logging" |
665 | download-size="0" |
666 | install-size="0" |
667 | version="0.0.0"/> |
668 | + |
669 | <plugin |
670 | id="org.kxml2" |
671 | download-size="0" |
672 | install-size="0" |
673 | version="0.0.0"/> |
674 | + |
675 | <plugin |
676 | id="redstone.xmlrpc" |
677 | download-size="0" |
678 | |
679 | === modified file 'org.vcs.bazaar.eclipse.feature/pom.xml' |
680 | --- org.vcs.bazaar.eclipse.feature/pom.xml 2011-03-22 15:05:45 +0000 |
681 | +++ org.vcs.bazaar.eclipse.feature/pom.xml 2013-02-19 07:30:34 +0000 |
682 | @@ -4,7 +4,7 @@ |
683 | <parent> |
684 | <groupId>org.vcs.bazaar.eclipse</groupId> |
685 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
686 | - <version>1.1.1-SNAPSHOT</version> |
687 | + <version>1.2.0-SNAPSHOT</version> |
688 | <relativePath>../pom.xml</relativePath> |
689 | </parent> |
690 | <groupId>org.vcs.bazaar.eclipse.feature</groupId> |
691 | |
692 | === modified file 'org.vcs.bazaar.eclipse.site/pom.xml' |
693 | --- org.vcs.bazaar.eclipse.site/pom.xml 2011-03-22 15:05:45 +0000 |
694 | +++ org.vcs.bazaar.eclipse.site/pom.xml 2013-02-19 07:30:34 +0000 |
695 | @@ -4,7 +4,7 @@ |
696 | <parent> |
697 | <groupId>org.vcs.bazaar.eclipse</groupId> |
698 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
699 | - <version>1.1.1-SNAPSHOT</version> |
700 | + <version>1.2.0-SNAPSHOT</version> |
701 | <relativePath>../pom.xml</relativePath> |
702 | </parent> |
703 | <groupId>org.vcs.bazaar.eclipse.site</groupId> |
704 | |
705 | === modified file 'org.vcs.bazaar.eclipse.site/site.xml' |
706 | --- org.vcs.bazaar.eclipse.site/site.xml 2011-03-22 15:05:45 +0000 |
707 | +++ org.vcs.bazaar.eclipse.site/site.xml 2013-02-19 07:30:34 +0000 |
708 | @@ -3,15 +3,8 @@ |
709 | <description url="http://verterok.com.ar/bzr-eclipse/update-site/"> |
710 | Update site for the Eclipse plugin for Bazaar |
711 | </description> |
712 | - <feature url="features/org.vcs.bazaar.eclipse.feature_1.1.1.qualifier.jar" id="org.vcs.bazaar.eclipse.feature" version="1.1.1.qualifier"> |
713 | - <category name="bzr-eclipse (dev snapshot)"/> |
714 | + <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"> |
715 | + <category name="Collaboration"/> |
716 | </feature> |
717 | - <!--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"> |
718 | - <category name="bzr-eclipse (dev snapshot)"/> |
719 | - </feature--> |
720 | - <category-def name="bzr-eclipse (dev snapshot)" label="bzr-eclipse (Eclipse-3.3 dev snapshot)"> |
721 | - <description> |
722 | - Here you can find snapshots of the current development trunk. |
723 | - </description> |
724 | - </category-def> |
725 | + <category-def name="Collaboration" label="Collaboration"/> |
726 | </site> |
727 | |
728 | === modified file 'org.vcs.bazaar.eclipse.tests-feature/feature.xml' |
729 | --- org.vcs.bazaar.eclipse.tests-feature/feature.xml 2010-02-02 06:40:31 +0000 |
730 | +++ org.vcs.bazaar.eclipse.tests-feature/feature.xml 2013-02-19 07:30:34 +0000 |
731 | @@ -2,7 +2,7 @@ |
732 | <feature |
733 | id="org.vcs.bazaar.eclipse.tests_feature" |
734 | label="Eclipse Tests Plugin for Bazaar" |
735 | - version="1.1.1.qualifier" |
736 | + version="1.2.0.idereal-3" |
737 | provider-name="Guillermo Gonzalez"> |
738 | |
739 | <description url="https://launchpad.net/bzr-eclipse"> |
740 | |
741 | === modified file 'org.vcs.bazaar.eclipse.tests-feature/pom.xml' |
742 | --- org.vcs.bazaar.eclipse.tests-feature/pom.xml 2011-03-22 15:05:45 +0000 |
743 | +++ org.vcs.bazaar.eclipse.tests-feature/pom.xml 2013-02-19 07:30:34 +0000 |
744 | @@ -9,6 +9,6 @@ |
745 | </parent> |
746 | <groupId>org.vcs.bazaar.eclipse.tests-feature</groupId> |
747 | <artifactId>org.vcs.bazaar.eclipse.tests-feature</artifactId> |
748 | - <version>1.1.1-SNAPSHOT</version> |
749 | + <version>1.2.0-SNAPSHOT</version> |
750 | <packaging>eclipse-test-feature</packaging> |
751 | </project> |
752 | |
753 | === modified file 'org.vcs.bazaar.eclipse.ui/META-INF/MANIFEST.MF' |
754 | --- org.vcs.bazaar.eclipse.ui/META-INF/MANIFEST.MF 2011-07-30 00:28:03 +0000 |
755 | +++ org.vcs.bazaar.eclipse.ui/META-INF/MANIFEST.MF 2013-02-19 07:30:34 +0000 |
756 | @@ -2,11 +2,11 @@ |
757 | Bundle-ManifestVersion: 2 |
758 | Bundle-Name: %plugin_name |
759 | Bundle-SymbolicName: org.vcs.bazaar.eclipse.ui;singleton:=true |
760 | -Bundle-Version: 1.1.1.qualifier |
761 | +Bundle-Version: 1.2.0.idereal-3 |
762 | Bundle-Activator: org.vcs.bazaar.eclipse.ui.EclipseBazaarUI |
763 | Bundle-Vendor: %provider_name |
764 | Bundle-Localization: plugin |
765 | -Require-Bundle: org.vcs.bazaar.eclipse.core;bundle-version="1.1.1";visibility:=reexport, |
766 | +Require-Bundle: org.vcs.bazaar.eclipse.core;bundle-version="1.2.0";visibility:=reexport, |
767 | org.eclipse.ui, |
768 | org.eclipse.core.runtime;bundle-version="3.3.0", |
769 | org.eclipse.core.resources, |
770 | @@ -39,7 +39,7 @@ |
771 | org.vcs.bazaar.eclipse.ui.views, |
772 | org.vcs.bazaar.eclipse.ui.wizards, |
773 | org.vcs.bazaar.eclipse.ui.wizards.configuration, |
774 | - org.vcs.bazaar.eclipse.ui.wizards.project |
775 | + org.vcs.bazaar.eclipse.ui.wizards.createproject |
776 | Bundle-ClassPath: ., |
777 | icons/, |
778 | images/ |
779 | |
780 | === modified file 'org.vcs.bazaar.eclipse.ui/plugin.properties' |
781 | --- org.vcs.bazaar.eclipse.ui/plugin.properties 2009-05-05 16:55:55 +0000 |
782 | +++ org.vcs.bazaar.eclipse.ui/plugin.properties 2013-02-19 07:30:34 +0000 |
783 | @@ -41,6 +41,8 @@ |
784 | #Commit changes into a new revision |
785 | ActionDiff_label=L&atest from branch |
786 | ActionDiff_tooltip=Show unsubmitted changes in the selected resource |
787 | +ActionEditConflicts_label=&Edit Conflicts |
788 | +ActionEditConflicts_tooltip=Open file in conflict editor |
789 | ActionLog_label=&Log... |
790 | ActionLog_tooltip=Show log of a branch, file, or directory |
791 | ActionNick_label=Nick... |
792 | @@ -49,7 +51,7 @@ |
793 | ActionRemove_tooltip=Make a file unversioned. |
794 | ActionIgnore_label=&Ignore... |
795 | ActionIgnore_tooltip=Make a file ignored by Bazaar |
796 | -ActionResolve_label=Resolv&e... |
797 | +ActionResolve_label=Mark Resolv&ed |
798 | ActionResolve_tooltip=Mark a conflict as resolved. |
799 | ActionRevert_label=&Revert |
800 | ActionRevert_tooltip=Revert files to a previous revision |
801 | @@ -134,4 +136,4 @@ |
802 | #others |
803 | quickDiff_label=Latest bazaar revision |
804 | |
805 | -BzrCommandCategory_description=Bazaar |
806 | \ No newline at end of file |
807 | +BzrCommandCategory_description=Bazaar |
808 | |
809 | === modified file 'org.vcs.bazaar.eclipse.ui/plugin.xml' |
810 | --- org.vcs.bazaar.eclipse.ui/plugin.xml 2011-06-02 00:41:16 +0000 |
811 | +++ org.vcs.bazaar.eclipse.ui/plugin.xml 2013-02-19 07:30:34 +0000 |
812 | @@ -96,6 +96,15 @@ |
813 | label="%ActionResolve_label" menubarPath="team.main/group3" |
814 | tooltip="%ActionResolve_tooltip"> |
815 | </action> |
816 | + <action |
817 | + class="org.vcs.bazaar.eclipse.ui.actions.EditConflictsAction" |
818 | + definitionId="org.vcs.bazaar.eclipse.ui.actions.ActionEditConflicts" |
819 | + icon="icons/bzrlogo.png" |
820 | + id="org.vcs.bazaar.eclipse.ui.actions.ActionEditConflicts" |
821 | + label="%ActionEditConflicts_label" |
822 | + menubarPath="team.main/group3" |
823 | + tooltip="%ActionEditConflicts_tooltip"> |
824 | + </action> |
825 | </objectContribution> |
826 | |
827 | <!-- Project Team menu --> |
828 | @@ -371,47 +380,31 @@ |
829 | <extension point="org.eclipse.ui.newWizards"> |
830 | <category id="org.vcs.bazaar.eclipse.ui.wizards.new" |
831 | name="%NewWizard_categoryName" /> |
832 | - <wizard |
833 | - canFinishEarly="false" |
834 | - category="org.vcs.bazaar.eclipse.ui.wizards.new" |
835 | - class="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard" |
836 | - hasPages="true" |
837 | - icon="icons/bzrlogo.png" |
838 | - id="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard" |
839 | - name="%BranchNewWizard_Name" |
840 | - project="true"/> |
841 | - <wizard |
842 | - canFinishEarly="false" |
843 | - category="org.vcs.bazaar.eclipse.ui.wizards.new" |
844 | - class="org.vcs.bazaar.eclipse.ui.wizards.project.CheckoutWizard" |
845 | - hasPages="true" |
846 | - icon="icons/bzrlogo.png" |
847 | - id="org.vcs.bazaar.eclipse.ui.wizards.project.CheckOutWizard" |
848 | - name="%CheckoutNewWizard_Name" |
849 | - project="true"/> |
850 | + <wizard |
851 | + canFinishEarly="false" |
852 | + category="org.vcs.bazaar.eclipse.ui.wizards.new" |
853 | + class="org.vcs.bazaar.eclipse.ui.wizards.createproject.CreateProjectWizard" |
854 | + hasPages="true" |
855 | + icon="icons/bzrlogo.png" |
856 | + id="org.vcs.bazaar.eclipse.ui.wizards.project.CreateProjectWizard" |
857 | + name="Project From Bazaar" |
858 | + project="true"> |
859 | + </wizard> |
860 | </extension> |
861 | |
862 | <extension point="org.eclipse.ui.importWizards"> |
863 | <category id="org.vcs.bazaar.eclipse.ui.wizards.new" |
864 | name="%NewWizard_categoryName" /> |
865 | - <wizard |
866 | - canFinishEarly="false" |
867 | - category="org.vcs.bazaar.eclipse.ui.wizards.new" |
868 | - class="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard" |
869 | - hasPages="true" |
870 | - icon="icons/bzrlogo.png" |
871 | - id="org.vcs.bazaar.eclipse.ui.wizards.project.BranchWizard" |
872 | - name="%BranchNewWizard_Name" |
873 | - project="true"/> |
874 | - <wizard |
875 | - canFinishEarly="false" |
876 | - category="org.vcs.bazaar.eclipse.ui.wizards.new" |
877 | - class="org.vcs.bazaar.eclipse.ui.wizards.project.CheckoutWizard" |
878 | - hasPages="true" |
879 | - icon="icons/bzrlogo.png" |
880 | - id="org.vcs.bazaar.eclipse.ui.wizards.project.CheckOutWizard" |
881 | - name="%CheckoutNewWizard_Name" |
882 | - project="true"/> |
883 | + <wizard |
884 | + canFinishEarly="false" |
885 | + category="org.vcs.bazaar.eclipse.ui.wizards.new" |
886 | + class="org.vcs.bazaar.eclipse.ui.wizards.createproject.CreateProjectWizard" |
887 | + hasPages="true" |
888 | + icon="icons/bzrlogo.png" |
889 | + id="org.vcs.bazaar.eclipse.ui.wizards.project.CreateProjectWizard" |
890 | + name="Project From Bazaar" |
891 | + project="true"> |
892 | + </wizard> |
893 | </extension> |
894 | <extension point="org.eclipse.ui.console.consoleFactories"> |
895 | <consoleFactory |
896 | |
897 | === modified file 'org.vcs.bazaar.eclipse.ui/pom.xml' |
898 | --- org.vcs.bazaar.eclipse.ui/pom.xml 2011-03-22 15:05:45 +0000 |
899 | +++ org.vcs.bazaar.eclipse.ui/pom.xml 2013-02-19 07:30:34 +0000 |
900 | @@ -4,7 +4,7 @@ |
901 | <parent> |
902 | <groupId>org.vcs.bazaar.eclipse</groupId> |
903 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
904 | - <version>1.1.1-SNAPSHOT</version> |
905 | + <version>1.2.0-SNAPSHOT</version> |
906 | <relativePath>../pom.xml</relativePath> |
907 | </parent> |
908 | <groupId>org.vcs.bazaar.eclipse.ui</groupId> |
909 | |
910 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java' |
911 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java 2009-11-18 08:48:22 +0000 |
912 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java 2013-02-19 07:30:34 +0000 |
913 | @@ -60,6 +60,7 @@ |
914 | */ |
915 | public EclipseBazaarUI() { |
916 | plugin = this; |
917 | + console = new BzrOutputConsole(); |
918 | } |
919 | |
920 | /** |
921 | @@ -237,6 +238,10 @@ |
922 | getDefault().getLog().log(ex.getStatus()); |
923 | } |
924 | |
925 | + public static void log(Throwable t) { |
926 | + log(t.getMessage(), t); |
927 | + } |
928 | + |
929 | public static boolean isTracing(final String optionId) { |
930 | final String option = getPluginId() + "/trace/" + optionId; //$NON-NLS-1$ |
931 | final String value = Platform.getDebugOption(option); |
932 | @@ -266,9 +271,6 @@ |
933 | } |
934 | |
935 | public synchronized BzrOutputConsole getConsole() { |
936 | - if(console == null){ |
937 | - console = new BzrOutputConsole(); |
938 | - } |
939 | return console; |
940 | } |
941 | |
942 | |
943 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BindAction.java' |
944 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BindAction.java 2009-11-18 08:48:22 +0000 |
945 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BindAction.java 2013-02-19 07:30:34 +0000 |
946 | @@ -58,7 +58,7 @@ |
947 | LocationInputDialog dialog = LocationInputDialog.remoteBindLocationDialog(getShell(), locations, dialogInfo); |
948 | dialog.setBlockOnOpen(true); |
949 | if (dialog.open() == LocationInputDialog.OK) { |
950 | - return BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation()); |
951 | + return BranchFactory.findOrCreateFor(dialogInfo.getLocation()); |
952 | } |
953 | return null; |
954 | } |
955 | |
956 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BranchAction.java' |
957 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BranchAction.java 2009-11-18 08:48:22 +0000 |
958 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/BranchAction.java 2013-02-19 07:30:34 +0000 |
959 | @@ -3,11 +3,8 @@ |
960 | */ |
961 | package org.vcs.bazaar.eclipse.ui.actions; |
962 | |
963 | -import org.eclipse.core.resources.IProject; |
964 | import org.eclipse.jface.action.IAction; |
965 | -import org.vcs.bazaar.eclipse.BzrWorkspaceRoot; |
966 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
967 | -import org.vcs.bazaar.eclipse.ui.wizards.project.BranchFromProjectWizard; |
968 | +import org.vcs.bazaar.eclipse.ui.wizards.createproject.CreateProjectWizard; |
969 | |
970 | /** |
971 | * @author Guillermo Gonzalez |
972 | @@ -23,12 +20,7 @@ |
973 | */ |
974 | @Override |
975 | public void execute(IAction action) { |
976 | - IProject[] projects = getSelectedProjects(); |
977 | - if(projects != null && projects.length == 1) { |
978 | - IProject project = projects[0]; |
979 | - IBzrBranch branch = BzrWorkspaceRoot.getBzrWorkspaceRootFor(project).getBranch(); |
980 | - BranchFromProjectWizard.open(getShell(), branch); |
981 | - } |
982 | + new CreateProjectWizard(getSelection()).show(getShell()); |
983 | } |
984 | |
985 | @Override |
986 | |
987 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/EditConflictsAction.java' |
988 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/EditConflictsAction.java 1970-01-01 00:00:00 +0000 |
989 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/EditConflictsAction.java 2013-02-19 07:30:34 +0000 |
990 | @@ -0,0 +1,78 @@ |
991 | +/******************************************************************************* |
992 | + * Copyright (c) 2012 Idereal Limited |
993 | + * All rights reserved. This program and the accompanying materials |
994 | + * are made available under the terms of the Eclipse Public License v1.0 |
995 | + * which accompanies this distribution, and is available at |
996 | + * http://www.eclipse.org/legal/epl-v10.html |
997 | + * |
998 | + * Contributors: |
999 | + * Alexander Taler |
1000 | + *******************************************************************************/ |
1001 | +package org.vcs.bazaar.eclipse.ui.actions; |
1002 | + |
1003 | +import org.eclipse.compare.CompareConfiguration; |
1004 | +import org.eclipse.compare.CompareUI; |
1005 | +import org.eclipse.core.resources.IContainer; |
1006 | +import org.eclipse.core.resources.IFile; |
1007 | +import org.eclipse.jface.action.IAction; |
1008 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
1009 | +import org.vcs.bazaar.eclipse.ui.compare.ConflictingFileEditorInput; |
1010 | + |
1011 | +/** |
1012 | + * @author Alexander Taler |
1013 | + */ |
1014 | +public class EditConflictsAction extends WorkbenchAction { |
1015 | + |
1016 | + @Override |
1017 | + public void execute(IAction action) throws BazaarException { |
1018 | + |
1019 | + IFile local = (IFile) getSelectedResources()[0]; |
1020 | + |
1021 | + // Find the base, other and this files |
1022 | + IContainer parent = local.getParent(); |
1023 | + IFile MrgBase = (IFile) parent.findMember(local.getName() + ".BASE"); |
1024 | + IFile MrgOthr = (IFile) parent.findMember(local.getName() + ".OTHER"); |
1025 | + IFile MrgThis = (IFile) parent.findMember(local.getName() + ".THIS"); |
1026 | + |
1027 | + CompareConfiguration cc = new CompareConfiguration(); |
1028 | + ConflictingFileEditorInput compare = |
1029 | + new ConflictingFileEditorInput(cc, local, local, MrgOthr, MrgBase); |
1030 | + CompareUI.openCompareEditor(compare); |
1031 | + } |
1032 | + |
1033 | + @Override |
1034 | + protected boolean isEnabledForUnmanagedResources() { |
1035 | + return false; |
1036 | + } |
1037 | + |
1038 | + @Override |
1039 | + protected boolean isEnabledForManagedResources() { |
1040 | + return true; |
1041 | + } |
1042 | + |
1043 | + @Override |
1044 | + protected boolean isEnabledForAddedResources() { |
1045 | + return false; |
1046 | + } |
1047 | + |
1048 | + @Override |
1049 | + protected boolean isEnabledForMultipleResources() { |
1050 | + return false; |
1051 | + } |
1052 | + |
1053 | + @Override |
1054 | + protected boolean isEnabledForConflictedResources() { |
1055 | + return true; |
1056 | + } |
1057 | + |
1058 | + @Override |
1059 | + protected boolean isEnabledForUnmodifiedResources() { |
1060 | + return false; |
1061 | + } |
1062 | + |
1063 | + @Override |
1064 | + protected boolean isEnabledForModifiedResources() { |
1065 | + return false; |
1066 | + } |
1067 | + |
1068 | +} |
1069 | |
1070 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MergeAction.java' |
1071 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MergeAction.java 2009-11-18 08:48:22 +0000 |
1072 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MergeAction.java 2013-02-19 07:30:34 +0000 |
1073 | @@ -58,7 +58,7 @@ |
1074 | MergeDialog dialog = new MergeDialog(getShell(), locations, dialogInfo); |
1075 | dialog.setBlockOnOpen(true); |
1076 | if (dialog.open() == MergeDialog.OK) { |
1077 | - return BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation()); |
1078 | + return BranchFactory.findOrCreateFor(dialogInfo.getLocation()); |
1079 | } |
1080 | return null; |
1081 | } |
1082 | |
1083 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MissingAction.java' |
1084 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MissingAction.java 2009-11-18 08:48:22 +0000 |
1085 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/MissingAction.java 2013-02-19 07:30:34 +0000 |
1086 | @@ -123,7 +123,7 @@ |
1087 | if("".equals(dialogInfo.getLocation()) && parent != null) { |
1088 | return parent; |
1089 | } else { |
1090 | - return BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation()); |
1091 | + return BranchFactory.findOrCreateFor(dialogInfo.getLocation()); |
1092 | } |
1093 | } |
1094 | return null; |
1095 | |
1096 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PullAction.java' |
1097 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PullAction.java 2009-11-18 08:48:22 +0000 |
1098 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PullAction.java 2013-02-19 07:30:34 +0000 |
1099 | @@ -36,7 +36,7 @@ |
1100 | final IProject[] projects = getEnclosingProjectsForSelectedResources(); |
1101 | final LocationDialogInfo dialogInfo = getRemoteLocation(projects[0]); |
1102 | if (dialogInfo != null && dialogInfo.getLocation() != null && !"".equals(dialogInfo.getLocation().trim())) { |
1103 | - final IBzrBranch location = BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation()); |
1104 | + final IBzrBranch location = BranchFactory.findOrCreateFor(dialogInfo.getLocation()); |
1105 | run(new WorkspaceModifyOperation() { |
1106 | @Override |
1107 | public void execute(IProgressMonitor monitor) throws InvocationTargetException { |
1108 | |
1109 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PushAction.java' |
1110 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PushAction.java 2009-11-18 08:48:22 +0000 |
1111 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/PushAction.java 2013-02-19 07:30:34 +0000 |
1112 | @@ -38,7 +38,7 @@ |
1113 | protected void execute(final IProject aProject) throws InvocationTargetException, InterruptedException { |
1114 | final LocationDialogInfo dialogInfo = getRemoteLocation(aProject); |
1115 | if (dialogInfo != null && dialogInfo.getLocation() != null && !"".equals(dialogInfo.getLocation().trim())) { |
1116 | - IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(dialogInfo.getLocation().trim()); |
1117 | + IBzrBranch branch = BranchFactory.findOrCreateFor(dialogInfo.getLocation().trim()); |
1118 | new PushOperation(getTargetPart(), aProject, branch.getBranchLocation(), dialogInfo.isRemember(), dialogInfo.isUseExistingDir()).run(); |
1119 | } |
1120 | } |
1121 | |
1122 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/SwitchAction.java' |
1123 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/SwitchAction.java 2009-11-18 08:48:22 +0000 |
1124 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/SwitchAction.java 2013-02-19 07:30:34 +0000 |
1125 | @@ -34,7 +34,7 @@ |
1126 | // popup a input dialog to get the remote location |
1127 | String remoteLocation = getRemoteLocation(project, dialogInfo); |
1128 | if (remoteLocation != null) { |
1129 | - final IBzrBranch location = BranchFactory.getInstance().findOrCreateFor(remoteLocation); |
1130 | + final IBzrBranch location = BranchFactory.findOrCreateFor(remoteLocation); |
1131 | run(new IRunnableWithProgress() { |
1132 | public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { |
1133 | try { |
1134 | |
1135 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/UpdateAction.java' |
1136 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/UpdateAction.java 2009-11-18 08:48:22 +0000 |
1137 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/UpdateAction.java 2013-02-19 07:30:34 +0000 |
1138 | @@ -7,6 +7,7 @@ |
1139 | |
1140 | import org.eclipse.core.resources.IProject; |
1141 | import org.eclipse.core.resources.IResource; |
1142 | +import org.eclipse.core.runtime.CoreException; |
1143 | import org.eclipse.core.runtime.IProgressMonitor; |
1144 | import org.eclipse.jface.action.IAction; |
1145 | import org.eclipse.jface.dialogs.MessageDialog; |
1146 | @@ -35,19 +36,44 @@ |
1147 | protected void execute(IAction action) throws BazaarException, InvocationTargetException, InterruptedException { |
1148 | IProject project = getSelectedProjects()[0]; |
1149 | final UpdateCommand cmd = new UpdateCommand(project); |
1150 | - run(new WorkspaceModifyOperation() { |
1151 | - @Override |
1152 | - public void execute(IProgressMonitor monitor) throws InvocationTargetException { |
1153 | - try { |
1154 | - cmd.run(monitor); |
1155 | - } catch (BazaarException e) { |
1156 | - handle(e); |
1157 | - } finally { |
1158 | - monitor.done(); |
1159 | - } |
1160 | - } |
1161 | - }, false /* no cancelable */, PROGRESS_DIALOG); |
1162 | - MessageDialog.openInformation(getShell(), "Update finished", cmd.getOutputMessage()); |
1163 | + String updMsg = null; |
1164 | + try { |
1165 | + run(new WorkspaceModifyOperation() { |
1166 | + @Override |
1167 | + public void execute(IProgressMonitor monitor) |
1168 | + throws InvocationTargetException, BazaarException |
1169 | + { |
1170 | + try { |
1171 | + cmd.run(monitor); |
1172 | + } finally { |
1173 | + monitor.done(); |
1174 | + } |
1175 | + } |
1176 | + }, false /* no cancelable */, PROGRESS_DIALOG); |
1177 | + } catch (InvocationTargetException ite) { |
1178 | + Throwable ie = ite.getCause(); |
1179 | + if (ie instanceof BazaarException) { |
1180 | + if (ie.getCause() != null) { |
1181 | + ie = ie.getCause(); |
1182 | + } |
1183 | + if (ie.getMessage().contains("conflicts encountered")) { |
1184 | + updMsg = "Conflicts occurred during update.\n\n" + ie.getMessage(); |
1185 | + ite = null; |
1186 | + } |
1187 | + } |
1188 | + if (ite != null) { |
1189 | + throw ite; |
1190 | + } |
1191 | + } |
1192 | + try { |
1193 | + project.refreshLocal(IResource.DEPTH_INFINITE, null); |
1194 | + } catch (CoreException e) { |
1195 | + throw new BazaarException(e); |
1196 | + } |
1197 | + if (updMsg == null) { |
1198 | + updMsg = cmd.getOutputMessage(); |
1199 | + } |
1200 | + MessageDialog.openInformation(getShell(), "Update finished", updMsg); |
1201 | } |
1202 | |
1203 | @Override |
1204 | |
1205 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/compare/ConflictingFileEditorInput.java' |
1206 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/compare/ConflictingFileEditorInput.java 1970-01-01 00:00:00 +0000 |
1207 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/compare/ConflictingFileEditorInput.java 2013-02-19 07:30:34 +0000 |
1208 | @@ -0,0 +1,165 @@ |
1209 | +/******************************************************************************* |
1210 | + * Copyright (c) 2005-2008 Polarion Software. |
1211 | + * Copyright (c) 2012 Idereal Limited |
1212 | + * All rights reserved. This program and the accompanying materials |
1213 | + * are made available under the terms of the Eclipse Public License v1.0 |
1214 | + * which accompanies this distribution, and is available at |
1215 | + * http://www.eclipse.org/legal/epl-v10.html |
1216 | + * |
1217 | + * Contributors: |
1218 | + * Alexander Gurov - Initial API and implementation |
1219 | + * Alexander Taler - Copied from Subversive project to bzr-eclipse |
1220 | + *******************************************************************************/ |
1221 | + |
1222 | +package org.vcs.bazaar.eclipse.ui.compare; |
1223 | + |
1224 | +import java.io.ByteArrayOutputStream; |
1225 | +import java.io.InputStream; |
1226 | +import java.lang.reflect.InvocationTargetException; |
1227 | + |
1228 | +import org.eclipse.compare.CompareConfiguration; |
1229 | +import org.eclipse.compare.CompareEditorInput; |
1230 | +import org.eclipse.compare.CompareUI; |
1231 | +import org.eclipse.compare.ITypedElement; |
1232 | +import org.eclipse.compare.internal.BufferedResourceNode; |
1233 | +import org.eclipse.compare.structuremergeviewer.Differencer; |
1234 | +import org.eclipse.core.resources.IFile; |
1235 | +import org.eclipse.core.resources.IResource; |
1236 | +import org.eclipse.core.runtime.CoreException; |
1237 | +import org.eclipse.core.runtime.IProgressMonitor; |
1238 | +import org.eclipse.swt.graphics.Image; |
1239 | + |
1240 | +/** |
1241 | + * Conflicting files merger editor input implementation |
1242 | + * |
1243 | + * @author Alexander Gurov |
1244 | + */ |
1245 | +public class ConflictingFileEditorInput extends CompareEditorInput { |
1246 | + protected IFile target; |
1247 | + protected IFile left; |
1248 | + protected IFile right; |
1249 | + protected IFile ancestor; |
1250 | + |
1251 | + protected MergeElement targetElement; |
1252 | + |
1253 | + public ConflictingFileEditorInput(CompareConfiguration configuration, |
1254 | + IFile target, |
1255 | + IFile left, |
1256 | + IFile right, |
1257 | + IFile ancestor) |
1258 | + { |
1259 | + super(configuration); |
1260 | + this.target = target; |
1261 | + this.left = left; |
1262 | + this.right = right; |
1263 | + this.ancestor = ancestor; |
1264 | + } |
1265 | + |
1266 | + protected Object prepareInput(IProgressMonitor monitor) |
1267 | + throws InvocationTargetException, InterruptedException |
1268 | + { |
1269 | + CompareConfiguration cc = this.getCompareConfiguration(); |
1270 | + Image img = CompareUI.getImage(this.target); |
1271 | + cc.setLeftImage(img); |
1272 | + cc.setRightImage(img); |
1273 | + cc.setAncestorImage(img); |
1274 | + cc.setLeftLabel(this.target.getName() + " Local Revision"); //$NON-NLS-1$ |
1275 | + cc.setLeftEditable(true); |
1276 | + cc.setRightLabel(this.target.getName() + " Incoming Revision"); //$NON-NLS-1$ |
1277 | + cc.setRightEditable(false); |
1278 | + cc.setAncestorLabel(this.target.getName() + " Common Base"); //$NON-NLS-1$ |
1279 | + |
1280 | + this.setTitle(this.target.getName() + " Conflicts"); //$NON-NLS-1$ |
1281 | + |
1282 | + InputStream stream = null; |
1283 | + try { |
1284 | + stream = this.left.getContents(); |
1285 | + byte[] buf = new byte[2048]; |
1286 | + int len = 0; |
1287 | + ByteArrayOutputStream output = new ByteArrayOutputStream(); |
1288 | + while ((len = stream.read(buf)) > 0) { |
1289 | + output.write(buf, 0, len); |
1290 | + } |
1291 | + this.targetElement = new MergeElement(this.target, output.toByteArray(), true); |
1292 | + } catch (RuntimeException e) { |
1293 | + throw e; |
1294 | + } catch (Exception e) { |
1295 | + throw new InvocationTargetException(e); |
1296 | + } finally { |
1297 | + if (stream != null) { |
1298 | + try { |
1299 | + stream.close(); |
1300 | + } catch (Exception ex) { |
1301 | + } |
1302 | + } |
1303 | + } |
1304 | + |
1305 | + try { |
1306 | + MergeElement rightRef = new MergeElement(this.right); |
1307 | + rightRef.setCharsetReference(this.targetElement); |
1308 | + MergeElement ancestorRef = new MergeElement(this.ancestor); |
1309 | + ancestorRef.setCharsetReference(this.targetElement); |
1310 | + return new Differencer().findDifferences(true, monitor, null, ancestorRef, |
1311 | + this.targetElement, rightRef); |
1312 | + } finally { |
1313 | + monitor.done(); |
1314 | + } |
1315 | + } |
1316 | + |
1317 | + public Object getAdapter(Class adapter) { |
1318 | + if (IFile.class.equals(adapter)) { |
1319 | + // disallow auto-flush of editor content |
1320 | + return this.target; |
1321 | + } |
1322 | + return super.getAdapter(adapter); |
1323 | + } |
1324 | + |
1325 | + public void saveChanges(IProgressMonitor pm) throws CoreException { |
1326 | + // flush editor content... |
1327 | + super.saveChanges(pm); |
1328 | + // ...and save it |
1329 | + this.targetElement.commit(pm); |
1330 | + |
1331 | + this.setDirty(false); |
1332 | + } |
1333 | + |
1334 | + protected class MergeElement extends BufferedResourceNode { |
1335 | + protected boolean editable; |
1336 | + protected BufferedResourceNode charsetReference; |
1337 | + |
1338 | + public BufferedResourceNode getCharsetReference() { |
1339 | + return this.charsetReference; |
1340 | + } |
1341 | + |
1342 | + public void setCharsetReference(BufferedResourceNode charsetReference) { |
1343 | + this.charsetReference = charsetReference; |
1344 | + } |
1345 | + |
1346 | + public MergeElement(IResource resource) { |
1347 | + this(resource, null, false); |
1348 | + } |
1349 | + |
1350 | + public MergeElement(IResource resource, byte[] initialContent, boolean editable) { |
1351 | + super(resource); |
1352 | + this.editable = editable; |
1353 | + if (initialContent != null) { |
1354 | + this.setContent(initialContent); |
1355 | + } |
1356 | + } |
1357 | + |
1358 | + public String getCharset() { |
1359 | + return this.charsetReference != null ? this.charsetReference.getCharset() : super |
1360 | + .getCharset(); |
1361 | + } |
1362 | + |
1363 | + public String getType() { |
1364 | + String extension = ConflictingFileEditorInput.this.target.getFileExtension(); |
1365 | + return extension == null ? ITypedElement.UNKNOWN_TYPE : extension; |
1366 | + } |
1367 | + |
1368 | + public boolean isEditable() { |
1369 | + return this.editable; |
1370 | + } |
1371 | + } |
1372 | + |
1373 | +} |
1374 | |
1375 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/MergeDialog.java' |
1376 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/MergeDialog.java 2009-11-18 08:48:22 +0000 |
1377 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/MergeDialog.java 2013-02-19 07:30:34 +0000 |
1378 | @@ -101,7 +101,7 @@ |
1379 | if(url == null || "".equals(url.trim())) { |
1380 | return; |
1381 | } |
1382 | - IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(url); |
1383 | + IBzrBranch branch = BranchFactory.findOrCreateFor(url); |
1384 | if(branch != null) { |
1385 | ShowLogDialog dialog = new ShowLogDialog(getShell(), branch); |
1386 | if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) { |
1387 | |
1388 | === modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/SendDialog.java' |
1389 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/SendDialog.java 2009-11-18 08:48:22 +0000 |
1390 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/SendDialog.java 2013-02-19 07:30:34 +0000 |
1391 | @@ -268,7 +268,7 @@ |
1392 | if(url == null || "".equals(url.trim())) { |
1393 | return; |
1394 | } |
1395 | - IBzrBranch branch = BranchFactory.getInstance().findOrCreateFor(url); |
1396 | + IBzrBranch branch = BranchFactory.findOrCreateFor(url); |
1397 | if(branch != null) { |
1398 | ShowLogDialog dialog = new ShowLogDialog(getShell(), branch); |
1399 | if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) { |
1400 | |
1401 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/BranchAsProjectOperation.java' |
1402 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/BranchAsProjectOperation.java 2009-11-18 08:48:22 +0000 |
1403 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/BranchAsProjectOperation.java 1970-01-01 00:00:00 +0000 |
1404 | @@ -1,137 +0,0 @@ |
1405 | -/** |
1406 | - * LICENSE + COPYRIGHT |
1407 | - */ |
1408 | -package org.vcs.bazaar.eclipse.ui.operations; |
1409 | - |
1410 | -import java.lang.reflect.InvocationTargetException; |
1411 | - |
1412 | -import org.eclipse.core.resources.IProject; |
1413 | -import org.eclipse.core.resources.IProjectDescription; |
1414 | -import org.eclipse.core.resources.ResourcesPlugin; |
1415 | -import org.eclipse.core.runtime.CoreException; |
1416 | -import org.eclipse.core.runtime.IProgressMonitor; |
1417 | -import org.eclipse.jface.operation.IRunnableContext; |
1418 | -import org.eclipse.ui.IWorkbenchWindowActionDelegate; |
1419 | -import org.vcs.bazaar.eclipse.core.commands.BranchCommand; |
1420 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
1421 | -import org.vcs.bazaar.eclipse.core.repository.BazaarTeamProviderType; |
1422 | -import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager; |
1423 | -import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
1424 | -import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
1425 | - |
1426 | -/** |
1427 | - * @author Guillermo Gonzalez |
1428 | - * |
1429 | - * TODO: Test me |
1430 | - */ |
1431 | -public class BranchAsProjectOperation extends BzrOperation { |
1432 | - private final IBzrBranch fromLocation; |
1433 | - private final IProject project; |
1434 | - private final String revno; |
1435 | - private final IProjectDescription projectDescription; |
1436 | - |
1437 | - /** |
1438 | - * |
1439 | - * @param fromLocation The parent of the project |
1440 | - * @param project |
1441 | - * @param revno |
1442 | - */ |
1443 | - public BranchAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, String revno) { |
1444 | - this(context, fromLocation, project, null, revno); |
1445 | - } |
1446 | - |
1447 | - public BranchAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProjectDescription description, String revno) { |
1448 | - this(context, fromLocation, null, description, revno); |
1449 | - } |
1450 | - |
1451 | - public BranchAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, IProjectDescription description, String revno) { |
1452 | - super(context); |
1453 | - this.fromLocation = fromLocation; |
1454 | - if(project == null) { |
1455 | - this.project = ResourcesPlugin.getWorkspace().getRoot().getProject(description.getName()); |
1456 | - } else { |
1457 | - this.project = project; |
1458 | - } |
1459 | - this.projectDescription = description; |
1460 | - this.revno = revno!=null&&"".equals(revno.trim())?null:revno; |
1461 | - } |
1462 | - |
1463 | - /** |
1464 | - * The action has been activated. The argument of the method represents the |
1465 | - * 'real' action sitting in the workbench UI. |
1466 | - * |
1467 | - * @see IWorkbenchWindowActionDelegate#run |
1468 | - */ |
1469 | - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { |
1470 | - try { |
1471 | - runCommand(monitor); |
1472 | - if(getProjectDescription() == null) { |
1473 | - getProject().create(monitor); |
1474 | - } else { |
1475 | - getProject().create(getProjectDescription(), monitor); |
1476 | - } |
1477 | - getProject().open(monitor); |
1478 | - // Register the project with Team. This will bring all the files |
1479 | - // that we cloned into the project. |
1480 | - BazaarTeamProviderType.registerProject(getProject()); |
1481 | - if (getFromLocation() != null && !BranchLocationManager.getInstance().getAllBranches().contains(getFromLocation())) { |
1482 | - BranchLocationManager.getInstance().addRepoLocation(getFromLocation()); |
1483 | - } |
1484 | - } catch (BazaarException e) { |
1485 | - EclipseBazaarUI.log(e); |
1486 | - throw new InvocationTargetException(e, e.getMessage()); |
1487 | - } catch (CoreException e) { |
1488 | - EclipseBazaarUI.log(e); |
1489 | - throw new InvocationTargetException(e, e.getMessage()); |
1490 | - } finally { |
1491 | - monitor.done(); |
1492 | - } |
1493 | - } |
1494 | - |
1495 | - /** |
1496 | - * @param monitor |
1497 | - * @throws BazaarException |
1498 | - */ |
1499 | - protected void runCommand(IProgressMonitor monitor) throws BazaarException { |
1500 | - BranchCommand op = null; |
1501 | - if(getProjectDescription() == null) |
1502 | - op = new BranchCommand(getFromLocation(), getProject().getWorkspace().getRoot().getLocation().append(getProject().getName()).toFile().toURI(), getRevno()); |
1503 | - else |
1504 | - op = new BranchCommand(getFromLocation(), getProjectDescription().getLocationURI(), getRevno()); |
1505 | - op.run(monitor); |
1506 | - } |
1507 | - |
1508 | - @Override |
1509 | - protected boolean canRunAsJob() { |
1510 | - return true; |
1511 | - } |
1512 | - |
1513 | - /** |
1514 | - * @return the projectDescription |
1515 | - */ |
1516 | - protected IProjectDescription getProjectDescription() { |
1517 | - return projectDescription; |
1518 | - } |
1519 | - |
1520 | - /** |
1521 | - * @return the fromLocation |
1522 | - */ |
1523 | - protected IBzrBranch getFromLocation() { |
1524 | - return fromLocation; |
1525 | - } |
1526 | - |
1527 | - /** |
1528 | - * @return the project |
1529 | - */ |
1530 | - protected IProject getProject() { |
1531 | - return project; |
1532 | - } |
1533 | - |
1534 | - /** |
1535 | - * @return the revno |
1536 | - */ |
1537 | - protected String getRevno() { |
1538 | - return revno; |
1539 | - } |
1540 | - |
1541 | -} |
1542 | |
1543 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CheckoutAsProjectOperation.java' |
1544 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CheckoutAsProjectOperation.java 2009-11-18 08:48:22 +0000 |
1545 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CheckoutAsProjectOperation.java 1970-01-01 00:00:00 +0000 |
1546 | @@ -1,70 +0,0 @@ |
1547 | -/** |
1548 | - * LICENSE + COPYRIGHT |
1549 | - */ |
1550 | -package org.vcs.bazaar.eclipse.ui.operations; |
1551 | - |
1552 | -import java.util.ArrayList; |
1553 | -import java.util.List; |
1554 | - |
1555 | -import org.eclipse.core.resources.IProject; |
1556 | -import org.eclipse.core.resources.IProjectDescription; |
1557 | -import org.eclipse.core.runtime.IProgressMonitor; |
1558 | -import org.eclipse.jface.operation.IRunnableContext; |
1559 | -import org.vcs.bazaar.client.BazaarRevision; |
1560 | -import org.vcs.bazaar.client.commandline.commands.options.Option; |
1561 | -import org.vcs.bazaar.client.commandline.syntax.ICheckoutOptions; |
1562 | -import org.vcs.bazaar.eclipse.core.commands.CheckoutCommand; |
1563 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
1564 | -import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
1565 | - |
1566 | -/** |
1567 | - * @author Guillermo Gonzalez <guillo.gonzo@gmail.com> |
1568 | - * |
1569 | - */ |
1570 | -public class CheckoutAsProjectOperation extends BranchAsProjectOperation { |
1571 | - |
1572 | - private Option[] options; |
1573 | - |
1574 | - /** |
1575 | - * |
1576 | - * @param fromLocation The parent of the project |
1577 | - * @param description |
1578 | - * @param revno |
1579 | - */ |
1580 | - public CheckoutAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProjectDescription description, String revno, boolean lightweight) { |
1581 | - this(context, fromLocation, null, description, revno, lightweight); |
1582 | - } |
1583 | - |
1584 | - public CheckoutAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, String revno, boolean lightweight) { |
1585 | - this(context, fromLocation, project, null, revno, lightweight); |
1586 | - } |
1587 | - |
1588 | - public CheckoutAsProjectOperation(IRunnableContext context, IBzrBranch fromLocation, IProject project, IProjectDescription description, String revno, boolean lightweight) { |
1589 | - super(context, fromLocation, project, description, revno); |
1590 | - List<Option> options = new ArrayList<Option>(0); |
1591 | - if(lightweight) { |
1592 | - options.add(ICheckoutOptions.LIGHTWEIGHT); |
1593 | - } |
1594 | - if(revno != null && !"".equals(revno.trim())) { |
1595 | - options.add(ICheckoutOptions.REVISION.setArgument(BazaarRevision.getRevision(BazaarRevision.Prefix.REVNO, revno).toString())); |
1596 | - } |
1597 | - this.options = options.toArray(new Option[0]); |
1598 | - } |
1599 | - |
1600 | - @Override |
1601 | - protected void runCommand(IProgressMonitor monitor) throws BazaarException { |
1602 | - CheckoutCommand op = null; |
1603 | - if(getProjectDescription() == null) { |
1604 | - op = new CheckoutCommand(getFromLocation(), getProject().getWorkspace().getRoot().getLocation().append(getProject().getName()).toFile().toURI(), options); |
1605 | - } else { |
1606 | - op = new CheckoutCommand(getFromLocation(), getProjectDescription().getLocationURI(), options); |
1607 | - } |
1608 | - op.run(monitor); |
1609 | - } |
1610 | - |
1611 | - @Override |
1612 | - protected boolean canRunAsJob() { |
1613 | - return true; |
1614 | - } |
1615 | - |
1616 | -} |
1617 | |
1618 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CreateBazaarProjectOperation.java' |
1619 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CreateBazaarProjectOperation.java 1970-01-01 00:00:00 +0000 |
1620 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/operations/CreateBazaarProjectOperation.java 2013-02-19 07:30:34 +0000 |
1621 | @@ -0,0 +1,198 @@ |
1622 | +/******************************************************************************* |
1623 | + * Copyright (c) 2012 Idereal Limited |
1624 | + * All rights reserved. This program and the accompanying materials |
1625 | + * are made available under the terms of the Eclipse Public License v1.0 |
1626 | + * which accompanies this distribution, and is available at |
1627 | + * http://www.eclipse.org/legal/epl-v10.html |
1628 | + * |
1629 | + * Contributors: |
1630 | + * Alexander Taler |
1631 | + *******************************************************************************/ |
1632 | +package org.vcs.bazaar.eclipse.ui.operations; |
1633 | + |
1634 | +import java.io.File; |
1635 | +import java.io.FileFilter; |
1636 | +import java.lang.reflect.InvocationTargetException; |
1637 | +import java.net.URI; |
1638 | +import java.net.URISyntaxException; |
1639 | +import java.util.ArrayList; |
1640 | +import java.util.LinkedList; |
1641 | +import java.util.List; |
1642 | + |
1643 | +import org.eclipse.core.resources.IProject; |
1644 | +import org.eclipse.core.resources.IProjectDescription; |
1645 | +import org.eclipse.core.resources.IWorkspace; |
1646 | +import org.eclipse.core.resources.ResourcesPlugin; |
1647 | +import org.eclipse.core.runtime.CoreException; |
1648 | +import org.eclipse.core.runtime.IPath; |
1649 | +import org.eclipse.core.runtime.IProgressMonitor; |
1650 | +import org.eclipse.core.runtime.Path; |
1651 | +import org.eclipse.jface.operation.IRunnableContext; |
1652 | +import org.eclipse.team.ui.TeamOperation; |
1653 | +import org.vcs.bazaar.client.BazaarRevision; |
1654 | +import org.vcs.bazaar.client.commandline.commands.options.Option; |
1655 | +import org.vcs.bazaar.client.commandline.syntax.ICheckoutOptions; |
1656 | +import org.vcs.bazaar.eclipse.core.commands.BranchCommand; |
1657 | +import org.vcs.bazaar.eclipse.core.commands.CheckoutCommand; |
1658 | +import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
1659 | +import org.vcs.bazaar.eclipse.core.repository.BazaarTeamProviderType; |
1660 | +import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager; |
1661 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
1662 | + |
1663 | +/** |
1664 | + * Operation for creating project(s) from a Bazaar branch. |
1665 | + * |
1666 | + * Influenced by earlier implementation by Guillermo Gonzalez. |
1667 | + * |
1668 | + * @author Alexander Taler alex <@> idereal <.> co <.> nz |
1669 | + */ |
1670 | +public class CreateBazaarProjectOperation extends TeamOperation { |
1671 | + |
1672 | + public static int TYPE_CHECKOUT = 1; |
1673 | + public static int TYPE_LIGHTWEIGHT = 2; |
1674 | + public static int TYPE_BRANCH = 3; |
1675 | + |
1676 | + String projectName; |
1677 | + IBzrBranch remoteBranch; |
1678 | + String projectLocation; |
1679 | + int type; |
1680 | + String revision; |
1681 | + |
1682 | + /** |
1683 | + * |
1684 | + * @param context Found with getContainer() |
1685 | + * @param projectName The project to be created |
1686 | + * @param remoteBranch The branch to get code from |
1687 | + * @param projectLocation Where on disk to check out the project |
1688 | + * @param type The type of operation, one of TYPE_CHECKOUT, TYPE_LIGHTWEIGHT, TYPE_BRANCH |
1689 | + * @param revision Optional revision, null means use tip |
1690 | + */ |
1691 | + public CreateBazaarProjectOperation(IRunnableContext context, |
1692 | + String projectName, |
1693 | + IBzrBranch remoteBranch, |
1694 | + String projectLocation, |
1695 | + int type, |
1696 | + String revision) |
1697 | + { |
1698 | + super(context); |
1699 | + this.projectName = projectName; |
1700 | + this.remoteBranch = remoteBranch; |
1701 | + this.projectLocation = projectLocation; |
1702 | + this.type = type; |
1703 | + this.revision = revision; |
1704 | + } |
1705 | + |
1706 | + public void run(IProgressMonitor monitor) |
1707 | + throws InvocationTargetException, InterruptedException |
1708 | + { |
1709 | + try { |
1710 | + URI toDir = new URI("file", projectLocation, null); |
1711 | + |
1712 | + if (type == TYPE_BRANCH) { |
1713 | + BranchCommand op = new BranchCommand(remoteBranch, toDir, revision); |
1714 | + op.run(monitor); |
1715 | + } else { |
1716 | + List<Option> options = new ArrayList<Option>(0); |
1717 | + if (type == TYPE_LIGHTWEIGHT) { |
1718 | + options.add(ICheckoutOptions.LIGHTWEIGHT); |
1719 | + } |
1720 | + if ((revision != null) && revision.trim().length() > 0) { |
1721 | + String s = BazaarRevision.getRevision(BazaarRevision.Prefix.REVNO, revision).toString(); |
1722 | + options.add(ICheckoutOptions.REVISION.setArgument(s)); |
1723 | + } |
1724 | + CheckoutCommand op = new CheckoutCommand(remoteBranch, toDir, options.toArray(new Option[0])); |
1725 | + op.run(monitor); |
1726 | + } |
1727 | + |
1728 | + // Search the resulting checked out directory for existing Eclipse projects. |
1729 | + List<File> projDirs = findProjects(new File(projectLocation)); |
1730 | + |
1731 | + // If no projects were found, then just create a single project at the root. |
1732 | + if (projDirs.isEmpty()) { |
1733 | + projDirs.add(new File(projectLocation)); |
1734 | + } |
1735 | + |
1736 | + // Go through the list of project directories and add them all |
1737 | + for (File projDir : projDirs) { |
1738 | + createProject(projDir, monitor); |
1739 | + } |
1740 | + } catch (BazaarException e) { |
1741 | + throw new InvocationTargetException(e); |
1742 | + } catch (CoreException e) { |
1743 | + throw new InvocationTargetException(e); |
1744 | + } catch (URISyntaxException e) { |
1745 | + throw new InvocationTargetException(e); |
1746 | + } |
1747 | + } |
1748 | + |
1749 | + /** |
1750 | + * Search the given location for Eclipse projects. |
1751 | + * |
1752 | + * This is done after the location has been fetched from Bazaar. The |
1753 | + * function performs the search recursively, stopping when it finds a |
1754 | + * project file. |
1755 | + * |
1756 | + * @return List of File objects, the directories containing Bazaar projects. |
1757 | + */ |
1758 | + private List<File> findProjects(File location) { |
1759 | + List<File> ps = new LinkedList<File>(); |
1760 | + File dotProj = new File(location, ".project"); |
1761 | + if (dotProj.exists()) { |
1762 | + ps.add(location); |
1763 | + return ps; |
1764 | + } |
1765 | + // Search directories |
1766 | + File[] dirs = location.listFiles(new FileFilter() { |
1767 | + public boolean accept(File pathname) { |
1768 | + return pathname.isDirectory() && !pathname.getName().equals(".bzr"); |
1769 | + } |
1770 | + }); |
1771 | + |
1772 | + for (File dir : dirs) { |
1773 | + ps.addAll(findProjects(dir)); |
1774 | + } |
1775 | + |
1776 | + return ps; |
1777 | + } |
1778 | + |
1779 | + /** |
1780 | + * Create an Eclipse project at the given location. |
1781 | + * |
1782 | + * Eclipse throws an exception if a ProjectDescription is used to create |
1783 | + * a project at a location directly in the workspace root. However, if |
1784 | + * the project location has the same name as the project itself, then |
1785 | + * creating the project without a description will not throw an |
1786 | + * exception. |
1787 | + * |
1788 | + * So, as a special case if the directory is in the workspace root, but |
1789 | + * matches the project name, create is used without a description. |
1790 | + * |
1791 | + * The other error case is not checked for here, in case this |
1792 | + * undocumented Eclipse behaviour changes. |
1793 | + */ |
1794 | + private void createProject(File projDir, IProgressMonitor monitor) throws CoreException { |
1795 | + IWorkspace ws = ResourcesPlugin.getWorkspace(); |
1796 | + IPath projPath = new Path(projDir.toString()); |
1797 | + IPath parentPath = projPath.removeLastSegments(1); |
1798 | + IProject projectHandle = null; |
1799 | + |
1800 | + if (parentPath.equals(ws.getRoot().getLocation()) |
1801 | + && projPath.lastSegment().equals(projectName)) { |
1802 | + |
1803 | + projectHandle = ws.getRoot().getProject(projectName); |
1804 | + projectHandle.create(monitor); |
1805 | + |
1806 | + } else { |
1807 | + |
1808 | + // Derive a new project name based on the directory |
1809 | + String newProjectName = projectName + "-" + projPath.lastSegment(); |
1810 | + projectHandle = ws.getRoot().getProject(newProjectName); |
1811 | + IProjectDescription projDesc = ws.newProjectDescription(newProjectName); |
1812 | + projDesc.setLocation(projPath); |
1813 | + projectHandle.create(projDesc, monitor); |
1814 | + } |
1815 | + projectHandle.open(monitor); |
1816 | + BazaarTeamProviderType.registerProject(projectHandle); |
1817 | + BranchLocationManager.getInstance().addRepoLocation(remoteBranch); |
1818 | + } |
1819 | +} |
1820 | |
1821 | === added directory 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject' |
1822 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectAdvancedPage.java' |
1823 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectAdvancedPage.java 1970-01-01 00:00:00 +0000 |
1824 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectAdvancedPage.java 2013-02-19 07:30:34 +0000 |
1825 | @@ -0,0 +1,69 @@ |
1826 | +/******************************************************************************* |
1827 | + * Copyright (c) 2012 Idereal Limited |
1828 | + * All rights reserved. This program and the accompanying materials |
1829 | + * are made available under the terms of the Eclipse Public License v1.0 |
1830 | + * which accompanies this distribution, and is available at |
1831 | + * http://www.eclipse.org/legal/epl-v10.html |
1832 | + * |
1833 | + * Contributors: |
1834 | + * Alexander Taler |
1835 | + *******************************************************************************/ |
1836 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
1837 | + |
1838 | +import org.eclipse.jface.resource.ImageDescriptor; |
1839 | +import org.eclipse.jface.wizard.WizardPage; |
1840 | +import org.eclipse.swt.SWT; |
1841 | +import org.eclipse.swt.layout.GridLayout; |
1842 | +import org.eclipse.swt.widgets.Composite; |
1843 | +import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
1844 | + |
1845 | +/** |
1846 | + * Advanced options for Bazaar project creation Wizard. |
1847 | + * |
1848 | + * Allows selection of: |
1849 | + * - Detached branch, checkout, or lightweight checkout |
1850 | + * - revision to fetch |
1851 | + * |
1852 | + * @author Alexander Taler alex <@> idereal <.> co <.> nz |
1853 | + */ |
1854 | +public class CreateProjectAdvancedPage extends WizardPage { |
1855 | + |
1856 | + // The parent wizard to act as a reference |
1857 | + public CreateProjectWizard wiz; |
1858 | + |
1859 | + CreateProjectBranchType branchTypeEntry = null; |
1860 | + CreateProjectRevision revision = null; |
1861 | + |
1862 | + public CreateProjectAdvancedPage(String pageName, CreateProjectWizard wiz) { |
1863 | + super(pageName); |
1864 | + this.wiz = wiz; |
1865 | + setTitle("Eclipse Project from Bazaar"); |
1866 | + setDescription("Advanced options for creating project from Bazaar repository"); |
1867 | + ImageDescriptor titleImage = EclipseBazaarUI.getImageDescriptor("icons/bzr-eclipse.jpg"); |
1868 | + setImageDescriptor(titleImage); |
1869 | + } |
1870 | + |
1871 | + public void createControl(Composite parent) { |
1872 | + final Composite topComposite = new Composite(parent, SWT.NONE); |
1873 | + topComposite.setLayout(new GridLayout(1, false)); |
1874 | + |
1875 | + branchTypeEntry = new CreateProjectBranchType(topComposite, this, wiz, 425); |
1876 | + revision = new CreateProjectRevision(topComposite, this, wiz, 425); |
1877 | + |
1878 | + setControl(topComposite); |
1879 | + setPageComplete(true); |
1880 | + } |
1881 | + |
1882 | + @Override |
1883 | + public boolean isPageComplete() { |
1884 | + return true; |
1885 | + } |
1886 | + |
1887 | + public int getBranchType() { |
1888 | + return branchTypeEntry.getBranchType(); |
1889 | + } |
1890 | + |
1891 | + public String getRevision() { |
1892 | + return revision.getValue(); |
1893 | + } |
1894 | +} |
1895 | |
1896 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectBranchType.java' |
1897 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectBranchType.java 1970-01-01 00:00:00 +0000 |
1898 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectBranchType.java 2013-02-19 07:30:34 +0000 |
1899 | @@ -0,0 +1,90 @@ |
1900 | +/******************************************************************************* |
1901 | + * Copyright (c) 2012 Idereal Limited |
1902 | + * All rights reserved. This program and the accompanying materials |
1903 | + * are made available under the terms of the Eclipse Public License v1.0 |
1904 | + * which accompanies this distribution, and is available at |
1905 | + * http://www.eclipse.org/legal/epl-v10.html |
1906 | + * |
1907 | + * Contributors: |
1908 | + * Alexander Taler |
1909 | + *******************************************************************************/ |
1910 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
1911 | + |
1912 | +import org.eclipse.jface.wizard.WizardPage; |
1913 | +import org.eclipse.swt.SWT; |
1914 | +import org.eclipse.swt.layout.GridLayout; |
1915 | +import org.eclipse.swt.widgets.Button; |
1916 | +import org.eclipse.swt.widgets.Composite; |
1917 | +import org.eclipse.swt.widgets.Scrollable; |
1918 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
1919 | +import org.vcs.bazaar.eclipse.ui.operations.CreateBazaarProjectOperation; |
1920 | + |
1921 | +/** |
1922 | + * A specialization of CreateProjectEntry. |
1923 | + * |
1924 | + * Provides a multi selection box to choose the branch type, Branch, Checkout or |
1925 | + * Lightweight Checkout. |
1926 | + * |
1927 | + * @author Alexander Taler |
1928 | + */ |
1929 | +public class CreateProjectBranchType extends CreateProjectEntry { |
1930 | + |
1931 | + private static String labelText = "Branch Type"; |
1932 | + |
1933 | + protected Button coButton; |
1934 | + protected Button lwcoButton; |
1935 | + protected Button brButton; |
1936 | + |
1937 | + public CreateProjectBranchType(Composite parent, |
1938 | + WizardPage page, |
1939 | + CreateProjectWizard wiz, |
1940 | + int width) { |
1941 | + super(parent, page, wiz, labelText, width, ""); |
1942 | + } |
1943 | + |
1944 | + @Override |
1945 | + protected Scrollable createWidget(Composite parent) { |
1946 | + Composite compo = new Composite(parent, SWT.NONE); |
1947 | + compo.setLayout(new GridLayout(1, false)); |
1948 | + |
1949 | + coButton = new Button(compo, SWT.RADIO); |
1950 | + coButton.setText("Checkout"); |
1951 | + coButton.setSelection(true); |
1952 | + |
1953 | + lwcoButton = new Button(compo, SWT.RADIO); |
1954 | + lwcoButton.setText("Lightweight Checkout"); |
1955 | + |
1956 | + brButton = new Button(compo, SWT.RADIO); |
1957 | + brButton.setText("Branch"); |
1958 | + |
1959 | + return compo; |
1960 | + } |
1961 | + |
1962 | + @Override |
1963 | + public void isValid() throws BazaarException { |
1964 | + return; |
1965 | + } |
1966 | + |
1967 | + @Override |
1968 | + public String getValue() { |
1969 | + return ""; |
1970 | + } |
1971 | + |
1972 | + public int getBranchType() { |
1973 | + if (coButton.getSelection()) { |
1974 | + return CreateBazaarProjectOperation.TYPE_CHECKOUT; |
1975 | + } |
1976 | + if (lwcoButton.getSelection()) { |
1977 | + return CreateBazaarProjectOperation.TYPE_LIGHTWEIGHT; |
1978 | + } |
1979 | + if (brButton.getSelection()) { |
1980 | + return CreateBazaarProjectOperation.TYPE_BRANCH; |
1981 | + } |
1982 | + throw new RuntimeException("No Branch Type selected"); |
1983 | + } |
1984 | + |
1985 | + @Override |
1986 | + public void setValue(String newValue) { |
1987 | + throw new RuntimeException("setValue not supported"); |
1988 | + } |
1989 | +} |
1990 | |
1991 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectEntry.java' |
1992 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectEntry.java 1970-01-01 00:00:00 +0000 |
1993 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectEntry.java 2013-02-19 07:30:34 +0000 |
1994 | @@ -0,0 +1,166 @@ |
1995 | +/******************************************************************************* |
1996 | + * Copyright (c) 2012 Idereal Limited |
1997 | + * All rights reserved. This program and the accompanying materials |
1998 | + * are made available under the terms of the Eclipse Public License v1.0 |
1999 | + * which accompanies this distribution, and is available at |
2000 | + * http://www.eclipse.org/legal/epl-v10.html |
2001 | + * |
2002 | + * Contributors: |
2003 | + * Alexander Taler |
2004 | + *******************************************************************************/ |
2005 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
2006 | + |
2007 | +import org.eclipse.jface.dialogs.IMessageProvider; |
2008 | +import org.eclipse.jface.wizard.WizardPage; |
2009 | +import org.eclipse.swt.SWT; |
2010 | +import org.eclipse.swt.layout.GridData; |
2011 | +import org.eclipse.swt.widgets.Composite; |
2012 | +import org.eclipse.swt.widgets.Event; |
2013 | +import org.eclipse.swt.widgets.Label; |
2014 | +import org.eclipse.swt.widgets.Listener; |
2015 | +import org.eclipse.swt.widgets.Scrollable; |
2016 | +import org.eclipse.swt.widgets.Text; |
2017 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
2018 | + |
2019 | +/** |
2020 | + * A set of widgets and functionality on the project wizard page. |
2021 | + * |
2022 | + * Provides layout: creating a label and single line text box. |
2023 | + * |
2024 | + * Manages page completion by listening for events, providing isComplete() |
2025 | + * method and calling setPageComplete(). |
2026 | + * |
2027 | + * Can "cascade" text to another text entry box. This allows user input to |
2028 | + * update several entries simultaneously. This is suppressed for entries which |
2029 | + * the user has edited manually. |
2030 | + * |
2031 | + * @author Alexander Taler alex <@> idereal <.> co <.> nz |
2032 | + */ |
2033 | +public class CreateProjectEntry implements Listener { |
2034 | + |
2035 | + Scrollable textWidget; // The widget holding the text. |
2036 | + WizardPage page; // The parent page |
2037 | + CreateProjectWizard wiz; // The parent wizard to act as a reference |
2038 | + boolean touched = false; // true when the user has directly edited the field |
2039 | + CreateProjectEntry cascadeTo = null; // An entry object to cascade text to |
2040 | + String baseValue = ""; // The base value, modifiable but a useful start |
2041 | + |
2042 | + protected Text text; // The text widget which holds user input. It may be null in sub classes |
2043 | + |
2044 | + /** |
2045 | + * A new text entry box on a CreateProjectPage. |
2046 | + * |
2047 | + * @param parent The SWT Composite holds this. |
2048 | + * @param page The CreateProjectPage containing this. |
2049 | + * @param labelText String to display to user explaining what to enter. |
2050 | + * @param width Suggested width for the text entry box. |
2051 | + * @param baseValue Optional base value. |
2052 | + */ |
2053 | + public CreateProjectEntry(Composite parent, |
2054 | + WizardPage page, |
2055 | + CreateProjectWizard wiz, |
2056 | + String labelText, |
2057 | + int width, |
2058 | + String baseValue) |
2059 | + { |
2060 | + this.page = page; |
2061 | + this.wiz = wiz; |
2062 | + if (baseValue != null) { |
2063 | + this.baseValue = baseValue; |
2064 | + } |
2065 | + |
2066 | + Label label = new Label(parent, SWT.LEFT); |
2067 | + label.setText(labelText); |
2068 | + |
2069 | + textWidget = createWidget(parent); |
2070 | + final GridData gridData = new GridData(SWT.VERTICAL); |
2071 | + gridData.widthHint = width; |
2072 | + textWidget.setLayoutData(gridData); |
2073 | + |
2074 | + textWidget.addListener(SWT.Modify, this); |
2075 | + } |
2076 | + |
2077 | + protected Scrollable createWidget(Composite parent) { |
2078 | + text = new Text(parent, SWT.SINGLE | SWT.BORDER); |
2079 | + text.setText(baseValue); |
2080 | + return text; |
2081 | + } |
2082 | + |
2083 | + public void handleEvent(Event event) { |
2084 | + if (textWidget.isFocusControl()) { |
2085 | + touched = isModified(); |
2086 | + page.setMessage(null); |
2087 | + } |
2088 | + if (cascadeTo != null) { |
2089 | + cascadeTo.cascade(getValue()); |
2090 | + } |
2091 | + try { |
2092 | + isValid(); |
2093 | + page.setPageComplete(true); |
2094 | + } catch (BazaarException be) { |
2095 | + page.setPageComplete(false); |
2096 | + // SetErrorMessage is not displaying. I have not investigated. |
2097 | + String message = be.getStatus().getMessage(); |
2098 | + if ((message != null) && (message.length() > 0)) { |
2099 | + page.setMessage(message, IMessageProvider.WARNING); |
2100 | + } |
2101 | + } |
2102 | + } |
2103 | + |
2104 | + public void setCascadeTo(CreateProjectEntry cascadeTo) { |
2105 | + this.cascadeTo = cascadeTo; |
2106 | + } |
2107 | + |
2108 | + /** |
2109 | + * Receive text from another element used to populate this field. |
2110 | + * |
2111 | + * @param cascadeText |
2112 | + */ |
2113 | + private void cascade(String cascadeText) { |
2114 | + if (touched) { |
2115 | + return; |
2116 | + } |
2117 | + // Only use the last segment assuming it's a file name or similar |
2118 | + String[] parts = cascadeText.split("[\\\\/]"); |
2119 | + if (parts.length > 0) { |
2120 | + cascadeText = parts[parts.length - 1]; |
2121 | + } |
2122 | + setValue(baseValue + cascadeText); |
2123 | + if (cascadeTo != null) { |
2124 | + cascadeTo.cascade(getValue()); |
2125 | + } |
2126 | + } |
2127 | + |
2128 | + /** |
2129 | + * Check if this field is modified from it's original value. |
2130 | + */ |
2131 | + public boolean isModified() { |
2132 | + return (getValue().length() > 0) && (!getValue().equals(baseValue)); |
2133 | + } |
2134 | + |
2135 | + /** |
2136 | + * Check if this field is complete and valid. |
2137 | + * |
2138 | + * The default implementation just checks if it's modified. The thrown |
2139 | + * exception message explains the issue, or is empty if there's nothing |
2140 | + * interesting to say. |
2141 | + * |
2142 | + * @throws BazaarException including a message. |
2143 | + */ |
2144 | + public void isValid() throws BazaarException { |
2145 | + if (!isModified()) { |
2146 | + throw new BazaarException(""); |
2147 | + } |
2148 | + } |
2149 | + |
2150 | + // This method is used internally in order to allow subclasses to override text |
2151 | + public String getValue() { |
2152 | + return text.getText(); |
2153 | + } |
2154 | + |
2155 | + // This method is used internally in order to allow subclasses to override text |
2156 | + public void setValue(String newValue) { |
2157 | + text.setText(newValue); |
2158 | + } |
2159 | + |
2160 | +} |
2161 | |
2162 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectLocation.java' |
2163 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectLocation.java 1970-01-01 00:00:00 +0000 |
2164 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectLocation.java 2013-02-19 07:30:34 +0000 |
2165 | @@ -0,0 +1,53 @@ |
2166 | +/******************************************************************************* |
2167 | + * Copyright (c) 2012 Idereal Limited |
2168 | + * All rights reserved. This program and the accompanying materials |
2169 | + * are made available under the terms of the Eclipse Public License v1.0 |
2170 | + * which accompanies this distribution, and is available at |
2171 | + * http://www.eclipse.org/legal/epl-v10.html |
2172 | + * |
2173 | + * Contributors: |
2174 | + * Alexander Taler |
2175 | + *******************************************************************************/ |
2176 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
2177 | + |
2178 | +import org.eclipse.core.runtime.IPath; |
2179 | +import org.eclipse.core.runtime.Path; |
2180 | +import org.eclipse.jface.wizard.WizardPage; |
2181 | +import org.eclipse.swt.widgets.Composite; |
2182 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
2183 | + |
2184 | +/** |
2185 | + * A widget for entering a project location. |
2186 | + * |
2187 | + * This means checking the validity. |
2188 | + * |
2189 | + * @author Alexander Taler |
2190 | + */ |
2191 | +public class CreateProjectLocation extends CreateProjectEntry { |
2192 | + public CreateProjectLocation(Composite parent, |
2193 | + WizardPage page, |
2194 | + CreateProjectWizard wiz, |
2195 | + String labelText, |
2196 | + int width, |
2197 | + String baseValue) |
2198 | + { |
2199 | + super(parent, page, wiz, labelText, width, baseValue); |
2200 | + } |
2201 | + |
2202 | + @Override |
2203 | + public void isValid() throws BazaarException { |
2204 | + // Ensure that it's modified. |
2205 | + super.isValid(); |
2206 | + IPath loc = new Path(getValue()); |
2207 | + IPath locParent = loc.removeLastSegments(1); |
2208 | + IPath workBase = new Path(baseValue); |
2209 | + IPath locDefault = new Path(baseValue + wiz.getProjectName()); |
2210 | + if (loc.equals(workBase)) { |
2211 | + throw new BazaarException("Project Location cannot be directly in the workspace root"); |
2212 | + } |
2213 | + if (locParent.equals(workBase) && !loc.equals(locDefault)) { |
2214 | + throw new BazaarException( |
2215 | + "Project Location cannot be a folder in the workspace root with a different name from the project."); |
2216 | + } |
2217 | + } |
2218 | +} |
2219 | |
2220 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectName.java' |
2221 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectName.java 1970-01-01 00:00:00 +0000 |
2222 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectName.java 2013-02-19 07:30:34 +0000 |
2223 | @@ -0,0 +1,51 @@ |
2224 | +/******************************************************************************* |
2225 | + * Copyright (c) 2012 Idereal Limited |
2226 | + * All rights reserved. This program and the accompanying materials |
2227 | + * are made available under the terms of the Eclipse Public License v1.0 |
2228 | + * which accompanies this distribution, and is available at |
2229 | + * http://www.eclipse.org/legal/epl-v10.html |
2230 | + * |
2231 | + * Contributors: |
2232 | + * Alexander Taler |
2233 | + *******************************************************************************/ |
2234 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
2235 | + |
2236 | +import org.eclipse.core.resources.IProject; |
2237 | +import org.eclipse.core.resources.ResourcesPlugin; |
2238 | +import org.eclipse.jface.wizard.WizardPage; |
2239 | +import org.eclipse.swt.widgets.Composite; |
2240 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
2241 | + |
2242 | +/** |
2243 | + * A specialization of CreateProjectEntry. |
2244 | + * |
2245 | + * This boils down to one line of code: checking validity of project name. A |
2246 | + * whole class for that one line seems a bit excessive. |
2247 | + * |
2248 | + * @author Alexander Taler |
2249 | + */ |
2250 | +public class CreateProjectName extends CreateProjectEntry { |
2251 | + public CreateProjectName(Composite parent, |
2252 | + WizardPage page, |
2253 | + CreateProjectWizard wiz, |
2254 | + String labelText, |
2255 | + int width, |
2256 | + String baseValue) { |
2257 | + super(parent, page, wiz, labelText, width, baseValue); |
2258 | + } |
2259 | + |
2260 | + @Override |
2261 | + public void isValid() throws BazaarException { |
2262 | + // Ensure that it's modified. |
2263 | + super.isValid(); |
2264 | + try { |
2265 | + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getValue()); |
2266 | + if (project.exists()) { |
2267 | + throw new BazaarException("Project name already taken"); |
2268 | + } |
2269 | + } catch (IllegalArgumentException iae) { |
2270 | + throw new BazaarException("Illegal project name"); |
2271 | + } |
2272 | + } |
2273 | + |
2274 | +} |
2275 | |
2276 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectPage.java' |
2277 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectPage.java 1970-01-01 00:00:00 +0000 |
2278 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectPage.java 2013-02-19 07:30:34 +0000 |
2279 | @@ -0,0 +1,115 @@ |
2280 | +/******************************************************************************* |
2281 | + * Copyright (c) 2012 Idereal Limited |
2282 | + * All rights reserved. This program and the accompanying materials |
2283 | + * are made available under the terms of the Eclipse Public License v1.0 |
2284 | + * which accompanies this distribution, and is available at |
2285 | + * http://www.eclipse.org/legal/epl-v10.html |
2286 | + * |
2287 | + * Contributors: |
2288 | + * Alexander Taler |
2289 | + *******************************************************************************/ |
2290 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
2291 | + |
2292 | +import org.eclipse.core.runtime.Platform; |
2293 | +import org.eclipse.jface.resource.ImageDescriptor; |
2294 | +import org.eclipse.jface.wizard.WizardPage; |
2295 | +import org.eclipse.swt.SWT; |
2296 | +import org.eclipse.swt.layout.GridLayout; |
2297 | +import org.eclipse.swt.widgets.Composite; |
2298 | +import org.eclipse.swt.widgets.Label; |
2299 | +import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
2300 | + |
2301 | +/** |
2302 | + * The basic page for the Bazaar project creation Wizard. |
2303 | + * |
2304 | + * The page is has these entries, in order: |
2305 | + * - Remote Bazaar URL |
2306 | + * - Project Name |
2307 | + * - Local directory location |
2308 | + * |
2309 | + * @author Alexander Taler alex <@> idereal <.> co <.> nz |
2310 | + */ |
2311 | +public class CreateProjectPage extends WizardPage { |
2312 | + |
2313 | + // The parent wizard to act as a reference |
2314 | + public CreateProjectWizard wiz; |
2315 | + |
2316 | + CreateProjectRemoteBranch remoteBranch = null; |
2317 | + CreateProjectName projName = null; |
2318 | + CreateProjectLocation projLoc = null; |
2319 | + |
2320 | + public CreateProjectPage(String pageName, CreateProjectWizard wiz) { |
2321 | + super(pageName); |
2322 | + this.wiz = wiz; |
2323 | + setTitle("Eclipse Project from Bazaar"); |
2324 | + setDescription("Create a local Eclipse project connected to a remote Bazaar branch"); |
2325 | + ImageDescriptor titleImage = EclipseBazaarUI.getImageDescriptor("icons/bzr-eclipse.jpg"); |
2326 | + setImageDescriptor(titleImage); |
2327 | + } |
2328 | + |
2329 | + public void createControl(Composite parent) { |
2330 | + final Composite topComposite = new Composite(parent, SWT.NONE); |
2331 | + topComposite.setLayout(new GridLayout(1, false)); |
2332 | + |
2333 | + /////////////// |
2334 | + // Repository Location |
2335 | + remoteBranch = new CreateProjectRemoteBranch(topComposite, this, wiz, 425, ""); |
2336 | + setRepoLocation(wiz.getInitialBranch()); |
2337 | + |
2338 | + // Space |
2339 | + Label space1Label = new Label(topComposite, SWT.LEFT); |
2340 | + space1Label.setText(""); |
2341 | + |
2342 | + /////////////// |
2343 | + // Project Name |
2344 | + projName = new CreateProjectName(topComposite, this, wiz, "Name of Eclipse Project", 150, ""); |
2345 | + |
2346 | + // Space |
2347 | + Label space2Label = new Label(topComposite, SWT.LEFT); |
2348 | + space2Label.setText(""); |
2349 | + |
2350 | + /////////////// |
2351 | + // Project Location |
2352 | + String bv = Platform.getLocation().addTrailingSeparator().toOSString(); |
2353 | + |
2354 | + projLoc = new CreateProjectLocation(topComposite, this, wiz, "Location for Eclipse Project", 425, bv); |
2355 | + |
2356 | + // Set up the connections |
2357 | + remoteBranch.setCascadeTo(projName); |
2358 | + projName.setCascadeTo(projLoc); |
2359 | + |
2360 | + setControl(topComposite); |
2361 | + setPageComplete(false); |
2362 | + } |
2363 | + |
2364 | + @Override |
2365 | + public boolean isPageComplete() { |
2366 | + try { |
2367 | + remoteBranch.isValid(); |
2368 | + projName.isValid(); |
2369 | + projLoc.isValid(); |
2370 | + } catch (Exception e) { |
2371 | + // NullPointerException and BazaarException |
2372 | + return false; |
2373 | + } |
2374 | + return true; |
2375 | + } |
2376 | + |
2377 | + public String getProjectName() { |
2378 | + return projName.getValue(); |
2379 | + } |
2380 | + |
2381 | + public String getRepoLocation() { |
2382 | + return remoteBranch.getValue(); |
2383 | + } |
2384 | + |
2385 | + public void setRepoLocation(String newValue) { |
2386 | + if (newValue != null) { |
2387 | + remoteBranch.setValue(newValue); |
2388 | + } |
2389 | + } |
2390 | + |
2391 | + public String getProjectLocation() { |
2392 | + return projLoc.getValue(); |
2393 | + } |
2394 | +} |
2395 | |
2396 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRemoteBranch.java' |
2397 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRemoteBranch.java 1970-01-01 00:00:00 +0000 |
2398 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRemoteBranch.java 2013-02-19 07:30:34 +0000 |
2399 | @@ -0,0 +1,101 @@ |
2400 | +/******************************************************************************* |
2401 | + * Copyright (c) 2012 Idereal Limited |
2402 | + * All rights reserved. This program and the accompanying materials |
2403 | + * are made available under the terms of the Eclipse Public License v1.0 |
2404 | + * which accompanies this distribution, and is available at |
2405 | + * http://www.eclipse.org/legal/epl-v10.html |
2406 | + * |
2407 | + * Contributors: |
2408 | + * Alexander Taler |
2409 | + *******************************************************************************/ |
2410 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
2411 | + |
2412 | +import org.eclipse.jface.wizard.WizardPage; |
2413 | +import org.eclipse.swt.SWT; |
2414 | +import org.eclipse.swt.events.SelectionAdapter; |
2415 | +import org.eclipse.swt.events.SelectionEvent; |
2416 | +import org.eclipse.swt.layout.GridLayout; |
2417 | +import org.eclipse.swt.widgets.Button; |
2418 | +import org.eclipse.swt.widgets.Combo; |
2419 | +import org.eclipse.swt.widgets.Composite; |
2420 | +import org.eclipse.swt.widgets.DirectoryDialog; |
2421 | +import org.eclipse.swt.widgets.Scrollable; |
2422 | +import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
2423 | +import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager; |
2424 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
2425 | +import org.vcs.bazaar.eclipse.internal.core.model.BzrBranchLocator; |
2426 | +import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
2427 | + |
2428 | +/** |
2429 | + * A specialization of CreateProjectEntry. |
2430 | + * |
2431 | + * It uses a Combo widget instead of a Text widget, validates that input is |
2432 | + * correctly formatted and adds a button to browse the file system for branches. |
2433 | + * |
2434 | + * @author Alexander Taler |
2435 | + */ |
2436 | +public class CreateProjectRemoteBranch extends CreateProjectEntry { |
2437 | + |
2438 | + protected Combo combo; |
2439 | + |
2440 | + private static String labelText = |
2441 | + "Repository Location\nProvide a URL to a remote repository and branch, or browse for a branch on the local machine"; |
2442 | + |
2443 | + public CreateProjectRemoteBranch(Composite parent, |
2444 | + WizardPage page, |
2445 | + CreateProjectWizard wiz, |
2446 | + int width, |
2447 | + String baseValue) { |
2448 | + super(parent, page, wiz, labelText, width, baseValue); |
2449 | + } |
2450 | + |
2451 | + @Override |
2452 | + protected Scrollable createWidget(Composite parent) { |
2453 | + Composite compo = new Composite(parent, SWT.NONE); |
2454 | + compo.setLayout(new GridLayout(2, false)); |
2455 | + |
2456 | + combo = new Combo(compo, SWT.SINGLE | SWT.BORDER); |
2457 | + |
2458 | + for (IBzrBranch br : BranchLocationManager.getInstance().getAllBranches()) { |
2459 | + try { |
2460 | + combo.add(br.getBranchLocator().toString()); |
2461 | + } catch (BazaarException e1) { |
2462 | + // A broken branch is not critical, just log it |
2463 | + EclipseBazaarUI.log(e1); |
2464 | + } |
2465 | + } |
2466 | + |
2467 | + final Button browse = new Button(compo, SWT.PUSH); |
2468 | + browse.setText("Browse for folder"); |
2469 | + browse.addSelectionListener(new SelectionAdapter() { |
2470 | + @Override |
2471 | + public void widgetSelected(SelectionEvent e) { |
2472 | + final DirectoryDialog dialog = new DirectoryDialog(page.getShell()); |
2473 | + dialog.setMessage("Select folder"); |
2474 | + final String seldir = dialog.open(); |
2475 | + if (seldir != null) { |
2476 | + combo.setText(seldir); |
2477 | + } |
2478 | + } |
2479 | + }); |
2480 | + |
2481 | + return combo; |
2482 | + } |
2483 | + |
2484 | + @Override |
2485 | + public void isValid() throws BazaarException { |
2486 | + // Ensure that it's modified. |
2487 | + super.isValid(); |
2488 | + new BzrBranchLocator(getValue()); |
2489 | + } |
2490 | + |
2491 | + @Override |
2492 | + public String getValue() { |
2493 | + return combo.getText(); |
2494 | + } |
2495 | + |
2496 | + @Override |
2497 | + public void setValue(String newValue) { |
2498 | + combo.setText(newValue); |
2499 | + } |
2500 | +} |
2501 | |
2502 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRevision.java' |
2503 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRevision.java 1970-01-01 00:00:00 +0000 |
2504 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectRevision.java 2013-02-19 07:30:34 +0000 |
2505 | @@ -0,0 +1,106 @@ |
2506 | +/******************************************************************************* |
2507 | + * Copyright (c) 2012 Idereal Limited |
2508 | + * All rights reserved. This program and the accompanying materials |
2509 | + * are made available under the terms of the Eclipse Public License v1.0 |
2510 | + * which accompanies this distribution, and is available at |
2511 | + * http://www.eclipse.org/legal/epl-v10.html |
2512 | + * |
2513 | + * Contributors: |
2514 | + * Alexander Taler |
2515 | + *******************************************************************************/ |
2516 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
2517 | + |
2518 | +import org.eclipse.jface.dialogs.Dialog; |
2519 | +import org.eclipse.jface.dialogs.IMessageProvider; |
2520 | +import org.eclipse.jface.wizard.WizardPage; |
2521 | +import org.eclipse.swt.SWT; |
2522 | +import org.eclipse.swt.events.SelectionAdapter; |
2523 | +import org.eclipse.swt.events.SelectionEvent; |
2524 | +import org.eclipse.swt.layout.GridData; |
2525 | +import org.eclipse.swt.layout.GridLayout; |
2526 | +import org.eclipse.swt.widgets.Button; |
2527 | +import org.eclipse.swt.widgets.Composite; |
2528 | +import org.eclipse.swt.widgets.Event; |
2529 | +import org.eclipse.swt.widgets.Listener; |
2530 | +import org.eclipse.swt.widgets.Scrollable; |
2531 | +import org.eclipse.swt.widgets.Text; |
2532 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
2533 | +import org.vcs.bazaar.eclipse.ui.dialogs.ShowLogDialog; |
2534 | + |
2535 | +/** |
2536 | + * Allow selection of older revisions |
2537 | + * |
2538 | + * Provides an entry box to provide an older revision number. |
2539 | + * |
2540 | + * TODO: Add support for symbolic tags. |
2541 | + * TODO: Replace with org.vcs.bazaar.eclipse.ui.widgets.RevisionNumber |
2542 | + * |
2543 | + * @author Alexander Taler |
2544 | + */ |
2545 | +public class CreateProjectRevision extends CreateProjectEntry { |
2546 | + |
2547 | + private static String labelText = "Fetch a specific revision"; |
2548 | + |
2549 | + private Button checkBox; |
2550 | + private Button showLog; |
2551 | + |
2552 | + public CreateProjectRevision(Composite parent, |
2553 | + WizardPage page, |
2554 | + CreateProjectWizard wiz, |
2555 | + int width) { |
2556 | + super(parent, page, wiz, labelText, width, ""); |
2557 | + } |
2558 | + |
2559 | + @Override |
2560 | + protected Scrollable createWidget(Composite parent) { |
2561 | + Composite compo = new Composite(parent, SWT.NONE); |
2562 | + compo.setLayout(new GridLayout(3, false)); |
2563 | + |
2564 | + checkBox = new Button(compo, SWT.CHECK); |
2565 | + checkBox.setText("Use older revision"); |
2566 | + checkBox.setSelection(false); |
2567 | + |
2568 | + text = new Text(compo, SWT.BORDER); |
2569 | + GridData gridData = new GridData(SWT.VERTICAL); |
2570 | + gridData.widthHint = 50; |
2571 | + text.setLayoutData(gridData); |
2572 | + text.setEnabled(false); |
2573 | + |
2574 | + // Enable revision text box iff it's enabled. |
2575 | + checkBox.addListener(SWT.Selection, new Listener() { |
2576 | + public void handleEvent(Event event) { |
2577 | + text.setEnabled(checkBox.getSelection()); |
2578 | + } |
2579 | + }); |
2580 | + |
2581 | + // Add the showlog button |
2582 | + showLog = new Button(compo, SWT.PUSH); |
2583 | + showLog.setText("View Revision Log"); |
2584 | + showLog.addSelectionListener(new SelectionAdapter() { |
2585 | + @Override |
2586 | + public void widgetSelected(SelectionEvent e) { |
2587 | + try { |
2588 | + checkBox.setSelection(true); |
2589 | + final ShowLogDialog dialog = |
2590 | + new ShowLogDialog(page.getShell(), wiz.getRemoteBranch()); |
2591 | + if (dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) { |
2592 | + text.setText(dialog.getSelectedRevision().getValue()); |
2593 | + } |
2594 | + } catch (BazaarException be) { |
2595 | + // SetErrorMessage is not displaying. I have not investigated. |
2596 | + String message = be.getStatus().getMessage(); |
2597 | + if ((message != null) && (message.length() > 0)) { |
2598 | + page.setMessage(message, IMessageProvider.WARNING); |
2599 | + } |
2600 | + } |
2601 | + } |
2602 | + }); |
2603 | + |
2604 | + return compo; |
2605 | + } |
2606 | + |
2607 | + @Override |
2608 | + public void isValid() throws BazaarException { |
2609 | + return; |
2610 | + } |
2611 | +} |
2612 | |
2613 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectWizard.java' |
2614 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectWizard.java 1970-01-01 00:00:00 +0000 |
2615 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/createproject/CreateProjectWizard.java 2013-02-19 07:30:34 +0000 |
2616 | @@ -0,0 +1,176 @@ |
2617 | +/******************************************************************************* |
2618 | + * Copyright (c) 2012 Idereal Limited |
2619 | + * All rights reserved. This program and the accompanying materials |
2620 | + * are made available under the terms of the Eclipse Public License v1.0 |
2621 | + * which accompanies this distribution, and is available at |
2622 | + * http://www.eclipse.org/legal/epl-v10.html |
2623 | + * |
2624 | + * Contributors: |
2625 | + * Alexander Taler |
2626 | + *******************************************************************************/ |
2627 | +package org.vcs.bazaar.eclipse.ui.wizards.createproject; |
2628 | + |
2629 | +import java.lang.reflect.InvocationTargetException; |
2630 | + |
2631 | +import org.eclipse.core.resources.IProject; |
2632 | +import org.eclipse.core.runtime.CoreException; |
2633 | +import org.eclipse.core.runtime.IStatus; |
2634 | +import org.eclipse.jface.viewers.IStructuredSelection; |
2635 | +import org.eclipse.jface.wizard.Wizard; |
2636 | +import org.eclipse.jface.wizard.WizardDialog; |
2637 | +import org.eclipse.swt.widgets.Shell; |
2638 | +import org.eclipse.ui.INewWizard; |
2639 | +import org.eclipse.ui.IWorkbench; |
2640 | +import org.vcs.bazaar.eclipse.BzrWorkspaceRoot; |
2641 | +import org.vcs.bazaar.eclipse.EclipseBazaarCore; |
2642 | +import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
2643 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
2644 | +import org.vcs.bazaar.eclipse.internal.core.model.BzrBranchLocator; |
2645 | +import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
2646 | +import org.vcs.bazaar.eclipse.ui.operations.CreateBazaarProjectOperation; |
2647 | +import org.vcs.bazaar.eclipse.ui.team.BazaarUtilities; |
2648 | + |
2649 | +/** |
2650 | + * A Wizard for creating a local Eclipse project from a remote Bazaar branch. |
2651 | + * |
2652 | + * It can be called from the create project and import project menus. It can |
2653 | + * also be called from the Branch action, in which case the selection is used to |
2654 | + * determine the remote Bazaar branch. |
2655 | + * |
2656 | + * @author Alexander Taler alex <@> idereal <.> co <.> nz |
2657 | + */ |
2658 | +public class CreateProjectWizard extends Wizard implements INewWizard { |
2659 | + |
2660 | + private CreateProjectPage cpPage; |
2661 | + private CreateProjectAdvancedPage cpaPage; |
2662 | + |
2663 | + // Initial branch |
2664 | + protected String initialBranch = null; |
2665 | + |
2666 | + public CreateProjectWizard() { |
2667 | + super(); |
2668 | + } |
2669 | + |
2670 | + public CreateProjectWizard(IStructuredSelection ss) { |
2671 | + super(); |
2672 | + init(null, null); |
2673 | + |
2674 | + if ((ss == null) || (ss.size() < 0)) { |
2675 | + throw new RuntimeException("Selection required"); |
2676 | + } |
2677 | + if (ss.size() > 1) { |
2678 | + throw new RuntimeException("Single Selection only supported"); |
2679 | + } |
2680 | + if (!(ss.getFirstElement() instanceof IProject)) { |
2681 | + throw new RuntimeException("Selection must be a Project"); |
2682 | + } |
2683 | + IProject project = (IProject) ss.getFirstElement(); |
2684 | + IBzrBranch branch = BzrWorkspaceRoot.getBzrWorkspaceRootFor(project).getBranch(); |
2685 | + try { |
2686 | + initialBranch = branch.getBranchLocator().toString(); |
2687 | + } catch (BazaarException e) { |
2688 | + EclipseBazaarUI.log(e); |
2689 | + } |
2690 | + } |
2691 | + |
2692 | + /** |
2693 | + * The branch that this wizard was created with. |
2694 | + */ |
2695 | + String getInitialBranch() { |
2696 | + return initialBranch; |
2697 | + } |
2698 | + |
2699 | + /** |
2700 | + * Display this wizard to the user. |
2701 | + * |
2702 | + * @param shell |
2703 | + */ |
2704 | + public void show(Shell shell) { |
2705 | + new WizardDialog(shell, this).open(); |
2706 | + } |
2707 | + |
2708 | + public void init(IWorkbench workbench, IStructuredSelection selection) { |
2709 | + setWindowTitle("Bazaar Create Project Wizard"); |
2710 | + setNeedsProgressMonitor(true); |
2711 | + cpPage = new CreateProjectPage("BazaarCreateProjectPage", this); |
2712 | + addPage(cpPage); |
2713 | + cpaPage = new CreateProjectAdvancedPage("BazaarCreateProjectPage", this); |
2714 | + addPage(cpaPage); |
2715 | + |
2716 | + if (!EclipseBazaarCore.getDefault().isClientAvailable()) { |
2717 | + BazaarUtilities.configureExecutable(); |
2718 | + } |
2719 | + } |
2720 | + |
2721 | + /** |
2722 | + * Display a useful error message to the user. |
2723 | + * |
2724 | + * The message is shown on both pages of the wizard. |
2725 | + * |
2726 | + * @param e The exception to show to the user. |
2727 | + */ |
2728 | + protected void setErrorMessage(Throwable e) { |
2729 | + String message = ""; |
2730 | + if (e instanceof InvocationTargetException) { |
2731 | + e = e.getCause(); |
2732 | + } |
2733 | + if (e instanceof BazaarException) { |
2734 | + message = ((BazaarException) e).getStatus().getMessage(); |
2735 | + } else if (e instanceof CoreException) { |
2736 | + if (((CoreException) e).getStatus() != null) { |
2737 | + message = ((CoreException) e).getStatus().getMessage(); |
2738 | + for (IStatus i : ((CoreException) e).getStatus().getChildren()) { |
2739 | + message += i.getMessage(); |
2740 | + } |
2741 | + } else { |
2742 | + message = e.getMessage(); |
2743 | + } |
2744 | + } |
2745 | + EclipseBazaarUI.log(e); |
2746 | + cpPage.setErrorMessage(message); |
2747 | + cpaPage.setErrorMessage(message); |
2748 | + } |
2749 | + |
2750 | + /** |
2751 | + * Return a branch object for the branch this wizard will use. |
2752 | + * |
2753 | + * @return A branch object of the appropriate type |
2754 | + * @throws BazaarException if the user specified branch is invalid |
2755 | + */ |
2756 | + public IBzrBranch getRemoteBranch() throws BazaarException { |
2757 | + return new BzrBranchLocator(cpPage.getRepoLocation()).getBranch(); |
2758 | + } |
2759 | + |
2760 | + /** |
2761 | + * Return the project name currently entered. |
2762 | + * |
2763 | + * @return String containing the project name |
2764 | + */ |
2765 | + public String getProjectName() { |
2766 | + return cpPage.getProjectName(); |
2767 | + } |
2768 | + |
2769 | + @Override |
2770 | + public boolean performFinish() { |
2771 | + try { |
2772 | + CreateBazaarProjectOperation op = |
2773 | + new CreateBazaarProjectOperation( |
2774 | + this.getContainer(), |
2775 | + cpPage.getProjectName(), |
2776 | + getRemoteBranch(), |
2777 | + cpPage.getProjectLocation(), |
2778 | + cpaPage.getBranchType(), |
2779 | + cpaPage.getRevision()); |
2780 | + op.run(); |
2781 | + return true; |
2782 | + } catch (InvocationTargetException e) { |
2783 | + setErrorMessage(e); |
2784 | + } catch (InterruptedException e) { |
2785 | + setErrorMessage(e); |
2786 | + } catch (BazaarException e) { |
2787 | + setErrorMessage(e); |
2788 | + } |
2789 | + return false; |
2790 | + } |
2791 | +} |
2792 | + |
2793 | |
2794 | === removed directory 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project' |
2795 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchFromProjectWizard.java' |
2796 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchFromProjectWizard.java 2009-11-18 08:48:22 +0000 |
2797 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchFromProjectWizard.java 1970-01-01 00:00:00 +0000 |
2798 | @@ -1,93 +0,0 @@ |
2799 | -/** |
2800 | - * LICENSE + COPYRIGHT |
2801 | - */ |
2802 | -package org.vcs.bazaar.eclipse.ui.wizards.project; |
2803 | - |
2804 | -import org.eclipse.core.resources.IProject; |
2805 | -import org.eclipse.core.resources.IProjectDescription; |
2806 | -import org.eclipse.core.resources.ResourcesPlugin; |
2807 | -import org.eclipse.jface.dialogs.MessageDialog; |
2808 | -import org.eclipse.jface.wizard.IWizardPage; |
2809 | -import org.eclipse.jface.wizard.WizardDialog; |
2810 | -import org.eclipse.swt.widgets.Shell; |
2811 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
2812 | -import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
2813 | -import org.vcs.bazaar.eclipse.ui.operations.BranchAsProjectOperation; |
2814 | - |
2815 | -/** |
2816 | - * This class implements the branch from project wizard |
2817 | - * |
2818 | - * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com> |
2819 | - */ |
2820 | -public class BranchFromProjectWizard extends BranchWizard { |
2821 | - |
2822 | - public BranchFromProjectWizard(Shell shell, IBzrBranch branch) { |
2823 | - super(); |
2824 | - setRemoteLocation(branch); |
2825 | - init(null, null); |
2826 | - } |
2827 | - |
2828 | - public static BranchFromProjectWizard open(Shell shell, IBzrBranch branch) { |
2829 | - BranchFromProjectWizard wizard = new BranchFromProjectWizard(shell, branch); |
2830 | - WizardDialog dialog = new WizardDialog(shell, wizard); |
2831 | - dialog.open(); |
2832 | - return wizard; |
2833 | - } |
2834 | - |
2835 | - |
2836 | - @Override |
2837 | - protected boolean performOperation(IProject project) { |
2838 | - BranchAsProjectOperation branchOp = null; |
2839 | - if(project == null) { |
2840 | - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName()); |
2841 | - description.setLocation(getNewProjectPage().getLocationPath()); |
2842 | - branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision()); |
2843 | - } else { |
2844 | - branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision()); |
2845 | - } |
2846 | - try { |
2847 | - branchOp.run(); |
2848 | - } catch (Exception e) { |
2849 | - MessageDialog.openError(this.getShell(), "Error while executing branch operation", e.getMessage()); |
2850 | - EclipseBazaarUI.log(e.getMessage(), e); |
2851 | - return false; |
2852 | - } |
2853 | - return true; |
2854 | - } |
2855 | - |
2856 | - @Override |
2857 | - public void addPages() { |
2858 | - //super.addPages(); |
2859 | - addPage(getProjectPage()); |
2860 | - addPage(getNewProjectPage()); |
2861 | - } |
2862 | - |
2863 | - @Override |
2864 | - public IWizardPage getNextPage(IWizardPage page) { |
2865 | - if(page != null) { |
2866 | - if(page.getName().equals(getProjectPage().getName())) { |
2867 | - if(getProjectPage().useNewProjectWizard()) { |
2868 | - setUseNewProjectWizard(true); |
2869 | - return null; |
2870 | - } else { |
2871 | - setUseNewProjectWizard(false); |
2872 | - return getNewProjectPage(); |
2873 | - } |
2874 | - } else if(page.getName().equals(getNewProjectPage().getName())) { |
2875 | - return null; |
2876 | - } |
2877 | - } |
2878 | - return super.getNextPage(page); |
2879 | - } |
2880 | - |
2881 | - @Override |
2882 | - public IWizardPage getPreviousPage(IWizardPage page) { |
2883 | - if(page != null) { |
2884 | - if(page.getName().equals(getNewProjectPage().getName())) { |
2885 | - return getProjectPage(); |
2886 | - } |
2887 | - } |
2888 | - return super.getPreviousPage(page); |
2889 | - } |
2890 | - |
2891 | -} |
2892 | |
2893 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizard.java' |
2894 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizard.java 2009-11-18 08:48:22 +0000 |
2895 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizard.java 1970-01-01 00:00:00 +0000 |
2896 | @@ -1,250 +0,0 @@ |
2897 | -/** |
2898 | - * LICENSE + COPYRIGHT |
2899 | - */ |
2900 | -package org.vcs.bazaar.eclipse.ui.wizards.project; |
2901 | - |
2902 | -import org.eclipse.core.resources.IProject; |
2903 | -import org.eclipse.core.resources.IProjectDescription; |
2904 | -import org.eclipse.core.resources.IResource; |
2905 | -import org.eclipse.core.resources.IResourceChangeEvent; |
2906 | -import org.eclipse.core.resources.IResourceChangeListener; |
2907 | -import org.eclipse.core.resources.IResourceDelta; |
2908 | -import org.eclipse.core.resources.ResourcesPlugin; |
2909 | -import org.eclipse.jface.dialogs.MessageDialog; |
2910 | -import org.eclipse.jface.viewers.IStructuredSelection; |
2911 | -import org.eclipse.jface.wizard.IWizardPage; |
2912 | -import org.eclipse.jface.wizard.Wizard; |
2913 | -import org.eclipse.ui.INewWizard; |
2914 | -import org.eclipse.ui.IWorkbench; |
2915 | -import org.eclipse.ui.PlatformUI; |
2916 | -import org.eclipse.ui.actions.NewProjectAction; |
2917 | -import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; |
2918 | -import org.vcs.bazaar.eclipse.EclipseBazaarCore; |
2919 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
2920 | -import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
2921 | -import org.vcs.bazaar.eclipse.ui.UITexts; |
2922 | -import org.vcs.bazaar.eclipse.ui.operations.BranchAsProjectOperation; |
2923 | -import org.vcs.bazaar.eclipse.ui.team.BazaarUtilities; |
2924 | -import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage; |
2925 | - |
2926 | -/** |
2927 | - * This class implements the new wizard extension. |
2928 | - * |
2929 | - * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com> |
2930 | - */ |
2931 | -public class BranchWizard extends Wizard implements INewWizard { |
2932 | - |
2933 | - private BranchWizardBranchLocationPage createRepoLocationPage; |
2934 | - private BranchWizardSelectionPage selectBranchPage; |
2935 | - private WizardNewProjectCreationPage newProjectPage; |
2936 | - private BranchWizardProjectPage projectPage; |
2937 | - |
2938 | - private IBzrBranch remoteLocation; |
2939 | - private boolean useNewProjectWizard; |
2940 | - |
2941 | - @Override |
2942 | - public boolean canFinish() { |
2943 | - if(useNewProjectWizard) { |
2944 | - return (getRemoteLocation() != null); |
2945 | - } else if(getProjectHandle() == null){ |
2946 | - return getRemoteLocation() != null && getNewProjectPage().isPageComplete(); |
2947 | - } else { |
2948 | - return getRemoteLocation() != null && getProjectHandle() != null; |
2949 | - } |
2950 | - } |
2951 | - |
2952 | - protected IProject getProjectHandle() { |
2953 | - try { |
2954 | - if(!getProjectPage().useNewProjectWizard() && getNewProjectPage().useDefaults()) |
2955 | - return getNewProjectPage().getProjectHandle(); |
2956 | - } catch(IllegalArgumentException iae) { |
2957 | - return null; |
2958 | - } |
2959 | - return null; |
2960 | - } |
2961 | - |
2962 | - @Override |
2963 | - public boolean performFinish() { |
2964 | - IProject project = null; |
2965 | - if(useNewProjectWizard) { |
2966 | - ProjectListener listener = new ProjectListener(); |
2967 | - ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE); |
2968 | - (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run(); |
2969 | - ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener); |
2970 | - project = listener.getProject(); |
2971 | - } else { |
2972 | - project = getProjectHandle(); |
2973 | - } |
2974 | - return performOperation(project); |
2975 | - } |
2976 | - |
2977 | - /** |
2978 | - * Perform the real stuff (in this case branching) |
2979 | - * @param project |
2980 | - * @return |
2981 | - */ |
2982 | - protected boolean performOperation(IProject project) { |
2983 | - BranchAsProjectOperation branchOp = null; |
2984 | - if(project == null) { |
2985 | - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName()); |
2986 | - description.setLocation(getNewProjectPage().getLocationPath()); |
2987 | - branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision()); |
2988 | - } else { |
2989 | - branchOp = new BranchAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision()); |
2990 | - } |
2991 | - try { |
2992 | - branchOp.run(); |
2993 | - } catch (Exception e) { |
2994 | - MessageDialog.openError(this.getShell(), "Error while executing branch operation", e.getMessage()); |
2995 | - EclipseBazaarUI.log(e.getMessage(), e); |
2996 | - return false; |
2997 | - } |
2998 | - return true; |
2999 | - } |
3000 | - |
3001 | - public void init(IWorkbench workbench, IStructuredSelection selection) { |
3002 | - setWindowTitle(UITexts.ImportWizard_wizardTitle); |
3003 | - setNeedsProgressMonitor(true); |
3004 | - selectBranchPage = new BranchWizardSelectionPage("selectBranch", "Source branch"); |
3005 | - projectPage = new BranchWizardProjectPage("projectPage", isCheckout()); |
3006 | - createRepoLocationPage = new BranchWizardBranchLocationPage("CreateRepoPage", "Source branch"); |
3007 | - setNewProjectPage(new WizardNewProjectCreationPage("newProjectPage")); |
3008 | - getNewProjectPage().setTitle("Project"); |
3009 | - getNewProjectPage().setDescription("Create a new project resource"); |
3010 | - getNewProjectPage().setImageDescriptor(BzrWizardPage.getTitleImage()); |
3011 | - |
3012 | - if (!EclipseBazaarCore.getDefault().isClientAvailable()) { |
3013 | - BazaarUtilities.configureExecutable(); |
3014 | - } |
3015 | - } |
3016 | - |
3017 | - protected boolean isCheckout() { |
3018 | - return false; |
3019 | - } |
3020 | - |
3021 | - @Override |
3022 | - public void addPages() { |
3023 | - super.addPages(); |
3024 | - addPage(selectBranchPage); |
3025 | - addPage(createRepoLocationPage); |
3026 | - addPage(getProjectPage()); |
3027 | - addPage(getNewProjectPage()); |
3028 | - } |
3029 | - |
3030 | - @Override |
3031 | - public IWizardPage getNextPage(IWizardPage page) { |
3032 | - if(page != null) { |
3033 | - if(page.getName().equals(selectBranchPage.getName())) { |
3034 | - if(selectBranchPage.isCreateNewBranchLocation()) { |
3035 | - return createRepoLocationPage; |
3036 | - } else { |
3037 | - setRemoteLocation(selectBranchPage.getLocation()); |
3038 | - getProjectPage().setLocation(getRemoteLocation()); |
3039 | - return getProjectPage(); |
3040 | - } |
3041 | - } else if(page.getName().equals(getProjectPage().getName())) { |
3042 | - if(getProjectPage().useNewProjectWizard()) { |
3043 | - useNewProjectWizard = true; |
3044 | - return null; |
3045 | - } else { |
3046 | - useNewProjectWizard = false; |
3047 | - return getNewProjectPage(); |
3048 | - } |
3049 | - } else if(page.getName().equals(createRepoLocationPage.getName())) { |
3050 | - setRemoteLocation(createRepoLocationPage.getLocation()); |
3051 | - getProjectPage().setLocation(getRemoteLocation()); |
3052 | - return super.getNextPage(page); |
3053 | - } |
3054 | - } |
3055 | - return super.getNextPage(page); |
3056 | - } |
3057 | - |
3058 | - @Override |
3059 | - public IWizardPage getPreviousPage(IWizardPage page) { |
3060 | - if(page != null) { |
3061 | - if(page.getName().equals(createRepoLocationPage.getName())) { |
3062 | - return selectBranchPage; |
3063 | - } else if(page.getName().equals(getProjectPage().getName())) { |
3064 | - if(selectBranchPage.isCreateNewBranchLocation()) { |
3065 | - return createRepoLocationPage; |
3066 | - } |
3067 | - } else if(page.getName().equals(getNewProjectPage().getName())) { |
3068 | - return getProjectPage(); |
3069 | - } |
3070 | - } |
3071 | - return super.getPreviousPage(page); |
3072 | - } |
3073 | - |
3074 | - |
3075 | - protected boolean isUseNewProjectWizard() { |
3076 | - return useNewProjectWizard; |
3077 | - } |
3078 | - |
3079 | - protected void setUseNewProjectWizard(boolean useNewProjectWizard) { |
3080 | - this.useNewProjectWizard = useNewProjectWizard; |
3081 | - } |
3082 | - |
3083 | - /** |
3084 | - * @param remoteLocation the remoteLocation to set |
3085 | - */ |
3086 | - protected void setRemoteLocation(IBzrBranch remoteLocation) { |
3087 | - this.remoteLocation = remoteLocation; |
3088 | - } |
3089 | - |
3090 | - /** |
3091 | - * @return the remoteLocation |
3092 | - */ |
3093 | - protected IBzrBranch getRemoteLocation() { |
3094 | - return remoteLocation; |
3095 | - } |
3096 | - |
3097 | - /** |
3098 | - * @param newProjectPage the newProjectPage to set |
3099 | - */ |
3100 | - protected void setNewProjectPage(WizardNewProjectCreationPage newProjectPage) { |
3101 | - this.newProjectPage = newProjectPage; |
3102 | - } |
3103 | - |
3104 | - /** |
3105 | - * @return the newProjectPage |
3106 | - */ |
3107 | - protected WizardNewProjectCreationPage getNewProjectPage() { |
3108 | - return newProjectPage; |
3109 | - } |
3110 | - |
3111 | - /** |
3112 | - * @param projectPage the projectPage to set |
3113 | - */ |
3114 | - protected void setProjectPage(BranchWizardProjectPage projectPage) { |
3115 | - this.projectPage = projectPage; |
3116 | - } |
3117 | - |
3118 | - /** |
3119 | - * @return the projectPage |
3120 | - */ |
3121 | - protected BranchWizardProjectPage getProjectPage() { |
3122 | - return projectPage; |
3123 | - } |
3124 | - |
3125 | - private static final class ProjectListener implements IResourceChangeListener { |
3126 | - private IProject project = null; |
3127 | - |
3128 | - public void resourceChanged(IResourceChangeEvent event) { |
3129 | - IResourceDelta[] deltas = event.getDelta().getAffectedChildren(); |
3130 | - for (int i = 0; i < deltas.length; i++) { |
3131 | - IResource resource = deltas[i].getResource(); |
3132 | - if (resource instanceof IProject) { |
3133 | - if (deltas[i].getKind() == IResourceDelta.ADDED) { |
3134 | - project = (IProject) resource; |
3135 | - } else if (deltas[i].getKind() == IResourceDelta.REMOVED && project == resource) { |
3136 | - project = null; |
3137 | - } |
3138 | - } |
3139 | - } |
3140 | - } |
3141 | - |
3142 | - public IProject getProject() { |
3143 | - return project; |
3144 | - } |
3145 | - } |
3146 | -} |
3147 | |
3148 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardBranchLocationPage.java' |
3149 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardBranchLocationPage.java 2009-11-18 08:48:22 +0000 |
3150 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardBranchLocationPage.java 1970-01-01 00:00:00 +0000 |
3151 | @@ -1,143 +0,0 @@ |
3152 | -/******************************************************************************* |
3153 | - * Copyright (c) 2006 Software Balm Consulting Inc. |
3154 | - * |
3155 | - * This software is licensed under the zlib/libpng license. |
3156 | - * |
3157 | - * This software is provided 'as-is', without any express or implied warranty. |
3158 | - * In no event will the authors be held liable for any damages arising from the |
3159 | - * use of this software. |
3160 | - * |
3161 | - * Permission is granted to anyone to use this software for any purpose, |
3162 | - * including commercial applications, and to alter it and redistribute it freely, |
3163 | - * subject to the following restrictions: |
3164 | - * |
3165 | - * 1. The origin of this software must not be misrepresented; you must not |
3166 | - * claim that you wrote the original software. If you use this |
3167 | - * software in a product, an acknowledgment in the product |
3168 | - * documentation would be appreciated but is not required. |
3169 | - * |
3170 | - * 2. Altered source versions must be plainly marked as such, and must not be |
3171 | - * misrepresented as being the original software. |
3172 | - * |
3173 | - * 3. This notice may not be removed or altered from any source distribution. |
3174 | - *******************************************************************************/ |
3175 | -package org.vcs.bazaar.eclipse.ui.wizards.project; |
3176 | - |
3177 | -import org.eclipse.jface.wizard.IWizardPage; |
3178 | -import org.eclipse.swt.SWT; |
3179 | -import org.eclipse.swt.events.ModifyEvent; |
3180 | -import org.eclipse.swt.events.ModifyListener; |
3181 | -import org.eclipse.swt.events.SelectionAdapter; |
3182 | -import org.eclipse.swt.events.SelectionEvent; |
3183 | -import org.eclipse.swt.layout.GridData; |
3184 | -import org.eclipse.swt.layout.GridLayout; |
3185 | -import org.eclipse.swt.widgets.Button; |
3186 | -import org.eclipse.swt.widgets.Combo; |
3187 | -import org.eclipse.swt.widgets.Composite; |
3188 | -import org.eclipse.swt.widgets.DirectoryDialog; |
3189 | -import org.eclipse.swt.widgets.Label; |
3190 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
3191 | -import org.vcs.bazaar.eclipse.core.repository.BranchFactory; |
3192 | -import org.vcs.bazaar.eclipse.ui.UITexts; |
3193 | -import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage; |
3194 | - |
3195 | -/* |
3196 | - * @author Peter Hunnisett <peter_hge at softwarebalm dot com> |
3197 | - * |
3198 | - * This file implements a wizard page which will allow the user to create a |
3199 | - * repository location. |
3200 | - * |
3201 | - */ |
3202 | -public class BranchWizardBranchLocationPage extends BzrWizardPage implements IWizardPage { |
3203 | - private String location; |
3204 | - /** |
3205 | - * |
3206 | - * @param pageName |
3207 | - * @param title |
3208 | - */ |
3209 | - public BranchWizardBranchLocationPage(String pageName, String title) { |
3210 | - super(pageName); |
3211 | - setTitle(title); |
3212 | - setDescription(UITexts.Branch_Wizard_page_description); |
3213 | - } |
3214 | - |
3215 | - @Override |
3216 | - public boolean canFlipToNextPage() { |
3217 | - return isPageComplete() && (getWizard().getNextPage(this) != null); |
3218 | - } |
3219 | - |
3220 | - public void createControl(Composite parent) { |
3221 | - final Composite outerContainer = new Composite(parent, SWT.NONE); |
3222 | - outerContainer.setLayout(new GridLayout(1,false)); |
3223 | - outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
3224 | - |
3225 | - // Three columns for the location + browse + revno |
3226 | - final Composite locationContainer = new Composite(outerContainer, SWT.NONE); |
3227 | - locationContainer.setLayout(new GridLayout(3,false)); |
3228 | - locationContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
3229 | - |
3230 | - // Box to enter the repo location |
3231 | - final Composite repoLocationContainer = new Composite(locationContainer, SWT.NONE); |
3232 | - repoLocationContainer.setLayout(new GridLayout(2,false)); |
3233 | - repoLocationContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
3234 | - |
3235 | - final Label locationLabel = new Label(repoLocationContainer, SWT.NONE); |
3236 | - locationLabel.setText(UITexts.Branch_Wizard_page_branch_location_label); |
3237 | - final GridData locationData = new GridData(SWT.VERTICAL); |
3238 | - locationData.widthHint = 500; |
3239 | - final Combo locationCombo = new Combo(repoLocationContainer, SWT.DROP_DOWN); |
3240 | - locationCombo.setLayoutData(locationData); |
3241 | - |
3242 | - final Button browseButton = new Button(locationContainer, SWT.PUSH); |
3243 | - browseButton.setText(UITexts.Branch_Wizard_page_branch_location_browse_button); |
3244 | - browseButton.addSelectionListener(new SelectionAdapter() { |
3245 | - @Override |
3246 | - public void widgetSelected(SelectionEvent e) { |
3247 | - final DirectoryDialog dialog = new DirectoryDialog(getShell()); |
3248 | - dialog.setMessage(UITexts.Branch_Wizard_page_branch_location_dialog_message); |
3249 | - final String dir = dialog.open(); |
3250 | - if (dir != null){ |
3251 | - locationCombo.setText(dir); |
3252 | - } |
3253 | - } |
3254 | - }); |
3255 | - |
3256 | - locationCombo.addSelectionListener(new SelectionAdapter(){ |
3257 | - @Override |
3258 | - public void widgetSelected(SelectionEvent e) { |
3259 | - location = locationCombo.getText(); |
3260 | - setPageComplete(isPageComplete()); |
3261 | - } |
3262 | - }); |
3263 | - locationCombo.addModifyListener(new ModifyListener(){ |
3264 | - |
3265 | - public void modifyText(ModifyEvent e) { |
3266 | - location = locationCombo.getText(); |
3267 | - setPageComplete(isPageComplete()); |
3268 | - } |
3269 | - }); |
3270 | - |
3271 | - setControl(outerContainer); |
3272 | - locationCombo.setFocus(); |
3273 | - setPageComplete(false); |
3274 | - } |
3275 | - |
3276 | - @Override |
3277 | - public boolean isPageComplete() { |
3278 | - if(location == null || location.length() == 0){ |
3279 | - setMessage(UITexts.Branch_Wizard_page_branch_location_error_location_notspecified); |
3280 | - return false; |
3281 | - } |
3282 | - if(!BranchFactory.validateBranch(location)){ |
3283 | - setMessage(UITexts.Branch_Wizard_page_branch_location_error_location_invalid); |
3284 | - return false; |
3285 | - } |
3286 | - setMessage(null); |
3287 | - return true; |
3288 | - } |
3289 | - |
3290 | - public IBzrBranch getLocation() { |
3291 | - return BranchFactory.getInstance().findOrCreateFor(location); |
3292 | - } |
3293 | - |
3294 | -} |
3295 | |
3296 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardProjectPage.java' |
3297 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardProjectPage.java 2009-11-18 08:48:22 +0000 |
3298 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardProjectPage.java 1970-01-01 00:00:00 +0000 |
3299 | @@ -1,176 +0,0 @@ |
3300 | -/** |
3301 | - * LICENSE + COPYRIGHT |
3302 | - */ |
3303 | -package org.vcs.bazaar.eclipse.ui.wizards.project; |
3304 | - |
3305 | -import org.eclipse.jface.dialogs.Dialog; |
3306 | -import org.eclipse.jface.dialogs.IMessageProvider; |
3307 | -import org.eclipse.jface.wizard.IWizardPage; |
3308 | -import org.eclipse.swt.SWT; |
3309 | -import org.eclipse.swt.events.SelectionAdapter; |
3310 | -import org.eclipse.swt.events.SelectionEvent; |
3311 | -import org.eclipse.swt.events.SelectionListener; |
3312 | -import org.eclipse.swt.layout.GridData; |
3313 | -import org.eclipse.swt.layout.GridLayout; |
3314 | -import org.eclipse.swt.layout.RowData; |
3315 | -import org.eclipse.swt.layout.RowLayout; |
3316 | -import org.eclipse.swt.widgets.Button; |
3317 | -import org.eclipse.swt.widgets.Composite; |
3318 | -import org.eclipse.swt.widgets.Group; |
3319 | -import org.eclipse.swt.widgets.Label; |
3320 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
3321 | -import org.vcs.bazaar.eclipse.ui.UITexts; |
3322 | -import org.vcs.bazaar.eclipse.ui.dialogs.ShowLogDialog; |
3323 | -import org.vcs.bazaar.eclipse.ui.widgets.RevisionNumber; |
3324 | -import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage; |
3325 | - |
3326 | -/** |
3327 | - * @author "Guillermo Gonzalez <guillo.gonzo at gmail dot com>" |
3328 | - * |
3329 | - */ |
3330 | -public class BranchWizardProjectPage extends BzrWizardPage implements IWizardPage { |
3331 | - |
3332 | - private Label textLabel; |
3333 | - private Button wizardButton; |
3334 | - private Button projectsButton; |
3335 | - private Group revisionGroup; |
3336 | - private RevisionNumber revision; |
3337 | - private IBzrBranch remoteLocation; |
3338 | - private final boolean isCheckout; |
3339 | - private Button lightWegithButton; |
3340 | - |
3341 | - protected BranchWizardProjectPage(String pageName, boolean isCheckout) { |
3342 | - super(pageName); |
3343 | - this.isCheckout = isCheckout; |
3344 | - } |
3345 | - |
3346 | - public void createControl(Composite parent) { |
3347 | - Composite outerContainer = new Composite(parent,SWT.NONE); |
3348 | - GridLayout layout = new GridLayout(); |
3349 | - layout.numColumns = 1; |
3350 | - outerContainer.setLayout(layout); |
3351 | - outerContainer.setLayoutData( |
3352 | - new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
3353 | - |
3354 | - textLabel = new Label(outerContainer, SWT.NONE); |
3355 | - GridData data = new GridData(); |
3356 | - data.widthHint = 300; |
3357 | - textLabel.setLayoutData(data); |
3358 | - |
3359 | - wizardButton = new Button(outerContainer, SWT.RADIO); |
3360 | - wizardButton.setText(UITexts.BranchWizardProjectPage_wizard); //$NON-NLS-1$ |
3361 | - wizardButton.setEnabled(true); |
3362 | - |
3363 | - projectsButton = new Button(outerContainer, SWT.RADIO); |
3364 | - projectsButton.setText(UITexts.BranchWizardProjectPage_projects); //$NON-NLS-1$ |
3365 | - |
3366 | - SelectionListener projectWizardTypeListener = new SelectionAdapter() { |
3367 | - @Override |
3368 | - public void widgetSelected(SelectionEvent e) { |
3369 | - setPageComplete(isPageComplete()); |
3370 | - } |
3371 | - }; |
3372 | - |
3373 | - projectsButton.addSelectionListener(projectWizardTypeListener); |
3374 | - wizardButton.addSelectionListener(projectWizardTypeListener); |
3375 | - |
3376 | - if(isCheckout) { |
3377 | - lightWegithButton = new Button(outerContainer, SWT.CHECK); |
3378 | - lightWegithButton.setText(UITexts.CheckoutWizardProjectPage_lightweight); |
3379 | - lightWegithButton.setSelection(false); |
3380 | - lightWegithButton.addSelectionListener(new SelectionAdapter() { |
3381 | - @Override |
3382 | - public void widgetSelected(SelectionEvent e) { |
3383 | - BranchWizardProjectPage.this.revision.setEnabled(!lightWegithButton.getSelection()); |
3384 | - } |
3385 | - }); |
3386 | - } |
3387 | - |
3388 | - createRevisionGroup(outerContainer); |
3389 | - |
3390 | - setControl(outerContainer); |
3391 | - projectsButton.setSelection(true); |
3392 | - projectsButton.setFocus(); |
3393 | - /* FIXME: TODO: Enable the project wizard |
3394 | - * temprary disabled. Until I can create the project but not the folder |
3395 | - * and can branch previous to the project folder creation |
3396 | - */ |
3397 | - wizardButton.setEnabled(false); |
3398 | - setPageComplete(false); |
3399 | - } |
3400 | - |
3401 | - private void createRevisionGroup(Composite parent) { |
3402 | - revisionGroup = new Group(parent, SWT.NULL); |
3403 | - revisionGroup.setText(UITexts.BranchWizardProjectPage_revision); //$NON-NLS-1$ |
3404 | - GridData data = new GridData(GridData.FILL_BOTH); |
3405 | - revisionGroup.setLayoutData(data); |
3406 | - revisionGroup.setLayout(new RowLayout(SWT.VERTICAL)); |
3407 | - |
3408 | - revision = new RevisionNumber(revisionGroup); |
3409 | - revision.setLayoutData(new RowData()); |
3410 | - revision.addShowLogButtonSelectionListener(new SelectionAdapter() { |
3411 | - @Override |
3412 | - public void widgetSelected(SelectionEvent e) { |
3413 | - showLog(); |
3414 | - } |
3415 | - }); |
3416 | - } |
3417 | - |
3418 | - protected void showLog() { |
3419 | - if(this.remoteLocation != null && !isLigthWeight()) { |
3420 | - ShowLogDialog dialog = new ShowLogDialog(getShell(), this.remoteLocation); |
3421 | - if(dialog.open() == Dialog.OK && dialog.getSelectedRevision() != null) { |
3422 | - revision.setRevision(dialog.getSelectedRevision().getValue()); |
3423 | - } |
3424 | - } |
3425 | - } |
3426 | - |
3427 | - protected void setLocation(IBzrBranch remoteLocation) { |
3428 | - this.remoteLocation = remoteLocation; |
3429 | - } |
3430 | - |
3431 | - @Override |
3432 | - public boolean isPageComplete() { |
3433 | - if(revision.isRevisionSelected()) { |
3434 | - if(revision.getRevision().trim().length() != 0){ |
3435 | - setMessage(null); |
3436 | - return true; |
3437 | - } |
3438 | - setMessage("specify a revision number",IMessageProvider.ERROR); |
3439 | - return false; |
3440 | - } else if(revision.isTipSelected()) { |
3441 | - setMessage(null); |
3442 | - return true; |
3443 | - } |
3444 | - return false; |
3445 | - } |
3446 | - |
3447 | - public String getRevision() { |
3448 | - return revision.getRevision(); |
3449 | - } |
3450 | - |
3451 | - public boolean useSpecificRevision() { |
3452 | - return revision.isRevisionSelected(); |
3453 | - } |
3454 | - |
3455 | - public boolean useNewProjectWizard() { |
3456 | - return wizardButton.getSelection(); |
3457 | - } |
3458 | - |
3459 | - public boolean isLigthWeight() { |
3460 | - if(isCheckout) { |
3461 | - return lightWegithButton.getSelection(); |
3462 | - } |
3463 | - return false; |
3464 | - } |
3465 | - @Override |
3466 | - public void dispose() { |
3467 | - textLabel.dispose(); |
3468 | - wizardButton.dispose(); |
3469 | - projectsButton.dispose(); |
3470 | - revision.dispose(); |
3471 | - revisionGroup.dispose(); |
3472 | - super.dispose(); |
3473 | - } |
3474 | - |
3475 | -} |
3476 | |
3477 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardSelectionPage.java' |
3478 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardSelectionPage.java 2009-11-18 08:48:22 +0000 |
3479 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/BranchWizardSelectionPage.java 1970-01-01 00:00:00 +0000 |
3480 | @@ -1,188 +0,0 @@ |
3481 | -/******************************************************************************* |
3482 | - * Copyright (c) 2006 Software Balm Consulting Inc. |
3483 | - * |
3484 | - * This software is licensed under the zlib/libpng license. |
3485 | - * |
3486 | - * This software is provided 'as-is', without any express or implied warranty. |
3487 | - * In no event will the authors be held liable for any damages arising from the |
3488 | - * use of this software. |
3489 | - * |
3490 | - * Permission is granted to anyone to use this software for any purpose, |
3491 | - * including commercial applications, and to alter it and redistribute it freely, |
3492 | - * subject to the following restrictions: |
3493 | - * |
3494 | - * 1. The origin of this software must not be misrepresented; you must not |
3495 | - * claim that you wrote the original software. If you use this |
3496 | - * software in a product, an acknowledgment in the product |
3497 | - * documentation would be appreciated but is not required. |
3498 | - * |
3499 | - * 2. Altered source versions must be plainly marked as such, and must not be |
3500 | - * misrepresented as being the original software. |
3501 | - * |
3502 | - * 3. This notice may not be removed or altered from any source distribution. |
3503 | - *******************************************************************************/ |
3504 | -package org.vcs.bazaar.eclipse.ui.wizards.project; |
3505 | - |
3506 | -import java.util.Set; |
3507 | - |
3508 | -import org.eclipse.jface.viewers.ISelectionChangedListener; |
3509 | -import org.eclipse.jface.viewers.IStructuredSelection; |
3510 | -import org.eclipse.jface.viewers.LabelProvider; |
3511 | -import org.eclipse.jface.viewers.ListViewer; |
3512 | -import org.eclipse.jface.viewers.SelectionChangedEvent; |
3513 | -import org.eclipse.jface.viewers.Viewer; |
3514 | -import org.eclipse.jface.viewers.ViewerComparator; |
3515 | -import org.eclipse.jface.wizard.IWizardPage; |
3516 | -import org.eclipse.swt.SWT; |
3517 | -import org.eclipse.swt.layout.GridData; |
3518 | -import org.eclipse.swt.layout.GridLayout; |
3519 | -import org.eclipse.swt.widgets.Button; |
3520 | -import org.eclipse.swt.widgets.Composite; |
3521 | -import org.eclipse.swt.widgets.Event; |
3522 | -import org.eclipse.swt.widgets.List; |
3523 | -import org.eclipse.swt.widgets.Listener; |
3524 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
3525 | -import org.vcs.bazaar.eclipse.core.repository.BranchLocationManager; |
3526 | -import org.vcs.bazaar.eclipse.ui.UITexts; |
3527 | -import org.vcs.bazaar.eclipse.ui.wizards.BzrWizardPage; |
3528 | - |
3529 | -/** |
3530 | - * @basedOn Peter Hunnisett <peter_hge at softwarebalm dot com> |
3531 | - * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com> |
3532 | - * This file implements a wizard page which will have the user choose a |
3533 | - * repository location or opt to create one. The creation of a repository |
3534 | - * location, if desired, is left to another wizard page. |
3535 | - * |
3536 | - */ |
3537 | -public class BranchWizardSelectionPage extends BzrWizardPage implements IWizardPage, ISelectionChangedListener { |
3538 | - private Button useExistingBranchLocation; |
3539 | - private Button createNewBranchLocation; |
3540 | - private ListViewer branchList; |
3541 | - |
3542 | - public BranchWizardSelectionPage(String pageName, String title) { |
3543 | - super(pageName); |
3544 | - setTitle(title); |
3545 | - setDescription(UITexts.Branch_Wizard_page_description_select_source_branch); |
3546 | - setPageComplete(false); |
3547 | - } |
3548 | - |
3549 | - @Override |
3550 | - public boolean canFlipToNextPage() { |
3551 | - if(useExistingBranchLocation.getSelection()) { |
3552 | - return branchList.getSelection() != null && !branchList.getSelection().isEmpty(); |
3553 | - } |
3554 | - return (createNewBranchLocation != null) && (createNewBranchLocation.getSelection()); |
3555 | - } |
3556 | - |
3557 | - public void createControl(Composite parent) { |
3558 | - Composite outerContainer = new Composite(parent, SWT.NONE); |
3559 | - GridLayout layout = new GridLayout(); |
3560 | - layout.numColumns = 1; |
3561 | - outerContainer.setLayout(layout); |
3562 | - outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); |
3563 | - |
3564 | - createNewBranchLocation = new Button(outerContainer, SWT.RADIO); |
3565 | - createNewBranchLocation.setText(UITexts.Branch_Wizard_page_init_new_branch); |
3566 | - |
3567 | - useExistingBranchLocation = new Button(outerContainer, SWT.RADIO); |
3568 | - useExistingBranchLocation.setText(UITexts.Branch_Wizard_page_use_existing_branch); |
3569 | - |
3570 | - createNewBranchLocation.addListener(SWT.Selection, new Listener() { |
3571 | - public void handleEvent(Event event) { |
3572 | - if (createNewBranchLocation.getSelection()) { |
3573 | - setPageComplete(true); |
3574 | - branchList.getControl().setEnabled(false); |
3575 | - } |
3576 | - } |
3577 | - }); |
3578 | - |
3579 | - useExistingBranchLocation.addListener(SWT.Selection, new Listener() { |
3580 | - public void handleEvent(Event event) { |
3581 | - if (useExistingBranchLocation.getSelection()) { |
3582 | - boolean isPageComplete = false; |
3583 | - if(branchList.getSelection() != null && !branchList.getSelection().isEmpty()) { |
3584 | - isPageComplete = true; |
3585 | - } |
3586 | - setPageComplete(isPageComplete); |
3587 | - branchList.getControl().setEnabled(true); |
3588 | - } |
3589 | - } |
3590 | - }); |
3591 | - |
3592 | - branchList = createBranchList(outerContainer); |
3593 | - |
3594 | - setControl(outerContainer); |
3595 | - |
3596 | - // This will trigger a setPageComplete call to set the next button |
3597 | - // appropriately. |
3598 | - createNewBranchLocation.setSelection(true); |
3599 | - createNewBranchLocation.setFocus(); |
3600 | - useExistingBranchLocation.setSelection(false); |
3601 | - branchList.getControl().setEnabled(false); |
3602 | - } |
3603 | - |
3604 | - private ListViewer createBranchList(Composite parent) { |
3605 | - ListViewer viewer = new ListViewer(parent); |
3606 | - viewer.setLabelProvider(new LabelProvider() { |
3607 | - @Override |
3608 | - public String getText(Object element) { |
3609 | - IBzrBranch branch = (IBzrBranch)element; |
3610 | - return branch.getBranchLocation().toString(); |
3611 | - } |
3612 | - }); |
3613 | - viewer.addSelectionChangedListener(this); |
3614 | - viewer.setComparator(new ViewerComparator() { |
3615 | - @Override |
3616 | - public int compare(Viewer viewer, Object e1, Object e2) { |
3617 | - IBzrBranch b1 = (IBzrBranch)e1; |
3618 | - IBzrBranch b2 = (IBzrBranch)e2; |
3619 | - return b1.compareTo(b2); |
3620 | - } |
3621 | - }); |
3622 | - List list = viewer.getList(); |
3623 | - list.setLayoutData(new GridData(GridData.FILL_BOTH)); |
3624 | - |
3625 | - Set<IBzrBranch> branchList = BranchLocationManager.getInstance().getAllBranches(); |
3626 | - for (IBzrBranch bzrBranch : branchList) { |
3627 | - viewer.add(bzrBranch); |
3628 | - } |
3629 | - return viewer; |
3630 | - } |
3631 | - |
3632 | - /* |
3633 | - * For the moment only handle the change selection in the branch list |
3634 | - * |
3635 | - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) |
3636 | - */ |
3637 | - public void selectionChanged(SelectionChangedEvent event) { |
3638 | - if(event.getSelection() != null) { |
3639 | - setPageComplete(true); |
3640 | - } |
3641 | - } |
3642 | - |
3643 | - public boolean isCreateNewBranchLocation() { |
3644 | - if(createNewBranchLocation != null) { |
3645 | - return createNewBranchLocation.getSelection(); |
3646 | - } |
3647 | - return false; |
3648 | - } |
3649 | - |
3650 | - public IBzrBranch getLocation() { |
3651 | - IStructuredSelection selection = (IStructuredSelection)branchList.getSelection(); |
3652 | - return (IBzrBranch)selection.getFirstElement(); |
3653 | - } |
3654 | - |
3655 | - @Override |
3656 | - public void dispose() { |
3657 | - if(useExistingBranchLocation != null) { |
3658 | - useExistingBranchLocation.dispose(); |
3659 | - } |
3660 | - if(createNewBranchLocation != null) { |
3661 | - createNewBranchLocation.dispose(); |
3662 | - } |
3663 | - if(branchList != null) { |
3664 | - branchList.getList().dispose(); |
3665 | - } |
3666 | - super.dispose(); |
3667 | - } |
3668 | -} |
3669 | |
3670 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutFromProjectWizard.java' |
3671 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutFromProjectWizard.java 2009-11-18 08:48:22 +0000 |
3672 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutFromProjectWizard.java 1970-01-01 00:00:00 +0000 |
3673 | @@ -1,57 +0,0 @@ |
3674 | -/** |
3675 | - * LICENSE + COPYRIGHT |
3676 | - */ |
3677 | -package org.vcs.bazaar.eclipse.ui.wizards.project; |
3678 | - |
3679 | -import org.eclipse.core.resources.IProject; |
3680 | -import org.eclipse.core.resources.IProjectDescription; |
3681 | -import org.eclipse.core.resources.ResourcesPlugin; |
3682 | -import org.eclipse.jface.dialogs.MessageDialog; |
3683 | -import org.eclipse.jface.wizard.WizardDialog; |
3684 | -import org.eclipse.swt.widgets.Shell; |
3685 | -import org.vcs.bazaar.eclipse.core.model.IBzrBranch; |
3686 | -import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
3687 | -import org.vcs.bazaar.eclipse.ui.operations.CheckoutAsProjectOperation; |
3688 | - |
3689 | -/** |
3690 | - * This class implements the checkout(and lightweight) from project wizard |
3691 | - * |
3692 | - * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com> |
3693 | - */ |
3694 | -public class CheckoutFromProjectWizard extends BranchFromProjectWizard { |
3695 | - |
3696 | - private boolean lightweight; |
3697 | - |
3698 | - public CheckoutFromProjectWizard(Shell shell, IBzrBranch branch, boolean lightweight) { |
3699 | - super(shell, branch); |
3700 | - this.lightweight = lightweight; |
3701 | - } |
3702 | - |
3703 | - public static CheckoutFromProjectWizard open(Shell shell, IBzrBranch branch, boolean lightweight) { |
3704 | - CheckoutFromProjectWizard wizard = new CheckoutFromProjectWizard(shell, branch, lightweight); |
3705 | - WizardDialog dialog = new WizardDialog(shell, wizard); |
3706 | - dialog.open(); |
3707 | - return wizard; |
3708 | - } |
3709 | - |
3710 | - |
3711 | - @Override |
3712 | - public boolean performOperation(IProject project) { |
3713 | - CheckoutAsProjectOperation checkoutOp = null; |
3714 | - if(project == null) { |
3715 | - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName()); |
3716 | - description.setLocation(getNewProjectPage().getLocationPath()); |
3717 | - checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision(), lightweight); |
3718 | - } else { |
3719 | - checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision(), lightweight); |
3720 | - } |
3721 | - try { |
3722 | - checkoutOp.run(); |
3723 | - } catch (Exception e) { |
3724 | - MessageDialog.openError(this.getShell(), "Error while executing branch operation", e.getMessage()); |
3725 | - EclipseBazaarUI.log(e.getMessage(), e); |
3726 | - return false; |
3727 | - } |
3728 | - return true; |
3729 | - } |
3730 | -} |
3731 | |
3732 | === removed file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutWizard.java' |
3733 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutWizard.java 2009-11-18 08:48:22 +0000 |
3734 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/wizards/project/CheckoutWizard.java 1970-01-01 00:00:00 +0000 |
3735 | @@ -1,45 +0,0 @@ |
3736 | -/** |
3737 | - * LICENSE + COPYRIGHT |
3738 | - */ |
3739 | -package org.vcs.bazaar.eclipse.ui.wizards.project; |
3740 | - |
3741 | -import org.eclipse.core.resources.IProject; |
3742 | -import org.eclipse.core.resources.IProjectDescription; |
3743 | -import org.eclipse.core.resources.ResourcesPlugin; |
3744 | -import org.eclipse.jface.dialogs.MessageDialog; |
3745 | -import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
3746 | -import org.vcs.bazaar.eclipse.ui.operations.CheckoutAsProjectOperation; |
3747 | - |
3748 | -/** |
3749 | - * This class implements the new wizard extension. |
3750 | - * |
3751 | - * @author Guillermo Gonzalez <guillo.gonzo at gmail dot com> |
3752 | - */ |
3753 | -public class CheckoutWizard extends BranchWizard { |
3754 | - |
3755 | - |
3756 | - @Override |
3757 | - protected boolean performOperation(IProject project) { |
3758 | - CheckoutAsProjectOperation checkoutOp = null; |
3759 | - if(project == null) { |
3760 | - IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(getNewProjectPage().getProjectName()); |
3761 | - description.setLocation(getNewProjectPage().getLocationPath()); |
3762 | - checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), description, getProjectPage().getRevision(), getProjectPage().isLigthWeight()); |
3763 | - } else { |
3764 | - checkoutOp = new CheckoutAsProjectOperation(this.getContainer(), getRemoteLocation(), project, getProjectPage().getRevision(), getProjectPage().isLigthWeight()); |
3765 | - } |
3766 | - try { |
3767 | - checkoutOp.run(); |
3768 | - } catch (Exception e) { |
3769 | - MessageDialog.openError(this.getShell(), "Error while executing checkout operation", e.getMessage()); |
3770 | - EclipseBazaarUI.log(e.getMessage(), e); |
3771 | - return false; |
3772 | - } |
3773 | - return true; |
3774 | - } |
3775 | - |
3776 | - @Override |
3777 | - protected boolean isCheckout() { |
3778 | - return true; |
3779 | - } |
3780 | -} |
3781 | |
3782 | === modified file 'pom.xml' |
3783 | --- pom.xml 2011-07-19 05:32:49 +0000 |
3784 | +++ pom.xml 2013-02-19 07:30:34 +0000 |
3785 | @@ -6,7 +6,7 @@ |
3786 | </prerequisites> |
3787 | <groupId>org.vcs.bazaar.eclipse</groupId> |
3788 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
3789 | - <version>1.1.1-SNAPSHOT</version> |
3790 | + <version>1.2.0-SNAPSHOT</version> |
3791 | <packaging>pom</packaging> |
3792 | <scm> |
3793 | <connection>scm:bazaar:lp:bzr-eclipse</connection> |
3794 | @@ -17,7 +17,7 @@ |
3795 | <url>http://bugs.launchpad.net/bzr-eclipse</url> |
3796 | </issueManagement> |
3797 | <properties> |
3798 | - <bzr-eclipse-version>1.1.1-SNAPSHOT</bzr-eclipse-version> |
3799 | + <bzr-eclipse-version>1.2.0-SNAPSHOT</bzr-eclipse-version> |
3800 | <tycho-version>0.10.0</tycho-version> |
3801 | <platform-version-name>helios</platform-version-name> |
3802 | <eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site> |
3803 | |
3804 | === modified file 'redstone.xmlrpc/pom.xml' |
3805 | --- redstone.xmlrpc/pom.xml 2011-03-22 15:05:45 +0000 |
3806 | +++ redstone.xmlrpc/pom.xml 2013-02-19 07:30:34 +0000 |
3807 | @@ -4,7 +4,7 @@ |
3808 | <parent> |
3809 | <groupId>org.vcs.bazaar.eclipse</groupId> |
3810 | <artifactId>org.vcs.bazaar.eclipse</artifactId> |
3811 | - <version>1.1.1-SNAPSHOT</version> |
3812 | + <version>1.2.0-SNAPSHOT</version> |
3813 | <relativePath>../pom.xml</relativePath> |
3814 | </parent> |
3815 | <groupId>redstone.xmlrpc</groupId> |
On 02/19/2013 08:31 AM, Alexander Taler wrote: /code.launchpad .net/~alex- idereal/ bzr-eclipse/ bzr-eclipse/ +merge/ 149207 anager
> 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:/
>
> == 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
> + BranchLocationM
>
Hi Alex,
I am planning to merge a branch I create based on /code.launchpad .net/%7Epiastuc ki/bzr- eclipse/ history- and-compare>
lp:~alex-idereal/bzr-eclipse/bzr-eclipse some time ago.
The branch is named
lp:~piastucki/bzr-eclipse/history-and-compare.<https:/
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