View | Details | Raw Unified | Return to bug 207583
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java (+11 lines)
Lines 22-30 Link Here
22
import org.eclipse.jface.resource.ImageDescriptor;
22
import org.eclipse.jface.resource.ImageDescriptor;
23
import org.eclipse.jface.viewers.LabelProvider;
23
import org.eclipse.jface.viewers.LabelProvider;
24
import org.eclipse.jface.viewers.TreeViewer;
24
import org.eclipse.jface.viewers.TreeViewer;
25
import org.eclipse.osgi.service.resolver.BundleDescription;
26
import org.eclipse.osgi.service.resolver.PlatformAdmin;
27
import org.eclipse.osgi.service.resolver.State;
25
import org.eclipse.osgi.util.NLS;
28
import org.eclipse.osgi.util.NLS;
26
import org.eclipse.pde.internal.runtime.OverlayIcon;
29
import org.eclipse.pde.internal.runtime.OverlayIcon;
27
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
30
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
31
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
28
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
32
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
29
import org.eclipse.swt.graphics.Image;
33
import org.eclipse.swt.graphics.Image;
30
import org.osgi.framework.Bundle;
34
import org.osgi.framework.Bundle;
Lines 111-116 Link Here
111
				return fActivePluginImage;
115
				return fActivePluginImage;
112
			case Bundle.UNINSTALLED:
116
			case Bundle.UNINSTALLED:
113
				return fUnresolvedPluginImage;
117
				return fUnresolvedPluginImage;
118
			case Bundle.INSTALLED:
119
				PlatformAdmin platformAdmin = 
120
					PDERuntimePlugin.getDefault().getPlatformAdmin();
121
				State state = platformAdmin.getState(false);
122
				BundleDescription description = state.getBundle(bundle.getBundleId());
123
				if((state.getDisabledInfos(description)).length > 0)
124
					return fUnresolvedPluginImage;
114
			default:
125
			default:
115
				return fPluginImage;
126
				return fPluginImage;
116
			}
127
			}
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryFilteredTree.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
2
 * Copyright (c) 2006, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 51-57 Link Here
51
		treeComposite.setLayout(treeCompositeLayout);
51
		treeComposite.setLayout(treeCompositeLayout);
52
        GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
52
        GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
53
        treeComposite.setLayoutData(data);
53
        treeComposite.setLayoutData(data);
54
        createTreeControl(treeComposite, SWT.NONE); 
54
        createTreeControl(treeComposite, treeStyle); 
55
	}
55
	}
56
	
56
	
