| /** |
| * |
| */ |
| package org.eclipse.epf.diagramming.base.parts; |
| |
| import org.eclipse.epf.library.edit.process.BreakdownElementWrapperItemProvider; |
| import org.eclipse.epf.library.edit.util.Suppression; |
| import org.eclipse.epf.library.edit.util.TngUtil; |
| import org.eclipse.epf.uma.BreakdownElement; |
| import org.eclipse.epf.uma.MethodElement; |
| import org.eclipse.jface.resource.ImageDescriptor; |
| import org.eclipse.ui.IEditorInput; |
| import org.eclipse.ui.IPersistableElement; |
| |
| /** |
| * DiagramEditor Input for {@link BreakdownElement} |
| * @author Shashidhar Kannoori |
| */ |
| public class DiagramEditorInput implements IEditorInput { |
| |
| private MethodElement methodElement; |
| |
| private ImageDescriptor imageDescriptor = null; |
| |
| private Suppression suppression; |
| |
| private BreakdownElementWrapperItemProvider wrapper; |
| |
| /** |
| * Creates an instance |
| * @param object |
| */ |
| public DiagramEditorInput(Object object, Suppression suppression) { |
| methodElement = (MethodElement) TngUtil.unwrap(object); |
| if (object instanceof BreakdownElementWrapperItemProvider) { |
| wrapper = (BreakdownElementWrapperItemProvider) object; |
| } |
| this.suppression = suppression; |
| } |
| |
| /** |
| * @return Returns the suppression. |
| */ |
| public Suppression getSuppression() { |
| return suppression; |
| } |
| |
| /** |
| * @return Returns the wrapper. |
| */ |
| public BreakdownElementWrapperItemProvider getWrapper() { |
| return wrapper; |
| } |
| |
| /** |
| * @see org.eclipse.epf.authoring.ui.editors.MethodElementEditorInput#equals(java.lang.Object) |
| */ |
| public boolean equals(Object obj) { |
| if (this == obj) |
| return true; |
| if (getClass().isInstance(obj)) { |
| DiagramEditorInput other = (DiagramEditorInput) obj; |
| return getMethodElement() == other.getMethodElement() |
| && suppression.getProcess() == other.getSuppression() |
| .getProcess(); |
| } |
| return false; |
| } |
| |
| public DiagramEditorInput(MethodElement e) { |
| methodElement = e; |
| } |
| |
| public MethodElement getMethodElement() { |
| return methodElement; |
| } |
| |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.IEditorInput#exists() |
| */ |
| public boolean exists() { |
| // TODO Auto-generated method stub |
| return false; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.IEditorInput#getImageDescriptor() |
| */ |
| public ImageDescriptor getImageDescriptor() { |
| return imageDescriptor; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.IEditorInput#getName() |
| */ |
| public String getName() { |
| return methodElement.getName(); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.IEditorInput#getPersistable() |
| */ |
| public IPersistableElement getPersistable() { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.IEditorInput#getToolTipText() |
| */ |
| public String getToolTipText() { |
| return ""; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
| */ |
| public Object getAdapter(Class adapter) { |
| // TODO Auto-generated method stub |
| return null; |
| } |
| } |