/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* 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:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.wgadesigner.team;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import de.innovationgate.wgaservices.types.FSDesignResourceState;
public class WGAFSDesignResourceStorage implements IStorage {
private byte[] _content;
private FSDesignResourceState _state;
public WGAFSDesignResourceStorage(FSDesignResourceState state, byte[] content) {
_state = state;
_content = content;
}
public InputStream getContents() throws CoreException {
return new ByteArrayInputStream(_content);
}
public IPath getFullPath() {
return new Path(_state.getPath());
}
public String getName() {
return getFullPath().lastSegment();
}
public boolean isReadOnly() {
return true;
}
public Object getAdapter(Class adapter) {
return null;
}
}