57
}
57
}
(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java (-50 / +204 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
package org.eclipse.pde.internal.runtime.registry;
11
package org.eclipse.pde.internal.runtime.registry;
12
12
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.Iterator;
15
import java.util.List;
14
16
15
import org.eclipse.core.runtime.IExtension;
17
import org.eclipse.core.runtime.IExtension;
16
import org.eclipse.core.runtime.IExtensionDelta;
18
import org.eclipse.core.runtime.IExtensionDelta;
Lines 24-33 Link Here
24
import org.eclipse.jface.action.IToolBarManager;
26
import org.eclipse.jface.action.IToolBarManager;
25
import org.eclipse.jface.action.MenuManager;
27
import org.eclipse.jface.action.MenuManager;
26
import org.eclipse.jface.action.Separator;
28
import org.eclipse.jface.action.Separator;
29
import org.eclipse.jface.viewers.IStructuredSelection;
27
import org.eclipse.jface.viewers.TreeViewer;
30
import org.eclipse.jface.viewers.TreeViewer;
28
import org.eclipse.jface.viewers.Viewer;
31
import org.eclipse.jface.viewers.Viewer;
29
import org.eclipse.jface.viewers.ViewerComparator;
32
import org.eclipse.jface.viewers.ViewerComparator;
30
import org.eclipse.jface.viewers.ViewerFilter;
33
import org.eclipse.jface.viewers.ViewerFilter;
34
import org.eclipse.osgi.service.resolver.BundleDescription;
35
import org.eclipse.osgi.service.resolver.DisabledInfo;
36
import org.eclipse.osgi.service.resolver.PlatformAdmin;
37
import org.eclipse.osgi.service.resolver.State;
31
import org.eclipse.pde.internal.runtime.IHelpContextIds;
38
import org.eclipse.pde.internal.runtime.IHelpContextIds;
32
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
39
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
33
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
40
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
Lines 52-62 Link Here
52
import org.eclipse.ui.part.ViewPart;
59
import org.eclipse.ui.part.ViewPart;
53
import org.osgi.framework.Bundle;
60
import org.osgi.framework.Bundle;
54
import org.osgi.framework.BundleEvent;
61
import org.osgi.framework.BundleEvent;
62
import org.osgi.framework.BundleException;
55
import org.osgi.framework.BundleListener;
63
import org.osgi.framework.BundleListener;
56
import org.osgi.framework.Constants;
64
import org.osgi.framework.Constants;
65
57
public class RegistryBrowser extends ViewPart implements BundleListener, IRegistryChangeListener {
66
public class RegistryBrowser extends ViewPart implements BundleListener, IRegistryChangeListener {
58
	
67
	
59
	public static final String SHOW_RUNNING_PLUGINS = "RegistryView.showRunning.label"; //$NON-NLS-1$
68
	public static final String SHOW_RUNNING_PLUGINS = "RegistryView.showRunning.label"; //$NON-NLS-1$
69
	public static final String SHOW_ADVANCED_MODE = "RegistryView.showAdvancedMode.label"; //$NON-NLS-1$
60
	
70
	
61
	private FilteredTree fFilteredTree;
71
	private FilteredTree fFilteredTree;
62
	private TreeViewer fTreeViewer;
72
	private TreeViewer fTreeViewer;
Lines 66-74 Link Here
66
	// menus and action items
76
	// menus and action items
67
	private Action fRefreshAction;
77
	private Action fRefreshAction;
68
	private Action fShowPluginsAction;
78
	private Action fShowPluginsAction;
79
	private Action fShowAdvancedOperationsAction;
69
	private Action fCollapseAllAction;
80
	private Action fCollapseAllAction;
70
	private Action fRemoveAction;
81
	
71
	private Action fAddAction;
82
	// advanced actions
83
	private Action fStartAction;
84
	private Action fStopAction;
85
	private Action fEnableAction;
86
	private Action fDisableAction;
87
	
72
	private DrillDownAdapter drillDownAdapter;
88
	private DrillDownAdapter drillDownAdapter;
73
	private ViewerFilter fActiveFilter = new ViewerFilter() {
89
	private ViewerFilter fActiveFilter = new ViewerFilter() {
74
		public boolean select(Viewer viewer, Object parentElement, Object element) {
90
		public boolean select(Viewer viewer, Object parentElement, Object element) {
Lines 126-131 Link Here
126
		// show all plug-ins by default (i.e. not just activated ones)
142
		// show all plug-ins by default (i.e. not just activated ones)
127
		if (fMemento.getString(SHOW_RUNNING_PLUGINS) == null)
143
		if (fMemento.getString(SHOW_RUNNING_PLUGINS) == null)
128
			fMemento.putString(SHOW_RUNNING_PLUGINS, "false"); //$NON-NLS-1$
144
			fMemento.putString(SHOW_RUNNING_PLUGINS, "false"); //$NON-NLS-1$
145
		
146
		// default to not showing advanced options to users
147
		if (fMemento.getString(SHOW_ADVANCED_MODE) == null)
148
			fMemento.putString(SHOW_ADVANCED_MODE, "false"); //$NON-NLS-1$
129
	}
149
	}
130
	
150
	
131
	public void dispose() {
151
	public void dispose() {
Lines 223-228 Link Here
223
		IMenuManager mgr = bars.getMenuManager();
243
		IMenuManager mgr = bars.getMenuManager();
224
		mgr.add(new Separator());
244
		mgr.add(new Separator());
225
		mgr.add(fShowPluginsAction);
245
		mgr.add(fShowPluginsAction);
246
		mgr.add(fShowAdvancedOperationsAction);
247
		
226
	}
248
	}
227
	public void fillContextMenu(IMenuManager manager) {
249
	public void fillContextMenu(IMenuManager manager) {
228
		manager.add(fRefreshAction);
250
		manager.add(fRefreshAction);
Lines 244-258 Link Here
244
					break;
266
					break;
245
				}
267
				}
246
			}
268
			}
247
			if (allRemoveable)
248
				manager.add(fRemoveAction);
249
			if (canAdd && selection.length == 1)
250
				manager.add(fAddAction);
251
		}
269
		}
252
		manager.add(new Separator());
270
		manager.add(new Separator());
253
		drillDownAdapter.addNavigationActions(manager);
271
		drillDownAdapter.addNavigationActions(manager);
254
		manager.add(new Separator());
272
		manager.add(new Separator());
273
		
274
		// check if we should enable advanced actions
275
		if(fShowAdvancedOperationsAction.isChecked() && isBundleSelected()) {
276
			// control bundle state actions
277
			if(selectedBundlesStopped())
278
				manager.add(fStartAction);
279
			if(selectedBundlesStarted())
280
				manager.add(fStopAction);
281
			
282
			// security related actions
283
			if(selectedBundlesDisabled())
284
				manager.add(fEnableAction);
285
			if(selectedBundlesEnabled())
286
				manager.add(fDisableAction);
287
		}
288
		
289
		manager.add(new Separator());
255
		manager.add(fShowPluginsAction);
290
		manager.add(fShowPluginsAction);
291
		manager.add(fShowAdvancedOperationsAction);
256
	}
292
	}
