@@ -143,12 +143,14 @@ public void run() {
143
143
private final ViewerFilter fActiveFilter = new ViewerFilter () {
144
144
@ Override
145
145
public boolean select (Viewer viewer , Object parentElement , Object element ) {
146
- if (element instanceof ExtensionPoint )
146
+ if (element instanceof ExtensionPoint ) {
147
147
element = Platform .getBundle (((ExtensionPoint ) element ).getNamespaceIdentifier ());
148
- else if (element instanceof Extension )
148
+ } else if (element instanceof Extension ) {
149
149
element = Platform .getBundle (((Extension ) element ).getNamespaceIdentifier ());
150
- if (element instanceof Bundle )
150
+ }
151
+ if (element instanceof Bundle ) {
151
152
return ((Bundle ) element ).getState () == Bundle .ACTIVE ;
153
+ }
152
154
return true ;
153
155
}
154
156
};
@@ -207,23 +209,27 @@ public IStatus run(IProgressMonitor monitor) {
207
209
@ Override
208
210
public void init (IViewSite site , IMemento memento ) throws PartInitException {
209
211
super .init (site , memento );
210
- if (memento == null )
212
+ if (memento == null ) {
211
213
this .fMemento = XMLMemento .createWriteRoot ("REGISTRYVIEW" ); //$NON-NLS-1$
212
- else
214
+ } else {
213
215
this .fMemento = memento ;
216
+ }
214
217
initializeMemento ();
215
218
}
216
219
217
220
private void initializeMemento () {
218
221
// 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 ) {
220
223
fMemento .putString (SHOW_RUNNING_PLUGINS , "false" ); //$NON-NLS-1$
221
- if (fMemento .getInteger (GROUP_BY ) == null )
224
+ }
225
+ if (fMemento .getInteger (GROUP_BY ) == null ) {
222
226
fMemento .putInteger (GROUP_BY , BUNDLES );
227
+ }
223
228
224
229
// default to not showing advanced options to users
225
- if (fMemento .getString (SHOW_ADVANCED_MODE ) == null )
230
+ if (fMemento .getString (SHOW_ADVANCED_MODE ) == null ) {
226
231
fMemento .putString (SHOW_ADVANCED_MODE , "false" ); //$NON-NLS-1$
232
+ }
227
233
}
228
234
229
235
@ Override
@@ -286,17 +292,19 @@ public int compare(Viewer viewer, Object e1, Object e2) {
286
292
return c1 .compareTo (c2 );
287
293
}
288
294
289
- if (e1 instanceof Folder && e2 instanceof Folder )
295
+ if (e1 instanceof Folder && e2 instanceof Folder ) {
290
296
return ((Folder ) e1 ).getId () - ((Folder ) e2 ).getId ();
297
+ }
291
298
if (e1 instanceof Bundle && e2 instanceof Bundle ) {
292
299
e1 = ((Bundle ) e1 ).getSymbolicName ();
293
300
e2 = ((Bundle ) e2 ).getSymbolicName ();
294
301
}
295
302
return super .compare (viewer , e1 , e2 );
296
303
}
297
304
});
298
- if (fShowPluginsAction .isChecked ())
305
+ if (fShowPluginsAction .isChecked ()) {
299
306
fTreeViewer .addFilter (fActiveFilter );
307
+ }
300
308
301
309
initializeModel ();
302
310
@@ -317,8 +325,9 @@ private void hookDoubleClickAction() {
317
325
IStructuredSelection selection = fTreeViewer .getStructuredSelection ();
318
326
if (selection .size () == 1 ) {
319
327
Object obj = selection .getFirstElement ();
320
- if (obj instanceof Bundle )
328
+ if (obj instanceof Bundle ) {
321
329
ManifestEditor .openPluginEditor (((Bundle ) obj ).getSymbolicName ());
330
+ }
322
331
}
323
332
});
324
333
}
@@ -355,13 +364,16 @@ private void fillContextMenu(IMenuManager manager) {
355
364
// check if we should enable advanced actions
356
365
if (fShowAdvancedOperationsAction .isChecked () && isBundleSelected ()) {
357
366
// control bundle state actions
358
- if (selectedBundlesStopped ())
367
+ if (selectedBundlesStopped ()) {
359
368
manager .add (fStartAction );
360
- if (selectedBundlesStarted ())
369
+ }
370
+ if (selectedBundlesStarted ()) {
361
371
manager .add (fStopAction );
372
+ }
362
373
363
- if (getSelectedBundles ().size () == 1 )
374
+ if (getSelectedBundles ().size () == 1 ) {
364
375
manager .add (fDiagnoseAction );
376
+ }
365
377
}
366
378
367
379
manager .add (new Separator ());
@@ -372,8 +384,9 @@ private void fillContextMenu(IMenuManager manager) {
372
384
373
385
@ Override
374
386
public void saveState (IMemento memento ) {
375
- if (memento == null || fMemento == null || fTreeViewer == null )
387
+ if (memento == null || fMemento == null || fTreeViewer == null ) {
376
388
return ;
389
+ }
377
390
fMemento .putString (SHOW_RUNNING_PLUGINS , Boolean .toString (fShowPluginsAction .isChecked ()));
378
391
fMemento .putBoolean (SHOW_ADVANCED_MODE , fShowAdvancedOperationsAction .isChecked ());
379
392
memento .putMemento (fMemento );
@@ -530,8 +543,9 @@ public void updateTitle() {
530
543
}
531
544
532
545
protected Tree getUndisposedTree () {
533
- if (fTreeViewer == null || fTreeViewer .getTree () == null || fTreeViewer .getTree ().isDisposed ())
546
+ if (fTreeViewer == null || fTreeViewer .getTree () == null || fTreeViewer .getTree ().isDisposed ()) {
534
547
return null ;
548
+ }
535
549
return fTreeViewer .getTree ();
536
550
}
537
551
@@ -555,8 +569,9 @@ public String getTitleSummary() {
555
569
break ;
556
570
}
557
571
558
- if (tree == null )
572
+ if (tree == null ) {
559
573
return NLS .bind (PDERuntimeMessages .RegistryView_titleSummary , (new String [] { "0" , "0" , type })); //$NON-NLS-1$ //$NON-NLS-2$
574
+ }
560
575
return NLS .bind (PDERuntimeMessages .RegistryView_titleSummary , (new String [] {Integer .toString (tree .getItemCount ()), Integer .toString (total ), type }));
561
576
}
562
577
@@ -595,8 +610,9 @@ private boolean selectedBundlesStarted() {
595
610
List <Bundle > bundles = getSelectedBundles ();
596
611
for (Iterator <Bundle > it = bundles .iterator (); it .hasNext ();) {
597
612
Bundle bundle = it .next ();
598
- if (bundle .getState () != Bundle .ACTIVE )
613
+ if (bundle .getState () != Bundle .ACTIVE ) {
599
614
return false ;
615
+ }
600
616
}
601
617
return true ;
602
618
}
@@ -608,8 +624,9 @@ private boolean selectedBundlesStopped() {
608
624
List <Bundle > bundles = getSelectedBundles ();
609
625
for (Iterator <Bundle > it = bundles .iterator (); it .hasNext ();) {
610
626
Bundle bundle = it .next ();
611
- if (bundle .getState () == Bundle .ACTIVE )
627
+ if (bundle .getState () == Bundle .ACTIVE ) {
612
628
return false ;
629
+ }
613
630
}
614
631
return true ;
615
632
}
@@ -624,21 +641,25 @@ public void add(Object object) {
624
641
}
625
642
626
643
protected void add (Object parent , Object object ) {
627
- if (fTreeViewer .getTree ().isDisposed ())
644
+ if (fTreeViewer .getTree ().isDisposed ()) {
628
645
return ;
646
+ }
629
647
630
- if (fDrillDownAdapter .canGoHome ())
648
+ if (fDrillDownAdapter .canGoHome ()) {
631
649
return ;
650
+ }
632
651
fTreeViewer .refresh ();
633
652
updateTitle ();
634
653
}
635
654
636
655
public void remove (Object object ) {
637
- if (fTreeViewer .getTree ().isDisposed ())
656
+ if (fTreeViewer .getTree ().isDisposed ()) {
638
657
return ;
658
+ }
639
659
640
- if (fDrillDownAdapter .canGoHome ())
660
+ if (fDrillDownAdapter .canGoHome ()) {
641
661
return ;
662
+ }
642
663
fTreeViewer .refresh ();
643
664
updateTitle ();
644
665
}
@@ -648,8 +669,9 @@ private boolean filtersEnabled() {
648
669
}
649
670
650
671
private void deferredRefresh () {
651
- if (refreshThread != null )
672
+ if (refreshThread != null ) {
652
673
return ;
674
+ }
653
675
654
676
long now = System .currentTimeMillis ();
655
677
if (now - lastRefresh > REFRESH_DELAY ) {
@@ -664,8 +686,9 @@ private void deferredRefresh() {
664
686
return ;
665
687
}
666
688
refreshThread = null ;
667
- if (fTreeViewer .getTree ().isDisposed ())
689
+ if (fTreeViewer .getTree ().isDisposed ()) {
668
690
return ;
691
+ }
669
692
670
693
fTreeViewer .getTree ().getDisplay ().asyncExec (() -> {
671
694
if (!fTreeViewer .getTree ().isDisposed ()) {
@@ -680,8 +703,9 @@ private void deferredRefresh() {
680
703
}
681
704
682
705
void refresh (Object [] objects ) {
683
- if (fTreeViewer .getTree ().isDisposed ())
706
+ if (fTreeViewer .getTree ().isDisposed ()) {
684
707
return ;
708
+ }
685
709
686
710
if (filtersEnabled ()) {
687
711
deferredRefresh ();
@@ -694,8 +718,9 @@ void refresh(Object[] objects) {
694
718
}
695
719
696
720
void refresh (Object object ) {
697
- if (fTreeViewer .getTree ().isDisposed ())
721
+ if (fTreeViewer .getTree ().isDisposed ()) {
698
722
return ;
723
+ }
699
724
700
725
if (filtersEnabled ()) {
701
726
deferredRefresh ();
0 commit comments