| /******************************************************************************* |
| * Copyright (c) 2004, 2007 Boeing. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Boeing - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.osee.ats.editor.service; |
| |
| import org.eclipse.jface.action.Action; |
| import org.eclipse.jface.wizard.WizardDialog; |
| import org.eclipse.osee.ats.AtsPlugin; |
| import org.eclipse.osee.ats.editor.SMAManager; |
| import org.eclipse.osee.ats.util.ArtifactEmailWizard; |
| import org.eclipse.osee.framework.db.connection.exception.OseeCoreException; |
| import org.eclipse.osee.framework.logging.OseeLevel; |
| import org.eclipse.osee.framework.logging.OseeLog; |
| import org.eclipse.osee.framework.ui.skynet.FrameworkImage; |
| import org.eclipse.osee.framework.ui.skynet.ImageManager; |
| import org.eclipse.swt.widgets.Display; |
| |
| /** |
| * @author Donald G. Dunne |
| */ |
| public class EmailActionService extends WorkPageService { |
| |
| public EmailActionService(SMAManager smaMgr) { |
| super(smaMgr); |
| } |
| |
| private void performEmail() throws OseeCoreException { |
| ArtifactEmailWizard ew = new ArtifactEmailWizard(smaMgr.getSma()); |
| WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), ew); |
| dialog.create(); |
| dialog.open(); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.osee.ats.editor.service.WorkPageService#createToolbarService() |
| */ |
| @Override |
| public Action createToolbarService() { |
| Action action = new Action(getName(), Action.AS_PUSH_BUTTON) { |
| public void run() { |
| try { |
| performEmail(); |
| } catch (Exception ex) { |
| OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex); |
| } |
| } |
| }; |
| action.setToolTipText(getName()); |
| action.setImageDescriptor(ImageManager.getImageDescriptor(FrameworkImage.EMAIL)); |
| return action; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.osee.ats.editor.service.WorkPageService#getName() |
| */ |
| @Override |
| public String getName() { |
| return "Email " + smaMgr.getSma().getArtifactSuperTypeName(); |
| } |
| } |