blob: 30d54ea18bd5eda75384e66067a3d9c5fe0edce2 [file] [log] [blame]
/**
* Copyright (c) 2013-2015 Angelo ZERR.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
*/
package org.eclipse.wst.json.ui.internal;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.wst.json.core.regions.JSONRegionContexts;
import org.eclipse.wst.json.ui.internal.style.IStyleConstantsJSON;
/**
* Color region types helper.
*
* @author azerr
*
*/
public class ColorTypesHelper {
/** Contains region to style mapping */
private static final Map<String, String> fColorTypes;
static {
fColorTypes = new HashMap<String, String>();
fColorTypes.put(JSONRegionContexts.JSON_OBJECT_OPEN,
IStyleConstantsJSON.CURLY_BRACE);
fColorTypes.put(JSONRegionContexts.JSON_OBJECT_CLOSE,
IStyleConstantsJSON.CURLY_BRACE);
fColorTypes.put(JSONRegionContexts.JSON_ARRAY_OPEN,
IStyleConstantsJSON.CURLY_BRACE);
fColorTypes.put(JSONRegionContexts.JSON_ARRAY_CLOSE,
IStyleConstantsJSON.CURLY_BRACE);
fColorTypes.put(JSONRegionContexts.JSON_COLON,
IStyleConstantsJSON.COLON);
fColorTypes.put(JSONRegionContexts.JSON_COMMA,
IStyleConstantsJSON.COMMA);
fColorTypes.put(JSONRegionContexts.JSON_OBJECT_KEY,
IStyleConstantsJSON.OBJECT_KEY);
fColorTypes.put(JSONRegionContexts.JSON_VALUE_STRING,
IStyleConstantsJSON.VALUE_STRING);
fColorTypes.put(JSONRegionContexts.JSON_VALUE_NUMBER,
IStyleConstantsJSON.VALUE_NUMBER);
fColorTypes.put(JSONRegionContexts.JSON_VALUE_BOOLEAN,
IStyleConstantsJSON.VALUE_BOOLEAN);
fColorTypes.put(JSONRegionContexts.JSON_VALUE_NULL,
IStyleConstantsJSON.VALUE_NULL);
fColorTypes.put(JSONRegionContexts.JSON_COMMENT,
IStyleConstantsJSON.COMMENT);
}
/**
* Returns the Color for the given region type {@link JSONRegionContexts}.
*
* @param regionType
* the region type.
* @return the Color for the given region type {@link JSONRegionContexts}.
*/
public static String getColor(String regionType) {
return fColorTypes.get(regionType);
}
public static String getNewStyle(PropertyChangeEvent event) {
return null;
}
}