View | Details | Raw Unified | Return to bug 207831 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java (+65 lines)
Lines 19-31 Link Here
19
import org.eclipse.core.runtime.IExtensionPoint;
19
import org.eclipse.core.runtime.IExtensionPoint;
20
import org.eclipse.core.runtime.IRegistryChangeEvent;
20
import org.eclipse.core.runtime.IRegistryChangeEvent;
21
import org.eclipse.core.runtime.IRegistryChangeListener;
21
import org.eclipse.core.runtime.IRegistryChangeListener;
22
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.MultiStatus;
22
import org.eclipse.core.runtime.Platform;
24
import org.eclipse.core.runtime.Platform;
25
import org.eclipse.core.runtime.Status;
26
import org.eclipse.core.runtime.internal.adaptor.MessageHelper;
23
import org.eclipse.jface.action.Action;
27
import org.eclipse.jface.action.Action;
24
import org.eclipse.jface.action.IMenuListener;
28
import org.eclipse.jface.action.IMenuListener;
25
import org.eclipse.jface.action.IMenuManager;
29
import org.eclipse.jface.action.IMenuManager;
26
import org.eclipse.jface.action.IToolBarManager;
30
import org.eclipse.jface.action.IToolBarManager;
27
import org.eclipse.jface.action.MenuManager;
31
import org.eclipse.jface.action.MenuManager;
28
import org.eclipse.jface.action.Separator;
32
import org.eclipse.jface.action.Separator;
33
import org.eclipse.jface.dialogs.Dialog;
34
import org.eclipse.jface.dialogs.MessageDialog;
29
import org.eclipse.jface.viewers.IStructuredSelection;
35
import org.eclipse.jface.viewers.IStructuredSelection;
30
import org.eclipse.jface.viewers.TreeViewer;
36
import org.eclipse.jface.viewers.TreeViewer;
31
import org.eclipse.jface.viewers.Viewer;
37
import org.eclipse.jface.viewers.Viewer;
Lines 34-40 Link Here
34
import org.eclipse.osgi.service.resolver.BundleDescription;
40
import org.eclipse.osgi.service.resolver.BundleDescription;
35
import org.eclipse.osgi.service.resolver.DisabledInfo;
41
import org.eclipse.osgi.service.resolver.DisabledInfo;
36
import org.eclipse.osgi.service.resolver.PlatformAdmin;
42
import org.eclipse.osgi.service.resolver.PlatformAdmin;
43
import org.eclipse.osgi.service.resolver.ResolverError;
37
import org.eclipse.osgi.service.resolver.State;
44
import org.eclipse.osgi.service.resolver.State;
45
import org.eclipse.osgi.service.resolver.VersionConstraint;
38
import org.eclipse.pde.internal.runtime.IHelpContextIds;
46
import org.eclipse.pde.internal.runtime.IHelpContextIds;
39
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
47
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
40
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
48
import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
Lines 84-89 Link Here
84
	private Action fStopAction;
92
	private Action fStopAction;
85
	private Action fEnableAction;
93
	private Action fEnableAction;
86
	private Action fDisableAction;
94
	private Action fDisableAction;
95
	private Action fDiagnoseAction;
87
	
96
	
88
	private DrillDownAdapter drillDownAdapter;
97
	private DrillDownAdapter drillDownAdapter;
89
	private ViewerFilter fActiveFilter = new ViewerFilter() {
98
	private ViewerFilter fActiveFilter = new ViewerFilter() {
Lines 279-284 Link Here
279
			if(selectedBundlesStarted())
288
			if(selectedBundlesStarted())
280
				manager.add(fStopAction);
289
				manager.add(fStopAction);
281
			
290
			
291
			manager.add(fDiagnoseAction);
292
			
282
			// security related actions
293
			// security related actions
283
			if(selectedBundlesDisabled())
294
			if(selectedBundlesDisabled())
284
				manager.add(fEnableAction);
295
				manager.add(fEnableAction);
Lines 587-592 Link Here
587
			}
598
			}
588
		};
599
		};
589
		
600
		
601
		fDiagnoseAction = new Action(PDERuntimeMessages.RegistryView_diagnoseAction_label) {
602
			public void run() {
603
				List bundles = getSelectedBundles();
604
				State state = PDERuntimePlugin.getDefault().getState();
605
				for (Iterator it = bundles.iterator(); it.hasNext();) {
606
					Bundle bundle = (Bundle) it.next();
607
					BundleDescription desc = state.getBundle(bundle.getBundleId());
608
					PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
609
					VersionConstraint[] unsatisfied = platformAdmin
610
							.getStateHelper().getUnsatisfiedConstraints(desc);
611
					ResolverError[] resolverErrors = platformAdmin.getState(false).getResolverErrors(desc);
612
					MultiStatus problems = new MultiStatus(PDERuntimePlugin.ID,
613
							IStatus.INFO,
614
							PDERuntimeMessages.RegistryView_found_problems,
615
							null);
616
					for (int i = 0; i < resolverErrors.length; i++) {
617
						if ((resolverErrors[i].getType() & (ResolverError.MISSING_FRAGMENT_HOST
618
								| ResolverError.MISSING_GENERIC_CAPABILITY
619
								| ResolverError.MISSING_IMPORT_PACKAGE | ResolverError.MISSING_REQUIRE_BUNDLE)) != 0)
620
							continue;
621
						IStatus status = new Status(IStatus.WARNING,
622
								PDERuntimePlugin.ID, resolverErrors[i]
623
										.toString());
624
						problems.add(status);
625
					}
626
627
					for (int i = 0; i < unsatisfied.length; i++) {
628
						// XXX what should we do with the MessageHelper? Copy over?
629
						IStatus status = new Status(
630
								IStatus.WARNING,
631
								PDERuntimePlugin.ID,
632
								MessageHelper
633
										.getResolutionFailureMessage(unsatisfied[i]));
634
						problems.add(status);
635
					}
636
					Dialog dialog;
637
					if (unsatisfied.length != 0 || resolverErrors.length != 0) {
638
						dialog = new DiagnosticsDialog(
639
								getSite().getShell(),
640
								PDERuntimeMessages.RegistryView_diag_dialog_title,
641
								null, problems, IStatus.WARNING);
642
						dialog.open();
643
					} else {
644
						MessageDialog
645
								.openInformation(
646
										getSite().getShell(),
647
										PDERuntimeMessages.RegistryView_diag_dialog_title,
648
										PDERuntimeMessages.RegistryView_no_unresolved_constraints);
649
					}
650
651
				}
652
			}
653
		};
