blob: dc226586c7580fc9b8a2324ac4ebbea7add3573b [file] [log] [blame]
/*******************************************************************************
* 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.framework.db.connection.exception.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.access.AccessControlManager;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.IATSArtifact;
import org.eclipse.osee.framework.ui.skynet.ImageManager;
import org.eclipse.osee.framework.ui.skynet.ats.AtsOpenOption;
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 Ryan D. Brooks
*/
public class AtsWorkflowRenderer extends DefaultArtifactRenderer {
private static final String COMMAND_ID = "org.eclipse.osee.framework.ui.skynet.atseditor.command";
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer#getCommandId()
*/
@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;
}
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.DefaultArtifactRenderer#getImage()
*/
@Override
public Image getImage(Artifact artifact) throws OseeCoreException {
return ImageManager.getImage(AtsImage.ACTION);
}
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.Renderer#getName()
*/
@Override
public String getName() {
return "ATS Workflow Editor";
}
/**
* @param rendererId
*/
public AtsWorkflowRenderer() {
super();
}
@Override
public void open(List<Artifact> artifacts) throws OseeCoreException {
for (Artifact artifact : artifacts) {
OseeAts.getAtsLib().openATSAction(artifact, AtsOpenOption.OpenOneOrPopupSelect);
}
}
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.IRenderer#newInstance()
*/
@Override
public AtsWorkflowRenderer newInstance() throws OseeCoreException {
return new AtsWorkflowRenderer();
}
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.IRenderer#isValidFor(org.eclipse.osee.framework.skynet.core.artifact.Artifact)
*/
@Override
public int getApplicabilityRating(PresentationType presentationType, Artifact artifact) {
if (artifact instanceof IATSArtifact && (!artifact.isHistorical())) {
return PRESENTATION_SUBTYPE_MATCH;
}
return NO_MATCH;
}
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.IRenderer#preview(java.util.List)
*/
@Override
public void preview(List<Artifact> artifacts) throws OseeCoreException {
open(artifacts);
}
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.render.IRenderer#minimumRanking()
*/
@Override
public int minimumRanking() throws OseeCoreException {
if (AccessControlManager.isOseeAdmin()) {
return NO_MATCH;
} else {
return PRESENTATION_TYPE;
}
}
}