@@ -143,12 +143,14 @@ public void run() {
143143 private final ViewerFilter fActiveFilter = new ViewerFilter () {
144144 @ Override
145145 public boolean select (Viewer viewer , Object parentElement , Object element ) {
146- if (element instanceof ExtensionPoint )
146+ if (element instanceof ExtensionPoint ) {
147147 element = Platform .getBundle (((ExtensionPoint ) element ).getNamespaceIdentifier ());
148- else if (element instanceof Extension )
148+ } else if (element instanceof Extension ) {
149149 element = Platform .getBundle (((Extension ) element ).getNamespaceIdentifier ());
150- if (element instanceof Bundle )
150+ }
151+ if (element instanceof Bundle ) {
151152 return ((Bundle ) element ).getState () == Bundle .ACTIVE ;
153+ }
152154 return true ;
153155 }
154156 };
@@ -207,23 +209,27 @@ public IStatus run(IProgressMonitor monitor) {
207209 @ Override
208210 public void init (IViewSite site , IMemento memento ) throws PartInitException {
209211 super .init (site , memento );
210- if (memento == null )
212+ if (memento == null ) {
211213 this .fMemento = XMLMemento .createWriteRoot ("REGISTRYVIEW" ); //$NON-NLS-1$
212- else
214+ } else {
213215 this .fMemento = memento ;
216+ }
214217 initializeMemento ();
215218 }
216219
217220 private void initializeMemento () {
218221 // show all bundles by default (i.e. not just activated ones)
219- if (fMemento .getString (SHOW_RUNNING_PLUGINS ) == null )
222+ if (fMemento .getString (SHOW_RUNNING_PLUGINS ) == null ) {
220223 fMemento .putString (SHOW_RUNNING_PLUGINS , "false" ); //$NON-NLS-1$
221- if (fMemento .getInteger (GROUP_BY ) == null )
224+ }
225+ if (fMemento .getInteger (GROUP_BY ) == null ) {
222226 fMemento .putInteger (GROUP_BY , BUNDLES );
227+ }
223228
224229 // default to not showing advanced options to users
225- if (fMemento .getString (SHOW_ADVANCED_MODE ) == null )
230+ if (fMemento .getString (SHOW_ADVANCED_MODE ) == null ) {
226231 fMemento .putString (SHOW_ADVANCED_MODE , "false" ); //$NON-NLS-1$
232+ }
227233 }
228234
229235 @ Override
@@ -286,17 +292,19 @@ public int compare(Viewer viewer, Object e1, Object e2) {
286292 return c1 .compareTo (c2 );
287293 }
288294
289- if (e1 instanceof Folder && e2 instanceof Folder )
295+ if (e1 instanceof Folder && e2 instanceof Folder ) {
290296 return ((Folder ) e1 ).getId () - ((Folder ) e2 ).getId ();
297+ }
291298 if (e1 instanceof Bundle && e2 instanceof Bundle ) {
292299 e1 = ((Bundle ) e1 ).getSymbolicName ();
293300 e2 = ((Bundle ) e2 ).getSymbolicName ();
294301 }
295302 return super .compare (viewer , e1 , e2 );
296303 }
297304 });
298- if (fShowPluginsAction .isChecked ())
305+ if (fShowPluginsAction .isChecked ()) {
299306 fTreeViewer .addFilter (fActiveFilter );
307+ }
300308
301309 initializeModel ();
302310
@@ -317,8 +325,9 @@ private void hookDoubleClickAction() {
317325 IStructuredSelection selection = fTreeViewer .getStructuredSelection ();
318326 if (selection .size () == 1 ) {
319327 Object obj = selection .getFirstElement ();
320- if (obj instanceof Bundle )
328+ if (obj instanceof Bundle ) {
321329 ManifestEditor .openPluginEditor (((Bundle ) obj ).getSymbolicName ());
330+ }
322331 }
323332 });
324333 }
@@ -355,13 +364,16 @@ private void fillContextMenu(IMenuManager manager) {
355364 // check if we should enable advanced actions
356365 if (fShowAdvancedOperationsAction .isChecked () && isBundleSelected ()) {
357366 // control bundle state actions
358- if (selectedBundlesStopped ())
367+ if (selectedBundlesStopped ()) {
359368 manager .add (fStartAction );
360- if (selectedBundlesStarted ())
369+ }
370+ if (selectedBundlesStarted ()) {
361371 manager .add (fStopAction );
372+ }
362373
363- if (getSelectedBundles ().size () == 1 )
374+ if (getSelectedBundles ().size () == 1 ) {
364375 manager .add (fDiagnoseAction );
376+ }
365377 }
366378
367379 manager .add (new Separator ());
@@ -372,8 +384,9 @@ private void fillContextMenu(IMenuManager manager) {
372384
373385 @ Override
374386 public void saveState (IMemento memento ) {
375- if (memento == null || fMemento == null || fTreeViewer == null )
387+ if (memento == null || fMemento == null || fTreeViewer == null ) {
376388 return ;
389+ }
377390 fMemento .putString (SHOW_RUNNING_PLUGINS , Boolean .toString (fShowPluginsAction .isChecked ()));
378391 fMemento .putBoolean (SHOW_ADVANCED_MODE , fShowAdvancedOperationsAction .isChecked ());
379392 memento .putMemento (fMemento );
@@ -530,8 +543,9 @@ public void updateTitle() {
530543 }
531544
532545 protected Tree getUndisposedTree () {
533- if (fTreeViewer == null || fTreeViewer .getTree () == null || fTreeViewer .getTree ().isDisposed ())
546+ if (fTreeViewer == null || fTreeViewer .getTree () == null || fTreeViewer .getTree ().isDisposed ()) {
534547 return null ;
548+ }
535549 return fTreeViewer .getTree ();
536550 }
537551
@@ -555,8 +569,9 @@ public String getTitleSummary() {
555569 break ;
556570 }
557571
558- if (tree == null )
572+ if (tree == null ) {
559573 return NLS .bind (PDERuntimeMessages .RegistryView_titleSummary , (new String [] { "0" , "0" , type })); //$NON-NLS-1$ //$NON-NLS-2$
574+ }
560575 return NLS .bind (PDERuntimeMessages .RegistryView_titleSummary , (new String [] {Integer .toString (tree .getItemCount ()), Integer .toString (total ), type }));
561576 }
562577
@@ -595,8 +610,9 @@ private boolean selectedBundlesStarted() {
595610 List <Bundle > bundles = getSelectedBundles ();
596611 for (Iterator <Bundle > it = bundles .iterator (); it .hasNext ();) {
597612 Bundle bundle = it .next ();
598- if (bundle .getState () != Bundle .ACTIVE )
613+ if (bundle .getState () != Bundle .ACTIVE ) {
599614 return false ;
615+ }
600616 }
601617 return true ;
602618 }
@@ -608,8 +624,9 @@ private boolean selectedBundlesStopped() {
608624 List <Bundle > bundles = getSelectedBundles ();
609625 for (Iterator <Bundle > it = bundles .iterator (); it .hasNext ();) {
610626 Bundle bundle = it .next ();
611- if (bundle .getState () == Bundle .ACTIVE )
627+ if (bundle .getState () == Bundle .ACTIVE ) {
612628 return false ;
629+ }
613630 }
614631 return true ;
615632 }
@@ -624,21 +641,25 @@ public void add(Object object) {
624641 }
625642
626643 protected void add (Object parent , Object object ) {
627- if (fTreeViewer .getTree ().isDisposed ())
644+ if (fTreeViewer .getTree ().isDisposed ()) {
628645 return ;
646+ }
629647
630- if (fDrillDownAdapter .canGoHome ())
648+ if (fDrillDownAdapter .canGoHome ()) {
631649 return ;
650+ }
632651 fTreeViewer .refresh ();
633652 updateTitle ();
634653 }
635654
636655 public void remove (Object object ) {
637- if (fTreeViewer .getTree ().isDisposed ())
656+ if (fTreeViewer .getTree ().isDisposed ()) {
638657 return ;
658+ }
639659
640- if (fDrillDownAdapter .canGoHome ())
660+ if (fDrillDownAdapter .canGoHome ()) {
641661 return ;
662+ }
642663 fTreeViewer .refresh ();
643664 updateTitle ();
644665 }
@@ -648,8 +669,9 @@ private boolean filtersEnabled() {
648669 }
649670
650671 private void deferredRefresh () {
651- if (refreshThread != null )
672+ if (refreshThread != null ) {
652673 return ;
674+ }
653675
654676 long now = System .currentTimeMillis ();
655677 if (now - lastRefresh > REFRESH_DELAY ) {
@@ -664,8 +686,9 @@ private void deferredRefresh() {
664686 return ;
665687 }
666688 refreshThread = null ;
667- if (fTreeViewer .getTree ().isDisposed ())
689+ if (fTreeViewer .getTree ().isDisposed ()) {
668690 return ;
691+ }
669692
670693 fTreeViewer .getTree ().getDisplay ().asyncExec (() -> {
671694 if (!fTreeViewer .getTree ().isDisposed ()) {
@@ -680,8 +703,9 @@ private void deferredRefresh() {
680703 }
681704
682705 void refresh (Object [] objects ) {
683- if (fTreeViewer .getTree ().isDisposed ())
706+ if (fTreeViewer .getTree ().isDisposed ()) {
684707 return ;
708+ }
685709
686710 if (filtersEnabled ()) {
687711 deferredRefresh ();
@@ -694,8 +718,9 @@ void refresh(Object[] objects) {
694718 }
695719
696720 void refresh (Object object ) {
697- if (fTreeViewer .getTree ().isDisposed ())
721+ if (fTreeViewer .getTree ().isDisposed ()) {
698722 return ;
723+ }
699724
700725 if (filtersEnabled ()) {
701726 deferredRefresh ();
0 commit comments