/******************************************************************************* | |
* 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; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.eclipse.osee.ats.AtsImage; | |
import org.eclipse.osee.ats.artifact.TaskArtifact; | |
import org.eclipse.osee.framework.db.connection.exception.OseeCoreException; | |
import org.eclipse.osee.framework.skynet.core.artifact.Artifact; | |
import org.eclipse.osee.framework.ui.skynet.ImageManager; | |
import org.eclipse.osee.framework.ui.skynet.ats.OseeAts; | |
import org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer; | |
import org.eclipse.osee.framework.ui.skynet.render.PresentationType; | |
import org.eclipse.swt.graphics.Image; | |
/** | |
* @author Jeff C. Phillips | |
*/ | |
public class AtsTaskEditorRenderer extends DefaultArtifactRenderer { | |
private static final String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.atstaskeditor.command"; | |
/* (non-Javadoc) | |
* @see org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer#open(java.util.List) | |
*/ | |
@Override | |
public void open(List<Artifact> artifacts) throws OseeCoreException { | |
if (OseeAts.getAtsLib() != null) { | |
OseeAts.getAtsLib().openInAtsTaskEditor("Tasks", artifacts); | |
} | |
} | |
/* (non-Javadoc) | |
* @see org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer#preview(java.util.List) | |
*/ | |
@Override | |
public void preview(List<Artifact> artifacts) throws OseeCoreException { | |
open(artifacts); | |
} | |
@Override | |
public Image getImage(Artifact artifact) throws OseeCoreException { | |
return ImageManager.getImage(AtsImage.TASK); | |
} | |
/* (non-Javadoc) | |
* @see org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer#getName() | |
*/ | |
@Override | |
public String getName() { | |
return "ATS Task Editor"; | |
} | |
/* (non-Javadoc) | |
* @see org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer#getApplicabilityRating(org.eclipse.osee.framework.ui.skynet.render.PresentationType, org.eclipse.osee.framework.skynet.core.artifact.Artifact) | |
*/ | |
@Override | |
public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) throws OseeCoreException { | |
if (artifact instanceof TaskArtifact && (!artifact.isHistorical())) { | |
return PRESENTATION_SUBTYPE_MATCH; | |
} | |
return NO_MATCH; | |
} | |
@Override | |
public List<String> getCommandId(PresentationType presentationType) { | |
ArrayList<String> commandIds = new ArrayList<String>(1); | |
if (presentationType == PresentationType.SPECIALIZED_EDIT) { | |
commandIds.add(COMMAND_ID); | |
} | |
return commandIds; | |
} | |
@Override | |
public AtsTaskEditorRenderer newInstance() throws OseeCoreException { | |
return new AtsTaskEditorRenderer(); | |
} | |
} |