257
	public TreeViewer getTreeViewer() {
293
	public TreeViewer getTreeViewer() {
258
		return fTreeViewer;
294
		return fTreeViewer;
Lines 261-272 Link Here
261
	public void saveState(IMemento memento) {
297
	public void saveState(IMemento memento) {
262
		if (memento == null || this.fMemento == null || fTreeViewer == null)
298
		if (memento == null || this.fMemento == null || fTreeViewer == null)
263
			return;
299
			return;
264
		boolean showRunning = fShowPluginsAction.isChecked();
300
		fMemento.putBoolean(SHOW_RUNNING_PLUGINS, fShowPluginsAction.isChecked());
265
		if (showRunning)
301
		fMemento.putBoolean(SHOW_ADVANCED_MODE, fShowAdvancedOperationsAction.isChecked());
266
			this.fMemento.putString(SHOW_RUNNING_PLUGINS, Boolean.toString(true));
302
		memento.putMemento(fMemento);
267
		else
268
			this.fMemento.putString(SHOW_RUNNING_PLUGINS, Boolean.toString(false));
269
		memento.putMemento(this.fMemento);
270
	}
303
	}
271
	
304
	
272
	public void setFocus() {
305
	public void setFocus() {
Lines 490-537 Link Here
490
		};
523
		};
491
		fShowPluginsAction.setChecked(fMemento.getString(SHOW_RUNNING_PLUGINS).equals("true")); //$NON-NLS-1$
524
		fShowPluginsAction.setChecked(fMemento.getString(SHOW_RUNNING_PLUGINS).equals("true")); //$NON-NLS-1$
492
		
525
		
493
		fRemoveAction = new Action("Remove") { //$NON-NLS-1$
526
		fShowAdvancedOperationsAction = new Action(PDERuntimeMessages.RegistryView_showAdvanced_label) {
527
			public void run() {
528
				if (fShowAdvancedOperationsAction.isChecked())
529
					createAdvancedActions();
530
				else
531
					disabledAdvancedActions();
532
			}
533
		};
534
		fShowAdvancedOperationsAction.setChecked(fMemento.getString(SHOW_ADVANCED_MODE).equals("true")); //$NON-NLS-1$
535
		
536
		fStartAction = new Action(PDERuntimeMessages.RegistryView_startAction_label) {
494
			public void run() {
537
			public void run() {
495
//				Tree tree = getUndisposedTree();
538
				try {
496
//				if (tree == null)
539
					List bundles = getSelectedBundles();
497
//					return;
540
					for(Iterator it = bundles.iterator(); it.hasNext();) {
498
//				IExtensionRegistry registry = Platform.getExtensionRegistry();
541
						Bundle bundle = (Bundle) it.next();
499
//				Object token = ((ExtensionRegistry)registry).getTemporaryUserToken();
542
						bundle.start();
500
//				TreeItem[] selection = tree.getSelection();
543
					}
501
//				for (int i = 0; i < selection.length; i++) {
544
				} catch (BundleException e) {
502
//					Object obj = selection[i].getData();
545
					PDERuntimePlugin.log(e);
503
//					if (obj instanceof ParentAdapter)
546
				}
504
//						obj = ((ParentAdapter)obj).getObject();
547
			}
505
//					if (obj instanceof IExtensionPoint)
548
		};
506
//						registry.removeExtensionPoint((IExtensionPoint)obj, token);
549
		
507
//					else if (obj instanceof IExtension)
550
		fStopAction = new Action(PDERuntimeMessages.RegistryView_stopAction_label) {
508
//						registry.removeExtension((IExtension)obj, token);
551
			public void run() {
509
//				}
552
				try {
510
				
553
					List bundles = getSelectedBundles();
554
					for(Iterator it = bundles.iterator(); it.hasNext();) {
555
						Bundle bundle = (Bundle) it.next();
556
						bundle.stop();
557
					}
558
				} catch (BundleException e) {
559
					PDERuntimePlugin.log(e);
560
				}
511
			}
561
			}
512
		};
562
		};
513
		
563
		
514
		fAddAction = new Action("Add...") { //$NON-NLS-1$
564
		fEnableAction = new Action(PDERuntimeMessages.RegistryView_enableAction_label) {
515
			public void run() {
565
			public void run() {
516
//				Tree tree = getUndisposedTree();
566
				List bundles = getSelectedBundles();
517
//				if (tree == null)
567
				State state = PDERuntimePlugin.getDefault().getState();
518
//					return;
568
				for(Iterator it = bundles.iterator(); it.hasNext();) {
519
//				FileDialog dialog = new FileDialog(getSite().getShell(), SWT.OPEN);
569
					Bundle bundle = (Bundle) it.next();
520
//				String input = dialog.open();
570
					BundleDescription desc = state.getBundle(bundle.getBundleId());
521
//				if (input == null)
571
					DisabledInfo[] infos = state.getDisabledInfos(desc);
522
//					return;
572
					for (int i = 0; i < infos.length; i++) {
523
//				Object selection = tree.getSelection()[0].getData();
573
						PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
524
//				if (selection instanceof PluginObjectAdapter)
574
						platformAdmin.removeDisabledInfo(infos[i]);
525
//					selection = ((PluginObjectAdapter)selection).getObject();
575
					}
526
//				if (!(selection instanceof Bundle))
576
				}
527
//					return;
577
			}
528
//				IContributor contributor = ContributorFactoryOSGi.createContributor((Bundle)selection);
578
		};
529
//				IExtensionRegistry registry = Platform.getExtensionRegistry();
579
		
530
//				Object token = ((ExtensionRegistry)registry).getTemporaryUserToken();
580
		fDisableAction = new Action(PDERuntimeMessages.RegistryView_disableAction_label) {
531
//				try {
581
			public void run() {
532
//					registry.addContribution(new FileInputStream(input), contributor, false, null, null, token);
582
				List bundles = getSelectedBundles();
533
//				} catch (FileNotFoundException e) {
583
				State state = PDERuntimePlugin.getDefault().getState();
534
//				}
584
				for(Iterator it = bundles.iterator(); it.hasNext();) {
585
					Bundle bundle = (Bundle) it.next();
586
					BundleDescription desc = state.getBundle(bundle.getBundleId());
587
					DisabledInfo info = new DisabledInfo("ui", "Bundle disabled via PDE", desc); //$NON-NLS-1$ //$NON-NLS-2$
588
					PlatformAdmin platformAdmin = 
589
						PDERuntimePlugin.getDefault().getPlatformAdmin();
590
					platformAdmin.addDisabledInfo(info);
591
				}
535
			}
592
			}
536
		};
593
		};
537
		
594
		
Lines 545-550 Link Here
545
		fCollapseAllAction.setToolTipText(PDERuntimeMessages.RegistryView_collapseAll_tooltip);
602
		fCollapseAllAction.setToolTipText(PDERuntimeMessages.RegistryView_collapseAll_tooltip);
546
	}
603
	}
