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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java (+4 lines)
Lines 37-42 Link Here
37
	public static final String IMG_MENU_OBJ = "menu_obj.gif"; //$NON-NLS-1$
37
	public static final String IMG_MENU_OBJ = "menu_obj.gif"; //$NON-NLS-1$
38
	public static final String IMG_ID_OBJ = "generic_xml_obj.gif"; //$NON-NLS-1$
38
	public static final String IMG_ID_OBJ = "generic_xml_obj.gif"; //$NON-NLS-1$
39
	public static final String IMG_MENUSPY_OBJ = "menuspy_obj.gif"; //$NON-NLS-1$
39
	public static final String IMG_MENUSPY_OBJ = "menuspy_obj.gif"; //$NON-NLS-1$
40
	public static final String IMG_CONTEXTID_OBJ = "contextid_obj.gif"; //$NON-NLS-1$
40
	
41
	
41
	public static final ImageDescriptor CLASS_OBJ =
42
	public static final ImageDescriptor CLASS_OBJ =
42
		create(PATH_OBJ, IMG_CLASS_OBJ);
43
		create(PATH_OBJ, IMG_CLASS_OBJ);
Lines 52-57 Link Here
52
		create(PATH_OBJ, IMG_ID_OBJ);
53
		create(PATH_OBJ, IMG_ID_OBJ);
53
	public static final ImageDescriptor MENUSPY_OBJ =
54
	public static final ImageDescriptor MENUSPY_OBJ =
54
		create(PATH_OBJ, IMG_MENUSPY_OBJ);
55
		create(PATH_OBJ, IMG_MENUSPY_OBJ);
56
	public static final ImageDescriptor CONTEXTID_OBJ =
57
		create(PATH_OBJ, IMG_CONTEXTID_OBJ);
55
58
56
	public static final ImageDescriptor DESC_REFRESH_DISABLED =
59
	public static final ImageDescriptor DESC_REFRESH_DISABLED =
57
		create(PATH_DCL, "refresh.gif"); //$NON-NLS-1$
60
		create(PATH_DCL, "refresh.gif"); //$NON-NLS-1$
Lines 115-120 Link Here
115
		manage(IMG_MENU_OBJ, MENU_OBJ);
118
		manage(IMG_MENU_OBJ, MENU_OBJ);
116
		manage(IMG_ID_OBJ, ID_OBJ);
119
		manage(IMG_ID_OBJ, ID_OBJ);
117
		manage(IMG_MENUSPY_OBJ, MENUSPY_OBJ);
120
		manage(IMG_MENUSPY_OBJ, MENUSPY_OBJ);
121
		manage(IMG_CONTEXTID_OBJ, CONTEXTID_OBJ);
118
	}
122
	}
119
	
123
	
