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