blob: 589883e9a691da8b4975aa1c8cd3419e32baac5a [file] [log] [blame]
/*******************************************************************************
* <copyright>
*
* Copyright (c) 2013, 2013 SAP AG.
* 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:
* SAP AG - initial API, implementation and documentation
*
* </copyright>
*
*******************************************************************************/
package org.eclipse.fmc.blockdiagram.editor.application;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
* The Naviagtor Root element for supporting drag and drop of ecore objects into
* Graphiti diagrams.
*
* @author Benjamin Schmeling
*
*/
public class NavigatorRoot implements IAdaptable, IPersistableElement,
IElementFactory {
public NavigatorRoot() {
}
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IPersistableElement.class)
return this;
if (adapter == IWorkbenchAdapter.class)
return ResourcesPlugin.getWorkspace().getRoot().getAdapter(adapter);
return null;
}
public String getFactoryId() {
return this.getClass().getCanonicalName();
}
public void saveState(IMemento memento) {
}
public IAdaptable createElement(IMemento memento) {
return ResourcesPlugin.getWorkspace().getRoot();
}
}