654
		
590
		fCollapseAllAction = new Action("collapseAll"){ //$NON-NLS-1$
655
		fCollapseAllAction = new Action("collapseAll"){ //$NON-NLS-1$
591
			public void run(){
656
			public void run(){
592
				fTreeViewer.collapseAll();
657
				fTreeViewer.collapseAll();
(-)src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java (+8 lines)
Lines 23-35 Link Here
23
	public static String RegistryView_folders_libraries;
23
	public static String RegistryView_folders_libraries;
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
27
	public static String RegistryView_found_problems;
26
	public static String RegistryView_showRunning_label;
28
	public static String RegistryView_showRunning_label;
27
	public static String RegistryView_showAdvanced_label;
29
	public static String RegistryView_showAdvanced_label;
28
	public static String RegistryView_titleSummary;
30
	public static String RegistryView_titleSummary;
29
	public static String RegistryView_startAction_label;
31
	public static String RegistryView_startAction_label;
30
	public static String RegistryView_stopAction_label;
32
	public static String RegistryView_stopAction_label;
31
	public static String RegistryView_enableAction_label;
33
	public static String RegistryView_enableAction_label;
34
	public static String RegistryView_diag_dialog_title;
35
36
	public static String RegistryView_diagnoseAction_label;
37
32
	public static String RegistryView_disableAction_label;
38
	public static String RegistryView_disableAction_label;
39
40
	public static String RegistryView_no_unresolved_constraints;
33
	
41
	
34
	public static String RegistryBrowserLabelProvider_nameIdBind;
42
	public static String RegistryBrowserLabelProvider_nameIdBind;
35
	
43
	
(-)src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties (+4 lines)
Lines 20-25 Link Here
20
RegistryView_folders_libraries = Run-time Libraries
20
RegistryView_folders_libraries = Run-time Libraries
21
RegistryView_folders_extensionPoints = Extension Points
21
RegistryView_folders_extensionPoints = Extension Points
22
RegistryView_folders_extensions = Extensions
22
RegistryView_folders_extensions = Extensions
23
RegistryView_found_problems=The following problems were found by diagnosing the bundle:
23
RegistryView_showRunning_label = &Show Active Plug-ins Only
24
RegistryView_showRunning_label = &Show Active Plug-ins Only
24
RegistryView_showAdvanced_label = Show Advanced &Operations
25
RegistryView_showAdvanced_label = Show Advanced &Operations
25
RegistryBrowserLabelProvider_nameIdBind={0} [{1}]
26
RegistryBrowserLabelProvider_nameIdBind={0} [{1}]
Lines 27-33 Link Here
27
RegistryView_startAction_label = Start
28
RegistryView_startAction_label = Start
28
RegistryView_stopAction_label = Stop
29
RegistryView_stopAction_label = Stop
29
RegistryView_enableAction_label = Enable
30
RegistryView_enableAction_label = Enable
31
RegistryView_diag_dialog_title=Bundle Diagnose
32
RegistryView_diagnoseAction_label=Diagnose
30
RegistryView_disableAction_label = Disable
33
RegistryView_disableAction_label = Disable
34
RegistryView_no_unresolved_constraints=No unresolved constraints.
31
35
32
# Plug-in Spy
36
# Plug-in Spy
33
SpyDialog_title = Plug-in Spy
37
SpyDialog_title = Plug-in Spy
(-)src/org/eclipse/pde/internal/runtime/registry/DiagnosticsDialog.java (+33 lines)
Added Link Here
1
package org.eclipse.pde.internal.runtime.registry;
2
3
import org.eclipse.core.runtime.IStatus;
4
import org.eclipse.jface.dialogs.ErrorDialog;
5
import org.eclipse.jface.dialogs.IDialogConstants;
6
import org.eclipse.swt.widgets.Composite;
7
import org.eclipse.swt.widgets.Control;
8
import org.eclipse.swt.widgets.Shell;
9
10
public class DiagnosticsDialog extends ErrorDialog {
11
12
	public DiagnosticsDialog(Shell parentShell, String dialogTitle,
13
			String message, IStatus status, int displayMask) {
14
		super(parentShell, dialogTitle, message, status, displayMask);
15
	}
16
17
	protected Control createDialogArea(Composite parent) {
18
		Control area = super.createDialogArea(parent);
19
		createDropDownList((Composite) area);
20
		return area;
21
	}
22
23
	/*
24
	 * (non-Javadoc)
25
	 * 
26
	 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
27
	 */
28
	protected void createButtonsForButtonBar(Composite parent) {
29
		createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
30
				true);
31
	}
32
33
}

Return to bug 207831