static File installAuxdata() throws IOException { File defaultAuxdataInstallDir = new File(SystemUtils.getApplicationDataDir(), "beam-meris-radiometry/smile-correction/auxdata"); String auxdataDirPath = System.getProperty(AUXDATA_DIR_PROPERTY, defaultAuxdataInstallDir.getAbsolutePath()); File auxdataDirectory = new File(auxdataDirPath); URL sourceUrl = ResourceInstaller.getSourceUrl(SmileCorrectionAuxdata.class); final ResourceInstaller resourceInstaller = new ResourceInstaller(sourceUrl, "auxdata/smile", auxdataDirectory); resourceInstaller.install(".*", ProgressMonitor.NULL); return auxdataDirectory; } }
private void installAuxdata(URL sourceLocation, String sourceRelPath, File auxdataInstallDir) throws IOException { new ResourceInstaller(sourceLocation, sourceRelPath, auxdataInstallDir) .install(".*", ProgressMonitor.NULL); }
@Override protected Object doInBackground(ProgressMonitor progressMonitor) throws Exception { resourceInstaller.install(".*.cpd", progressMonitor); defaultColorPalettesInstalled = true; return Boolean.TRUE; }
void installAuxdata() throws IOException { String auxdataDirPath = getAuxdataInstallationPath(); installAuxdata(ResourceInstaller.getSourceUrl(getClass()), "auxdata/", new File(auxdataDirPath)); }
private void installDefaultColorPalettes() { final URL codeSourceUrl = BeamUiActivator.class.getProtectionDomain().getCodeSource().getLocation(); final File auxdataDir = getSystemAuxdataDir(); final ResourceInstaller resourceInstaller = new ResourceInstaller(codeSourceUrl, "auxdata/color_palettes/", auxdataDir); ProgressMonitorSwingWorker swingWorker = new ProgressMonitorSwingWorker(toolView.getPaneControl(),
/** * Installs all resources found, matching the given pattern. Existing resources are left as-is * and are not overwritten. * * @param patternString the pattern * @param pm progress monitor for indicating progress */ public void install(String patternString, ProgressMonitor pm) throws IOException { try { pm.beginTask("Installing resource data: ", 2); scanner.scan(SubProgressMonitor.create(pm, 1)); URL[] resources = scanner.getResourcesByPattern(patternString); copyResources(resources, SubProgressMonitor.create(pm, 1)); } finally { pm.done(); } }
private void installAuxdata(URL sourceLocation, String sourceRelPath, File auxdataInstallDir) throws IOException { new ResourceInstaller(sourceLocation, sourceRelPath, auxdataInstallDir) .install(".*", ProgressMonitor.NULL); }
void installAuxdata() { setAuxdataInstallDir(SMAC_AUXDATA_DIR_PROPERTY, getDefaultAuxdataInstallDir()); try { installAuxdata(ResourceInstaller.getSourceUrl(getClass()), "auxdata/", auxdataInstallDir); } catch (IOException e) { throw new OperatorException("Failed to install auxdata into " + auxdataInstallDir, e); } }
private File installAuxiliaryData() { final File defaultTargetDir = new File(SystemUtils.getApplicationDataDir(), "beam-aatsr-sst/auxdata/aatsr/sst"); final String targetPath = System.getProperty(SST_AUXDATA_DIR_PROPERTY, defaultTargetDir.getAbsolutePath()); final File targetDir = new File(targetPath); final URL url = ResourceInstaller.getSourceUrl(getClass()); final ResourceInstaller installer = new ResourceInstaller(url, "auxdata/aatsr/sst", targetDir); try { installer.install(".*", ProgressMonitor.NULL); } catch (IOException e) { throw new OperatorException(e); } return targetDir; }
private void ensureDefaultDirSet() { if (!defaultEndmemberDir.exists()) { final ResourceInstaller resourceInstaller = new ResourceInstaller(ResourceInstaller.getSourceUrl(SpectralUnmixingDialog.class), "auxdata/", defaultEndmemberDir); try { resourceInstaller.install(".*", com.bc.ceres.core.ProgressMonitor.NULL); } catch (IOException e) { // failed, so what } } final String key = DiagramGraphIO.DIAGRAM_GRAPH_IO_LAST_DIR_KEY; final PropertyMap preferences = appContext.getPreferences(); if (preferences.getPropertyString(key, null) == null) { preferences.setPropertyString(key, defaultEndmemberDir.getPath()); } }