547
	
604
	
605
	protected void createAdvancedActions() {
606
		// TODO Auto-generated method stub
607
		
608
	}
609
610
	protected void disabledAdvancedActions() {
611
		// TODO Auto-generated method stub
612
		
613
	}
614
548
	public void updateTitle(){
615
	public void updateTitle(){
549
		if (fTreeViewer == null || fTreeViewer.getContentProvider() == null)
616
		if (fTreeViewer == null || fTreeViewer.getContentProvider() == null)
550
			return;
617
			return;
Lines 556-559 Link Here
556
			return null;
623
			return null;
557
		return fTreeViewer.getTree();
624
		return fTreeViewer.getTree();
558
	}
625
	}
626
	
627
	// TODO hackish, should rewrite
628
	private boolean isBundleSelected() {
629
		IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
630
		if(selection != null) {			
631
			Object[] elements = selection.toArray();
632
			for(int i = 0; i < elements.length; i++) {
633
				if(elements[i] instanceof PluginObjectAdapter) {
634
					PluginObjectAdapter adapter = (PluginObjectAdapter) elements[i];
635
					Object object = adapter.getObject();
636
					if(!(object instanceof Bundle))
637
						return false;
638
				} else {
639
					return false;
640
				}
641
			}
642
		}
643
		return true;
644
	}
