Lines 8-13
Link Here
|
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 |
* Willian Mitsuda <wmitsuda@gmail.com> - bug 209841 |
10 |
* Willian Mitsuda <wmitsuda@gmail.com> - bug 209841 |
|
|
11 |
* Benjamin CabĀ <benjamin.cabe@anyware-tech.com> - bug 209487 |
11 |
*******************************************************************************/ |
12 |
*******************************************************************************/ |
12 |
package org.eclipse.pde.internal.runtime.spy; |
13 |
package org.eclipse.pde.internal.runtime.spy; |
13 |
|
14 |
|
Lines 24-31
Link Here
|
24 |
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages; |
25 |
import org.eclipse.pde.internal.runtime.PDERuntimePluginImages; |
25 |
import org.eclipse.pde.internal.runtime.spy.dialogs.SpyDialog; |
26 |
import org.eclipse.pde.internal.runtime.spy.dialogs.SpyDialog; |
26 |
import org.eclipse.swt.SWT; |
27 |
import org.eclipse.swt.SWT; |
|
|
28 |
import org.eclipse.swt.dnd.Clipboard; |
29 |
import org.eclipse.swt.dnd.TextTransfer; |
30 |
import org.eclipse.swt.dnd.Transfer; |
27 |
import org.eclipse.swt.events.DisposeEvent; |
31 |
import org.eclipse.swt.events.DisposeEvent; |
28 |
import org.eclipse.swt.events.DisposeListener; |
32 |
import org.eclipse.swt.events.DisposeListener; |
|
|
33 |
import org.eclipse.swt.events.MenuEvent; |
34 |
import org.eclipse.swt.events.MenuListener; |
35 |
import org.eclipse.swt.events.SelectionAdapter; |
36 |
import org.eclipse.swt.events.SelectionEvent; |
37 |
import org.eclipse.swt.events.SelectionListener; |
29 |
import org.eclipse.swt.graphics.Cursor; |
38 |
import org.eclipse.swt.graphics.Cursor; |
30 |
import org.eclipse.swt.graphics.Image; |
39 |
import org.eclipse.swt.graphics.Image; |
31 |
import org.eclipse.swt.graphics.ImageData; |
40 |
import org.eclipse.swt.graphics.ImageData; |
Lines 33-38
Link Here
|
33 |
import org.eclipse.swt.widgets.Composite; |
42 |
import org.eclipse.swt.widgets.Composite; |
34 |
import org.eclipse.swt.widgets.Display; |
43 |
import org.eclipse.swt.widgets.Display; |
35 |
import org.eclipse.swt.widgets.FileDialog; |
44 |
import org.eclipse.swt.widgets.FileDialog; |
|
|
45 |
import org.eclipse.swt.widgets.Menu; |
46 |
import org.eclipse.swt.widgets.MenuItem; |
36 |
import org.eclipse.swt.widgets.ToolBar; |
47 |
import org.eclipse.swt.widgets.ToolBar; |
37 |
import org.eclipse.swt.widgets.Widget; |
48 |
import org.eclipse.swt.widgets.Widget; |
38 |
import org.eclipse.ui.forms.events.HyperlinkAdapter; |
49 |
import org.eclipse.ui.forms.events.HyperlinkAdapter; |
Lines 123-133
Link Here
|
123 |
|
134 |
|
124 |
public FormText createFormText(Composite parent, boolean trackFocus) { |
135 |
public FormText createFormText(Composite parent, boolean trackFocus) { |
125 |
FormText text = super.createFormText(parent, trackFocus); |
136 |
FormText text = super.createFormText(parent, trackFocus); |
|
|
137 |
|
126 |
if (PDERuntimePlugin.HAS_IDE_BUNDLES) { |
138 |
if (PDERuntimePlugin.HAS_IDE_BUNDLES) { |
127 |
text.addHyperlinkListener(new SpyHyperlinkAdapter(dialog)); |
139 |
text.addHyperlinkListener(new SpyHyperlinkAdapter(dialog)); |
|
|
140 |
addCopyQNameMenuItem(text); |
128 |
} |
141 |
} |
129 |
return text; |
142 |
return text; |
130 |
} |
143 |
} |
|
|
144 |
|
145 |
private void addCopyQNameMenuItem(final FormText formText) { |
146 |
Menu menu = formText.getMenu(); |
147 |
final MenuItem copyQNameItem = new MenuItem(menu, SWT.PUSH); |
148 |
copyQNameItem |
149 |
.setText(PDERuntimeMessages.SpyFormToolkit_copyQualifiedName); |
150 |
|
151 |
SelectionListener listener = new SelectionAdapter() { |
152 |
public void widgetSelected(SelectionEvent e) { |
153 |
if (e.widget == copyQNameItem) { |
154 |
Clipboard clipboard = new Clipboard(formText.getDisplay()); |
155 |
clipboard.setContents( |
156 |
new Object[] { ((String) formText |
157 |
.getSelectedLinkHref()) |
158 |
.substring(CLASS_PROTOCOL_PREFIX.length()) }, |
159 |
new Transfer[] { TextTransfer.getInstance() }); |
160 |
} |
161 |
} |
162 |
}; |
163 |
copyQNameItem.addSelectionListener(listener); |
164 |
|
165 |
menu.addMenuListener(new MenuListener() { |
166 |
public void menuShown(MenuEvent e) { |
167 |
String href = (String) formText.getSelectedLinkHref(); |
168 |
copyQNameItem.setEnabled(href != null |
169 |
&& href.startsWith(CLASS_PROTOCOL_PREFIX)); |
170 |
} |
171 |
|
172 |
public void menuHidden(MenuEvent e) { |
173 |
} |
174 |
}); |
175 |
} |
131 |
|
176 |
|
132 |
public String createInterfaceSection(FormText text, String title, Class[] clazzes) { |
177 |
public String createInterfaceSection(FormText text, String title, Class[] clazzes) { |
133 |
StringBuffer buffer = new StringBuffer(); |
178 |
StringBuffer buffer = new StringBuffer(); |