blob: c22cf6b07c53e00752b2cafbf73a186021f463d1 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2013, 2017 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* CEA LIST - Initial API and implementation
*****************************************************************************/
package org.eclipse.papyrus.cdo.internal.ui.adapters;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
import org.eclipse.papyrus.cdo.internal.ui.editors.DawnEditorAdapter;
import org.eclipse.ui.IEditorPart;
/**
* This is the EditorAdapterFactory type. Enjoy.
*/
@SuppressWarnings("rawtypes")
public class EditorAdapterFactory
implements IAdapterFactory {
private final Class[] supported = { IDawnEditor.class };
public EditorAdapterFactory() {
super();
}
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
Object result = null;
if (adapterType == IDawnEditor.class) {
if (adaptableObject instanceof IEditorPart) {
IEditorPart editor = (IEditorPart) adaptableObject;
result = DawnEditorAdapter.getDawnEditor(editor);
}
}
return result;
}
@Override
public Class[] getAdapterList() {
return supported;
}
}