645
	
646
	private List getSelectedBundles() {
647
		List bundles = new ArrayList();
648
		IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
649
		if(selection != null) {
650
			Object[] elements = selection.toArray();
651
			for(int i = 0; i < elements.length; i++) {
652
				if(elements[i] instanceof PluginObjectAdapter) {
653
					PluginObjectAdapter adapter = (PluginObjectAdapter) elements[i];
654
					Object object = adapter.getObject();
655
					if(object instanceof Bundle)
656
						bundles.add(object);
657
				}
658
			}
659
		}
660
		return bundles;
661
	}
662
	
663
	private boolean selectedBundlesStarted() {
664
		List bundles = getSelectedBundles();
665
		for(Iterator it = bundles.iterator(); it.hasNext();) {
666
			Bundle bundle = (Bundle) it.next();
667
			if(bundle.getState() != Bundle.ACTIVE)
668
				return false;
669
		}
670
		return true;
671
	}
672
	
673
	private boolean selectedBundlesStopped() {
674
		List bundles = getSelectedBundles();
675
		for(Iterator it = bundles.iterator(); it.hasNext();) {
676
			Bundle bundle = (Bundle) it.next();
677
			if(bundle.getState() == Bundle.ACTIVE)
678
				return false;
679
		}
680
		return true;
681
	}
682
	
683
	private boolean selectedBundlesDisabled() {
684
		List bundles = getSelectedBundles();
685
		for(Iterator it = bundles.iterator(); it.hasNext();) {
686
			Bundle bundle = (Bundle) it.next();
687
			State state = 
688
				PDERuntimePlugin.getDefault().getState();
689
			BundleDescription desc = 
690
				state.getBundle(bundle.getBundleId());
691
			DisabledInfo[] infos = state.getDisabledInfos(desc);
692
			if(infos.length == 0)
693
				return false;
694
		}
695
		return true;
696
	}
697
	
698
	private boolean selectedBundlesEnabled() {
699
		List bundles = getSelectedBundles();
700
		for(Iterator it = bundles.iterator(); it.hasNext();) {
701
			Bundle bundle = (Bundle) it.next();
702
			State state = 
703
				PDERuntimePlugin.getDefault().getState();
704
			BundleDescription desc = 
705
				state.getBundle(bundle.getBundleId());
706
			DisabledInfo[] infos = state.getDisabledInfos(desc);
707
			if(infos.length > 0)
708
				return false;
709
		}
710
		return true;
711
	}
712
	
