[jbosstools-commits] JBoss Tools SVN: r35623 - trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Oct 13 11:11:18 EDT 2011


Author: adietish
Date: 2011-10-13 11:11:17 -0400 (Thu, 13 Oct 2011)
New Revision: 35623

Added:
   trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/InvertingBooleanConverter.java
Log:
[JBIDE-9793] implemented default clone destination, default remote name

Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/InvertingBooleanConverter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/InvertingBooleanConverter.java	                        (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/InvertingBooleanConverter.java	2011-10-13 15:11:17 UTC (rev 35623)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ *     Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.ui.databinding;
+
+import org.eclipse.core.databinding.conversion.Converter;
+
+/**
+ * A converter that inverts a boolean. <code>true</code> gets <code>false</code>
+ * and the opposite. If the converter gets a non-boolean value feeded in, it
+ * will always return <code>false</code>.
+ * 
+ * @author André Dietisheim
+ */
+public class InvertingBooleanConverter extends Converter {
+
+	public InvertingBooleanConverter() {
+		super(Boolean.class, Boolean.class);
+	}
+
+	@Override
+	public Object convert(Object fromObject) {
+		if (!(fromObject instanceof Boolean)) {
+			return Boolean.FALSE;
+		}
+		return !((Boolean) fromObject).booleanValue();
+	}
+
+}


Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/InvertingBooleanConverter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list