List of usage examples for org.eclipse.jface.dialogs DialogSettings getArray
@Override
public String[] getArray(String key)
From source file:com.sonatype.buildserver.monitor.MonitorPersistence.java
License:Open Source License
/** * Retrieve a monitor given its ID.// w w w.jav a2s.c om * * @param id the monitor's id * @return the loaded monitor, or null if it does not exist */ static synchronized Object load(String id) { DialogSettings settings = new DialogSettings(id.toString()); try { settings.load(getLocation(id)); } catch (IOException e) { return new CompositeMonitor(UUID.fromString(id)); } String[] monitors = settings.getArray(MONITORS); if (monitors != null) { return loadComposite(id, monitors); } return loadMonitor(id, settings); }
From source file:com.sonatype.buildserver.monitor.MonitorPersistence.java
License:Open Source License
private static HudsonMonitor loadMonitor(String id, DialogSettings settings) { String[] jobIDs = settings.getArray(JOBS); HudsonMonitor monitor = HudsonManager.addHudsonMonitor(URI.create(settings.get(ADDRESS)), UUID.fromString(id)); if (jobIDs != null && jobIDs.length > 0) monitor.addMonitoredJobs(Arrays.asList(jobIDs)); return monitor; }
From source file:de.maybebuggy.finder.commands.FinderDialog.java
License:Open Source License
private SearchHistory getSearchHistory() { String fileName = getSearchHistoryFileName(); SearchHistory history = new SearchHistory(); DialogSettings searchDirectories = new DialogSettings("SearchHistory"); try {/*from w w w. j a v a 2s . c o m*/ createFileIfMissing(fileName); searchDirectories.load(fileName); } catch (IOException e) { e.printStackTrace(); return history; } String[] paths = searchDirectories.getArray("searchPaths"); history.addSearchPaths(paths); String[] terms = searchDirectories.getArray("searchTerms"); history.addSearchTerms(terms); return history; }
From source file:org.wesnoth.preprocessor.PreprocessorUtils.java
License:Open Source License
/** * Restores the timestamps for preprocessed files from * the filesystem// w w w.j av a 2 s .c o m */ public void restoreTimestamps() { DialogSettings settings = new DialogSettings("preprocessed"); //$NON-NLS-1$ filesTimeStamps_.clear(); try { // ensure the creation of a valid file if it doesn't exist if (!new File(PREPROCESSED_FILE_PATH).exists()) { settings.save(PREPROCESSED_FILE_PATH); } settings.load(PREPROCESSED_FILE_PATH); String[] timestamps = settings.getArray("timestamps"); //$NON-NLS-1$ String[] files = settings.getArray("files"); //$NON-NLS-1$ if (timestamps != null && files != null && timestamps.length == files.length) { for (int index = 0; index < files.length; ++index) { filesTimeStamps_.put(files[index], Long.valueOf(timestamps[index])); } } } catch (IOException e) { Logger.getInstance().logException(e); } }
From source file:org.wesnoth.utils.PreprocessorUtils.java
License:Open Source License
/** * Restores the timestamps for preprocessed files from * the filesystem/*from w w w . j a v a 2 s. c om*/ */ public void restoreTimestamps() { IPath path = Activator.getDefault().getStateLocation(); String filename = path.append("preprocessed.txt").toOSString(); //$NON-NLS-1$ DialogSettings settings = new DialogSettings("preprocessed"); //$NON-NLS-1$ filesTimeStamps_.clear(); try { // ensure the creation of a valid file if it doesn't exist if (new File(filename).exists() == false) settings.save(filename); settings.load(filename); String[] timestamps = settings.getArray("timestamps"); //$NON-NLS-1$ String[] files = settings.getArray("files"); //$NON-NLS-1$ if (timestamps != null && files != null && timestamps.length == files.length) { for (int index = 0; index < files.length; ++index) { filesTimeStamps_.put(files[index], Long.valueOf(timestamps[index])); } } } catch (IOException e) { Logger.getInstance().logException(e); } }