|
Lines 17-30
import org.eclipse.core.runtime.IStatus;
Link Here
|
| 17 |
import org.eclipse.core.runtime.Platform; |
17 |
import org.eclipse.core.runtime.Platform; |
| 18 |
import org.eclipse.core.runtime.Status; |
18 |
import org.eclipse.core.runtime.Status; |
| 19 |
import org.eclipse.core.runtime.jobs.Job; |
19 |
import org.eclipse.core.runtime.jobs.Job; |
|
|
20 |
import org.eclipse.jface.action.MenuManager; |
| 20 |
import org.eclipse.jface.viewers.ISelection; |
21 |
import org.eclipse.jface.viewers.ISelection; |
| 21 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
22 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
| 22 |
import org.eclipse.jface.viewers.ISelectionProvider; |
23 |
import org.eclipse.jface.viewers.ISelectionProvider; |
| 23 |
import org.eclipse.jface.viewers.IStructuredSelection; |
24 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
|
25 |
import org.eclipse.jubula.client.ui.constants.Constants; |
| 24 |
import org.eclipse.jubula.client.ui.i18n.Messages; |
26 |
import org.eclipse.jubula.client.ui.i18n.Messages; |
| 25 |
import org.eclipse.jubula.client.ui.utils.JobUtils; |
27 |
import org.eclipse.jubula.client.ui.utils.JobUtils; |
| 26 |
import org.eclipse.jubula.client.ui.views.IJBPart; |
28 |
import org.eclipse.jubula.client.ui.views.IJBPart; |
| 27 |
import org.eclipse.jubula.client.ui.views.NonSortedPropertySheetPage; |
29 |
import org.eclipse.jubula.client.ui.views.NonSortedPropertySheetPage; |
|
|
30 |
import org.eclipse.jubula.tools.constants.StringConstants; |
| 28 |
import org.eclipse.swt.SWT; |
31 |
import org.eclipse.swt.SWT; |
| 29 |
import org.eclipse.swt.custom.ScrolledComposite; |
32 |
import org.eclipse.swt.custom.ScrolledComposite; |
| 30 |
import org.eclipse.swt.dnd.DND; |
33 |
import org.eclipse.swt.dnd.DND; |
|
Lines 34-39
import org.eclipse.swt.dnd.DragSourceListener;
Link Here
|
| 34 |
import org.eclipse.swt.dnd.ImageTransfer; |
37 |
import org.eclipse.swt.dnd.ImageTransfer; |
| 35 |
import org.eclipse.swt.dnd.Transfer; |
38 |
import org.eclipse.swt.dnd.Transfer; |
| 36 |
import org.eclipse.swt.graphics.Image; |
39 |
import org.eclipse.swt.graphics.Image; |
|
|
40 |
import org.eclipse.swt.graphics.ImageData; |
| 37 |
import org.eclipse.swt.layout.FillLayout; |
41 |
import org.eclipse.swt.layout.FillLayout; |
| 38 |
import org.eclipse.swt.widgets.Composite; |
42 |
import org.eclipse.swt.widgets.Composite; |
| 39 |
import org.eclipse.swt.widgets.Label; |
43 |
import org.eclipse.swt.widgets.Label; |
|
Lines 41-49
import org.eclipse.swt.widgets.Menu;
Link Here
|
| 41 |
import org.eclipse.ui.ISelectionListener; |
45 |
import org.eclipse.ui.ISelectionListener; |
| 42 |
import org.eclipse.ui.ISelectionService; |
46 |
import org.eclipse.ui.ISelectionService; |
| 43 |
import org.eclipse.ui.IWorkbenchPart; |
47 |
import org.eclipse.ui.IWorkbenchPart; |
|
|
48 |
import org.eclipse.ui.contexts.IContextActivation; |
| 49 |
import org.eclipse.ui.contexts.IContextService; |
| 44 |
import org.eclipse.ui.part.ViewPart; |
50 |
import org.eclipse.ui.part.ViewPart; |
| 45 |
import org.eclipse.ui.views.properties.IPropertySheetPage; |
51 |
import org.eclipse.ui.views.properties.IPropertySheetPage; |
| 46 |
import org.eclipse.jface.action.MenuManager; |
|
|
| 47 |
|
52 |
|
| 48 |
|
53 |
|
| 49 |
/** |
54 |
/** |
|
Lines 62-67
public class ImageView extends ViewPart implements IJBPart, ISelectionProvider {
Link Here
|
| 62 |
private Image m_img; |
67 |
private Image m_img; |
| 63 |
|
68 |
|
| 64 |
/** |
69 |
/** |
|
|
70 |
* the name of the image |
| 71 |
*/ |
| 72 |
private String[] m_imgName = |
| 73 |
new String[] {StringConstants.EMPTY, StringConstants.EMPTY}; |
| 74 |
|
| 75 |
/** |
| 65 |
* <code>m_oldSelection</code> |
76 |
* <code>m_oldSelection</code> |
| 66 |
*/ |
77 |
*/ |
| 67 |
private ISelection m_currSelection = null; |
78 |
private ISelection m_currSelection = null; |
|
Lines 77-82
public class ImageView extends ViewPart implements IJBPart, ISelectionProvider {
Link Here
|
| 77 |
private Composite m_child; |
88 |
private Composite m_child; |
| 78 |
|
89 |
|
| 79 |
/** |
90 |
/** |
|
|
91 |
* context activation |
| 92 |
*/ |
| 93 |
private IContextActivation m_contextActivation; |
| 94 |
|
| 95 |
/** |
| 80 |
* The selectionListener listens for changes in the workbench's selection |
96 |
* The selectionListener listens for changes in the workbench's selection |
| 81 |
* service. |
97 |
* service. |
| 82 |
*/ |
98 |
*/ |
|
Lines 212-225
public class ImageView extends ViewPart implements IJBPart, ISelectionProvider {
Link Here
|
| 212 |
protected void setImage(final ImageProvider provider) { |
228 |
protected void setImage(final ImageProvider provider) { |
| 213 |
m_scrollComposite.getDisplay().syncExec(new Runnable() { |
229 |
m_scrollComposite.getDisplay().syncExec(new Runnable() { |
| 214 |
|
230 |
|
|
|
231 |
|
| 215 |
public void run() { |
232 |
public void run() { |
| 216 |
clearImage(); |
233 |
clearImage(); |
| 217 |
m_img = provider.getImage(m_scrollComposite.getDisplay()); |
234 |
m_img = provider.getImage(m_scrollComposite.getDisplay()); |
|
|
235 |
m_imgName = provider.getImageName(); |
| 218 |
m_imgWidget.setImage(m_img); |
236 |
m_imgWidget.setImage(m_img); |
| 219 |
if (m_img != null) { |
237 |
if (m_img != null) { |
| 220 |
m_imgWidget.setSize( |
238 |
m_imgWidget.setSize( |
| 221 |
m_img.getBounds().width, |
239 |
m_img.getBounds().width, |
| 222 |
m_img.getBounds().height); |
240 |
m_img.getBounds().height); |
|
|
241 |
IContextService cs = (IContextService) getSite(). |
| 242 |
getWorkbenchWindow(). |
| 243 |
getService(IContextService.class); |
| 244 |
m_contextActivation = cs.activateContext( |
| 245 |
Constants.IMAGEVIEW_DISPLAYS_IMAGE); |
| 223 |
} |
246 |
} |
| 224 |
m_scrollComposite.setMinSize(m_child.computeSize(SWT.DEFAULT, |
247 |
m_scrollComposite.setMinSize(m_child.computeSize(SWT.DEFAULT, |
| 225 |
SWT.DEFAULT)); |
248 |
SWT.DEFAULT)); |
|
Lines 236-241
public class ImageView extends ViewPart implements IJBPart, ISelectionProvider {
Link Here
|
| 236 |
if (oldImage != null) { |
259 |
if (oldImage != null) { |
| 237 |
oldImage.dispose(); |
260 |
oldImage.dispose(); |
| 238 |
} |
261 |
} |
|
|
262 |
|
| 263 |
IContextService cs = (IContextService) getSite(). |
| 264 |
getService(IContextService.class); |
| 265 |
cs.deactivateContext(m_contextActivation); |
| 239 |
} |
266 |
} |
| 240 |
|
267 |
|
| 241 |
/** |
268 |
/** |
|
Lines 300-303
public class ImageView extends ViewPart implements IJBPart, ISelectionProvider {
Link Here
|
| 300 |
} |
327 |
} |
| 301 |
return super.getAdapter(key); |
328 |
return super.getAdapter(key); |
| 302 |
} |
329 |
} |
|
|
330 |
|
| 331 |
/** |
| 332 |
* returns the data of the displayed image |
| 333 |
* @return the image data |
| 334 |
*/ |
| 335 |
public ImageData getImage() { |
| 336 |
return m_img.getImageData(); |
| 337 |
} |
| 338 |
|
| 339 |
/** |
| 340 |
* sets the name for the image |
| 341 |
* @param imgName the name |
| 342 |
*/ |
| 343 |
public void setImageName(String[] imgName) { |
| 344 |
m_imgName = imgName; |
| 345 |
} |
| 346 |
|
| 347 |
/** |
| 348 |
* returns the name of the image |
| 349 |
* @return the name |
| 350 |
*/ |
| 351 |
public String[] getImageName() { |
| 352 |
return m_imgName; |
| 353 |
} |
| 303 |
} |
354 |
} |