private static EditableProperties getEditableProperties(final File bundle) throws IOException { EditableProperties p = new EditableProperties(true); InputStream is = new FileInputStream(bundle); try { p.load(is); } finally { is.close(); } return p; }
/** * Convenience method for loading {@link EditableProperties} from a {@link * FileObject}. New items will alphabetizied by key. * * @param propsFO file representing properties file * @exception FileNotFoundException if the file represented by the given * FileObject does not exists, is a folder rather than a regular * file or is invalid. i.e. as it is thrown by {@link * FileObject#getInputStream()}. */ public static EditableProperties loadProperties(FileObject propsFO) throws IOException { InputStream propsIS = propsFO.getInputStream(); EditableProperties props = new EditableProperties(true); try { props.load(propsIS); } finally { propsIS.close(); } return props; }
public Object run() throws Exception { EditableProperties ep = new EditableProperties(); FileObject propFile = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); InputStream is = propFile.getInputStream(); ep.load(is); is.close(); return ep; } });
public void run() { EditableProperties properties = new EditableProperties(true); properties.setProperty(propertyName, new File(f.getParentFile(), fe.getFile().getName()).getPath()); Utils.updateProperties(helper, AntProjectHelper.PROJECT_PROPERTIES_PATH, properties); try { ProjectManager.getDefault().saveProject(WebProject.this); updateFileChangeListener(); } catch (IOException ex) { Exceptions.printStackTrace(ex); } catch (IllegalArgumentException ex) { Exceptions.printStackTrace(ex); } } });
@Override public void run(InputStream zipEntryInputStream) { EditableProperties templateProperties = new EditableProperties(false); try { templateProperties.load(zipEntryInputStream); projectProperties.setSiteRootFolder(templateProperties.getProperty(ClientSideProjectConstants.PROJECT_SITE_ROOT_FOLDER)) .setTestFolder(templateProperties.getProperty(ClientSideProjectConstants.PROJECT_TEST_FOLDER)); } catch (IOException ex) { LOGGER.log(Level.WARNING, "Error while reading file", ex); } } }, NB_TEMPLATE_FILTER);
if (wpe != null) { PropertyEvaluator pe = wpe.evaluator(); props = new EditableProperties(pe.getProperties()); } else { props = (EditableProperties) ProjectManager.mutex().readAccess(new Mutex.ExceptionAction() { public Object run() throws Exception { EditableProperties ep = new EditableProperties(); FileObject propFile = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); InputStream is = propFile.getInputStream();
private static void writeProjectMetadata(ZipOutputStream str, ClientSideProject project) throws IOException { ZipEntry ze = new ZipEntry(ClientSideProjectConstants.TEMPLATE_DESCRIPTOR); str.putNextEntry(ze); EditableProperties ep = new EditableProperties(false); ClientSideProjectProperties projectProperties = new ClientSideProjectProperties(project); String siteRoot; if (isSiteRootExternal(project.getProjectDirectory(), project.getSiteRootFolder())) { siteRoot = ClientSideProjectConstants.DEFAULT_SITE_ROOT_FOLDER; } else { siteRoot = projectProperties.getSiteRootFolder(); } ep.setProperty(ClientSideProjectConstants.PROJECT_SITE_ROOT_FOLDER, siteRoot); ep.setProperty(ClientSideProjectConstants.PROJECT_TEST_FOLDER, projectProperties.getTestFolder()); ep.store(str); }
final String name = (String) templateWizard.getProperty(ProjectPanel.PROJECT_NAME); final EditableProperties oldep=new EditableProperties(); FileInputStream fis = new FileInputStream(location+File.separator+AntProjectHelper.PROJECT_PROPERTIES_PATH); try { final EditableProperties oldpriv=new EditableProperties(); if (f.exists()) { fis = new FileInputStream(f);
public static EditableProperties readFromFile(final @NonNull FileObject propsFO) throws IOException { final EditableProperties ep = new EditableProperties(true); if(propsFO != null) { assert propsFO.isData(); try { ProjectManager.mutex().readAccess(new Mutex.ExceptionAction<Void>() { @Override public Void run() throws Exception { final InputStream is = propsFO.getInputStream(); try { ep.load(is); } finally { if (is != null) { is.close(); } } return null; } }); } catch (MutexException mux) { throw (IOException) mux.getException(); } } return ep; }
private void storeFX() throws IOException { updatePreloaderDependencies(CONFIGS); CONFIGS.storeActive(); final EditableProperties ep = new EditableProperties(true); final FileObject projPropsFO = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); final EditableProperties pep = new EditableProperties(true); final FileObject privPropsFO = project.getProjectDirectory().getFileObject(AntProjectHelper.PRIVATE_PROPERTIES_PATH); try {
FileObject sharedCfgFO = projDir.getFileObject(sharedPath); final EditableProperties sharedCfgProps = sharedCfgFO != null ? readFromFile(sharedCfgFO) : new EditableProperties(true); assert sharedCfgProps != null; if(sharedCfgProps.isEmpty()) { FileObject privateCfgFO = projDir.getFileObject(privatePath); final EditableProperties privateCfgProps = privateCfgFO != null ? readFromFile(projDir, privatePath) : new EditableProperties(true); assert privateCfgProps != null; if(privateCfgProps.isEmpty() || setBrowserProps) {
final EditableProperties ep = new EditableProperties(true); final FileObject projPropsFO = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); if(projPropsFO != null) {
private void storeSE() throws IOException { final EditableProperties ep = new EditableProperties(true); final FileObject projPropsFO = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); try {
final EditableProperties ep = new EditableProperties(true); final FileObject projPropsFO = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); try {
EditableProperties ep = new EditableProperties(true);