559
}
713
}
(-)src/org/eclipse/pde/internal/runtime/PDERuntimePlugin.java (+46 lines)
Lines 10-16 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime;
11
package org.eclipse.pde.internal.runtime;
12
12
13
import java.lang.reflect.InvocationTargetException;
14
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.IStatus;
13
import org.eclipse.core.runtime.Platform;
17
import org.eclipse.core.runtime.Platform;
18
import org.eclipse.core.runtime.Status;
19
import org.eclipse.osgi.service.resolver.PlatformAdmin;
20
import org.eclipse.osgi.service.resolver.State;
14
import org.eclipse.swt.widgets.Shell;
21
import org.eclipse.swt.widgets.Shell;
15
import org.eclipse.ui.IWorkbenchPage;
22
import org.eclipse.ui.IWorkbenchPage;
16
import org.eclipse.ui.IWorkbenchWindow;
23
import org.eclipse.ui.IWorkbenchWindow;
Lines 22-30 Link Here
22
29
23
public class PDERuntimePlugin extends AbstractUIPlugin {
30
public class PDERuntimePlugin extends AbstractUIPlugin {
24
	
31
	
32
	public static final String ID = "org.eclipse.pde.runtime"; //$NON-NLS-1$
33
	
25
	private static PDERuntimePlugin inst;
34
	private static PDERuntimePlugin inst;
26
	private BundleContext fContext;
35
	private BundleContext fContext;
27
	private ServiceTracker packageAdminTracker;
36
	private ServiceTracker packageAdminTracker;
37
	private ServiceTracker platformAdminTracker;
28
	
38
	
29
	private static boolean isBundleAvailable(String bundleID) {
39
	private static boolean isBundleAvailable(String bundleID) {
30
		Bundle bundle = Platform.getBundle(bundleID);
40
		Bundle bundle = Platform.getBundle(bundleID);
Lines 63-68 Link Here
63
		return (PackageAdmin) packageAdminTracker.getService();
73
		return (PackageAdmin) packageAdminTracker.getService();
64
	}
74
	}
65
	
75
	
76
	public PlatformAdmin getPlatformAdmin() {
77
		if (platformAdminTracker == null) {
78
			return null;
79
		}
80
		return (PlatformAdmin) platformAdminTracker.getService();
81
	}
82
	
66
	public static PDERuntimePlugin getDefault() {
83
	public static PDERuntimePlugin getDefault() {
67
		return inst;
84
		return inst;
68
	}
85
	}
Lines 87-98 Link Here
87
		
104
		
88
		packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
105
		packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
89
		packageAdminTracker.open();
106
		packageAdminTracker.open();
107
		
108
		platformAdminTracker = new ServiceTracker(context, PlatformAdmin.class.getName(), null);
109
		platformAdminTracker.open();
90
	}
110
	}
91
	
111
	
92
	public BundleContext getBundleContext() {
112
	public BundleContext getBundleContext() {
93
		return this.fContext;
113
		return this.fContext;
94
	}
114
	}
95
	
115
	
116
	public State getState() {
117
		return getPlatformAdmin().getState(false);
118
	}
119
	
120
	public static void log(Throwable e) {
121
		if (e instanceof InvocationTargetException)
122
			e = ((InvocationTargetException) e).getTargetException();
123
		IStatus status = null;
124
		if (e instanceof CoreException) {
125
			status = ((CoreException) e).getStatus();
126
		} else if (e.getMessage() != null) {
127
			status = new Status(
128
					IStatus.ERROR,
129
					ID,
130
					IStatus.OK,
131
					e.getMessage(),
132
					e);
133
		}
134
		if(status != null)
135
			getDefault().getLog().log(status);
136
	}
137
	
96
	/**
138
	/**
97
	 * This method is called when the plug-in is stopped
139
	 * This method is called when the plug-in is stopped
98
	 */
140
	 */
Lines 102-107 Link Here
102
			packageAdminTracker.close();
144
			packageAdminTracker.close();
103
			packageAdminTracker = null;
145
			packageAdminTracker = null;
104
		}
146
		}
147
		if (platformAdminTracker != null) {
148
			platformAdminTracker.close();
149
			platformAdminTracker = null;
150
		}
105
		inst = null;
151
		inst = null;
106
	}
152
	}
107
153
(-)src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java (+5 lines)
Lines 24-30 Link Here
24
	public static String RegistryView_folders_extensionPoints;
24
	public static String RegistryView_folders_extensionPoints;
25
	public static String RegistryView_folders_extensions;
25
	public static String RegistryView_folders_extensions;
26
	public static String RegistryView_showRunning_label;
26
	public static String RegistryView_showRunning_label;
27
	public static String RegistryView_showAdvanced_label;
27
	public static String RegistryView_titleSummary;
28
	public static String RegistryView_titleSummary;
29
	public static String RegistryView_startAction_label;
30
	public static String RegistryView_stopAction_label;
31
	public static String RegistryView_enableAction_label;
32
	public static String RegistryView_disableAction_label;
28
	
33
	
29
	public static String RegistryBrowserLabelProvider_nameIdBind;
34
	public static String RegistryBrowserLabelProvider_nameIdBind;

Return to bug 207583