Java Code Examples for org.eclipse.core.runtime.preferences.IEclipsePreferences#childrenNames()

The following examples show how to use org.eclipse.core.runtime.preferences.IEclipsePreferences#childrenNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaProject.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void updatePreferences(IEclipsePreferences preferences) {

	 	IEclipsePreferences oldPreferences = loadPreferences();
	 	if (oldPreferences != null) {
			try {
		 		String[] propertyNames = oldPreferences.childrenNames();
				for (int i = 0; i < propertyNames.length; i++){
					String propertyName = propertyNames[i];
				    String propertyValue = oldPreferences.get(propertyName, ""); //$NON-NLS-1$
				    if (!"".equals(propertyValue)) { //$NON-NLS-1$
					    preferences.put(propertyName, propertyValue);
				    }
				}
				// save immediately new preferences
				preferences.flush();
			} catch (BackingStoreException e) {
				// fails silently
			}
		}
	 }
 
Example 2
Source File: PreferenceRecorder.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
private void addListeners(IEclipsePreferences node) throws CoreException {
  addListener(node);

  try {
    for (String childName : node.childrenNames()) {
      IEclipsePreferences child = (IEclipsePreferences) node.node(childName);
      this.addListeners(child);
    }
  } catch (BackingStoreException e) {
    throw new CoreException(new Status(IStatus.ERROR, MechanicPlugin.PLUGIN_ID,
        "Could not read children for preference node", e));
  }
}