1 /*******************************************************************************
2 * Copyright (c) 2016 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * THTH ry - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.debug.browser.ui;
14 import org.eclipse.core.expressions.PropertyTester;
15 import org.eclipse.core.runtime.Platform;
18 * @author Tuukka Lehtonen / Semantum Oy
20 public class PlatformPropertyTester extends PropertyTester {
22 private static final String PROPERTY_IN_DEVELOPMENT_MODE = "inDevelopmentMode"; //$NON-NLS-1$
25 public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
26 if (PROPERTY_IN_DEVELOPMENT_MODE.equals(property)) {
27 return parseBoolean(expectedValue, true) == Platform.inDevelopmentMode();
32 private boolean parseBoolean(Object value, boolean defaultValue) {
33 if (value instanceof Boolean) return (Boolean) value;
34 if (value instanceof String) return Boolean.parseBoolean((String) value);