X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.debug.browser.ui%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fbrowser%2Fui%2FPlatformPropertyTester.java;h=1394894b57d71590f7bbe621512ac21b4094f1f9;hb=f9414daee0c65900deb73ab81a2d7f157c6bd5e4;hp=c5e49f2a34d9225181444266a7d9935724ec0a04;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.debug.browser.ui/src/org/simantics/debug/browser/ui/PlatformPropertyTester.java b/bundles/org.simantics.debug.browser.ui/src/org/simantics/debug/browser/ui/PlatformPropertyTester.java index c5e49f2a3..1394894b5 100644 --- a/bundles/org.simantics.debug.browser.ui/src/org/simantics/debug/browser/ui/PlatformPropertyTester.java +++ b/bundles/org.simantics.debug.browser.ui/src/org/simantics/debug/browser/ui/PlatformPropertyTester.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2016 Association for Decentralized Information Management - * in Industry THTH ry. - * 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: - * THTH ry - initial API and implementation - *******************************************************************************/ -package org.simantics.debug.browser.ui; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.core.runtime.Platform; - -/** - * @author Tuukka Lehtonen / Semantum Oy - */ -public class PlatformPropertyTester extends PropertyTester { - - private static final String PROPERTY_IN_DEVELOPMENT_MODE = "inDevelopmentMode"; //$NON-NLS-1$ - - @Override - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - if (PROPERTY_IN_DEVELOPMENT_MODE.equals(property)) { - return parseBoolean(expectedValue, true) == Platform.inDevelopmentMode(); - } - return false; - } - - private boolean parseBoolean(Object value, boolean defaultValue) { - if (value instanceof Boolean) return (Boolean) value; - if (value instanceof String) return Boolean.parseBoolean((String) value); - return defaultValue; - } - -} +/******************************************************************************* + * Copyright (c) 2016 Association for Decentralized Information Management + * in Industry THTH ry. + * 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: + * THTH ry - initial API and implementation + *******************************************************************************/ +package org.simantics.debug.browser.ui; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.runtime.Platform; + +/** + * @author Tuukka Lehtonen / Semantum Oy + */ +public class PlatformPropertyTester extends PropertyTester { + + private static final String PROPERTY_IN_DEVELOPMENT_MODE = "inDevelopmentMode"; //$NON-NLS-1$ + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + if (PROPERTY_IN_DEVELOPMENT_MODE.equals(property)) { + return parseBoolean(expectedValue, true) == Platform.inDevelopmentMode(); + } + return false; + } + + private boolean parseBoolean(Object value, boolean defaultValue) { + if (value instanceof Boolean) return (Boolean) value; + if (value instanceof String) return Boolean.parseBoolean((String) value); + return defaultValue; + } + +}