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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/runtime/spy/sections/ActiveMenuSection.java (-1 / +30 lines)
Lines 17-23 Link Here
17
import org.eclipse.jface.action.*;
17
import org.eclipse.jface.action.*;
18
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
18
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
19
import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
19
import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
20
import org.eclipse.swt.widgets.Event;
20
import org.eclipse.swt.widgets.*;
21
import org.eclipse.ui.IActionDelegate;
21
import org.eclipse.ui.IActionDelegate;
22
import org.eclipse.ui.PlatformUI;
22
import org.eclipse.ui.PlatformUI;
23
import org.eclipse.ui.commands.ICommandService;
23
import org.eclipse.ui.commands.ICommandService;
Lines 54-59 Link Here
54
				if (id != null) {
54
				if (id != null) {
55
					buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_0, new String[] {id}));
55
					buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_0, new String[] {id}));
56
				}
56
				}
57
				if (object instanceof ContributionItem) {
58
					createLocationURI(toolkit, object, text, buffer, id);
59
				}
57
				scan(item, buffer, toolkit, text);
60
				scan(item, buffer, toolkit, text);
58
			}
61
			}
59
62
Lines 62-67 Link Here
62
		}
65
		}
63
	}
66
	}
64
67
68
	private void createLocationURI(SpyFormToolkit toolkit, Object object, FormText text, StringBuffer buffer, String id) {
69
		IContributionManager parent = ((ContributionItem) object).getParent();
70
		if (parent instanceof IMenuManager) {
71
			String parentId = ((IMenuManager) parent).getId();
72
			String locationURI = "menu:" + parentId + (id == null ? "?fter=additions" : "?after=" + id);
73
			buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_0, new String[] {locationURI}));
74
		} else if (parent instanceof ToolBarManager) {
75
			ToolBar bar = ((ToolBarManager) parent).getControl();
76
			if (bar.getParent() instanceof CoolBar) {
77
				CoolItem[] items = ((CoolBar) bar.getParent()).getItems();
78
				for (int i = 0; i < items.length; i++) {
79
					CoolItem coolItem = items[i];
80
					if (coolItem.getControl() == bar) {
81
						Object o = coolItem.getData();
82
						if (o instanceof ToolBarContributionItem) {
83
							String parentId = ((ToolBarContributionItem) o).getId();
84
							String locationURI = "toolbar:" + parentId + (id == null ? "?fter=additions" : "?after=" + id);
85
							buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_0, new String[] {locationURI}));
86
						}
87
						continue;
88
					}
89
				}
90
			}
91
		}
92
	}
93
65
	// FIXME this is a bit hackish but works... rearchitect
94
	// FIXME this is a bit hackish but works... rearchitect
66
	private void scan(IContributionItem item, StringBuffer buffer, SpyFormToolkit toolkit, FormText text) {
95
	private void scan(IContributionItem item, StringBuffer buffer, SpyFormToolkit toolkit, FormText text) {
67
		// check for action set information
96
		// check for action set information

Return to bug 209872