120
	private static ImageDescriptor create(String prefix, String name) {
124
	private static ImageDescriptor create(String prefix, String name) {
(-)src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties (-1 / +2 lines)
Lines 46-49 Link Here
46
SpyDialog_activeSelectionInterfaces_desc = The interfaces valid for the selection:
46
SpyDialog_activeSelectionInterfaces_desc = The interfaces valid for the selection:
47
SpyDialog_activeDialogPageSection_title = Active Page ({0})
47
SpyDialog_activeDialogPageSection_title = Active Page ({0})
48
SpyDialog_activeDialogPageSection_title2 = Active Page
48
SpyDialog_activeDialogPageSection_title2 = Active Page
49
SpyDialog_activeDialogPageSection_desc = The active page class:
49
SpyDialog_activeDialogPageSection_desc = The active page class:
50
SpyDialog_activeHelpSection_title = Active Help Context Identifiers
(-)src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java (+1 lines)
Lines 50-55 Link Here
50
	public static String SpyDialog_activeDialogPageSection_title;
50
	public static String SpyDialog_activeDialogPageSection_title;
51
	public static String SpyDialog_activeDialogPageSection_title2;
51
	public static String SpyDialog_activeDialogPageSection_title2;
52
	public static String SpyDialog_activeDialogPageSection_desc;
52
	public static String SpyDialog_activeDialogPageSection_desc;
53
	public static String SpyDialog_activeHelpSection_title;
53
54
54
	static {
55
	static {
55
		// load message values from bundle file
56
		// load message values from bundle file
(-)src/org/eclipse/pde/internal/runtime/spy/sections/ActiveHelpSection.java (-20 / +28 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
9
 *     Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
10
 *     Remy Suen <remy.suen@gmail.com> - bug 203451
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.pde.internal.runtime.spy.sections;
12
package org.eclipse.pde.internal.runtime.spy.sections;
12
13
Lines 14-23 Link Here
14
import org.eclipse.jface.dialogs.Dialog;
15
import org.eclipse.jface.dialogs.Dialog;
15
import org.eclipse.jface.preference.IPreferencePage;
16
import org.eclipse.jface.preference.IPreferencePage;
16
import org.eclipse.jface.preference.PreferenceDialog;
17
import org.eclipse.jface.preference.PreferenceDialog;
18
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
19
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
17
import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
20
import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
21
import org.eclipse.swt.graphics.Image;
18
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.swt.widgets.Control;
23
import org.eclipse.swt.widgets.Control;
20
import org.eclipse.swt.widgets.Shell;
24
import org.eclipse.swt.widgets.Shell;
25
import org.eclipse.swt.widgets.Widget;
21
import org.eclipse.ui.IEditorPart;
26
import org.eclipse.ui.IEditorPart;
22
import org.eclipse.ui.IEditorReference;
27
import org.eclipse.ui.IEditorReference;
23
import org.eclipse.ui.IViewReference;
28
import org.eclipse.ui.IViewReference;
Lines 34-43 Link Here
34
39
35
public class ActiveHelpSection implements ISpySection {
40
public class ActiveHelpSection implements ISpySection {
36
41
37
	private static String HELP_KEY = "org.eclipse.ui.help"; //$NON-NLS-1$
42
	private SpyFormToolkit toolkit;
38
43
39
	public void build(ScrolledForm form, SpyFormToolkit toolkit,
44
	public void build(ScrolledForm form, SpyFormToolkit toolkit,
40
			ExecutionEvent event) {
45
			ExecutionEvent event) {
46
		this.toolkit = toolkit;
41
		final Shell shell = HandlerUtil.getActiveShell(event);
47
		final Shell shell = HandlerUtil.getActiveShell(event);
42
		Object object = shell.getData();
48
		Object object = shell.getData();
43
		if(object == null)
49
		if(object == null)
Lines 45-67 Link Here
45
		
51
		
46
		StringBuffer helpBuffer = new StringBuffer();
52
		StringBuffer helpBuffer = new StringBuffer();
47
		// process help
53
		// process help
54
		// TODO we need to make this cleaner... help processing is complicated atm
48
		if(object instanceof PreferenceDialog) {
55
		if(object instanceof PreferenceDialog) {
49
			PreferenceDialog dialog = (PreferenceDialog) object;
56
			PreferenceDialog dialog = (PreferenceDialog) object;
50
			IPreferencePage page = (IPreferencePage) dialog.getSelectedPage();
57
			IPreferencePage page = (IPreferencePage) dialog.getSelectedPage();
51
			processChildren(page.getControl().getShell(), toolkit, helpBuffer);
58
			processHelp(page.getControl().getShell(), helpBuffer);
59
			processChildren(page.getControl(), helpBuffer);
52
		} else if(object instanceof Dialog) {
60
		} else if(object instanceof Dialog) {
53
			Dialog dialog = (Dialog) object;
61
			Dialog dialog = (Dialog) object;
54
			processChildren(dialog.getShell(), toolkit, helpBuffer);
62
			processChildren(dialog.getShell(), helpBuffer);
55
		} else {
63
		} else {
56
			helpBuffer.append(processControlHelp(event, toolkit));
64
			helpBuffer.append(processControlHelp(event, toolkit));
57
		}
65
		}
58
		
66
		
59
		// ensure we actually have help
60
		// TODO we need to make this cleaner... help processing is complicated atm
61
		if(helpBuffer != null && helpBuffer.length() > 0) {
67
		if(helpBuffer != null && helpBuffer.length() > 0) {
62
			Section section = toolkit.createSection(form.getBody(),
68
			Section section = toolkit.createSection(form.getBody(),
63
					ExpandableComposite.TITLE_BAR);
69
					ExpandableComposite.TITLE_BAR);
64
			section.setText("Active Help"); //$NON-NLS-1$
70
			section.setText(PDERuntimeMessages.SpyDialog_activeHelpSection_title);
65
			
71
			
66
			FormText text = toolkit.createFormText(section, true);
72
			FormText text = toolkit.createFormText(section, true);
67
			section.setClient(text);
73
			section.setClient(text);
Lines 70-93 Link Here
70
			td.grabHorizontal = true;
76
			td.grabHorizontal = true;
71
			section.setLayoutData(td);
77
			section.setLayoutData(td);
72
			
78
			
79
			Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_CONTEXTID_OBJ);
80
			text.setImage("contextid", image); //$NON-NLS-1$
81
			
73
			StringBuffer buffer = new StringBuffer();
82
			StringBuffer buffer = new StringBuffer();
74
			buffer.append("<form>"); //$NON-NLS-1$
83
			buffer.append("<form>"); //$NON-NLS-1$
75
			buffer.append(helpBuffer.toString());
84
			buffer.append(helpBuffer.toString());
76
			buffer.append("</form>"); //$NON-NLS-1$
85
			buffer.append("</form>"); //$NON-NLS-1$
77
			text.setText(buffer.toString(), true, false);
86
			String content = buffer.toString().replaceAll("&", "&amp;"); //$NON-NLS-1$ //$NON-NLS-2$
87
			text.setText(content, true, false);
78
		}
88
		}
79
		
89
		
80
	}
90
	}
91
	
92
	private void processHelp(Widget widget, StringBuffer buffer) {
93
		buffer.append(toolkit.createHelpIdentifierSection(widget));
94
	}
81
95
82
	private void processChildren(Control control, SpyFormToolkit toolkit, StringBuffer buffer) {
96
	private void processChildren(Control control, StringBuffer buffer) {
83
		if(control.getData(HELP_KEY) != null) {
97
		processHelp(control, buffer);
84
			buffer.append("<li bindent=\"20\">" + control.toString() + " - " + control.getData(HELP_KEY) + "</li>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
85
		}
86
		if(control instanceof Composite) {
98
		if(control instanceof Composite) {
87
			Composite composite = (Composite) control;
99
			Composite composite = (Composite) control;
88
			Control[] controls = composite.getChildren();
100
			Control[] controls = composite.getChildren();
89
			for (int i = 0; i < controls.length; i++) {
101
			for (int i = 0; i < controls.length; i++) {
90
				processChildren(controls[i], toolkit, buffer);
102
				processChildren(controls[i], buffer);
91
			}
103
			}
92
		}
104
		}
93
	}
105
	}
Lines 137-157 Link Here
137
149
138
		}
150
		}
139
		if (shell != null) {
151
		if (shell != null) {
140
			if (shell.getData(HELP_KEY) != null) { 
152
			buffer.append(toolkit.createHelpIdentifierSection(shell));
141
				buffer.append("<li bindent=\"20\">" + shell.toString() + " - " + shell.getData(HELP_KEY) + "</li>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
142
			}
143
			for (int i = 0; i < shell.getChildren().length; i++) {
153
			for (int i = 0; i < shell.getChildren().length; i++) {
144
				processChildren(shell.getChildren()[i], toolkit, buffer);
154
				processChildren(shell.getChildren()[i], buffer);
145
			}
155
			}
146
		}
156
		}
147
		else if(control != null) {
157
		else if(control != null) {
148
			if(control.getData(HELP_KEY) != null) { 
158
			buffer.append(toolkit.createHelpIdentifierSection(control));
149
				buffer.append("<li bindent=\"20\">" + control.toString() + " - " + control.getData(HELP_KEY) + "</li>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
150
			}
151
			if(control instanceof Composite) {
159
			if(control instanceof Composite) {
152
				Composite parent = (Composite) control;
160
				Composite parent = (Composite) control;
153
				for(int i = 0; i < parent.getChildren().length; i++) {
161
				for(int i = 0; i < parent.getChildren().length; i++) {
154
					processChildren(parent.getChildren()[i], toolkit, buffer);
162
					processChildren(parent.getChildren()[i], buffer);
155
				}
163
				}
156
			}
164
			}
157
		}
165
		}
(-)src/org/eclipse/pde/internal/runtime/spy/dialogs/SpyDialog.java (-9 / +10 lines)
Lines 15-22 Link Here
15
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
15
import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
16
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
16
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
17
import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
17
import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
18
import org.eclipse.pde.internal.runtime.spy.sections.ActivePartSection;
19
import org.eclipse.pde.internal.runtime.spy.sections.ActiveDialogPageSection;
18
import org.eclipse.pde.internal.runtime.spy.sections.ActiveDialogPageSection;
19
import org.eclipse.pde.internal.runtime.spy.sections.ActiveHelpSection;
20
import org.eclipse.pde.internal.runtime.spy.sections.ActivePartSection;
20
import org.eclipse.pde.internal.runtime.spy.sections.ActiveSelectionSection;
21
import org.eclipse.pde.internal.runtime.spy.sections.ActiveSelectionSection;
21
import org.eclipse.pde.internal.runtime.spy.sections.ActiveShellSection;
22
import org.eclipse.pde.internal.runtime.spy.sections.ActiveShellSection;
22
import org.eclipse.pde.internal.runtime.spy.sections.ActiveWizardSection;
23
import org.eclipse.pde.internal.runtime.spy.sections.ActiveWizardSection;
Lines 85-108 Link Here
85
		section = new ActiveDialogPageSection();
86
		section = new ActiveDialogPageSection();
86
		section.build(form, toolkit, event);
87
		section.build(form, toolkit, event);
87
		
88
		
88
//		section = new ActiveHelpSection();
89
		section = new ActiveHelpSection();
89
//		section.build(form, toolkit, event);
90
		section.build(form, toolkit, event);
90
91
91
		parent.pack();
92
		parent.pack();
92
		return composite;
93
		return composite;
93
	}
94
	}
94
95
95
	protected Point getInitialLocation(Point initialSize) {
96
	protected Point getInitialLocation(Point size) {
96
		if (fAnchor == null) {
97
		if (fAnchor == null) {
97
			return super.getInitialLocation(initialSize);
98
			return super.getInitialLocation(size);
98
		}
99
		}
99
		Point point = fAnchor;
100
		Point point = fAnchor;
100
		Rectangle monitor = getShell().getMonitor().getClientArea();
101
		Rectangle monitor = getShell().getMonitor().getClientArea();
101
		if (monitor.width < point.x + initialSize.x) {
102
		if (monitor.width < point.x + size.x) {
102
			point.x = Math.max(0, point.x - initialSize.x);
103
			point.x = Math.max(0, point.x - size.x);
103
		}
104
		}
104
		if (monitor.height < point.y + initialSize.y) {
105
		if (monitor.height < point.y + size.y) {
105
			point.y = Math.max(0, point.y - initialSize.y);
106
			point.y = Math.max(0, point.y - size.y);
106
		}
107
		}
107
		return point;
108
		return point;
108
	}
109
	}
(-)src/org/eclipse/pde/internal/runtime/spy/SpyFormToolkit.java (-3 / +9 lines)
Lines 21-27 Link Here
21
import org.eclipse.swt.graphics.Image;
21
import org.eclipse.swt.graphics.Image;
22
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
23
import org.eclipse.swt.widgets.Display;
23
import org.eclipse.swt.widgets.Display;
24
import org.eclipse.ui.IWorkbenchPart;
24
import org.eclipse.swt.widgets.Widget;
25
import org.eclipse.ui.forms.events.HyperlinkAdapter;
25
import org.eclipse.ui.forms.events.HyperlinkAdapter;
26
import org.eclipse.ui.forms.events.HyperlinkEvent;
26
import org.eclipse.ui.forms.events.HyperlinkEvent;
27
import org.eclipse.ui.forms.widgets.FormText;
27
import org.eclipse.ui.forms.widgets.FormText;
Lines 48-53 Link Here
48
	
48
	
49
	private Map bundleClassByName = new HashMap();
49
	private Map bundleClassByName = new HashMap();
50
	private SpyDialog dialog;
50
	private SpyDialog dialog;
51
	private static String HELP_KEY = "org.eclipse.ui.help"; //$NON-NLS-1$
51
	
52
	
52
	public SpyFormToolkit(SpyDialog dialog) {
53
	public SpyFormToolkit(SpyDialog dialog) {
53
		super(Display.getDefault());
54
		super(Display.getDefault());
Lines 113-121 Link Here
113
		return buffer.toString();
114
		return buffer.toString();
114
	}
115
	}
115
	
116
	
116
	// TODO create this convenience method
117
	public String createHelpIdentifierSection(Widget widget) {
117
	public String createHelpIdentifierSection(FormText text, String title, IWorkbenchPart part) {
118
		StringBuffer buffer = new StringBuffer();
118
		StringBuffer buffer = new StringBuffer();
119
		Object help = widget.getData(HELP_KEY);
120
		if(help != null) {
121
			buffer.append("<li bindent=\"20\" style=\"image\" value=\"contextid\">"); //$NON-NLS-1$
122
			buffer.append(help);
123
			buffer.append("</li>");  //$NON-NLS-1$
124
		}
119
		return buffer.toString();
125
		return buffer.toString();
120
	}
126
	}
121
	
127
	
(-)icons/obj16/contextid_obj.gif (+1 lines)
Added Link Here
1
GIF89a

Return to bug 203451