3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.editor
.images
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.core
.commands
.operations
.IUndoableOperation
;
15 import org
.eclipse
.swt
.SWT
;
16 import org
.eclipse
.swt
.events
.MouseAdapter
;
17 import org
.eclipse
.swt
.events
.MouseEvent
;
18 import org
.eclipse
.swt
.graphics
.Color
;
19 import org
.eclipse
.swt
.graphics
.Font
;
20 import org
.eclipse
.ui
.forms
.ManagedForm
;
21 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
24 import eu
.etaxonomy
.taxeditor
.controller
.EditorController
;
25 import eu
.etaxonomy
.taxeditor
.controller
.GlobalController
;
26 import eu
.etaxonomy
.taxeditor
.editor
.GroupComposite
;
27 import eu
.etaxonomy
.taxeditor
.editor
.GroupedComposite
;
28 import eu
.etaxonomy
.taxeditor
.editor
.name
.NameComposite
;
29 import eu
.etaxonomy
.taxeditor
.editor
.name
.NameViewer
;
30 import eu
.etaxonomy
.taxeditor
.operations
.images
.AddImageOperation
;
37 public class TaxonHasNoImagesComposite
extends GroupedComposite
{
38 private static final Logger logger
= Logger
39 .getLogger(TaxonHasNoImagesComposite
.class);
42 * @param groupComposite
46 public TaxonHasNoImagesComposite(GroupComposite parent
,
47 ManagedForm form
, Taxon taxon
) {
51 setIsDraggable(false);
52 // setIcon(ACCEPTED_ICON);
53 setFont(getViewerFont());
54 // setIndent(ACCEPTED_INDENT);
59 protected void createControl() {
60 super.createControl();
62 Color groupBackgroundColor
= getDisplay().getSystemColor(SWT
.COLOR_WHITE
);
63 setBackground(groupBackgroundColor
);
66 protected void initEmptyText() {
67 super.initEmptyText();
69 getTextViewer().getTextWidget().setEditable(false);
70 getTextViewer().getTextWidget().addMouseListener(new MouseAdapter() {
71 public void mouseUp(MouseEvent e
) {
76 if (getTextViewer() instanceof NameViewer
) {
77 Color groupBackgroundColor
= getDisplay().getSystemColor(SWT
.COLOR_WHITE
);
78 ((NameViewer
) getTextViewer()).setBackground(groupBackgroundColor
);
82 protected String
getEmptyTextPrompt() {
83 return "Click to add an image";
89 private void createNewImage() {
90 // GlobalController.getUrlFromDialog();
91 IUndoableOperation operation
= new AddImageOperation
92 ("Create new image", EditorController
.getUndoContext(taxon
), taxon
);
93 GlobalController
.executeOperation(operation
);
98 * @see eu.etaxonomy.taxeditor.editor.GroupedComposite#getViewerFont()
101 protected Font
getViewerFont() {
102 return NameComposite
.ACCEPTED_FONT
;
106 * @see eu.etaxonomy.taxeditor.editor.IHasPropertySource#getPropertySource()
108 public IPropertySource
getPropertySource() {