|
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.*; |
| 24 |
import org.eclipse.swt.SWT; |
26 |
import org.eclipse.swt.SWT; |
| 25 |
import org.eclipse.swt.custom.BusyIndicator; |
27 |
import org.eclipse.swt.custom.BusyIndicator; |
| 26 |
import org.eclipse.swt.dnd.*; |
28 |
import org.eclipse.swt.dnd.*; |
|
Lines 33-40
Link Here
|
| 33 |
import org.eclipse.ui.dialogs.PatternFilter; |
35 |
import org.eclipse.ui.dialogs.PatternFilter; |
| 34 |
import org.eclipse.ui.part.DrillDownAdapter; |
36 |
import org.eclipse.ui.part.DrillDownAdapter; |
| 35 |
import org.eclipse.ui.part.ViewPart; |
37 |
import org.eclipse.ui.part.ViewPart; |
| 36 |
import org.osgi.framework.*; |
38 |
import org.osgi.framework.BundleException; |
| 37 |
import org.osgi.service.packageadmin.PackageAdmin; |
|
|
| 38 |
|
39 |
|
| 39 |
public class RegistryBrowser extends ViewPart { |
40 |
public class RegistryBrowser extends ViewPart { |
| 40 |
|
41 |
|
|
Lines 43-54
Link Here
|
| 43 |
public static final String SHOW_EXTENSIONS_ONLY = "RegistryView.showExtensions.label"; //$NON-NLS-1$ |
44 |
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$ |
45 |
public static final String SHOW_DISABLED_MODE = "RegistryView.showDisabledMode.label"; //$NON-NLS-1$ |
| 45 |
|
46 |
|
| 46 |
private RegistryBrowserListener fListener; |
|
|
| 47 |
private FilteredTree fFilteredTree; |
47 |
private FilteredTree fFilteredTree; |
| 48 |
private TreeViewer fTreeViewer; |
48 |
private TreeViewer fTreeViewer; |
| 49 |
private IMemento fMemento; |
49 |
private IMemento fMemento; |
| 50 |
private int fTotalItems = 0; |
50 |
private int fTotalItems = 0; |
| 51 |
|
51 |
|
|
|
52 |
private RegistryModel model; |
| 53 |
private ModelChangeListener listener; |
| 54 |
|
| 55 |
private RegistryBrowserContentProvider fContentProvider; |
| 56 |
|
| 52 |
// menus and action items |
57 |
// menus and action items |
| 53 |
private Action fRefreshAction; |
58 |
private Action fRefreshAction; |
| 54 |
private Action fShowPluginsAction; |
59 |
private Action fShowPluginsAction; |
|
Lines 70-81
Link Here
|
| 70 |
private DrillDownAdapter fDrillDownAdapter; |
75 |
private DrillDownAdapter fDrillDownAdapter; |
| 71 |
private ViewerFilter fActiveFilter = new ViewerFilter() { |
76 |
private ViewerFilter fActiveFilter = new ViewerFilter() { |
| 72 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
77 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
| 73 |
if (element instanceof PluginObjectAdapter) |
78 |
if (element instanceof ExtensionPoint) |
| 74 |
element = ((PluginObjectAdapter) element).getObject(); |
79 |
element = Platform.getBundle(((ExtensionPoint) element).getNamespaceIdentifier()); |
| 75 |
if (element instanceof IExtensionPoint) |
80 |
else if (element instanceof Extension) |
| 76 |
element = Platform.getBundle(((IExtensionPoint) element).getNamespaceIdentifier()); |
81 |
element = Platform.getBundle(((Extension) element).getNamespaceIdentifier()); |
| 77 |
else if (element instanceof IExtension) |
|
|
| 78 |
element = Platform.getBundle(((IExtension) element).getNamespaceIdentifier()); |
| 79 |
if (element instanceof Bundle) |
82 |
if (element instanceof Bundle) |
| 80 |
return ((Bundle) element).getState() == Bundle.ACTIVE; |
83 |
return ((Bundle) element).getState() == Bundle.ACTIVE; |
| 81 |
return true; |
84 |
return true; |
|
Lines 83-99
Link Here
|
| 83 |
}; |
86 |
}; |
| 84 |
|
87 |
|
| 85 |
private ViewerFilter fDisabledFilter = new ViewerFilter() { |
88 |
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) { |
89 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
| 90 |
if (element instanceof PluginObjectAdapter) |
|
|
| 91 |
element = ((PluginObjectAdapter) element).getObject(); |
| 92 |
|
| 93 |
if (element instanceof Bundle) { |
90 |
if (element instanceof Bundle) { |
| 94 |
Bundle bundle = (Bundle) element; |
91 |
return !((Bundle) element).isEnabled(); |
| 95 |
BundleDescription description = state.getBundle(bundle.getBundleId()); |
|
|
| 96 |
return ((state.getDisabledInfos(description)).length > 0); |
| 97 |
} |
92 |
} |
| 98 |
return false; |
93 |
return false; |
| 99 |
} |
94 |
} |
|
Lines 133-138
Link Here
|
| 133 |
} |
128 |
} |
| 134 |
} |
129 |
} |
| 135 |
|
130 |
|
|
|
131 |
public RegistryBrowser() { |
| 132 |
try { |
| 133 |
model = RegistryModelFactory.getRegistryModel(new URI("local")); |
| 134 |
} catch (URISyntaxException e) { |
| 135 |
PDERuntimePlugin.log(e); |
| 136 |
} |
| 137 |
model.connect(); |
| 138 |
|
| 139 |
listener = new RegistryBrowserModelChangeListener(this); |
| 140 |
model.addModelChangeListener(listener); |
| 141 |
} |
| 142 |
|
| 136 |
public void init(IViewSite site, IMemento memento) throws PartInitException { |
143 |
public void init(IViewSite site, IMemento memento) throws PartInitException { |
| 137 |
super.init(site, memento); |
144 |
super.init(site, memento); |
| 138 |
if (memento == null) |
145 |
if (memento == null) |
|
Lines 140-147
Link Here
|
| 140 |
else |
147 |
else |
| 141 |
this.fMemento = memento; |
148 |
this.fMemento = memento; |
| 142 |
initializeMemento(); |
149 |
initializeMemento(); |
| 143 |
|
|
|
| 144 |
fListener = new RegistryBrowserListener(this); |
| 145 |
} |
150 |
} |
| 146 |
|
151 |
|
| 147 |
private void initializeMemento() { |
152 |
private void initializeMemento() { |
|
Lines 159-170
Link Here
|
| 159 |
} |
164 |
} |
| 160 |
|
165 |
|
| 161 |
public void dispose() { |
166 |
public void dispose() { |
| 162 |
if (fListener != null) { |
167 |
model.disconnect(); |
| 163 |
Platform.getExtensionRegistry().removeRegistryChangeListener(fListener); |
168 |
model.removeModelChangeListener(listener); |
| 164 |
PDERuntimePlugin.getDefault().getBundleContext().removeBundleListener(fListener); |
169 |
if (fClipboard != null) { |
| 165 |
PDERuntimePlugin.getDefault().getBundleContext().removeServiceListener(fListener); |
170 |
fClipboard.dispose(); |
| 166 |
} |
171 |
} |
| 167 |
fClipboard.dispose(); |
|
|
| 168 |
super.dispose(); |
172 |
super.dispose(); |
| 169 |
} |
173 |
} |
| 170 |
|
174 |
|
|
Lines 179-188
Link Here
|
| 179 |
createTreeViewer(composite); |
183 |
createTreeViewer(composite); |
| 180 |
fClipboard = new Clipboard(fTreeViewer.getTree().getDisplay()); |
184 |
fClipboard = new Clipboard(fTreeViewer.getTree().getDisplay()); |
| 181 |
fillToolBar(); |
185 |
fillToolBar(); |
| 182 |
|
|
|
| 183 |
PDERuntimePlugin.getDefault().getBundleContext().addBundleListener(fListener); |
| 184 |
Platform.getExtensionRegistry().addRegistryChangeListener(fListener); |
| 185 |
PDERuntimePlugin.getDefault().getBundleContext().addServiceListener(fListener); |
| 186 |
} |
186 |
} |
| 187 |
|
187 |
|
| 188 |
private void createTreeViewer(Composite parent) { |
188 |
private void createTreeViewer(Composite parent) { |
|
Lines 198-214
Link Here
|
| 198 |
GridData gd = new GridData(GridData.FILL_BOTH); |
198 |
GridData gd = new GridData(GridData.FILL_BOTH); |
| 199 |
fFilteredTree.setLayoutData(gd); |
199 |
fFilteredTree.setLayoutData(gd); |
| 200 |
fTreeViewer = fFilteredTree.getViewer(); |
200 |
fTreeViewer = fFilteredTree.getViewer(); |
| 201 |
fTreeViewer.setContentProvider(new RegistryBrowserContentProvider()); |
201 |
fContentProvider = new RegistryBrowserContentProvider(this); |
|
|
202 |
fTreeViewer.setContentProvider(fContentProvider); |
| 202 |
fTreeViewer.setLabelProvider(new RegistryBrowserLabelProvider(fTreeViewer)); |
203 |
fTreeViewer.setLabelProvider(new RegistryBrowserLabelProvider(fTreeViewer)); |
| 203 |
fTreeViewer.setUseHashlookup(true); |
204 |
fTreeViewer.setUseHashlookup(true); |
| 204 |
fTreeViewer.setComparator(new ViewerComparator() { |
205 |
fTreeViewer.setComparator(new ViewerComparator() { |
| 205 |
public int compare(Viewer viewer, Object e1, Object e2) { |
206 |
public int compare(Viewer viewer, Object e1, Object e2) { |
| 206 |
if (e1 instanceof PluginObjectAdapter) |
207 |
if (e1 instanceof Folder && e2 instanceof Folder) |
| 207 |
e1 = ((PluginObjectAdapter) e1).getObject(); |
208 |
return ((Folder) e1).getId() - ((Folder) e2).getId(); |
| 208 |
if (e2 instanceof PluginObjectAdapter) |
|
|
| 209 |
e2 = ((PluginObjectAdapter) e2).getObject(); |
| 210 |
if (e1 instanceof IBundleFolder && e2 instanceof IBundleFolder) |
| 211 |
return ((IBundleFolder) e1).getFolderId() - ((IBundleFolder) e2).getFolderId(); |
| 212 |
if (e1 instanceof Bundle && e2 instanceof Bundle) { |
209 |
if (e1 instanceof Bundle && e2 instanceof Bundle) { |
| 213 |
e1 = ((Bundle) e1).getSymbolicName(); |
210 |
e1 = ((Bundle) e1).getSymbolicName(); |
| 214 |
e2 = ((Bundle) e2).getSymbolicName(); |
211 |
e2 = ((Bundle) e2).getSymbolicName(); |
|
Lines 240-254
Link Here
|
| 240 |
tree.setMenu(menu); |
237 |
tree.setMenu(menu); |
| 241 |
} |
238 |
} |
| 242 |
|
239 |
|
| 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() { |
240 |
private void fillToolBar() { |
| 253 |
fDrillDownAdapter = new RegistryDrillDownAdapter(fTreeViewer); |
241 |
fDrillDownAdapter = new RegistryDrillDownAdapter(fTreeViewer); |
| 254 |
IActionBars bars = getViewSite().getActionBars(); |
242 |
IActionBars bars = getViewSite().getActionBars(); |
|
Lines 424-484
Link Here
|
| 424 |
fEnableAction = new Action(PDERuntimeMessages.RegistryView_enableAction_label) { |
412 |
fEnableAction = new Action(PDERuntimeMessages.RegistryView_enableAction_label) { |
| 425 |
public void run() { |
413 |
public void run() { |
| 426 |
List bundles = getSelectedBundles(); |
414 |
List bundles = getSelectedBundles(); |
| 427 |
State state = PDERuntimePlugin.getDefault().getState(); |
|
|
| 428 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
415 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 429 |
Bundle bundle = (Bundle) it.next(); |
416 |
Bundle bundle = (Bundle) it.next(); |
| 430 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
417 |
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 |
} |
418 |
} |
| 437 |
PackageAdmin packageAdmin = PDERuntimePlugin.getDefault().getPackageAdmin(); |
|
|
| 438 |
packageAdmin.refreshPackages((Bundle[]) bundles.toArray(new Bundle[bundles.size()])); |
| 439 |
} |
419 |
} |
| 440 |
}; |
420 |
}; |
| 441 |
|
421 |
|
| 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 |
Bundle bundle = (Bundle) 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(); |
|
|
| 454 |
packageAdmin.refreshPackages((Bundle[]) bundles.toArray(new Bundle[bundles.size()])); |
| 455 |
} |
429 |
} |
| 456 |
}; |
430 |
}; |
| 457 |
|
431 |
|
| 458 |
fDiagnoseAction = new Action(PDERuntimeMessages.RegistryView_diagnoseAction_label) { |
432 |
fDiagnoseAction = new Action(PDERuntimeMessages.RegistryView_diagnoseAction_label) { |
| 459 |
public void run() { |
433 |
public void run() { |
| 460 |
List bundles = getSelectedBundles(); |
434 |
List bundles = getSelectedBundles(); |
| 461 |
State state = PDERuntimePlugin.getDefault().getState(); |
|
|
| 462 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
435 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 463 |
Bundle bundle = (Bundle) it.next(); |
436 |
Bundle bundle = (Bundle) it.next(); |
| 464 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
437 |
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 |
|
438 |
|
| 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; |
439 |
Dialog dialog; |
| 481 |
if (unsatisfied.length != 0 || resolverErrors.length != 0) { |
440 |
if (problems.getChildren().length > 0) { |
| 482 |
dialog = new DiagnosticsDialog(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, null, problems, IStatus.WARNING); |
441 |
dialog = new DiagnosticsDialog(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, null, problems, IStatus.WARNING); |
| 483 |
dialog.open(); |
442 |
dialog.open(); |
| 484 |
} else { |
443 |
} else { |
|
Lines 499-515
Link Here
|
| 499 |
fCollapseAllAction.setToolTipText(PDERuntimeMessages.RegistryView_collapseAll_tooltip); |
458 |
fCollapseAllAction.setToolTipText(PDERuntimeMessages.RegistryView_collapseAll_tooltip); |
| 500 |
} |
459 |
} |
| 501 |
|
460 |
|
|
|
461 |
public boolean showExtensionsOnly() { |
| 462 |
return fShowExtensionsOnlyAction.isChecked(); |
| 463 |
} |
| 464 |
|
| 502 |
protected void updateItems(boolean resetInput) { |
465 |
protected void updateItems(boolean resetInput) { |
| 503 |
Object[] input = null; |
466 |
Object[] input = null; |
| 504 |
boolean extOnly = fShowExtensionsOnlyAction.isChecked(); |
467 |
if (showExtensionsOnly()) |
| 505 |
if (extOnly) |
468 |
input = model.getExtensionPoints(); |
| 506 |
input = Platform.getExtensionRegistry().getExtensionPoints(); |
|
|
| 507 |
else |
469 |
else |
| 508 |
input = getBundles(); |
470 |
input = model.getBundles(); |
| 509 |
fListener.fExtOnly = extOnly; |
|
|
| 510 |
fTotalItems = input.length; |
471 |
fTotalItems = input.length; |
| 511 |
if (resetInput) |
472 |
if (resetInput) |
| 512 |
fTreeViewer.setInput(new PluginObjectAdapter(input)); |
473 |
fTreeViewer.setInput(input); |
| 513 |
updateTitle(); |
474 |
updateTitle(); |
| 514 |
} |
475 |
} |
| 515 |
|
476 |
|
|
Lines 531-552
Link Here
|
| 531 |
return NLS.bind(PDERuntimeMessages.RegistryView_titleSummary, (new String[] {Integer.toString(tree.getItemCount()), Integer.toString(fTotalItems), type})); |
492 |
return NLS.bind(PDERuntimeMessages.RegistryView_titleSummary, (new String[] {Integer.toString(tree.getItemCount()), Integer.toString(fTotalItems), type})); |
| 532 |
} |
493 |
} |
| 533 |
|
494 |
|
| 534 |
// TODO hackish, should rewrite |
|
|
| 535 |
private boolean isBundleSelected() { |
495 |
private boolean isBundleSelected() { |
| 536 |
IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); |
496 |
IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); |
| 537 |
if (selection != null) { |
497 |
if (selection != null) { |
| 538 |
Object[] elements = selection.toArray(); |
498 |
Object[] elements = selection.toArray(); |
| 539 |
for (int i = 0; i < elements.length; i++) { |
499 |
for (int i = 0; i < elements.length; i++) { |
| 540 |
if (elements[i] instanceof PluginObjectAdapter) { |
500 |
if (!(elements[i] instanceof Bundle)) { |
| 541 |
PluginObjectAdapter adapter = (PluginObjectAdapter) elements[i]; |
|
|
| 542 |
Object object = adapter.getObject(); |
| 543 |
if (!(object instanceof Bundle)) |
| 544 |
return false; |
| 545 |
} else { |
| 546 |
return false; |
501 |
return false; |
| 547 |
} |
502 |
} |
| 548 |
} |
503 |
} |
| 549 |
} |
504 |
} |
|
|
505 |
|
| 550 |
return true; |
506 |
return true; |
| 551 |
} |
507 |
} |
| 552 |
|
508 |
|
|
Lines 556-572
Link Here
|
| 556 |
if (selection != null) { |
512 |
if (selection != null) { |
| 557 |
Object[] elements = selection.toArray(); |
513 |
Object[] elements = selection.toArray(); |
| 558 |
for (int i = 0; i < elements.length; i++) { |
514 |
for (int i = 0; i < elements.length; i++) { |
| 559 |
if (elements[i] instanceof PluginObjectAdapter) { |
515 |
if (elements[i] instanceof Bundle) { |
| 560 |
PluginObjectAdapter adapter = (PluginObjectAdapter) elements[i]; |
516 |
bundles.add(elements[i]); |
| 561 |
Object object = adapter.getObject(); |
|
|
| 562 |
if (object instanceof Bundle) |
| 563 |
bundles.add(object); |
| 564 |
} |
517 |
} |
| 565 |
} |
518 |
} |
| 566 |
} |
519 |
} |
| 567 |
return bundles; |
520 |
return bundles; |
| 568 |
} |
521 |
} |
| 569 |
|
522 |
|
|
|
523 |
/** |
| 524 |
* @return true if none is stopped, false if at least one is stopped |
| 525 |
*/ |
| 570 |
private boolean selectedBundlesStarted() { |
526 |
private boolean selectedBundlesStarted() { |
| 571 |
List bundles = getSelectedBundles(); |
527 |
List bundles = getSelectedBundles(); |
| 572 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
528 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
|
Lines 577-582
Link Here
|
| 577 |
return true; |
533 |
return true; |
| 578 |
} |
534 |
} |
| 579 |
|
535 |
|
|
|
536 |
/** |
| 537 |
* @return true if none is active, false if at least one is active |
| 538 |
*/ |
| 580 |
private boolean selectedBundlesStopped() { |
539 |
private boolean selectedBundlesStopped() { |
| 581 |
List bundles = getSelectedBundles(); |
540 |
List bundles = getSelectedBundles(); |
| 582 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
541 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
|
Lines 587-620
Link Here
|
| 587 |
return true; |
546 |
return true; |
| 588 |
} |
547 |
} |
| 589 |
|
548 |
|
|
|
549 |
/** |
| 550 |
* @return true if none is enabled, false if at least one is enabled |
| 551 |
*/ |
| 590 |
private boolean selectedBundlesDisabled() { |
552 |
private boolean selectedBundlesDisabled() { |
| 591 |
List bundles = getSelectedBundles(); |
553 |
List bundles = getSelectedBundles(); |
| 592 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
554 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 593 |
Bundle bundle = (Bundle) it.next(); |
555 |
Bundle bundle = (Bundle) it.next(); |
| 594 |
State state = PDERuntimePlugin.getDefault().getState(); |
556 |
if (bundle.isEnabled()) |
| 595 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
|
|
| 596 |
DisabledInfo[] infos = state.getDisabledInfos(desc); |
| 597 |
if (infos.length == 0) |
| 598 |
return false; |
557 |
return false; |
| 599 |
} |
558 |
} |
| 600 |
return true; |
559 |
return true; |
| 601 |
} |
560 |
} |
| 602 |
|
561 |
|
|
|
562 |
/** |
| 563 |
* @return true if none is disabled, false if at least one is disabled |
| 564 |
*/ |
| 603 |
private boolean selectedBundlesEnabled() { |
565 |
private boolean selectedBundlesEnabled() { |
| 604 |
List bundles = getSelectedBundles(); |
566 |
List bundles = getSelectedBundles(); |
| 605 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
567 |
for (Iterator it = bundles.iterator(); it.hasNext();) { |
| 606 |
Bundle bundle = (Bundle) it.next(); |
568 |
Bundle bundle = (Bundle) it.next(); |
| 607 |
State state = PDERuntimePlugin.getDefault().getState(); |
569 |
if (!bundle.isEnabled()) |
| 608 |
BundleDescription desc = state.getBundle(bundle.getBundleId()); |
|
|
| 609 |
DisabledInfo[] infos = state.getDisabledInfos(desc); |
| 610 |
if (infos.length > 0) |
| 611 |
return false; |
570 |
return false; |
| 612 |
} |
571 |
} |
| 613 |
return true; |
572 |
return true; |
| 614 |
} |
573 |
} |
| 615 |
|
574 |
|
| 616 |
protected void add(Object object) { |
575 |
public void add(Object object) { |
| 617 |
add(fTreeViewer.getInput(), object); |
576 |
Object parent = fContentProvider.getParent(object); |
|
|
577 |
if (parent == null) { |
| 578 |
add(fTreeViewer.getInput(), object); |
| 579 |
} else { |
| 580 |
refresh(parent); |
| 581 |
} |
| 618 |
} |
582 |
} |
| 619 |
|
583 |
|
| 620 |
protected void add(Object parent, Object object) { |
584 |
protected void add(Object parent, Object object) { |
|
Lines 625-631
Link Here
|
| 625 |
updateTitle(); |
589 |
updateTitle(); |
| 626 |
} |
590 |
} |
| 627 |
|
591 |
|
| 628 |
protected void remove(Object object) { |
592 |
public void remove(Object object) { |
| 629 |
if (fDrillDownAdapter.canGoHome()) |
593 |
if (fDrillDownAdapter.canGoHome()) |
| 630 |
return; |
594 |
return; |
| 631 |
fTotalItems -= 1; |
595 |
fTotalItems -= 1; |
|
Lines 633-647
Link Here
|
| 633 |
updateTitle(); |
597 |
updateTitle(); |
| 634 |
} |
598 |
} |
| 635 |
|
599 |
|
| 636 |
protected void update(Object object) { |
600 |
public void update(Object object) { |
| 637 |
fTreeViewer.update(object, null); |
601 |
fTreeViewer.update(object, null); |
| 638 |
} |
602 |
} |
| 639 |
|
603 |
|
| 640 |
protected void refresh(Object object) { |
604 |
public void refresh(Object object) { |
| 641 |
fTreeViewer.refresh(object); |
605 |
fTreeViewer.refresh(object); |
| 642 |
} |
606 |
} |
| 643 |
|
|
|
| 644 |
protected TreeItem[] getTreeItems() { |
| 645 |
return fTreeViewer.getTree().getItems(); |
| 646 |
} |
| 647 |
} |
607 |
} |