|
Lines 11-16
Link Here
|
| 11 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 12 |
package org.eclipse.pde.internal.runtime.registry; |
12 |
package org.eclipse.pde.internal.runtime.registry; |
| 13 |
|
13 |
|
|
|
14 |
import java.net.URI; |
| 15 |
import java.net.URISyntaxException; |
| 14 |
import java.util.*; |
16 |
import java.util.*; |
| 15 |
import java.util.List; |
17 |
import java.util.List; |
| 16 |
import org.eclipse.core.runtime.*; |
18 |
import org.eclipse.core.runtime.*; |
|
Lines 18-26
Link Here
|
| 18 |
import org.eclipse.jface.dialogs.Dialog; |
20 |
import org.eclipse.jface.dialogs.Dialog; |
| 19 |
import org.eclipse.jface.dialogs.MessageDialog; |
21 |
import org.eclipse.jface.dialogs.MessageDialog; |
| 20 |
import org.eclipse.jface.viewers.*; |
22 |
import org.eclipse.jface.viewers.*; |
| 21 |
import org.eclipse.osgi.service.resolver.*; |
|
|
| 22 |
import org.eclipse.osgi.util.NLS; |
23 |
import org.eclipse.osgi.util.NLS; |
| 23 |
import org.eclipse.pde.internal.runtime.*; |
24 |
import org.eclipse.pde.internal.runtime.*; |
|
|
25 |
import org.eclipse.pde.internal.runtime.registry.model.*; |
| 26 |
import org.eclipse.pde.internal.runtime.registry.model.impl.generic.PluginObjectAdapter; |
| 24 |
import org.eclipse.swt.SWT; |
27 |
import org.eclipse.swt.SWT; |
| 25 |
import org.eclipse.swt.custom.BusyIndicator; |
28 |
import org.eclipse.swt.custom.BusyIndicator; |
| 26 |
import org.eclipse.swt.dnd.*; |
29 |
import org.eclipse.swt.dnd.*; |
|
Lines 33-39
Link Here
|
| 33 |
import org.eclipse.ui.dialogs.PatternFilter; |
36 |
import org.eclipse.ui.dialogs.PatternFilter; |
| 34 |
import org.eclipse.ui.part.DrillDownAdapter; |
37 |
import org.eclipse.ui.part.DrillDownAdapter; |
| 35 |
import org.eclipse.ui.part.ViewPart; |
38 |
import org.eclipse.ui.part.ViewPart; |
| 36 |
import org.osgi.framework.*; |
39 |
import org.osgi.framework.Bundle; |
|
|
40 |
import org.osgi.framework.BundleException; |
| 37 |
import org.osgi.service.packageadmin.PackageAdmin; |
41 |
import org.osgi.service.packageadmin.PackageAdmin; |
| 38 |
|
42 |
|
| 39 |
public class RegistryBrowser extends ViewPart { |
43 |
public class RegistryBrowser extends ViewPart { |
|
Lines 43-54
Link Here
|
| 43 |
public static final String SHOW_EXTENSIONS_ONLY = "RegistryView.showExtensions.label"; //$NON-NLS-1$ |
47 |
public static final String SHOW_EXTENSIONS_ONLY = "RegistryView.showExtensions.label"; //$NON-NLS-1$ |
| 44 |
public static final String SHOW_DISABLED_MODE = "RegistryView.showDisabledMode.label"; //$NON-NLS-1$ |
48 |
public static final String SHOW_DISABLED_MODE = "RegistryView.showDisabledMode.label"; //$NON-NLS-1$ |
| 45 |
|
49 |
|
| 46 |
private RegistryBrowserListener fListener; |
|
|
| 47 |
private FilteredTree fFilteredTree; |
50 |
private FilteredTree fFilteredTree; |
| 48 |
private TreeViewer fTreeViewer; |
51 |
private TreeViewer fTreeViewer; |
| 49 |
private IMemento fMemento; |
52 |
private IMemento fMemento; |
| 50 |
private int fTotalItems = 0; |
53 |
private int fTotalItems = 0; |
| 51 |
|
54 |
|
|
|
55 |
private IRegistryModel model; |
| 56 |
private IModelChangeListener listener; |
| 57 |
|
| 52 |
// menus and action items |
58 |
// menus and action items |
| 53 |
private Action fRefreshAction; |
59 |
private Action fRefreshAction; |
| 54 |
private Action fShowPluginsAction; |
60 |
private Action fShowPluginsAction; |
|
Lines 70-99
Link Here
|
| 70 |
private DrillDownAdapter fDrillDownAdapter; |
76 |
private DrillDownAdapter fDrillDownAdapter; |
| 71 |
private ViewerFilter fActiveFilter = new ViewerFilter() { |
77 |
private ViewerFilter fActiveFilter = new ViewerFilter() { |
| 72 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
78 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
| 73 |
if (element instanceof PluginObjectAdapter) |
79 |
if (element instanceof IExtensionPointAdapter) |
| 74 |
element = ((PluginObjectAdapter) element).getObject(); |
80 |
element = Platform.getBundle(((IExtensionPointAdapter) element).getNamespaceIdentifier()); |
| 75 |
if (element instanceof IExtensionPoint) |
81 |
else if (element instanceof IExtensionAdapter) |
| 76 |
element = Platform.getBundle(((IExtensionPoint) element).getNamespaceIdentifier()); |
82 |
element = Platform.getBundle(((IExtensionAdapter) element).getNamespaceIdentifier()); |
| 77 |
else if (element instanceof IExtension) |
83 |
if (element instanceof IBundle) |
| 78 |
element = Platform.getBundle(((IExtension) element).getNamespaceIdentifier()); |
84 |
return ((IBundle) element).getState() == Bundle.ACTIVE; |
| 79 |
if (element instanceof Bundle) |
|
|
| 80 |
return ((Bundle) element).getState() == Bundle.ACTIVE; |
| 81 |
return true; |
85 |
return true; |
| 82 |
} |
86 |
} |
| 83 |
}; |
87 |
}; |
| 84 |
|
88 |
|
| 85 |
private ViewerFilter fDisabledFilter = new ViewerFilter() { |
89 |
private ViewerFilter fDisabledFilter = new ViewerFilter() { |
| 86 |
PlatformAdmin plaformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin(); |
|
|
| 87 |
State state = plaformAdmin.getState(false); |
| 88 |
|
| 89 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
90 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
| 90 |
if (element instanceof PluginObjectAdapter) |
91 |
if (element instanceof IBundle) { |
| 91 |
element = ((PluginObjectAdapter) element).getObject(); |
92 |
return !((IBundle) element).isEnabled(); |
| 92 |
|
|
|
| 93 |
if (element instanceof Bundle) { |
| 94 |
Bundle bundle = (Bundle) element; |
| 95 |
BundleDescription description = state.getBundle(bundle.getBundleId()); |
| 96 |
return ((state.getDisabledInfos(description)).length > 0); |
| 97 |
} |
93 |
} |
| 98 |
return false; |
94 |
return false; |
| 99 |
} |
95 |
} |
|
Lines 133-138
Link Here
|
| 133 |
} |
129 |
} |
| 134 |
} |
130 |
} |
| 135 |
|
131 |
|
|
|
132 |
public RegistryBrowser() { |
| 133 |
try { |
| 134 |
model = RegistryModelFactory.getRegistryModel(new URI("local")); |
| 135 |
} catch (URISyntaxException e) { |
| 136 |
PDERuntimePlugin.log(e); |
| 137 |
} |
| 138 |
model.connect(); |
| 139 |
|
| 140 |
listener = new RegistryBrowserModelChangeListener(this); |
| 141 |
model.addModelChangeListener(listener); |
| 142 |
} |
| 143 |
|
| 136 |
public void init(IViewSite site, IMemento memento) throws PartInitException { |
144 |
public void init(IViewSite site, IMemento memento) throws PartInitException { |
| 137 |
super.init(site, memento); |
145 |
super.init(site, memento); |
| 138 |
if (memento == null) |
146 |
if (memento == null) |
|
Lines 140-147
Link Here
|
| 140 |
else |
148 |
else |
| 141 |
this.fMemento = memento; |
149 |
this.fMemento = memento; |
| 142 |
initializeMemento(); |
150 |
initializeMemento(); |
| 143 |
|
|
|
| 144 |
fListener = new RegistryBrowserListener(this); |
| 145 |
} |
151 |
} |
| 146 |
|
152 |
|
| 147 |
private void initializeMemento() { |
153 |
private void initializeMemento() { |
|
Lines 159-169
Link Here
|
| 159 |
} |
165 |
} |
| 160 |
|
166 |
|
| 161 |
public void dispose() { |
167 |
public void dispose() { |
| 162 |
if (fListener != null) { |
168 |
model.disconnect(); |
| 163 |
Platform.getExtensionRegistry().removeRegistryChangeListener(fListener); |
169 |
model.removeModelChangeListener(listener); |
| 164 |
PDERuntimePlugin.getDefault().getBundleContext().removeBundleListener(fListener); |
|
|
| 165 |
PDERuntimePlugin.getDefault().getBundleContext().removeServiceListener(fListener); |
| 166 |
} |
| 167 |
fClipboard.dispose(); |
170 |
fClipboard.dispose(); |
| 168 |
super.dispose(); |
171 |
super.dispose(); |
| 169 |
} |
172 |
} |
|
Lines 179-188
Link Here
|
| 179 |
createTreeViewer(composite); |
182 |
createTreeViewer(composite); |
| 180 |
fClipboard = new Clipboard(fTreeViewer.getTree().getDisplay()); |
183 |
fClipboard = new Clipboard(fTreeViewer.getTree().getDisplay()); |
| 181 |
fillToolBar(); |
184 |
fillToolBar(); |
| 182 |
|
|
|
| 183 |
PDERuntimePlugin.getDefault().getBundleContext().addBundleListener(fListener); |
| 184 |
Platform.getExtensionRegistry().addRegistryChangeListener(fListener); |
| 185 |
PDERuntimePlugin.getDefault().getBundleContext().addServiceListener(fListener); |
| 186 |
} |
185 |
} |
| 187 |
|
186 |
|
| 188 |
private void createTreeViewer(Composite parent) { |
187 |
private void createTreeViewer(Composite parent) { |
|
Lines 203-217
Link Here
|
| 203 |
fTreeViewer.setUseHashlookup(true); |
202 |
fTreeViewer.setUseHashlookup(true); |
| 204 |
fTreeViewer.setComparator(new ViewerComparator() { |
203 |
fTreeViewer.setComparator(new ViewerComparator() { |
| 205 |
public int compare(Viewer viewer, Object e1, Object e2) { |
204 |
public int compare(Viewer viewer, Object e1, Object e2) { |
| 206 |
if (e1 instanceof PluginObjectAdapter) |
|
|
| 207 |
e1 = ((PluginObjectAdapter) e1).getObject(); |
| 208 |
if (e2 instanceof PluginObjectAdapter) |
| 209 |
e2 = ((PluginObjectAdapter) e2).getObject(); |
| 210 |
if (e1 instanceof IBundleFolder && e2 instanceof IBundleFolder) |
205 |
if (e1 instanceof IBundleFolder && e2 instanceof IBundleFolder) |
| 211 |
return ((IBundleFolder) e1).getFolderId() - ((IBundleFolder) e2).getFolderId(); |
206 |
return ((IBundleFolder) e1).getFolderId() - ((IBundleFolder) e2).getFolderId(); |
| 212 |
if (e1 instanceof Bundle && e2 instanceof Bundle) { |
207 |
if (e1 instanceof IBundle && e2 instanceof IBundle) { |
| 213 |
e1 = ((Bundle) e1).getSymbolicName(); |
208 |
e1 = ((IBundle) e1).getSymbolicName(); |
| 214 |
e2 = ((Bundle) e2).getSymbolicName(); |
209 |
e2 = ((IBundle) e2).getSymbolicName(); |
| 215 |
} |
210 |
} |
| 216 |
return super.compare(viewer, e1, e2); |
211 |
return super.compare(viewer, e1, e2); |
| 217 |
} |
212 |
} |
|
Lines 240-254
Link Here
|
| 240 |
tree.setMenu(menu); |
235 |
tree.setMenu(menu); |
| 241 |
} |
236 |
} |
| 242 |
|
237 |
|
| 243 |
private PluginObjectAdapter[] getBundles() { |
|
|
| 244 |
Bundle[] bundles = PDERuntimePlugin.getDefault().getBundleContext().getBundles(); |
| 245 |
ArrayList list = new ArrayList(); |
| 246 |
for (int i = 0; i < bundles.length; i++) |
| 247 |
if (bundles[i].getHeaders().get(Constants.FRAGMENT_HOST) == null) |
| 248 |
list.add(new PluginAdapter(bundles[i])); |
| 249 |
return (PluginObjectAdapter[]) list.toArray(new PluginObjectAdapter[list.size()]); |
| 250 |
} |
| 251 |
|
| 252 |
private void fillToolBar() { |
238 |
private void fillToolBar() { |
| 253 |
fDrillDownAdapter = new RegistryDrillDownAdapter(fTreeViewer); |
239 |
fDrillDownAdapter = new RegistryDrillDownAdapter(fTreeViewer); |
| 254 |
IActionBars bars = getViewSite().getActionBars(); |
240 |
IActionBars bars = getViewSite().getActionBars(); |
|
Lines 398-404
Link Here
|
| 398 |
try { |
384 |
try { |
| 399 |
List bundles = getSelectedBundles(); |
385 |
List bundles = getSelectedBundles(); |
| 400 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
386 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 401 |
Bundle bundle = (Bundle) it.next(); |
387 |
IBundle bundle = (IBundle) it.next(); |
| 402 |
bundle.start(); |
388 |
bundle.start(); |
| 403 |
} |
389 |
} |
| 404 |
} catch (BundleException e) { |
390 |
} catch (BundleException e) { |
|
Lines 412-418
Link Here
|
| 412 |
try { |
398 |
try { |
| 413 |
List bundles = getSelectedBundles(); |
399 |
List bundles = getSelectedBundles(); |
| 414 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
400 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 415 |
Bundle bundle = (Bundle) it.next(); |
401 |
IBundle bundle = (IBundle) it.next(); |
| 416 |
bundle.stop(); |
402 |
bundle.stop(); |
| 417 |
} |
403 |
} |
| 418 |
} catch (BundleException e) { |
404 |
} catch (BundleException e) { |
|
Lines 424-438
Link Here
|
| 424 |
fEnableAction = new Action(PDERuntimeMessages.RegistryView_enableAction_label) { |
410 |
fEnableAction = new Action(PDERuntimeMessages.RegistryView_enableAction_label) { |
| 425 |
public void run() { |
411 |
public void run() { |
| 426 |
List bundles = getSelectedBundles(); |
412 |
List bundles = getSelectedBundles(); |
| 427 |
State state = PDERuntimePlugin.getDefault().getState(); |
|
|
| 428 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
413 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 429 |
Bundle bundle = (Bundle) it.next(); |
414 |
IBundle bundle = (IBundle) it.next(); |
| 430 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
415 |
bundle.setEnabled(true); |
| 431 |
DisabledInfo[] infos = state.getDisabledInfos(desc); |
|
|
| 432 |
for (int i = 0; i < infos.length; i++) { |
| 433 |
PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin(); |
| 434 |
platformAdmin.removeDisabledInfo(infos[i]); |
| 435 |
} |
| 436 |
} |
416 |
} |
| 437 |
PackageAdmin packageAdmin = PDERuntimePlugin.getDefault().getPackageAdmin(); |
417 |
PackageAdmin packageAdmin = PDERuntimePlugin.getDefault().getPackageAdmin(); |
| 438 |
packageAdmin.refreshPackages((Bundle[]) bundles.toArray(new Bundle[bundles.size()])); |
418 |
packageAdmin.refreshPackages((Bundle[]) bundles.toArray(new Bundle[bundles.size()])); |
|
Lines 442-454
Link Here
|
| 442 |
fDisableAction = new Action(PDERuntimeMessages.RegistryView_disableAction_label) { |
422 |
fDisableAction = new Action(PDERuntimeMessages.RegistryView_disableAction_label) { |
| 443 |
public void run() { |
423 |
public void run() { |
| 444 |
List bundles = getSelectedBundles(); |
424 |
List bundles = getSelectedBundles(); |
| 445 |
State state = PDERuntimePlugin.getDefault().getState(); |
|
|
| 446 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
425 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 447 |
Bundle bundle = (Bundle) it.next(); |
426 |
IBundle bundle = (IBundle) it.next(); |
| 448 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
427 |
bundle.setEnabled(false); |
| 449 |
DisabledInfo info = new DisabledInfo("org.eclipse.pde.ui", "Disabled via PDE", desc); //$NON-NLS-1$ //$NON-NLS-2$ |
|
|
| 450 |
PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin(); |
| 451 |
platformAdmin.addDisabledInfo(info); |
| 452 |
} |
428 |
} |
| 453 |
PackageAdmin packageAdmin = PDERuntimePlugin.getDefault().getPackageAdmin(); |
429 |
PackageAdmin packageAdmin = PDERuntimePlugin.getDefault().getPackageAdmin(); |
| 454 |
packageAdmin.refreshPackages((Bundle[]) bundles.toArray(new Bundle[bundles.size()])); |
430 |
packageAdmin.refreshPackages((Bundle[]) bundles.toArray(new Bundle[bundles.size()])); |
|
Lines 458-484
Link Here
|
| 458 |
fDiagnoseAction = new Action(PDERuntimeMessages.RegistryView_diagnoseAction_label) { |
434 |
fDiagnoseAction = new Action(PDERuntimeMessages.RegistryView_diagnoseAction_label) { |
| 459 |
public void run() { |
435 |
public void run() { |
| 460 |
List bundles = getSelectedBundles(); |
436 |
List bundles = getSelectedBundles(); |
| 461 |
State state = PDERuntimePlugin.getDefault().getState(); |
|
|
| 462 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
437 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 463 |
Bundle bundle = (Bundle) it.next(); |
438 |
IBundle bundle = (IBundle) it.next(); |
| 464 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
439 |
MultiStatus problems = bundle.diagnose(); |
| 465 |
PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin(); |
|
|
| 466 |
VersionConstraint[] unsatisfied = platformAdmin.getStateHelper().getUnsatisfiedConstraints(desc); |
| 467 |
ResolverError[] resolverErrors = platformAdmin.getState(false).getResolverErrors(desc); |
| 468 |
MultiStatus problems = new MultiStatus(PDERuntimePlugin.ID, IStatus.INFO, PDERuntimeMessages.RegistryView_found_problems, null); |
| 469 |
for (int i = 0; i < resolverErrors.length; i++) { |
| 470 |
if ((resolverErrors[i].getType() & (ResolverError.MISSING_FRAGMENT_HOST | ResolverError.MISSING_GENERIC_CAPABILITY | ResolverError.MISSING_IMPORT_PACKAGE | ResolverError.MISSING_REQUIRE_BUNDLE)) != 0) |
| 471 |
continue; |
| 472 |
IStatus status = new Status(IStatus.WARNING, PDERuntimePlugin.ID, resolverErrors[i].toString()); |
| 473 |
problems.add(status); |
| 474 |
} |
| 475 |
|
440 |
|
| 476 |
for (int i = 0; i < unsatisfied.length; i++) { |
|
|
| 477 |
IStatus status = new Status(IStatus.WARNING, PDERuntimePlugin.ID, MessageHelper.getResolutionFailureMessage(unsatisfied[i])); |
| 478 |
problems.add(status); |
| 479 |
} |
| 480 |
Dialog dialog; |
441 |
Dialog dialog; |
| 481 |
if (unsatisfied.length != 0 || resolverErrors.length != 0) { |
442 |
if (problems.getChildren().length > 0) { |
| 482 |
dialog = new DiagnosticsDialog(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, null, problems, IStatus.WARNING); |
443 |
dialog = new DiagnosticsDialog(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, null, problems, IStatus.WARNING); |
| 483 |
dialog.open(); |
444 |
dialog.open(); |
| 484 |
} else { |
445 |
} else { |
|
Lines 499-512
Link Here
|
| 499 |
fCollapseAllAction.setToolTipText(PDERuntimeMessages.RegistryView_collapseAll_tooltip); |
460 |
fCollapseAllAction.setToolTipText(PDERuntimeMessages.RegistryView_collapseAll_tooltip); |
| 500 |
} |
461 |
} |
| 501 |
|
462 |
|
| 502 |
protected void updateItems(boolean resetInput) { |
463 |
public/* was protected */void updateItems(boolean resetInput) { |
| 503 |
Object[] input = null; |
464 |
Object[] input = null; |
| 504 |
boolean extOnly = fShowExtensionsOnlyAction.isChecked(); |
465 |
boolean extOnly = fShowExtensionsOnlyAction.isChecked(); |
| 505 |
if (extOnly) |
466 |
if (extOnly) |
| 506 |
input = Platform.getExtensionRegistry().getExtensionPoints(); |
467 |
input = model.getExtensionPoints(); |
| 507 |
else |
468 |
else |
| 508 |
input = getBundles(); |
469 |
input = model.getBundles(); |
| 509 |
fListener.fExtOnly = extOnly; |
|
|
| 510 |
fTotalItems = input.length; |
470 |
fTotalItems = input.length; |
| 511 |
if (resetInput) |
471 |
if (resetInput) |
| 512 |
fTreeViewer.setInput(new PluginObjectAdapter(input)); |
472 |
fTreeViewer.setInput(new PluginObjectAdapter(input)); |
|
Lines 517-523
Link Here
|
| 517 |
setContentDescription(getTitleSummary()); |
477 |
setContentDescription(getTitleSummary()); |
| 518 |
} |
478 |
} |
| 519 |
|
479 |
|
| 520 |
protected Tree getUndisposedTree() { |
480 |
public/* was protected */Tree getUndisposedTree() { |
| 521 |
if (fTreeViewer == null || fTreeViewer.getTree() == null || fTreeViewer.getTree().isDisposed()) |
481 |
if (fTreeViewer == null || fTreeViewer.getTree() == null || fTreeViewer.getTree().isDisposed()) |
| 522 |
return null; |
482 |
return null; |
| 523 |
return fTreeViewer.getTree(); |
483 |
return fTreeViewer.getTree(); |
|
Lines 556-566
Link Here
|
| 556 |
if (selection != null) { |
516 |
if (selection != null) { |
| 557 |
Object[] elements = selection.toArray(); |
517 |
Object[] elements = selection.toArray(); |
| 558 |
for (int i = 0; i < elements.length; i++) { |
518 |
for (int i = 0; i < elements.length; i++) { |
| 559 |
if (elements[i] instanceof PluginObjectAdapter) { |
519 |
if (elements[i] instanceof IBundle) { |
| 560 |
PluginObjectAdapter adapter = (PluginObjectAdapter) elements[i]; |
520 |
bundles.add(elements[i]); |
| 561 |
Object object = adapter.getObject(); |
|
|
| 562 |
if (object instanceof Bundle) |
| 563 |
bundles.add(object); |
| 564 |
} |
521 |
} |
| 565 |
} |
522 |
} |
| 566 |
} |
523 |
} |
|
Lines 570-576
Link Here
|
| 570 |
private boolean selectedBundlesStarted() { |
527 |
private boolean selectedBundlesStarted() { |
| 571 |
List bundles = getSelectedBundles(); |
528 |
List bundles = getSelectedBundles(); |
| 572 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
529 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 573 |
Bundle bundle = (Bundle) it.next(); |
530 |
IBundle bundle = (IBundle) it.next(); |
| 574 |
if (bundle.getState() != Bundle.ACTIVE) |
531 |
if (bundle.getState() != Bundle.ACTIVE) |
| 575 |
return false; |
532 |
return false; |
| 576 |
} |
533 |
} |
|
Lines 580-586
Link Here
|
| 580 |
private boolean selectedBundlesStopped() { |
537 |
private boolean selectedBundlesStopped() { |
| 581 |
List bundles = getSelectedBundles(); |
538 |
List bundles = getSelectedBundles(); |
| 582 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
539 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 583 |
Bundle bundle = (Bundle) it.next(); |
540 |
IBundle bundle = (IBundle) it.next(); |
| 584 |
if (bundle.getState() == Bundle.ACTIVE) |
541 |
if (bundle.getState() == Bundle.ACTIVE) |
| 585 |
return false; |
542 |
return false; |
| 586 |
} |
543 |
} |
|
Lines 590-600
Link Here
|
| 590 |
private boolean selectedBundlesDisabled() { |
547 |
private boolean selectedBundlesDisabled() { |
| 591 |
List bundles = getSelectedBundles(); |
548 |
List bundles = getSelectedBundles(); |
| 592 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
549 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 593 |
Bundle bundle = (Bundle) it.next(); |
550 |
IBundle bundle = (IBundle) it.next(); |
| 594 |
State state = PDERuntimePlugin.getDefault().getState(); |
551 |
if (!bundle.isEnabled()) |
| 595 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
|
|
| 596 |
DisabledInfo[] infos = state.getDisabledInfos(desc); |
| 597 |
if (infos.length == 0) |
| 598 |
return false; |
552 |
return false; |
| 599 |
} |
553 |
} |
| 600 |
return true; |
554 |
return true; |
|
Lines 603-623
Link Here
|
| 603 |
private boolean selectedBundlesEnabled() { |
557 |
private boolean selectedBundlesEnabled() { |
| 604 |
List bundles = getSelectedBundles(); |
558 |
List bundles = getSelectedBundles(); |
| 605 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
559 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 606 |
Bundle bundle = (Bundle) it.next(); |
560 |
IBundle bundle = (IBundle) it.next(); |
| 607 |
State state = PDERuntimePlugin.getDefault().getState(); |
561 |
if (bundle.isEnabled()) |
| 608 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
562 |
return true; |
| 609 |
DisabledInfo[] infos = state.getDisabledInfos(desc); |
|
|
| 610 |
if (infos.length > 0) |
| 611 |
return false; |
| 612 |
} |
563 |
} |
| 613 |
return true; |
564 |
return true; |
| 614 |
} |
565 |
} |
| 615 |
|
566 |
|
| 616 |
protected void add(Object object) { |
567 |
public/* was protected */void add(Object object) { |
| 617 |
add(fTreeViewer.getInput(), object); |
568 |
add(fTreeViewer.getInput(), object); |
| 618 |
} |
569 |
} |
| 619 |
|
570 |
|
| 620 |
protected void add(Object parent, Object object) { |
571 |
public/* was protected */void add(Object parent, Object object) { |
| 621 |
if (fDrillDownAdapter.canGoHome()) |
572 |
if (fDrillDownAdapter.canGoHome()) |
| 622 |
return; |
573 |
return; |
| 623 |
fTotalItems += 1; |
574 |
fTotalItems += 1; |
|
Lines 625-631
Link Here
|
| 625 |
updateTitle(); |
576 |
updateTitle(); |
| 626 |
} |
577 |
} |
| 627 |
|
578 |
|
| 628 |
protected void remove(Object object) { |
579 |
public/* was protected */void remove(Object object) { |
| 629 |
if (fDrillDownAdapter.canGoHome()) |
580 |
if (fDrillDownAdapter.canGoHome()) |
| 630 |
return; |
581 |
return; |
| 631 |
fTotalItems -= 1; |
582 |
fTotalItems -= 1; |
|
Lines 633-647
Link Here
|
| 633 |
updateTitle(); |
584 |
updateTitle(); |
| 634 |
} |
585 |
} |
| 635 |
|
586 |
|
| 636 |
protected void update(Object object) { |
587 |
public/* was protected */void update(Object object) { |
| 637 |
fTreeViewer.update(object, null); |
588 |
fTreeViewer.update(object, null); |
| 638 |
} |
589 |
} |
| 639 |
|
590 |
|
| 640 |
protected void refresh(Object object) { |
591 |
public/* was protected */void refresh(Object object) { |
| 641 |
fTreeViewer.refresh(object); |
592 |
fTreeViewer.refresh(object); |
| 642 |
} |
593 |
} |
| 643 |
|
594 |
|
| 644 |
protected TreeItem[] getTreeItems() { |
595 |
public/* was protected */TreeItem[] getTreeItems() { |
| 645 |
return fTreeViewer.getTree().getItems(); |
596 |
return fTreeViewer.getTree().getItems(); |
| 646 |
} |
597 |
} |
| 647 |
} |
598 |
} |