blob: 9e87e6d2d03b8c88beacf7cc89d0b9cf87e2f56c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2010 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.monitor.ui;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.mylyn.monitor.core.InteractionEvent;
/**
* @author Mik Kersten
*/
public class PreferenceChangeMonitor implements IPropertyChangeListener {
public void propertyChange(PropertyChangeEvent event) {
String newValue = obfuscateValueIfContainsPath(event.getNewValue().toString());
InteractionEvent interactionEvent = InteractionEvent.makePreference(event.getProperty(), newValue);
MonitorUiPlugin.getDefault().notifyInteractionObserved(interactionEvent);
}
private String obfuscateValueIfContainsPath(String preferenceValue) {
if (preferenceValue.indexOf(java.io.File.separator) != -1 || preferenceValue.indexOf('/') != -1) {
return MonitorUiPlugin.OBFUSCATED_LABEL;
} else {
return preferenceValue;
}
}
}