3030import com .google .cloud .tools .eclipse .dataflow .core .project .DataflowDependencyManager ;
3131import com .google .cloud .tools .eclipse .dataflow .core .project .MajorVersion ;
3232import com .google .cloud .tools .eclipse .dataflow .ui .DataflowUiPlugin ;
33+ import com .google .cloud .tools .eclipse .dataflow .ui .Messages ;
3334import com .google .cloud .tools .eclipse .dataflow .ui .page .MessageTarget ;
3435import com .google .cloud .tools .eclipse .dataflow .ui .page .component .LabeledTextMapComponent ;
3536import com .google .cloud .tools .eclipse .dataflow .ui .page .component .TextAndButtonComponent ;
3839import com .google .common .annotations .VisibleForTesting ;
3940import com .google .common .base .Joiner ;
4041import com .google .common .base .Preconditions ;
42+ import com .google .common .base .Strings ;
4143import com .google .common .collect .ImmutableSet ;
4244import com .google .common .collect .Iterables ;
4345import com .google .common .util .concurrent .SettableFuture ;
8183 * A tab specifying arguments required to run a Dataflow Pipeline.
8284 */
8385public class PipelineArgumentsTab extends AbstractLaunchConfigurationTab {
84- private static final Joiner MISSING_GROUP_MEMBER_JOINER = Joiner .on (", " );
86+ private static final Joiner MISSING_GROUP_MEMBER_JOINER = Joiner .on (", " ); //$NON-NLS-1$
8587
86- private static final String ARGUMENTS_SEPARATOR = "=" ;
88+ private static final String ARGUMENTS_SEPARATOR = "=" ; //$NON-NLS-1$
8789
8890 private Executor executor ;
8991
@@ -139,7 +141,7 @@ public void createControl(Composite parent) {
139141 internalComposite .setLayout (new GridLayout (1 , false ));
140142
141143 runnerGroup = new Group (internalComposite , SWT .NULL );
142- runnerGroup .setText ("Runner:" );
144+ runnerGroup .setText (Messages . getString ( "runner" )); //$NON-NLS-1$
143145 runnerGroup .setLayoutData (new GridData (SWT .FILL , SWT .BEGINNING , true , false ));
144146 runnerGroup .setLayout (new GridLayout (2 , false ));
145147
@@ -152,15 +154,17 @@ public void createControl(Composite parent) {
152154 Set <String > filterProperties =
153155 ImmutableSet .<String >builder ()
154156 .addAll (DataflowPreferences .SUPPORTED_DEFAULT_PROPERTIES )
155- .add ("runner" )
157+ .add ("runner" ) //$NON-NLS-1$
156158 .build ();
157159
158160 Group runnerOptionsGroup = new Group (inputsComposite , SWT .NULL );
159- runnerOptionsGroup .setText ("Pipeline Options:" );
161+ runnerOptionsGroup .setText (Messages . getString ( "pipeline.options" )); //$NON-NLS-1$
160162 runnerOptionsGroup .setLayout (new GridLayout ());
161163
162164 userOptionsSelector = new TextAndButtonComponent (
163- runnerOptionsGroup , new GridData (SWT .FILL , SWT .BEGINNING , true , false ), "&Search..." );
165+ runnerOptionsGroup ,
166+ new GridData (SWT .FILL , SWT .BEGINNING , true , false ),
167+ Messages .getString ("search" )); //$NON-NLS-1$
164168 userOptionsSelector .addButtonSelectionListener (openPipelineOptionsSearchListener ());
165169
166170 pipelineOptionsForm =
@@ -181,12 +185,12 @@ public void createControl(Composite parent) {
181185 private TextAndButtonSelectionListener openPipelineOptionsSearchListener () {
182186 return new TextAndButtonSelectionListener () {
183187 @ Override
184- public void widgetSelected (SelectionEvent e ) {
188+ public void widgetSelected (SelectionEvent event ) {
185189 Map <String , PipelineOptionsType > optionsTypes = hierarchy .getAllPipelineOptionsTypes ();
186190 PipelineOptionsSelectionDialog dialog =
187191 new PipelineOptionsSelectionDialog (getShell (), optionsTypes );
188192 dialog .setBlockOnOpen (true );
189- dialog .setInitialPattern ("**" );
193+ dialog .setInitialPattern ("**" ); //$NON-NLS-1$
190194 if (dialog .open () == Window .OK ) {
191195 String userOptionsName = dialog .getFirstResult ().toString ();
192196 setTextValue (userOptionsName );
@@ -197,7 +201,7 @@ public void widgetSelected(SelectionEvent e) {
197201 }
198202
199203 @ Override
200- public void widgetDefaultSelected (SelectionEvent e ) {}
204+ public void widgetDefaultSelected (SelectionEvent event ) {}
201205 };
202206 }
203207
@@ -286,7 +290,7 @@ PipelineRunner getSelectedRunner() {
286290 return runnerButton .getKey ();
287291 }
288292 }
289- throw new IllegalStateException ("No runner selected, but a runner starts selected" );
293+ throw new IllegalStateException ("No runner selected, but a runner starts selected" ); //$NON-NLS-1$
290294 }
291295
292296 @ Override
@@ -311,12 +315,13 @@ public void initializeFrom(ILaunchConfiguration configuration) {
311315 defaultOptionsComponent .setCustomValues (launchConfiguration .getArgumentValues ());
312316
313317 String userOptionsName = launchConfiguration .getUserOptionsName ();
314- userOptionsSelector .setText (userOptionsName == null ? "" : userOptionsName );
318+ userOptionsSelector .setText (Strings . nullToEmpty ( userOptionsName ) );
315319
316320 updatePipelineOptionsForm ();
317- } catch (CoreException e ) {
321+ } catch (CoreException ex ) {
318322 // TODO: Handle
319- DataflowUiPlugin .logError (e , "Error while initializing from existing configuration" );
323+ DataflowUiPlugin .logError (ex ,
324+ "Error while initializing from existing configuration" ); //$NON-NLS-1$
320325 }
321326 }
322327
@@ -333,7 +338,7 @@ void updateRunnerButtons(MajorVersion majorVersion) {
333338 runnerButton = runnerButtons .get (PipelineLaunchConfiguration .defaultRunner (majorVersion ));
334339 }
335340 Preconditions .checkNotNull (runnerButton ,
336- "runners for %s should always include the default runner" , majorVersion );
341+ "runners for %s should always include the default runner" , majorVersion ); //$NON-NLS-1$
337342 runnerButton .setSelection (true );
338343 runnerGroup .getParent ().redraw ();
339344 }
@@ -342,7 +347,7 @@ void updateRunnerButtons(MajorVersion majorVersion) {
342347 * Asynchronously updates the project hierarchy.
343348 */
344349 private void updateHierarchy (final MajorVersion majorVersion ) {
345- Job job = new Job ("Update Hierarchy" ) {
350+ Job job = new Job (Messages . getString ( "update.hierarchy" )) { //$NON-NLS-1$
346351 @ Override
347352 public IStatus run (IProgressMonitor progress ) {
348353 hierarchy = getPipelineOptionsHierarchy (majorVersion , progress );
@@ -369,7 +374,7 @@ private PipelineOptionsHierarchy getPipelineOptionsHierarchy(
369374 return pipelineOptionsHierarchyFactory .forProject (project , majorVersion , monitor );
370375 } catch (PipelineOptionsRetrievalException e ) {
371376 DataflowUiPlugin .logWarning (
372- "Couldn't retrieve Pipeline Options Hierarchy for project %s" , project );
377+ "Couldn't retrieve Pipeline Options Hierarchy for project %s" , project ); //$NON-NLS-1$
373378 return pipelineOptionsHierarchyFactory .global (monitor );
374379 }
375380 }
@@ -386,13 +391,13 @@ private IProject getProject() {
386391
387392 @ Override
388393 public String getName () {
389- return "Pipeline Arguments" ;
394+ return Messages . getString ( "pipeline.arguments" ); //$NON-NLS-1$
390395 }
391396
392397 private void updatePipelineOptionsForm () {
393398 final SettableFuture <Map <PipelineOptionsType , Set <PipelineOptionsProperty >>>
394399 optionsHierarchyFuture = SettableFuture .create ();
395- Job job = new Job ("Update Pipeline Options Form" ) {
400+ Job job = new Job ("Update Pipeline Options Form" ) { //$NON-NLS-1$
396401 @ Override
397402 protected IStatus run (IProgressMonitor monitor ) {
398403 optionsHierarchyFuture .set (launchConfiguration .getOptionsHierarchy (hierarchy ));
@@ -412,7 +417,7 @@ public void run() {
412417 pipelineOptionsForm .updateForm (launchConfiguration , optionsHierarchyFuture .get ());
413418 updateLaunchConfigurationDialog ();
414419 } catch (InterruptedException | ExecutionException e ) {
415- DataflowUiPlugin .logError (e , "Exception while updating available Pipeline Options" );
420+ DataflowUiPlugin .logError (e , "Exception while updating available Pipeline Options" ); //$NON-NLS-1$
416421 }
417422 }
418423 },
@@ -440,15 +445,15 @@ private boolean validateRequiredGroups(MissingRequiredProperties validationFailu
440445 Map .Entry <String , Set <PipelineOptionsProperty >> missingGroupEntry =
441446 Iterables .getFirst (validationFailures .getMissingGroups ().entrySet (), null );
442447 if (missingGroupEntry != null ) {
443- StringBuilder errorBuilder = new StringBuilder ("Missing value for group " );
448+ StringBuilder errorBuilder = new StringBuilder ("Missing value for group " ); //$NON-NLS-1$
444449 errorBuilder .append (missingGroupEntry .getKey ());
445- errorBuilder .append (". Properties satisfying group requirement are " );
450+ errorBuilder .append (". Properties satisfying group requirement are " ); //$NON-NLS-1$
446451 Set <String > groupMembers = new HashSet <>();
447452 for (PipelineOptionsProperty missingProperty : missingGroupEntry .getValue ()) {
448453 groupMembers .add (missingProperty .getName ());
449454 }
450455 errorBuilder .append (MISSING_GROUP_MEMBER_JOINER .join (groupMembers ));
451- errorBuilder .append ("." );
456+ errorBuilder .append ("." ); //$NON-NLS-1$
452457 setErrorMessage (errorBuilder .toString ());
453458 return false ;
454459 }
@@ -459,7 +464,7 @@ private boolean validateRequiredProperties(MissingRequiredProperties validationF
459464 PipelineOptionsProperty missingProperty =
460465 Iterables .getFirst (validationFailures .getMissingProperties (), null );
461466 if (missingProperty != null ) {
462- setErrorMessage ("Missing required property " + missingProperty .getName ());
467+ setErrorMessage (Messages . getString ( "missing. required. property" , missingProperty .getName ())); //$NON-NLS-1$
463468 return false ;
464469 }
465470 return true ;
0 commit comments