Lines 42-47
Link Here
|
42 |
package org.netbeans.api.project; |
42 |
package org.netbeans.api.project; |
43 |
|
43 |
|
44 |
import java.beans.PropertyChangeListener; |
44 |
import java.beans.PropertyChangeListener; |
|
|
45 |
import java.io.IOException; |
45 |
import java.util.Collections; |
46 |
import java.util.Collections; |
46 |
import java.util.HashMap; |
47 |
import java.util.HashMap; |
47 |
import java.util.HashSet; |
48 |
import java.util.HashSet; |
Lines 49-67
Link Here
|
49 |
import java.util.Set; |
50 |
import java.util.Set; |
50 |
import java.util.prefs.Preferences; |
51 |
import java.util.prefs.Preferences; |
51 |
import javax.swing.Icon; |
52 |
import javax.swing.Icon; |
52 |
import javax.swing.ImageIcon; |
|
|
53 |
import org.netbeans.modules.projectapi.AuxiliaryConfigBasedPreferencesProvider; |
53 |
import org.netbeans.modules.projectapi.AuxiliaryConfigBasedPreferencesProvider; |
54 |
import org.netbeans.modules.projectapi.AuxiliaryConfigImpl; |
54 |
import org.netbeans.modules.projectapi.AuxiliaryConfigImpl; |
55 |
import org.netbeans.spi.project.AuxiliaryConfiguration; |
55 |
import org.netbeans.spi.project.AuxiliaryConfiguration; |
56 |
import org.netbeans.spi.project.AuxiliaryProperties; |
56 |
import org.netbeans.spi.project.AuxiliaryProperties; |
|
|
57 |
import org.netbeans.spi.project.CacheDirectoryProvider; |
57 |
import org.netbeans.spi.project.SubprojectProvider; |
58 |
import org.netbeans.spi.project.SubprojectProvider; |
58 |
import org.netbeans.spi.project.support.GenericSources; |
59 |
import org.netbeans.spi.project.support.GenericSources; |
59 |
import org.openide.filesystems.FileObject; |
60 |
import org.openide.filesystems.FileObject; |
60 |
import org.openide.filesystems.FileStateInvalidException; |
61 |
import org.openide.filesystems.FileStateInvalidException; |
|
|
62 |
import org.openide.filesystems.FileUtil; |
61 |
import org.openide.util.ImageUtilities; |
63 |
import org.openide.util.ImageUtilities; |
62 |
import org.openide.util.Mutex; |
64 |
import org.openide.util.Mutex; |
63 |
import org.openide.util.Parameters; |
65 |
import org.openide.util.Parameters; |
64 |
import org.openide.util.Utilities; |
|
|
65 |
|
66 |
|
66 |
/** |
67 |
/** |
67 |
* Utility methods to get information about {@link Project}s. |
68 |
* Utility methods to get information about {@link Project}s. |
Lines 263-266
Link Here
|
263 |
return new AuxiliaryConfigImpl(project); |
264 |
return new AuxiliaryConfigImpl(project); |
264 |
} |
265 |
} |
265 |
|
266 |
|
|
|
267 |
/** |
268 |
* Gets a directory in which modules may store arbitrary extra unversioned files |
269 |
* associated with a project. |
270 |
* These could be caches of information found in sources, logs or snapshots |
271 |
* from activities associated with developing the project, etc. |
272 |
* <p> |
273 |
* If the project supplies a {@link CacheDirectoryProvider}, that will be used |
274 |
* for the parent directory. Otherwise an unspecified storage area will be used. |
275 |
* @param project a project |
276 |
* @param owner a class from the calling module (each module or package will get its own space) |
277 |
* @return a directory available for storing miscellaneous files |
278 |
* @throws IOException if no such directory could be created |
279 |
* @since org.netbeans.modules.projectapi/1 1.26 |
280 |
*/ |
281 |
public static FileObject getCacheDirectory(Project project, Class<?> owner) throws IOException { |
282 |
FileObject d; |
283 |
CacheDirectoryProvider cdp = project.getLookup().lookup(CacheDirectoryProvider.class); |
284 |
if (cdp != null) { |
285 |
d = cdp.getCacheDirectory(); |
286 |
} else { |
287 |
d = FileUtil.createFolder(FileUtil.getConfigRoot(), |
288 |
String.format("Projects/extra/%s-%08x", getInformation(project).getName(), // NOI18N |
289 |
project.getProjectDirectory().getPath().hashCode())); |
290 |
} |
291 |
return FileUtil.createFolder(d, AuxiliaryConfigBasedPreferencesProvider.findCNBForClass(owner)); |
292 |
} |
293 |
|
266 |
} |
294 |
} |