@@ -194,15 +194,17 @@ public String getObjectText(IPluginBase pluginBase) {
194194
195195 String text ;
196196
197- if (version != null && version .length () > 0 )
197+ if (version != null && version .length () > 0 ) {
198198 text = name + ' ' + formatVersion (pluginBase .getVersion ());
199- else
199+ } else {
200200 text = name ;
201+ }
201202 if (SYSTEM_BUNDLE .equals (pluginBase .getId ())) {
202203 text += getSystemBundleInfo ();
203204 }
204- if (pluginBase .getModel () != null && !pluginBase .getModel ().isInSync ())
205+ if (pluginBase .getModel () != null && !pluginBase .getModel ().isInSync ()) {
205206 text += " " + PDEUIMessages .PluginModelManager_outOfSync ; //$NON-NLS-1$
207+ }
206208 return text ;
207209 }
208210
@@ -225,12 +227,14 @@ public String getObjectText(IPluginExtensionPoint point) {
225227
226228 public String getObjectText (ImportObject obj ) {
227229 String version = obj .getImport ().getVersion ();
228- if (version != null && version .length () > 0 )
230+ if (version != null && version .length () > 0 ) {
229231 version = formatVersion (version );
232+ }
230233
231234 String text = isFullNameModeEnabled () ? obj .toString () : preventNull (obj .getId ());
232- if (SYSTEM_BUNDLE .equals (obj .getId ()))
235+ if (SYSTEM_BUNDLE .equals (obj .getId ())) {
233236 return text + getSystemBundleInfo ();
237+ }
234238 return version == null || version .length () == 0 ? text : text + " " + version ; //$NON-NLS-1$
235239 }
236240
@@ -239,10 +243,11 @@ public String getObjectText(IProductPlugin obj) {
239243 String name = obj .getId ();
240244 String version = obj .getVersion ();
241245 String text ;
242- if (version != null && version .length () > 0 )
246+ if (version != null && version .length () > 0 ) {
243247 text = name + ' ' + formatVersion (obj .getVersion ());
244- else
248+ } else {
245249 text = name ;
250+ }
246251 return preventNull (text );
247252 }
248253
@@ -285,15 +290,17 @@ public String getObjectText(ISchemaObject obj) {
285290 int maxOccurs = rso .getMaxOccurs ();
286291 int minOccurs = rso .getMinOccurs ();
287292 if (maxOccurs != 1 || minOccurs != 1 ) {
288- if (isRTL () && SWTUtil .isBidi ())
293+ if (isRTL () && SWTUtil .isBidi ()) {
289294 text .append ('\u200f' );
295+ }
290296 text .append (" (" ); //$NON-NLS-1$
291297 text .append (minOccurs );
292298 text .append (" - " ); //$NON-NLS-1$
293- if (unbounded )
299+ if (unbounded ) {
294300 text .append ('*' );
295- else
301+ } else {
296302 text .append (maxOccurs );
303+ }
297304 text .append (')' );
298305 }
299306 }
@@ -312,10 +319,11 @@ public String getObjectText(FeaturePlugin obj) {
312319
313320 String text ;
314321
315- if (version != null && version .length () > 0 )
322+ if (version != null && version .length () > 0 ) {
316323 text = name + ' ' + formatVersion (version );
317- else
324+ } else {
318325 text = name ;
326+ }
319327 return preventNull (text );
320328 }
321329
@@ -338,8 +346,9 @@ public String getObjectText(FeatureImport obj) {
338346 public String getObjectText (IFeatureModel obj , boolean showVersion ) {
339347 IFeature feature = obj .getFeature ();
340348 String name = (isFullNameModeEnabled ()) ? feature .getTranslatableLabel () : feature .getId ();
341- if (!showVersion )
349+ if (!showVersion ) {
342350 return preventNull (name );
351+ }
343352 return preventNull (name ) + ' ' + formatVersion (feature .getVersion ());
344353
345354 }
@@ -357,8 +366,9 @@ public String getObjectText(IProductFeature obj) {
357366 if (obj .isRootInstallMode ()) {
358367 name += " (root)" ; //$NON-NLS-1$
359368 }
360- if (VersionUtil .isEmptyVersion (obj .getVersion ()))
369+ if (VersionUtil .isEmptyVersion (obj .getVersion ())) {
361370 return name ;
371+ }
362372 return name + ' ' + formatVersion (obj .getVersion ());
363373 }
364374
@@ -376,19 +386,22 @@ private String getObjectText(IProductModel obj) {
376386
377387 public String getObjectText (ISiteFeature obj ) {
378388 IFeatureModel model = PDECore .getDefault ().getFeatureModelManager ().findFeatureModel (obj .getId (), obj .getVersion () != null ? obj .getVersion () : ICoreConstants .DEFAULT_VERSION );
379- if (model != null )
389+ if (model != null ) {
380390 return getObjectText (model );
391+ }
381392 String url = obj .getURL ();
382- if (url != null )
393+ if (url != null ) {
383394 return url ;
395+ }
384396 return preventNull (obj .getId ());
385397 }
386398
387399 public String getObjectText (ISiteBundle obj ) {
388400 IPluginModelBase modelBase = PluginRegistry .findModel (obj .getId (), obj .getVersion (),
389401 VersionMatchRule .COMPATIBLE );
390- if (modelBase != null )
402+ if (modelBase != null ) {
391403 return getObjectText (modelBase .getPluginBase ());
404+ }
392405 return preventNull (obj .getId ());
393406 }
394407
@@ -413,8 +426,9 @@ public String getObjectText(PackageObject obj) {
413426
414427 public String getObjectText (ISiteCategory obj ) {
415428 ISiteCategoryDefinition def = obj .getDefinition ();
416- if (def != null )
429+ if (def != null ) {
417430 return preventNull (def .getLabel ());
431+ }
418432 return preventNull (obj .getName ());
419433 }
420434
@@ -484,8 +498,9 @@ public Image getImage(Object obj) {
484498 }
485499 if (obj instanceof IFeatureModel ) {
486500 int flags = 0 ;
487- if (((IFeatureModel ) obj ).getUnderlyingResource () == null )
501+ if (((IFeatureModel ) obj ).getUnderlyingResource () == null ) {
488502 flags |= F_EXTERNAL ;
503+ }
489504 return get (PDEPluginImages .DESC_FEATURE_OBJ , flags );
490505 }
491506 if (obj instanceof IFeatureChild ) {
@@ -571,18 +586,21 @@ public Image getObjectImage(IPlugin plugin, boolean checkEnabled, boolean javaSe
571586 IPluginModelBase model = plugin .getPluginModel ();
572587 int flags = getModelFlags (model );
573588
574- if (javaSearch )
589+ if (javaSearch ) {
575590 flags |= F_JAVA ;
591+ }
576592 ImageDescriptor desc = PDEPluginImages .DESC_PLUGIN_OBJ ;
577- if (checkEnabled && model .isEnabled () == false )
593+ if (checkEnabled && model .isEnabled () == false ) {
578594 desc = PDEPluginImages .DESC_EXT_PLUGIN_OBJ ;
595+ }
579596 return get (desc , flags );
580597 }
581598
582599 private int getModelFlags (IPluginModelBase model ) {
583600 int flags = 0 ;
584- if (!(model .isLoaded () && model .isInSync ()))
601+ if (!(model .isLoaded () && model .isInSync ())) {
585602 flags = F_ERROR ;
603+ }
586604 IResource resource = model .getUnderlyingResource ();
587605 if (resource == null ) {
588606 flags |= F_EXTERNAL ;
@@ -613,23 +631,27 @@ private Image getObjectImage(IFragment fragment) {
613631 public Image getObjectImage (IFragment fragment , boolean checkEnabled , boolean javaSearch ) {
614632 IPluginModelBase model = fragment .getPluginModel ();
615633 int flags = getModelFlags (model );
616- if (javaSearch )
634+ if (javaSearch ) {
617635 flags |= F_JAVA ;
636+ }
618637 ImageDescriptor desc = PDEPluginImages .DESC_FRAGMENT_OBJ ;
619- if (checkEnabled && !model .isEnabled ())
638+ if (checkEnabled && !model .isEnabled ()) {
620639 desc = PDEPluginImages .DESC_EXT_FRAGMENT_OBJ ;
640+ }
621641 return get (desc , flags );
622642 }
623643
624644 private Image getObjectImage (ImportObject iobj ) {
625645 int flags = 0 ;
626646 IPluginImport iimport = iobj .getImport ();
627- if (!iobj .isResolved ())
647+ if (!iobj .isResolved ()) {
628648 flags = iimport .isOptional () ? F_WARNING : F_ERROR ;
629- else if (iimport .isReexported ())
649+ } else if (iimport .isReexported ()) {
630650 flags = F_EXPORT ;
631- if (iimport .isOptional ())
651+ }
652+ if (iimport .isOptional ()) {
632653 flags |= F_OPTIONAL ;
654+ }
633655 IPlugin plugin = iobj .getPlugin ();
634656 if (plugin != null ) {
635657 IPluginModelBase model = plugin .getPluginModel ();
@@ -656,8 +678,9 @@ private Image getObjectImage(IPluginElement obj) {
656678 ISchemaElement schemaElement = schema .findElement (obj .getName ());
657679 // Only label an element if either the element is deprecated or it actually specifies a deprecated attribute;
658680 // 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 ))) {
660682 flags |= F_WARNING ;
683+ }
661684 }
662685 }
663686 return get (getRequiredPluginImageDescriptor (obj ), flags );
@@ -682,8 +705,9 @@ protected ImageDescriptor getRequiredPluginImageDescriptor(IPluginImport iobj) {
682705
683706 private Image getObjectImage (IPluginImport obj ) {
684707 int flags = 0 ;
685- if (obj .isReexported ())
708+ if (obj .isReexported ()) {
686709 flags |= F_EXPORT ;
710+ }
687711 return get (getRequiredPluginImageDescriptor (obj ), flags );
688712 }
689713
@@ -710,8 +734,9 @@ private Image getObjectImage(IPluginExtensionPoint point) {
710734
711735 private Image getObjectImage (ISchemaElement element ) {
712736 int flags = 0 ;
713- if (element instanceof ISchemaObjectReference && ((ISchemaObjectReference ) element ).getReferencedObject () == null )
737+ if (element instanceof ISchemaObjectReference && ((ISchemaObjectReference ) element ).getReferencedObject () == null ) {
714738 flags |= F_ERROR ;
739+ }
715740 ImageDescriptor desc = element instanceof ISchemaObjectReference ? PDEPluginImages .DESC_XML_ELEMENT_REF_OBJ : PDEPluginImages .DESC_GEL_SC_OBJ ;
716741 return get (desc , flags );
717742 }
@@ -721,16 +746,21 @@ private Image getObjectImage(ISchemaAttribute att) {
721746 String type = att .getType ().getName ();
722747 int use = att .getUse ();
723748 int flags = 0 ;
724- if (use == ISchemaAttribute .OPTIONAL )
749+ if (use == ISchemaAttribute .OPTIONAL ) {
725750 flags = 0 ; //|= F_OPTIONAL;
726- if (kind == IMetaAttribute .JAVA )
751+ }
752+ if (kind == IMetaAttribute .JAVA ) {
727753 return get (PDEPluginImages .DESC_ATT_CLASS_OBJ , flags );
728- if (kind == IMetaAttribute .RESOURCE )
754+ }
755+ if (kind == IMetaAttribute .RESOURCE ) {
729756 return get (PDEPluginImages .DESC_ATT_FILE_OBJ , flags );
730- if (kind == IMetaAttribute .IDENTIFIER )
757+ }
758+ if (kind == IMetaAttribute .IDENTIFIER ) {
731759 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 ])) {
733762 return get (PDEPluginImages .DESC_ATT_BOOLEAN_OBJ , flags );
763+ }
734764
735765 return get (PDEPluginImages .DESC_ATT_STRING_OBJ );
736766 }
@@ -753,24 +783,27 @@ private Image getObjectImage(IFeaturePlugin plugin) {
753783 int flags = 0 ;
754784 if (((FeaturePlugin ) plugin ).getPluginBase () == null ) {
755785 int cflag = CompilerFlags .getFlag (null , CompilerFlags .F_UNRESOLVED_PLUGINS );
756- if (cflag == CompilerFlags .ERROR )
786+ if (cflag == CompilerFlags .ERROR ) {
757787 flags = F_ERROR ;
758- else if (cflag == CompilerFlags .WARNING )
788+ } else if (cflag == CompilerFlags .WARNING ) {
759789 flags = F_WARNING ;
790+ }
760791 }
761- if (plugin .isFragment ())
792+ if (plugin .isFragment ()) {
762793 return get (PDEPluginImages .DESC_FRAGMENT_OBJ , flags );
794+ }
763795 return get (PDEPluginImages .DESC_PLUGIN_OBJ , flags );
764796 }
765797
766798 private Image getObjectImage (IFeatureChild feature ) {
767799 int flags = 0 ;
768800 if (((FeatureChild ) feature ).getReferencedFeature () == null ) {
769801 int cflag = CompilerFlags .getFlag (null , CompilerFlags .F_UNRESOLVED_FEATURES );
770- if (cflag == CompilerFlags .ERROR )
802+ if (cflag == CompilerFlags .ERROR ) {
771803 flags = F_ERROR ;
772- else if (cflag == CompilerFlags .WARNING )
804+ } else if (cflag == CompilerFlags .WARNING ) {
773805 flags = F_WARNING ;
806+ }
774807 }
775808 return get (PDEPluginImages .DESC_FEATURE_OBJ , flags );
776809 }
@@ -779,15 +812,17 @@ private Image getObjectImage(IProductFeature feature) {
779812 int flags = 0 ;
780813 String version = feature .getVersion ().length () > 0 ? feature .getVersion () : ICoreConstants .DEFAULT_VERSION ;
781814 IFeatureModel model = PDECore .getDefault ().getFeatureModelManager ().findFeatureModel (feature .getId (), version );
782- if (model == null )
815+ if (model == null ) {
783816 flags = F_ERROR ;
817+ }
784818 return get (PDEPluginImages .DESC_FEATURE_OBJ , flags );
785819 }
786820
787821 private Image getObjectImage (IFeatureData data ) {
788822 int flags = 0 ;
789- if (!data .exists ())
823+ if (!data .exists ()) {
790824 flags = F_ERROR ;
825+ }
791826 ImageDescriptor desc = PlatformUI .getWorkbench ().getEditorRegistry ().getImageDescriptor (data .getId ());
792827 return get (desc , flags );
793828 }
@@ -801,13 +836,15 @@ private Image getObjectImage(IFeatureImport obj) {
801836 if (type == IFeatureImport .FEATURE ) {
802837 base = PDEPluginImages .DESC_FEATURE_OBJ ;
803838 IFeature feature = iimport .getFeature ();
804- if (feature == null )
839+ if (feature == null ) {
805840 flags = F_ERROR ;
841+ }
806842 } else {
807843 base = PDEPluginImages .DESC_REQ_PLUGIN_OBJ ;
808844 IPlugin plugin = iimport .getPlugin ();
809- if (plugin == null )
845+ if (plugin == null ) {
810846 flags = F_ERROR ;
847+ }
811848 }
812849
813850 return get (base , flags );
@@ -816,8 +853,9 @@ private Image getObjectImage(IFeatureImport obj) {
816853 private Image getObjectImage (IFeatureInfo info ) {
817854 int flags = 0 ;
818855 String text = info .getDescription ();
819- if (text != null )
856+ if (text != null ) {
820857 text = text .trim ();
858+ }
821859 if (text != null && text .length () > 0 ) {
822860 // complete
823861 flags = F_EDIT ;
@@ -855,8 +893,9 @@ public Image getObjectImage(ExportPackageObject obj) {
855893 if (obj .isInternal ()) {
856894 flags = F_INTERNAL ;
857895 // if internal with at least one friend
858- if (obj .getFriends ().length > 0 )
896+ if (obj .getFriends ().length > 0 ) {
859897 flags = F_FRIEND ;
898+ }
860899 }
861900 ImageDescriptor desc = JavaUI .getSharedImages ().getImageDescriptor (ISharedImages .IMG_OBJS_PACKAGE );
862901 return get (desc , flags );
@@ -914,11 +953,12 @@ private static boolean isRTL() {
914953 public static String formatVersion (String versionRange ) {
915954 boolean isBasicVersion = versionRange == null || versionRange .length () == 0 || Character .isDigit (versionRange .charAt (0 ));
916955 if (isBasicVersion ) {
917- if (SWTUtil .isBidi ())
956+ if (SWTUtil .isBidi ()) {
918957 // The versionRange is a single version. Since parenthesis is neutral, it direction is determined by leading and following character.
919958 // Since leading character is Arabic and following character is Latin, the parenthesis will take default (proper) direction.
920959 // Must have the following character be the Latin character to ensure version is formatted as Latin (LTR)
921960 return "\u200f (\u200e " + versionRange + ")" ; //$NON-NLS-1$ //$NON-NLS-2$
961+ }
922962 return "(" + versionRange + ')' ; //$NON-NLS-1$
923963 } else if (isRTL () && SWTUtil .isBidi ()) {
924964 // when running RTL and formatting a versionRange, we need to break up the String to make sure it is properly formatted.
0 commit comments