/******************************************************************************* | |
* Copyright 2011 Chair for Applied Software Engineering, | |
* Technische Universitaet Muenchen. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the Eclipse Public License v1.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v10.html | |
* | |
* Contributors: | |
******************************************************************************/ | |
package org.eclipse.emf.emfstore.client.model.importexport.impl; | |
import java.io.File; | |
import java.io.IOException; | |
import org.eclipse.core.runtime.IProgressMonitor; | |
import org.eclipse.emf.emfstore.client.model.Workspace; | |
import org.eclipse.emf.emfstore.client.model.WorkspaceManager; | |
import org.eclipse.emf.emfstore.client.model.importexport.ExportImportDataUnits; | |
import org.eclipse.emf.emfstore.client.model.importexport.IExportImportController; | |
/** | |
* Controller that is capable of import a project space. | |
* | |
* @author emueller | |
* | |
*/ | |
public class ImportProjectSpaceController implements IExportImportController { | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.client.model.controller.importexport.IExportImportController#getLabel() | |
*/ | |
public String getLabel() { | |
return "project space"; | |
} | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.client.model.controller.importexport.IExportImportController#getFilteredNames() | |
*/ | |
public String[] getFilteredNames() { | |
return new String[] { "EMFStore project space (*" + ExportImportDataUnits.ProjectSpace.getExtension() + ")", | |
"All Files (*.*)" }; | |
} | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.client.model.controller.importexport.IExportImportController#getFilteredExtensions() | |
*/ | |
public String[] getFilteredExtensions() { | |
return new String[] { "*" + ExportImportDataUnits.ProjectSpace.getExtension(), "*.*" }; | |
} | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.client.model.controller.importexport.IExportImportController#getParentFolderPropertyKey() | |
*/ | |
public String getParentFolderPropertyKey() { | |
return "org.eclipse.emf.emfstore.client.ui.importProjectSpacePath"; | |
} | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.client.model.controller.importexport.IExportImportController#execute(java.io.File, | |
* org.eclipse.core.runtime.IProgressMonitor) | |
*/ | |
public void execute(File file, IProgressMonitor progressMonitor) throws IOException { | |
Workspace currentWorkspace = WorkspaceManager.getInstance().getCurrentWorkspace(); | |
currentWorkspace.importProjectSpace(file.getAbsolutePath()); | |
} | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.client.model.controller.importexport.IExportImportController#getFilename() | |
*/ | |
public String getFilename() { | |
return null; | |
} | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.client.model.controller.importexport.IExportImportController#isExport() | |
*/ | |
public boolean isExport() { | |
return false; | |
} | |
} |