@@ -194,15 +194,17 @@ public String getObjectText(IPluginBase pluginBase) {
194
194
195
195
String text ;
196
196
197
- if (version != null && version .length () > 0 )
197
+ if (version != null && version .length () > 0 ) {
198
198
text = name + ' ' + formatVersion (pluginBase .getVersion ());
199
- else
199
+ } else {
200
200
text = name ;
201
+ }
201
202
if (SYSTEM_BUNDLE .equals (pluginBase .getId ())) {
202
203
text += getSystemBundleInfo ();
203
204
}
204
- if (pluginBase .getModel () != null && !pluginBase .getModel ().isInSync ())
205
+ if (pluginBase .getModel () != null && !pluginBase .getModel ().isInSync ()) {
205
206
text += " " + PDEUIMessages .PluginModelManager_outOfSync ; //$NON-NLS-1$
207
+ }
206
208
return text ;
207
209
}
208
210
@@ -225,12 +227,14 @@ public String getObjectText(IPluginExtensionPoint point) {
225
227
226
228
public String getObjectText (ImportObject obj ) {
227
229
String version = obj .getImport ().getVersion ();
228
- if (version != null && version .length () > 0 )
230
+ if (version != null && version .length () > 0 ) {
229
231
version = formatVersion (version );
232
+ }
230
233
231
234
String text = isFullNameModeEnabled () ? obj .toString () : preventNull (obj .getId ());
232
- if (SYSTEM_BUNDLE .equals (obj .getId ()))
235
+ if (SYSTEM_BUNDLE .equals (obj .getId ())) {
233
236
return text + getSystemBundleInfo ();
237
+ }
234
238
return version == null || version .length () == 0 ? text : text + " " + version ; //$NON-NLS-1$
235
239
}
236
240
@@ -239,10 +243,11 @@ public String getObjectText(IProductPlugin obj) {
239
243
String name = obj .getId ();
240
244
String version = obj .getVersion ();
241
245
String text ;
242
- if (version != null && version .length () > 0 )
246
+ if (version != null && version .length () > 0 ) {
243
247
text = name + ' ' + formatVersion (obj .getVersion ());
244
- else
248
+ } else {
245
249
text = name ;
250
+ }
246
251
return preventNull (text );
247
252
}
248
253
@@ -285,15 +290,17 @@ public String getObjectText(ISchemaObject obj) {
285
290
int maxOccurs = rso .getMaxOccurs ();
286
291
int minOccurs = rso .getMinOccurs ();
287
292
if (maxOccurs != 1 || minOccurs != 1 ) {
288
- if (isRTL () && SWTUtil .isBidi ())
293
+ if (isRTL () && SWTUtil .isBidi ()) {
289
294
text .append ('\u200f' );
295
+ }
290
296
text .append (" (" ); //$NON-NLS-1$
291
297
text .append (minOccurs );
292
298
text .append (" - " ); //$NON-NLS-1$
293
- if (unbounded )
299
+ if (unbounded ) {
294
300
text .append ('*' );
295
- else
301
+ } else {
296
302
text .append (maxOccurs );
303
+ }
297
304
text .append (')' );
298
305
}
299
306
}
@@ -312,10 +319,11 @@ public String getObjectText(FeaturePlugin obj) {
312
319
313
320
String text ;
314
321
315
- if (version != null && version .length () > 0 )
322
+ if (version != null && version .length () > 0 ) {
316
323
text = name + ' ' + formatVersion (version );
317
- else
324
+ } else {
318
325
text = name ;
326
+ }
319
327
return preventNull (text );
320
328
}
321
329
@@ -338,8 +346,9 @@ public String getObjectText(FeatureImport obj) {
338
346
public String getObjectText (IFeatureModel obj , boolean showVersion ) {
339
347
IFeature feature = obj .getFeature ();
340
348
String name = (isFullNameModeEnabled ()) ? feature .getTranslatableLabel () : feature .getId ();
341
- if (!showVersion )
349
+ if (!showVersion ) {
342
350
return preventNull (name );
351
+ }
343
352
return preventNull (name ) + ' ' + formatVersion (feature .getVersion ());
344
353
345
354
}
@@ -357,8 +366,9 @@ public String getObjectText(IProductFeature obj) {
357
366
if (obj .isRootInstallMode ()) {
358
367
name += " (root)" ; //$NON-NLS-1$
359
368
}
360
- if (VersionUtil .isEmptyVersion (obj .getVersion ()))
369
+ if (VersionUtil .isEmptyVersion (obj .getVersion ())) {
361
370
return name ;
371
+ }
362
372
return name + ' ' + formatVersion (obj .getVersion ());
363
373
}
364
374
@@ -376,19 +386,22 @@ private String getObjectText(IProductModel obj) {
376
386
377
387
public String getObjectText (ISiteFeature obj ) {
378
388
IFeatureModel model = PDECore .getDefault ().getFeatureModelManager ().findFeatureModel (obj .getId (), obj .getVersion () != null ? obj .getVersion () : ICoreConstants .DEFAULT_VERSION );
379
- if (model != null )
389
+ if (model != null ) {
380
390
return getObjectText (model );
391
+ }
381
392
String url = obj .getURL ();
382
- if (url != null )
393
+ if (url != null ) {
383
394
return url ;
395
+ }
384
396
return preventNull (obj .getId ());
385
397
}
386
398
387
399
public String getObjectText (ISiteBundle obj ) {
388
400
IPluginModelBase modelBase = PluginRegistry .findModel (obj .getId (), obj .getVersion (),
389
401
VersionMatchRule .COMPATIBLE );
390
- if (modelBase != null )
402
+ if (modelBase != null ) {
391
403
return getObjectText (modelBase .getPluginBase ());
404
+ }
392
405
return preventNull (obj .getId ());
393
406
}
394
407
@@ -413,8 +426,9 @@ public String getObjectText(PackageObject obj) {
413
426
414
427
public String getObjectText (ISiteCategory obj ) {
415
428
ISiteCategoryDefinition def = obj .getDefinition ();
416
- if (def != null )
429
+ if (def != null ) {
417
430
return preventNull (def .getLabel ());
431
+ }
418
432
return preventNull (obj .getName ());
419
433
}
420
434
@@ -484,8 +498,9 @@ public Image getImage(Object obj) {
484
498
}
485
499
if (obj instanceof IFeatureModel ) {
486
500
int flags = 0 ;
487
- if (((IFeatureModel ) obj ).getUnderlyingResource () == null )
501
+ if (((IFeatureModel ) obj ).getUnderlyingResource () == null ) {
488
502
flags |= F_EXTERNAL ;
503
+ }
489
504
return get (PDEPluginImages .DESC_FEATURE_OBJ , flags );
490
505
}
491
506
if (obj instanceof IFeatureChild ) {
@@ -571,18 +586,21 @@ public Image getObjectImage(IPlugin plugin, boolean checkEnabled, boolean javaSe
571
586
IPluginModelBase model = plugin .getPluginModel ();
572
587
int flags = getModelFlags (model );
573
588
574
- if (javaSearch )
589
+ if (javaSearch ) {
575
590
flags |= F_JAVA ;
591
+ }
576
592
ImageDescriptor desc = PDEPluginImages .DESC_PLUGIN_OBJ ;
577
- if (checkEnabled && model .isEnabled () == false )
593
+ if (checkEnabled && model .isEnabled () == false ) {
578
594
desc = PDEPluginImages .DESC_EXT_PLUGIN_OBJ ;
595
+ }
579
596
return get (desc , flags );
580
597
}
581
598
582
599
private int getModelFlags (IPluginModelBase model ) {
583
600
int flags = 0 ;
584
- if (!(model .isLoaded () && model .isInSync ()))
601
+ if (!(model .isLoaded () && model .isInSync ())) {
585
602
flags = F_ERROR ;
603
+ }
586
604
IResource resource = model .getUnderlyingResource ();
587
605
if (resource == null ) {
588
606
flags |= F_EXTERNAL ;
@@ -613,23 +631,27 @@ private Image getObjectImage(IFragment fragment) {
613
631
public Image getObjectImage (IFragment fragment , boolean checkEnabled , boolean javaSearch ) {
614
632
IPluginModelBase model = fragment .getPluginModel ();
615
633
int flags = getModelFlags (model );
616
- if (javaSearch )
634
+ if (javaSearch ) {
617
635
flags |= F_JAVA ;
636
+ }
618
637
ImageDescriptor desc = PDEPluginImages .DESC_FRAGMENT_OBJ ;
619
- if (checkEnabled && !model .isEnabled ())
638
+ if (checkEnabled && !model .isEnabled ()) {
620
639
desc = PDEPluginImages .DESC_EXT_FRAGMENT_OBJ ;
640
+ }
621
641
return get (desc , flags );
622
642
}
623
643
624
644
private Image getObjectImage (ImportObject iobj ) {
625
645
int flags = 0 ;
626
646
IPluginImport iimport = iobj .getImport ();
627
- if (!iobj .isResolved ())
647
+ if (!iobj .isResolved ()) {
628
648
flags = iimport .isOptional () ? F_WARNING : F_ERROR ;
629
- else if (iimport .isReexported ())
649
+ } else if (iimport .isReexported ()) {
630
650
flags = F_EXPORT ;
631
- if (iimport .isOptional ())
651
+ }
652
+ if (iimport .isOptional ()) {
632
653
flags |= F_OPTIONAL ;
654
+ }
633
655
IPlugin plugin = iobj .getPlugin ();
634
656
if (plugin != null ) {
635
657
IPluginModelBase model = plugin .getPluginModel ();
@@ -656,8 +678,9 @@ private Image getObjectImage(IPluginElement obj) {
656
678
ISchemaElement schemaElement = schema .findElement (obj .getName ());
657
679
// Only label an element if either the element is deprecated or it actually specifies a deprecated attribute;
658
680
// We don't want to mislabel non-deprecated elements with no deprecated attributes.
659
- if (schemaElement != null && (schemaElement .isDeprecated () || hasDeprecatedAttributes (obj , schemaElement )))
681
+ if (schemaElement != null && (schemaElement .isDeprecated () || hasDeprecatedAttributes (obj , schemaElement ))) {
660
682
flags |= F_WARNING ;
683
+ }
661
684
}
662
685
}
663
686
return get (getRequiredPluginImageDescriptor (obj ), flags );
@@ -682,8 +705,9 @@ protected ImageDescriptor getRequiredPluginImageDescriptor(IPluginImport iobj) {
682
705
683
706
private Image getObjectImage (IPluginImport obj ) {
684
707
int flags = 0 ;
685
- if (obj .isReexported ())
708
+ if (obj .isReexported ()) {
686
709
flags |= F_EXPORT ;
710
+ }
687
711
return get (getRequiredPluginImageDescriptor (obj ), flags );
688
712
}
689
713
@@ -710,8 +734,9 @@ private Image getObjectImage(IPluginExtensionPoint point) {
710
734
711
735
private Image getObjectImage (ISchemaElement element ) {
712
736
int flags = 0 ;
713
- if (element instanceof ISchemaObjectReference && ((ISchemaObjectReference ) element ).getReferencedObject () == null )
737
+ if (element instanceof ISchemaObjectReference && ((ISchemaObjectReference ) element ).getReferencedObject () == null ) {
714
738
flags |= F_ERROR ;
739
+ }
715
740
ImageDescriptor desc = element instanceof ISchemaObjectReference ? PDEPluginImages .DESC_XML_ELEMENT_REF_OBJ : PDEPluginImages .DESC_GEL_SC_OBJ ;
716
741
return get (desc , flags );
717
742
}
@@ -721,16 +746,21 @@ private Image getObjectImage(ISchemaAttribute att) {
721
746
String type = att .getType ().getName ();
722
747
int use = att .getUse ();
723
748
int flags = 0 ;
724
- if (use == ISchemaAttribute .OPTIONAL )
749
+ if (use == ISchemaAttribute .OPTIONAL ) {
725
750
flags = 0 ; //|= F_OPTIONAL;
726
- if (kind == IMetaAttribute .JAVA )
751
+ }
752
+ if (kind == IMetaAttribute .JAVA ) {
727
753
return get (PDEPluginImages .DESC_ATT_CLASS_OBJ , flags );
728
- if (kind == IMetaAttribute .RESOURCE )
754
+ }
755
+ if (kind == IMetaAttribute .RESOURCE ) {
729
756
return get (PDEPluginImages .DESC_ATT_FILE_OBJ , flags );
730
- if (kind == IMetaAttribute .IDENTIFIER )
757
+ }
758
+ if (kind == IMetaAttribute .IDENTIFIER ) {
731
759
return get (PDEPluginImages .DESC_ATT_ID_OBJ , flags );
732
- if (type .equals (ISchemaAttribute .TYPES [ISchemaAttribute .BOOL_IND ]))
760
+ }
761
+ if (type .equals (ISchemaAttribute .TYPES [ISchemaAttribute .BOOL_IND ])) {
733
762
return get (PDEPluginImages .DESC_ATT_BOOLEAN_OBJ , flags );
763
+ }
734
764
735
765
return get (PDEPluginImages .DESC_ATT_STRING_OBJ );
736
766
}
@@ -753,24 +783,27 @@ private Image getObjectImage(IFeaturePlugin plugin) {
753
783
int flags = 0 ;
754
784
if (((FeaturePlugin ) plugin ).getPluginBase () == null ) {
755
785
int cflag = CompilerFlags .getFlag (null , CompilerFlags .F_UNRESOLVED_PLUGINS );
756
- if (cflag == CompilerFlags .ERROR )
786
+ if (cflag == CompilerFlags .ERROR ) {
757
787
flags = F_ERROR ;
758
- else if (cflag == CompilerFlags .WARNING )
788
+ } else if (cflag == CompilerFlags .WARNING ) {
759
789
flags = F_WARNING ;
790
+ }
760
791
}
761
- if (plugin .isFragment ())
792
+ if (plugin .isFragment ()) {
762
793
return get (PDEPluginImages .DESC_FRAGMENT_OBJ , flags );
794
+ }
763
795
return get (PDEPluginImages .DESC_PLUGIN_OBJ , flags );
764
796
}
765
797
766
798
private Image getObjectImage (IFeatureChild feature ) {
767
799
int flags = 0 ;
768
800
if (((FeatureChild ) feature ).getReferencedFeature () == null ) {
769
801
int cflag = CompilerFlags .getFlag (null , CompilerFlags .F_UNRESOLVED_FEATURES );
770
- if (cflag == CompilerFlags .ERROR )
802
+ if (cflag == CompilerFlags .ERROR ) {
771
803
flags = F_ERROR ;
772
- else if (cflag == CompilerFlags .WARNING )
804
+ } else if (cflag == CompilerFlags .WARNING ) {
773
805
flags = F_WARNING ;
806
+ }
774
807
}
775
808
return get (PDEPluginImages .DESC_FEATURE_OBJ , flags );
776
809
}
@@ -779,15 +812,17 @@ private Image getObjectImage(IProductFeature feature) {
779
812
int flags = 0 ;
780
813
String version = feature .getVersion ().length () > 0 ? feature .getVersion () : ICoreConstants .DEFAULT_VERSION ;
781
814
IFeatureModel model = PDECore .getDefault ().getFeatureModelManager ().findFeatureModel (feature .getId (), version );
782
- if (model == null )
815
+ if (model == null ) {
783
816
flags = F_ERROR ;
817
+ }
784
818
return get (PDEPluginImages .DESC_FEATURE_OBJ , flags );
785
819
}
786
820
787
821
private Image getObjectImage (IFeatureData data ) {
788
822
int flags = 0 ;
789
- if (!data .exists ())
823
+ if (!data .exists ()) {
790
824
flags = F_ERROR ;
825
+ }
791
826
ImageDescriptor desc = PlatformUI .getWorkbench ().getEditorRegistry ().getImageDescriptor (data .getId ());
792
827
return get (desc , flags );
793
828
}
@@ -801,13 +836,15 @@ private Image getObjectImage(IFeatureImport obj) {
801
836
if (type == IFeatureImport .FEATURE ) {
802
837
base = PDEPluginImages .DESC_FEATURE_OBJ ;
803
838
IFeature feature = iimport .getFeature ();
804
- if (feature == null )
839
+ if (feature == null ) {
805
840
flags = F_ERROR ;
841
+ }
806
842
} else {
807
843
base = PDEPluginImages .DESC_REQ_PLUGIN_OBJ ;
808
844
IPlugin plugin = iimport .getPlugin ();
809
- if (plugin == null )
845
+ if (plugin == null ) {
810
846
flags = F_ERROR ;
847
+ }
811
848
}
812
849
813
850
return get (base , flags );
@@ -816,8 +853,9 @@ private Image getObjectImage(IFeatureImport obj) {
816
853
private Image getObjectImage (IFeatureInfo info ) {
817
854
int flags = 0 ;
818
855
String text = info .getDescription ();
819
- if (text != null )
856
+ if (text != null ) {
820
857
text = text .trim ();
858
+ }
821
859
if (text != null && text .length () > 0 ) {
822
860
// complete
823
861
flags = F_EDIT ;
@@ -855,8 +893,9 @@ public Image getObjectImage(ExportPackageObject obj) {
855
893
if (obj .isInternal ()) {
856
894
flags = F_INTERNAL ;
857
895
// if internal with at least one friend
858
- if (obj .getFriends ().length > 0 )
896
+ if (obj .getFriends ().length > 0 ) {
859
897
flags = F_FRIEND ;
898
+ }
860
899
}
861
900
ImageDescriptor desc = JavaUI .getSharedImages ().getImageDescriptor (ISharedImages .IMG_OBJS_PACKAGE );
862
901
return get (desc , flags );
@@ -914,11 +953,12 @@ private static boolean isRTL() {
914
953
public static String formatVersion (String versionRange ) {
915
954
boolean isBasicVersion = versionRange == null || versionRange .length () == 0 || Character .isDigit (versionRange .charAt (0 ));
916
955
if (isBasicVersion ) {
917
- if (SWTUtil .isBidi ())
956
+ if (SWTUtil .isBidi ()) {
918
957
// The versionRange is a single version. Since parenthesis is neutral, it direction is determined by leading and following character.
919
958
// Since leading character is Arabic and following character is Latin, the parenthesis will take default (proper) direction.
920
959
// Must have the following character be the Latin character to ensure version is formatted as Latin (LTR)
921
960
return "\u200f (\u200e " + versionRange + ")" ; //$NON-NLS-1$ //$NON-NLS-2$
961
+ }
922
962
return "(" + versionRange + ')' ; //$NON-NLS-1$
923
963
} else if (isRTL () && SWTUtil .isBidi ()) {
924
964
// when running RTL and formatting a versionRange, we need to break up the String to make sure it is properly formatted.
0 commit comments