org.eclipse.jface.viewers.DecorationContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spotless-ext-greclipse Show documentation
Show all versions of spotless-ext-greclipse Show documentation
Groovy Eclipse's formatter bundled for Spotless
The newest version!
/*******************************************************************************
* Copyright (c) 2006, 2008 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.viewers;
import java.util.HashMap;
import java.util.Map;
/**
* A concrete implementation of the {@link IDecorationContext} interface,
* suitable for instantiating.
*
* This class is not intended to be subclassed.
*
* @since 3.2
*/
public class DecorationContext implements IDecorationContext {
/**
* Constant that defines a default decoration context that has
* no context ids associated with it.
*/
public static final IDecorationContext DEFAULT_CONTEXT = new DecorationContext();
private Map properties = new HashMap();
/**
* Create a decoration context.
*/
public DecorationContext() {
}
@Override
public Object getProperty(String property) {
return properties.get(property);
}
@Override
public String[] getProperties() {
return (String[]) properties.keySet().toArray(new String[properties.size()]);
}
/**
* Set the given property to the given value. Setting the value of
* a property to null
removes the property from
* the context.
* @param property the property
* @param value the value of the property or null
* if the property is to be removed.
*/
public void putProperty(String property, Object value) {
if (value == null) {
properties.remove(property);
} else {
properties.put(property, value);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy