Merge lp://staging/~walles/bzr-eclipse/perf+logging+code+usability into lp://staging/~verterok/bzr-eclipse/trunk

Proposed by Johan Walles
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 219
Merged at revision: not available
Proposed branch: lp://staging/~walles/bzr-eclipse/perf+logging+code+usability
Merge into: lp://staging/~verterok/bzr-eclipse/trunk
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~walles/bzr-eclipse/perf+logging+code+usability
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Review via email: mp+7403@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Johan Walles (walles) wrote :

This branch:
* Cuts plugin initialization time from 15s to 3s.
* Passes the core unit tests (this is an improvement from trunk).
* Adds automatic code formatting for code readability.
* Uses commons logging and goes nicely with lp:~walles/bzr-java-lib/commons-logging
* Fixes new-version-of-Bazaar message for usability.

Revision history for this message
Guillermo Gonzalez (verterok) wrote :

Apologize the delay,
Looks awesome!!
Thanks a lot for working on this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'org.vcs.bazaar.eclipse.client/.classpath'
2--- org.vcs.bazaar.eclipse.client/.classpath 2009-04-20 18:28:32 +0000
3+++ org.vcs.bazaar.eclipse.client/.classpath 2009-04-27 18:42:32 +0000
4@@ -3,6 +3,7 @@
5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
6 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
7 <classpathentry exported="true" kind="lib" path="bzr-java-lib-0.5.1-SNAPSHOT.jar" sourcepath="org.vcs.bazaar.eclipse.clientsrc.zip"/>
8+ <classpathentry exported="true" kind="lib" path="commons-logging-1.1.1.jar"/>
9 <classpathentry exported="true" kind="lib" path="kxml2-min-2.3.0.jar" sourcepath="org.vcs.bazaar.eclipse.clientsrc.zip"/>
10 <classpathentry exported="true" kind="lib" path="xmlrpc-1.1.jar" sourcepath="org.vcs.bazaar.eclipse.clientsrc.zip"/>
11 <classpathentry exported="true" kind="lib" path="xmlrpc-client-1.1.jar" sourcepath="org.vcs.bazaar.eclipse.clientsrc.zip"/>
12
13=== modified file 'org.vcs.bazaar.eclipse.client/META-INF/MANIFEST.MF'
14--- org.vcs.bazaar.eclipse.client/META-INF/MANIFEST.MF 2009-02-21 23:16:34 +0000
15+++ org.vcs.bazaar.eclipse.client/META-INF/MANIFEST.MF 2009-04-18 17:37:48 +0000
16@@ -1,6 +1,7 @@
17 Manifest-Version: 1.0
18 Bundle-Name: Bazaar client library
19 Bundle-ClassPath: bzr-java-lib-0.5.1-SNAPSHOT.jar,
20+ commons-logging-1.1.1.jar,
21 kxml2-min-2.3.0.jar,
22 xmlrpc-1.1.jar,
23 xmlrpc-client-1.1.jar
24
25=== modified file 'org.vcs.bazaar.eclipse.client/build.properties'
26--- org.vcs.bazaar.eclipse.client/build.properties 2009-01-17 23:34:36 +0000
27+++ org.vcs.bazaar.eclipse.client/build.properties 2009-04-18 17:37:48 +0000
28@@ -1,4 +1,5 @@
29 bin.includes = META-INF/,\
30+ commons-logging-1.1.1.jar,\
31 kxml2-min-2.3.0.jar,\
32 xmlrpc-1.1.jar,\
33 xmlrpc-client-1.1.jar,\
34
35=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/EclipseBazaarCore.java'
36--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/EclipseBazaarCore.java 2008-12-13 23:37:48 +0000
37+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/EclipseBazaarCore.java 2009-04-18 18:47:58 +0000
38@@ -68,11 +68,8 @@
39 plugin = this;
40 }
41
42- /**
43- * This method is called upon plug-in activation
44- * @throws Exception
45- */
46- public void start(BundleContext context) throws Exception {
47+ @Override
48+ public void start(BundleContext context) throws Exception {
49 super.start(context);
50 getPluginPreferences().addPropertyChangeListener(preferenceListener);
51 inventoryCacheManager = new InventoryCacheManager();
52@@ -91,24 +88,30 @@
53 }
54 }
55
56+ /**
57+ * Set bazaar java library preferences from Eclipse preferences.
58+ */
59 public void updateClientPreferences() {
60- if (clientPreferences == null)
61- clientPreferences = BazaarClientPreferences.getInstance();
62- clientPreferences.set(BazaarPreference.EXECUTABLE, getPluginPreferences().getString(BazaarPreference.EXECUTABLE.name()));
63+ if (clientPreferences == null) {
64+ clientPreferences = BazaarClientPreferences.getInstance();
65+ }
66+ String bzrExeName = getPluginPreferences().getString(BazaarPreference.EXECUTABLE.name());
67+ if (bzrExeName != null && ! "".equals(bzrExeName)) {
68+ // User has explicitly set a bazaar executable to use
69+ clientPreferences.set(BazaarPreference.EXECUTABLE, bzrExeName);
70+ }
71 clientPreferences.set(BazaarPreference.BZR_EMAIL, getPluginPreferences().getString(BazaarPreference.BZR_EMAIL.name()));
72 clientPreferences.set(BazaarPreference.BZR_XMLRPC_PORT, getPluginPreferences().getString(BazaarPreference.BZR_XMLRPC_PORT.name()));
73 String pluginPath = getPluginPreferences().getString(BazaarPreference.BZR_PLUGIN_PATH.name());
74- if (pluginPath != null && pluginPath.length() > 0)
75- clientPreferences.set(BazaarPreference.BZR_PLUGIN_PATH, pluginPath);
76- else
77- clientPreferences.unset(BazaarPreference.BZR_PLUGIN_PATH);
78+ if (pluginPath != null && pluginPath.length() > 0) {
79+ clientPreferences.set(BazaarPreference.BZR_PLUGIN_PATH, pluginPath);
80+ } else {
81+ clientPreferences.unset(BazaarPreference.BZR_PLUGIN_PATH);
82+ }
83 }
84
85- /**
86- * This method is called when the plug-in is stopped
87- * @throws Exception
88- */
89- public void stop(BundleContext context) throws Exception {
90+ @Override
91+ public void stop(BundleContext context) throws Exception {
92 BranchLocationManager.getInstance().stop();
93 ResourcesPlugin.getWorkspace().removeResourceChangeListener(fileModificationManager);
94 ResourcesPlugin.getWorkspace().removeResourceChangeListener(metaDirChangeListener);
95@@ -159,8 +162,9 @@
96 if (client != null) {
97 // to prevent adding a null listener (this happen when the core
98 // plugin is initialized before the ui plugin)
99- if (getConsoleListener() != null)
100- client.addNotifyListener(getConsoleListener());
101+ if (getConsoleListener() != null) {
102+ client.addNotifyListener(getConsoleListener());
103+ }
104 }
105 return client;
106 }
107@@ -252,12 +256,14 @@
108 * @param monitor
109 */
110 public static void checkCanceled(IProgressMonitor monitor) {
111- if (monitor != null && monitor.isCanceled())
112- throw new OperationCanceledException();
113+ if (monitor != null && monitor.isCanceled()) {
114+ throw new OperationCanceledException();
115+ }
116 }
117 public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
118- if (monitor == null)
119- return new NullProgressMonitor();
120+ if (monitor == null) {
121+ return new NullProgressMonitor();
122+ }
123 return monitor;
124 }
125
126@@ -267,10 +273,12 @@
127 * @return
128 */
129 public static IProgressMonitor subProgressMonitorFor(IProgressMonitor monitor) {
130- if (monitor == null)
131- return new NullProgressMonitor();
132- if (monitor instanceof NullProgressMonitor)
133- return monitor;
134+ if (monitor == null) {
135+ return new NullProgressMonitor();
136+ }
137+ if (monitor instanceof NullProgressMonitor) {
138+ return monitor;
139+ }
140 return new SubProgressMonitor(monitor, 1000);
141 }
142
143
144=== modified file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/log/LogCacheManager.java'
145--- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/log/LogCacheManager.java 2008-12-02 18:37:38 +0000
146+++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/log/LogCacheManager.java 2009-04-27 18:40:39 +0000
147@@ -52,8 +52,7 @@
148 * Returns the last log of the given resource. If is not present in
149 * cache, it will be retrieved using the actual strategy.
150 *
151- * @param resource
152- * whose last log is required.
153+ * @param resource whose last log is required.
154 * @throws CoreException
155 */
156 public IBazaarLogMessage getLastLog(IResource resource) throws CoreException {
157@@ -65,8 +64,7 @@
158 * Returns the logs of the given resource. If is not present in
159 * cache, it will be retrieved using the actual strategy.
160 *
161- * @param resource
162- * whose last log is required.
163+ * @param resource whose last log is required.
164 * @return a List<IBazaarLogMessage> for the corresponding resource
165 * (the size is dependent on the limit setup in the preferences)
166 * @throws CoreException
167@@ -77,9 +75,6 @@
168
169 /**
170 * see {@link #getLogs(IResource)}
171- * @param resource
172- * @return
173- * @throws CoreException
174 */
175 public List<IBazaarLogMessage> getLogs(IBzrResource resource) throws CoreException {
176 return getLogs(resource, logUpdater, getLock(resource));
177@@ -124,11 +119,6 @@
178
179 /**
180 * refresh the cache and returns if the resource is in it.
181- *
182- * @param resource
183- * @param strategy
184- * @return
185- * @throws CoreException
186 */
187 private List<IBazaarLogMessage> basicGetLog(IBzrResource resource, LogUpdater strategy) throws CoreException {
188 EclipseBazaarCore.trace(ITracingOptions.LOG_CACHE, "LogCacheManager.basicGetlog: " + resource.getName());
189@@ -148,10 +138,6 @@
190
191 /**
192 * Purge the cache of the spacified IProject from the cache
193- *
194- * @param root
195- * @param deep
196- * @throws CoreException
197 */
198 public void purgeCache(IProject root) throws CoreException {
199 logCache.purgeCache(root);
200@@ -174,5 +160,4 @@
201 }
202 }
203 }
204-
205 }
206
207=== added file 'org.vcs.bazaar.eclipse.ui/.settings/org.eclipse.jdt.core.prefs'
208--- org.vcs.bazaar.eclipse.ui/.settings/org.eclipse.jdt.core.prefs 1970-01-01 00:00:00 +0000
209+++ org.vcs.bazaar.eclipse.ui/.settings/org.eclipse.jdt.core.prefs 2009-04-29 05:52:15 +0000
210@@ -0,0 +1,258 @@
211+#Wed Apr 29 06:48:26 GMT+01:00 2009
212+eclipse.preferences.version=1
213+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
214+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
215+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
216+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
217+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
218+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
219+org.eclipse.jdt.core.formatter.alignment_for_assignment=16
220+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
221+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
222+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
223+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
224+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
225+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
226+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=80
227+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=80
228+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
229+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=32
230+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
231+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=32
232+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=32
233+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=32
234+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
235+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
236+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
237+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
238+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
239+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
240+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
241+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
242+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
243+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
244+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
245+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line_on_wrap
246+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line_on_wrap
247+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
248+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line_on_wrap
249+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line_on_wrap
250+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line_on_wrap
251+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line_on_wrap
252+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line_on_wrap
253+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line_on_wrap
254+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
255+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line_on_wrap
256+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
257+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
258+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
259+org.eclipse.jdt.core.formatter.comment.format_header=false
260+org.eclipse.jdt.core.formatter.comment.format_html=true
261+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
262+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
263+org.eclipse.jdt.core.formatter.comment.format_source_code=true
264+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
265+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
266+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
267+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
268+org.eclipse.jdt.core.formatter.comment.line_length=80
269+org.eclipse.jdt.core.formatter.compact_else_if=true
270+org.eclipse.jdt.core.formatter.continuation_indentation=1
271+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
272+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
273+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
274+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
275+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
276+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
277+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
278+org.eclipse.jdt.core.formatter.indent_empty_lines=false
279+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
280+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
281+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
282+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
283+org.eclipse.jdt.core.formatter.indentation.size=4
284+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
285+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
286+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
287+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
288+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
289+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
290+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
291+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
292+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
293+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
294+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
295+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
296+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
297+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
298+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
299+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
300+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
301+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
302+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
303+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
304+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
305+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
306+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
307+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
308+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
309+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
310+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
311+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
312+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
313+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
314+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
315+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
316+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
317+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
318+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
319+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
320+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
321+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
322+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
323+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
324+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
325+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
326+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
327+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
328+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
329+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
330+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
331+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
332+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
333+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
334+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
335+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
336+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
337+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
338+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
339+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
340+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
341+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
342+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
343+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
344+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
345+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
346+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
347+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
348+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
349+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
350+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
351+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
352+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
353+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
354+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
355+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
356+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
357+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
358+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
359+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
360+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
361+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
362+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
363+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
364+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
365+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
366+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
367+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
368+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
369+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
370+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
371+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
372+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
373+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
374+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
375+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
376+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
377+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
378+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
379+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
380+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
381+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
382+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
383+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
384+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
385+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
386+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
387+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
388+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
389+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
390+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
391+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
392+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
393+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
394+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
395+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
396+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
397+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
398+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
399+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
400+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
401+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
402+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
403+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
404+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
405+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
406+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
407+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
408+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
409+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
410+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
411+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
412+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
413+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
414+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
415+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
416+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
417+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
418+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
419+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
420+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
421+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
422+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
423+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
424+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
425+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
426+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
427+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
428+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
429+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
430+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
431+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
432+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
433+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
434+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
435+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
436+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
437+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
438+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
439+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
440+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
441+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
442+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
443+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
444+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
445+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
446+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
447+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
448+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
449+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
450+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
451+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
452+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
453+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
454+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
455+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
456+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
457+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
458+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
459+org.eclipse.jdt.core.formatter.lineSplit=100
460+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
461+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
462+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
463+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
464+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
465+org.eclipse.jdt.core.formatter.tabulation.char=space
466+org.eclipse.jdt.core.formatter.tabulation.size=4
467+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
468+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
469
470=== added file 'org.vcs.bazaar.eclipse.ui/.settings/org.eclipse.jdt.ui.prefs'
471--- org.vcs.bazaar.eclipse.ui/.settings/org.eclipse.jdt.ui.prefs 1970-01-01 00:00:00 +0000
472+++ org.vcs.bazaar.eclipse.ui/.settings/org.eclipse.jdt.ui.prefs 2009-04-29 06:02:45 +0000
473@@ -0,0 +1,56 @@
474+#Wed Apr 29 06:57:54 GMT+01:00 2009
475+eclipse.preferences.version=1
476+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
477+formatter_profile=_Bzr Java
478+formatter_settings_version=11
479+sp_cleanup.add_default_serial_version_id=true
480+sp_cleanup.add_generated_serial_version_id=false
481+sp_cleanup.add_missing_annotations=false
482+sp_cleanup.add_missing_deprecated_annotations=true
483+sp_cleanup.add_missing_methods=false
484+sp_cleanup.add_missing_nls_tags=false
485+sp_cleanup.add_missing_override_annotations=true
486+sp_cleanup.add_serial_version_id=false
487+sp_cleanup.always_use_blocks=true
488+sp_cleanup.always_use_parentheses_in_expressions=true
489+sp_cleanup.always_use_this_for_non_static_field_access=false
490+sp_cleanup.always_use_this_for_non_static_method_access=false
491+sp_cleanup.convert_to_enhanced_for_loop=true
492+sp_cleanup.correct_indentation=false
493+sp_cleanup.format_source_code=true
494+sp_cleanup.format_source_code_changes_only=true
495+sp_cleanup.make_local_variable_final=false
496+sp_cleanup.make_parameters_final=false
497+sp_cleanup.make_private_fields_final=true
498+sp_cleanup.make_type_abstract_if_missing_method=false
499+sp_cleanup.make_variable_declarations_final=false
500+sp_cleanup.never_use_blocks=false
501+sp_cleanup.never_use_parentheses_in_expressions=false
502+sp_cleanup.on_save_use_additional_actions=true
503+sp_cleanup.organize_imports=false
504+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
505+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
506+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
507+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
508+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
509+sp_cleanup.remove_private_constructors=true
510+sp_cleanup.remove_trailing_whitespaces=false
511+sp_cleanup.remove_trailing_whitespaces_all=true
512+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
513+sp_cleanup.remove_unnecessary_casts=true
514+sp_cleanup.remove_unnecessary_nls_tags=false
515+sp_cleanup.remove_unused_imports=true
516+sp_cleanup.remove_unused_local_variables=false
517+sp_cleanup.remove_unused_private_fields=true
518+sp_cleanup.remove_unused_private_members=false
519+sp_cleanup.remove_unused_private_methods=true
520+sp_cleanup.remove_unused_private_types=true
521+sp_cleanup.sort_members=false
522+sp_cleanup.sort_members_all=false
523+sp_cleanup.use_blocks=true
524+sp_cleanup.use_blocks_only_for_return_and_throw=false
525+sp_cleanup.use_parentheses_in_expressions=false
526+sp_cleanup.use_this_for_non_static_field_access=false
527+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
528+sp_cleanup.use_this_for_non_static_method_access=false
529+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
530
531=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java'
532--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java 2009-01-01 05:01:52 +0000
533+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/EclipseBazaarUI.java 2009-04-28 16:09:12 +0000
534@@ -43,8 +43,12 @@
535
536 private static final String LOGVIEW_ID = "org.vcs.bazaar.eclipse.ui.views.LogView";
537 private static final String MISSINGVIEW_ID = "org.vcs.bazaar.eclipse.ui.views.MissingView";
538- // The shared instance.
539+
540+ /**
541+ * The shared instance.
542+ */
543 private static EclipseBazaarUI plugin;
544+
545 private BzrOutputConsole console;
546 private final IPropertyChangeListener preferenceChangeListener = new PreferenceStoreChangeListener();
547 private BundleListener bundleListener;
548@@ -58,12 +62,11 @@
549 plugin = this;
550 }
551
552- /**
553- * This method is called upon plug-in activation.
554- *
555- * @throws Exception
556- */
557- public void start(BundleContext context) throws Exception {
558+ /**
559+ * This method is called upon plug-in activation.
560+ */
561+ @Override
562+ public void start(BundleContext context) throws Exception {
563 bundleListener = new BundleListener() {
564 public void bundleChanged(BundleEvent event) {
565 if (event.getBundle() == getBundle()
566@@ -95,8 +98,6 @@
567 };
568 context.addBundleListener(bundleListener);
569 super.start(context);
570- // looks like this is done in the constructor of the BzrOuputConsole, it might be safe to remove the following line.
571- EclipseBazaarCore.getDefault().setConsoleListener(getConsole());
572 getPreferenceStore().addPropertyChangeListener(preferenceChangeListener);
573 if(!getWorkbench().getDecoratorManager().getEnabled(BazaarLightweightDecorator.class.getName())) {
574 getWorkbench().getDecoratorManager().setEnabled(BazaarLightweightDecorator.class.getName(), true);
575@@ -108,10 +109,9 @@
576
577 /**
578 * This method is called when the plug-in is stopped
579- *
580- * @throws Exception
581 */
582- public void stop(BundleContext context) throws Exception {
583+ @Override
584+ public void stop(BundleContext context) throws Exception {
585 refreshExecListener.removeFrom((ICommandService) this.getWorkbench().getService(ICommandService.class));
586 getPreferenceStore().removePropertyChangeListener(preferenceChangeListener);
587 getConsole().shutdown();
588@@ -136,8 +136,7 @@
589 * Returns an image descriptor for the image file at the given plug-in
590 * relative path.
591 *
592- * @param path
593- * the path
594+ * @param path the path
595 * @return the image descriptor
596 */
597 public static ImageDescriptor getImageDescriptor(String path) {
598@@ -154,7 +153,9 @@
599 */
600 public static IWorkbenchPage getActivePage() {
601 final IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow();
602- if (window == null) return null;
603+ if (window == null) {
604+ return null;
605+ }
606 return window.getActivePage();
607 }
608
609@@ -207,7 +208,9 @@
610 }
611 //new TimeoutProgressMonitorDialog(parent, TIMEOUT).run(true /*fork*/, cancelable, runnable);
612 } finally {
613- if (createdShell && parent != null) parent.dispose();
614+ if (createdShell && parent != null) {
615+ parent.dispose();
616+ }
617 }
618 }
619
620
621=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/console/BzrOutputConsole.java'
622--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/console/BzrOutputConsole.java 2008-02-29 16:35:35 +0000
623+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/console/BzrOutputConsole.java 2009-04-28 15:58:48 +0000
624@@ -32,6 +32,7 @@
625 import org.vcs.bazaar.eclipse.core.client.IConsoleListener;
626 import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
627 import org.vcs.bazaar.eclipse.ui.UITexts;
628+import org.vcs.bazaar.eclipse.ui.console.ConsoleDocument.ConsoleLine;
629 import org.vcs.bazaar.eclipse.ui.preferences.BazaarPreferenceConstants;
630
631 /**
632@@ -62,9 +63,13 @@
633
634 private ConsoleDocument document;
635
636- // Indicates whether the console is visible in the Console view
637+ /**
638+ * Indicates whether the console is visible in the Console view
639+ */
640 private boolean visible = false;
641- // Indicates whether the console's streams have been initialized
642+ /**
643+ * Indicates whether the console's streams have been initialized
644+ */
645 private boolean initialized = false;
646
647 /**
648@@ -73,8 +78,7 @@
649 */
650 class MyLifecycle implements org.eclipse.ui.console.IConsoleListener {
651 public void consolesAdded(IConsole[] consoles) {
652- for (int i = 0; i < consoles.length; i++) {
653- IConsole console = consoles[i];
654+ for (IConsole console : consoles) {
655 if (console == BzrOutputConsole.this) {
656 init();
657 }
658@@ -83,8 +87,7 @@
659 }
660
661 public void consolesRemoved(IConsole[] consoles) {
662- for (int i = 0; i < consoles.length; i++) {
663- IConsole console = consoles[i];
664+ for (IConsole console : consoles) {
665 if (console == BzrOutputConsole.this) {
666 ConsolePlugin.getDefault().getConsoleManager().removeConsoleListener(this);
667 dispose();
668@@ -108,12 +111,8 @@
669 EclipseBazaarUI.getDefault().getPreferenceStore().addPropertyChangeListener(BzrOutputConsole.this);
670 }
671
672- /*
673- * (non-Javadoc)
674- *
675- * @see org.eclipse.ui.console.AbstractConsole#init()
676- */
677- protected void init() {
678+ @Override
679+ protected void init() {
680 // Called when console is added to the console view
681 super.init();
682
683@@ -167,8 +166,7 @@
684 synchronized (document) {
685 visible = true;
686 ConsoleDocument.ConsoleLine[] lines = document.getLines();
687- for (int i = 0; i < lines.length; i++) {
688- ConsoleDocument.ConsoleLine line = lines[i];
689+ for (ConsoleLine line : lines) {
690 appendLine(line.type, line.line);
691 }
692 document.clear();
693@@ -220,12 +218,8 @@
694 manager.showConsoleView(this);
695 }
696
697- /*
698- * (non-Javadoc)
699- *
700- * @see org.eclipse.ui.console.MessageConsole#dispose()
701- */
702- protected void dispose() {
703+ @Override
704+ protected void dispose() {
705 // Here we can't call super.dispose() because we actually want the
706 // partitioner to remain
707 // connected, but we won't show lines until the console is added to the
708
709=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/CommitDialog.java'
710--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/CommitDialog.java 2008-12-02 14:43:35 +0000
711+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/CommitDialog.java 2009-04-29 05:35:40 +0000
712@@ -74,466 +74,480 @@
713
714 /**
715 * <br>
716- * A commit dialog box allowing choosing of what files to commit and a commit message for those files. Untracked files may also be chosen.
717- * <br>
718+ * A commit dialog box allowing choosing of what files to commit and a commit
719+ * message for those files. Untracked files may also be chosen. <br>
720 *
721- * @author
722 * @author Peter Hunnisett <peter_hge at softwarebalm dot com> <br>
723 * @modifiedBy Guillermo Gonzalez
724 *
725 */
726 public class CommitDialog extends TrayDialog {
727
728- private static String DEFAULT_COMMIT_MESSAGE = UITexts.CommitDialog_defaultCommitMessage;
729-
730- private class CommittableFilesFilter extends ViewerFilter {
731-
732- public CommittableFilesFilter() {
733- super();
734- }
735-
736- /**
737- * Filter out un commitable files (i.e. ! -> deleted but still tracked)
738- */
739- public boolean select(Viewer viewer, Object parentElement, Object element) {
740- if (element instanceof IBzrResourceStatus) {
741- IBzrResourceStatus status = ((IBzrResourceStatus) element);
742- IBzrLocalResource bzrResource = status.getResource();
743- if (status.isUnchanged() || status.isIgnored() || (!status.isDeleted() && bzrResource.getIResource().getType() == IResource.PROJECT))
744- return false;
745- }
746- return true;
747- }
748- }
749-
750- public class AdaptableCommitList implements IAdaptable, IWorkbenchAdapter {
751- private IBzrResourceStatus[] resources;
752-
753- public AdaptableCommitList(List<IBzrResourceStatus> resources) {
754- this.resources = resources.toArray(new IBzrResourceStatus[0]);
755- }
756-
757- public Object[] getChildren(Object o) {
758- return resources;
759- }
760-
761- public ImageDescriptor getImageDescriptor(Object object) {
762- return null;
763- }
764-
765- public String getLabel(Object o) {
766- if (o instanceof IBzrResourceStatus)
767- return ((IBzrResourceStatus) o).getStatus().toString();
768- return o == null ? "" : o.toString();//$NON-NLS-1$
769- }
770-
771- public Object getParent(Object o) {
772- return null;
773- }
774-
775- public Object getAdapter(Class adapter) {
776- if (adapter == IWorkbenchAdapter.class)
777- return this;
778- return null;
779- }
780- }
781-
782- private static Column[] columns = new Column[]{Column.REVNO, Column.COMMITTER, Column.TIMESTAMP, Column.MESSAGE};
783-
784- private StyledText commitTextBox;
785-
786- private Label commitTextLabel;
787-
788- private Button showUntrackedFilesButton;
789-
790- private Button pushAfterCommitButton;
791-
792- private Button localCommitButton;
793-
794- private CommitableResources commitableResources;
795-
796- private List<IResource> filesToAdd;
797-
798- private List<IBzrLocalResource> filesToCommit;
799-
800- private String commitMessage;
801-
802- private MouseListener commitMouseListener;
803-
804- private KeyListener commitKeyListener;
805-
806- private boolean pushAfterCommit = false;
807-
808- private CommitableResources selectedResources;
809-
810- private Text authorText;
811-
812- private BzrResourceSelectionComposite resourceSelectionComposite;
813-
814- private Text fixesText;
815-
816- private ArrayList<Option> options = new ArrayList<Option>(0);
817-
818- private Button authorButton;
819-
820- private Button fixesButton;
821-
822- private boolean pendingMerge;
823-
824- /**
825- *
826- * @param shell
827- * @param commitableResources
828- * @param selectedResources
829- */
830- public CommitDialog(Shell shell, CommitableResources commitableResources, CommitableResources selectedResources) {
831- this(shell);
832- this.commitableResources = commitableResources;
833- this.selectedResources = selectedResources;
834- }
835-
836- public CommitDialog(Shell shell) {
837- super(shell);
838- setShellStyle(SWT.RESIZE | SWT.MODELESS | SWT.CLOSE | SWT.MAX | SWT.BORDER | SWT.TITLE);
839- setBlockOnOpen(false);
840- }
841-
842- public List<IBzrLocalResource> getFilesToCommit() {
843- return filesToCommit;
844- }
845-
846- public String getCommitMessage() {
847- return commitMessage;
848- }
849-
850- public List<IResource> getFilesToAdd() {
851- return filesToAdd;
852- }
853-
854- protected Control createDialogArea(Composite parent) {
855- Composite container = (Composite) super.createDialogArea(parent);
856- getShell().setText(UITexts.CommitDialog_dialogTitle);
857- container.setLayout(new GridLayout(1, false));
858- container.setLayoutData(new GridData(GridData.FILL_BOTH));
859-
860- commitTextLabel = new Label(container, SWT.NONE);
861- commitTextLabel.setText(UITexts.CommitDialog_commentsTitle);
862-
863- commitTextBox = new StyledText(container, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP);
864- GridData textBoxData = new GridData(GridData.FILL_HORIZONTAL);
865- textBoxData.heightHint = 150;
866- commitTextBox.setLayoutData(textBoxData);
867-
868- createAuthorTextBox(container);
869- createFixesTextBox(container);
870-
871- resourceSelectionComposite = new BzrResourceSelectionComposite(!pendingMerge) {
872- private HistoryTree logTree;
873-
874- @Override
875- protected void createOption(Composite container) {
876- Group optionGroup = new Group(container, SWT.NONE);
877- optionGroup.setText("Options");
878- optionGroup.setLayout(new GridLayout(3, false));
879-
880- GridData data;
881- data = new GridData();
882- data.horizontalAlignment = GridData.FILL;
883- data.verticalAlignment = GridData.CENTER;
884- data.grabExcessHorizontalSpace = true;
885- data.grabExcessVerticalSpace = true;
886- optionGroup.setLayoutData(data);
887-
888- if(!pendingMerge) {
889- showUntrackedFilesButton = new Button(optionGroup, SWT.CHECK);
890- showUntrackedFilesButton.setText(UITexts.CommitDialog_checkboxUntracked);
891- }
892-
893- pushAfterCommitButton = new Button(optionGroup, SWT.CHECK);
894- pushAfterCommitButton.setText(UITexts.CommitDialog_pushAfterCommit);
895-
896- localCommitButton = new Button(optionGroup, SWT.CHECK);
897- localCommitButton.setText(UITexts.CommitDialog_localCommit);
898- }
899-
900- @Override
901- protected void createUpperControls(Composite container) {
902- if(!pendingMerge) {
903- Label commitFilesLabel = new Label(container, GridData.FILL_BOTH);
904- commitFilesLabel.setText("Select Files:");
905- }
906- }
907-
908- @Override
909- protected void createMiddleControls(Composite container) {
910- if(pendingMerge) {
911- TabFolder folder = new TabFolder(container, SWT.NONE);
912- folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
913- TabItem fileListItem = new TabItem(folder, SWT.NONE);
914- fileListItem.setText("File list");
915- super.createMiddleControls(folder);
916- fileListItem.setControl(super.getTableViewer().getTable());
917- TabItem logItem = new TabItem(folder, SWT.NONE);
918- logTree = new HistoryTree(folder, columns);
919- logTree.getTree().getColumn(Column.REVNO.ordinal()).setText("RevId");
920- logItem.setControl(logTree);
921- logItem.setText("Pending merges");
922- GridData data;
923- data = new GridData();
924- data.horizontalAlignment = GridData.FILL;
925- data.verticalAlignment = GridData.FILL;
926- data.grabExcessHorizontalSpace = true;
927- logTree.setLayoutData(data);
928- logTree.populate(commitableResources.getAllPendingMerges());
929- } else {
930- super.createMiddleControls(container);
931- }
932- }
933- };
934- Composite listComposite = resourceSelectionComposite.createControls(container);
935- resourceSelectionComposite.getTableViewer().addFilter(new CommittableFilesFilter());
936- resourceSelectionComposite.addUntrackedFilesFilter();
937-
938- resourceSelectionComposite.setResources(this.commitableResources.getAllStatuses());
939- if(pendingMerge) {
940- List<IBzrResourceStatus> filteredResources = new ArrayList<IBzrResourceStatus>(this.commitableResources.getAllStatuses().size());
941- for (IBzrResourceStatus status : this.commitableResources.getAllStatuses()) {
942- if(!status.isUnknown()) {
943- filteredResources.add(status);
944- }
945- }
946- resourceSelectionComposite.setSelection(filteredResources);
947- resourceSelectionComposite.addUntrackedFilesFilter();
948- } else {
949- for (IBzrResourceStatus status : selectedResources.getAllStatuses()) {
950- if(status.isUnknown() && status.getResource() != null && !status.getResource().isFolder()) {
951- resourceSelectionComposite.removeUntrackedFilesFilter();
952- break;
953- }
954- }
955- resourceSelectionComposite.setSelection(this.selectedResources.getAllStatuses());
956- }
957- resourceSelectionComposite.refreshTableViewer();
958-
959- listComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
960-
961-
962- makeActions();
963- return container;
964- }
965-
966- private void createAuthorTextBox(Composite parent) {
967- final Composite container = new Composite(parent, SWT.NONE);
968- container.setLayout(new GridLayout(3, false));
969- container.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
970- authorButton = new Button(container, SWT.CHECK);
971- GridData data = new GridData();
972- data.horizontalAlignment = GridData.BEGINNING;
973- data.grabExcessHorizontalSpace = false;
974- data.grabExcessVerticalSpace = false;
975- authorButton.setLayoutData(data);
976- final Label author = new Label(container, SWT.HORIZONTAL);
977- author.setText("Author:");
978- authorText = new Text(container, SWT.SINGLE|SWT.WRAP);
979- authorText.setText(EclipseBazaarUI.getDefault().getPreferenceStore().getString(BazaarPreference.BZR_EMAIL.name()));
980- authorText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
981- authorText.setEditable(false);
982- authorButton.addSelectionListener(new SelectionAdapter() {
983- @Override
984- public void widgetSelected(SelectionEvent e) {
985- authorText.setEditable(authorButton.getSelection());
986- authorText.setEnabled(authorButton.getSelection());
987- }
988- });
989- container.addControlListener(new ControlAdapter() {
990- @Override
991- public void controlResized(ControlEvent e) {
992- Point currSize = authorText.getSize();
993- currSize.x = container.getSize().x;
994- authorText.setSize(currSize);
995- }
996- });
997- }
998-
999- private void createFixesTextBox(Composite parent) {
1000- final Composite container = new Composite(parent, SWT.NONE);
1001- container.setLayout(new GridLayout(3, false));
1002- container.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
1003- fixesButton = new Button(container, SWT.CHECK);
1004- GridData data = new GridData();
1005- data.horizontalAlignment = GridData.BEGINNING;
1006- data.grabExcessHorizontalSpace = false;
1007- data.grabExcessVerticalSpace = false;
1008- fixesButton.setLayoutData(data);
1009- final Label author = new Label(container, SWT.HORIZONTAL);
1010- author.setText("Fixes:");
1011- fixesText = new Text(container, SWT.SINGLE|SWT.WRAP);
1012- fixesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
1013- fixesText.setEditable(false);
1014- fixesButton.addSelectionListener(new SelectionAdapter() {
1015- @Override
1016- public void widgetSelected(SelectionEvent e) {
1017- fixesText.setEditable(fixesButton.getSelection());
1018- fixesText.setEnabled(fixesButton.getSelection());
1019- }
1020- });
1021- container.addControlListener(new ControlAdapter() {
1022- public void controlResized(ControlEvent e) {
1023- Point currSize = fixesText.getSize();
1024- currSize.x = container.getSize().x;
1025- fixesText.setSize(currSize);
1026- }
1027- });
1028- }
1029-
1030- private void makeActions() {
1031-
1032- commitTextBox.setCapture(true);
1033- if(!pendingMerge) {
1034- showUntrackedFilesButton.setSelection(!resourceSelectionComposite.isFilterUntracked()); // Start unselected.
1035- }
1036- pushAfterCommitButton.setSelection(false); // Start unselected.
1037- localCommitButton.setSelection(false); // Start unselected
1038- localCommitButton.setVisible(false);
1039-
1040- // TODO: for the moment only one branch is supported in commit so we can do this
1041- for (IBzrResourceStatus commitable : commitableResources.getAllStatuses()) {
1042- if (!commitable.isDeleted() && commitable.getResource().getBranch().isBound()) {
1043- localCommitButton.setVisible(true);
1044- break;
1045- }
1046- }
1047- if(!pendingMerge) {
1048- showUntrackedFilesButton.addSelectionListener(new SelectionAdapter() {
1049- public void widgetSelected(SelectionEvent e) {
1050- if (showUntrackedFilesButton.getSelection()) {
1051- resourceSelectionComposite.removeUntrackedFilesFilter();
1052- for (TableColumn column : resourceSelectionComposite.getTableViewer().getTable().getColumns()) {
1053- column.pack();
1054- }
1055- } else {
1056- resourceSelectionComposite.addUntrackedFilesFilter();
1057- }
1058- resourceSelectionComposite.getTableViewer().refresh(true);
1059- }
1060- });
1061- }
1062-
1063- // set Ctrl + Return listener (fix Bug #128071)
1064- commitTextBox.addTraverseListener(new TraverseListener() {
1065- public void keyTraversed(TraverseEvent e) {
1066- if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) != 0) {
1067- okPressed();
1068- }
1069- }
1070- });
1071-
1072- setupDefaultCommitMessage();
1073- }
1074-
1075- private void setupDefaultCommitMessage() {
1076- commitTextBox.setText(DEFAULT_COMMIT_MESSAGE);
1077- commitMouseListener = new MouseListener() {
1078-
1079- public void mouseDown(MouseEvent e) {
1080- // On the first mouse down in the area clear the default commit
1081- // message.
1082- commitTextBox.setText("");
1083- commitTextBox.removeMouseListener(commitMouseListener);
1084- commitTextBox.removeKeyListener(commitKeyListener);
1085- }
1086-
1087- public void mouseDoubleClick(MouseEvent e) {
1088- // Nothing
1089- }
1090-
1091- public void mouseUp(MouseEvent e) {
1092- // Nothing
1093- }
1094- };
1095-
1096- commitKeyListener = new KeyListener() {
1097-
1098- public void keyPressed(KeyEvent e) {
1099- // On the first key press, deleted the default commit message
1100- // and then remove the handlers.
1101- commitTextBox.setText("");
1102- commitTextBox.removeMouseListener(commitMouseListener);
1103- commitTextBox.removeKeyListener(commitKeyListener);
1104- }
1105-
1106- public void keyReleased(KeyEvent e) {
1107- // Nothing
1108- }
1109- };
1110- commitTextBox.addMouseListener(commitMouseListener);
1111- commitTextBox.addKeyListener(commitKeyListener);
1112- }
1113-
1114- private List<IBzrLocalResource> getCommitList(List<IBzrResourceStatus> list) {
1115- List<IBzrLocalResource> filtered = new ArrayList<IBzrLocalResource>();
1116- for (IBzrResourceStatus status : list) {
1117- filtered.add(status.getResource());
1118- }
1119- return filtered;
1120- }
1121-
1122- private List<IResource> getToAddList(List<IBzrResourceStatus> list) {
1123- List<IResource> filtered = new ArrayList<IResource>();
1124- for (IBzrResourceStatus status : list) {
1125- if (status.contains(BazaarStatusKind.UNKNOWN)) {
1126- filtered.add(status.getResource().getIResource());
1127- }
1128- }
1129- return filtered;
1130- }
1131-
1132- /**
1133- * Override the OK button pressed to capture the info we want first and then call super.
1134- */
1135- protected void okPressed() {
1136- filesToAdd = getToAddList(resourceSelectionComposite.getSelection());
1137- filesToCommit = getCommitList(resourceSelectionComposite.getSelection());
1138- commitMessage = commitTextBox.getText();
1139- pushAfterCommit = pushAfterCommitButton.getSelection();
1140- String author = authorText.getText();
1141- String fixes = fixesText.getText();
1142- this.options = new ArrayList<Option>(0);
1143- if(localCommitButton.getSelection()) {
1144- options.add(ICommitOptions.LOCAL);
1145- }
1146- if(authorButton.getSelection() && author != null && !"".equals(author.trim())) {
1147- options.add(ICommitOptions.AUTHOR.setArgument(author));
1148- }
1149- if(fixesButton.getSelection() && fixes != null && !"".equals(fixes.trim())) {
1150- options.add(ICommitOptions.FIXES.setArgument(fixes));
1151- }
1152- if (commitMessage == null || commitMessage.trim().length() == 0 || commitMessage.equals(UITexts.CommitDialog_defaultCommitMessage)) {
1153- MessageDialog.openInformation(this.getParentShell(), "Empty Commit Text", "You must complete the comment");
1154- } else {
1155- super.okPressed();
1156- }
1157- }
1158-
1159- protected Point getInitialSize() {
1160- return new Point(480, 700);
1161- }
1162-
1163- public boolean isPushAfterCommit() {
1164- return pushAfterCommit;
1165- }
1166-
1167- public ArrayList<Option> getOptions() {
1168- return options;
1169- }
1170-
1171- public int open(CommitableResources commitableResources, CommitableResources selectedResources, boolean shouldBlock) {
1172- setShellStyle(SWT.RESIZE | SWT.MODELESS | SWT.CLOSE | SWT.MAX | SWT.BORDER | SWT.TITLE);
1173- setBlockOnOpen(shouldBlock);
1174- this.commitableResources = commitableResources;
1175- this.selectedResources = selectedResources;
1176- this.pendingMerge = commitableResources.getAllPendingMerges().size() > 0;
1177- return open();
1178- }
1179-
1180+ private static String DEFAULT_COMMIT_MESSAGE = UITexts.CommitDialog_defaultCommitMessage;
1181+
1182+ private class CommittableFilesFilter extends ViewerFilter {
1183+
1184+ public CommittableFilesFilter() {
1185+ super();
1186+ }
1187+
1188+ /**
1189+ * Filter out uncommittable files (i.e. ! -> deleted but still tracked)
1190+ */
1191+ public boolean select(Viewer viewer, Object parentElement, Object element) {
1192+ if (element instanceof IBzrResourceStatus) {
1193+ IBzrResourceStatus status = ((IBzrResourceStatus) element);
1194+ IBzrLocalResource bzrResource = status.getResource();
1195+ if (status.isUnchanged()
1196+ || status.isIgnored()
1197+ || (!status.isDeleted() && bzrResource.getIResource().getType() == IResource.PROJECT))
1198+ {
1199+ return false;
1200+ }
1201+ }
1202+ return true;
1203+ }
1204+ }
1205+
1206+ public class AdaptableCommitList implements IAdaptable, IWorkbenchAdapter {
1207+ private IBzrResourceStatus[] resources;
1208+
1209+ public AdaptableCommitList(List<IBzrResourceStatus> resources) {
1210+ this.resources = resources.toArray(new IBzrResourceStatus[0]);
1211+ }
1212+
1213+ public Object[] getChildren(Object o) {
1214+ return resources;
1215+ }
1216+
1217+ public ImageDescriptor getImageDescriptor(Object object) {
1218+ return null;
1219+ }
1220+
1221+ public String getLabel(Object o) {
1222+ if (o instanceof IBzrResourceStatus) {
1223+ return ((IBzrResourceStatus) o).getStatus().toString();
1224+ }
1225+ return o == null ? "" : o.toString();//$NON-NLS-1$
1226+ }
1227+
1228+ public Object getParent(Object o) {
1229+ return null;
1230+ }
1231+
1232+ public Object getAdapter(Class adapter) {
1233+ if (adapter == IWorkbenchAdapter.class) {
1234+ return this;
1235+ }
1236+ return null;
1237+ }
1238+ }
1239+
1240+ private static Column[] columns =
1241+ new Column[] { Column.REVNO, Column.COMMITTER, Column.TIMESTAMP, Column.MESSAGE };
1242+
1243+ private StyledText commitTextBox;
1244+
1245+ private Label commitTextLabel;
1246+
1247+ private Button showUntrackedFilesButton;
1248+
1249+ private Button pushAfterCommitButton;
1250+
1251+ private Button localCommitButton;
1252+
1253+ private CommitableResources commitableResources;
1254+
1255+ private List<IResource> filesToAdd;
1256+
1257+ private List<IBzrLocalResource> filesToCommit;
1258+
1259+ private String commitMessage;
1260+
1261+ private MouseListener commitMouseListener;
1262+
1263+ private KeyListener commitKeyListener;
1264+
1265+ private boolean pushAfterCommit = false;
1266+
1267+ private CommitableResources selectedResources;
1268+
1269+ private Text authorText;
1270+
1271+ private BzrResourceSelectionComposite resourceSelectionComposite;
1272+
1273+ private Text fixesText;
1274+
1275+ private ArrayList<Option> options = new ArrayList<Option>(0);
1276+
1277+ private Button authorButton;
1278+
1279+ private Button fixesButton;
1280+
1281+ private boolean pendingMerge;
1282+
1283+ public CommitDialog(Shell shell, CommitableResources commitableResources,
1284+ CommitableResources selectedResources)
1285+ {
1286+ this(shell);
1287+ this.commitableResources = commitableResources;
1288+ this.selectedResources = selectedResources;
1289+ }
1290+
1291+ public CommitDialog(Shell shell) {
1292+ super(shell);
1293+ setShellStyle(SWT.RESIZE | SWT.MODELESS | SWT.CLOSE | SWT.MAX | SWT.BORDER | SWT.TITLE);
1294+ setBlockOnOpen(false);
1295+ }
1296+
1297+ public List<IBzrLocalResource> getFilesToCommit() {
1298+ return filesToCommit;
1299+ }
1300+
1301+ public String getCommitMessage() {
1302+ return commitMessage;
1303+ }
1304+
1305+ public List<IResource> getFilesToAdd() {
1306+ return filesToAdd;
1307+ }
1308+
1309+ protected Control createDialogArea(Composite parent) {
1310+ Composite container = (Composite) super.createDialogArea(parent);
1311+ getShell().setText(UITexts.CommitDialog_dialogTitle);
1312+ container.setLayout(new GridLayout(1, false));
1313+ container.setLayoutData(new GridData(GridData.FILL_BOTH));
1314+
1315+ commitTextLabel = new Label(container, SWT.NONE);
1316+ commitTextLabel.setText(UITexts.CommitDialog_commentsTitle);
1317+
1318+ commitTextBox = new StyledText(container, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP);
1319+ GridData textBoxData = new GridData(GridData.FILL_HORIZONTAL);
1320+ textBoxData.heightHint = 150;
1321+ commitTextBox.setLayoutData(textBoxData);
1322+
1323+ createAuthorTextBox(container);
1324+ createFixesTextBox(container);
1325+
1326+ resourceSelectionComposite = new BzrResourceSelectionComposite(!pendingMerge) {
1327+ private HistoryTree logTree;
1328+
1329+ @Override
1330+ protected void createOption(Composite container) {
1331+ Group optionGroup = new Group(container, SWT.NONE);
1332+ optionGroup.setText("Options");
1333+ optionGroup.setLayout(new GridLayout(3, false));
1334+
1335+ GridData data;
1336+ data = new GridData();
1337+ data.horizontalAlignment = GridData.FILL;
1338+ data.verticalAlignment = GridData.CENTER;
1339+ data.grabExcessHorizontalSpace = true;
1340+ data.grabExcessVerticalSpace = true;
1341+ optionGroup.setLayoutData(data);
1342+
1343+ if (!pendingMerge) {
1344+ showUntrackedFilesButton = new Button(optionGroup, SWT.CHECK);
1345+ showUntrackedFilesButton.setText(UITexts.CommitDialog_checkboxUntracked);
1346+ }
1347+
1348+ pushAfterCommitButton = new Button(optionGroup, SWT.CHECK);
1349+ pushAfterCommitButton.setText(UITexts.CommitDialog_pushAfterCommit);
1350+
1351+ localCommitButton = new Button(optionGroup, SWT.CHECK);
1352+ localCommitButton.setText(UITexts.CommitDialog_localCommit);
1353+ }
1354+
1355+ @Override
1356+ protected void createUpperControls(Composite container) {
1357+ if (!pendingMerge) {
1358+ Label commitFilesLabel = new Label(container, GridData.FILL_BOTH);
1359+ commitFilesLabel.setText("Select Files:");
1360+ }
1361+ }
1362+
1363+ @Override
1364+ protected void createMiddleControls(Composite container) {
1365+ if (pendingMerge) {
1366+ TabFolder folder = new TabFolder(container, SWT.NONE);
1367+ folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
1368+ TabItem fileListItem = new TabItem(folder, SWT.NONE);
1369+ fileListItem.setText("File list");
1370+ super.createMiddleControls(folder);
1371+ fileListItem.setControl(super.getTableViewer().getTable());
1372+ TabItem logItem = new TabItem(folder, SWT.NONE);
1373+ logTree = new HistoryTree(folder, columns);
1374+ logTree.getTree().getColumn(Column.REVNO.ordinal()).setText("RevId");
1375+ logItem.setControl(logTree);
1376+ logItem.setText("Pending merges");
1377+ GridData data;
1378+ data = new GridData();
1379+ data.horizontalAlignment = GridData.FILL;
1380+ data.verticalAlignment = GridData.FILL;
1381+ data.grabExcessHorizontalSpace = true;
1382+ logTree.setLayoutData(data);
1383+ logTree.populate(commitableResources.getAllPendingMerges());
1384+ } else {
1385+ super.createMiddleControls(container);
1386+ }
1387+ }
1388+ };
1389+ Composite listComposite = resourceSelectionComposite.createControls(container);
1390+ resourceSelectionComposite.getTableViewer().addFilter(new CommittableFilesFilter());
1391+ resourceSelectionComposite.addUntrackedFilesFilter();
1392+
1393+ resourceSelectionComposite.setResources(this.commitableResources.getAllStatuses());
1394+ if (pendingMerge) {
1395+ List<IBzrResourceStatus> filteredResources =
1396+ new ArrayList<IBzrResourceStatus>(this.commitableResources.getAllStatuses().size());
1397+ for (IBzrResourceStatus status : this.commitableResources.getAllStatuses()) {
1398+ if (!status.isUnknown()) {
1399+ filteredResources.add(status);
1400+ }
1401+ }
1402+ resourceSelectionComposite.setSelection(filteredResources);
1403+ resourceSelectionComposite.addUntrackedFilesFilter();
1404+ } else {
1405+ for (IBzrResourceStatus status : selectedResources.getAllStatuses()) {
1406+ if (status.isUnknown() && status.getResource() != null
1407+ && !status.getResource().isFolder())
1408+ {
1409+ resourceSelectionComposite.removeUntrackedFilesFilter();
1410+ break;
1411+ }
1412+ }
1413+ resourceSelectionComposite.setSelection(this.selectedResources.getAllStatuses());
1414+ }
1415+ resourceSelectionComposite.refreshTableViewer();
1416+
1417+ listComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
1418+
1419+ makeActions();
1420+ return container;
1421+ }
1422+
1423+ private void createAuthorTextBox(Composite parent) {
1424+ final Composite container = new Composite(parent, SWT.NONE);
1425+ container.setLayout(new GridLayout(3, false));
1426+ container.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
1427+ authorButton = new Button(container, SWT.CHECK);
1428+ GridData data = new GridData();
1429+ data.horizontalAlignment = GridData.BEGINNING;
1430+ data.grabExcessHorizontalSpace = false;
1431+ data.grabExcessVerticalSpace = false;
1432+ authorButton.setLayoutData(data);
1433+ final Label author = new Label(container, SWT.HORIZONTAL);
1434+ author.setText("Author:");
1435+ authorText = new Text(container, SWT.SINGLE | SWT.WRAP);
1436+ authorText.setText(EclipseBazaarUI.getDefault().getPreferenceStore().getString(
1437+ BazaarPreference.BZR_EMAIL.name()));
1438+ authorText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
1439+ authorText.setEditable(false);
1440+ authorButton.addSelectionListener(new SelectionAdapter() {
1441+ @Override
1442+ public void widgetSelected(SelectionEvent e) {
1443+ authorText.setEditable(authorButton.getSelection());
1444+ authorText.setEnabled(authorButton.getSelection());
1445+ }
1446+ });
1447+ container.addControlListener(new ControlAdapter() {
1448+ @Override
1449+ public void controlResized(ControlEvent e) {
1450+ Point currSize = authorText.getSize();
1451+ currSize.x = container.getSize().x;
1452+ authorText.setSize(currSize);
1453+ }
1454+ });
1455+ }
1456+
1457+ private void createFixesTextBox(Composite parent) {
1458+ final Composite container = new Composite(parent, SWT.NONE);
1459+ container.setLayout(new GridLayout(3, false));
1460+ container.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
1461+ fixesButton = new Button(container, SWT.CHECK);
1462+ GridData data = new GridData();
1463+ data.horizontalAlignment = GridData.BEGINNING;
1464+ data.grabExcessHorizontalSpace = false;
1465+ data.grabExcessVerticalSpace = false;
1466+ fixesButton.setLayoutData(data);
1467+ final Label author = new Label(container, SWT.HORIZONTAL);
1468+ author.setText("Fixes:");
1469+ fixesText = new Text(container, SWT.SINGLE | SWT.WRAP);
1470+ fixesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
1471+ fixesText.setEditable(false);
1472+ fixesButton.addSelectionListener(new SelectionAdapter() {
1473+ @Override
1474+ public void widgetSelected(SelectionEvent e) {
1475+ fixesText.setEditable(fixesButton.getSelection());
1476+ fixesText.setEnabled(fixesButton.getSelection());
1477+ }
1478+ });
1479+ container.addControlListener(new ControlAdapter() {
1480+ public void controlResized(ControlEvent e) {
1481+ Point currSize = fixesText.getSize();
1482+ currSize.x = container.getSize().x;
1483+ fixesText.setSize(currSize);
1484+ }
1485+ });
1486+ }
1487+
1488+ private void makeActions() {
1489+
1490+ commitTextBox.setCapture(true);
1491+ if (!pendingMerge) {
1492+ showUntrackedFilesButton.setSelection(!resourceSelectionComposite.isFilterUntracked()); // Start unselected.
1493+ }
1494+ pushAfterCommitButton.setSelection(false); // Start unselected.
1495+ localCommitButton.setSelection(false); // Start unselected
1496+ localCommitButton.setVisible(false);
1497+
1498+ // TODO: for the moment only one branch is supported in commit so we can do this
1499+ for (IBzrResourceStatus commitable : commitableResources.getAllStatuses()) {
1500+ if (!commitable.isDeleted() && commitable.getResource().getBranch().isBound()) {
1501+ localCommitButton.setVisible(true);
1502+ break;
1503+ }
1504+ }
1505+ if (!pendingMerge) {
1506+ showUntrackedFilesButton.addSelectionListener(new SelectionAdapter() {
1507+ public void widgetSelected(SelectionEvent e) {
1508+ if (showUntrackedFilesButton.getSelection()) {
1509+ resourceSelectionComposite.removeUntrackedFilesFilter();
1510+ for (TableColumn column : resourceSelectionComposite.getTableViewer()
1511+ .getTable().getColumns())
1512+ {
1513+ column.pack();
1514+ }
1515+ } else {
1516+ resourceSelectionComposite.addUntrackedFilesFilter();
1517+ }
1518+ resourceSelectionComposite.getTableViewer().refresh(true);
1519+ }
1520+ });
1521+ }
1522+
1523+ // set Ctrl + Return listener (fix Bug #128071)
1524+ commitTextBox.addTraverseListener(new TraverseListener() {
1525+ public void keyTraversed(TraverseEvent e) {
1526+ if (e.detail == SWT.TRAVERSE_RETURN && (e.stateMask & SWT.CTRL) != 0) {
1527+ okPressed();
1528+ }
1529+ }
1530+ });
1531+
1532+ setupDefaultCommitMessage();
1533+ }
1534+
1535+ private void setupDefaultCommitMessage() {
1536+ commitTextBox.setText(DEFAULT_COMMIT_MESSAGE);
1537+ commitMouseListener = new MouseListener() {
1538+
1539+ public void mouseDown(MouseEvent e) {
1540+ // On the first mouse down in the area clear the default commit
1541+ // message.
1542+ commitTextBox.setText("");
1543+ commitTextBox.removeMouseListener(commitMouseListener);
1544+ commitTextBox.removeKeyListener(commitKeyListener);
1545+ }
1546+
1547+ public void mouseDoubleClick(MouseEvent e) {
1548+ // Nothing
1549+ }
1550+
1551+ public void mouseUp(MouseEvent e) {
1552+ // Nothing
1553+ }
1554+ };
1555+
1556+ commitKeyListener = new KeyListener() {
1557+
1558+ public void keyPressed(KeyEvent e) {
1559+ // On the first key press, deleted the default commit message
1560+ // and then remove the handlers.
1561+ commitTextBox.setText("");
1562+ commitTextBox.removeMouseListener(commitMouseListener);
1563+ commitTextBox.removeKeyListener(commitKeyListener);
1564+ }
1565+
1566+ public void keyReleased(KeyEvent e) {
1567+ // Nothing
1568+ }
1569+ };
1570+ commitTextBox.addMouseListener(commitMouseListener);
1571+ commitTextBox.addKeyListener(commitKeyListener);
1572+ }
1573+
1574+ private List<IBzrLocalResource> getCommitList(List<IBzrResourceStatus> list) {
1575+ List<IBzrLocalResource> filtered = new ArrayList<IBzrLocalResource>();
1576+ for (IBzrResourceStatus status : list) {
1577+ filtered.add(status.getResource());
1578+ }
1579+ return filtered;
1580+ }
1581+
1582+ private List<IResource> getToAddList(List<IBzrResourceStatus> list) {
1583+ List<IResource> filtered = new ArrayList<IResource>();
1584+ for (IBzrResourceStatus status : list) {
1585+ if (status.contains(BazaarStatusKind.UNKNOWN)) {
1586+ filtered.add(status.getResource().getIResource());
1587+ }
1588+ }
1589+ return filtered;
1590+ }
1591+
1592+ /**
1593+ * Override the OK button pressed to capture the info we want first and then
1594+ * call super.
1595+ */
1596+ protected void okPressed() {
1597+ filesToAdd = getToAddList(resourceSelectionComposite.getSelection());
1598+ filesToCommit = getCommitList(resourceSelectionComposite.getSelection());
1599+ commitMessage = commitTextBox.getText();
1600+ pushAfterCommit = pushAfterCommitButton.getSelection();
1601+ String author = authorText.getText();
1602+ String fixes = fixesText.getText();
1603+ this.options = new ArrayList<Option>(0);
1604+ if (localCommitButton.getSelection()) {
1605+ options.add(ICommitOptions.LOCAL);
1606+ }
1607+ if (authorButton.getSelection() && author != null && !"".equals(author.trim())) {
1608+ options.add(ICommitOptions.AUTHOR.setArgument(author));
1609+ }
1610+ if (fixesButton.getSelection() && fixes != null && !"".equals(fixes.trim())) {
1611+ options.add(ICommitOptions.FIXES.setArgument(fixes));
1612+ }
1613+ if (commitMessage == null || commitMessage.trim().length() == 0
1614+ || commitMessage.equals(UITexts.CommitDialog_defaultCommitMessage))
1615+ {
1616+ MessageDialog.openInformation(this.getParentShell(), "Empty Commit Text",
1617+ "You must complete the comment");
1618+ } else {
1619+ super.okPressed();
1620+ }
1621+ }
1622+
1623+ protected Point getInitialSize() {
1624+ return new Point(480, 700);
1625+ }
1626+
1627+ public boolean isPushAfterCommit() {
1628+ return pushAfterCommit;
1629+ }
1630+
1631+ public ArrayList<Option> getOptions() {
1632+ return options;
1633+ }
1634+
1635+ public int open(CommitableResources commitableResources,
1636+ CommitableResources selectedResources,
1637+ boolean shouldBlock)
1638+ {
1639+ setShellStyle(SWT.RESIZE | SWT.MODELESS | SWT.CLOSE | SWT.MAX | SWT.BORDER | SWT.TITLE);
1640+ setBlockOnOpen(shouldBlock);
1641+ this.commitableResources = commitableResources;
1642+ this.selectedResources = selectedResources;
1643+ this.pendingMerge = commitableResources.getAllPendingMerges().size() > 0;
1644+ return open();
1645+ }
1646+
1647 }
1648
1649=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/UpdateInfoDialog.java'
1650--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/UpdateInfoDialog.java 2008-09-10 02:31:19 +0000
1651+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/dialogs/UpdateInfoDialog.java 2009-04-28 04:23:06 +0000
1652@@ -32,8 +32,13 @@
1653 import org.vcs.bazaar.eclipse.ui.UITexts;
1654
1655 /**
1656+ * Dialog requesting the user to verify that bzr-eclipse dependencies are
1657+ * fulfilled.
1658+ * <p>
1659+ * Usually displayed after bzr-eclipse has either been upgraded or newly
1660+ * installed.
1661+ *
1662 * @author Guillermo Gonzalez <guillo.gonzo@gmail.com>
1663- *
1664 */
1665 public class UpdateInfoDialog extends TrayDialog {
1666
1667
1668=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/internal/TeamAction.java'
1669--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/internal/TeamAction.java 2008-12-02 18:37:38 +0000
1670+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/internal/TeamAction.java 2009-04-29 05:52:15 +0000
1671@@ -47,7 +47,6 @@
1672 import org.eclipse.ui.IWorkbenchWindow;
1673 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
1674 import org.eclipse.ui.PartInitException;
1675-import org.eclipse.ui.PlatformUI;
1676 import org.eclipse.ui.actions.ActionDelegate;
1677 import org.eclipse.ui.internal.LegacyResourceSupport;
1678 import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI;
1679@@ -61,391 +60,395 @@
1680 * providers may also instantiate or subclass any of the subclasses of
1681 * TeamAction provided in this package.
1682 */
1683-public abstract class TeamAction extends ActionDelegate implements IObjectActionDelegate, IViewActionDelegate, IWorkbenchWindowActionDelegate {
1684- // The current selection
1685- private IStructuredSelection selection;
1686-
1687- // The shell, required for the progress dialog
1688- private Shell shell;
1689-
1690- // Constants for determining the type of progress. Subclasses may
1691- // pass one of these values to the run method.
1692- public final static int PROGRESS_DIALOG = 1;
1693- public final static int PROGRESS_BUSYCURSOR = 2;
1694-
1695- private IWorkbenchPart targetPart;
1696- private IWorkbenchWindow window;
1697-
1698- private ISelectionListener selectionListener = new ISelectionListener() {
1699- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
1700- if (selection instanceof IStructuredSelection)
1701- TeamAction.this.selection = (IStructuredSelection) selection;
1702- }
1703- };
1704-
1705- /**
1706- * Creates an array of the given class type containing all the objects in
1707- * the selection that adapt to the given class.
1708- *
1709- * @param selection
1710- * @param c
1711- * @return the selected adaptables
1712- */
1713- public static Object[] getSelectedAdaptables(ISelection selection, Class c) {
1714- ArrayList<Object> result = null;
1715- if (selection != null && !selection.isEmpty()) {
1716- result = new ArrayList<Object>();
1717- Iterator elements = ((IStructuredSelection) selection).iterator();
1718- while (elements.hasNext()) {
1719- Object adapter = getAdapter(elements.next(), c);
1720- if (c.isInstance(adapter)) {
1721- result.add(adapter);
1722- }
1723- }
1724- }
1725- if (result != null && !result.isEmpty()) {
1726- return result.toArray((Object[]) Array.newInstance(c, result.size()));
1727- }
1728- return (Object[]) Array.newInstance(c, 0);
1729- }
1730-
1731- /**
1732- * Find the object associated with the given object when it is adapted to
1733- * the provided class. Null is returned if the given object does not adapt
1734- * to the given class
1735- *
1736- * @param adaptable
1737- * @param c
1738- * @return Object
1739- */
1740- public static Object getAdapter(Object adaptable, Class c) {
1741- if (c.isInstance(adaptable)) {
1742- return adaptable;
1743- }
1744- if (adaptable instanceof IAdaptable) {
1745- IAdaptable a = (IAdaptable) adaptable;
1746- Object adapter = a.getAdapter(c);
1747- if (c.isInstance(adapter)) {
1748- return adapter;
1749- }
1750- }
1751- return null;
1752- }
1753-
1754- /**
1755- * Returns the selected projects.
1756- *
1757- * @return the selected projects
1758- */
1759- protected IProject[] getSelectedProjects() {
1760- IResource[] selectedResources = getSelectedResources();
1761- if (selectedResources.length == 0)
1762- return new IProject[0];
1763- ArrayList<IProject> projects = new ArrayList<IProject>();
1764- for (int i = 0; i < selectedResources.length; i++) {
1765- IResource resource = selectedResources[i];
1766- if (resource.getType() == IResource.PROJECT) {
1767- projects.add((IProject) resource);
1768- }
1769- }
1770- return (IProject[]) projects.toArray(new IProject[projects.size()]);
1771- }
1772-
1773- /**
1774- * Returns an array of the given class type c that contains all instances of
1775- * c that are either contained in the selection or are adapted from objects
1776- * contained in the selection.
1777- *
1778- * @param c
1779- * @return the selection adapted to the given class
1780- */
1781- protected Object[] getAdaptedSelection(Class c) {
1782- return getSelectedAdaptables(selection, c);
1783- }
1784-
1785- /**
1786- * Returns the selected resources.
1787- *
1788- * @return the selected resources
1789- */
1790- protected IResource[] getSelectedResources() {
1791- return Utils.getContributedResources(getSelection().toArray());
1792- }
1793-
1794- protected IStructuredSelection getSelection() {
1795- if (selection == null)
1796- selection = StructuredSelection.EMPTY;
1797- return selection;
1798- }
1799-
1800- /**
1801- * Return the selected resource mappins that contain resources in projects
1802- * that are associated with a repository of the given id.
1803- *
1804- * @param providerId
1805- * the repository provider id
1806- * @return the resource mappings that contain resources associated with the
1807- * given provider
1808- */
1809- protected ResourceMapping[] getSelectedResourceMappings(String providerId) {
1810- Object[] elements = getSelection().toArray();
1811- ArrayList<ResourceMapping> providerMappings = new ArrayList<ResourceMapping>();
1812- for (int i = 0; i < elements.length; i++) {
1813- Object object = elements[i];
1814- Object adapted = getResourceMapping(object);
1815- if (adapted instanceof ResourceMapping) {
1816- ResourceMapping mapping = (ResourceMapping) adapted;
1817- if (providerId == null || isMappedToProvider(mapping, providerId)) {
1818- providerMappings.add(mapping);
1819- }
1820- }
1821- }
1822- return (ResourceMapping[]) providerMappings.toArray(new ResourceMapping[providerMappings.size()]);
1823- }
1824-
1825- private Object getResourceMapping(Object object) {
1826- if (object instanceof ResourceMapping)
1827- return (ResourceMapping) object;
1828- return LegacyResourceSupport.getAdaptedContributorResourceMapping(object);
1829- }
1830-
1831- private boolean isMappedToProvider(ResourceMapping element, String providerId) {
1832- IProject[] projects = element.getProjects();
1833- for (int k = 0; k < projects.length; k++) {
1834- IProject project = projects[k];
1835- RepositoryProvider provider = RepositoryProvider.getProvider(project);
1836- if (provider != null && provider.getID().equals(providerId)) {
1837- return true;
1838- }
1839- }
1840- return false;
1841- }
1842-
1843- /**
1844- * Convenience method for getting the current shell.
1845- *
1846- * @return the shell
1847- */
1848- protected Shell getShell() {
1849- if (shell != null) {
1850- return shell;
1851- } else if (targetPart != null) {
1852- return targetPart.getSite().getShell();
1853- } else if (window != null) {
1854- return window.getShell();
1855- } else {
1856- IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
1857- if (workbench == null)
1858- return null;
1859- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
1860- if (window == null)
1861- return null;
1862- return window.getShell();
1863- }
1864- }
1865-
1866- /**
1867- * Convenience method for running an operation with progress and error
1868- * feedback.
1869- *
1870- * @param runnable
1871- * the runnable which executes the operation
1872- * @param problemMessage
1873- * the message to display in the case of errors
1874- * @param progressKind
1875- * one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG
1876- */
1877- final protected void run(final IRunnableWithProgress runnable, final String problemMessage, int progressKind) {
1878- final Exception[] exceptions = new Exception[] { null };
1879- switch (progressKind) {
1880- case PROGRESS_BUSYCURSOR:
1881- final Display display = EclipseBazaarUI.getStandardDisplay();
1882- BusyIndicator.showWhile(display , new Runnable() {
1883- public void run() {
1884- try {
1885- runnable.run(new NullProgressMonitor());
1886- } catch (InvocationTargetException e) {
1887- exceptions[0] = e;
1888- } catch (InterruptedException e) {
1889- exceptions[0] = null;
1890- }
1891- }
1892- });
1893- break;
1894- default:
1895- case PROGRESS_DIALOG:
1896- try {
1897- new ProgressMonitorDialog(getShell()).run(true, true, runnable);
1898- } catch (InvocationTargetException e) {
1899- exceptions[0] = e;
1900- } catch (InterruptedException e) {
1901- exceptions[0] = null;
1902- }
1903- break;
1904- }
1905- if (exceptions[0] != null) {
1906- handle(exceptions[0], null, problemMessage);
1907- }
1908- }
1909-
1910- /*
1911- * Method declared on IActionDelegate.
1912- */
1913- public void selectionChanged(IAction action, ISelection selection) {
1914- if (selection instanceof IStructuredSelection) {
1915- this.selection = (IStructuredSelection) selection;
1916- if (action != null) {
1917- setActionEnablement(action);
1918- }
1919- }
1920- }
1921-
1922- /**
1923- * Method invoked from <code>selectionChanged(IAction, ISelection)</code>
1924- * to set the enablement status of the action. The instance variable
1925- * <code>selection</code> will contain the latest selection so the methods
1926- * <code>getSelectedResources()</code> and
1927- * <code>getSelectedProjects()</code> will provide the proper objects.
1928- *
1929- * This method can be overridden by subclasses but should not be invoked by
1930- * them.
1931- */
1932- protected void setActionEnablement(IAction action) {
1933- try {
1934- action.setEnabled(isEnabled());
1935- } catch (TeamException e) {
1936- if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
1937- // Enable the action to allow the user to discover the problem
1938- action.setEnabled(true);
1939- } else {
1940- action.setEnabled(false);
1941- // We should not open a dialog when determining menu enablements
1942- // so log it instead
1943- TeamPlugin.log(e);
1944- }
1945- }
1946- }
1947-
1948- /*
1949- * Method declared on IObjectActionDelegate.
1950- */
1951- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
1952- if (targetPart != null) {
1953- this.shell = targetPart.getSite().getShell();
1954- this.targetPart = targetPart;
1955- }
1956- }
1957-
1958- /**
1959- *
1960- * Shows the given errors to the user.
1961- *
1962- * @param exception
1963- * @param title
1964- * @param message
1965- * void
1966- */
1967- protected void handle(Exception exception, String title, String message) {
1968- Utils.handleError(getShell(), exception, title, message);
1969- }
1970-
1971- /**
1972- * Concrete action enablement code. Subclasses must implement.
1973- *
1974- * @return whether the action is enabled
1975- * @throws TeamException
1976- * if an error occurs during enablement detection
1977- */
1978- abstract protected boolean isEnabled() throws TeamException;
1979-
1980- /**
1981- * Convenience method that maps the given resources to their providers. The
1982- * returned Hashtable has keys which are ITeamProviders, and values which
1983- * are Lists of IResources that are shared with that provider.
1984- *
1985- * @return a hashtable mapping providers to their resources
1986- */
1987- protected Hashtable getProviderMapping(IResource[] resources) {
1988- Hashtable<RepositoryProvider, List<IResource>> result = new Hashtable<RepositoryProvider, List<IResource>>();
1989- for (int i = 0; i < resources.length; i++) {
1990- RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject());
1991- List<IResource> list = result.get(provider);
1992- if (list == null) {
1993- list = new ArrayList<IResource>();
1994- result.put(provider, list);
1995- }
1996- list.add(resources[i]);
1997- }
1998- return result;
1999- }
2000-
2001- /**
2002- * @return IWorkbenchPart
2003- */
2004- protected IWorkbenchPart getTargetPart() {
2005- if (targetPart == null) {
2006- IWorkbenchPage page = TeamUIPlugin.getActivePage();
2007- if (page != null) {
2008- targetPart = page.getActivePart();
2009- }
2010- }
2011- return targetPart;
2012-
2013- }
2014-
2015- /**
2016- * Return the path that was active when the menu item was selected.
2017- *
2018- * @return IWorkbenchPage
2019- */
2020- protected IWorkbenchPage getTargetPage() {
2021- if (getTargetPart() == null)
2022- return TeamUIPlugin.getActivePage();
2023- return getTargetPart().getSite().getPage();
2024- }
2025-
2026- /**
2027- * Show the view with the given ID in the perspective from which the action
2028- * was executed. Returns null if the view is not registered.
2029- *
2030- * @param viewId
2031- * @return IViewPart
2032- */
2033- protected IViewPart showView(String viewId) {
2034- try {
2035- return getTargetPage().showView(viewId);
2036- } catch (PartInitException pe) {
2037- return null;
2038- }
2039- }
2040-
2041- /*
2042- * (non-Javadoc)
2043- *
2044- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
2045- */
2046- public void init(IViewPart view) {
2047- if (view != null) {
2048- this.shell = view.getSite().getShell();
2049- this.targetPart = view;
2050- }
2051- }
2052-
2053- public void init(IWorkbenchWindow window) {
2054- this.window = window;
2055- this.shell = window.getShell();
2056- window.getSelectionService().addPostSelectionListener(selectionListener);
2057- }
2058-
2059- public IWorkbenchWindow getWindow() {
2060- return window;
2061- }
2062-
2063- public void dispose() {
2064- super.dispose();
2065- if (window != null) {
2066- window.getSelectionService().removePostSelectionListener(selectionListener);
2067- }
2068- selection = null;
2069- }
2070+public abstract class TeamAction extends ActionDelegate
2071+ implements IObjectActionDelegate, IViewActionDelegate, IWorkbenchWindowActionDelegate
2072+{
2073+ // The current selection
2074+ private IStructuredSelection selection;
2075+
2076+ // The shell, required for the progress dialog
2077+ private Shell shell;
2078+
2079+ // Constants for determining the type of progress. Subclasses may
2080+ // pass one of these values to the run method.
2081+ public final static int PROGRESS_DIALOG = 1;
2082+ public final static int PROGRESS_BUSYCURSOR = 2;
2083+
2084+ private IWorkbenchPart targetPart;
2085+ private IWorkbenchWindow window;
2086+
2087+ private ISelectionListener selectionListener = new ISelectionListener() {
2088+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
2089+ if (selection instanceof IStructuredSelection) {
2090+ TeamAction.this.selection = (IStructuredSelection) selection;
2091+ }
2092+ }
2093+ };
2094+
2095+ /**
2096+ * Creates an array of the given class type containing all the objects in
2097+ * the selection that adapt to the given class.
2098+ *
2099+ * @param selection
2100+ * @param c
2101+ * @return the selected adaptables
2102+ */
2103+ public static Object[] getSelectedAdaptables(ISelection selection, Class c) {
2104+ ArrayList<Object> result = null;
2105+ if (selection != null && !selection.isEmpty()) {
2106+ result = new ArrayList<Object>();
2107+ Iterator elements = ((IStructuredSelection) selection).iterator();
2108+ while (elements.hasNext()) {
2109+ Object adapter = getAdapter(elements.next(), c);
2110+ if (c.isInstance(adapter)) {
2111+ result.add(adapter);
2112+ }
2113+ }
2114+ }
2115+ if (result != null && !result.isEmpty()) {
2116+ return result.toArray((Object[]) Array.newInstance(c, result.size()));
2117+ }
2118+ return (Object[]) Array.newInstance(c, 0);
2119+ }
2120+
2121+ /**
2122+ * Find the object associated with the given object when it is adapted to
2123+ * the provided class. Null is returned if the given object does not adapt
2124+ * to the given class
2125+ *
2126+ * @param adaptable
2127+ * @param c
2128+ * @return Object
2129+ */
2130+ public static Object getAdapter(Object adaptable, Class c) {
2131+ if (c.isInstance(adaptable)) {
2132+ return adaptable;
2133+ }
2134+ if (adaptable instanceof IAdaptable) {
2135+ IAdaptable a = (IAdaptable) adaptable;
2136+ Object adapter = a.getAdapter(c);
2137+ if (c.isInstance(adapter)) {
2138+ return adapter;
2139+ }
2140+ }
2141+ return null;
2142+ }
2143+
2144+ /**
2145+ * Returns the selected projects.
2146+ *
2147+ * @return the selected projects
2148+ */
2149+ protected IProject[] getSelectedProjects() {
2150+ IResource[] selectedResources = getSelectedResources();
2151+ if (selectedResources.length == 0) {
2152+ return new IProject[0];
2153+ }
2154+ ArrayList<IProject> projects = new ArrayList<IProject>();
2155+ for (IResource resource : selectedResources) {
2156+ if (resource.getType() == IResource.PROJECT) {
2157+ projects.add((IProject) resource);
2158+ }
2159+ }
2160+ return projects.toArray(new IProject[projects.size()]);
2161+ }
2162+
2163+ /**
2164+ * Returns an array of the given class type c that contains all instances of
2165+ * c that are either contained in the selection or are adapted from objects
2166+ * contained in the selection.
2167+ *
2168+ * @param c
2169+ * @return the selection adapted to the given class
2170+ */
2171+ protected Object[] getAdaptedSelection(Class c) {
2172+ return getSelectedAdaptables(selection, c);
2173+ }
2174+
2175+ /**
2176+ * Returns the selected resources.
2177+ *
2178+ * @return the selected resources
2179+ */
2180+ protected IResource[] getSelectedResources() {
2181+ return Utils.getContributedResources(getSelection().toArray());
2182+ }
2183+
2184+ protected IStructuredSelection getSelection() {
2185+ if (selection == null) {
2186+ selection = StructuredSelection.EMPTY;
2187+ }
2188+ return selection;
2189+ }
2190+
2191+ /**
2192+ * Return the selected resource mappins that contain resources in projects
2193+ * that are associated with a repository of the given id.
2194+ *
2195+ * @param providerId the repository provider id
2196+ * @return the resource mappings that contain resources associated with the
2197+ * given provider
2198+ */
2199+ protected ResourceMapping[] getSelectedResourceMappings(String providerId) {
2200+ Object[] elements = getSelection().toArray();
2201+ ArrayList<ResourceMapping> providerMappings = new ArrayList<ResourceMapping>();
2202+ for (Object object : elements) {
2203+ Object adapted = getResourceMapping(object);
2204+ if (adapted instanceof ResourceMapping) {
2205+ ResourceMapping mapping = (ResourceMapping) adapted;
2206+ if (providerId == null || isMappedToProvider(mapping, providerId)) {
2207+ providerMappings.add(mapping);
2208+ }
2209+ }
2210+ }
2211+ return providerMappings.toArray(new ResourceMapping[providerMappings.size()]);
2212+ }
2213+
2214+ private Object getResourceMapping(Object object) {
2215+ if (object instanceof ResourceMapping) {
2216+ return object;
2217+ }
2218+ return LegacyResourceSupport.getAdaptedContributorResourceMapping(object);
2219+ }
2220+
2221+ private boolean isMappedToProvider(ResourceMapping element, String providerId) {
2222+ IProject[] projects = element.getProjects();
2223+ for (IProject project : projects) {
2224+ RepositoryProvider provider = RepositoryProvider.getProvider(project);
2225+ if (provider != null && provider.getID().equals(providerId)) {
2226+ return true;
2227+ }
2228+ }
2229+ return false;
2230+ }
2231+
2232+ /**
2233+ * Convenience method for getting the current shell.
2234+ *
2235+ * @return the shell
2236+ */
2237+ protected Shell getShell() {
2238+ if (shell != null) {
2239+ return shell;
2240+ } else if (targetPart != null) {
2241+ return targetPart.getSite().getShell();
2242+ } else if (window != null) {
2243+ return window.getShell();
2244+ } else {
2245+ IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench();
2246+ if (workbench == null) {
2247+ return null;
2248+ }
2249+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
2250+ if (window == null) {
2251+ return null;
2252+ }
2253+ return window.getShell();
2254+ }
2255+ }
2256+
2257+ /**
2258+ * Convenience method for running an operation with progress and error
2259+ * feedback.
2260+ *
2261+ * @param runnable the runnable which executes the operation
2262+ * @param problemMessage the message to display in the case of errors
2263+ * @param progressKind one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG
2264+ */
2265+ final protected void run(final IRunnableWithProgress runnable,
2266+ final String problemMessage,
2267+ int progressKind)
2268+ {
2269+ final Exception[] exceptions = new Exception[] { null };
2270+ switch (progressKind) {
2271+ case PROGRESS_BUSYCURSOR:
2272+ final Display display = EclipseBazaarUI.getStandardDisplay();
2273+ BusyIndicator.showWhile(display, new Runnable() {
2274+ public void run() {
2275+ try {
2276+ runnable.run(new NullProgressMonitor());
2277+ } catch (InvocationTargetException e) {
2278+ exceptions[0] = e;
2279+ } catch (InterruptedException e) {
2280+ exceptions[0] = null;
2281+ }
2282+ }
2283+ });
2284+ break;
2285+ default:
2286+ case PROGRESS_DIALOG:
2287+ try {
2288+ new ProgressMonitorDialog(getShell()).run(true, true, runnable);
2289+ } catch (InvocationTargetException e) {
2290+ exceptions[0] = e;
2291+ } catch (InterruptedException e) {
2292+ exceptions[0] = null;
2293+ }
2294+ break;
2295+ }
2296+ if (exceptions[0] != null) {
2297+ handle(exceptions[0], null, problemMessage);
2298+ }
2299+ }
2300+
2301+ /*
2302+ * Method declared on IActionDelegate.
2303+ */
2304+ public void selectionChanged(IAction action, ISelection selection) {
2305+ if (selection instanceof IStructuredSelection) {
2306+ this.selection = (IStructuredSelection) selection;
2307+ if (action != null) {
2308+ setActionEnablement(action);
2309+ }
2310+ }
2311+ }
2312+
2313+ /**
2314+ * Method invoked from <code>selectionChanged(IAction, ISelection)</code> to
2315+ * set the enablement status of the action. The instance variable
2316+ * <code>selection</code> will contain the latest selection so the methods
2317+ * <code>getSelectedResources()</code> and
2318+ * <code>getSelectedProjects()</code> will provide the proper objects.
2319+ *
2320+ * This method can be overridden by subclasses but should not be invoked by
2321+ * them.
2322+ */
2323+ protected void setActionEnablement(IAction action) {
2324+ try {
2325+ action.setEnabled(isEnabled());
2326+ } catch (TeamException e) {
2327+ if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
2328+ // Enable the action to allow the user to discover the problem
2329+ action.setEnabled(true);
2330+ } else {
2331+ action.setEnabled(false);
2332+ // We should not open a dialog when determining menu enablements
2333+ // so log it instead
2334+ TeamPlugin.log(e);
2335+ }
2336+ }
2337+ }
2338+
2339+ /*
2340+ * Method declared on IObjectActionDelegate.
2341+ */
2342+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
2343+ if (targetPart != null) {
2344+ this.shell = targetPart.getSite().getShell();
2345+ this.targetPart = targetPart;
2346+ }
2347+ }
2348+
2349+ /**
2350+ *
2351+ * Shows the given errors to the user.
2352+ *
2353+ * @param exception
2354+ * @param title
2355+ * @param message void
2356+ */
2357+ protected void handle(Exception exception, String title, String message) {
2358+ Utils.handleError(getShell(), exception, title, message);
2359+ }
2360+
2361+ /**
2362+ * Concrete action enablement code. Subclasses must implement.
2363+ *
2364+ * @return whether the action is enabled
2365+ * @throws TeamException if an error occurs during enablement detection
2366+ */
2367+ abstract protected boolean isEnabled() throws TeamException;
2368+
2369+ /**
2370+ * Convenience method that maps the given resources to their providers. The
2371+ * returned Hashtable has keys which are ITeamProviders, and values which
2372+ * are Lists of IResources that are shared with that provider.
2373+ *
2374+ * @return a hashtable mapping providers to their resources
2375+ */
2376+ protected Hashtable getProviderMapping(IResource[] resources) {
2377+ Hashtable<RepositoryProvider, List<IResource>> result =
2378+ new Hashtable<RepositoryProvider, List<IResource>>();
2379+ for (IResource resource : resources) {
2380+ RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject());
2381+ List<IResource> list = result.get(provider);
2382+ if (list == null) {
2383+ list = new ArrayList<IResource>();
2384+ result.put(provider, list);
2385+ }
2386+ list.add(resource);
2387+ }
2388+ return result;
2389+ }
2390+
2391+ /**
2392+ * @return IWorkbenchPart
2393+ */
2394+ protected IWorkbenchPart getTargetPart() {
2395+ if (targetPart == null) {
2396+ IWorkbenchPage page = TeamUIPlugin.getActivePage();
2397+ if (page != null) {
2398+ targetPart = page.getActivePart();
2399+ }
2400+ }
2401+ return targetPart;
2402+
2403+ }
2404+
2405+ /**
2406+ * Return the path that was active when the menu item was selected.
2407+ *
2408+ * @return IWorkbenchPage
2409+ */
2410+ protected IWorkbenchPage getTargetPage() {
2411+ if (getTargetPart() == null) {
2412+ return TeamUIPlugin.getActivePage();
2413+ }
2414+ return getTargetPart().getSite().getPage();
2415+ }
2416+
2417+ /**
2418+ * Show the view with the given ID in the perspective from which the action
2419+ * was executed. Returns null if the view is not registered.
2420+ *
2421+ * @param viewId
2422+ * @return IViewPart
2423+ */
2424+ protected IViewPart showView(String viewId) {
2425+ try {
2426+ return getTargetPage().showView(viewId);
2427+ } catch (PartInitException pe) {
2428+ return null;
2429+ }
2430+ }
2431+
2432+ /*
2433+ * (non-Javadoc)
2434+ *
2435+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
2436+ */
2437+ public void init(IViewPart view) {
2438+ if (view != null) {
2439+ this.shell = view.getSite().getShell();
2440+ this.targetPart = view;
2441+ }
2442+ }
2443+
2444+ public void init(IWorkbenchWindow window) {
2445+ this.window = window;
2446+ this.shell = window.getShell();
2447+ window.getSelectionService().addPostSelectionListener(selectionListener);
2448+ }
2449+
2450+ public IWorkbenchWindow getWindow() {
2451+ return window;
2452+ }
2453+
2454+ public void dispose() {
2455+ super.dispose();
2456+ if (window != null) {
2457+ window.getSelectionService().removePostSelectionListener(selectionListener);
2458+ }
2459+ selection = null;
2460+ }
2461 }
2462
2463=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/properties/BazaarPropertyPage.java'
2464--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/properties/BazaarPropertyPage.java 2008-04-11 22:11:00 +0000
2465+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/properties/BazaarPropertyPage.java 2009-04-29 06:02:45 +0000
2466@@ -26,381 +26,392 @@
2467 */
2468 public class BazaarPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
2469
2470- private IBazaarInfo info = null;
2471- private Text layout;
2472- private Text controlDirFormat;
2473- // Formats
2474- private Composite formats;
2475- private Text branchFormat;
2476- private Text controlFormat;
2477- private Text repositoryFormat;
2478- private Text workingTreeFormat;
2479- // locations
2480- private Composite locations;
2481- private Text lightCheckoutRoot;
2482- private Text repositoryCheckoutRoot;
2483- private Text checkoutRoot;
2484- private Text checkoutOfBranch;
2485- private Text sharedRepository;
2486- private Text repository;
2487- private Text repositoryBranch;
2488- private Text branchRoot;
2489- private Text boundToBranch;
2490- // related branches
2491- private Composite relatedBranches;
2492- private Text publicBranch;
2493- private Text pushBranch;
2494- private Text parentBranch;
2495- private Text submitBranch;
2496- // stats
2497- private Composite workingTreeStats;
2498- private Text added;
2499- private Text ignored;
2500- private Text modified;
2501- private Text removed;
2502- private Text renamed;
2503- private Text unchanged;
2504- private Text unknown;
2505- private Text versionedSubdirectories;
2506-
2507- private Composite branchHistory;
2508- private Text branchRevisions;
2509- private Text committers;
2510- private Text daysOld;
2511- private Text firstRevisionDate;
2512- private Text latestRevisionDate;
2513-
2514- private Composite repositoryStats;
2515- private Text repositoryRevisions;
2516- private Text repositorySize;
2517-
2518- public BazaarPropertyPage() {
2519- super();
2520- }
2521-
2522- private void addFirstSection(Composite parent) {
2523- Composite composite = createDefaultComposite(parent);
2524-
2525- Label label = new Label(composite, SWT.NONE);
2526- label.setText("Layout: "); //$NON-NLS-1$
2527- layout = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
2528-
2529- label = new Label(composite, SWT.NONE);
2530- label.setText("Control directory format: "); //$NON-NLS-1$
2531- controlDirFormat = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
2532-
2533- // populate fields
2534- if (info == null)
2535- return;
2536- layout.setText(info.getLayout());
2537- final StringBuilder sb = new StringBuilder();
2538- String[] formats = info.getFormats();
2539- for (int idx = 0; idx < formats.length; idx++) {
2540- sb.append(formats[idx]);
2541- if (idx + 1 < formats.length)
2542- sb.append(" or ");
2543- }
2544- controlDirFormat.setText(sb.toString());
2545-
2546- // related branches
2547- if(info.getRelatedBranches() == null)
2548- return;
2549- label = new Label(composite, SWT.NONE);
2550- label.setText("Related branches: "); //$NON-NLS-1$
2551- relatedBranches = createDefaultComposite(composite);
2552- if (info.getRelatedBranches().getParentBranch() != null) {
2553- label = new Label(relatedBranches, SWT.NONE);
2554- label.setText("Parent Branch: "); //$NON-NLS-1$
2555- parentBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2556- parentBranch.setText(info.getRelatedBranches().getParentBranch());
2557- }
2558- if (info.getRelatedBranches().getPushBranch() != null) {
2559- label = new Label(relatedBranches, SWT.NONE);
2560- label.setText("Push branch: "); //$NON-NLS-1$
2561- pushBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2562- pushBranch.setText(info.getRelatedBranches().getPushBranch());
2563- }
2564- if (info.getRelatedBranches().getPublicBranch() != null) {
2565- label = new Label(relatedBranches, SWT.NONE);
2566- label.setText("Public branch: "); //$NON-NLS-1$
2567- publicBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2568- publicBranch.setText(info.getRelatedBranches().getSubmitBranch());
2569- }
2570- if (info.getRelatedBranches().getSubmitBranch() != null) {
2571- label = new Label(relatedBranches, SWT.NONE);
2572- label.setText("Submit branch: "); //$NON-NLS-1$
2573- submitBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2574- submitBranch.setText(info.getRelatedBranches().getSubmitBranch());
2575- }
2576-
2577- }
2578-
2579- private void addSeparator(Composite parent) {
2580- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
2581- GridData gridData = new GridData();
2582- gridData.horizontalAlignment = GridData.FILL;
2583- gridData.grabExcessHorizontalSpace = true;
2584- separator.setLayoutData(gridData);
2585- }
2586-
2587- private void addSecondSection(Composite parent) {
2588- Composite composite = createDefaultComposite(parent);
2589- Label label = new Label(composite, SWT.NONE);
2590- label.setText("Formats: "); //$NON-NLS-1$
2591- formats = createDefaultComposite(composite);
2592- label = new Label(formats, SWT.NONE);
2593- label.setText("Branch format: "); //$NON-NLS-1$
2594- branchFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2595- label = new Label(formats, SWT.NONE);
2596- label.setText("Control format: "); //$NON-NLS-1$
2597- controlFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2598- label = new Label(formats, SWT.NONE);
2599- label.setText("Repository format: "); //$NON-NLS-1$
2600- repositoryFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2601- label = new Label(formats, SWT.NONE);
2602- label.setText("Working tree format: "); //$NON-NLS-1$
2603- workingTreeFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2604-
2605-// populate default fields
2606- if (info == null)
2607- return;
2608- branchFormat.setText(info.getBranchFormat() == null ? "" : info.getBranchFormat());
2609- controlFormat.setText(info.getControlFormat() == null ? "" : info.getControlFormat());
2610- repositoryFormat.setText(info.getRepositoryFormat() == null ? "" : info.getRepositoryFormat());
2611- workingTreeFormat.setText(info.getWorkingTreeFormat() == null ? "" : info.getWorkingTreeFormat());
2612-
2613- createLocations(composite);
2614-
2615- createWorkingTreeStats(composite);
2616-
2617- createBranchHistory(composite);
2618-
2619- if(info.getRepositoryStats() == null)
2620- return;
2621- label = new Label(composite, SWT.NONE);
2622- label.setText("Repository"); //$NON-NLS-1$
2623- repositoryStats = createDefaultComposite(composite);
2624- if(info.getRepositoryStats().getRevisionCount() != null) {
2625- repositoryRevisions = new Text(repositoryStats, SWT.WRAP | SWT.READ_ONLY);
2626- repositoryRevisions.setText(info.getRepositoryStats().getRevisionCount().toString());
2627- label = new Label(repositoryStats, SWT.NONE);
2628- label.setText("revisions"); //$NON-NLS-1$
2629- }
2630- if(info.getRepositoryStats().getSize() != null) {
2631- repositorySize = new Text(repositoryStats, SWT.WRAP | SWT.READ_ONLY);
2632- repositorySize.setText(info.getRepositoryStats().getSize().toString());
2633- label = new Label(repositoryStats, SWT.NONE);
2634- label.setText("KiB"); //$NON-NLS-1$
2635- }
2636-
2637- }
2638-
2639- private void createWorkingTreeStats(Composite parent) {
2640- if(info.getWorkingTreeStats() == null)
2641- return;
2642- Label label = new Label(parent, SWT.NONE);
2643- label.setText("In the working tree"); //$NON-NLS-1$
2644- workingTreeStats = createDefaultComposite(parent);
2645- if (info.getWorkingTreeStats().getUnchanged() != null) {
2646- unchanged = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2647- unchanged.setText(info.getWorkingTreeStats().getUnchanged().toString());
2648- label = new Label(workingTreeStats, SWT.NONE);
2649- label.setText("unchanged"); //$NON-NLS-1$
2650- }
2651- if (info.getWorkingTreeStats().getModified() != null) {
2652- modified = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2653- modified.setText(info.getWorkingTreeStats().getModified().toString());
2654- label = new Label(workingTreeStats, SWT.NONE);
2655- label.setText("modified"); //$NON-NLS-1$
2656- }
2657- if (info.getWorkingTreeStats().getAdded() != null) {
2658- added = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2659- added.setText(info.getWorkingTreeStats().getAdded().toString());
2660- label = new Label(workingTreeStats, SWT.NONE);
2661- label.setText("added"); //$NON-NLS-1$
2662- }
2663- if (info.getWorkingTreeStats().getRemoved() != null) {
2664- removed = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2665- removed.setText(info.getWorkingTreeStats().getRemoved().toString());
2666- label = new Label(workingTreeStats, SWT.NONE);
2667- label.setText("removed"); //$NON-NLS-1$
2668- }
2669- if (info.getWorkingTreeStats().getRenamed() != null) {
2670- renamed = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2671- renamed.setText(info.getWorkingTreeStats().getRenamed().toString());
2672- label = new Label(workingTreeStats, SWT.NONE);
2673- label.setText("renamed"); //$NON-NLS-1$
2674- }
2675- if (info.getWorkingTreeStats().getUnknown() != null) {
2676- unknown = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2677- unknown.setText(info.getWorkingTreeStats().getUnknown().toString());
2678- label = new Label(workingTreeStats, SWT.NONE);
2679- label.setText("unknown"); //$NON-NLS-1$
2680- }
2681- if (info.getWorkingTreeStats().getIgnored() != null) {
2682- ignored = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2683- ignored.setText(info.getWorkingTreeStats().getIgnored().toString());
2684- label = new Label(workingTreeStats, SWT.NONE);
2685- label.setText("ignored"); //$NON-NLS-1$
2686- }
2687- if (info.getWorkingTreeStats().getVersionedSubdirectories() != null) {
2688- versionedSubdirectories = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
2689- versionedSubdirectories.setText(info.getWorkingTreeStats().getVersionedSubdirectories().toString());
2690- label = new Label(workingTreeStats, SWT.NONE);
2691- label.setText("versioned subdirectories"); //$NON-NLS-1$
2692- }
2693-
2694- }
2695-
2696- private void createLocations(Composite parent) {
2697- if(info.getLocations() == null)
2698- return;
2699- Label label = new Label(parent, SWT.NONE);
2700- label.setText("Locations: "); //$NON-NLS-1$
2701- locations = createDefaultComposite(parent);
2702- if (info.getLocations().getLightCheckoutRoot() != null) {
2703- label = new Label(locations, SWT.NONE);
2704- label.setText("Light checkout root: "); //$NON-NLS-1$
2705- lightCheckoutRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2706- lightCheckoutRoot.setText(info.getLocations().getLightCheckoutRoot());
2707- }
2708- if (info.getLocations().getRepositoryCheckoutRoot() != null) {
2709- label = new Label(locations, SWT.NONE);
2710- label.setText("Repository checkout root: "); //$NON-NLS-1$
2711- repositoryCheckoutRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2712- repositoryCheckoutRoot.setText(info.getLocations().getRepositoryCheckoutRoot());
2713- }
2714- if (info.getLocations().getCheckoutRoot() != null) {
2715- label = new Label(locations, SWT.NONE);
2716- label.setText("Checkout root: "); //$NON-NLS-1$
2717- checkoutRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2718- checkoutRoot.setText(info.getLocations().getCheckoutRoot());
2719- }
2720- if (info.getLocations().getCheckoutOfBranch() != null) {
2721- label = new Label(locations, SWT.NONE);
2722- label.setText("Checkout of branch: "); //$NON-NLS-1$
2723- checkoutOfBranch = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2724- checkoutOfBranch.setText(info.getLocations().getCheckoutOfBranch());
2725- }
2726- if (info.getLocations().getSharedRepository() != null) {
2727- label = new Label(locations, SWT.NONE);
2728- label.setText("Shared repository: "); //$NON-NLS-1$
2729- sharedRepository = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2730- sharedRepository.setText(info.getLocations().getSharedRepository());
2731- }
2732- if (info.getLocations().getRepository() != null) {
2733- label = new Label(locations, SWT.NONE);
2734- label.setText("Repository: "); //$NON-NLS-1$
2735- repository = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2736- repository.setText(info.getLocations().getRepository());
2737- }
2738- if (info.getLocations().getRepositoryBranch() != null) {
2739- label = new Label(locations, SWT.NONE);
2740- label.setText("Repository branch: "); //$NON-NLS-1$
2741- repositoryBranch = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2742- repositoryBranch.setText(info.getLocations().getRepositoryBranch());
2743- }
2744- if (info.getLocations().getBranchRoot() != null) {
2745- label = new Label(locations, SWT.NONE);
2746- label.setText("Branch root: "); //$NON-NLS-1$
2747- branchRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2748- branchRoot.setText(info.getLocations().getBranchRoot());
2749- }
2750- if (info.getLocations().getBoundToBranch() != null) {
2751- label = new Label(locations, SWT.NONE);
2752- label.setText("Bound to branch: "); //$NON-NLS-1$
2753- boundToBranch = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
2754- boundToBranch.setText(info.getLocations().getBoundToBranch());
2755- }
2756- }
2757-
2758- private void createBranchHistory(Composite parent) {
2759- if (info.getBranchHistory() == null)
2760- return;
2761- Label label = new Label(parent, SWT.NONE);
2762- label.setText("Branch history: "); //$NON-NLS-1$
2763- branchHistory = createDefaultComposite(parent);
2764- if (info.getBranchHistory().getRevisions() != null) {
2765- label = new Label(branchHistory, SWT.NONE);
2766- label.setText("Revisions: "); //$NON-NLS-1$
2767- branchRevisions = new Text(branchHistory, SWT.WRAP | SWT.READ_ONLY);
2768- branchRevisions.setText(info.getBranchHistory().getRevisions().toString());
2769- }
2770- if (info.getBranchHistory().getCommitters() != null) {
2771- label = new Label(branchHistory, SWT.NONE);
2772- label.setText("Committers: "); //$NON-NLS-1$
2773- committers = new Text(branchHistory, SWT.WRAP | SWT.READ_ONLY);
2774- committers.setText(info.getBranchHistory().getCommitters().toString());
2775- }
2776- if (info.getBranchHistory().getDaysOld() != null) {
2777- label = new Label(branchHistory, SWT.NONE);
2778- label.setText("Days old: "); //$NON-NLS-1$
2779- daysOld = new Text(branchHistory, SWT.WRAP | SWT.READ_ONLY);
2780- daysOld.setText(info.getBranchHistory().getDaysOld().toString());
2781- }
2782- if (info.getBranchHistory().getFirstRevisionDate() != null) {
2783- label = new Label(branchHistory, SWT.NONE);
2784- label.setText("First revision date: "); //$NON-NLS-1$
2785- firstRevisionDate = new Text(branchHistory, SWT.SINGLE | SWT.READ_ONLY);
2786- firstRevisionDate.setText(info.getBranchHistory().getFirstRevisionDate().toString());
2787- }
2788- if (info.getBranchHistory().getLatestRevisionDate() != null) {
2789- label = new Label(branchHistory, SWT.NONE);
2790- label.setText("Latest revision date: "); //$NON-NLS-1$
2791- latestRevisionDate = new Text(branchHistory, SWT.SINGLE | SWT.READ_ONLY);
2792- latestRevisionDate.setText(info.getBranchHistory().getLatestRevisionDate().toString());
2793- }
2794- }
2795-
2796- /*
2797- * @see PreferencePage#createContents(Composite)
2798- */
2799- protected Control createContents(Composite parent) {
2800- Composite composite = new Composite(parent, SWT.NONE);
2801- GridLayout layout = new GridLayout();
2802- composite.setLayout(layout);
2803- GridData data = new GridData(GridData.FILL);
2804-
2805- composite.setLayoutData(data);
2806- loadInfo();
2807- addFirstSection(composite);
2808- addSeparator(composite);
2809- addSecondSection(composite);
2810-
2811- Dialog.applyDialogFont(parent);
2812-
2813- return composite;
2814- }
2815-
2816- private Composite createDefaultComposite(Composite parent) {
2817- Composite composite = new Composite(parent, SWT.NULL);
2818- GridLayout layout = new GridLayout();
2819- layout.numColumns = 2;
2820- composite.setLayout(layout);
2821-
2822- GridData data = new GridData();
2823- data.verticalAlignment = GridData.FILL;
2824- composite.setLayoutData(data);
2825-
2826- return composite;
2827- }
2828-
2829- private void loadInfo() {
2830- IResource resource = (IResource) getElement();
2831- try {
2832- InfoCommand cmd = new InfoCommand(resource.getProject());
2833- cmd.run(new NullProgressMonitor());
2834- info = cmd.getInfo();
2835- } catch (BazaarException e) {
2836- EclipseBazaarUI.log(e);
2837- }
2838- }
2839-
2840- protected void performDefaults() {
2841- }
2842-
2843- public boolean performOk() {
2844- return true;
2845- }
2846+ private IBazaarInfo info = null;
2847+ private Text layout;
2848+ private Text controlDirFormat;
2849+ // Formats
2850+ private Composite formats;
2851+ private Text branchFormat;
2852+ private Text controlFormat;
2853+ private Text repositoryFormat;
2854+ private Text workingTreeFormat;
2855+ // locations
2856+ private Composite locations;
2857+ private Text lightCheckoutRoot;
2858+ private Text repositoryCheckoutRoot;
2859+ private Text checkoutRoot;
2860+ private Text checkoutOfBranch;
2861+ private Text sharedRepository;
2862+ private Text repository;
2863+ private Text repositoryBranch;
2864+ private Text branchRoot;
2865+ private Text boundToBranch;
2866+ // related branches
2867+ private Composite relatedBranches;
2868+ private Text publicBranch;
2869+ private Text pushBranch;
2870+ private Text parentBranch;
2871+ private Text submitBranch;
2872+ // stats
2873+ private Composite workingTreeStats;
2874+ private Text added;
2875+ private Text ignored;
2876+ private Text modified;
2877+ private Text removed;
2878+ private Text renamed;
2879+ private Text unchanged;
2880+ private Text unknown;
2881+ private Text versionedSubdirectories;
2882+
2883+ private Composite branchHistory;
2884+ private Text branchRevisions;
2885+ private Text committers;
2886+ private Text daysOld;
2887+ private Text firstRevisionDate;
2888+ private Text latestRevisionDate;
2889+
2890+ private Composite repositoryStats;
2891+ private Text repositoryRevisions;
2892+ private Text repositorySize;
2893+
2894+ public BazaarPropertyPage() {
2895+ super();
2896+ }
2897+
2898+ private void addFirstSection(Composite parent) {
2899+ Composite composite = createDefaultComposite(parent);
2900+
2901+ Label label = new Label(composite, SWT.NONE);
2902+ label.setText("Layout: "); //$NON-NLS-1$
2903+ layout = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
2904+
2905+ label = new Label(composite, SWT.NONE);
2906+ label.setText("Control directory format: "); //$NON-NLS-1$
2907+ controlDirFormat = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
2908+
2909+ // populate fields
2910+ if (info == null) {
2911+ return;
2912+ }
2913+ layout.setText(info.getLayout());
2914+ final StringBuilder sb = new StringBuilder();
2915+ String[] formats = info.getFormats();
2916+ for (int idx = 0; idx < formats.length; idx++) {
2917+ sb.append(formats[idx]);
2918+ if (idx + 1 < formats.length) {
2919+ sb.append(" or ");
2920+ }
2921+ }
2922+ controlDirFormat.setText(sb.toString());
2923+
2924+ // related branches
2925+ if (info.getRelatedBranches() == null) {
2926+ return;
2927+ }
2928+ label = new Label(composite, SWT.NONE);
2929+ label.setText("Related branches: "); //$NON-NLS-1$
2930+ relatedBranches = createDefaultComposite(composite);
2931+ if (info.getRelatedBranches().getParentBranch() != null) {
2932+ label = new Label(relatedBranches, SWT.NONE);
2933+ label.setText("Parent Branch: "); //$NON-NLS-1$
2934+ parentBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2935+ parentBranch.setText(info.getRelatedBranches().getParentBranch());
2936+ }
2937+ if (info.getRelatedBranches().getPushBranch() != null) {
2938+ label = new Label(relatedBranches, SWT.NONE);
2939+ label.setText("Push branch: "); //$NON-NLS-1$
2940+ pushBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2941+ pushBranch.setText(info.getRelatedBranches().getPushBranch());
2942+ }
2943+ if (info.getRelatedBranches().getPublicBranch() != null) {
2944+ label = new Label(relatedBranches, SWT.NONE);
2945+ label.setText("Public branch: "); //$NON-NLS-1$
2946+ publicBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2947+ publicBranch.setText(info.getRelatedBranches().getSubmitBranch());
2948+ }
2949+ if (info.getRelatedBranches().getSubmitBranch() != null) {
2950+ label = new Label(relatedBranches, SWT.NONE);
2951+ label.setText("Submit branch: "); //$NON-NLS-1$
2952+ submitBranch = new Text(relatedBranches, SWT.SINGLE | SWT.READ_ONLY);
2953+ submitBranch.setText(info.getRelatedBranches().getSubmitBranch());
2954+ }
2955+
2956+ }
2957+
2958+ private void addSeparator(Composite parent) {
2959+ Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
2960+ GridData gridData = new GridData();
2961+ gridData.horizontalAlignment = GridData.FILL;
2962+ gridData.grabExcessHorizontalSpace = true;
2963+ separator.setLayoutData(gridData);
2964+ }
2965+
2966+ private void addSecondSection(Composite parent) {
2967+ Composite composite = createDefaultComposite(parent);
2968+ Label label = new Label(composite, SWT.NONE);
2969+ label.setText("Formats: "); //$NON-NLS-1$
2970+ formats = createDefaultComposite(composite);
2971+ label = new Label(formats, SWT.NONE);
2972+ label.setText("Branch format: "); //$NON-NLS-1$
2973+ branchFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2974+ label = new Label(formats, SWT.NONE);
2975+ label.setText("Control format: "); //$NON-NLS-1$
2976+ controlFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2977+ label = new Label(formats, SWT.NONE);
2978+ label.setText("Repository format: "); //$NON-NLS-1$
2979+ repositoryFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2980+ label = new Label(formats, SWT.NONE);
2981+ label.setText("Working tree format: "); //$NON-NLS-1$
2982+ workingTreeFormat = new Text(formats, SWT.SINGLE | SWT.READ_ONLY);
2983+
2984+ // populate default fields
2985+ if (info == null) {
2986+ return;
2987+ }
2988+ branchFormat.setText(info.getBranchFormat() == null ? "" : info.getBranchFormat());
2989+ controlFormat.setText(info.getControlFormat() == null ? "" : info.getControlFormat());
2990+ repositoryFormat.setText(info.getRepositoryFormat() == null ? "" : info
2991+ .getRepositoryFormat());
2992+ workingTreeFormat.setText(info.getWorkingTreeFormat() == null ? "" : info
2993+ .getWorkingTreeFormat());
2994+
2995+ createLocations(composite);
2996+
2997+ createWorkingTreeStats(composite);
2998+
2999+ createBranchHistory(composite);
3000+
3001+ if (info.getRepositoryStats() == null) {
3002+ return;
3003+ }
3004+ label = new Label(composite, SWT.NONE);
3005+ label.setText("Repository"); //$NON-NLS-1$
3006+ repositoryStats = createDefaultComposite(composite);
3007+ if (info.getRepositoryStats().getRevisionCount() != null) {
3008+ repositoryRevisions = new Text(repositoryStats, SWT.WRAP | SWT.READ_ONLY);
3009+ repositoryRevisions.setText(info.getRepositoryStats().getRevisionCount().toString());
3010+ label = new Label(repositoryStats, SWT.NONE);
3011+ label.setText("revisions"); //$NON-NLS-1$
3012+ }
3013+ if (info.getRepositoryStats().getSize() != null) {
3014+ repositorySize = new Text(repositoryStats, SWT.WRAP | SWT.READ_ONLY);
3015+ repositorySize.setText(info.getRepositoryStats().getSize().toString());
3016+ label = new Label(repositoryStats, SWT.NONE);
3017+ label.setText("KiB"); //$NON-NLS-1$
3018+ }
3019+
3020+ }
3021+
3022+ private void createWorkingTreeStats(Composite parent) {
3023+ if (info.getWorkingTreeStats() == null) {
3024+ return;
3025+ }
3026+ Label label = new Label(parent, SWT.NONE);
3027+ label.setText("In the working tree"); //$NON-NLS-1$
3028+ workingTreeStats = createDefaultComposite(parent);
3029+ if (info.getWorkingTreeStats().getUnchanged() != null) {
3030+ unchanged = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3031+ unchanged.setText(info.getWorkingTreeStats().getUnchanged().toString());
3032+ label = new Label(workingTreeStats, SWT.NONE);
3033+ label.setText("unchanged"); //$NON-NLS-1$
3034+ }
3035+ if (info.getWorkingTreeStats().getModified() != null) {
3036+ modified = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3037+ modified.setText(info.getWorkingTreeStats().getModified().toString());
3038+ label = new Label(workingTreeStats, SWT.NONE);
3039+ label.setText("modified"); //$NON-NLS-1$
3040+ }
3041+ if (info.getWorkingTreeStats().getAdded() != null) {
3042+ added = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3043+ added.setText(info.getWorkingTreeStats().getAdded().toString());
3044+ label = new Label(workingTreeStats, SWT.NONE);
3045+ label.setText("added"); //$NON-NLS-1$
3046+ }
3047+ if (info.getWorkingTreeStats().getRemoved() != null) {
3048+ removed = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3049+ removed.setText(info.getWorkingTreeStats().getRemoved().toString());
3050+ label = new Label(workingTreeStats, SWT.NONE);
3051+ label.setText("removed"); //$NON-NLS-1$
3052+ }
3053+ if (info.getWorkingTreeStats().getRenamed() != null) {
3054+ renamed = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3055+ renamed.setText(info.getWorkingTreeStats().getRenamed().toString());
3056+ label = new Label(workingTreeStats, SWT.NONE);
3057+ label.setText("renamed"); //$NON-NLS-1$
3058+ }
3059+ if (info.getWorkingTreeStats().getUnknown() != null) {
3060+ unknown = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3061+ unknown.setText(info.getWorkingTreeStats().getUnknown().toString());
3062+ label = new Label(workingTreeStats, SWT.NONE);
3063+ label.setText("unknown"); //$NON-NLS-1$
3064+ }
3065+ if (info.getWorkingTreeStats().getIgnored() != null) {
3066+ ignored = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3067+ ignored.setText(info.getWorkingTreeStats().getIgnored().toString());
3068+ label = new Label(workingTreeStats, SWT.NONE);
3069+ label.setText("ignored"); //$NON-NLS-1$
3070+ }
3071+ if (info.getWorkingTreeStats().getVersionedSubdirectories() != null) {
3072+ versionedSubdirectories = new Text(workingTreeStats, SWT.WRAP | SWT.READ_ONLY);
3073+ versionedSubdirectories.setText(info.getWorkingTreeStats().getVersionedSubdirectories()
3074+ .toString());
3075+ label = new Label(workingTreeStats, SWT.NONE);
3076+ label.setText("versioned subdirectories"); //$NON-NLS-1$
3077+ }
3078+
3079+ }
3080+
3081+ private void createLocations(Composite parent) {
3082+ if (info.getLocations() == null) {
3083+ return;
3084+ }
3085+ Label label = new Label(parent, SWT.NONE);
3086+ label.setText("Locations: "); //$NON-NLS-1$
3087+ locations = createDefaultComposite(parent);
3088+ if (info.getLocations().getLightCheckoutRoot() != null) {
3089+ label = new Label(locations, SWT.NONE);
3090+ label.setText("Light checkout root: "); //$NON-NLS-1$
3091+ lightCheckoutRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3092+ lightCheckoutRoot.setText(info.getLocations().getLightCheckoutRoot());
3093+ }
3094+ if (info.getLocations().getRepositoryCheckoutRoot() != null) {
3095+ label = new Label(locations, SWT.NONE);
3096+ label.setText("Repository checkout root: "); //$NON-NLS-1$
3097+ repositoryCheckoutRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3098+ repositoryCheckoutRoot.setText(info.getLocations().getRepositoryCheckoutRoot());
3099+ }
3100+ if (info.getLocations().getCheckoutRoot() != null) {
3101+ label = new Label(locations, SWT.NONE);
3102+ label.setText("Checkout root: "); //$NON-NLS-1$
3103+ checkoutRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3104+ checkoutRoot.setText(info.getLocations().getCheckoutRoot());
3105+ }
3106+ if (info.getLocations().getCheckoutOfBranch() != null) {
3107+ label = new Label(locations, SWT.NONE);
3108+ label.setText("Checkout of branch: "); //$NON-NLS-1$
3109+ checkoutOfBranch = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3110+ checkoutOfBranch.setText(info.getLocations().getCheckoutOfBranch());
3111+ }
3112+ if (info.getLocations().getSharedRepository() != null) {
3113+ label = new Label(locations, SWT.NONE);
3114+ label.setText("Shared repository: "); //$NON-NLS-1$
3115+ sharedRepository = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3116+ sharedRepository.setText(info.getLocations().getSharedRepository());
3117+ }
3118+ if (info.getLocations().getRepository() != null) {
3119+ label = new Label(locations, SWT.NONE);
3120+ label.setText("Repository: "); //$NON-NLS-1$
3121+ repository = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3122+ repository.setText(info.getLocations().getRepository());
3123+ }
3124+ if (info.getLocations().getRepositoryBranch() != null) {
3125+ label = new Label(locations, SWT.NONE);
3126+ label.setText("Repository branch: "); //$NON-NLS-1$
3127+ repositoryBranch = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3128+ repositoryBranch.setText(info.getLocations().getRepositoryBranch());
3129+ }
3130+ if (info.getLocations().getBranchRoot() != null) {
3131+ label = new Label(locations, SWT.NONE);
3132+ label.setText("Branch root: "); //$NON-NLS-1$
3133+ branchRoot = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3134+ branchRoot.setText(info.getLocations().getBranchRoot());
3135+ }
3136+ if (info.getLocations().getBoundToBranch() != null) {
3137+ label = new Label(locations, SWT.NONE);
3138+ label.setText("Bound to branch: "); //$NON-NLS-1$
3139+ boundToBranch = new Text(locations, SWT.SINGLE | SWT.READ_ONLY);
3140+ boundToBranch.setText(info.getLocations().getBoundToBranch());
3141+ }
3142+ }
3143+
3144+ private void createBranchHistory(Composite parent) {
3145+ if (info.getBranchHistory() == null) {
3146+ return;
3147+ }
3148+ Label label = new Label(parent, SWT.NONE);
3149+ label.setText("Branch history: "); //$NON-NLS-1$
3150+ branchHistory = createDefaultComposite(parent);
3151+ if (info.getBranchHistory().getRevisions() != null) {
3152+ label = new Label(branchHistory, SWT.NONE);
3153+ label.setText("Revisions: "); //$NON-NLS-1$
3154+ branchRevisions = new Text(branchHistory, SWT.WRAP | SWT.READ_ONLY);
3155+ branchRevisions.setText(info.getBranchHistory().getRevisions().toString());
3156+ }
3157+ if (info.getBranchHistory().getCommitters() != null) {
3158+ label = new Label(branchHistory, SWT.NONE);
3159+ label.setText("Committers: "); //$NON-NLS-1$
3160+ committers = new Text(branchHistory, SWT.WRAP | SWT.READ_ONLY);
3161+ committers.setText(info.getBranchHistory().getCommitters().toString());
3162+ }
3163+ if (info.getBranchHistory().getDaysOld() != null) {
3164+ label = new Label(branchHistory, SWT.NONE);
3165+ label.setText("Days old: "); //$NON-NLS-1$
3166+ daysOld = new Text(branchHistory, SWT.WRAP | SWT.READ_ONLY);
3167+ daysOld.setText(info.getBranchHistory().getDaysOld().toString());
3168+ }
3169+ if (info.getBranchHistory().getFirstRevisionDate() != null) {
3170+ label = new Label(branchHistory, SWT.NONE);
3171+ label.setText("First revision date: "); //$NON-NLS-1$
3172+ firstRevisionDate = new Text(branchHistory, SWT.SINGLE | SWT.READ_ONLY);
3173+ firstRevisionDate.setText(info.getBranchHistory().getFirstRevisionDate().toString());
3174+ }
3175+ if (info.getBranchHistory().getLatestRevisionDate() != null) {
3176+ label = new Label(branchHistory, SWT.NONE);
3177+ label.setText("Latest revision date: "); //$NON-NLS-1$
3178+ latestRevisionDate = new Text(branchHistory, SWT.SINGLE | SWT.READ_ONLY);
3179+ latestRevisionDate.setText(info.getBranchHistory().getLatestRevisionDate().toString());
3180+ }
3181+ }
3182+
3183+ /*
3184+ * @see PreferencePage#createContents(Composite)
3185+ */
3186+ protected Control createContents(Composite parent) {
3187+ Composite composite = new Composite(parent, SWT.NONE);
3188+ GridLayout layout = new GridLayout();
3189+ composite.setLayout(layout);
3190+ GridData data = new GridData(GridData.FILL);
3191+
3192+ composite.setLayoutData(data);
3193+ loadInfo();
3194+ addFirstSection(composite);
3195+ addSeparator(composite);
3196+ addSecondSection(composite);
3197+
3198+ Dialog.applyDialogFont(parent);
3199+
3200+ return composite;
3201+ }
3202+
3203+ private Composite createDefaultComposite(Composite parent) {
3204+ Composite composite = new Composite(parent, SWT.NULL);
3205+ GridLayout layout = new GridLayout();
3206+ layout.numColumns = 2;
3207+ composite.setLayout(layout);
3208+
3209+ GridData data = new GridData();
3210+ data.verticalAlignment = GridData.FILL;
3211+ composite.setLayoutData(data);
3212+
3213+ return composite;
3214+ }
3215+
3216+ private void loadInfo() {
3217+ IResource resource = (IResource) getElement();
3218+ try {
3219+ InfoCommand cmd = new InfoCommand(resource.getProject());
3220+ cmd.run(new NullProgressMonitor());
3221+ info = cmd.getInfo();
3222+ } catch (BazaarException e) {
3223+ EclipseBazaarUI.log(e);
3224+ }
3225+ }
3226+
3227+ protected void performDefaults() {
3228+ }
3229+
3230+ public boolean performOk() {
3231+ return true;
3232+ }
3233
3234 }
3235
3236=== modified file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/uitexts.properties'
3237--- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/uitexts.properties 2009-04-21 00:24:40 +0000
3238+++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/uitexts.properties 2009-04-28 04:23:06 +0000
3239@@ -124,7 +124,7 @@
3240 error_QuickDiffProvider_closingFile=Failed closing the file on a quick diff
3241
3242 #update info dialog
3243-update_message=The dependencies of this version might have changed. \n\nPlease, check if your system fulfill the new dependencies: \n\n
3244+update_message=A new version of the bzr Eclipse plugin has been installed, and the dependencies of this version might have changed.\n\nPlease check if your system fulfill the new dependencies: \n\n
3245 bzr_eclipse_home_link=http://bazaar-vcs.org/BzrEclipse
3246
3247 #other constants

Subscribers

People subscribed via source and target branches

to all changes: