1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.eclipse.adt.internal.wizards.newproject; 18 19 import org.eclipse.core.filesystem.IFileInfo; 20 import org.eclipse.core.filesystem.IFileStore; 21 import org.eclipse.core.filesystem.IFileSystem; 22 import org.eclipse.core.runtime.CoreException; 23 import org.eclipse.core.runtime.IPath; 24 import org.eclipse.core.runtime.IProgressMonitor; 25 26 import java.io.File; 27 import java.io.InputStream; 28 import java.io.OutputStream; 29 import java.net.URI; 30 31 /** 32 * IFileStore implementation that delegates to the give {@link IFileStore}. 33 * This makes it easier to just override a single method from a store. 34 */ 35 class FileStoreAdapter implements IFileStore { 36 37 private final IFileStore mStore; 38 FileStoreAdapter(IFileStore store)39 public FileStoreAdapter(IFileStore store) { 40 mStore = store; 41 } 42 43 @SuppressWarnings("rawtypes") 44 @Override getAdapter(Class adapter)45 public Object getAdapter(Class adapter) { 46 return mStore.getAdapter(adapter); 47 } 48 49 @Override childInfos(int options, IProgressMonitor monitor)50 public IFileInfo[] childInfos(int options, IProgressMonitor monitor) throws CoreException { 51 return mStore.childInfos(options, monitor); 52 } 53 54 @Override childNames(int options, IProgressMonitor monitor)55 public String[] childNames(int options, IProgressMonitor monitor) 56 throws CoreException { 57 return mStore.childNames(options, monitor); 58 } 59 60 @Override childStores(int options, IProgressMonitor monitor)61 public IFileStore[] childStores(int options, IProgressMonitor monitor) throws CoreException { 62 return mStore.childStores(options, monitor); 63 } 64 65 @Override copy(IFileStore destination, int options, IProgressMonitor monitor)66 public void copy(IFileStore destination, int options, IProgressMonitor monitor) 67 throws CoreException { 68 mStore.copy(destination, options, monitor); 69 } 70 71 @Override delete(int options, IProgressMonitor monitor)72 public void delete(int options, IProgressMonitor monitor) throws CoreException { 73 mStore.delete(options, monitor); 74 } 75 76 @Override fetchInfo()77 public IFileInfo fetchInfo() { 78 return mStore.fetchInfo(); 79 } 80 81 @Override fetchInfo(int options, IProgressMonitor monitor)82 public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException { 83 return mStore.fetchInfo(options, monitor); 84 } 85 86 @Deprecated 87 @Override getChild(IPath path)88 public IFileStore getChild(IPath path) { 89 return mStore.getChild(path); 90 } 91 92 @Override getFileStore(IPath path)93 public IFileStore getFileStore(IPath path) { 94 return mStore.getFileStore(path); 95 } 96 97 @Override getChild(String name)98 public IFileStore getChild(String name) { 99 return mStore.getChild(name); 100 } 101 102 @Override getFileSystem()103 public IFileSystem getFileSystem() { 104 return mStore.getFileSystem(); 105 } 106 107 @Override getName()108 public String getName() { 109 return mStore.getName(); 110 } 111 112 @Override getParent()113 public IFileStore getParent() { 114 return mStore.getParent(); 115 } 116 117 @Override isParentOf(IFileStore other)118 public boolean isParentOf(IFileStore other) { 119 return mStore.isParentOf(other); 120 } 121 122 @Override mkdir(int options, IProgressMonitor monitor)123 public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException { 124 return mStore.mkdir(options, monitor); 125 } 126 127 @Override move(IFileStore destination, int options, IProgressMonitor monitor)128 public void move(IFileStore destination, int options, IProgressMonitor monitor) 129 throws CoreException { 130 mStore.move(destination, options, monitor); 131 } 132 133 @Override openInputStream(int options, IProgressMonitor monitor)134 public InputStream openInputStream(int options, IProgressMonitor monitor) 135 throws CoreException { 136 return mStore.openInputStream(options, monitor); 137 } 138 139 @Override openOutputStream(int options, IProgressMonitor monitor)140 public OutputStream openOutputStream(int options, IProgressMonitor monitor) 141 throws CoreException { 142 return mStore.openOutputStream(options, monitor); 143 } 144 145 @Override putInfo(IFileInfo info, int options, IProgressMonitor monitor)146 public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) 147 throws CoreException { 148 mStore.putInfo(info, options, monitor); 149 } 150 151 @Override toLocalFile(int options, IProgressMonitor monitor)152 public File toLocalFile(int options, IProgressMonitor monitor) throws CoreException { 153 return mStore.toLocalFile(options, monitor); 154 } 155 156 @Override toURI()157 public URI toURI() { 158 return mStore.toURI(); 159 } 160 } 161