OSDN Git Service

first commit
[japandigitalstudio/build-jds.git] / bundles.plugins.application.src.org.bonitasoft.studio.application.coolbar.WelcomeCoolbarItem.java
1 /**
2  * Copyright (C) 2012 BonitaSoft S.A.
3  * BonitaSoft, 31 rue Gustave Eiffel - 38000 Grenoble
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2.0 of the License, or
7  * (at your option) any later version.
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 package org.bonitasoft.studio.application.coolbar;
16
17 import org.bonitasoft.studio.application.actions.OpenIntroCommandHandler;
18 import org.bonitasoft.studio.application.i18n.Messages;
19 import org.bonitasoft.studio.common.extension.IBonitaContributionItem;
20 import org.bonitasoft.studio.common.log.BonitaStudioLog;
21 import org.bonitasoft.studio.pics.Pics;
22 import org.bonitasoft.studio.pics.PicsConstants;
23 import org.eclipse.core.commands.ExecutionEvent;
24 import org.eclipse.core.commands.ExecutionException;
25 import org.eclipse.jface.action.ContributionItem;
26 import org.eclipse.swt.SWT;
27 import org.eclipse.swt.events.SelectionAdapter;
28 import org.eclipse.swt.events.SelectionEvent;
29 import org.eclipse.swt.widgets.ToolBar;
30 import org.eclipse.swt.widgets.ToolItem;
31
32 /**
33  * @author Romain Bioteau
34  */
35 public class WelcomeCoolbarItem extends ContributionItem implements IBonitaContributionItem {
36 /*
37     private final OpenIntroCommandHandler handler;
38
39     public WelcomeCoolbarItem() {
40         handler = new OpenIntroCommandHandler();
41     }
42 */
43     /*
44      * (non-Javadoc)
45      * @see org.eclipse.jface.action.IContributionItem#getId()
46      */
47 /*    @Override
48     public String getId() {
49         return "org.bonitasoft.studio.coolbar.welcome";
50     }
51
52     @Override
53     public String getText() {
54         return Messages.WelcomeButtonLabel;
55     }
56
57     @Override
58     public void fill(final ToolBar toolbar, final int index, final int iconSize) {
59         final ToolItem item = new ToolItem(toolbar, SWT.PUSH | SWT.RIGHT);
60         item.setToolTipText(Messages.WelcomeButtonLabel);
61         if (iconSize < 0) {
62             item.setImage(Pics.getImage(PicsConstants.coolbar_welcome_32));
63             item.setHotImage(Pics.getImage(PicsConstants.coolbar_welcome_hot_32));
64         } else {
65             item.setImage(Pics.getImage(PicsConstants.coolbar_welcome_24));
66             item.setHotImage(Pics.getImage(PicsConstants.coolbar_welcome_hot_24));
67         }
68         item.addSelectionListener(new SelectionAdapter() {
69
70             @Override
71             public void widgetSelected(final SelectionEvent e) {
72                 try {
73                     handler.execute(new ExecutionEvent());
74                 } catch (final ExecutionException e1) {
75                     BonitaStudioLog.error(e1);
76                 }
77             }
78         });
79
80     }
81 */
82 }