Mercurial > projects > dwt2
changeset 85:6be48cf9f95c
Work on databinding
line wrap: on
line diff
--- a/base/src/java/lang/Class.d Sat Apr 18 09:25:29 2009 +0200 +++ b/base/src/java/lang/Class.d Sat Apr 18 13:54:50 2009 +0200 @@ -15,6 +15,13 @@ implMissing(__FILE__, __LINE__ ); return null; } + static Class fromType(T)(){ + return null; + } + static Class fromObject(T)(T t){ + static assert( is(T==class)||is(T==interface)); + return null; + } //static Class forName(String name, bool initialize, ClassLoader loader){ // implMissing(__FILE__, __LINE__ ); // return null;
--- a/base/src/java/lang/System.d Sat Apr 18 09:25:29 2009 +0200 +++ b/base/src/java/lang/System.d Sat Apr 18 13:54:50 2009 +0200 @@ -114,6 +114,34 @@ class System { + version(D_Version2){ + mixin("alias const(T) CT;"); + } else { // D1 + static void arraycopyT(T)(T[] src, uint srcPos, T[] dest, uint destPos, uint len) { + if(len == 0) return; + + assert(src); + assert(dest); + debug{validCheck(src.length - srcPos, dest.length - destPos, len);} + + // overlapping? + if((src.ptr <= dest.ptr && src.ptr + len > dest.ptr) + ||(src.ptr >= dest.ptr && src.ptr < dest.ptr + len)){ + if( destPos < srcPos ){ + for(int i=0; i<len; ++i){ + dest[destPos+i] = cast(T)src[srcPos+i]; + } + } + else{ + for(int i=len-1; i>=0; --i){ + dest[destPos+i] = cast(T)src[srcPos+i]; + } + } + }else{ + dest[destPos..(len+destPos)] = cast(T[])src[srcPos..(len+srcPos)]; + } + } + } alias SimpleType!(int).arraycopy arraycopy; alias SimpleType!(byte).arraycopy arraycopy;
--- a/base/src/java/util/Arrays.d Sat Apr 18 09:25:29 2009 +0200 +++ b/base/src/java/util/Arrays.d Sat Apr 18 13:54:50 2009 +0200 @@ -66,13 +66,23 @@ tango.core.Array.sort( a, &isLess ); } static List asList(T)(T[] a) { - static assert( is(T==interface) || is(T==class)); - if( a.length is 0 ) return Collections.EMPTY_LIST; - ArrayList res = new ArrayList( a.length ); - foreach( o; a ){ - res.add( cast(Object)o); + static if( is(T==String)){ + if( a.length is 0 ) return Collections.EMPTY_LIST; + ArrayList res = new ArrayList( a.length ); + foreach( o; a ){ + res.add( stringcast(o)); + } + return res; } - return res; + else{ + static assert( is(T==interface) || is(T==class), "asList"); + if( a.length is 0 ) return Collections.EMPTY_LIST; + ArrayList res = new ArrayList( a.length ); + foreach( o; a ){ + res.add( cast(Object)o); + } + return res; + } } public static void fill( char[] str, char c ){ str[] = c;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/text/BreakIterator.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,58 @@ + +module com.ibm.icu.text.BreakIterator; + +import java.lang.all; +import java.text.CharacterIterator; + +public class BreakIterator { + + public static final int DONE = 0; + + public static BreakIterator getLineInstance() { + // TODO Auto-generated method stub + return null; + } + + public void setText(String line) { + // TODO Auto-generated method stub + + } + + public int following(int currOffset) { + // TODO Auto-generated method stub + return 0; + } + + public int next() { + // TODO Auto-generated method stub + return 0; + } + + public static BreakIterator getWordInstance() { + // TODO Auto-generated method stub + return null; + } + + public int preceding(int position) { + // TODO Auto-generated method stub + return 0; + } + + public void setText(CharacterIterator docIter) { + // TODO Auto-generated method stub + + } + + public bool isBoundary(int position) { + // TODO Auto-generated method stub + return false; + } + + public int first() { + // TODO Auto-generated method stub + return 0; + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/text/CollationKey.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,15 @@ + +module com.ibm.icu.text.CollationKey; + +import java.lang.all; + +public class CollationKey { + + public int compareTo(CollationKey descriptionKey) { + // TODO Auto-generated method stub + return 0; + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/text/Collator.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,34 @@ + +module com.ibm.icu.text.Collator; +import com.ibm.icu.text.CollationKey; + +import java.lang.all; +//import java.util.Comparator; +//import java.util.Locale; + +public class Collator : Comparator { + + public static Collator getInstance() { + // TODO Auto-generated method stub + return null; + } + + public int compare(Object label, Object label2) { + // TODO Auto-generated method stub + return 0; + } + + //FIXME missing API + //public static Collator getInstance(Locale default1) { + // // TODO Auto-generated method stub + // return null; + //} + + public CollationKey getCollationKey(String attributeValue) { + // TODO Auto-generated method stub + return null; + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/text/DateFormat.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,56 @@ +module com.ibm.icu.text.DateFormat; + +import java.lang.all; +import java.text.ParsePosition; +import java.util.Date; + +public class DateFormat { + + public static const int LONG = 0; + public static const int FULL = 0; + public static const int SHORT = 0; + public static const int MEDIUM = 0; + + public static DateFormat getDateInstance() { + // TODO Auto-generated method stub + return null; + } + + public String format(Date date) { + // TODO Auto-generated method stub + return null; + } + + public static DateFormat getTimeInstance() { + // TODO Auto-generated method stub + return null; + } + + public static DateFormat getDateTimeInstance(int l, int m) { + // TODO Auto-generated method stub + return null; + } + + public static DateFormat getTimeInstance(int s) { + // TODO Auto-generated method stub + return null; + } + + public static DateFormat getDateInstance(int dateFormat) { + // TODO Auto-generated method stub + return null; + } + + public Date parse(String str, ParsePosition pos) { + // TODO Auto-generated method stub + return null; + } + + public String format(Long long2) { + // TODO Auto-generated method stub + return null; + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/text/MessageFormat.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,23 @@ + +module com.ibm.icu.text.MessageFormat; + +import java.lang.all; +public class MessageFormat { + + public this(String taskList_line) { + // TODO Auto-generated constructor stub + } + + public static String format(String format, Object[] args) { + // TODO Auto-generated method stub + return null; + } + + public String format(Object[] objects) { + // TODO Auto-generated method stub + return null; + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/text/NumberFormat.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,53 @@ + +module com.ibm.icu.text.NumberFormat; +import com.ibm.icu.text.DateFormat; + +import java.lang.all; +import java.math.BigInteger; +import java.text.ParsePosition; + +public class NumberFormat { + + public static NumberFormat getIntegerInstance() { + // TODO Auto-generated method stub + return null; + } + + public static NumberFormat getNumberInstance() { + // TODO Auto-generated method stub + return null; + } + + public String format(long longValue) { + // TODO Auto-generated method stub + return null; + } + + public String format(double doubleValue) { + // TODO Auto-generated method stub + return null; + } + + public String format(BigInteger number) { + // TODO Auto-generated method stub + return null; + } + + public Number parse(String source, ParsePosition position) { + // TODO Auto-generated method stub + return null; + } + + public String format(Number minValue) { + // TODO Auto-generated method stub + return null; + } + + public static DateFormat getInstance() { + // TODO Auto-generated method stub + return null; + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/text/SimpleDateFormat.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,14 @@ + +module com.ibm.icu.text.SimpleDateFormat; +import com.ibm.icu.text.DateFormat; + +import java.lang.all; +public class SimpleDateFormat : DateFormat { + + public this(String string) { + // TODO Auto-generated constructor stub + } + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com.ibm.icu/src/com/ibm/icu/util/Calendar.d Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,19 @@ +module com.ibm.icu.util.Calendar; + +import java.lang.all; + +public class Calendar { + + public static final int YEAR = 0; + + public static Calendar getInstance() { + // TODO Auto-generated method stub + return null; + } + + public int get(int year2) { + // TODO Auto-generated method stub + return 0; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.eclipse.core.databinding/res/org.eclipse.core.internal.databinding.messages.properties Sat Apr 18 13:54:50 2009 +0200 @@ -0,0 +1,56 @@ +############################################################################### +# Copyright (c) 2000, 2008 IBM Corporation and others. +# 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: +# IBM Corporation - initial API and implementation +############################################################################### +# NLS file for JFace Data Binding +############################################################################### +## Uneeded value +# +#Yes=Yes +#yes=yes +#No=No +#no=no +#True=True +#true=true +#False=False +#false=false +#and=and +#or=or +#Validate_BooleanHelp=Please type "Yes", "No", "True", or "False" +# +#Validate_RangeStart=Please enter a number between +#Validate_Like=Please enter a number like +# +############### + +IndexOutOfRange=Index out of Range. +MultipleProblems=Multiple Problems. + +ValueBinding_ErrorWhileSettingValue=An error occurred while setting the value. +DateFormat_DateTime=dd.MM.yyyy HH:mm:ss.SSS Z +DateFormat_Time=HH:mm:ss.SSS + +#ValueDelimiter should be used to separate multiple values that are stored in one key +ValueDelimiter=, + +#Values must be separated by ValueDelimiter +TrueStringValues=yes,true +FalseStringValues=no,false + +Validate_NumberOutOfRangeError=Please enter a value between [{0}] and [{1}] and with a similar format. +Validate_NumberParseError=Invalid character for value [{0}] at position [{1}] character [{2}]. +Validate_NumberParseErrorNoCharacter=Missing character for value [{0}] at position [{1}]. + +Validate_ConversionToPrimitive="Null object values can not be converted to primitives." +Validate_ConversionFromClassToPrimitive="Wrong object type to convert to primitive." + +Validate_NoChangeAllowedHelp=Changes are not allowed in this field +Validate_CharacterHelp=Please type a character + +Examples=Examples \ No newline at end of file
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/AggregateValidationStatus.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/AggregateValidationStatus.d Sat Apr 18 13:54:50 2009 +0200 @@ -94,7 +94,7 @@ * @see DataBindingContext#getValidationStatusProviders() */ public this( - IObservableCollection validationStatusProviders, strategy) { + IObservableCollection validationStatusProviders, int strategy) { this(Realm.getDefault(), validationStatusProviders, strategy); } @@ -113,25 +113,25 @@ public this(Realm realm, IObservableCollection validationStatusProviders, int strategy) { if (strategy is MERGED) { - implementation = new class(realm, IStatus.classinfo, validationStatusProviders) ComputedValue { + implementation = new class(realm, typeid(IStatus), validationStatusProviders) ComputedValue { IObservableCollection validationStatusProviders_; - this(Realm r, ClassInfo c, IObservableCollection v){ + this(Realm r, TypeInfo c, IObservableCollection v){ super(r, c); validationStatusProviders_=v; } protected Object calculate() { - return getStatusMerged(validationStatusProviders_); + return cast(Object)getStatusMerged(validationStatusProviders_); } }; } else { - implementation = new class(realm, IStatus.classinfo, validationStatusProviders) ComputedValue { + implementation = new class(realm, typeid(IStatus), validationStatusProviders) ComputedValue { IObservableCollection validationStatusProviders_; - this(Realm r, ClassInfo c, IObservableCollection v){ + this(Realm r, TypeInfo c, IObservableCollection v){ super(r, c); validationStatusProviders_=v; } protected Object calculate() { - return getStatusMaxSeverity(validationStatusProviders_); + return cast(Object)getStatusMaxSeverity(validationStatusProviders_); } }; } @@ -215,7 +215,7 @@ IStatus status = cast(IStatus) validationStatusProvider .getValidationStatus().getValue(); if (!status.isOK()) { - statuses.add(status); + statuses.add(cast(Object)status); } } if (statuses.size() is 1) { @@ -224,7 +224,7 @@ if (!statuses.isEmpty()) { MultiStatus result = new MultiStatus(Policy.JFACE_DATABINDING, 0, BindingMessages - .getStringcast(BindingMessages.MULTIPLE_PROBLEMS), null); + .getString(BindingMessages.MULTIPLE_PROBLEMS), null); for (Iterator it = statuses.iterator(); it.hasNext();) { IStatus status = cast(IStatus) it.next(); result.merge(status);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/Binding.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/Binding.d Sat Apr 18 13:54:50 2009 +0200 @@ -147,7 +147,7 @@ */ public IObservableList getTargets() { return Observables.staticObservableList(context.getValidationRealm(), - Collections.singletonList(target)); + Collections.singletonList(cast(Object)target)); } /** @@ -162,6 +162,6 @@ */ public IObservableList getModels() { return Observables.staticObservableList(context.getValidationRealm(), - Collections.singletonList(model)); + Collections.singletonList(cast(Object)model)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/BindingException.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/BindingException.d Sat Apr 18 13:54:50 2009 +0200 @@ -49,18 +49,20 @@ } public void printStackTrace(PrintStream err) { - super.printStackTrace(err); - if (cause !is null) { - err.println("caused by:"); //$NON-NLS-1$ - cause.printStackTrace(err); - } + implMissing( __FILE__, __LINE__ ); + //ExceptionPrintStackTrace( this, err ); + //if (cause !is null) { + // err.println("caused by:"); //$NON-NLS-1$ + // ExceptionPrintStackTrace( cause, err ); + //} } public void printStackTrace(PrintWriter err) { - super.printStackTrace(err); - if (cause !is null) { - err.println("caused by:"); //$NON-NLS-1$ - cause.printStackTrace(err); - } + implMissing( __FILE__, __LINE__ ); + //ExceptionPrintStackTrace( this, err ); + //if (cause !is null) { + // err.println("caused by:"); //$NON-NLS-1$ + // ExceptionPrintStackTrace( cause, err ); + //} } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/DataBindingContext.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/DataBindingContext.d Sat Apr 18 13:54:50 2009 +0200 @@ -144,8 +144,8 @@ : createTargetToModelUpdateValueStrategy(targetObservableValue, modelObservableValue); UpdateValueStrategy modelToTargetStrategy = modelToTarget !is null ? modelToTarget : createModelToTargetUpdateValueStrategy(modelObservableValue, targetObservableValue); - targetToModelStrategy.fillDefaults(targetObservableValue, modelObservableValue); - modelToTargetStrategy.fillDefaults(modelObservableValue, targetObservableValue); + targetToModelStrategy.fillDefaults_package(targetObservableValue, modelObservableValue); + modelToTargetStrategy.fillDefaults_package(modelObservableValue, targetObservableValue); ValueBinding result = new ValueBinding(targetObservableValue, modelObservableValue, targetToModelStrategy, modelToTargetStrategy); @@ -209,9 +209,9 @@ UpdateListStrategy modelToTargetStrategy = modelToTarget !is null ? modelToTarget : createModelToTargetUpdateListStrategy(modelObservableList, targetObservableList); - targetToModelStrategy.fillDefaults(targetObservableList, + targetToModelStrategy.fillDefaults_package(targetObservableList, modelObservableList); - modelToTargetStrategy.fillDefaults(modelObservableList, + modelToTargetStrategy.fillDefaults_package(modelObservableList, targetObservableList); ListBinding result = new ListBinding(targetObservableList, modelObservableList, targetToModelStrategy, @@ -271,8 +271,8 @@ if (modelToTarget is null) modelToTarget = createModelToTargetUpdateSetStrategy( modelObservableSet, targetObservableSet); - targetToModel.fillDefaults(targetObservableSet, modelObservableSet); - modelToTarget.fillDefaults(modelObservableSet, targetObservableSet); + targetToModel.fillDefaults_package(targetObservableSet, modelObservableSet); + modelToTarget.fillDefaults_package(modelObservableSet, targetObservableSet); SetBinding result = new SetBinding(targetObservableSet, modelObservableSet, targetToModel, modelToTarget); result.init(this);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/ListBinding.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/ListBinding.d Sat Apr 18 13:54:50 2009 +0200 @@ -43,7 +43,8 @@ private bool updatingTarget; private bool updatingModel; - private IListChangeListener targetChangeListener = new class() IListChangeListener { + private IListChangeListener targetChangeListener; + private class TargetChangeListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { if (!updatingTarget) { doUpdate(cast(IObservableList) getTarget(), @@ -51,8 +52,9 @@ targetToModel, false, false); } } - }; - private IListChangeListener modelChangeListener = new class() IListChangeListener { + } + private IListChangeListener modelChangeListener; + class ModelChangeListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { if (!updatingModel) { doUpdate(cast(IObservableList) getModel(), @@ -71,6 +73,8 @@ public this(IObservableList target, IObservableList model, UpdateListStrategy targetToModelStrategy, UpdateListStrategy modelToTargetStrategy) { +targetChangeListener = new TargetChangeListener(); +modelChangeListener = new ModelChangeListener(); super(target, model); this.targetToModel = targetToModelStrategy; this.modelToTarget = modelToTargetStrategy; @@ -92,7 +96,7 @@ protected void preInit() { validationStatusObservable = new WritableValue(context - .getValidationRealm(), Status.OK_STATUS, IStatus.classinfo); + .getValidationRealm(), cast(Object)Status.OK_STATUS, typeid(IStatus)); } protected void postInit() { @@ -168,7 +172,7 @@ ListDiffEntry listDiffEntry = diffEntries[i]; if (listDiffEntry.isAddition()) { IStatus setterStatus = updateListStrategy_ - .doAdd( + .doAdd_package( destination_, updateListStrategy_ .convert(listDiffEntry @@ -180,7 +184,7 @@ // will be out of sync if an error occurred... } else { IStatus setterStatus = updateListStrategy_ - .doRemove(destination_, + .doRemove_package(destination_, listDiffEntry.getPosition()); mergeStatus(multiStatus, setterStatus);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/ObservablesManager.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/ObservablesManager.d Sat Apr 18 13:54:50 2009 +0200 @@ -36,14 +36,17 @@ */ public class ObservablesManager { - private Set managedObservables = new HashSet(); - private Set excludedObservables = new HashSet(); - private Map contexts = new HashMap(); + private Set managedObservables; + private Set excludedObservables; + private Map contexts; /** * Create a new observables manager. */ public this() { +managedObservables = new HashSet(); +excludedObservables = new HashSet(); +contexts = new HashMap(); } /** @@ -53,7 +56,7 @@ * the observable */ public void addObservable(IObservable observable) { - managedObservables.add(observable); + managedObservables.add(cast(Object)observable); } /** @@ -64,7 +67,7 @@ * the observable */ public void excludeObservable(IObservable observable) { - excludedObservables.add(observable); + excludedObservables.add(cast(Object)observable); } /** @@ -104,10 +107,10 @@ for (Iterator it2 = context.getBindings().iterator(); it2.hasNext();) { Binding binding = cast(Binding) it2.next(); if (disposeTargets) { - observables.add(binding.getTarget()); + observables.add(cast(Object)binding.getTarget()); } if (disposeModels) { - observables.add(binding.getModel()); + observables.add(cast(Object)binding.getModel()); } } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/SetBinding.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/SetBinding.d Sat Apr 18 13:54:50 2009 +0200 @@ -43,7 +43,8 @@ private bool updatingTarget; private bool updatingModel; - private ISetChangeListener targetChangeListener = new class() ISetChangeListener { + private ISetChangeListener targetChangeListener; + class TargetChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { if (!updatingTarget) { doUpdate(cast(IObservableSet) getTarget(), @@ -53,7 +54,8 @@ } }; - private ISetChangeListener modelChangeListener = new class() ISetChangeListener { + private ISetChangeListener modelChangeListener; + class ModelChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { if (!updatingModel) { doUpdate(cast(IObservableSet) getModel(), @@ -72,6 +74,8 @@ public this(IObservableSet target, IObservableSet model, UpdateSetStrategy targetToModelStrategy, UpdateSetStrategy modelToTargetStrategy) { +targetChangeListener = new TargetChangeListener(); +modelChangeListener = new ModelChangeListener(); super(target, model); this.targetToModel = targetToModelStrategy; this.modelToTarget = modelToTargetStrategy; @@ -93,7 +97,7 @@ protected void preInit() { validationStatusObservable = new WritableValue(context - .getValidationRealm(), Status.OK_STATUS, IStatus.classinfo); + .getValidationRealm(), cast(Object)Status.OK_STATUS, typeid(IStatus)); } protected void postInit() { @@ -165,7 +169,7 @@ for (Iterator iterator = diff_.getRemovals().iterator(); iterator .hasNext();) { - IStatus setterStatus = updateSetStrategy_.doRemove( + IStatus setterStatus = updateSetStrategy_.doRemove_package( destination_, updateSetStrategy_.convert(iterator .next())); @@ -177,7 +181,7 @@ for (Iterator iterator = diff_.getAdditions().iterator(); iterator .hasNext();) { - IStatus setterStatus = updateSetStrategy_.doAdd( + IStatus setterStatus = updateSetStrategy_.doAdd_package( destination_, updateSetStrategy_.convert(iterator .next())); @@ -195,7 +199,7 @@ updatingModel = false; } } - }, destination, diff, updateSetStrategy, clearDestination_)); + }, destination, diff, updateSetStrategy, clearDestination)); } /**
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateListStrategy.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateListStrategy.d Sat Apr 18 13:54:50 2009 +0200 @@ -165,14 +165,17 @@ if (converter !is null) { if (sourceType !is null) { checkAssignable(converter.getFromType(), sourceType, - "converter does not convert from type " + sourceType); //$NON-NLS-1$ + "converter does not convert from type " ~ String_valueOf(sourceType)); //$NON-NLS-1$ } if (destinationType !is null) { checkAssignable(converter.getToType(), destinationType, - "converter does not convert to type " + destinationType); //$NON-NLS-1$ + "converter does not convert to type " ~ String_valueOf(destinationType)); //$NON-NLS-1$ } } } + package void fillDefaults_package(IObservableList source, IObservableList destination) { + fillDefaults(source, destination ); + } /** * @return the update policy @@ -208,11 +211,14 @@ observableList.add(index, element); } catch (Exception ex) { return ValidationStatus.error(BindingMessages - .getStringcast(BindingMessages.VALUEBINDING_ERROR_WHILE_SETTING_VALUE), + .getString(BindingMessages.VALUEBINDING_ERROR_WHILE_SETTING_VALUE), ex); } return Status.OK_STATUS; } + package IStatus doAdd_package(IObservableList observableList, Object element, int index) { + return doAdd(observableList, element, index ); + } /** * Removes the element at the given index from the given observable list. @@ -227,9 +233,12 @@ observableList.remove(index); } catch (Exception ex) { return ValidationStatus.error(BindingMessages - .getStringcast(BindingMessages.VALUEBINDING_ERROR_WHILE_SETTING_VALUE), + .getString(BindingMessages.VALUEBINDING_ERROR_WHILE_SETTING_VALUE), ex); } return Status.OK_STATUS; } + package IStatus doRemove_package(IObservableList observableList, int index) { + return doRemove(observableList, index ); + } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateSetStrategy.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateSetStrategy.d Sat Apr 18 13:54:50 2009 +0200 @@ -22,6 +22,19 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; + /** + * Helper method allowing API evolution of the above constant values. The + * compiler will not inline constant values into client code if values are + * "computed" using this helper. + * + * @param i + * an integer + * @return the same integer + */ + private int notInlined(int i) { + return i; + } + /** * Customizes a {@link Binding} between two * {@link IObservableSet observable sets}. The following behaviors can be @@ -71,19 +84,6 @@ */ public final static int POLICY_UPDATE = notInlined(8); - /** - * Helper method allowing API evolution of the above constant values. The - * compiler will not inline constant values into client code if values are - * "computed" using this helper. - * - * @param i - * an integer - * @return the same integer - */ - private static int notInlined(int i) { - return i; - } - protected IConverter converter; private int updatePolicy; @@ -165,14 +165,17 @@ if (converter !is null) { if (sourceType !is null) { checkAssignable(converter.getFromType(), sourceType, - "converter does not convert from type " + sourceType); //$NON-NLS-1$ + "converter does not convert from type " ~ String_valueOf(sourceType)); //$NON-NLS-1$ } if (destinationType !is null) { checkAssignable(converter.getToType(), destinationType, - "converter does not convert to type " + destinationType); //$NON-NLS-1$ + "converter does not convert to type " ~ String_valueOf(destinationType)); //$NON-NLS-1$ } } } + package void fillDefaults_package(IObservableSet source, IObservableSet destination) { + fillDefaults(source, destination); + } /** * @return the update policy @@ -211,6 +214,9 @@ } return Status.OK_STATUS; } + package IStatus doAdd_package( IObservableSet observableSet, Object element) { + return doAdd(observableSet, element); + } /** * Removes the element at the given index from the given observable list. @@ -230,4 +236,7 @@ } return Status.OK_STATUS; } + package IStatus doRemove_package(IObservableSet observableSet, Object element) { + return doRemove(observableSet, element ); + } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateStrategy.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateStrategy.d Sat Apr 18 13:54:50 2009 +0200 @@ -15,6 +15,7 @@ import org.eclipse.core.databinding.BindingException; import java.lang.all; +import java.nonstandard.RuntimeTraits; import java.math.BigDecimal; import java.math.BigInteger; @@ -71,23 +72,23 @@ private static Map converterMap; - private static ClassInfo autoboxed(ClassInfo clazz) { + private static TypeInfo autoboxed(TypeInfo clazz) { if (clazz is Float.TYPE) - return Float.classinfo; + return typeid(Float); else if (clazz is Double.TYPE) - return Double.classinfo; + return typeid(Double); else if (clazz is Short.TYPE) - return Short.classinfo; + return typeid(Short); else if (clazz is Integer.TYPE) - return Integer.classinfo; + return typeid(Integer); else if (clazz is Long.TYPE) - return Long.classinfo; + return typeid(Long); else if (clazz is Byte.TYPE) - return Byte.classinfo; + return typeid(Byte); else if (clazz is Boolean.TYPE) - return Boolean.classinfo; + return typeid(Boolean); else if (clazz is Character.TYPE) - return Character.classinfo; + return typeid(Character); return clazz; } @@ -98,7 +99,7 @@ if (assignableFromModelToModelConverter !is null && !assignableFromModelToModelConverter.booleanValue()) { throw new BindingException(errorString - + " Expected: " + fromType + ", actual: " + toType); //$NON-NLS-1$//$NON-NLS-2$ + ~ Format(" Expected: {}, actual: {}", fromType, toType)); //$NON-NLS-1$//$NON-NLS-2$ } } @@ -113,49 +114,49 @@ * @return an IConverter, or <code>null</code> if unsuccessful */ protected IConverter createConverter(Object fromType, Object toType) { - if (!( null !is cast(ClassInfo)fromType ) || !( null !is cast(ClassInfo)toType )) { + if (!( null !is cast(TypeInfo)fromType ) || !( null !is cast(TypeInfo)toType )) { return new DefaultConverter(fromType, toType); } - ClassInfo toClass = cast(ClassInfo) toType; - ClassInfo originalToClass = toClass; - if (toClass.isPrimitive()) { + TypeInfo toClass = cast(TypeInfo) toType; + TypeInfo originalToClass = toClass; + if (isJavaPrimitive(toClass)) { toClass = autoboxed(toClass); } - ClassInfo fromClass = cast(ClassInfo) fromType; - ClassInfo originalFromClass = fromClass; - if (fromClass.isPrimitive()) { + TypeInfo fromClass = cast(TypeInfo) fromType; + TypeInfo originalFromClass = fromClass; + if (isJavaPrimitive(fromClass)) { fromClass = autoboxed(fromClass); } - if (!(cast(ClassInfo) toType).isPrimitive() - && toClass.isAssignableFrom(fromClass)) { + if (!isJavaPrimitive(cast(TypeInfo) toType) + && isImplicitly(fromClass, toClass)) { return new IdentityConverter(originalFromClass, originalToClass); } - if ((cast(ClassInfo) fromType).isPrimitive() && (cast(ClassInfo) toType).isPrimitive() - && fromType.equals(toType)) { + if (isJavaPrimitive(cast(TypeInfo) fromType) && isJavaPrimitive(cast(TypeInfo) toType) + && fromType.opEquals(toType)) { return new IdentityConverter(originalFromClass, originalToClass); } Map converterMap = getConverterMap(); - ClassInfo[] supertypeHierarchyFlattened = ClassLookupSupport + TypeInfo[] supertypeHierarchyFlattened = ClassLookupSupport .getTypeHierarchyFlattened(fromClass); for (int i = 0; i < supertypeHierarchyFlattened.length; i++) { - ClassInfo currentFromClass = supertypeHierarchyFlattened[i]; + TypeInfo currentFromClass = supertypeHierarchyFlattened[i]; if (currentFromClass is toType) { // converting to toType is just a widening return new IdentityConverter(fromClass, toClass); } - Pair key = new Pair(getKeyForClass(fromType, currentFromClass), - getKeyForClass(toType, toClass)); + Pair key = new Pair(stringcast(getKeyForClass(fromType, currentFromClass)), + stringcast(getKeyForClass(toType, toClass))); Object converterOrClassname = converterMap.get(key); if ( null !is cast(IConverter)converterOrClassname ) { return cast(IConverter) converterOrClassname; - } else if ( null !is cast(String)converterOrClassname ) { - String classname = cast(String) converterOrClassname; + } else if ( null !is cast(ArrayWrapperString)converterOrClassname ) { + String classname = stringcast( converterOrClassname); ClassInfo converterClass; try { - converterClass = ClassInfo.forName(classname); + converterClass = ClassInfo.find(classname); IConverter result = cast(IConverter) converterClass - .newInstance(); - converterMap.put(key, result); + .create(); + converterMap.put(stringcast(key), cast(Object)result); return result; } catch (Exception e) { Policy @@ -172,7 +173,7 @@ // Since we found no converter yet, try a "downcast" converter; // the IdentityConverter will automatically check the actual types at // runtime. - if (fromClass.isAssignableFrom(toClass)) { + if (isImplicitly(toClass, fromClass)) { return new IdentityConverter(originalFromClass, originalToClass); } return new DefaultConverter(fromType, toType); @@ -258,10 +259,10 @@ new Pair("java.lang.String", INTEGER_TYPE), StringToNumberConverter.toInteger(integerFormat, true)); //$NON-NLS-1$ converterMap .put( - new Pair(INTEGER_TYPE, "java.lang.Integer"), new IdentityConverter(Integer.TYPE, Integer.classinfo)); //$NON-NLS-1$ + new Pair(INTEGER_TYPE, "java.lang.Integer"), new IdentityConverter(Integer.TYPE, typeid(Integer))); //$NON-NLS-1$ converterMap .put( - new Pair(INTEGER_TYPE, "java.lang.Object"), new IdentityConverter(Integer.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(INTEGER_TYPE, "java.lang.Object"), new IdentityConverter(Integer.TYPE, typeid(Object))); //$NON-NLS-1$ converterMap .put( new Pair(INTEGER_TYPE, "java.lang.String"), NumberToStringConverter.fromInteger(integerFormat, true)); //$NON-NLS-1$ @@ -272,13 +273,13 @@ new Pair("java.lang.String", BYTE_TYPE), StringToByteConverter.toByte(integerFormat, true)); //$NON-NLS-1$ converterMap .put( - new Pair(BYTE_TYPE, "java.lang.Byte"), new IdentityConverter(Byte.TYPE, Byte.classinfo)); //$NON-NLS-1$ + new Pair(BYTE_TYPE, "java.lang.Byte"), new IdentityConverter(Byte.TYPE, typeid(Byte))); //$NON-NLS-1$ converterMap .put( new Pair(BYTE_TYPE, "java.lang.String"), IntegerToStringConverter.fromByte(integerFormat, true)); //$NON-NLS-1$ converterMap .put( - new Pair(BYTE_TYPE, "java.lang.Object"), new IdentityConverter(Byte.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(BYTE_TYPE, "java.lang.Object"), new IdentityConverter(Byte.TYPE, typeid(Object))); //$NON-NLS-1$ // Double.TYPE converterMap @@ -290,10 +291,10 @@ converterMap .put( - new Pair(DOUBLE_TYPE, "java.lang.Double"), new IdentityConverter(Double.TYPE, Double.classinfo)); //$NON-NLS-1$ + new Pair(DOUBLE_TYPE, "java.lang.Double"), new IdentityConverter(Double.TYPE, typeid(Double))); //$NON-NLS-1$ converterMap .put( - new Pair(DOUBLE_TYPE, "java.lang.Object"), new IdentityConverter(Double.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(DOUBLE_TYPE, "java.lang.Object"), new IdentityConverter(Double.TYPE, typeid(Object))); //$NON-NLS-1$ // Boolean.TYPE converterMap @@ -301,13 +302,13 @@ new Pair("java.lang.String", BOOLEAN_TYPE), "org.eclipse.core.internal.databinding.conversion.StringToBooleanPrimitiveConverter"); //$NON-NLS-1$ //$NON-NLS-2$ converterMap .put( - new Pair(BOOLEAN_TYPE, "java.lang.Boolean"), new IdentityConverter(Boolean.TYPE, Boolean.classinfo)); //$NON-NLS-1$ + new Pair(BOOLEAN_TYPE, "java.lang.Boolean"), new IdentityConverter(Boolean.TYPE, typeid(Boolean))); //$NON-NLS-1$ converterMap .put( - new Pair(BOOLEAN_TYPE, "java.lang.String"), new ObjectToStringConvertercast(Boolean.TYPE)); //$NON-NLS-1$ + new Pair(BOOLEAN_TYPE, "java.lang.String"), new ObjectToStringConverter(Boolean.TYPE)); //$NON-NLS-1$ converterMap .put( - new Pair(BOOLEAN_TYPE, "java.lang.Object"), new IdentityConverter(Boolean.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(BOOLEAN_TYPE, "java.lang.Object"), new IdentityConverter(Boolean.TYPE, typeid(Object))); //$NON-NLS-1$ // Float.TYPE converterMap @@ -318,10 +319,10 @@ new Pair(FLOAT_TYPE, "java.lang.String"), NumberToStringConverter.fromFloat(numberFormat, true)); //$NON-NLS-1$ converterMap .put( - new Pair(FLOAT_TYPE, "java.lang.Float"), new IdentityConverter(Float.TYPE, Float.classinfo)); //$NON-NLS-1$ + new Pair(FLOAT_TYPE, "java.lang.Float"), new IdentityConverter(Float.TYPE, typeid(Float))); //$NON-NLS-1$ converterMap .put( - new Pair(FLOAT_TYPE, "java.lang.Object"), new IdentityConverter(Float.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(FLOAT_TYPE, "java.lang.Object"), new IdentityConverter(Float.TYPE, typeid(Object))); //$NON-NLS-1$ // Short.TYPE converterMap @@ -329,13 +330,13 @@ new Pair("java.lang.String", SHORT_TYPE), StringToShortConverter.toShort(integerFormat, true)); //$NON-NLS-1$ converterMap .put( - new Pair(SHORT_TYPE, "java.lang.Short"), new IdentityConverter(Short.TYPE, Short.classinfo)); //$NON-NLS-1$ + new Pair(SHORT_TYPE, "java.lang.Short"), new IdentityConverter(Short.TYPE, typeid(Short))); //$NON-NLS-1$ converterMap .put( new Pair(SHORT_TYPE, "java.lang.String"), IntegerToStringConverter.fromShort(integerFormat, true)); //$NON-NLS-1$ converterMap .put( - new Pair(SHORT_TYPE, "java.lang.Object"), new IdentityConverter(Short.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(SHORT_TYPE, "java.lang.Object"), new IdentityConverter(Short.TYPE, typeid(Object))); //$NON-NLS-1$ // Long.TYPE converterMap @@ -346,10 +347,10 @@ new Pair(LONG_TYPE, "java.lang.String"), NumberToStringConverter.fromLong(integerFormat, true)); //$NON-NLS-1$ converterMap .put( - new Pair(LONG_TYPE, "java.lang.Long"), new IdentityConverter(Long.TYPE, Long.classinfo)); //$NON-NLS-1$ + new Pair(LONG_TYPE, "java.lang.Long"), new IdentityConverter(Long.TYPE, typeid(Long))); //$NON-NLS-1$ converterMap .put( - new Pair(LONG_TYPE, "java.lang.Object"), new IdentityConverter(Long.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(LONG_TYPE, "java.lang.Object"), new IdentityConverter(Long.TYPE, typeid(Object))); //$NON-NLS-1$ // Character.TYPE converterMap @@ -357,13 +358,13 @@ new Pair("java.lang.String", CHARACTER_TYPE), StringToCharacterConverter.toCharacter(true)); //$NON-NLS-1$ converterMap .put( - new Pair(CHARACTER_TYPE, "java.lang.Character"), new IdentityConverter(Character.TYPE, Character.classinfo)); //$NON-NLS-1$ + new Pair(CHARACTER_TYPE, "java.lang.Character"), new IdentityConverter(Character.TYPE, typeid(Character))); //$NON-NLS-1$ converterMap .put( new Pair(CHARACTER_TYPE, "java.lang.String"), CharacterToStringConverter.fromCharacter(true)); //$NON-NLS-1$ converterMap .put( - new Pair(CHARACTER_TYPE, "java.lang.Object"), new IdentityConverter(Character.TYPE, Object.classinfo)); //$NON-NLS-1$ + new Pair(CHARACTER_TYPE, "java.lang.Object"), new IdentityConverter(Character.TYPE, typeid(Object))); //$NON-NLS-1$ // Miscellaneous converterMap @@ -411,12 +412,16 @@ return converterMap; } - private static final ClassInfo[] integerClasses = new ClassInfo[] [ Byte.TYPE, - Byte.classinfo, Short.TYPE, Short.classinfo, Integer.TYPE, Integer.classinfo, - Long.TYPE, Long.classinfo, BigInteger.classinfo ]; + private static TypeInfo[] integerClasses; + private static TypeInfo[] floatClasses; + static this(){ + integerClasses = [ Byte.TYPE, + typeid(Byte), Short.TYPE, typeid(Short), Integer.TYPE, typeid(Integer), + Long.TYPE, typeid(Long), typeid(BigInteger) ]; + floatClasses = [ Float.TYPE, + typeid(Float), Double.TYPE, typeid(Double), typeid(BigDecimal) ]; + } - private static final ClassInfo[] floatClasses = new ClassInfo[] [ Float.TYPE, - Float.classinfo, Double.TYPE, Double.classinfo, BigDecimal.classinfo ]; /** * Registers converters to boxed and unboxed types from a list of from @@ -427,20 +432,20 @@ * @param fromTypes */ private static void addNumberToByteConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(Byte.classinfo) && !fromType.equalscast(Byte.TYPE)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (fromType != typeid(Byte) && fromType != Byte.TYPE) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map .put(new Pair(fromName, BYTE_TYPE), new NumberToByteConverter(numberFormat, fromType, true)); map - .put(new Pair(fromName, Byte.classinfo.getName()), + .put(new Pair(fromName, .getName(Byte.classinfo)), new NumberToByteConverter(numberFormat, fromType, false)); } @@ -456,18 +461,18 @@ * @param fromTypes */ private static void addNumberToShortConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(Short.classinfo) && !fromType.equalscast(Short.TYPE)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (fromType != typeid(Short) && fromType != Short.TYPE) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map .put(new Pair(fromName, SHORT_TYPE), new NumberToShortConverter(numberFormat, fromType, true)); - map.put(new Pair(fromName, Short.classinfo.getName()), + map.put(new Pair(fromName, .getName(Short.classinfo)), new NumberToShortConverter(numberFormat, fromType, false)); } @@ -483,18 +488,18 @@ * @param fromTypes */ private static void addNumberToIntegerConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(Integer.classinfo) - && !fromType.equalscast(Integer.TYPE)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (fromType != typeid(Integer) + && fromType != Integer.TYPE) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map.put(new Pair(fromName, INTEGER_TYPE), new NumberToIntegerConverter(numberFormat, fromType, true)); - map.put(new Pair(fromName, Integer.classinfo.getName()), + map.put(new Pair(fromName, .getName(Integer.classinfo)), new NumberToIntegerConverter(numberFormat, fromType, false)); } @@ -510,19 +515,19 @@ * @param fromTypes */ private static void addNumberToLongConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(Long.classinfo) && !fromType.equalscast(Long.TYPE)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (fromType != typeid(Long) && fromType != Long.TYPE) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map .put(new Pair(fromName, LONG_TYPE), new NumberToLongConverter(numberFormat, fromType, true)); map - .put(new Pair(fromName, Long.classinfo.getName()), + .put(new Pair(fromName, .getName(Long.classinfo)), new NumberToLongConverter(numberFormat, fromType, false)); } @@ -538,18 +543,18 @@ * @param fromTypes */ private static void addNumberToFloatConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(Float.classinfo) && !fromType.equalscast(Float.TYPE)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (fromType != typeid(Float) && fromType != Float.TYPE) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map .put(new Pair(fromName, FLOAT_TYPE), new NumberToFloatConverter(numberFormat, fromType, true)); - map.put(new Pair(fromName, Float.classinfo.getName()), + map.put(new Pair(fromName, .getName(Float.classinfo)), new NumberToFloatConverter(numberFormat, fromType, false)); } @@ -565,17 +570,17 @@ * @param fromTypes */ private static void addNumberToDoubleConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(Double.classinfo) && !fromType.equalscast(Double.TYPE)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (fromType != typeid(Double) && fromType != Double.TYPE) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map.put(new Pair(fromName, DOUBLE_TYPE), new NumberToDoubleConverter(numberFormat, fromType, true)); - map.put(new Pair(fromName, Double.classinfo.getName()), + map.put(new Pair(fromName, .getName(Double.classinfo)), new NumberToDoubleConverter(numberFormat, fromType, false)); } @@ -591,15 +596,15 @@ * @param fromTypes */ private static void addNumberToBigIntegerConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(BigInteger.classinfo)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (!fromType.opEquals(typeid(BigInteger))) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map - .put(new Pair(fromName, BigInteger.classinfo.getName()), + .put(new Pair(fromName, .getName(BigInteger.classinfo)), new NumberToBigIntegerConverter(numberFormat, fromType)); } @@ -615,15 +620,15 @@ * @param fromTypes */ private static void addNumberToBigDecimalConverters(Map map, - NumberFormat numberFormat, ClassInfo[] fromTypes) { + NumberFormat numberFormat, TypeInfo[] fromTypes) { for (int i = 0; i < fromTypes.length; i++) { - ClassInfo fromType = fromTypes[i]; - if (!fromType.equals(BigDecimal.classinfo)) { - String fromName = (fromType.isPrimitive()) ? getKeyForClass( - fromType, null) : fromType.getName(); + TypeInfo fromType = fromTypes[i]; + if (!fromType.opEquals(typeid(BigDecimal))) { + String fromName = isJavaPrimitive(fromType) ? getKeyForClass( + fromType, null) : .getName(fromType); map - .put(new Pair(fromName, BigDecimal.classinfo.getName()), + .put(new Pair(fromName, .getName(BigDecimal.classinfo)), new NumberToBigDecimalConverter(numberFormat, fromType)); } @@ -631,26 +636,26 @@ } private static String getKeyForClass(Object originalValue, - ClassInfo filteredValue) { - if ( null !is cast(ClassInfo)originalValue ) { - ClassInfo originalClass = cast(ClassInfo) originalValue; - if (originalClass.equalscast(Integer.TYPE)) { + TypeInfo filteredValue) { + if ( null !is cast(TypeInfo)originalValue ) { + TypeInfo originalClass = cast(TypeInfo) originalValue; + if (originalClass == Integer.TYPE) { return INTEGER_TYPE; - } else if (originalClass.equalscast(Byte.TYPE)) { + } else if (originalClass == Byte.TYPE) { return BYTE_TYPE; - } else if (originalClass.equalscast(Boolean.TYPE)) { + } else if (originalClass == Boolean.TYPE) { return BOOLEAN_TYPE; - } else if (originalClass.equalscast(Double.TYPE)) { + } else if (originalClass == Double.TYPE) { return DOUBLE_TYPE; - } else if (originalClass.equalscast(Float.TYPE)) { + } else if (originalClass == Float.TYPE) { return FLOAT_TYPE; - } else if (originalClass.equalscast(Long.TYPE)) { + } else if (originalClass == Long.TYPE) { return LONG_TYPE; - } else if (originalClass.equalscast(Short.TYPE)) { + } else if (originalClass == Short.TYPE) { return SHORT_TYPE; } } - return filteredValue.getName(); + return .getName(filteredValue); } /** @@ -664,16 +669,16 @@ * if unknown */ protected Boolean isAssignableFromTo(Object fromType, Object toType) { - if ( null !is cast(ClassInfo )fromType && null !is cast(ClassInfo)toType ) { - ClassInfo toClass = cast(ClassInfo) toType; - if (toClass.isPrimitive()) { + if ( null !is cast(TypeInfo)fromType && null !is cast(TypeInfo)toType ) { + TypeInfo toClass = cast(TypeInfo) toType; + if (isJavaPrimitive(toClass)) { toClass = autoboxed(toClass); } - ClassInfo fromClass = cast(ClassInfo) fromType; - if (fromClass.isPrimitive()) { + TypeInfo fromClass = cast(TypeInfo) fromType; + if (isJavaPrimitive(fromClass)) { fromClass = autoboxed(fromClass); } - return toClass.isAssignableFrom(fromClass) ? Boolean.TRUE + return isImplicitly(fromClass, toClass) ? Boolean.TRUE : Boolean.FALSE; } return null;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateValueStrategy.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/UpdateValueStrategy.d Sat Apr 18 13:54:50 2009 +0200 @@ -68,10 +68,10 @@ * <p> * The update phases are: * <ol> - * <li>Validate after get - {@link #validateAfterGetcast(Object)}</li> - * <li>Conversion - {@link #convertcast(Object)}</li> - * <li>Validate after conversion - {@link #validateAfterConvertcast(Object)}</li> - * <li>Validate before set - {@link #validateBeforeSetcast(Object)}</li> + * <li>Validate after get - {@link #validateAfterGet(Object)}</li> + * <li>Conversion - {@link #convert(Object)}</li> + * <li>Validate after conversion - {@link #validateAfterConvert(Object)}</li> + * <li>Validate before set - {@link #validateBeforeSet(Object)}</li> * <li>Value set - {@link #doSet(IObservableValue, Object)}</li> * </ol> * </p> @@ -121,7 +121,7 @@ /** * Policy constant denoting that the source observable's state should be * tracked, including validating changes except for - * {@link #validateBeforeSetcast(Object)}, but that the destination + * {@link #validateBeforeSet(Object)}, but that the destination * observable's value should only be updated on request. */ public static int POLICY_CONVERT = notInlined(4); @@ -154,8 +154,12 @@ private int updatePolicy; - private static ValidatorRegistry validatorRegistry = new ValidatorRegistry(); - private static HashMap validatorsByConverter = new HashMap(); + private static ValidatorRegistry validatorRegistry; + private static HashMap validatorsByConverter; + static this(){ + validatorRegistry = new ValidatorRegistry(); + validatorsByConverter = new HashMap(); + } protected bool provideDefaults; @@ -210,7 +214,7 @@ * Converts the value from the source type to the destination type. * <p> * Default implementation will use the - * {@link #setConvertercast(IConverter) converter} if one exists. If no + * {@link #setConverter(IConverter) converter} if one exists. If no * converter exists no conversion occurs. * </p> * @@ -248,7 +252,7 @@ * and <code>destination</code>. If the strategy is to default values it * will attempt to default a converter. If the converter can be defaulted an * attempt is made to default the - * {@link #validateAfterGetcast(Object) after get validator}. If a validator + * {@link #validateAfterGet(Object) after get validator}. If a validator * cannot be defaulted it will be <code>null</code>. * * @param source @@ -273,14 +277,18 @@ if (converter !is null) { if (sourceType !is null) { checkAssignable(converter.getFromType(), sourceType, - "converter does not convert from type " + sourceType); //$NON-NLS-1$ + Format("converter does not convert from type {}", sourceType)); //$NON-NLS-1$ } if (destinationType !is null) { checkAssignable(converter.getToType(), destinationType, - "converter does not convert to type " + destinationType); //$NON-NLS-1$ + Format("converter does not convert to type {}", destinationType)); //$NON-NLS-1$ } } } + package void fillDefaults_package(IObservableValue source, + IObservableValue destination) { + fillDefaults(source, destination ); + } private IValidator findValidator(Object fromType, Object toType) { IValidator result = null; @@ -288,52 +296,52 @@ // We only default the validator if we defaulted the converter since the // two are tightly coupled. if (defaultedConverter) { - if (String.classinfo.equals(fromType)) { - result = cast(IValidator) validatorsByConverter.get(converter); + if (typeid(StringCls) is fromType) { + result = cast(IValidator) validatorsByConverter.get(cast(Object)converter); if (result is null) { // TODO sring based lookup - if (Integer.classinfo.equals(toType) - || Integer.TYPE.equals(toType)) { + if (typeid(Integer).opEquals(toType) + || Integer.TYPE.opEquals(toType)) { result = new StringToIntegerValidator( cast(NumberFormatConverter) converter); - } else if (Long.classinfo.equals(toType) - || Long.TYPE.equals(toType)) { + } else if (typeid(Long).opEquals(toType) + || Long.TYPE.opEquals(toType)) { result = new StringToLongValidator( cast(NumberFormatConverter) converter); - } else if (Float.classinfo.equals(toType) - || Float.TYPE.equals(toType)) { + } else if (typeid(Float).opEquals(toType) + || Float.TYPE.opEquals(toType)) { result = new StringToFloatValidator( cast(NumberFormatConverter) converter); - } else if (Double.classinfo.equals(toType) - || Double.TYPE.equals(toType)) { + } else if (typeid(Double).opEquals(toType) + || Double.TYPE.opEquals(toType)) { result = new StringToDoubleValidator( cast(NumberFormatConverter) converter); - } else if (Byte.classinfo.equals(toType) - || Byte.TYPE.equals(toType)) { + } else if (typeid(Byte).opEquals(toType) + || Byte.TYPE.opEquals(toType)) { result = new StringToByteValidator( cast(NumberFormatConverter) converter); - } else if (Short.classinfo.equals(toType) - || Short.TYPE.equals(toType)) { + } else if (typeid(Short).opEquals(toType) + || Short.TYPE.opEquals(toType)) { result = new StringToShortValidator( cast(NumberFormatConverter) converter); - } else if (Character.classinfo.equals(toType) - || Character.TYPE.equals(toType) + } else if (typeid(Character).opEquals(toType) + || Character.TYPE.opEquals(toType) && null !is cast(StringToCharacterConverter)converter ) { result = new StringToCharacterValidator( cast(StringToCharacterConverter) converter); - } else if (Date.classinfo.equals(toType) + } else if (typeid(Date).opEquals(toType) && null !is cast(StringToDateConverter)converter ) { result = new StringToDateValidator( cast(StringToDateConverter) converter); } if (result !is null) { - validatorsByConverter.put(converter, result); + validatorsByConverter.put(cast(Object)converter, cast(Object)result); } } } else if ( null !is cast(NumberToNumberConverter)converter ) { - result = cast(IValidator) validatorsByConverter.get(converter); + result = cast(IValidator) validatorsByConverter.get(cast(Object)converter); if (result is null) { if ( null !is cast(NumberToByteConverter)converter ) { @@ -430,7 +438,7 @@ * Validates the value after it is converted. * <p> * Default implementation will use the - * {@link #setAfterConvertValidatorcast(IValidator) validator} if one exists. If + * {@link #setAfterConvertValidator(IValidator) validator} if one exists. If * one does not exist no validation will occur. * </p> * @@ -446,7 +454,7 @@ * Validates the value after it is retrieved from the source. * <p> * Default implementation will use the - * {@link #setAfterGetValidatorcast(IValidator) validator} if one exists. If one + * {@link #setAfterGetValidator(IValidator) validator} if one exists. If one * does not exist no validation will occur. * </p> * @@ -462,7 +470,7 @@ * Validates the value before it is set on the destination. * <p> * Default implementation will use the - * {@link #setBeforeSetValidatorcast(IValidator) validator} if one exists. If + * {@link #setBeforeSetValidator(IValidator) validator} if one exists. If * one does not exist no validation will occur. * </p> * @@ -487,15 +495,18 @@ observableValue.setValue(value); } catch (Exception ex) { return ValidationStatus.error(BindingMessages - .getStringcast(BindingMessages.VALUEBINDING_ERROR_WHILE_SETTING_VALUE), + .getString(BindingMessages.VALUEBINDING_ERROR_WHILE_SETTING_VALUE), ex); } return Status.OK_STATUS; } + package IStatus doSet_package(IObservableValue observableValue, Object value) { + return doSet(observableValue,value); + } private static class ValidatorRegistry { - private HashMap validators = new HashMap(); + private HashMap validators; /** * Adds the system-provided validators to the current validator @@ -503,36 +514,37 @@ * singleton. */ private this() { +validators = new HashMap(); // Standalone validators here... - associate(Integer.classinfo, Integer.TYPE, - new ObjectToPrimitiveValidatorcast(Integer.TYPE)); - associate(Byte.classinfo, Byte.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Integer), Integer.TYPE, + new ObjectToPrimitiveValidator(Integer.TYPE)); + associate(typeid(Byte), Byte.TYPE, new ObjectToPrimitiveValidator( Byte.TYPE)); - associate(Short.classinfo, Short.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Short), Short.TYPE, new ObjectToPrimitiveValidator( Short.TYPE)); - associate(Long.classinfo, Long.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Long), Long.TYPE, new ObjectToPrimitiveValidator( Long.TYPE)); - associate(Float.classinfo, Float.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Float), Float.TYPE, new ObjectToPrimitiveValidator( Float.TYPE)); - associate(Double.classinfo, Double.TYPE, - new ObjectToPrimitiveValidatorcast(Double.TYPE)); - associate(Boolean.classinfo, Boolean.TYPE, - new ObjectToPrimitiveValidatorcast(Boolean.TYPE)); + associate(typeid(Double), Double.TYPE, + new ObjectToPrimitiveValidator(Double.TYPE)); + associate(typeid(Boolean), Boolean.TYPE, + new ObjectToPrimitiveValidator(Boolean.TYPE)); - associate(Object.classinfo, Integer.TYPE, - new ObjectToPrimitiveValidatorcast(Integer.TYPE)); - associate(Object.classinfo, Byte.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Object), Integer.TYPE, + new ObjectToPrimitiveValidator(Integer.TYPE)); + associate(typeid(Object), Byte.TYPE, new ObjectToPrimitiveValidator( Byte.TYPE)); - associate(Object.classinfo, Short.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Object), Short.TYPE, new ObjectToPrimitiveValidator( Short.TYPE)); - associate(Object.classinfo, Long.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Object), Long.TYPE, new ObjectToPrimitiveValidator( Long.TYPE)); - associate(Object.classinfo, Float.TYPE, new ObjectToPrimitiveValidator( + associate(typeid(Object), Float.TYPE, new ObjectToPrimitiveValidator( Float.TYPE)); - associate(Object.classinfo, Double.TYPE, - new ObjectToPrimitiveValidatorcast(Double.TYPE)); - associate(Object.classinfo, Boolean.TYPE, - new ObjectToPrimitiveValidatorcast(Boolean.TYPE)); + associate(typeid(Object), Double.TYPE, + new ObjectToPrimitiveValidator(Double.TYPE)); + associate(typeid(Object), Boolean.TYPE, + new ObjectToPrimitiveValidator(Boolean.TYPE)); } /** @@ -548,7 +560,7 @@ */ private void associate(Object fromClass, Object toClass, IValidator validator) { - validators.put(new Pair(fromClass, toClass), validator); + validators.put(new Pair(fromClass, toClass), cast(Object)validator); } /**
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/ValueBinding.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/ValueBinding.d Sat Apr 18 13:54:50 2009 +0200 @@ -40,14 +40,16 @@ private bool updatingTarget; private bool updatingModel; - private IValueChangeListener targetChangeListener = new class() IValueChangeListener { + private IValueChangeListener targetChangeListener; + class TargetChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { if (!updatingTarget && !Util.equals(event.diff.getOldValue(), event.diff.getNewValue())) { doUpdate(target, model, targetToModel, false, false); } } }; - private IValueChangeListener modelChangeListener = new class() IValueChangeListener { + private IValueChangeListener modelChangeListener; + class ModelChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { if (!updatingModel && !Util.equals(event.diff.getOldValue(), event.diff.getNewValue())) { doUpdate(model, target, modelToTarget, false, false); @@ -64,6 +66,8 @@ public this(IObservableValue targetObservableValue, IObservableValue modelObservableValue, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget) { +targetChangeListener = new TargetChangeListener(); +modelChangeListener = new ModelChangeListener(); super(targetObservableValue, modelObservableValue); this.target = targetObservableValue; this.model = modelObservableValue; @@ -83,7 +87,7 @@ protected void preInit() { validationStatusObservable = new WritableValue(context - .getValidationRealm(), Status.OK_STATUS, IStatus.classinfo); + .getValidationRealm(), cast(Object) Status.OK_STATUS, typeid(IStatus)); } protected void postInit() { @@ -189,7 +193,7 @@ } try { IStatus setterStatus = updateValueStrategy__ - .doSet(destination__, convertedValue); + .doSet_package(destination__, convertedValue); mergeStatus(multiStatus, setterStatus); } finally { @@ -204,8 +208,8 @@ } catch (Exception ex) { // This check is necessary as in 3.2.2 Status // doesn't accept a null message (bug 177264). - String message = (ex.getMessage() !is null) ? ex - .getMessage() : ""; //$NON-NLS-1$ + String message = (ex.msg !is null) ? ex + .msg : ""; //$NON-NLS-1$ mergeStatus(multiStatus, new Status(IStatus.ERROR, Policy.JFACE_DATABINDING, IStatus.ERROR, message, @@ -229,7 +233,7 @@ private void setValidationStatus( IStatus status) { validationStatusObservable.getRealm().exec(dgRunnable((IStatus status_) { - validationStatusObservable.setValue(status_); + validationStatusObservable.setValue(cast(Object)status_); }, status)); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/NumberToStringConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/NumberToStringConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,6 +13,7 @@ import org.eclipse.core.databinding.conversion.Converter; import java.lang.all; +import java.nonstandard.RuntimeTraits; import java.math.BigInteger; @@ -26,7 +27,7 @@ */ public class NumberToStringConverter : Converter { private final NumberFormat numberFormat; - private final ClassInfo fromType; + private final TypeInfo fromType; private bool fromTypeIsLong; private bool fromTypeIsDecimalType; private bool fromTypeIsBigInteger; @@ -40,20 +41,20 @@ * @param numberFormat * @param fromType */ - private this(NumberFormat numberFormat, ClassInfo fromType) { - super(fromType, String.classinfo); + private this(NumberFormat numberFormat, TypeInfo fromType) { + super(fromType, typeid(StringCls)); this.numberFormat = numberFormat; this.fromType = fromType; - if (Integer.classinfo.equals(fromType) || Integer.TYPE.equals(fromType) - || Long.classinfo.equals(fromType) || Long.TYPE.equals(fromType)) { + if (typeid(Integer) is fromType || Integer.TYPE is fromType + || typeid(Long) is (fromType) || Long.TYPE is (fromType)) { fromTypeIsLong = true; - } else if (Float.classinfo.equals(fromType) || Float.TYPE.equals(fromType) - || Double.classinfo.equals(fromType) - || Double.TYPE.equals(fromType)) { + } else if (typeid(Float) is (fromType) || Float.TYPE is (fromType) + || typeid(Double) is (fromType) + || Double.TYPE is (fromType)) { fromTypeIsDecimalType = true; - } else if (BigInteger.classinfo.equals(fromType)) { + } else if (typeid(BigInteger) is (fromType)) { fromTypeIsBigInteger = true; } } @@ -71,8 +72,8 @@ */ public Object convert(Object fromObject) { // Null is allowed when the type is not primitve. - if (fromObject is null && !fromType.isPrimitive()) { - return ""; //$NON-NLS-1$ + if (fromObject is null && !isJavaPrimitive(fromType)) { + return stringcast(""); //$NON-NLS-1$ } Number number = cast(Number) fromObject; @@ -91,7 +92,7 @@ } } - return result; + return stringcast(result); } /** @@ -111,7 +112,7 @@ public static NumberToStringConverter fromDouble(NumberFormat numberFormat, bool primitive) { return new NumberToStringConverter(numberFormat, - (primitive) ? Double.TYPE : Double.classinfo); + (primitive) ? Double.TYPE : typeid(Double)); } /** @@ -131,7 +132,7 @@ public static NumberToStringConverter fromLong(NumberFormat numberFormat, bool primitive) { return new NumberToStringConverter(numberFormat, - (primitive) ? Long.TYPE : Long.classinfo); + (primitive) ? Long.TYPE : typeid(Long)); } /** @@ -151,7 +152,7 @@ public static NumberToStringConverter fromFloat(NumberFormat numberFormat, bool primitive) { return new NumberToStringConverter(numberFormat, - (primitive) ? Float.TYPE : Float.classinfo); + (primitive) ? Float.TYPE : typeid(Float)); } /** @@ -171,7 +172,7 @@ public static NumberToStringConverter fromInteger( NumberFormat numberFormat, bool primitive) { return new NumberToStringConverter(numberFormat, - (primitive) ? Integer.TYPE : Integer.classinfo); + (primitive) ? Integer.TYPE : typeid(Integer)); } /** @@ -187,6 +188,6 @@ */ public static NumberToStringConverter fromBigInteger( NumberFormat numberFormat) { - return new NumberToStringConverter(numberFormat, BigInteger.classinfo); + return new NumberToStringConverter(numberFormat, typeid(BigInteger)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/StringToNumberConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/conversion/StringToNumberConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,12 +12,12 @@ module org.eclipse.core.databinding.conversion.StringToNumberConverter; import java.lang.all; +import java.nonstandard.RuntimeTraits; import java.math.BigDecimal; import java.math.BigInteger; import org.eclipse.core.internal.databinding.conversion.StringToNumberParser; -import org.eclipse.core.internal.databinding.conversion.StringToNumberParser.ParseResult; import org.eclipse.core.internal.databinding.validation.NumberFormatConverter; import com.ibm.icu.text.NumberFormat; @@ -29,7 +29,7 @@ * @since 1.0 */ public class StringToNumberConverter : NumberFormatConverter { - private ClassInfo toType; + private TypeInfo toType; /** * NumberFormat instance to use for conversion. Access must be synchronized. */ @@ -49,19 +49,33 @@ /** * The boxed type of the toType; */ - private final ClassInfo boxedType; + private final TypeInfo boxedType; + + private static const Integer MIN_INTEGER; + private static const Integer MAX_INTEGER; - private static final Integer MIN_INTEGER = new Integercast(Integer.MIN_VALUE); - private static final Integer MAX_INTEGER = new Integercast(Integer.MAX_VALUE); + private static const Double MIN_DOUBLE; + private static const Double MAX_DOUBLE; + + private static const Long MIN_LONG; + private static const Long MAX_LONG; + + private static const Float MIN_FLOAT; + private static const Float MAX_FLOAT; - private static final Double MIN_DOUBLE = new Double(-Double.MAX_VALUE); - private static final Double MAX_DOUBLE = new Doublecast(Double.MAX_VALUE); + static this(){ + MIN_INTEGER = new Integer(Integer.MIN_VALUE); + MAX_INTEGER = new Integer(Integer.MAX_VALUE); + + MIN_DOUBLE = new Double(-Double.MAX_VALUE); + MAX_DOUBLE = new Double(Double.MAX_VALUE); - private static final Long MIN_LONG = new Longcast(Long.MIN_VALUE); - private static final Long MAX_LONG = new Longcast(Long.MIN_VALUE); + MIN_LONG = new Long(Long.MIN_VALUE); + MAX_LONG = new Long(Long.MIN_VALUE); - private static final Float MIN_FLOAT = new Float(-Float.MAX_VALUE); - private static final Float MAX_FLOAT = new Floatcast(Float.MAX_VALUE); + MIN_FLOAT = new Float(-Float.MAX_VALUE); + MAX_FLOAT = new Float(Float.MAX_VALUE); + } /** * @param numberFormat @@ -76,9 +90,9 @@ * a convenience that allows for the checking against one type * rather than boxed and unboxed types */ - private this(NumberFormat numberFormat, ClassInfo toType, - Number min, Number max, ClassInfo boxedType) { - super(String.classinfo, toType, numberFormat); + private this(NumberFormat numberFormat, TypeInfo toType, + Number min, Number max, TypeInfo boxedType) { + super(typeid(StringCls), toType, numberFormat); this.toType = toType; this.numberFormat = numberFormat; @@ -100,15 +114,15 @@ * if conversion was not possible */ public Object convert(Object fromObject) { - ParseResult result = StringToNumberParser.parse(fromObject, - numberFormat, toType.isPrimitive()); + StringToNumberParser.ParseResult result = StringToNumberParser.parse(fromObject, + numberFormat, isJavaPrimitive(toType)); if (result.getPosition() !is null) { // this shouldn't happen in the pipeline as validation should catch // it but anyone can call convert so we should return a properly // formatted message in an exception throw new IllegalArgumentException(StringToNumberParser - .createParseErrorMessage(cast(String) fromObject, result + .createParseErrorMessage(stringcast(fromObject), result .getPosition())); } else if (result.getNumber() is null) { // if an error didn't occur and the number is null then it's a boxed @@ -121,23 +135,23 @@ * validator should have validated this already but we shouldn't assume * this has occurred. */ - if (Integer.classinfo.equals(boxedType)) { + if (typeid(Integer) is (boxedType)) { if (StringToNumberParser.inIntegerRange(result.getNumber())) { return new Integer(result.getNumber().intValue()); } - } else if (Double.classinfo.equals(boxedType)) { + } else if (typeid(Double) is (boxedType)) { if (StringToNumberParser.inDoubleRange(result.getNumber())) { return new Double(result.getNumber().doubleValue()); } - } else if (Long.classinfo.equals(boxedType)) { + } else if (typeid(Long) is (boxedType)) { if (StringToNumberParser.inLongRange(result.getNumber())) { return new Long(result.getNumber().longValue()); } - } else if (Float.classinfo.equals(boxedType)) { + } else if (typeid(Float) is (boxedType)) { if (StringToNumberParser.inFloatRange(result.getNumber())) { return new Float(result.getNumber().floatValue()); } - } else if (BigInteger.classinfo.equals(boxedType)) { + } else if (typeid(BigInteger) is (boxedType)) { return (new BigDecimal(result.getNumber().doubleValue())) .toBigInteger(); } @@ -152,7 +166,7 @@ * exception is better than returning null and hiding the error. */ throw new IllegalArgumentException( - "Could not convert [" + fromObject + "] to type [" + toType + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Format("Could not convert [{}] to type [{}]", fromObject, toType)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } /** @@ -172,8 +186,8 @@ public static StringToNumberConverter toInteger(NumberFormat numberFormat, bool primitive) { return new StringToNumberConverter(numberFormat, - (primitive) ? Integer.TYPE : Integer.classinfo, MIN_INTEGER, - MAX_INTEGER, Integer.classinfo); + (primitive) ? Integer.TYPE : typeid(Integer), MIN_INTEGER, + MAX_INTEGER, typeid(Integer)); } /** @@ -193,8 +207,8 @@ public static StringToNumberConverter toDouble(NumberFormat numberFormat, bool primitive) { return new StringToNumberConverter(numberFormat, - (primitive) ? Double.TYPE : Double.classinfo, MIN_DOUBLE, - MAX_DOUBLE, Double.classinfo); + (primitive) ? Double.TYPE : typeid(Double), MIN_DOUBLE, + MAX_DOUBLE, typeid(Double)); } /** @@ -214,8 +228,8 @@ public static StringToNumberConverter toLong(NumberFormat numberFormat, bool primitive) { return new StringToNumberConverter(numberFormat, - (primitive) ? Long.TYPE : Long.classinfo, MIN_LONG, MAX_LONG, - Long.classinfo); + (primitive) ? Long.TYPE : typeid(Long), MIN_LONG, MAX_LONG, + typeid(Long)); } /** @@ -235,8 +249,8 @@ public static StringToNumberConverter toFloat(NumberFormat numberFormat, bool primitive) { return new StringToNumberConverter(numberFormat, - (primitive) ? Float.TYPE : Float.classinfo, MIN_FLOAT, MAX_FLOAT, - Float.classinfo); + (primitive) ? Float.TYPE : typeid(Float), MIN_FLOAT, MAX_FLOAT, + typeid(Float)); } /** @@ -251,7 +265,7 @@ * @return to BigInteger converter with the provided numberFormat */ public static StringToNumberConverter toBigInteger(NumberFormat numberFormat) { - return new StringToNumberConverter(numberFormat, BigInteger.classinfo, - null, null, BigInteger.classinfo); + return new StringToNumberConverter(numberFormat, typeid(BigInteger), + null, null, typeid(BigInteger)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/AbstractObservable.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/AbstractObservable.d Sat Apr 18 13:54:50 2009 +0200 @@ -29,6 +29,9 @@ * @since 1.0 */ public abstract class AbstractObservable : ChangeManager , IObservable { + public override Realm getRealm(){ + return super.getRealm(); + } /** * @param realm
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ChangeEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ChangeEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,8 +30,11 @@ /** * */ - private static final long serialVersionUID = -3241193109844979384L; - static final Object TYPE = new Object(); + private static const long serialVersionUID = -3241193109844979384L; + static const Object TYPE; + static this(){ + TYPE = new Object(); + } /** * Creates a new change event object.
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ChangeManager.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ChangeManager.d Sat Apr 18 13:54:50 2009 +0200 @@ -67,7 +67,7 @@ listenerTypes[length] = listenerType; listenerLists[length] = new ListenerList(); bool hadListeners = hasListeners(); - listenerLists[length].add(listener); + listenerLists[length].add(cast(Object)listener); if (!hadListeners) { this.firstListenerAdded(); } @@ -78,7 +78,7 @@ if (listenerList.size() is 0) { hadListeners = hasListeners(); } - listenerList.add(listener); + listenerList.add(cast(Object)listener); if (!hadListeners) { firstListenerAdded(); } @@ -92,7 +92,7 @@ IObservablesListener listener) { int listenerTypeIndex = findListenerTypeIndex(listenerType); if (listenerTypeIndex !is -1) { - listenerLists[listenerTypeIndex].remove(listener); + listenerLists[listenerTypeIndex].remove(cast(Object)listener); if (listenerLists[listenerTypeIndex].size() is 0) { if (!hasListeners()) { this.lastListenerRemoved(); @@ -125,13 +125,13 @@ } protected void fireEvent(ObservableEvent event) { - Object listenerType = event.getListenerType(); + Object listenerType = event.getListenerType_package(); int listenerTypeIndex = findListenerTypeIndex(listenerType); if (listenerTypeIndex !is -1) { Object[] listeners = listenerLists[listenerTypeIndex] .getListeners(); for (int i = 0; i < listeners.length; i++) { - event.dispatch(cast(IObservablesListener) listeners[i]); + event.dispatch_package(cast(IObservablesListener) listeners[i]); } } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/Diffs.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/Diffs.d Sat Apr 18 13:54:50 2009 +0200 @@ -22,7 +22,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.Map.Entry; import org.eclipse.core.databinding.observable.list.ListDiff; import org.eclipse.core.databinding.observable.list.ListDiffEntry; @@ -66,7 +65,7 @@ do { done = true; Object oldValue = oldList.get(index); - if (oldValue is null ? newValue !is null : !oldValue.equals(newValue)) { + if (oldValue is null ? newValue !is null : !oldValue.opEquals(newValue)) { int oldIndexOfNewValue = listIndexOf(oldList, newValue, index); if (oldIndexOfNewValue !is -1) { int newIndexOfOldValue = listIndexOf(newList, oldValue, index); @@ -122,7 +121,7 @@ int size = list.size(); for (int i=index; i<size;i++) { Object candidate = list.get(i); - if (candidateisnull ? objectisnull : candidate.equals(object)) { + if (candidate is null ? object is null : candidate.opEquals(object)) { return i; } } @@ -142,7 +141,7 @@ */ public static final bool equals(Object left, Object right) { return left is null ? right is null : ((right !is null) && left - .equals(right)); + .opEquals(right)); } /** @@ -175,7 +174,7 @@ final Map oldValues = new HashMap(); final Map newValues = new HashMap(); for (Iterator it = oldMap.entrySet().iterator(); it.hasNext();) { - Map.Entry oldEntry = cast(Entry) it.next(); + Map.Entry oldEntry = cast(Map.Entry) it.next(); Object oldKey = oldEntry.getKey(); if (addedKeys.remove(oldKey)) { // potentially changed key since it is in oldMap and newMap @@ -223,6 +222,18 @@ * @param newValue * @return a value diff */ + public static ValueDiff createValueDiff(String oldValue, + Object newValue) { + return createValueDiff( stringcast(oldValue), newValue ); + } + public static ValueDiff createValueDiff(Object oldValue, + String newValue) { + return createValueDiff( oldValue, stringcast(newValue) ); + } + public static ValueDiff createValueDiff(String oldValue, + String newValue) { + return createValueDiff( stringcast(oldValue), stringcast(newValue) ); + } public static ValueDiff createValueDiff(Object oldValue, Object newValue) { return new class(oldValue, newValue) ValueDiff {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ObservableEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ObservableEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -33,7 +33,7 @@ * @param source */ public this(IObservable source) { - super(source); + super(cast(Object)source); } /** @@ -59,6 +59,9 @@ * the listener that should handle the event */ protected abstract void dispatch(IObservablesListener listener); + package void dispatch_package(IObservablesListener listener){ + dispatch(listener); + } /** * Returns a unique object used for distinguishing this event type from @@ -67,5 +70,8 @@ * @return a unique object representing the concrete type of this event. */ protected abstract Object getListenerType(); + package Object getListenerType_package(){ + return getListenerType(); + } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ObservableTracker.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/ObservableTracker.d Sat Apr 18 13:54:50 2009 +0200 @@ -70,11 +70,17 @@ * changes the current value, it remembers the old value as a local variable * and restores the old value when the method exits. */ - private static ThreadLocal currentChangeListener = new ThreadLocal(); + private static ThreadLocal currentChangeListener; + + private static ThreadLocal currentStaleListener; + + private static ThreadLocal currentObservableSet; - private static ThreadLocal currentStaleListener = new ThreadLocal(); - - private static ThreadLocal currentObservableSet = new ThreadLocal(); + static this(){ +currentChangeListener = new ThreadLocal(); +currentStaleListener = new ThreadLocal(); +currentObservableSet = new ThreadLocal(); + } /** * Invokes the given runnable, and returns the set of IObservables that were @@ -102,17 +108,17 @@ Set observableSet = new HashSet(); // Push the new listeners to the top of the stack - currentObservableSet.set(observableSet); - currentChangeListener.set(changeListener); - currentStaleListener.set(staleListener); + currentObservableSet.set(cast(Object)observableSet); + currentChangeListener.set(cast(Object)changeListener); + currentStaleListener.set(cast(Object)staleListener); try { runnable.run(); } finally { // Pop the new listener off the top of the stack (by restoring the // previous listener) - currentObservableSet.set(lastObservableSet); - currentChangeListener.set(lastChangeListener); - currentStaleListener.set(lastStaleListener); + currentObservableSet.set(cast(Object)lastObservableSet); + currentChangeListener.set(cast(Object)lastChangeListener); + currentStaleListener.set(cast(Object)lastStaleListener); } int i = 0; @@ -146,9 +152,9 @@ } finally { // Pop the new listener off the top of the stack (by restoring the // previous listener) - currentObservableSet.set(lastObservableSet); - currentChangeListener.set(lastChangeListener); - currentStaleListener.set(lastStaleListener); + currentObservableSet.set(cast(Object)lastObservableSet); + currentChangeListener.set(cast(Object)lastChangeListener); + currentStaleListener.set(cast(Object)lastStaleListener); } } @@ -158,8 +164,8 @@ * recursion and stack overflow. */ private static String toString(IObservable observable) { - return observable.getClass().getName() + "@" //$NON-NLS-1$ - + Integer.toHexString(System.identityHashCode(observable)); + return observable.classinfo.name ~ "@" //$NON-NLS-1$ + ~ Integer.toHexString(System.identityHashCode(cast(Object)observable)); } /** @@ -176,10 +182,10 @@ Realm realm = observable.getRealm(); if (realm is null) // observable.isDisposed() would be more appropriate if it existed Assert.isTrue(false, "Getter called on disposed observable " //$NON-NLS-1$ - + toString(observable)); + ~ toString(observable)); if (!realm.isCurrent()) Assert.isTrue(false, "Getter called outside realm of observable " //$NON-NLS-1$ - + toString(observable)); + ~ toString(observable)); Set lastObservableSet = cast(Set) currentObservableSet.get(); if (lastObservableSet is null) { @@ -192,7 +198,7 @@ bool added = false; if (lastObservableSet !is null) { - added = lastObservableSet.add(new IdentityWrapper(observable)); + added = lastObservableSet.add(new IdentityWrapper(cast(Object)observable)); } // If anyone is listening for observable usage...
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/Observables.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/Observables.d Sat Apr 18 13:54:50 2009 +0200 @@ -64,7 +64,7 @@ */ public static IObservableValue unmodifiableObservableValue( IObservableValue value) { - Assert.isNotNull(value, "Argument 'value' cannot be null"); //$NON-NLS-1$ + Assert.isNotNull(cast(Object)value, "Argument 'value' cannot be null"); //$NON-NLS-1$ return new UnmodifiableObservableValue(value); } @@ -278,7 +278,7 @@ * @return an observable set backed by the given set */ public static IObservableSet staticObservableSet(Set set) { - return staticObservableSet(Realm.getDefault(), set, Object.classinfo); + return staticObservableSet(Realm.getDefault(), set, typeid(Object)); } /** @@ -307,7 +307,7 @@ * @return an observable set backed by the given unchanging set */ public static IObservableSet staticObservableSet(Realm realm, Set set) { - return staticObservableSet(realm, set, Object.classinfo); + return staticObservableSet(realm, set, typeid(Object)); } /** @@ -326,6 +326,7 @@ public static IObservableSet staticObservableSet(Realm realm, Set set, Object elementType) { return new class(realm, set, elementType) ObservableSet { + this(Realm r, Set s, Object e ){ super(r, s, e);} public void addChangeListener(IChangeListener listener) { } @@ -372,7 +373,7 @@ * @return an observable list backed by the given unchanging list */ public static IObservableList staticObservableList(List list) { - return staticObservableList(Realm.getDefault(), list, Object.classinfo); + return staticObservableList(Realm.getDefault(), list, typeid(Object)); } /** @@ -402,7 +403,7 @@ * @return an observable list backed by the given unchanging list */ public static IObservableList staticObservableList(Realm realm, List list) { - return staticObservableList(realm, list, Object.classinfo); + return staticObservableList(realm, list, typeid(Object)); } /** @@ -421,6 +422,7 @@ public static IObservableList staticObservableList(Realm realm, List list, Object elementType) { return new class(realm, list, elementType) ObservableList { + this(Realm r, List s, Object e ){ super(r, s, e);} public void addChangeListener(IChangeListener listener) { } @@ -488,7 +490,7 @@ */ public static IObservableFactory mapEntryValueFactory( IObservableMap map, Object valueType) { - return new class() IObservableFactory { + return new class(map, valueType) IObservableFactory { IObservableMap map_; Object valueType_; this(IObservableMap a, Object b){
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/Realm.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/Realm.d Sat Apr 18 13:54:50 2009 +0200 @@ -78,7 +78,13 @@ */ public abstract class Realm { - private static ThreadLocal defaultRealm = new ThreadLocal(); + private static ThreadLocal defaultRealm; + static this(){ + defaultRealm = new ThreadLocal(); + } + this(){ + workQueue = new Queue(); + } /** * Returns the default realm for the calling thread, or <code>null</code> @@ -115,7 +121,7 @@ private Thread workerThread; - Queue workQueue = new Queue(); + Queue workQueue; /** * Runs the given runnable. If an exception occurs within the runnable, it @@ -141,7 +147,7 @@ IStatus.ERROR, Policy.JFACE_DATABINDING, IStatus.OK, - "Unhandled exception: " + exception.getMessage(), exception)); //$NON-NLS-1$ + "Unhandled exception: " ~ exception.msg, exception)); //$NON-NLS-1$ } public void run() { runnable_.run(); @@ -191,7 +197,7 @@ public void asyncExec(Runnable runnable) { synchronized (workQueue) { ensureWorkerThreadIsRunning(); - workQueue.enqueue(runnable); + workQueue.enqueue(cast(Object)runnable); workQueue.notifyAll(); } } @@ -275,6 +281,12 @@ } } } + void notifyAll(){ + implMissing( __FILE__, __LINE__ ); + } + void wait(){ + implMissing( __FILE__, __LINE__ ); + } } /**
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/StaleEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/StaleEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -45,9 +45,12 @@ /** * */ - private static final long serialVersionUID = 3491012225431471077L; + private static const long serialVersionUID = 3491012225431471077L; - static final Object TYPE = new Object(); + static const Object TYPE; + static this(){ + TYPE = new Object(); + } protected void dispatch(IObservablesListener listener) { (cast(IStaleListener) listener).handleStale(this);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/AbstractObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/AbstractObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,6 +25,8 @@ import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; +import java.util.ListIterator; +import java.util.List; import org.eclipse.core.databinding.observable.ChangeEvent; import org.eclipse.core.databinding.observable.ChangeSupport; @@ -50,7 +52,42 @@ */ public abstract class AbstractObservableList : AbstractList , IObservableList { - + public Object set(int index, Object element){ + return super.set( index, element ); + } + public Object remove(int index){ + return super.remove(index); + } + public bool remove(Object o){ + return super.remove(o); + } + public bool remove(String o){ + return super.remove(o); + } + public void add(int index, Object element){ + return super.add(index, element); + } + public bool add(Object o){ + return super.add(o); + } + public bool add(String o){ + return super.add(o); + } + public ListIterator listIterator(){ + return super.listIterator(); + } + public ListIterator listIterator(int index){ + return super.listIterator(index); + } + public void clear(){ + super.clear(); + } + public int opApply (int delegate(ref Object value) dg){ + return super.opApply(dg); + } + public List subList(int fromIndex, int toIndex){ + return super.subList( fromIndex, toIndex ); + } private ChangeSupport changeSupport; /** @@ -60,6 +97,7 @@ public this(Realm realm) { Assert.isNotNull(realm, "Realm cannot be null"); //$NON-NLS-1$ changeSupport = new class(realm) ChangeSupport { + this(Realm r){super(r);} protected void firstListenerAdded() { this.outer.firstListenerAdded(); } @@ -192,6 +230,7 @@ }; } + public Object[] toArray() { getterCalled(); return super.toArray(); @@ -202,9 +241,15 @@ return super.toArray(a); } + public String[] toArray(String a[]) { + getterCalled(); + return super.toArray(a); + } + // Modification Operations - public bool add(Object o) { + public alias AbstractList.add add; + public override bool add(Object o) { getterCalled(); return super.add(o); } @@ -237,16 +282,17 @@ int size = doGetSize(); if (oldIndex < 0 || oldIndex >= size) throw new IndexOutOfBoundsException( - "oldIndex: " + oldIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("oldIndex: {}, size:{}", oldIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ if (newIndex < 0 || newIndex >= size) throw new IndexOutOfBoundsException( - "newIndex: " + newIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("newIndex: {}, size:{}", newIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ Object element = remove(oldIndex); add(newIndex, element); return element; } - public bool remove(Object o) { + public alias AbstractList.remove remove; + public override bool remove(Object o) { getterCalled(); return super.remove(o); } @@ -280,14 +326,14 @@ // Comparison and hashing - public override bool opEquals(Object o) { + public override equals_t opEquals(Object o) { getterCalled(); - return super.equals(o); + return super.opEquals(o); } - public int hashCode() { + public hash_t toHash() { getterCalled(); - return super.hashCode(); + return super.toHash(); } public int indexOf(Object o) {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ComputedList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ComputedList.d Sat Apr 18 13:54:50 2009 +0200 @@ -43,12 +43,12 @@ * @since 1.1 */ public abstract class ComputedList : AbstractObservableList { - private List cachedList = new ArrayList(); + private List cachedList; private bool dirty = true; private bool stale = false; - private IObservable[] dependencies = new IObservable[0]; + private IObservable[] dependencies; /** * Creates a computed list in the default realm and with an unknown (null) @@ -93,6 +93,8 @@ * unknown element type */ public this(Realm realm, Object elementType) { +cachedList = new ArrayList(); +privateInterface = new PrivateInterface(); super(realm); this.elementType = elementType; } @@ -136,7 +138,7 @@ } } - private PrivateInterface privateInterface = new PrivateInterface(); + private PrivateInterface privateInterface; private Object elementType;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/IObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/IObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -39,7 +39,8 @@ * @since 1.0 */ public interface IObservableList : List, IObservableCollection { - + alias List.add add; + /** * Adds the given list change listener to the list of list change listeners. * @param listener @@ -122,12 +123,12 @@ /** * @TrackedGetter */ - public bool opEquals(Object o); + public equals_t opEquals(Object o); /** * @TrackedGetter */ - public int hashCode(); + public hash_t toHash(); /** * @TrackedGetter
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ListChangeEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ListChangeEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,9 +30,12 @@ /** * */ - private static final long serialVersionUID = -9154315534258776672L; + private static const long serialVersionUID = -9154315534258776672L; - static final Object TYPE = new Object(); + static const Object TYPE; + static this(){ + TYPE = new Object(); + } /** * Description of the change to the source observable list. Listeners must
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ListDiff.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ListDiff.d Sat Apr 18 13:54:50 2009 +0200 @@ -15,6 +15,7 @@ import org.eclipse.core.databinding.observable.list.ListDiffVisitor; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.internal.databinding.Util; @@ -93,7 +94,7 @@ public String toString() { ListDiffEntry[] differences = getDifferences(); StringBuffer buffer = new StringBuffer(); - buffer.append(getClass().getName()); + buffer.append(.getName( this.classinfo )); if (differences is null || differences.length is 0) { buffer
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ListDiffEntry.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ListDiffEntry.d Sat Apr 18 13:54:50 2009 +0200 @@ -41,7 +41,7 @@ public String toString() { StringBuffer buffer = new StringBuffer(); buffer - .append(this.getClass().getName()) + .append(this.classinfo.name) .append("{position [") //$NON-NLS-1$ .append(getPosition()) .append("], isAddition [") //$NON-NLS-1$
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -46,6 +46,38 @@ public abstract class ObservableList : AbstractObservable , IObservableList { +// DWT start: additional methods in List + public bool add(String o) { + return add(stringcast(o)); + } + public bool remove(String o) { + return remove(stringcast(o)); + } + public bool contains(String o) { + return contains(stringcast(o)); + } + public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; + } + public String[] toArray( String[] a ){ + auto d = toArray(); + if( a.length < d.length ){ + a.length = d.length; + } + for( int i = 0; i < d.length; i++ ){ + a[i] = stringcast(d[i]); + } + return a; + } +// DWT end: additional methods in List +// DWT start: reimpl +// DWT end: reimpl protected List wrappedList; /** @@ -89,14 +121,14 @@ return wrappedList.containsAll(c); } - public override bool opEquals(Object o) { + public override equals_t opEquals(Object o) { getterCalled(); - return wrappedList.equals(o); + return wrappedList.opEquals(o); } - public int hashCode() { + public hash_t toHash() { getterCalled(); - return wrappedList.hashCode(); + return wrappedList.toHash(); } public bool isEmpty() { @@ -212,6 +244,9 @@ return wrappedIterator.previous(); } + public void add(String o) { + throw new UnsupportedOperationException(); + } public void add(Object o) { throw new UnsupportedOperationException(); } @@ -232,7 +267,7 @@ int fromIndex_; int toIndex_; this( Realm r, int f, int t){ super(r); - fromIndex_ = r; + fromIndex_ = f; toIndex_ = t; } @@ -286,10 +321,10 @@ int size = wrappedList.size(); if (oldIndex < 0 || oldIndex >= size) throw new IndexOutOfBoundsException( - "oldIndex: " + oldIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("oldIndex: {}, size:{}", oldIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ if (newIndex < 0 || newIndex >= size) throw new IndexOutOfBoundsException( - "newIndex: " + newIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("newIndex: {}, size:{}", newIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ Object element = remove(oldIndex); add(newIndex, element); return element;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/WritableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/WritableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -100,10 +100,10 @@ int size = wrappedList.size(); if (oldIndex < 0 || oldIndex >= size) throw new IndexOutOfBoundsException( - "oldIndex: " + oldIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("oldIndex: {}, size:{}", oldIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ if (newIndex < 0 || newIndex >= size) throw new IndexOutOfBoundsException( - "newIndex: " + newIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("newIndex: {}, size:{}", newIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ if (oldIndex is newIndex) return wrappedList.get(oldIndex); Object element = wrappedList.remove(oldIndex); @@ -114,7 +114,7 @@ return element; } - public Object remove(int index) { + public override Object remove(int index) { checkRealm(); Object oldElement = wrappedList.remove(index); fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry(index, @@ -167,7 +167,8 @@ return added; } - public bool remove(Object o) { + public alias ObservableList.remove remove; + public override bool remove(Object o) { checkRealm(); int index = wrappedList.indexOf(o); if (index is -1) {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/AbstractObservableMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/AbstractObservableMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -20,6 +20,7 @@ import java.lang.all; import java.util.AbstractMap; +import java.util.Set; import org.eclipse.core.databinding.observable.ChangeEvent; import org.eclipse.core.databinding.observable.ChangeSupport; @@ -42,6 +43,41 @@ public abstract class AbstractObservableMap : AbstractMap , IObservableMap { + // DWT start reimplement + public override int size(){ + return super.size(); + } + public override bool isEmpty(){ + return super.isEmpty(); + } + public override bool containsKey(Object o){ + return super.containsKey(o); + } + public override bool containsValue(Object o){ + return super.containsValue(o); + } + public override Object get(Object o){ + return super.get(o); + } + public override Object put(Object key, Object value){ + return super.put(key, value); + } + public override equals_t opEquals(Object o){ + return super.opEquals(o); + } + public override hash_t toHash(){ + return super.toHash(); + } + public override Object remove(Object o){ + return super.remove(o); + } + public override Set keySet(){ + return super.keySet(); + } + public override Set values(){ + return super.values(); + } + // DWT end reimplement private ChangeSupport changeSupport; private bool stale; @@ -70,6 +106,7 @@ public this(Realm realm) { Assert.isNotNull(realm, "Realm cannot be null"); //$NON-NLS-1$ changeSupport = new class(realm) ChangeSupport { + this(Realm r){ super(r);} protected void firstListenerAdded() { this.outer.firstListenerAdded(); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/BidirectionalMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/BidirectionalMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -38,9 +38,10 @@ */ public class BidirectionalMap : ObservableMap { - private Map valueToElements = new HashMap(); + private Map valueToElements; - private IMapChangeListener mapListener = new class() IMapChangeListener { + private IMapChangeListener mapListener; + class MapListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { MapDiff diff = event.diff; @@ -65,6 +66,8 @@ * @param wrappedMap */ public this(IObservableMap wrappedMap) { +valueToElements = new HashMap(); +mapListener = new MapListener(); super(wrappedMap.getRealm(), wrappedMap); wrappedMap.addMapChangeListener(mapListener); for (Iterator it = wrappedMap.entrySet().iterator(); it.hasNext();) {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/CompositeMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/CompositeMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -50,24 +50,25 @@ */ public class CompositeMap : ObservableMap { - private Map valueToElements = new HashMap(); + private Map valueToElements; // adds that need to go through the second map and thus will be picked up by // secondMapListener. - private Set pendingAdds = new HashSet(); + private Set pendingAdds; // Removes that need to go through the second map and thus will be picked up // by // secondMapListener. Maps from value being removed to key being removed. - private Map pendingRemoves = new HashMap(); + private Map pendingRemoves; // Changes that need to go through the second map and thus will be picked up // by // secondMapListener. Maps from old value to new value and new value to old // value. - private Map pendingChanges = new HashMap(); + private Map pendingChanges; - private IMapChangeListener firstMapListener = new class() IMapChangeListener { + private IMapChangeListener firstMapListener; + class FirstMapListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { MapDiff diff = event.diff; @@ -158,7 +159,8 @@ } }; - private IMapChangeListener secondMapListener = new class() IMapChangeListener { + private IMapChangeListener secondMapListener; + class SecondMapListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { MapDiff diff = event.diff; @@ -278,7 +280,7 @@ } } - private WritableSetPlus rangeSet = new WritableSetPlus(); + private WritableSetPlus rangeSet; /** * Creates a new composite map. Because the key set of the second map is @@ -295,6 +297,13 @@ */ public this(IObservableMap firstMap, IObservableFactory secondMapFactory) { +valueToElements = new HashMap(); +pendingAdds = new HashSet(); +pendingRemoves = new HashMap(); +pendingChanges = new HashMap(); +firstMapListener = new FirstMapListener(); +secondMapListener = new SecondMapListener(); +rangeSet = new WritableSetPlus(); super(firstMap.getRealm(), new HashMap()); this.firstMap = firstMap; firstMap.addMapChangeListener(firstMapListener);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/ComputedObservableMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/ComputedObservableMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -33,9 +33,10 @@ */ public abstract class ComputedObservableMap : AbstractObservableMap { - private final IObservableSet keySet; + private final IObservableSet fkeySet; - private ISetChangeListener setChangeListener = new class() ISetChangeListener { + private ISetChangeListener setChangeListener; + class SetChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { Set addedKeys = new HashSet(event.diff.getAdditions()); Set removedKeys = new HashSet(event.diff.getRemovals()); @@ -60,7 +61,7 @@ } }; - private Set entrySet = new EntrySet(); + private Set fentrySet; private class EntrySet : AbstractSet { @@ -69,7 +70,7 @@ final Iterator keyIterator; this(){ - keyIterator = keySet.iterator(); + keyIterator = fkeySet.iterator(); } public bool hasNext() { @@ -94,6 +95,16 @@ public Object setValue(Object value) { return put(getKey(), value); } + + public override equals_t opEquals(Object o){ + implMissing( __FILE__, __LINE__ ); + return 0; + } + public override hash_t toHash(){ + implMissing( __FILE__, __LINE__ ); + return 0; + } + }; } @@ -104,22 +115,27 @@ } public int size() { - return keySet.size(); + return fkeySet.size(); } + public override String toString(){ + return super.toString(); + } } /** * @param keySet */ - public this(IObservableSet keySet) { - super(keySet.getRealm()); - this.keySet = keySet; - this.keySet.addSetChangeListener(setChangeListener); + public this(IObservableSet _keySet) { +setChangeListener = new SetChangeListener(); +fentrySet = new EntrySet(); + super(_keySet.getRealm()); + this.fkeySet = _keySet; + this.fkeySet.addSetChangeListener(setChangeListener); } protected void init() { - for (Iterator it = this.keySet.iterator(); it.hasNext();) { + for (Iterator it = this.fkeySet.iterator(); it.hasNext();) { Object key = it.next(); hookListener(key); } @@ -131,11 +147,11 @@ } public Set entrySet() { - return entrySet; + return fentrySet; } public Set keySet() { - return keySet; + return fkeySet; } final public Object get(Object key) {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/IObservableMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/IObservableMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -101,10 +101,10 @@ /** * @TrackedGetter */ - public bool opEquals(Object o); + public equals_t opEquals(Object o); /** * @TrackedGetter */ - public int hashCode(); + public hash_t toHash(); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/MapChangeEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/MapChangeEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -31,8 +31,11 @@ /** * */ - private static final long serialVersionUID = -8092347212410548463L; - static final Object TYPE = new Object(); + private static const long serialVersionUID = -8092347212410548463L; + static const Object TYPE; + static this(){ + TYPE = new Object(); + } /** * Description of the change to the source observable map. Listeners must
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/ObservableMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/ObservableMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -22,6 +22,8 @@ import java.util.Map; import java.util.Set; +import org.eclipse.core.databinding.observable.IChangeListener; +import org.eclipse.core.databinding.observable.IStaleListener; import org.eclipse.core.databinding.observable.AbstractObservable; import org.eclipse.core.databinding.observable.ObservableTracker; import org.eclipse.core.databinding.observable.Realm; @@ -36,6 +38,71 @@ * @since 1.0 */ public class ObservableMap : AbstractObservable , IObservableMap { + // DWT start: java.util.Map additional methods + public bool containsKey(String key) { + return containsKey(stringcast(key)); + } + public Object get(String key){ + return get(stringcast(key)); + } + public Object put(String key, Object value){ + return put(stringcast(key), value); + } + public Object put(Object key, String value){ + return put(key, stringcast(value)); + } + public Object put(String key, String value){ + return put(stringcast(key), stringcast(value)); + } + public Object remove(String key){ + return remove(stringcast(key)); + } + public int opApply (int delegate(ref Object value) dg){ + foreach( entry; entrySet() ){ + auto me = cast(Map.Entry)entry; + auto v = me.getValue(); + int res = dg( v ); + if( res ) return res; + } + return 0; + } + public int opApply (int delegate(ref Object key, ref Object value) dg){ + foreach( entry; entrySet() ){ + auto me = cast(Map.Entry)entry; + auto k = me.getKey(); + auto v = me.getValue(); + int res = dg( k, v ); + if( res ) return res; + } + return 0; + } + // DWT end: java.util.Map additional methods + // DWT start reimpl super meths + public override Realm getRealm() { + return super.getRealm(); + } + public override void addChangeListener(IChangeListener listener) { + super.addChangeListener(listener); + } + public override void addStaleListener(IStaleListener listener) { + super.addStaleListener(listener); + } + public override void removeChangeListener(IChangeListener listener) { + super.removeChangeListener(listener); + } + public override void removeStaleListener(IStaleListener listener) { + super.removeStaleListener(listener); + } + public override hash_t toHash(){ + return super.toHash(); + } + public equals_t opEquals( Object o){ + if( ObservableMap other = cast(ObservableMap)o){ + return cast(equals_t)entrySet().opEquals( cast(Object) other.entrySet() ); + } + return false; + } + // DWT end reimpl super meths protected Map wrappedMap;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/WritableMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/map/WritableMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -62,7 +62,7 @@ checkRealm(); Object result = wrappedMap.put(key, value); if (!Util.equals(result, value)) { - if (resultisnull) { + if (result is null) { fireMapChange(Diffs.createMapDiffSingleAdd(key, value)); } else { fireMapChange(Diffs.createMapDiffSingleChange(key, result, @@ -106,7 +106,7 @@ for (Iterator it = map.entrySet().iterator(); it.hasNext();) { Map.Entry entry = cast(Entry) it.next(); Object previousValue = wrappedMap.put(entry.getKey(), entry.getValue()); - if (previousValueisnull) { + if (previousValue is null) { addedKeys.add(entry.getKey()); } else { changes.put(entry.getKey(), previousValue);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/AbstractObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/AbstractObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -41,6 +41,26 @@ */ public abstract class AbstractObservableSet : AbstractObservable , IObservableSet { +// DWT start: additional methods in Set + public bool add(String o) { + return add(stringcast(o)); + } + public bool remove(String o) { + return remove(stringcast(o)); + } + public bool contains(String o) { + return contains(stringcast(o)); + } + public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; + } +// DWT end: additional methods in Set private ChangeSupport changeSupport; @@ -61,6 +81,7 @@ protected this(Realm realm) { super(realm); changeSupport = new class(realm) ChangeSupport { + this(Realm r){ super(r); } protected void firstListenerAdded() { this.outer.firstListenerAdded(); } @@ -97,14 +118,14 @@ return getWrappedSet().containsAll(c); } - public override bool opEquals(Object o) { + public override equals_t opEquals(Object o) { getterCalled(); - return getWrappedSet().equals(o); + return getWrappedSet().opEquals(o); } - public int hashCode() { + public override hash_t toHash() { getterCalled(); - return getWrappedSet().hashCode(); + return getWrappedSet().toHash(); } public bool isEmpty() {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/IObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/IObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -122,11 +122,11 @@ /** * @TrackedGetter */ - bool opEquals(Object o); + equals_t opEquals(Object o); /** * @TrackedGetter */ - int hashCode(); + hash_t toHash(); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/ListToSetAdapter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/ListToSetAdapter.d Sat Apr 18 13:54:50 2009 +0200 @@ -41,7 +41,8 @@ private final IObservableList list; - private IListChangeListener listener = new class() IListChangeListener { + private IListChangeListener listener; + class Listener_ : IListChangeListener { public void handleListChange(ListChangeEvent event) { Set added = new HashSet(); @@ -70,6 +71,7 @@ * @param list */ public this(IObservableList list) { +listener = new Listener_(); super(list.getRealm(), new HashSet(), list.getElementType()); this.list = list; wrappedSet.addAll(list);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/MappedSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/MappedSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -49,9 +49,10 @@ /* * Map from values (range elements) to Integer ref counts */ - private Map valueCounts = new HashMap(); + private Map valueCounts; - private ISetChangeListener domainListener = new class() ISetChangeListener { + private ISetChangeListener domainListener; + class DomainListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { Set additions = new HashSet(); for (Iterator it = event.diff.getAdditions().iterator(); it.hasNext();) { @@ -73,7 +74,8 @@ } }; - private IMapChangeListener mapChangeListener = new class() IMapChangeListener { + private IMapChangeListener mapChangeListener; + class MapChangeListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { MapDiff diff = event.diff; Set additions = new HashSet(); @@ -114,7 +116,10 @@ * @param map */ public this(IObservableSet input, IObservableMap map) { - super(input.getRealm(), Collections.EMPTY_SET, Object.classinfo); +valueCounts = new HashMap(); +domainListener = new DomainListener(); +mapChangeListener = new MapChangeListener(); + super(input.getRealm(), Collections.EMPTY_SET, typeid(Object)); setWrappedSet(valueCounts.keySet()); this.wrappedMap = map; this.input = input;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/ObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/ObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -41,7 +41,27 @@ */ public abstract class ObservableSet : AbstractObservable , IObservableSet { +// DWT start: additional methods in Set + public bool add(String o) { + return add(stringcast(o)); + } + public bool remove(String o) { + return remove(stringcast(o)); + } + public bool contains(String o) { + return contains(stringcast(o)); + } + public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; + } +// DWT end: additional methods in Set protected Set wrappedSet; private bool stale = false; @@ -83,14 +103,14 @@ return wrappedSet.containsAll(c); } - public override bool opEquals(Object o) { + public override equals_t opEquals(Object o) { getterCalled(); - return wrappedSet.equals(o); + return wrappedSet.opEquals(o); } - public int hashCode() { + public hash_t toHash() { getterCalled(); - return wrappedSet.hashCode(); + return wrappedSet.toHash(); } public bool isEmpty() {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/SetChangeEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/SetChangeEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -31,8 +31,11 @@ /** * */ - private static final long serialVersionUID = 7436547103857482256L; - static final Object TYPE = new Object(); + private static const long serialVersionUID = 7436547103857482256L; + static const Object TYPE; + static this(){ + TYPE = new Object(); + } /** * Description of the change to the source observable set. Listeners must
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/SetDiff.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/SetDiff.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ module org.eclipse.core.databinding.observable.set.SetDiff; import java.lang.all; +import java.nonstandard.RuntimeTraits; import java.util.Set; @@ -37,7 +38,7 @@ public String toString() { StringBuffer buffer = new StringBuffer(); buffer - .append(getClass().getName()) + .append(.getName(this.classinfo)) .append("{additions [") //$NON-NLS-1$ .append(getAdditions() !is null ? getAdditions().toString() : "null") //$NON-NLS-1$ .append("], removals [") //$NON-NLS-1$
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/UnionSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/set/UnionSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -14,6 +14,7 @@ import org.eclipse.core.databinding.observable.set.ISetChangeListener; import org.eclipse.core.databinding.observable.set.SetChangeEvent; import org.eclipse.core.databinding.observable.set.IObservableSet; +import org.eclipse.core.databinding.observable.IObservable; import org.eclipse.core.databinding.observable.set.ObservableSet; import java.lang.all; @@ -66,18 +67,25 @@ */ public this(IObservableSet[] childSets) { super(childSets[0].getRealm(), null, childSets[0].getElementType()); - System.arraycopy(childSets, 0, this.childSets = new IObservableSet[childSets.length], 0, childSets.length); - this.stalenessTracker = new StalenessTracker(childSets, +childSetChangeListener = new ChildSetChangeListener(); +stalenessConsumer = new StalenessConsumer(); + this.childSets = new IObservableSet[childSets.length]; + for( int i = 0; i < childSets.length; i++ ){ + this.childSets[i] = childSets[i]; + } + this.stalenessTracker = new StalenessTracker(arraycast!(IObservable)(childSets), stalenessConsumer); } - private ISetChangeListener childSetChangeListener = new class() ISetChangeListener { + private ISetChangeListener childSetChangeListener; + class ChildSetChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { processAddsAndRemoves(event.diff.getAdditions(), event.diff.getRemovals()); } - }; + } - private IStalenessConsumer stalenessConsumer = new class() IStalenessConsumer { + private IStalenessConsumer stalenessConsumer; + class StalenessConsumer : IStalenessConsumer { public void setStale(bool stale) { bool oldStale = this.outer.stale; this.outer.stale = stale; @@ -85,7 +93,7 @@ fireStale(); } } - }; + } public bool isStale() { getterCalled(); @@ -154,7 +162,7 @@ next.addSetChangeListener(childSetChangeListener); incrementRefCounts(next); } - stalenessTracker = new StalenessTracker(childSets, stalenessConsumer); + stalenessTracker = new StalenessTracker(arraycast!(IObservable)(childSets), stalenessConsumer); setWrappedSet(refCounts.keySet()); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/AbstractObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/AbstractObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -56,7 +56,8 @@ removeListener(ValueChangeEvent.TYPE, listener); } - final public void setValue(Object value) { + // DWT remove final for reimpl delegation + /+final+/ public void setValue(Object value) { checkRealm(); doSetValue(value); } @@ -77,7 +78,8 @@ fireEvent(new ValueChangeEvent(this, diff)); } - public final Object getValue() { + // DWT remove final for reimpl delegation + public /+final+/ Object getValue() { getterCalled(); return doGetValue(); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ComputedValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ComputedValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -79,6 +79,7 @@ * @param valueType */ public this(Realm realm, Object valueType) { +privateInterface = new PrivateInterface(); super(realm); this.valueType = valueType; } @@ -122,7 +123,7 @@ } } - private PrivateInterface privateInterface = new PrivateInterface(); + private PrivateInterface privateInterface; private Object valueType;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueChangeEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueChangeEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -31,9 +31,12 @@ /** * */ - private static final long serialVersionUID = 2305345286999701156L; + private static const long serialVersionUID = 2305345286999701156L; - static final Object TYPE = new Object(); + static const Object TYPE; + static this(){ + TYPE = new Object(); + } /** * Description of the change to the source observable value. Listeners must
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueChangingEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueChangingEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -32,9 +32,12 @@ /** * */ - private static final long serialVersionUID = 2305345286999701156L; + private static const long serialVersionUID = 2305345286999701156L; - static final Object TYPE = new Object(); + static const Object TYPE; + static this(){ + TYPE = new Object(); + } /** * Description of the change to the source observable value. Listeners must
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueDiff.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/ValueDiff.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ module org.eclipse.core.databinding.observable.value.ValueDiff; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.databinding.observable.Diffs; @@ -36,7 +37,7 @@ */ public abstract Object getNewValue(); - public override bool opEquals(Object obj) { + public override equals_t opEquals(Object obj) { if ( null !is cast(ValueDiff)obj ) { ValueDiff val = cast(ValueDiff) obj; @@ -47,13 +48,13 @@ return false; } - public int hashCode() { + public hash_t toHash() { final int prime = 31; int result = 1; Object nv = getNewValue(); Object ov = getOldValue(); - result = prime * result + ((nv is null) ? 0 : nv.hashCode()); - result = prime * result + ((ov is null) ? 0 : ov.hashCode()); + result = prime * result + ((nv is null) ? 0 : nv.toHash()); + result = prime * result + ((ov is null) ? 0 : ov.toHash()); return result; } @@ -63,7 +64,7 @@ public String toString() { StringBuffer buffer = new StringBuffer(); buffer - .append(getClass().getName()) + .append(.getName(this.classinfo)) .append("{oldValue [") //$NON-NLS-1$ .append(getOldValue() !is null ? getOldValue().toString() : "null") //$NON-NLS-1$ .append("], newValue [") //$NON-NLS-1$
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/WritableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/WritableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -93,7 +93,7 @@ if (this.value is null && value !is null) { changed = true; - } else if (this.value !is null && !this.value.equals(value)) { + } else if (this.value !is null && !this.value.opEquals(value)) { changed = true; }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/util/Policy.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/util/Policy.d Sat Apr 18 13:54:50 2009 +0200 @@ -45,9 +45,9 @@ private static ILogger getDummyLog() { return new class() ILogger { public void log(IStatus status) { - System.err.println(status.getPlugin() + " - " + status.getCode() + " - " + status.getMessage()); //$NON-NLS-1$//$NON-NLS-2$ + getDwtLogger().error( __FILE__, __LINE__, "{} - {} - {}", status.getPlugin(), status.getCode(), status.getMessage()); //$NON-NLS-1$//$NON-NLS-2$ if( status.getException() !is null ) { - status.getException().printStackTrace(System.err); + ExceptionPrintStackTrace(status.getException()); } } };
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/validation/MultiValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/validation/MultiValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -124,7 +124,8 @@ private IObservableList unmodifiableTargets; private IObservableList models; - IListChangeListener targetsListener = new class() IListChangeListener { + IListChangeListener targetsListener; + class TargetsListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { event.diff.accept(new class() ListDiffVisitor { public void handleAdd(int index, Object element) { @@ -140,7 +141,8 @@ } }; - private IChangeListener dependencyListener = new class() IChangeListener { + private IChangeListener dependencyListener; + class DependencyListener : IChangeListener { public void handleChange(ChangeEvent event) { revalidate(); } @@ -160,13 +162,15 @@ * the realm on which validation takes place. */ public this(Realm realm) { +targetsListener = new TargetsListener(); +dependencyListener = new DependencyListener(); Assert.isNotNull(realm, "Realm cannot be null"); //$NON-NLS-1$ this.realm = realm; - validationStatus = new WritableValue(realm, ValidationStatus.ok(), - IStatus.classinfo); + validationStatus = new WritableValue(realm, cast(Object)ValidationStatus.ok(), + typeid(IStatus)); - targets = new WritableList(realm, new ArrayList(), IObservable.classinfo); + targets = new WritableList(realm, new ArrayList(), typeid(IObservable)); targets.addListChangeListener(targetsListener); unmodifiableTargets = Observables.unmodifiableObservableList(targets); @@ -174,9 +178,9 @@ } private void checkObservable(IObservable target) { - Assert.isNotNull(target, "Target observable cannot be null"); //$NON-NLS-1$ + Assert.isNotNull(cast(Object)target, "Target observable cannot be null"); //$NON-NLS-1$ Assert - .isTrue(realm.equals(target.getRealm()), + .isTrue(cast(bool)realm.opEquals(target.getRealm()), "Target observable must be in the same realm as MultiValidator"); //$NON-NLS-1$ } @@ -205,11 +209,11 @@ IStatus status = validate(); if (status is null) status = ValidationStatus.ok(); - validationStatus.setValue(status); + validationStatus.setValue(cast(Object)status); } catch (RuntimeException e) { // Usually an NPE as dependencies are // init'ed - validationStatus.setValue(ValidationStatus.error(e + validationStatus.setValue(cast(Object)ValidationStatus.error(e .getMessage(), e)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/databinding/validation/ValidationStatus.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/databinding/validation/ValidationStatus.d Sat Apr 18 13:54:50 2009 +0200 @@ -111,9 +111,9 @@ /* * (non-Javadoc) * - * @see java.lang.Object#hashCode() + * @see java.lang.Object#toHash() */ - public int hashCode() { + public hash_t toHash() { final int prime = 31; int result = 1; @@ -121,10 +121,10 @@ int severity = getSeverity(); Throwable throwable = getException(); - result = prime * result + ((message is null) ? 0 : message.hashCode()); + result = prime * result + ((message is null) ? 0 : String_toHash(message)); result = prime * result + severity; result = prime * result - + ((throwable is null) ? 0 : throwable.hashCode()); + + ((throwable is null) ? 0 : throwable.toHash()); return result; } @@ -133,12 +133,12 @@ * * @see java.lang.Object#equals(java.lang.Object) */ - public override bool opEquals(Object obj) { + public override equals_t opEquals(Object obj) { if (this is obj) return true; if (obj is null) return false; - if (getClass() !is obj.getClass()) + if (this.classinfo !is obj.classinfo) return false; final ValidationStatus other = cast(ValidationStatus) obj; @@ -147,12 +147,12 @@ if (getMessage() is null) { if (other.getMessage() !is null) return false; - } else if (!getMessage().equals(other.getMessage())) + } else if (getMessage() != other.getMessage()) return false; if (getException() is null) { if (other.getException() !is null) return false; - } else if (!getException().equals(other.getException())) + } else if (!getException().opEquals(other.getException())) return false; return true; }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/Activator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/Activator.d Sat Apr 18 13:54:50 2009 +0200 @@ -44,7 +44,7 @@ } public void start(BundleContext context) { - _frameworkLogTracker = new ServiceTracker(context, FrameworkLog.classinfo.getName(), null); + _frameworkLogTracker = new ServiceTracker(context, FrameworkLog.classinfo.name, null); _frameworkLogTracker.open(); Policy.setLog(new class() ILogger { @@ -56,9 +56,9 @@ log.log(createLogEntry(status)); } else { // fall back to System.err - System.err.println(status.getPlugin() + " - " + status.getCode() + " - " + status.getMessage()); //$NON-NLS-1$//$NON-NLS-2$ + getDwtLogger().error(__FILE__, __LINE__, "{} - {} - {}", status.getPlugin(), status.getCode(), status.getMessage()); //$NON-NLS-1$//$NON-NLS-2$ if( status.getException() !is null ) { - status.getException().printStackTrace(System.err); + ExceptionPrintStackTrace(status.getException()); } } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/BindingMessages.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/BindingMessages.d Sat Apr 18 13:54:50 2009 +0200 @@ -27,8 +27,11 @@ /** * The Binding resource bundle; eagerly initialized. */ - private static final ResourceBundle bundle = ResourceBundle - .getBundle("org.eclipse.core.internal.databinding.messages"); //$NON-NLS-1$ + private static ResourceBundle bundle; + static this() { + bundle = ResourceBundle.getBundle( + getImportData!("org.eclipse.core.internal.databinding.messages.properties")); //$NON-NLS-1$ + } /** * Key to be used for an index out of range message.
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/BindingStatus.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/BindingStatus.d Sat Apr 18 13:54:50 2009 +0200 @@ -72,31 +72,32 @@ return new BindingStatus(Policy.JFACE_DATABINDING, 0, "", null); //$NON-NLS-1$ } - private static int hashCode(Object[] array) { + private static hash_t toHash(IStatus[] array) { final int prime = 31; if (array is null) return 0; int result = 1; for (int index = 0; index < array.length; index++) { + auto obj = cast(Object)array[index]; result = prime * result - + (array[index] is null ? 0 : array[index].hashCode()); + + (obj is null ? 0 : obj.toHash()); } return result; } - public int hashCode() { + public hash_t toHash() { final int prime = 31; int result = 1; - result = prime * result + BindingStatus.hashCode(getChildren()); + result = prime * result + BindingStatus.toHash(getChildren()); return result; } - public override bool opEquals(Object obj) { + public override equals_t opEquals(Object obj) { if (this is obj) return true; if (obj is null) return false; - if (getClass() !is obj.getClass()) + if (this.classinfo !is obj.classinfo) return false; final BindingStatus other = cast(BindingStatus) obj; if (!Arrays.equals(getChildren(), other.getChildren()))
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/ClassLookupSupport.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/ClassLookupSupport.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ module org.eclipse.core.internal.databinding.ClassLookupSupport; import java.lang.all; +import java.nonstandard.RuntimeTraits; import java.util.ArrayList; import java.util.Collection; @@ -37,7 +38,7 @@ * @param type * @return an array containing the given type and all its direct and indirect supertypes */ - public static ClassInfo[] getTypeHierarchyFlattened(ClassInfo type) { + public static TypeInfo[] getTypeHierarchyFlattened(TypeInfo type) { List classes = null; //cache reference to lookup to protect against concurrent flush HashMap lookup = classSearchOrderLookup; @@ -49,9 +50,9 @@ computeClassOrder(type, classes); if (lookup is null) classSearchOrderLookup = lookup = new HashMap(); - lookup.put(type, classes); + lookup.put(type, cast(Object)classes); } - return cast(ClassInfo[]) classes.toArray(new ClassInfo[classes.size()]); + return cast(TypeInfo[]) classes.toArray(new TypeInfo[classes.size()]); } /** @@ -64,20 +65,20 @@ * Note that it is important to maintain a consistent class and interface * lookup order. See the class comment for more details. */ - private static void computeClassOrder(ClassInfo adaptable, Collection classes) { - ClassInfo clazz = adaptable; + private static void computeClassOrder(TypeInfo adaptable, Collection classes) { + TypeInfo clazz = adaptable; Set seen = new HashSet(4); while (clazz !is null) { classes.add(clazz); - computeInterfaceOrder(clazz.getInterfaces(), classes, seen); - clazz = clazz.isInterface() ? Object.classinfo : clazz.getSuperclass(); + computeInterfaceOrder(getInterfaces(clazz), classes, seen); + clazz = isInterface(clazz) ? typeid(Object) : getSuperclass(clazz); } } - private static void computeInterfaceOrder(ClassInfo[] interfaces, Collection classes, Set seen) { + private static void computeInterfaceOrder(TypeInfo[] interfaces, Collection classes, Set seen) { List newInterfaces = new ArrayList(interfaces.length); for (int i = 0; i < interfaces.length; i++) { - ClassInfo interfac = interfaces[i]; + TypeInfo interfac = interfaces[i]; if (seen.add(interfac)) { //note we cannot recurse here without changing the resulting interface order classes.add(interfac); @@ -85,7 +86,7 @@ } } for (Iterator it = newInterfaces.iterator(); it.hasNext();) - computeInterfaceOrder((cast(ClassInfo) it.next()).getInterfaces(), classes, seen); + computeInterfaceOrder(getInterfaces(cast(TypeInfo) it.next()), classes, seen); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/IdentityWrapper.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/IdentityWrapper.d Sat Apr 18 13:54:50 2009 +0200 @@ -16,7 +16,7 @@ /** * Used for wrapping objects that define their own implementations of equals() - * and hashCode() when putting them in sets or hashmaps to ensure identity + * and toHash() when putting them in sets or hashmaps to ensure identity * comparison. * * @since 1.0 @@ -39,14 +39,14 @@ return o; } - public override bool opEquals(Object obj) { - if (obj is null || obj.getClass() !is IdentityWrapper.classinfo) { + public override equals_t opEquals(Object obj) { + if (obj is null || obj.classinfo !is IdentityWrapper.classinfo) { return false; } return o is (cast(IdentityWrapper) obj).o; } - public int hashCode() { + public hash_t toHash() { return System.identityHashCode(o); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/Pair.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/Pair.d Sat Apr 18 13:54:50 2009 +0200 @@ -34,36 +34,45 @@ * @param a a in the pair (a, b) * @param b b in the pair (a, b) */ + public this(String a, String b) { + this(stringcast(a), stringcast(b)); + } + public this(Object a, String b) { + this(a, stringcast(b)); + } + public this(String a, Object b) { + this(stringcast(a), b); + } public this(Object a, Object b) { this.a = a; this.b = b; } - public int hashCode() { + public override hash_t toHash() { final int prime = 31; int result = 1; - result = prime * result + ((a is null) ? 0 : a.hashCode()); - result = prime * result + ((b is null) ? 0 : b.hashCode()); + result = prime * result + ((a is null) ? 0 : a.toHash()); + result = prime * result + ((b is null) ? 0 : b.toHash()); return result; } - public override bool opEquals(Object obj) { + public override equals_t opEquals(Object obj) { if (this is obj) return true; if (obj is null) return false; - if (getClass() !is obj.getClass()) + if (this.classinfo !is obj.classinfo) return false; Pair other = cast(Pair) obj; if (a is null) { if (other.a !is null) return false; - } else if (!a.equals(other.a)) + } else if (!a.opEquals(other.a)) return false; if (b is null) { if (other.b !is null) return false; - } else if (!b.equals(other.b)) + } else if (!b.opEquals(other.b)) return false; return true; }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/Queue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/Queue.d Sat Apr 18 13:54:50 2009 +0200 @@ -20,6 +20,13 @@ */ public class Queue { + void notifyAll(){ + implMissing( __FILE__, __LINE__ ); + } + void wait(){ + implMissing( __FILE__, __LINE__ ); + } + static class Entry { Object object;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/RandomAccessListIterator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/RandomAccessListIterator.d Sat Apr 18 13:54:50 2009 +0200 @@ -48,6 +48,9 @@ public void add(Object arg0) { delegate_.add(arg0); } + public void add(String arg0) { + add(stringcast(arg0)); + } /* (non-Javadoc) * @see java.util.ListIterator#hasNext()
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/ValidationStatusMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/ValidationStatusMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -42,9 +42,10 @@ private final WritableList bindings; - private List dependencies = new ArrayList(); + private List dependencies; - private IChangeListener markDirtyChangeListener = new class() IChangeListener { + private IChangeListener markDirtyChangeListener; + class MarkDirtyChangeListener : IChangeListener { public void handleChange(ChangeEvent event) { markDirty(); } @@ -55,6 +56,8 @@ * @param bindings */ public this(Realm realm, WritableList bindings) { +markDirtyChangeListener = new MarkDirtyChangeListener(); +dependencies = new ArrayList(); super(realm, new HashMap()); this.bindings = bindings; bindings.addChangeListener(markDirtyChangeListener); @@ -117,11 +120,11 @@ Binding binding = cast(Binding) it.next(); IObservableValue validationError = binding .getValidationStatus(); - dependencies.add(validationError); + dependencies.add(cast(Object)validationError); validationError.addChangeListener(markDirtyChangeListener); IStatus validationStatusValue = cast(IStatus) validationError .getValue(); - newContents.put(binding, validationStatusValue); + newContents.put(binding, cast(Object)validationStatusValue); } wrappedMap.putAll(newContents); isDirty = false;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/CharacterToStringConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/CharacterToStringConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,7 +25,7 @@ * @param primitive */ private this(bool primitive) { - super(primitive ? Character.TYPE : Character.classinfo, String.classinfo); + super(primitive ? Character.TYPE : typeid(Character), typeid(StringCls)); this.primitive = primitive; } @@ -40,7 +40,7 @@ if (primitive) throw new IllegalArgumentException( "'fromObject' is null. Cannot convert to primitive char."); //$NON-NLS-1$ - return ""; //$NON-NLS-1$ + return stringcast(""); //$NON-NLS-1$ } if (!( null !is cast(Character)fromObject )) { @@ -48,7 +48,7 @@ "'fromObject' is not of type [Character]."); //$NON-NLS-1$ } - return String.valueOf((cast(Character) fromObject).charValue()); + return stringcast(String_valueOf((cast(Character) fromObject).charValue())); } /**
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/DateConversionSupport.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/DateConversionSupport.d Sat Apr 18 13:54:50 2009 +0200 @@ -32,25 +32,28 @@ * </p> */ public abstract class DateConversionSupport { - private final static int DATE_FORMAT=DateFormat.SHORT; - private final static int DEFAULT_FORMATTER_INDEX=0; + private const static int DATE_FORMAT=DateFormat.SHORT; + private const static int DEFAULT_FORMATTER_INDEX=0; - private final static int NUM_VIRTUAL_FORMATTERS=1; + private const static int NUM_VIRTUAL_FORMATTERS=1; /** * Alternative formatters for date, time and date/time. * Raw milliseconds are covered as a special case. */ // TODO: These could be shared, but would have to be synchronized. - private DateFormat[] formatters = { - new SimpleDateFormat(BindingMessages.getStringcast(BindingMessages.DATE_FORMAT_DATE_TIME)), - new SimpleDateFormat(BindingMessages.getStringcast(BindingMessages.DATEFORMAT_TIME)), + private static DateFormat[] formatters; + static this(){ + formatters = [ cast(DateFormat) + new SimpleDateFormat(BindingMessages.getString(BindingMessages.DATE_FORMAT_DATE_TIME)), + new SimpleDateFormat(BindingMessages.getString(BindingMessages.DATEFORMAT_TIME)), DateFormat.getDateTimeInstance(DATE_FORMAT, DateFormat.SHORT), - DateFormat.getDateInstancecast(DATE_FORMAT), - DateFormat.getTimeInstancecast(DateFormat.SHORT), + DateFormat.getDateInstance(DATE_FORMAT), + DateFormat.getTimeInstance(DateFormat.SHORT), DateFormat.getDateTimeInstance(DATE_FORMAT,DateFormat.MEDIUM), - DateFormat.getTimeInstancecast(DateFormat.MEDIUM) - }; + DateFormat.getTimeInstance(DateFormat.MEDIUM) + ]; + } /** * Tries all available formatters to parse the given string according to the @@ -104,7 +107,7 @@ if(formatterIdx>=0) { return formatters[formatterIdx].format(date); } - return String.valueOf(date.getTime()); + return String_valueOf(date.getTime()); } protected int numFormatters() { @@ -123,7 +126,7 @@ */ protected DateFormat getDateFormat(int index) { if (index < 0 || index >= formatters.length) { - throw new IllegalArgumentException("'index' [" + index + "] is out of bounds."); //$NON-NLS-1$//$NON-NLS-2$ + throw new IllegalArgumentException(Format("'index' [{}] is out of bounds.", index )); //$NON-NLS-1$//$NON-NLS-2$ } return formatters[index];
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/DateToStringConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/DateToStringConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -28,15 +28,15 @@ public class DateToStringConverter : DateConversionSupport , IConverter { public Object convert(Object source) { if (source !is null) - return format(cast(Date)source); - return ""; //$NON-NLS-1$ + return stringcast(format(cast(Date)source)); + return stringcast(""); //$NON-NLS-1$ } public Object getFromType() { - return Date.classinfo; + return typeid(Date); } public Object getToType() { - return String.classinfo; + return typeid(StringCls); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/IdentityConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/IdentityConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,6 +13,7 @@ module org.eclipse.core.internal.databinding.conversion.IdentityConverter; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.databinding.BindingException; import org.eclipse.core.databinding.conversion.IConverter; @@ -22,33 +23,39 @@ */ public class IdentityConverter : IConverter { - private ClassInfo fromType; + private TypeInfo fromType; - private ClassInfo toType; + private TypeInfo toType; /** * @param type */ - public this(ClassInfo type) { + public this(TypeInfo type) { this.fromType = type; this.toType = type; + initPrimitiveMap(); } /** * @param fromType * @param toType */ - public this(ClassInfo fromType, ClassInfo toType) { + public this(TypeInfo fromType, TypeInfo toType) { this.fromType = fromType; this.toType = toType; + initPrimitiveMap(); } - private ClassInfo[][] primitiveMap = new ClassInfo[][] [ - [ Integer.TYPE, Integer.classinfo ], [ Short.TYPE, Short.classinfo ], - [ Long.TYPE, Long.classinfo ], [ Double.TYPE, Double.classinfo ], - [ Byte.TYPE, Byte.classinfo ], [ Float.TYPE, Float.classinfo ], - [ Boolean.TYPE, Boolean.classinfo ], - [ Character.TYPE, Character.classinfo ] ]; + private TypeInfo[][] primitiveMap; + + private void initPrimitiveMap(){ + primitiveMap = [ + [ cast(TypeInfo)Integer.TYPE, typeid(Integer) ], [ cast(TypeInfo)Short.TYPE, typeid(Short) ], + [ cast(TypeInfo)Long.TYPE, typeid(Long) ], [ cast(TypeInfo)Double.TYPE, typeid(Double) ], + [ cast(TypeInfo)Byte.TYPE, typeid(Byte) ], [ cast(TypeInfo)Float.TYPE, typeid(Float) ], + [ cast(TypeInfo)Boolean.TYPE, typeid(Boolean) ], + [ cast(TypeInfo)Character.TYPE, typeid(Character) ] ]; + } /* * (non-Javadoc) @@ -56,24 +63,24 @@ * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object) */ public Object convert(Object source) { - if (toType.isPrimitive()) { + if ( isJavaPrimitive(toType)) { if (source is null) { throw new BindingException("Cannot convert null to a primitive"); //$NON-NLS-1$ } } if (source !is null) { - ClassInfo sourceClass = source.getClass(); - if (toType.isPrimitive() || sourceClass.isPrimitive()) { - if (sourceClass.equals(toType) + TypeInfo sourceClass = getTypeInfo(source.classinfo); + if (isJavaPrimitive(toType) || isJavaPrimitive(sourceClass)) { + if (sourceClass.opEquals(toType) || isPrimitiveTypeMatchedWithBoxed(sourceClass, toType)) { return source; } throw new BindingException( "Boxed and unboxed types do not match"); //$NON-NLS-1$ } - if (!toType.isAssignableFrom(sourceClass)) { - throw new BindingException(sourceClass.getName() - + " is not assignable to " + toType.getName()); //$NON-NLS-1$ + if (!isImplicitly(sourceClass, toType)) { + throw new BindingException(asClass(sourceClass).name + ~ " is not assignable to " ~ asClass(toType).name); //$NON-NLS-1$ } } return source; @@ -86,15 +93,15 @@ * @param toClass * @return true if sourceClass and toType are matched primitive/boxed types */ - public bool isPrimitiveTypeMatchedWithBoxed(ClassInfo sourceClass, - ClassInfo toClass) { + public bool isPrimitiveTypeMatchedWithBoxed(TypeInfo sourceClass, + TypeInfo toClass) { for (int i = 0; i < primitiveMap.length; i++) { - if (toClass.equals(primitiveMap[i][0]) - && sourceClass.equals(primitiveMap[i][1])) { + if (toClass.opEquals(primitiveMap[i][0]) + && sourceClass.opEquals(primitiveMap[i][1])) { return true; } - if (sourceClass.equals(primitiveMap[i][0]) - && toClass.equals(primitiveMap[i][1])) { + if (sourceClass.opEquals(primitiveMap[i][0]) + && toClass.opEquals(primitiveMap[i][1])) { return true; } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/IntegerToStringConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/IntegerToStringConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ module org.eclipse.core.internal.databinding.conversion.IntegerToStringConverter; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.databinding.conversion.Converter; @@ -30,17 +31,17 @@ public class IntegerToStringConverter : Converter { private final bool primitive; private final NumberFormat numberFormat; - private final ClassInfo boxedType; + private final TypeInfo boxedType; /** * @param numberFormat * @param fromType * @param boxedType */ - private this(NumberFormat numberFormat, ClassInfo fromType, - ClassInfo boxedType) { - super(fromType, String.classinfo); - this.primitive = fromType.isPrimitive(); + private this(NumberFormat numberFormat, TypeInfo fromType, + TypeInfo boxedType) { + super(fromType, typeid(StringCls)); + this.primitive = isJavaPrimitive(fromType); this.numberFormat = numberFormat; this.boxedType = boxedType; } @@ -53,15 +54,15 @@ public Object convert(Object fromObject) { // Null is allowed when the type is not primitve. if (fromObject is null && !primitive) { - return ""; //$NON-NLS-1$ + return stringcast(""); //$NON-NLS-1$ } - if (!boxedType.isInstance(fromObject)) { + if (!isImplicitly(fromObject.classinfo, boxedType.classinfo)) { throw new IllegalArgumentException( - "'fromObject' is not of type [" + boxedType + "]."); //$NON-NLS-1$//$NON-NLS-2$ + Format("'fromObject' is not of type [{}].", boxedType)); //$NON-NLS-1$//$NON-NLS-2$ } - return numberFormat.format((cast(Number) fromObject).longValue()); + return stringcast(numberFormat.format((cast(Number) fromObject).longValue())); } /** @@ -80,7 +81,7 @@ public static IntegerToStringConverter fromShort(NumberFormat numberFormat, bool primitive) { return new IntegerToStringConverter(numberFormat, - primitive ? Short.TYPE : Short.classinfo, Short.classinfo); + primitive ? Short.TYPE : typeid(Short), typeid(Short)); } /** @@ -99,6 +100,6 @@ public static IntegerToStringConverter fromByte(NumberFormat numberFormat, bool primitive) { return new IntegerToStringConverter(numberFormat, primitive ? Byte.TYPE - : Byte.classinfo, Byte.classinfo); + : typeid(Byte), typeid(Byte)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToBigDecimalConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToBigDecimalConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -32,8 +32,8 @@ * @param numberFormat * @param fromType */ - public this(NumberFormat numberFormat, ClassInfo fromType) { - super(numberFormat, fromType, BigDecimal.classinfo); + public this(NumberFormat numberFormat, TypeInfo fromType) { + super(numberFormat, fromType, typeid(BigDecimal)); } /* (non-Javadoc)
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToBigIntegerConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToBigIntegerConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -32,8 +32,8 @@ * @param numberFormat * @param fromType */ - public this(NumberFormat numberFormat, ClassInfo fromType) { - super(numberFormat, fromType, BigInteger.classinfo); + public this(NumberFormat numberFormat, TypeInfo fromType) { + super(numberFormat, fromType, typeid(BigInteger)); } /* (non-Javadoc)
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToByteConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToByteConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -31,9 +31,9 @@ * @param fromType * @param primitive */ - public this(NumberFormat numberFormat, ClassInfo fromType, + public this(NumberFormat numberFormat, TypeInfo fromType, bool primitive) { - super(numberFormat, fromType, (primitive) ? Byte.TYPE : Byte.classinfo); + super(numberFormat, fromType, (primitive) ? Byte.TYPE : typeid(Byte)); } /* (non-Javadoc)
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToDoubleConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToDoubleConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -32,9 +32,9 @@ * @param fromType * @param primitive */ - public this(NumberFormat numberFormat, ClassInfo fromType, + public this(NumberFormat numberFormat, TypeInfo fromType, bool primitive) { - super(numberFormat, fromType, (primitive) ? Double.TYPE : Double.classinfo); + super(numberFormat, fromType, (primitive) ? Double.TYPE : typeid(Double)); } /* (non-Javadoc)
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToFloatConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToFloatConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,9 +30,9 @@ * @param fromType * @param primitive */ - public this(NumberFormat numberFormat, ClassInfo fromType, + public this(NumberFormat numberFormat, TypeInfo fromType, bool primitive) { - super(numberFormat, fromType, (primitive) ? Float.TYPE : Float.classinfo); + super(numberFormat, fromType, (primitive) ? Float.TYPE : typeid(Float)); } /* (non-Javadoc)
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToIntegerConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToIntegerConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -28,6 +28,15 @@ */ public class NumberToIntegerConverter : NumberToNumberConverter , IConverter { + public override Object convert(Object fromObject){ + return super.convert(fromObject); + } + public override Object getFromType() { + return super.getFromType(); + } + public override Object getToType() { + return super.getToType(); + } /** * @param numberFormat @@ -35,8 +44,8 @@ * @param primitive */ public this(NumberFormat numberFormat, - ClassInfo fromType, bool primitive) { - super(numberFormat, fromType, (primitive) ? Integer.TYPE : Integer.classinfo); + TypeInfo fromType, bool primitive) { + super(numberFormat, fromType, (primitive) ? Integer.TYPE : typeid(Integer)); } /* (non-Javadoc)
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToLongConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToLongConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,9 +30,9 @@ * @param fromType * @param primitive */ - public this(NumberFormat numberFormat, ClassInfo fromType, + public this(NumberFormat numberFormat, TypeInfo fromType, bool primitive) { - super(numberFormat, fromType, (primitive) ? Long.TYPE : Long.classinfo); + super(numberFormat, fromType, (primitive) ? Long.TYPE : typeid(Long)); } /* (non-Javadoc)
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToNumberConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToNumberConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,6 +13,7 @@ import org.eclipse.core.internal.databinding.conversion.StringToNumberParser; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.databinding.conversion.Converter; @@ -34,10 +35,10 @@ private String outOfRangeMessage; protected this(NumberFormat numberFormat, - ClassInfo fromType, ClassInfo toType) { + TypeInfo fromType, TypeInfo toType) { super(fromType, toType); this.numberFormat = numberFormat; - this.primitive = toType.isPrimitive(); + this.primitive = isJavaPrimitive(toType); } /* @@ -45,7 +46,8 @@ * * @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object) */ - public final Object convert(Object fromObject) { + // DWT not final, need to override to reimplement interface IConvert + public /+final+/ Object convert(Object fromObject) { if (fromObject is null) { if (primitive) { throw new IllegalArgumentException( @@ -70,8 +72,8 @@ synchronized (this) { if (outOfRangeMessage is null) { outOfRangeMessage = StringToNumberParser - .createOutOfRangeMessage(new Shortcast(Short.MIN_VALUE), - new Shortcast(Short.MAX_VALUE), numberFormat); + .createOutOfRangeMessage(new Short(Short.MIN_VALUE), + new Short(Short.MAX_VALUE), numberFormat); } throw new IllegalArgumentException(outOfRangeMessage);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToShortConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/NumberToShortConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,10 +30,10 @@ * @param fromType * @param primitive */ - public this(NumberFormat numberFormat, ClassInfo fromType, + public this(NumberFormat numberFormat, TypeInfo fromType, bool primitive) { - super(numberFormat, fromType, (primitive) ? Short.TYPE : Short.classinfo); + super(numberFormat, fromType, (primitive) ? Short.TYPE : typeid(Short)); } /*
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/ObjectToStringConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/ObjectToStringConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -19,19 +19,19 @@ * Converts any object to a string by calling its toString() method. */ public class ObjectToStringConverter : IConverter { - private final ClassInfo fromClass; + private final TypeInfo fromClass; /** * */ public this() { - this(Object.classinfo); + this(typeid(Object)); } /** * @param fromClass */ - public this(ClassInfo fromClass) { + public this(TypeInfo fromClass) { this.fromClass = fromClass; } @@ -42,9 +42,9 @@ */ public Object convert(Object source) { if (source is null) { - return ""; //$NON-NLS-1$ + return stringcast(""); //$NON-NLS-1$ } - return source.toString(); + return stringcast(source.toString()); } public Object getFromType() { @@ -52,7 +52,7 @@ } public Object getToType() { - return String.classinfo; + return typeid(StringCls); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StatusToStringConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StatusToStringConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -23,11 +23,17 @@ * @since 1.0 */ public class StatusToStringConverter : Converter , IConverter { + public override Object getFromType() { + return super.getFromType(); + } + public override Object getToType() { + return super.getToType(); + } /** * Constructs a new instance. */ public this() { - super(IStatus.classinfo, String.classinfo); + super(typeid(IStatus), typeid(StringCls)); } /* (non-Javadoc) @@ -39,6 +45,6 @@ } IStatus status = cast(IStatus) fromObject; - return status.getMessage(); + return stringcast(status.getMessage()); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToBooleanConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToBooleanConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,7 +25,7 @@ * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object) */ public Object convert(Object source) { - String sourceString = cast(String) source; + String sourceString = stringcast( source); if ("".equals(sourceString.trim())) { //$NON-NLS-1$ return null; } @@ -33,7 +33,7 @@ } public Object getToType() { - return Boolean.classinfo; + return typeid(Boolean); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToBooleanPrimitiveConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToBooleanPrimitiveConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -26,16 +26,16 @@ * StringToBooleanPrimitiveConverter. */ public class StringToBooleanPrimitiveConverter : IConverter { - private static final String[] trueValues; + private static String[] trueValues; - private static final String[] falseValues; + private static String[] falseValues; static this(){ - String delimiter = BindingMessages.getStringcast(BindingMessages.VALUE_DELIMITER); - String values = BindingMessages.getStringcast(BindingMessages.TRUE_STRING_VALUES); + String delimiter = BindingMessages.getString(BindingMessages.VALUE_DELIMITER); + String values = BindingMessages.getString(BindingMessages.TRUE_STRING_VALUES); trueValues = valuesToSortedArray(delimiter, values); - values = BindingMessages.getStringcast(BindingMessages.FALSE_STRING_VALUES); + values = BindingMessages.getString(BindingMessages.FALSE_STRING_VALUES); falseValues = valuesToSortedArray(delimiter, values); } @@ -65,7 +65,7 @@ * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object) */ public Object convert(Object source) { - String s = cast(String) source; + String s = stringcast( source); s = s.toUpperCase(); if (Arrays.binarySearch(trueValues, s) > -1) { @@ -80,7 +80,7 @@ } public Object getFromType() { - return String.classinfo; + return typeid(StringCls); } public Object getToType() {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToByteConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToByteConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,8 +13,8 @@ import org.eclipse.core.internal.databinding.conversion.StringToNumberParser; import java.lang.all; +import java.nonstandard.RuntimeTraits; -import org.eclipse.core.internal.databinding.conversion.StringToNumberParser.ParseResult; import org.eclipse.core.internal.databinding.validation.NumberFormatConverter; import com.ibm.icu.text.NumberFormat; @@ -31,9 +31,9 @@ * @param numberFormat * @param toType */ - private this(NumberFormat numberFormat, ClassInfo toType) { - super(String.classinfo, toType, numberFormat); - primitive = toType.isPrimitive(); + private this(NumberFormat numberFormat, TypeInfo toType) { + super(typeid(StringCls), toType, numberFormat); + primitive = isJavaPrimitive(cast(TypeInfo)toType); this.numberFormat = numberFormat; } @@ -44,7 +44,7 @@ */ public static StringToByteConverter toByte(NumberFormat numberFormat, bool primitive) { - return new StringToByteConverter(numberFormat, (primitive) ? Byte.TYPE : Byte.classinfo); + return new StringToByteConverter(numberFormat, (primitive) ? Byte.TYPE : typeid(Byte)); } /** @@ -59,7 +59,7 @@ * @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object) */ public Object convert(Object fromObject) { - ParseResult result = StringToNumberParser.parse(fromObject, + StringToNumberParser.ParseResult result = StringToNumberParser.parse(fromObject, numberFormat, primitive); if (result.getPosition() !is null) { @@ -67,7 +67,7 @@ // it but anyone can call convert so we should return a properly // formatted message in an exception throw new IllegalArgumentException(StringToNumberParser - .createParseErrorMessage(cast(String) fromObject, result + .createParseErrorMessage(stringcast(fromObject), result .getPosition())); } else if (result.getNumber() is null) { // if an error didn't occur and the number is null then it's a boxed @@ -82,7 +82,7 @@ synchronized (this) { if (outOfRangeMessage is null) { outOfRangeMessage = StringToNumberParser - .createOutOfRangeMessage(new Bytecast(Byte.MIN_VALUE), new Bytecast(Byte.MAX_VALUE), numberFormat); + .createOutOfRangeMessage(new Byte(Byte.MIN_VALUE), new Byte(Byte.MAX_VALUE), numberFormat); } throw new IllegalArgumentException(outOfRangeMessage);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToCharacterConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToCharacterConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -37,11 +37,11 @@ * @see org.eclipse.jface.binding.converter.IConverter#convert(java.lang.Object) */ public Object convert(Object source) { - if (source !is null && !( null !is cast(String)source )) + if (source !is null && !( null !is cast(ArrayWrapperString)source )) throw new IllegalArgumentException( - "String2Character: Expected type String, got type [" + source.getClass().getName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + Format("String2Character: Expected type String, got type [{}]", source.classinfo.name) ); //$NON-NLS-1$ //$NON-NLS-2$ - String s = cast(String) source; + String s = stringcast(source); if (source is null || s.equals("")) { //$NON-NLS-1$ if (primitiveTarget) throw new IllegalArgumentException( @@ -52,24 +52,24 @@ if (s.length() > 1) throw new IllegalArgumentException( - "String2Character: string too long: " + s); //$NON-NLS-1$ + "String2Character: string too long: " ~ s); //$NON-NLS-1$ try { result = new Character(s.charAt(0)); } catch (Exception e) { throw new IllegalArgumentException( - "String2Character: " + e.getMessage() + ": " + s); //$NON-NLS-1$ //$NON-NLS-2$ + Format("String2Character: {}: {}", e.msg, s)); //$NON-NLS-1$ //$NON-NLS-2$ } return result; } public Object getFromType() { - return String.classinfo; + return typeid(StringCls); } public Object getToType() { - return primitiveTarget ? Character.TYPE : Character.classinfo; + return primitiveTarget ? Character.TYPE : typeid(Character); } /**
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToDateConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToDateConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,10 +30,10 @@ } public Object getFromType() { - return String.classinfo; + return typeid(StringCls); } public Object getToType() { - return Date.classinfo; + return typeid(Date); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToNumberParser.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToNumberParser.d Sat Apr 18 13:54:50 2009 +0200 @@ -27,15 +27,21 @@ * @since 1.0 */ public class StringToNumberParser { - private static final BigDecimal FLOAT_MAX_BIG_DECIMAL = new BigDecimal( - Float.MAX_VALUE); - private static final BigDecimal FLOAT_MIN_BIG_DECIMAL = new BigDecimal( - -Float.MAX_VALUE); + private static BigDecimal FLOAT_MAX_BIG_DECIMAL; + private static BigDecimal FLOAT_MIN_BIG_DECIMAL; + private static BigDecimal DOUBLE_MAX_BIG_DECIMAL; + private static BigDecimal DOUBLE_MIN_BIG_DECIMAL; + static this(){ + FLOAT_MAX_BIG_DECIMAL = new BigDecimal( + Float.MAX_VALUE); + FLOAT_MIN_BIG_DECIMAL = new BigDecimal( + -Float.MAX_VALUE); - private static final BigDecimal DOUBLE_MAX_BIG_DECIMAL = new BigDecimal( - Double.MAX_VALUE); - private static final BigDecimal DOUBLE_MIN_BIG_DECIMAL = new BigDecimal( - -Double.MAX_VALUE); + DOUBLE_MAX_BIG_DECIMAL = new BigDecimal( + Double.MAX_VALUE); + DOUBLE_MIN_BIG_DECIMAL = new BigDecimal( + -Double.MAX_VALUE); + } /** * @param value @@ -45,12 +51,12 @@ */ public static ParseResult parse(Object value, NumberFormat numberFormat, bool primitive) { - if (!( null !is cast(String)value )) { + if (!( null !is cast(ArrayWrapperString)value )) { throw new IllegalArgumentException( "Value to convert is not a String"); //$NON-NLS-1$ } - String source = cast(String) value; + String source = stringcast( value ); ParseResult result = new ParseResult(); if (!primitive && source.trim().length() is 0) { return result; @@ -144,7 +150,7 @@ } return BindingMessages.formatString( - "Validate_NumberOutOfRangeError", [ cast(Object)min, max ]); //$NON-NLS-1$ + "Validate_NumberOutOfRangeError", [ cast(Object)stringcast(min), stringcast(max) ]); //$NON-NLS-1$ } /** @@ -205,7 +211,7 @@ } throw new IllegalArgumentException( - "Number of type [" + number.getClass().getName() + "] is not supported."); //$NON-NLS-1$ //$NON-NLS-2$ + Format("Number of type [{}] is not supported.", number.classinfo.name )); //$NON-NLS-1$ //$NON-NLS-2$ } /** @@ -273,7 +279,7 @@ } throw new IllegalArgumentException( - "Number of type [" + number.getClass().getName() + "] is not supported."); //$NON-NLS-1$ //$NON-NLS-2$ + Format("Number of type [{}] is not supported.", number.classinfo.name)); //$NON-NLS-1$ //$NON-NLS-2$ } /**
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToShortConverter.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/conversion/StringToShortConverter.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,8 +13,8 @@ import org.eclipse.core.internal.databinding.conversion.StringToNumberParser; import java.lang.all; +import java.nonstandard.RuntimeTraits; -import org.eclipse.core.internal.databinding.conversion.StringToNumberParser.ParseResult; import org.eclipse.core.internal.databinding.validation.NumberFormatConverter; import com.ibm.icu.text.NumberFormat; @@ -31,10 +31,10 @@ /** * Constructs a new instance. */ - private this(NumberFormat numberFormat, ClassInfo toType) { - super(String.classinfo, toType, numberFormat); + private this(NumberFormat numberFormat, TypeInfo toType) { + super(typeid(String), toType, numberFormat); this.numberFormat = numberFormat; - primitive = toType.isPrimitive(); + primitive = isJavaPrimitive(toType); } /* @@ -43,7 +43,7 @@ * @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object) */ public Object convert(Object fromObject) { - ParseResult result = StringToNumberParser.parse(fromObject, + StringToNumberParser.ParseResult result = StringToNumberParser.parse(fromObject, numberFormat, primitive); if (result.getPosition() !is null) { @@ -51,7 +51,7 @@ // it but anyone can call convert so we should return a properly // formatted message in an exception throw new IllegalArgumentException(StringToNumberParser - .createParseErrorMessage(cast(String) fromObject, result + .createParseErrorMessage(stringcast( fromObject), result .getPosition())); } else if (result.getNumber() is null) { // if an error didn't occur and the number is null then it's a boxed @@ -66,7 +66,7 @@ synchronized (this) { if (outOfRangeMessage is null) { outOfRangeMessage = StringToNumberParser - .createOutOfRangeMessage(new Shortcast(Short.MIN_VALUE), new Shortcast(Short.MAX_VALUE), numberFormat); + .createOutOfRangeMessage(new Short(Short.MIN_VALUE), new Short(Short.MAX_VALUE), numberFormat); } throw new IllegalArgumentException(outOfRangeMessage); @@ -90,6 +90,6 @@ public static StringToShortConverter toShort(NumberFormat numberFormat, bool primitive) { return new StringToShortConverter(numberFormat, - (primitive) ? Short.TYPE : Short.classinfo); + (primitive) ? Short.TYPE : typeid(Short)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/messages.properties Sat Apr 18 09:25:29 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2008 IBM Corporation and others. -# 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: -# IBM Corporation - initial API and implementation -############################################################################### -# NLS file for JFace Data Binding -############################################################################### -## Uneeded value -# -#Yes=Yes -#yes=yes -#No=No -#no=no -#True=True -#true=true -#False=False -#false=false -#and=and -#or=or -#Validate_BooleanHelp=Please type "Yes", "No", "True", or "False" -# -#Validate_RangeStart=Please enter a number between -#Validate_Like=Please enter a number like -# -############### - -IndexOutOfRange=Index out of Range. -MultipleProblems=Multiple Problems. - -ValueBinding_ErrorWhileSettingValue=An error occurred while setting the value. -DateFormat_DateTime=dd.MM.yyyy HH:mm:ss.SSS Z -DateFormat_Time=HH:mm:ss.SSS - -#ValueDelimiter should be used to separate multiple values that are stored in one key -ValueDelimiter=, - -#Values must be separated by ValueDelimiter -TrueStringValues=yes,true -FalseStringValues=no,false - -Validate_NumberOutOfRangeError=Please enter a value between [{0}] and [{1}] and with a similar format. -Validate_NumberParseError=Invalid character for value [{0}] at position [{1}] character [{2}]. -Validate_NumberParseErrorNoCharacter=Missing character for value [{0}] at position [{1}]. - -Validate_ConversionToPrimitive="Null object values can not be converted to primitives." -Validate_ConversionFromClassToPrimitive="Wrong object type to convert to primitive." - -Validate_NoChangeAllowedHelp=Changes are not allowed in this field -Validate_CharacterHelp=Please type a character - -Examples=Examples \ No newline at end of file
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/EmptyObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/EmptyObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -32,8 +32,41 @@ * Singleton empty list */ public class EmptyObservableList : IObservableList { +// DWT start: additional methods in List + public bool add(String o) { + return add(stringcast(o)); + } + public bool remove(String o) { + return remove(stringcast(o)); + } + public bool contains(String o) { + return contains(stringcast(o)); + } + public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; + } + public String[] toArray( String[] a ){ + auto d = toArray(); + if( a.length < d.length ){ + a.length = d.length; + } + for( int i = 0; i < d.length; i++ ){ + a[i] = stringcast(d[i]); + } + return a; + } +// DWT end: additional methods in List - private static final List emptyList = Collections.EMPTY_LIST; + private static List emptyList; + static this(){ + emptyList = Collections.EMPTY_LIST; + } private Realm realm; private Object elementType; @@ -207,7 +240,7 @@ return realm; } - public override bool opEquals(Object obj) { + public override equals_t opEquals(Object obj) { checkRealm(); if (obj is this) return true; @@ -219,7 +252,7 @@ return (cast(List) obj).isEmpty(); } - public int hashCode() { + public hash_t toHash() { checkRealm(); return 1; }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/EmptyObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/EmptyObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,8 +30,31 @@ * Singleton empty set */ public class EmptyObservableSet : IObservableSet { +// DWT start: additional methods in Set + public bool add(String o) { + return add(stringcast(o)); + } + public bool remove(String o) { + return remove(stringcast(o)); + } + public bool contains(String o) { + return contains(stringcast(o)); + } + public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; + } +// DWT end: additional methods in Set - private static final Set emptySet = Collections.EMPTY_SET; + private static Set emptySet; + static this(){ + emptySet = Collections.EMPTY_SET; + } private Realm realm; private Object elementType; @@ -159,7 +182,7 @@ return realm; } - public override bool opEquals(Object obj) { + public override equals_t opEquals(Object obj) { checkRealm(); if (obj is this) return true; @@ -171,7 +194,7 @@ return (cast(Set) obj).isEmpty(); } - public int hashCode() { + public hash_t toHash() { checkRealm(); return 0; }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/MapEntryObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/MapEntryObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -35,12 +35,13 @@ private Object key; private Object valueType; - private IMapChangeListener changeListener = new class() IMapChangeListener { + private IMapChangeListener changeListener; + class ChangeListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { if (event.diff.getAddedKeys().contains(key)) { final Object newValue = event.diff.getNewValue(key); if (newValue !is null) { - fireValueChange(Diffs.createValueDiff(null, newValue)); + fireValueChange(Diffs.createValueDiff(cast(Object)null, newValue)); } } else if (event.diff.getChangedKeys().contains(key)) { fireValueChange(Diffs.createValueDiff(event.diff @@ -48,13 +49,14 @@ } else if (event.diff.getRemovedKeys().contains(key)) { final Object oldValue = event.diff.getOldValue(key); if (oldValue !is null) { - fireValueChange(Diffs.createValueDiff(oldValue, null)); + fireValueChange(Diffs.createValueDiff(oldValue, cast(Object)null)); } } } }; - private IStaleListener staleListener = new class() IStaleListener { + private IStaleListener staleListener; + class StaleListener : IStaleListener { public void handleStale(StaleEvent staleEvent) { fireStale(); } @@ -72,6 +74,8 @@ */ public this(IObservableMap map, Object key, Object valueType) { +changeListener = new ChangeListener(); +staleListener = new StaleListener(); super(map.getRealm()); this.map = map; this.key = key;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ProxyObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ProxyObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -33,13 +33,15 @@ * @since 1.1 */ public class ProxyObservableList : ObservableList { - private IListChangeListener listChangelistener = new class() IListChangeListener { + private IListChangeListener listChangelistener; + class ListChangeListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { fireListChange(event.diff); } }; - private IStaleListener staleListener = new class() IStaleListener { + private IStaleListener staleListener; + class StaleListener : IStaleListener { public void handleStale(StaleEvent event) { fireStale(); } @@ -54,6 +56,8 @@ * the list being wrapped */ public this(IObservableList wrappedList) { +listChangelistener = new ListChangeListener(); +staleListener = new StaleListener(); super(wrappedList.getRealm(), wrappedList, wrappedList.getElementType()); this.wrappedList = wrappedList; wrappedList.addListChangeListener(listChangelistener);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ProxyObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ProxyObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -36,13 +36,15 @@ private IObservableSet wrappedSet; private Object elementType; - private ISetChangeListener setChangeListener = new class() ISetChangeListener { + private ISetChangeListener setChangeListener; + class SetChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { fireSetChange(event.diff); } }; - private IStaleListener staleListener = new class() IStaleListener { + private IStaleListener staleListener; + class StaleListener : IStaleListener { public void handleStale(StaleEvent staleEvent) { fireStale(); } @@ -55,6 +57,8 @@ * the set being wrapped */ public this(IObservableSet wrappedSet) { +setChangeListener = new SetChangeListener(); +staleListener = new StaleListener(); super(wrappedSet.getRealm()); this.wrappedSet = wrappedSet; this.elementType = wrappedSet.getElementType();
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/StalenessObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/StalenessObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -48,7 +48,7 @@ private IObservable tracked; private bool stale; - private MyListener listener = new MyListener(); + private MyListener listener; /** * Constructs a StalenessObservableValue that tracks the staleness of the @@ -58,6 +58,7 @@ * the observable to track */ public this(IObservable observable) { + listener = new MyListener(); super(observable.getRealm()); this.tracked = observable; this.stale = observable.isStale();
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/StalenessTracker.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/StalenessTracker.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,7 +30,7 @@ */ public class StalenessTracker { - private Map staleMap = new HashMap(); + private Map staleMap; private int staleCount = 0; @@ -46,7 +46,7 @@ } } - private ChildListener childListener = new ChildListener(); + private ChildListener childListener; /** * @param observables @@ -54,6 +54,8 @@ */ public this(IObservable[] observables, IStalenessConsumer stalenessConsumer) { +childListener = new ChildListener(); +staleMap = new HashMap(); this.stalenessConsumer = stalenessConsumer; for (int i = 0; i < observables.length; i++) { IObservable observable = observables[i]; @@ -68,7 +70,7 @@ */ public void processStalenessChange(IObservable child, bool callback) { bool oldStale = staleCount > 0; - IdentityWrapper wrappedChild = new IdentityWrapper(child); + IdentityWrapper wrappedChild = new IdentityWrapper(cast(Object)child); bool oldChildStale = getOldChildStale(wrappedChild); bool newChildStale = child.isStale(); if (oldChildStale !is newChildStale) { @@ -113,7 +115,7 @@ */ public void removeObservable(IObservable observable) { bool oldStale = staleCount > 0; - IdentityWrapper wrappedChild = new IdentityWrapper(observable); + IdentityWrapper wrappedChild = new IdentityWrapper(cast(Object)observable); bool oldChildStale = getOldChildStale(wrappedChild); if (oldChildStale) { staleCount--;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/UnmodifiableObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/UnmodifiableObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -39,14 +39,16 @@ */ private IObservableList wrappedList; - private IListChangeListener listChangeListener = new class() IListChangeListener { + private IListChangeListener listChangeListener; + class ListChangeListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { // Fires a Change and then ListChange event. fireListChange(event.diff); } }; - private IStaleListener staleListener = new class() IStaleListener { + private IStaleListener staleListener; + class StaleListener : IStaleListener { public void handleStale(StaleEvent event) { fireStale(); } @@ -56,6 +58,8 @@ * @param wrappedList */ public this(IObservableList wrappedList) { +listChangeListener = new ListChangeListener(); +staleListener = new StaleListener(); super(wrappedList.getRealm(), wrappedList, wrappedList.getElementType()); this.wrappedList = wrappedList;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/UnmodifiableObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/UnmodifiableObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,13 +30,15 @@ * @since 1.1 */ public class UnmodifiableObservableSet : ObservableSet { - private ISetChangeListener setChangeListener = new class() ISetChangeListener { + private ISetChangeListener setChangeListener; + class SetChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { fireSetChange(event.diff); } }; - private IStaleListener staleListener = new class() IStaleListener { + private IStaleListener staleListener; + class StaleListener : IStaleListener { public void handleStale(StaleEvent event) { fireStale(); } @@ -48,6 +50,8 @@ * @param wrappedSet */ public this(IObservableSet wrappedSet) { +setChangeListener = new SetChangeListener(); +staleListener = new StaleListener(); super(wrappedSet.getRealm(), wrappedSet, wrappedSet.getElementType()); this.wrappedSet = wrappedSet;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -53,7 +53,8 @@ private bool updatingTarget = false; - private IListChangeListener targetChangeListener = new class() IListChangeListener { + private IListChangeListener targetChangeListener; + class TargetChangeListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { if (updatingTarget) return; @@ -83,13 +84,15 @@ return status.isOK() || status.matches(IStatus.INFO | IStatus.WARNING); } - private IStaleListener targetStaleListener = new class() IStaleListener { + private IStaleListener targetStaleListener; + class TargetStaleListener : IStaleListener { public void handleStale(StaleEvent staleEvent) { fireStale(); } }; - private IValueChangeListener validationStatusChangeListener = new class() IValueChangeListener { + private IValueChangeListener validationStatusChangeListener; + class ValidationStatusChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { IStatus oldStatus = cast(IStatus) event.diff.getOldValue(); IStatus newStatus = cast(IStatus) event.diff.getNewValue(); @@ -112,11 +115,14 @@ */ public this(IObservableList target, IObservableValue validationStatus) { +targetStaleListener = new TargetStaleListener(); +targetChangeListener = new TargetChangeListener(); +validationStatusChangeListener = new ValidationStatusChangeListener(); super(target.getRealm(), new ArrayList(target), target.getElementType()); - Assert.isNotNull(validationStatus, + Assert.isNotNull(cast(Object)validationStatus, "Validation status observable cannot be null"); //$NON-NLS-1$ Assert - .isTrue(target.getRealm().equals(validationStatus.getRealm()), + .isTrue(cast(bool)target.getRealm().opEquals(validationStatus.getRealm()), "Target and validation status observables must be on the same realm"); //$NON-NLS-1$ this.target = target; this.validationStatus = validationStatus; @@ -252,6 +258,9 @@ int lastIndex = -1; Object last = null; + public void add(String o) { + add(stringcast(o)); + } public void add(Object o) { wrappedIterator.add(o); lastIndex = previousIndex(); @@ -315,10 +324,10 @@ int size = wrappedList.size(); if (oldIndex >= size) throw new IndexOutOfBoundsException( - "oldIndex: " + oldIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("oldIndex: {}, size:{}", oldIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ if (newIndex >= size) throw new IndexOutOfBoundsException( - "newIndex: " + newIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("newIndex: {}, size:{}", newIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ if (oldIndex is newIndex) return wrappedList.get(oldIndex); Object element = wrappedList.remove(oldIndex);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -48,7 +48,8 @@ private bool updatingTarget = false; - private IMapChangeListener targetChangeListener = new class() IMapChangeListener { + private IMapChangeListener targetChangeListener; + class TargetChangeListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { if (updatingTarget) return; @@ -74,13 +75,15 @@ } }; - private IStaleListener targetStaleListener = new class() IStaleListener { + private IStaleListener targetStaleListener; + class TargetStaleListener : IStaleListener { public void handleStale(StaleEvent staleEvent) { fireStale(); } }; - private IValueChangeListener validationStatusChangeListener = new class() IValueChangeListener { + private IValueChangeListener validationStatusChangeListener; + class ValidationStatusChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { IStatus oldStatus = cast(IStatus) event.diff.getOldValue(); IStatus newStatus = cast(IStatus) event.diff.getNewValue(); @@ -103,11 +106,14 @@ */ public this(IObservableMap target, IObservableValue validationStatus) { +targetStaleListener = new TargetStaleListener(); +targetChangeListener = new TargetChangeListener(); +validationStatusChangeListener = new ValidationStatusChangeListener(); super(target.getRealm(), new HashMap(target)); - Assert.isNotNull(validationStatus, + Assert.isNotNull(cast(Object)validationStatus, "Validation status observable cannot be null"); //$NON-NLS-1$ Assert - .isTrue(target.getRealm().equals(validationStatus.getRealm()), + .isTrue(cast(bool)target.getRealm().opEquals(validationStatus.getRealm()), "Target and validation status observables must be on the same realm"); //$NON-NLS-1$ this.target = target; this.validationStatus = validationStatus;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -49,7 +49,8 @@ private bool updatingTarget = false; - private ISetChangeListener targetChangeListener = new class() ISetChangeListener { + private ISetChangeListener targetChangeListener; + class TargetChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { if (updatingTarget) return; @@ -75,13 +76,15 @@ } }; - private IStaleListener targetStaleListener = new class() IStaleListener { + private IStaleListener targetStaleListener; + class TargetStaleListener : IStaleListener { public void handleStale(StaleEvent staleEvent) { fireStale(); } }; - private IValueChangeListener validationStatusChangeListener = new class() IValueChangeListener { + private IValueChangeListener validationStatusChangeListener; + class ValidationStatusChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { IStatus oldStatus = cast(IStatus) event.diff.getOldValue(); IStatus newStatus = cast(IStatus) event.diff.getNewValue(); @@ -104,11 +107,14 @@ */ public this(IObservableSet target, IObservableValue validationStatus) { +targetStaleListener = new TargetStaleListener(); +targetChangeListener = new TargetChangeListener(); +validationStatusChangeListener = new ValidationStatusChangeListener(); super(target.getRealm(), new HashSet(target), target.getElementType()); - Assert.isNotNull(validationStatus, + Assert.isNotNull(cast(Object)validationStatus, "Validation status observable cannot be null"); //$NON-NLS-1$ Assert - .isTrue(target.getRealm().equals(validationStatus.getRealm()), + .isTrue(cast(bool)target.getRealm().opEquals(validationStatus.getRealm()), "Target and validation status observables must be on the same realm"); //$NON-NLS-1$ this.target = target; this.validationStatus = validationStatus;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/ValidatedObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -63,7 +63,8 @@ private bool stale; private bool updatingTarget = false; - private IValueChangeListener targetChangeListener = new class() IValueChangeListener { + private IValueChangeListener targetChangeListener; + class TargetChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { if (updatingTarget) return; @@ -79,13 +80,15 @@ return status.isOK() || status.matches(IStatus.INFO | IStatus.WARNING); } - private IStaleListener targetStaleListener = new class() IStaleListener { + private IStaleListener targetStaleListener; + class TargetStaleListener : IStaleListener { public void handleStale(StaleEvent staleEvent) { fireStale(); } }; - private IValueChangeListener validationStatusChangeListener = new class() IValueChangeListener { + private IValueChangeListener validationStatusChangeListener; + class ValidationStatusChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { IStatus oldStatus = cast(IStatus) event.diff.getOldValue(); IStatus newStatus = cast(IStatus) event.diff.getNewValue(); @@ -106,11 +109,14 @@ */ public this(IObservableValue target, IObservableValue validationStatus) { +targetChangeListener = new TargetChangeListener(); +targetStaleListener = new TargetStaleListener(); +validationStatusChangeListener = new ValidationStatusChangeListener(); super(target.getRealm()); - Assert.isNotNull(validationStatus, + Assert.isNotNull(cast(Object)validationStatus, "Validation status observable cannot be null"); //$NON-NLS-1$ Assert - .isTrue(target.getRealm().equals(validationStatus.getRealm()), + .isTrue(cast(bool)target.getRealm().opEquals(validationStatus.getRealm()), "Target and validation status observables must be on the same realm"); //$NON-NLS-1$ this.target = target; this.validationStatus = validationStatus;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -40,7 +40,8 @@ private bool updating = false; - private IListChangeListener innerChangeListener = new class() IListChangeListener { + private IListChangeListener innerChangeListener; + class InnerChangeListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { if (!updating) { fireListChange(event.diff); @@ -65,6 +66,7 @@ */ public this(IObservableFactory factory, IObservableValue outerObservableValue, Object detailType) { +innerChangeListener = new InnerChangeListener(); super(outerObservableValue.getRealm(), Collections.EMPTY_LIST, detailType); this.factory = factory; this.outerObservableValue = outerObservableValue; @@ -74,7 +76,8 @@ outerObservableValue.addValueChangeListener(outerChangeListener); } - IValueChangeListener outerChangeListener = new class() IValueChangeListener { + IValueChangeListener outerChangeListener; + class OuterChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { List oldList = new ArrayList(wrappedList); updateInnerObservableList(outerObservableValue); @@ -98,7 +101,7 @@ if (detailType !is null) { Object innerValueType = innerObservableList.getElementType(); - Assert.isTrue(getElementType().equals(innerValueType), + Assert.isTrue(cast(bool)getElementType().opEquals(innerValueType), "Cannot change value type in a nested observable list"); //$NON-NLS-1$ } innerObservableList.addListChangeListener(innerChangeListener);
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -40,7 +40,8 @@ private IObservableMap detailMap; - private IValueChangeListener masterChangeListener = new class() IValueChangeListener { + private IValueChangeListener masterChangeListener; + class MasterChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { Map oldMap = new HashMap(wrappedMap); updateDetailMap(); @@ -48,7 +49,8 @@ } }; - private IMapChangeListener detailChangeListener = new class() IMapChangeListener { + private IMapChangeListener detailChangeListener; + class DetailChangeListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { if (!updating) { fireMapChange(event.diff); @@ -67,6 +69,8 @@ */ public this(IObservableFactory detailFactory, IObservableValue master) { +masterChangeListener = new MasterChangeListener(); +detailChangeListener = new DetailChangeListener(); super(master.getRealm(), Collections.EMPTY_MAP); this.master = master; this.detailFactory = detailFactory;
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -38,7 +38,8 @@ private bool updating = false; - private ISetChangeListener innerChangeListener = new class() ISetChangeListener { + private ISetChangeListener innerChangeListener; + class InnerChangeListener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { if (!updating) { fireSetChange(event.diff); @@ -61,6 +62,8 @@ */ public this(IObservableFactory factory, IObservableValue outerObservableValue, Object detailType) { +innerChangeListener = new InnerChangeListener(); +outerChangeListener = new OuterChangeListener(); super(outerObservableValue.getRealm(), Collections.EMPTY_SET, detailType); this.factory = factory; @@ -70,7 +73,8 @@ outerObservableValue.addValueChangeListener(outerChangeListener); } - IValueChangeListener outerChangeListener = new class() IValueChangeListener { + IValueChangeListener outerChangeListener; + class OuterChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { Set oldSet = new HashSet(wrappedSet); updateInnerObservableSet(outerObservableValue); @@ -95,7 +99,7 @@ if (elementType !is null) { Object innerValueType = innerObservableSet.getElementType(); - Assert.isTrue(elementType.equals(innerValueType), + Assert.isTrue(cast(bool)elementType.opEquals(innerValueType), "Cannot change value type in a nested observable set"); //$NON-NLS-1$ }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/masterdetail/DetailObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -31,7 +31,8 @@ private bool updating = false; - private IValueChangeListener innerChangeListener = new class() IValueChangeListener { + private IValueChangeListener innerChangeListener; + class InnerChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { if (!updating) { fireValueChange(event.diff); @@ -56,6 +57,8 @@ */ public this(IObservableValue outerObservableValue, IObservableFactory factory, Object detailType) { +innerChangeListener = new InnerChangeListener(); +outerChangeListener = new OuterChangeListener(); super(outerObservableValue.getRealm()); this.factory = factory; this.detailType = detailType; @@ -65,7 +68,8 @@ outerObservableValue.addValueChangeListener(outerChangeListener); } - IValueChangeListener outerChangeListener = new class() IValueChangeListener { + IValueChangeListener outerChangeListener; + class OuterChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { Object oldValue = doGetValue(); updateInnerObservableValue(outerObservableValue); @@ -90,8 +94,8 @@ if (detailType !is null) { Assert .isTrue( - detailType.equals(innerValueType), - "Cannot change value type in a nested observable value, from " + innerValueType + " to " + detailType); //$NON-NLS-1$ //$NON-NLS-2$ + cast(bool)detailType.opEquals(innerValueType), + Format("Cannot change value type in a nested observable value, from {} to {}", innerValueType, detailType)); //$NON-NLS-1$ //$NON-NLS-2$ } innerObservableValue.addValueChangeListener(innerChangeListener); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/AbstractObservableTree.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/AbstractObservableTree.d Sat Apr 18 13:54:50 2009 +0200 @@ -39,12 +39,13 @@ private bool stale; - private ListenerList treeListeners = new ListenerListcast(ListenerList.IDENTITY); + private ListenerList treeListeners; /** * @param realm */ public this(Realm realm) { + treeListeners = new ListenerList(ListenerList.IDENTITY); super(realm); } @@ -53,7 +54,7 @@ } public void addTreeChangeListener(ITreeChangeListener listener) { - treeListeners.add(listener); + treeListeners.add(cast(Object)listener); } public int getChildCount(TreePath parentPath) { @@ -85,7 +86,7 @@ } public void removeTreeChangeListener(ITreeChangeListener listener) { - treeListeners.remove(listener); + treeListeners.remove(cast(Object)listener); } public void setChildCount(TreePath parentPath, int count) { @@ -110,7 +111,7 @@ Policy.JFACE_DATABINDING, IStatus.OK, BindingMessages - .getStringcast(BindingMessages.INDEX_OUT_OF_RANGE), + .getString(BindingMessages.INDEX_OUT_OF_RANGE), null)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IObservableTree.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IObservableTree.d Sat Apr 18 13:54:50 2009 +0200 @@ -37,13 +37,16 @@ * * @since 1.1 */ + static this(){ + IObservableTree.UNKNOWN_ELEMENT = new Object(); + } public interface IObservableTree : IObservable { /** * Element that can be returned from synchronous getters if this observable * tree is lazy. */ - public final static Object UNKNOWN_ELEMENT = new Object(); + public static Object UNKNOWN_ELEMENT; /** * @param listener
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeChangeEvent.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeChangeEvent.d Sat Apr 18 13:54:50 2009 +0200 @@ -37,7 +37,7 @@ * @param diff */ public this(IObservableTree source, TreeDiff diff) { - super(source); + super(cast(Object)source); this.diff = diff; }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffNode.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffNode.d Sat Apr 18 13:54:50 2009 +0200 @@ -44,7 +44,7 @@ /** * */ - public static final TreeDiffNode[] NO_CHILDREN = new TreeDiffNode[0]; + public static final TreeDiffNode[] NO_CHILDREN; /** *
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreePath.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreePath.d Sat Apr 18 13:54:50 2009 +0200 @@ -30,7 +30,10 @@ /** * Constant for representing an empty tree path. */ - public static final TreePath EMPTY = new TreePath(new Object[0]); + public static TreePath EMPTY; + static this(){ + EMPTY = new TreePath(new Object[0]); + } private Object[] segments; @@ -44,7 +47,7 @@ * root element */ public this(Object[] segments) { - Assert.isNotNull(segments, "Segments array cannot be null"); //$NON-NLS-1$ + Assert.isTrue(segments !is null, "Segments array cannot be null"); //$NON-NLS-1$ this.segments = new Object[segments.length]; for (int i = 0; i < segments.length; i++) { Assert.isNotNull(segments[i], "Segments array cannot contain null"); //$NON-NLS-1$ @@ -101,7 +104,7 @@ * * @see java.lang.Object#equals(java.lang.Object) */ - public override bool opEquals(Object other) { + public override equals_t opEquals(Object other) { if (!( null !is cast(TreePath)other )) { return false; } @@ -110,17 +113,17 @@ return false; } for (int i = 0; i < segments.length; i++) { - if (!segments[i].equals(otherPath.segments[i])) { + if (!segments[i].opEquals(otherPath.segments[i])) { return false; } } return true; } - public int hashCode() { + public hash_t toHash() { if (hash is 0) { for (int i = 0; i < segments.length; i++) { - hash += segments[i].hashCode(); + hash += segments[i].toHash(); } } return hash; @@ -139,14 +142,14 @@ int thisSegmentCount = getSegmentCount(); int otherSegmentCount = treePath.getSegmentCount(); if (otherSegmentCount is thisSegmentCount) { - return equals(treePath); + return cast(bool)opEquals(treePath); } if (otherSegmentCount > thisSegmentCount) { return false; } for (int i = 0; i < otherSegmentCount; i++) { Object otherSegment = treePath.getSegment(i); - if (!otherSegment.equals(segments[i])) { + if (!otherSegment.opEquals(segments[i])) { return false; } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/AbstractStringToNumberValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/AbstractStringToNumberValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,11 +13,11 @@ import org.eclipse.core.internal.databinding.validation.NumberFormatConverter; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.databinding.validation.ValidationStatus; import org.eclipse.core.internal.databinding.conversion.StringToNumberParser; -import org.eclipse.core.internal.databinding.conversion.StringToNumberParser.ParseResult; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -49,9 +49,9 @@ this.min = min; this.max = max; - if (null !is cast(ClassInfo)converter.getToType()) { - ClassInfo clazz = cast(ClassInfo) converter.getToType(); - toPrimitive = clazz.isPrimitive(); + if (null !is cast(TypeInfo)converter.getToType()) { + TypeInfo clazz = cast(TypeInfo) converter.getToType(); + toPrimitive = isJavaPrimitive(clazz); } else { toPrimitive = false; } @@ -67,7 +67,7 @@ * @see org.eclipse.core.databinding.validation.IValidator#validate(java.lang.Object) */ public final IStatus validate(Object value) { - ParseResult result = StringToNumberParser.parse(value, converter + StringToNumberParser.ParseResult result = StringToNumberParser.parse(value, converter .getNumberFormat(), toPrimitive); if (result.getNumber() !is null) { @@ -82,7 +82,7 @@ } } else if (result.getPosition() !is null) { String parseErrorMessage = StringToNumberParser.createParseErrorMessage( - cast(String) value, result.getPosition()); + stringcast(value), result.getPosition()); return ValidationStatus.error(parseErrorMessage); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToByteValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToByteValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -26,13 +26,17 @@ * @since 1.0 */ public class NumberToByteValidator : NumberToNumberValidator { - private static final Byte MAX = new Bytecast(Byte.MAX_VALUE); - private static final Byte MIN = new Bytecast(Byte.MIN_VALUE); + private static Byte MAX; + private static Byte MIN; /** * @param converter */ public this(NumberToByteConverter converter) { + if( MAX is null || MIN is null ){ + MAX = new Byte(Byte.MAX_VALUE); + MIN = new Byte(Byte.MIN_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToDoubleValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToDoubleValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,13 +25,17 @@ * @since 1.0 */ public class NumberToDoubleValidator : NumberToNumberValidator { - private static final Double MIN = new Doublecast(Double.MIN_VALUE); - private static final Double MAX = new Doublecast(Double.MAX_VALUE); + private static Double MIN; + private static Double MAX; /** * @param converter */ public this(NumberToDoubleConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Double(Double.MIN_VALUE); + MAX = new Double(Double.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToFloatValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToFloatValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,13 +25,17 @@ * @since 1.0 */ public class NumberToFloatValidator : NumberToNumberValidator { - private static final Float MIN = new Floatcast(Float.MIN_VALUE); - private static final Float MAX = new Floatcast(Float.MAX_VALUE); + private static Float MIN; + private static Float MAX; /** * @param converter */ public this(NumberToFloatConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Float(Float.MIN_VALUE); + MAX = new Float(Float.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToIntegerValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToIntegerValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,13 +25,17 @@ * @since 1.0 */ public class NumberToIntegerValidator : NumberToNumberValidator { - private static final Integer MIN = new Integercast(Integer.MIN_VALUE); - private static final Integer MAX = new Integercast(Integer.MAX_VALUE); + private static Integer MIN; + private static Integer MAX; /** * @param converter */ public this(NumberToIntegerConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Integer(Integer.MIN_VALUE); + MAX = new Integer(Integer.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToLongValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToLongValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,13 +25,17 @@ * @since 1.0 */ public class NumberToLongValidator : NumberToNumberValidator { - private static final Long MIN = new Longcast(Long.MIN_VALUE); - private static final Long MAX = new Longcast(Long.MAX_VALUE); + private static Long MIN; + private static Long MAX; /** * @param converter */ public this(NumberToLongConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Long(Long.MIN_VALUE); + MAX = new Long(Long.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToNumberValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToNumberValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ module org.eclipse.core.internal.databinding.validation.NumberToNumberValidator; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.databinding.validation.ValidationStatus; @@ -52,7 +53,7 @@ this.min = min; this.max = max; - primitive = (cast(ClassInfo) converter.getToType()).isPrimitive(); + primitive = isJavaPrimitive(cast(TypeInfo)converter.getToType()); } /*
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToShortValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/NumberToShortValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -26,13 +26,17 @@ * @since 1.0 */ public class NumberToShortValidator : NumberToNumberValidator { - private static final Short MIN = new Shortcast(Short.MIN_VALUE); - private static final Short MAX = new Shortcast(Short.MAX_VALUE); + private static Short MIN; + private static Short MAX; /** * @param converter */ public this(NumberToShortConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Short(Short.MIN_VALUE); + MAX = new Short(Short.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/ObjectToPrimitiveValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/ObjectToPrimitiveValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,6 +13,7 @@ module org.eclipse.core.internal.databinding.validation.ObjectToPrimitiveValidator; import java.lang.all; +import java.nonstandard.RuntimeTraits; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.databinding.validation.ValidationStatus; @@ -26,23 +27,26 @@ */ public class ObjectToPrimitiveValidator : IValidator { - private ClassInfo toType; + private TypeInfo toType; - private ClassInfo[][] primitiveMap = new ClassInfo[][] [ - [ Integer.TYPE, Integer.classinfo ], [ Short.TYPE, Short.classinfo ], - [ Long.TYPE, Long.classinfo ], [ Double.TYPE, Double.classinfo ], - [ Byte.TYPE, Byte.classinfo ], [ Float.TYPE, Float.classinfo ], - [ Boolean.TYPE, Boolean.classinfo ], - [ Character.TYPE, Character.classinfo ] ]; + private static TypeInfo[][] primitiveMap; + static this(){ + primitiveMap = [ + [ Integer.TYPE, typeid(Integer) ], [ Short.TYPE, typeid(Short) ], + [ Long.TYPE, typeid(Long) ], [ Double.TYPE, typeid(Double) ], + [ Byte.TYPE, typeid(Byte) ], [ Float.TYPE, typeid(Float) ], + [ Boolean.TYPE, typeid(Boolean) ], + [ Character.TYPE, typeid(Character) ] ]; + } /** * @param toType */ - public this(ClassInfo toType) { + public this(TypeInfo toType) { this.toType = toType; } - protected ClassInfo getToType() { + protected TypeInfo getToType() { return this.toType; } @@ -52,7 +56,7 @@ private IStatus doValidate(Object value) { if (value !is null) { - if (!mapContainsValues(toType, value.getClass())) { + if (!mapContainsValues(toType, getTypeInfo(value.classinfo))) { return ValidationStatus.error(getClassHint()); } return Status.OK_STATUS; @@ -60,10 +64,10 @@ return ValidationStatus.error(getNullHint()); } - private bool mapContainsValues(ClassInfo toType, ClassInfo fromType) { + private bool mapContainsValues(TypeInfo toType, TypeInfo fromType) { for (int i = 0; i < primitiveMap.length; i++) { - if ((primitiveMap[i][0].equals(toType)) - && (primitiveMap[i][1].equals(fromType))) { + if ((primitiveMap[i][0] == toType ) + && (primitiveMap[i][1] == fromType )) { return true; } } @@ -74,7 +78,7 @@ * @return a hint string */ public String getNullHint() { - return BindingMessages.getStringcast(BindingMessages.VALIDATE_CONVERSION_TO_PRIMITIVE); + return BindingMessages.getString(BindingMessages.VALIDATE_CONVERSION_TO_PRIMITIVE); } /** @@ -82,6 +86,6 @@ */ public String getClassHint() { return BindingMessages - .getStringcast(BindingMessages.VALIDATE_CONVERSION_FROM_CLASS_TO_PRIMITIVE); + .getString(BindingMessages.VALIDATE_CONVERSION_FROM_CLASS_TO_PRIMITIVE); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/ReadOnlyValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/ReadOnlyValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -42,7 +42,7 @@ public IStatus validate(Object value) { // No changes are allowed return ValidationStatus.error(BindingMessages - .getStringcast(BindingMessages.VALIDATE_NO_CHANGE_ALLOWED_HELP)); + .getString(BindingMessages.VALIDATE_NO_CHANGE_ALLOWED_HELP)); } }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToByteValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToByteValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -21,13 +21,17 @@ * @since 1.0 */ public class StringToByteValidator : AbstractStringToNumberValidator { - private static final Byte MIN = new Bytecast(Byte.MIN_VALUE); - private static final Byte MAX = new Bytecast(Byte.MAX_VALUE); + private static Byte MIN; + private static Byte MAX; /** * @param converter */ public this(NumberFormatConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Byte(Byte.MIN_VALUE); + MAX = new Byte(Byte.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToCharacterValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToCharacterValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -47,7 +47,7 @@ // The StringToCharacterConverter throws an IllegalArgumentException // if it cannot convert. return ValidationStatus.error(BindingMessages - .getStringcast(BindingMessages.VALIDATE_CHARACTER_HELP)); + .getString(BindingMessages.VALIDATE_CHARACTER_HELP)); } return Status.OK_STATUS; }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToDateValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToDateValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -43,7 +43,7 @@ * @see org.eclipse.core.databinding.validation.IValidator#validate(java.lang.Object) */ public IStatus validate(Object value) { - if ( null !is cast(String )value && (cast(String)value).trim().length() is 0) { + if ( null !is cast(ArrayWrapperString)value && (stringcast(value)).trim().length() is 0) { return Status.OK_STATUS; } Object convertedValue = converter.convert(value); @@ -75,7 +75,7 @@ samples.append('\''); samples.append(util.format(sampleDate, 0)); samples.append('\''); - return BindingMessages.getStringcast(BindingMessages.EXAMPLES) + ": " + samples + ",..."; //$NON-NLS-1$//$NON-NLS-2$ + return BindingMessages.getString(BindingMessages.EXAMPLES) ~ ": " ~ samples.toString() ~ ",..."; //$NON-NLS-1$//$NON-NLS-2$ } private static class FormatUtil : DateConversionSupport {
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToDoubleValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToDoubleValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -21,13 +21,17 @@ * @since 1.0 */ public class StringToDoubleValidator : AbstractStringToNumberValidator { - private static final Double MIN = new Double(-Double.MAX_VALUE); - private static final Double MAX = new Doublecast(Double.MAX_VALUE); + private static Double MIN; + private static Double MAX; /** * @param converter */ public this(NumberFormatConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Double(-Double.MAX_VALUE); + MAX = new Double(Double.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToFloatValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToFloatValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,13 +25,17 @@ */ public class StringToFloatValidator : AbstractStringToNumberValidator { - private static final Float MIN = new Float(-Float.MAX_VALUE); - private static final Float MAX = new Floatcast(Float.MAX_VALUE); + private static Float MIN; + private static Float MAX; /** * @param converter */ public this(NumberFormatConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Float(-Float.MAX_VALUE); + MAX = new Float( Float.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToIntegerValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToIntegerValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -25,13 +25,17 @@ * @since 1.0 */ public class StringToIntegerValidator : AbstractStringToNumberValidator { - private static final Integer MIN = new Integercast(Integer.MIN_VALUE); - private static final Integer MAX = new Integercast(Integer.MAX_VALUE); + private static Integer MIN; + private static Integer MAX; /** * @param converter */ public this(NumberFormatConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Integer(Integer.MIN_VALUE); + MAX = new Integer(Integer.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToLongValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToLongValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -24,13 +24,17 @@ * @since 1.0 */ public class StringToLongValidator : AbstractStringToNumberValidator { - private static final Long MIN = new Longcast(Long.MIN_VALUE); - private static final Long MAX = new Longcast(Long.MAX_VALUE); + private static Long MIN; + private static Long MAX; /** * @param converter */ public this(NumberFormatConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Long(Long.MIN_VALUE); + MAX = new Long(Long.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToShortValidator.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/validation/StringToShortValidator.d Sat Apr 18 13:54:50 2009 +0200 @@ -21,13 +21,17 @@ * @since 1.0 */ public class StringToShortValidator : AbstractStringToNumberValidator { - private static final Short MIN = new Shortcast(Short.MIN_VALUE); - private static final Short MAX = new Shortcast(Short.MAX_VALUE); + private static Short MIN; + private static Short MAX; /** * @param converter */ public this(NumberFormatConverter converter) { + if( MIN is null || MAX is null ){ + MIN = new Short(Short.MIN_VALUE); + MAX = new Short(Short.MAX_VALUE); + } super(converter, MIN, MAX); }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/swt/ISWTObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/swt/ISWTObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,7 @@ *******************************************************************************/ module org.eclipse.jface.databinding.swt.ISWTObservableValue; +import org.eclipse.jface.databinding.swt.ISWTObservable; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/swt/SWTObservables.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/swt/SWTObservables.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,11 +13,13 @@ * Michael Krauter, bug 180223 *******************************************************************************/ module org.eclipse.jface.databinding.swt.SWTObservables; +import org.eclipse.jface.databinding.swt.ISWTObservableValue; import java.lang.all; import java.util.ArrayList; import java.util.Iterator; +static import java.util.List; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.core.databinding.observable.list.IObservableList; @@ -66,7 +68,10 @@ */ public class SWTObservables { - private static java.util.List realms = new ArrayList(); + private static java.util.List.List realms; + static this(){ + realms = new ArrayList(); + } /** * Returns the realm representing the UI thread for the given display. @@ -174,7 +179,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -199,7 +204,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -224,7 +229,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -247,7 +252,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -284,7 +289,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -311,7 +316,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -342,7 +347,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } /** @@ -389,7 +394,7 @@ } throw new IllegalArgumentException( - "Widget [" + control.getClass().getName() + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + "Widget [" ~ Class.fromObject(control).getName() ~ "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ } private static class DisplayRealm : Realm { @@ -420,8 +425,8 @@ * * @see java.lang.Object#hashCode() */ - public int hashCode() { - return (display is null) ? 0 : display.hashCode(); + public override hash_t toHash() { + return (display is null) ? 0 : display.toHash(); } /* @@ -429,18 +434,18 @@ * * @see java.lang.Object#equals(java.lang.Object) */ - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (this is obj) return true; if (obj is null) return false; - if (getClass() !is obj.getClass()) + if (Class.fromObject(this) !is Class.fromObject(obj)) return false; final DisplayRealm other = cast(DisplayRealm) obj; if (display is null) { if (other.display !is null) return false; - } else if (!display.equals(other.display)) + } else if (!display.opEquals(other.display)) return false; return true; }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/IViewerObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/IViewerObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,7 @@ ******************************************************************************/ module org.eclipse.jface.databinding.viewers.IViewerObservableList; +import org.eclipse.jface.databinding.viewers.IViewerObservable; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/IViewerObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/IViewerObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,7 @@ ******************************************************************************/ module org.eclipse.jface.databinding.viewers.IViewerObservableSet; +import org.eclipse.jface.databinding.viewers.IViewerObservable; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/IViewerObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/IViewerObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,7 @@ ******************************************************************************/ module org.eclipse.jface.databinding.viewers.IViewerObservableValue; +import org.eclipse.jface.databinding.viewers.IViewerObservable; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ListeningLabelProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ListeningLabelProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -26,7 +26,8 @@ */ public abstract class ListeningLabelProvider : ViewerLabelProvider { - private ISetChangeListener listener = new class() ISetChangeListener { + private ISetChangeListener listener; + class _Listener : ISetChangeListener { public void handleSetChange(SetChangeEvent event) { for (Iterator it = event.diff.getAdditions().iterator(); it.hasNext();) { addListenerTo(it.next()); @@ -43,6 +44,7 @@ * @param itemsThatNeedLabels */ public this(IObservableSet itemsThatNeedLabels) { +listener = new _Listener(); this.items = itemsThatNeedLabels; items.addSetChangeListener(listener); for (Iterator it = items.iterator(); it.hasNext();) {
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableListTreeContentProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableListTreeContentProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ *******************************************************************************/ module org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; +import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableMapLabelProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableMapLabelProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -35,7 +35,8 @@ private final IObservableMap[] attributeMaps; - private IMapChangeListener mapChangeListener = new class() IMapChangeListener { + private IMapChangeListener mapChangeListener; + class MapChangeListener : IMapChangeListener { public void handleMapChange(MapChangeEvent event) { Set affectedElements = event.diff.getChangedKeys(); LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent( @@ -56,7 +57,8 @@ * @param attributeMaps */ public this(IObservableMap[] attributeMaps) { - System.arraycopy(attributeMaps, 0, this.attributeMaps = attributeMaps, 0, attributeMaps.length); +mapChangeListener = new MapChangeListener(); + System.arraycopyT(attributeMaps, 0, this.attributeMaps = attributeMaps, 0, attributeMaps.length); for (int i = 0; i < attributeMaps.length; i++) { attributeMaps[i].addMapChangeListener(mapChangeListener); }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableSetTreeContentProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableSetTreeContentProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ *******************************************************************************/ module org.eclipse.jface.databinding.viewers.ObservableSetTreeContentProvider; +import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableValueEditingSupport.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ObservableValueEditingSupport.d Sat Apr 18 13:54:50 2009 +0200 @@ -39,7 +39,7 @@ */ private EditingState editingState; - private final ColumnViewerEditorActivationListenerHelper activationListener = new ColumnViewerEditorActivationListenerHelper(); + private const ColumnViewerEditorActivationListenerHelper activationListener; private ColumnViewer viewer; @@ -56,6 +56,7 @@ */ public this(ColumnViewer viewer, DataBindingContext dbc) { +activationListener = new ColumnViewerEditorActivationListenerHelper(); super(viewer); if (dbc is null) { @@ -107,12 +108,12 @@ ViewerCell cell) { IObservableValue target = doCreateCellEditorObservable(cellEditor); Assert - .isNotNull(target, + .isNotNull(cast(Object)target, "doCreateCellEditorObservable(...) did not return an observable"); //$NON-NLS-1$ IObservableValue model = doCreateElementObservable(cell.getElement(), cell); - Assert.isNotNull(model, + Assert.isNotNull(cast(Object)model, "doCreateElementObservable(...) did not return an observable"); //$NON-NLS-1$ Binding binding = createBinding(target, model);
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ViewersObservables.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/viewers/ViewersObservables.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,9 @@ *******************************************************************************/ module org.eclipse.jface.databinding.viewers.ViewersObservables; +import org.eclipse.jface.databinding.viewers.IViewerObservableSet; +import org.eclipse.jface.databinding.viewers.IViewerObservableList; +import org.eclipse.jface.databinding.viewers.IViewerObservableValue; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/wizard/WizardPageSupport.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/wizard/WizardPageSupport.d Sat Apr 18 13:54:50 2009 +0200 @@ -74,17 +74,22 @@ } private this(WizardPage wizardPage, DataBindingContext dbc) { +uiChangeListener = new UiChangeListener(); +validationStatusProvidersListener = new ValidationStatusProvidersListener(); +validationStatusProviderTargetsListener = new ValidationStatusProviderTargetsListener(); this.wizardPage = wizardPage; this.dbc = dbc; init(); } - private IChangeListener uiChangeListener = new class() IChangeListener { + private IChangeListener uiChangeListener; + class UiChangeListener : IChangeListener { public void handleChange(ChangeEvent event) { handleUIChanged(); } }; - private IListChangeListener validationStatusProvidersListener = new class() IListChangeListener { + private IListChangeListener validationStatusProvidersListener; + class ValidationStatusProvidersListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { ListDiff diff = event.diff; ListDiffEntry[] differences = diff.getDifferences(); @@ -111,7 +116,8 @@ } } }; - private IListChangeListener validationStatusProviderTargetsListener = new class() IListChangeListener { + private IListChangeListener validationStatusProviderTargetsListener; + class ValidationStatusProviderTargetsListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { ListDiff diff = event.diff; ListDiffEntry[] differences = diff.getDifferences(); @@ -266,7 +272,7 @@ IStatus.ERROR, Policy.JFACE_DATABINDING, IStatus.OK, - "Unhandled exception: " + throwable.getMessage(), throwable)); //$NON-NLS-1$ + Format("Unhandled exception: {}", throwable.msg), throwable)); //$NON-NLS-1$ } /**
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/internal/swt/LinkObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/internal/swt/LinkObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -39,11 +39,11 @@ } public Object doGetValue() { - return link.getText(); + return stringcast(link.getText()); } public Object getValueType() { - return String.classinfo; + return Class.fromType!(String); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/AbstractSWTObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/AbstractSWTObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -20,6 +20,7 @@ import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.widgets.Widget; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; /** * NON-API - An abstract superclass for observable values that gurantees that the @@ -29,6 +30,18 @@ * @since 1.1 */ public abstract class AbstractSWTObservableValue : AbstractObservableValue , ISWTObservableValue { + public override Object getValue(){ + return super.getValue(); + } + public override void setValue( Object v ){ + super.setValue(v); + } + public void addValueChangeListener(IValueChangeListener listener) { + super.addValueChangeListener(listener); + } + public void removeValueChangeListener(IValueChangeListener listener) { + super.removeValueChangeListener(listener); + } private final Widget widget; @@ -51,12 +64,14 @@ * @since 1.2 */ protected this(Realm realm, Widget widget) { +disposeListener = new LDisposeListener(); super(realm); this.widget = widget; widget.addDisposeListener(disposeListener); } - private DisposeListener disposeListener = new class() DisposeListener { + private DisposeListener disposeListener; + class LDisposeListener : DisposeListener { public void widgetDisposed(DisposeEvent e) { this.outer.dispose(); }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/AbstractSWTVetoableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/AbstractSWTVetoableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -20,6 +20,7 @@ import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.widgets.Widget; +import org.eclipse.core.databinding.observable.value.IValueChangeListener; /** * NON-API - An abstract superclass for vetoable values that gurantees that the @@ -29,6 +30,18 @@ * @since 1.1 */ public abstract class AbstractSWTVetoableValue : AbstractVetoableValue , ISWTObservableValue { + public override Object getValue(){ + return super.getValue(); + } + public override void setValue( Object v ){ + super.setValue(v); + } + public void addValueChangeListener(IValueChangeListener listener) { + super.addValueChangeListener(listener); + } + public void removeValueChangeListener(IValueChangeListener listener) { + super.removeValueChangeListener(listener); + } private final Widget widget; @@ -50,6 +63,7 @@ * @since 1.2 */ protected this(Realm realm, Widget widget) { +disposeListener = new _DisposeListener(); super(realm); this.widget = widget; if (widget is null) { @@ -58,7 +72,8 @@ widget.addDisposeListener(disposeListener); } - private DisposeListener disposeListener = new class() DisposeListener { + private DisposeListener disposeListener; + class _DisposeListener : DisposeListener { public void widgetDisposed(DisposeEvent e) { this.outer.dispose(); }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/CompositeUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/CompositeUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * Boris Bokowski, IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.provisional.swt.CompositeUpdater; +import org.eclipse.jface.internal.databinding.provisional.swt.SWTUtil; import java.lang.all; @@ -43,7 +44,7 @@ private bool dirty = true; - private IObservable[] dependencies = new IObservable[0]; + private IObservable[] dependencies; this(Widget widget, Object element) { this.widget = widget; @@ -99,7 +100,10 @@ private class LayoutRunnable : Runnable { private bool posted = false; - private Set controlsToLayout = new HashSet(); + private Set controlsToLayout; + this(){ + controlsToLayout = new HashSet(); + } void add(Control toLayout) { controlsToLayout.add(toLayout); if (!posted) { @@ -114,7 +118,7 @@ } } - private LayoutRunnable layoutRunnable = new LayoutRunnable(); + private LayoutRunnable layoutRunnable; /** * To be called from {@link #updateWidget(Widget, Object)} or {@link #createWidget(int)} @@ -149,7 +153,7 @@ } - private PrivateInterface privateInterface = new PrivateInterface(); + private PrivateInterface privateInterface; private Composite theComposite; @@ -166,6 +170,8 @@ * an observable list to track */ public this(Composite toUpdate, IObservableList model) { +layoutRunnable = new LayoutRunnable(); +privateInterface = new PrivateInterface(); this.theComposite = toUpdate; this.model = model;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/ControlUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/ControlUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.provisional.swt.ControlUpdater; +import org.eclipse.jface.internal.databinding.provisional.swt.SWTUtil; import java.lang.all; @@ -103,15 +104,16 @@ } - private Runnable updateRunnable = new class() Runnable { + private Runnable updateRunnable; + class UpdateRunnable : Runnable { public void run() { updateControl(); } }; - private PrivateInterface privateInterface = new PrivateInterface(); + private PrivateInterface privateInterface; private Control theControl; - private IObservable[] dependencies = new IObservable[0]; + private IObservable[] dependencies; private bool dirty = false; /** @@ -120,6 +122,8 @@ * @param toUpdate control to update */ public this(Control toUpdate) { +updateRunnable = new UpdateRunnable(); +privateInterface = new PrivateInterface(); theControl = toUpdate; theControl.addDisposeListener(privateInterface);
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/MenuUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/MenuUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.provisional.swt.MenuUpdater; +import org.eclipse.jface.internal.databinding.provisional.swt.SWTUtil; import java.lang.all; @@ -88,15 +89,16 @@ } - private Runnable updateRunnable = new class() Runnable { + private Runnable updateRunnable; + class UpdateRunnable : Runnable { public void run() { updateMenu(); } }; - private PrivateInterface privateInterface = new PrivateInterface(); + private PrivateInterface privateInterface; private Menu theMenu; - private IObservable[] dependencies = new IObservable[0]; + private IObservable[] dependencies; private bool dirty = false; /** @@ -105,6 +107,8 @@ * @param toUpdate menu to update */ public this(Menu toUpdate) { +updateRunnable = new UpdateRunnable(); +privateInterface = new PrivateInterface(); theMenu = toUpdate; theMenu.addDisposeListener(privateInterface);
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/SWTUtil.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/SWTUtil.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.provisional.swt.SWTUtil; +import org.eclipse.jface.internal.databinding.provisional.swt.WorkQueue; import java.lang.all; @@ -29,7 +30,10 @@ /** * Stores a work queue for each display */ - private static Map mapDisplayOntoWorkQueue = new HashMap(); + private static Map mapDisplayOntoWorkQueue; + static this(){ + mapDisplayOntoWorkQueue = new HashMap(); + } private this() { }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/TableUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/TableUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.provisional.swt.TableUpdater; +import org.eclipse.jface.internal.databinding.provisional.swt.SWTUtil; import java.lang.all; @@ -48,7 +49,7 @@ private bool dirty = false; - private IObservable[] dependencies = new IObservable[0]; + private IObservable[] dependencies; private final Object element; @@ -142,11 +143,12 @@ } - private PrivateInterface privateInterface = new PrivateInterface(); + private PrivateInterface privateInterface; private Table table; - private IListChangeListener listChangeListener = new class() IListChangeListener { + private IListChangeListener listChangeListener; + class ListChangeListener : IListChangeListener { public void handleListChange(ListChangeEvent event) { ListDiffEntry[] differences = event.diff.getDifferences(); for (int i = 0; i < differences.length; i++) { @@ -175,6 +177,8 @@ * @since 1.2 */ public this(Table table, IObservableList list) { +privateInterface = new PrivateInterface(); +listChangeListener = new ListChangeListener(); this.table = table; this.list = list; Assert.isLegal((table.getStyle() & SWT.VIRTUAL) !is 0, @@ -195,7 +199,7 @@ */ public void dispose() { table.removeDisposeListener(privateInterface); - table.removeListener(SWT.SetData, privateInterface); + table.removeListener(SWT.SetData, cast(Listener)privateInterface); list.removeListChangeListener(listChangeListener); table = null; list = null;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/WorkQueue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/swt/WorkQueue.d Sat Apr 18 13:54:50 2009 +0200 @@ -33,20 +33,22 @@ private bool paintListenerAttached = false; - private LinkedList pendingWork = new LinkedList(); + private LinkedList pendingWork; private Display d; - private Set pendingWorkSet = new HashSet(); + private Set pendingWorkSet; - private Runnable updateJob = new class() Runnable { + private Runnable updateJob; + class UpdateJob : Runnable { public void run() { doUpdate(); updateScheduled = false; } }; - private Listener paintListener = new class() Listener { + private Listener paintListener; + class PaintListener : Listener { public void handleEvent(Event event) { paintListenerAttached = false; d.removeFilter(SWT.Paint, this); @@ -58,6 +60,10 @@ * @param targetDisplay */ public this(Display targetDisplay) { +pendingWork = new LinkedList(); +pendingWorkSet = new HashSet(); +updateJob = new UpdateJob(); +paintListener = new PaintListener(); d = targetDisplay; } @@ -69,7 +75,7 @@ break; } next = cast(Runnable) pendingWork.removeFirst(); - pendingWorkSet.remove(next); + pendingWorkSet.remove(cast(Object)next); } next.run(); @@ -87,11 +93,11 @@ */ public void runOnce(Runnable work) { synchronized (pendingWork) { - if (pendingWorkSet.contains(work)) { + if (pendingWorkSet.contains(cast(Object)work)) { return; } - pendingWorkSet.add(work); + pendingWorkSet.add(cast(Object)work); asyncExec(work); } @@ -108,7 +114,7 @@ */ public void asyncExec(Runnable work) { synchronized (pendingWork) { - pendingWork.add(work); + pendingWork.add(cast(Object)work); if (!updateScheduled) { updateScheduled = true; d.asyncExec(updateJob); @@ -134,8 +140,8 @@ */ public void cancelExec(Runnable toCancel) { synchronized (pendingWork) { - pendingWork.remove(toCancel); - pendingWorkSet.remove(toCancel); + pendingWork.remove(cast(Object)toCancel); + pendingWorkSet.remove(cast(Object)toCancel); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/viewers/TreeNode.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/viewers/TreeNode.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,7 @@ * Stefan Xenos, IBM - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.provisional.viewers.TreeNode; +import org.eclipse.jface.internal.databinding.provisional.viewers.UnorderedTreeContentProvider; import java.lang.all; @@ -52,7 +53,7 @@ private IObservableSet children; private bool hasPendingNode = false; - private bool isStale; + private bool isStale_; private bool listeningToChildren = false; private bool prefetchEnqueued = false; @@ -78,7 +79,7 @@ if (this.parent is null) { this.parent = parent; } else { - if (parent.equals(this.parent)) { + if (parent.opEquals(this.parent)) { return; } if (parents is null) { @@ -142,10 +143,10 @@ private void updateStale() { bool willBeStale = children.isStale(); - if (willBeStale !is isStale) { - isStale = willBeStale; + if (willBeStale !is isStale_) { + isStale_ = willBeStale; - contentProvider.changeStale(isStale? 1 : -1); + contentProvider.changeStale(isStale_? 1 : -1); } } @@ -153,7 +154,7 @@ * @return TODO */ public bool isStale() { - return isStale; + return isStale_; } /** @@ -190,7 +191,7 @@ children.dispose(); children = null; - if (listeningToChildren && isStale) { + if (listeningToChildren && isStale_) { contentProvider.changeStale(-1); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/viewers/UnorderedTreeContentProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/viewers/UnorderedTreeContentProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,8 @@ * Stefan Xenos, IBM - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.provisional.viewers.UnorderedTreeContentProvider; +import org.eclipse.jface.internal.databinding.provisional.viewers.IParentProvider; +import org.eclipse.jface.internal.databinding.provisional.viewers.TreeNode; import java.lang.all; @@ -45,10 +47,10 @@ */ public class UnorderedTreeContentProvider : ITreeContentProvider, ITreePathContentProvider { - private HashMap mapElementToTreeNode = new HashMap(); - private LinkedList enqueuedPrefetches = new LinkedList(); + private HashMap mapElementToTreeNode; + private LinkedList enqueuedPrefetches; private IParentProvider rootParentProvider = null; - private bool useTreePaths = false; + private bool useTreePaths_ = false; class KnownElementsSet : AbstractObservableSet { @@ -87,9 +89,10 @@ } } - KnownElementsSet elements = new KnownElementsSet(); + KnownElementsSet elements; - private ITreeViewerListener expandListener = new class() ITreeViewerListener { + private ITreeViewerListener expandListener; + class ExpandListener : ITreeViewerListener { public void treeCollapsed(TreeExpansionEvent event) { } @@ -119,6 +122,10 @@ */ public this(IUnorderedTreeProvider provider, Object pendingNode, bool useRefresh) { +mapElementToTreeNode = new HashMap(); +enqueuedPrefetches = new LinkedList(); +elements = new KnownElementsSet(); +expandListener = new ExpandListener(); this.provider = provider; this.pendingNode = pendingNode; this.useRefresh = useRefresh; @@ -152,7 +159,7 @@ * @param usePaths */ public void useTreePaths(bool usePaths) { - this.useTreePaths = usePaths; + this.useTreePaths_ = usePaths; } /** @@ -181,7 +188,7 @@ if (lastElement || useRefresh) { doRefresh(element); } else { - if (useTreePaths) { + if (useTreePaths_) { List toRemove = new ArrayList(); TreePath[] parents = getParents(element); for (int i = 0; i < parents.length; i++) { @@ -221,7 +228,7 @@ if (useRefresh) { doRefresh(element); } else { - if (useTreePaths) { + if (useTreePaths_) { TreePath[] parents = getParents(element); for (int i = 0; i < parents.length; i++) { TreePath parent = parents[i]; @@ -298,7 +305,7 @@ // This should only ever be called for a single viewer setViewer(viewer); - if (oldInput !is null && newInput !is null && oldInput.equals(newInput)) { + if (oldInput !is null && newInput !is null && oldInput.opEquals(newInput)) { return; } @@ -516,7 +523,7 @@ List parentPath = cast(List) iterator2.next(); parentPath.add(parent); - result.add(parentPath); + result.add(cast(Object)parentPath); } } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/viewers/ViewerLabelProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/provisional/viewers/ViewerLabelProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -35,7 +35,11 @@ public class ViewerLabelProvider : IViewerLabelProvider, ILabelProvider { - private List listeners = new ArrayList(); + private List listeners; + + this(){ + listeners = new ArrayList(); + } /** * Subclasses should override this method. They should not call the base @@ -48,8 +52,8 @@ protected final void fireChangeEvent(Collection changes) { final LabelProviderChangedEvent event = new LabelProviderChangedEvent( this, changes.toArray()); - ILabelProviderListener[] listenerArray = cast(ILabelProviderListener[]) listeners - .toArray(new ILabelProviderListener[listeners.size()]); + ILabelProviderListener[] listenerArray = arraycast!(ILabelProviderListener)( listeners + .toArray()); for (int i = 0; i < listenerArray.length; i++) { ILabelProviderListener listener = listenerArray[i]; try { @@ -57,7 +61,7 @@ } catch (Exception e) { Policy.getLog().log( new Status(IStatus.ERROR, Policy.JFACE_DATABINDING, e - .getLocalizedMessage(), e)); + .msg, e)); } } } @@ -75,7 +79,7 @@ } public void addListener(ILabelProviderListener listener) { - listeners.add(listener); + listeners.add(cast(Object)listener); } public void dispose() { @@ -87,7 +91,7 @@ } public void removeListener(ILabelProviderListener listener) { - listeners.remove(listener); + listeners.remove(cast(Object)listener); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ButtonObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ButtonObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -32,7 +32,8 @@ private bool selectionValue; - private Listener updateListener = new class() Listener { + private Listener updateListener; + class UpdateListener : Listener { public void handleEvent(Event event) { bool oldSelectionValue = selectionValue; selectionValue = button.getSelection(); @@ -61,6 +62,7 @@ } private void init() { +updateListener = new UpdateListener(); button.addListener(SWT.Selection, updateListener); button.addListener(SWT.DefaultSelection, updateListener); }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CComboObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CComboObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.CComboObservableList; +import org.eclipse.jface.internal.databinding.swt.SWTObservableList; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CComboObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CComboObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -13,6 +13,7 @@ * Eric Rizzo - bug 134884 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.CComboObservableValue; +import org.eclipse.jface.internal.databinding.swt.SWTProperties; import java.lang.all; @@ -85,7 +86,7 @@ }; ccombo.addModifyListener(modifyListener); } else - throw new IllegalArgumentException(); + throw new IllegalArgumentException(null); } public void doSetValue(Object value) { @@ -101,14 +102,15 @@ if (value is null) { ccombo.select(-1); } else if (items !is null) { + auto valueStr = stringcast(value); for (int i = 0; i < items.length; i++) { - if (value.equals(items[i])) { + if (valueStr.equals(items[i])) { index = i; break; } } if (index is -1) { - ccombo.setText(cast(String) value); + ccombo.setText(stringcast(value)); } else { ccombo.select(index); // -1 will not "unselect" } @@ -124,20 +126,20 @@ public Object doGetValue() { if (attribute.equals(SWTProperties.TEXT)) - return ccombo.getText(); + return stringcast(ccombo.getText()); Assert.isTrue(attribute.equals(SWTProperties.SELECTION), - "unexpected attribute: " + attribute); //$NON-NLS-1$ + "unexpected attribute: " ~ attribute); //$NON-NLS-1$ // The problem with a ccombo, is that it changes the text and // fires before it update its selection index - return ccombo.getText(); + return stringcast(ccombo.getText()); } public Object getValueType() { Assert.isTrue(attribute.equals(SWTProperties.TEXT) || attribute.equals(SWTProperties.SELECTION), - "unexpected attribute: " + attribute); //$NON-NLS-1$ - return String.classinfo; + Format("unexpected attribute: {}", attribute)); //$NON-NLS-1$ + return Class.fromType!(String); } /**
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CComboSingleSelectionObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CComboSingleSelectionObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ * Ashley Cambrell - bug 198904 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.CComboSingleSelectionObservableValue; +import org.eclipse.jface.internal.databinding.swt.SingleSelectionObservableValue; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CLabelObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/CLabelObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -54,11 +54,11 @@ } public Object doGetValue() { - return label.getText(); + return stringcast(label.getText()); } public Object getValueType() { - return String.classinfo; + return Class.fromType!(String); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ComboObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ComboObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.ComboObservableList; +import org.eclipse.jface.internal.databinding.swt.SWTObservableList; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ComboObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ComboObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ * Matthew Hall - bug 118516 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.ComboObservableValue; +import org.eclipse.jface.internal.databinding.swt.SWTProperties; import java.lang.all; @@ -76,7 +77,7 @@ }; combo.addModifyListener(modifyListener); } else - throw new IllegalArgumentException(); + throw new IllegalArgumentException(null); } public void doSetValue(Object value) { @@ -89,15 +90,16 @@ } else if (attribute.equals(SWTProperties.SELECTION)) { String items[] = combo.getItems(); int index = -1; + auto valueStr = stringcast(value); if (items !is null && value !is null) { for (int i = 0; i < items.length; i++) { - if (value.equals(items[i])) { + if (valueStr.equals(items[i])) { index = i; break; } } if (index is -1) { - combo.setText(cast(String) value); + combo.setText(stringcast(value)); } else { combo.select(index); // -1 will not "unselect" } @@ -113,20 +115,20 @@ public Object doGetValue() { if (attribute.equals(SWTProperties.TEXT)) - return combo.getText(); + return stringcast(combo.getText()); Assert.isTrue(attribute.equals(SWTProperties.SELECTION), - "unexpected attribute: " + attribute); //$NON-NLS-1$ + "unexpected attribute: " ~ attribute); //$NON-NLS-1$ // The problem with a ccombo, is that it changes the text and // fires before it update its selection index - return combo.getText(); + return stringcast(combo.getText()); } public Object getValueType() { Assert.isTrue(attribute.equals(SWTProperties.TEXT) || attribute.equals(SWTProperties.SELECTION), - "unexpected attribute: " + attribute); //$NON-NLS-1$ - return String.classinfo; + Format("unexpected attribute: {}", attribute)); //$NON-NLS-1$ + return Class.fromType!(String); } /**
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ComboSingleSelectionObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ComboSingleSelectionObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ * Ashley Cambrell - bugs 198903, 198904 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.ComboSingleSelectionObservableValue; +import org.eclipse.jface.internal.databinding.swt.SingleSelectionObservableValue; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ControlObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ControlObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ * Brad Reynolds - bug 170848 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.ControlObservableValue; +import org.eclipse.jface.internal.databinding.swt.SWTProperties; import java.lang.all; @@ -41,10 +42,10 @@ SUPPORTED_ATTRIBUTES = new HashMap(); SUPPORTED_ATTRIBUTES.put(SWTProperties.ENABLED, Boolean.TYPE); SUPPORTED_ATTRIBUTES.put(SWTProperties.VISIBLE, Boolean.TYPE); - SUPPORTED_ATTRIBUTES.put(SWTProperties.TOOLTIP_TEXT, String.classinfo); - SUPPORTED_ATTRIBUTES.put(SWTProperties.FOREGROUND, Color.classinfo); - SUPPORTED_ATTRIBUTES.put(SWTProperties.BACKGROUND, Color.classinfo); - SUPPORTED_ATTRIBUTES.put(SWTProperties.FONT, Font.classinfo); + SUPPORTED_ATTRIBUTES.put(SWTProperties.TOOLTIP_TEXT, Class.fromType!(String)); + SUPPORTED_ATTRIBUTES.put(SWTProperties.FOREGROUND, Class.fromType!(Color)); + SUPPORTED_ATTRIBUTES.put(SWTProperties.BACKGROUND, Class.fromType!(Color)); + SUPPORTED_ATTRIBUTES.put(SWTProperties.FONT, Class.fromType!(Font)); } /** @@ -58,7 +59,7 @@ if (SUPPORTED_ATTRIBUTES.keySet().contains(attribute)) { this.valueType = SUPPORTED_ATTRIBUTES.get(attribute); } else { - throw new IllegalArgumentException(); + throw new IllegalArgumentException(null); } } @@ -69,7 +70,7 @@ } else if (attribute.equals(SWTProperties.VISIBLE)) { control.setVisible((cast(Boolean) value).booleanValue()); } else if (attribute.equals(SWTProperties.TOOLTIP_TEXT)) { - control.setToolTipText(cast(String) value); + control.setToolTipText(stringcast(value)); } else if (attribute.equals(SWTProperties.FOREGROUND)) { control.setForeground(cast(Color) value); } else if (attribute.equals(SWTProperties.BACKGROUND)) { @@ -88,7 +89,7 @@ return control.getVisible() ? Boolean.TRUE : Boolean.FALSE; } if (attribute.equals(SWTProperties.TOOLTIP_TEXT)) { - return control.getToolTipText(); + return stringcast(control.getToolTipText()); } if (attribute.equals(SWTProperties.FOREGROUND)) { return control.getForeground();
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/DelayedObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/DelayedObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -55,7 +55,7 @@ class ValueUpdater : Runnable { private final Object oldValue; - bool cancel = false; + bool cancel_ = false; bool running = false; this(Object oldValue) { @@ -63,11 +63,11 @@ } void cancel() { - cancel = true; + cancel_ = true; } public void run() { - if (!cancel) + if (!cancel_) try { running = true; internalFireValueChange(oldValue); @@ -77,21 +77,24 @@ } } - private IStaleListener staleListener = new class() IStaleListener { + private IStaleListener staleListener; + class StaleListener : IStaleListener { public void handleStale(StaleEvent staleEvent) { if (!updating) fireStale(); } }; - private IValueChangeListener valueChangeListener = new class() IValueChangeListener { + private IValueChangeListener valueChangeListener; + class ValueChangeListener : IValueChangeListener { public void handleValueChange(ValueChangeEvent event) { if (!updating) makeDirty(); } }; - private Listener focusOutListener = new class() Listener { + private Listener focusOutListener; + class FocusOutListener : Listener { public void handleEvent(Event event) { // Force update on focus out if (dirty) @@ -123,6 +126,9 @@ */ public this(int delayMillis, ISWTObservableValue observable) { +staleListener = new StaleListener(); +valueChangeListener = new ValueChangeListener(); +focusOutListener = new FocusOutListener(); super(observable.getRealm(), observable.getWidget()); this.delay = delayMillis; this.observable = observable; @@ -166,7 +172,7 @@ // passed to setValue(). Make sure we cache whatever is set. cachedValue = observable.getValue(); - if (!Util.equals(oldValue, cachedValue)) + if (!Util.opEquals(oldValue, cachedValue)) fireValueChange(Diffs.createValueDiff(oldValue, cachedValue)); } finally { updating = false;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/LabelObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/LabelObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -48,17 +48,17 @@ String newValue = value is null ? "" : value.toString(); //$NON-NLS-1$ label.setText(newValue); - if (!newValue.opEquals(oldValue)) { + if (!newValue.equals(oldValue)) { fireValueChange(Diffs.createValueDiff(oldValue, newValue)); } } public Object doGetValue() { - return label.getText(); + return stringcast(label.getText()); } public Object getValueType() { - return String.classinfo; + return Class.fromType!(String); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ListObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ListObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.ListObservableList; +import org.eclipse.jface.internal.databinding.swt.SWTObservableList; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ListObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ListObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -41,7 +41,7 @@ public this(List list) { super(list); this.list = list; - this.currentValue = cast(String) doGetValue(); + this.currentValue = stringcast(doGetValue()); if ((list.getStyle() & SWT.MULTI) > 0) throw new IllegalArgumentException( @@ -51,10 +51,10 @@ public void handleEvent(Event event) { if (!updating) { - Object oldValue = currentValue; - currentValue = cast(String) doGetValue(); + Object oldValue = stringcast(currentValue); + currentValue = stringcast(doGetValue()); fireValueChange(Diffs.createValueDiff(oldValue, - currentValue)); + stringcast(currentValue))); } } @@ -70,31 +70,32 @@ updating = true; String items[] = list.getItems(); int index = -1; + String valueStr = stringcast(value); if (items !is null && value !is null) { for (int i = 0; i < items.length; i++) { - if (value.equals(items[i])) { + if (valueStr.equals(items[i])) { index = i; break; } } list.select(index); // -1 will not "unselect" } - currentValue = cast(String) value; + currentValue = stringcast(value); } finally { updating = false; } - fireValueChange(Diffs.createValueDiff(oldValue, value)); + fireValueChange(Diffs.createValueDiff(stringcast(oldValue), value)); } public Object doGetValue() { int index = list.getSelectionIndex(); if (index >= 0) - return list.getItem(index); + return stringcast(list.getItem(index)); return null; } public Object getValueType() { - return String.classinfo; + return Class.fromType!(String); } /*
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ListSingleSelectionObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ListSingleSelectionObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ * Ashley Cambrell - bug 198904 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.ListSingleSelectionObservableValue; +import org.eclipse.jface.internal.databinding.swt.SingleSelectionObservableValue; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/SWTObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/SWTObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -53,7 +53,7 @@ index = size; String[] newItems = new String[size + 1]; System.arraycopy(getItems(), 0, newItems, 0, index); - newItems[index] = cast(String) element; + newItems[index] = stringcast( element); System.arraycopy(getItems(), index, newItems, index + 1, size - index); setItems(newItems); fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry(index, @@ -66,11 +66,11 @@ public Object get(int index) { getterCalled(); - return getItem(index); + return stringcast(getItem(index)); } public Object getElementType() { - return String.classinfo; + return Class.fromType!(String); } /** @@ -111,17 +111,17 @@ } setItems(newItems); fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry(index, - false, oldElement))); - return oldElement; + false, stringcast(oldElement)))); + return stringcast(oldElement); } public Object set(int index, Object element) { String oldElement = getItem(index); - setItem(index, cast(String) element); + setItem(index, stringcast( element)); fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry(index, - false, oldElement), Diffs.createListDiffEntry(index, true, + false, stringcast(oldElement)), Diffs.createListDiffEntry(index, true, element))); - return oldElement; + return stringcast(oldElement); } public Object move(int oldIndex, int newIndex) { @@ -131,10 +131,10 @@ int size = doGetSize(); if (oldIndex < 0 || oldIndex >= size) throw new IndexOutOfBoundsException( - "oldIndex: " + oldIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("oldIndex: {}, size:{}", oldIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ if (newIndex < 0 || newIndex >= size) throw new IndexOutOfBoundsException( - "newIndex: " + newIndex + ", size:" + size); //$NON-NLS-1$ //$NON-NLS-2$ + Format("newIndex: {}, size:{}", newIndex, size)); //$NON-NLS-1$ //$NON-NLS-2$ String[] items = getItems(); String[] newItems = new String[size]; @@ -152,9 +152,9 @@ } setItems(newItems); fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry(oldIndex, - false, element), Diffs.createListDiffEntry(newIndex, true, - element))); - return element; + false, stringcast(element)), Diffs.createListDiffEntry(newIndex, true, + stringcast(element)))); + return stringcast(element); } public bool removeAll(Collection c) {
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ScaleObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ScaleObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,7 @@ * Peter Centgraf - bug 175763 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.ScaleObservableValue; +import org.eclipse.jface.internal.databinding.swt.SWTProperties; import java.lang.all; @@ -77,7 +78,7 @@ } else if (!attribute.equals(SWTProperties.MIN) && !attribute.equals(SWTProperties.MAX)) { throw new IllegalArgumentException( - "Attribute name not valid: " + attribute); //$NON-NLS-1$ + "Attribute name not valid: " ~ attribute); //$NON-NLS-1$ } } @@ -98,7 +99,7 @@ oldValue = scale.getMaximum(); scale.setMaximum(newValue); } else { - Assert.isTrue(false, "invalid attribute name:" + attribute); //$NON-NLS-1$ + Assert.isTrue(false, "invalid attribute name:" ~ attribute); //$NON-NLS-1$ return; } @@ -110,7 +111,7 @@ public Object doGetValue() { int value = 0; - if (attribute.opEquals(SWTProperties.SELECTION)) { + if (attribute.equals(SWTProperties.SELECTION)) { value = scale.getSelection(); } else if (attribute.equals(SWTProperties.MIN)) { value = scale.getMinimum();
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ShellObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ShellObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -61,16 +61,16 @@ String newValue = value is null ? "" : value.toString(); //$NON-NLS-1$ shell.setText(newValue); - if (!newValue.opEquals(oldValue)) { - fireValueChange(Diffs.createValueDiff(oldValue, newValue)); + if (!newValue.equals(oldValue)) { + fireValueChange(Diffs.createValueDiff(stringcast(oldValue), stringcast(newValue))); } } protected Object doGetValue() { - return shell.getText(); + return stringcast(shell.getText()); } public Object getValueType() { - return String.classinfo; + return Class.fromType!(String); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/SpinnerObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/SpinnerObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -12,6 +12,7 @@ * Matthew Hall - bug 118516 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.SpinnerObservableValue; +import org.eclipse.jface.internal.databinding.swt.SWTProperties; import java.lang.all; @@ -100,7 +101,7 @@ oldValue = spinner.getMaximum(); spinner.setMaximum(newValue); } else { - Assert.isTrue(false, "invalid attribute name:" + attribute); //$NON-NLS-1$ + Assert.isTrue(false, "invalid attribute name:" ~ attribute); //$NON-NLS-1$ return; } notifyIfChanged(oldValue, newValue);
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/TableSingleSelectionObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/TableSingleSelectionObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ * Ashley Cambrell - bug 198904 *******************************************************************************/ module org.eclipse.jface.internal.databinding.swt.TableSingleSelectionObservableValue; +import org.eclipse.jface.internal.databinding.swt.SingleSelectionObservableValue; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/TextEditableObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/TextEditableObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -70,7 +70,7 @@ text.setEditable(newValue.booleanValue()); - if (!oldValue.equals(newValue)) { + if (!oldValue.opEquals(newValue)) { fireValueChange(Diffs.createValueDiff(oldValue, newValue)); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/TextObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/TextObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -49,7 +49,7 @@ /** * {@link Text} widget that this is being observed. */ - private final Text text; + private const Text text; /** * Flag to track when the model is updating the widget. When @@ -62,7 +62,7 @@ * SWT event that on firing this observable will fire change events to its * listeners. */ - private final int updateEventType; + private const int updateEventType; /** * Valid types for the {@link #updateEventType}. @@ -75,13 +75,14 @@ */ private String oldValue; - private Listener updateListener = new class() Listener { + private Listener updateListener; + class UpdateListener : Listener { public void handleEvent(Event event) { if (!updating) { String newValue = text.getText(); if (!newValue.equals(oldValue)) { - fireValueChange(Diffs.createValueDiff(oldValue, newValue)); + fireValueChange(Diffs.createValueDiff(stringcast(oldValue), stringcast(newValue))); oldValue = newValue; } } @@ -115,6 +116,7 @@ * @param updateEventType */ public this(Realm realm, Text text, int updateEventType) { +updateListener = new UpdateListener(); super(realm, text); bool eventValid = false; @@ -123,7 +125,7 @@ } if (!eventValid) { throw new IllegalArgumentException( - "UpdateEventType [" + updateEventType + "] is not supported."); //$NON-NLS-1$//$NON-NLS-2$ + Format("UpdateEventType [{}] is not supported.", updateEventType )); //$NON-NLS-1$//$NON-NLS-2$ } this.text = text; this.updateEventType = updateEventType; @@ -138,10 +140,10 @@ if (!updating) { String currentText = text .getText(); - String newText = currentText.substring(0, e.start) + e.text - + currentText.substring(e.end); - if (!fireValueChanging(Diffs.createValueDiff(currentText, - newText))) { + String newText = currentText.substring(0, e.start) ~ e.text + ~ currentText.substring(e.end); + if (!fireValueChanging(Diffs.createValueDiff(stringcast(currentText), + stringcast(newText)))) { e.doit = false; } } @@ -175,7 +177,7 @@ * @see org.eclipse.core.databinding.observable.value.AbstractVetoableValue#doGetValue() */ public Object doGetValue() { - return oldValue = text.getText(); + return stringcast(oldValue = text.getText()); } /** @@ -185,7 +187,7 @@ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() */ public Object getValueType() { - return String.classinfo; + return Class.fromType!(String); } public void dispose() {
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/CheckableCheckedElementsObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/CheckableCheckedElementsObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,6 +10,7 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.CheckableCheckedElementsObservableSet; +import org.eclipse.jface.internal.databinding.viewers.ViewerElementSet; import java.lang.all; @@ -68,8 +69,8 @@ public this(Realm realm, ICheckable checkable, Object elementType, Set wrappedSet) { super(realm); - Assert.isNotNull(checkable, "Checkable cannot be null"); //$NON-NLS-1$ - Assert.isNotNull(wrappedSet, "Wrapped set cannot be null"); //$NON-NLS-1$ + Assert.isNotNull(cast(Object)checkable, "Checkable cannot be null"); //$NON-NLS-1$ + Assert.isNotNull(cast(Object)wrappedSet, "Wrapped set cannot be null"); //$NON-NLS-1$ this.checkable = checkable; this.wrappedSet = wrappedSet; this.elementType = elementType; @@ -106,6 +107,9 @@ return elementType; } + public bool add(String o) { + return add(stringcast(o)); + } public bool add(Object o) { getterCalled(); bool added = wrappedSet.add(o); @@ -117,6 +121,10 @@ return added; } + alias AbstractObservableSet.remove remove; + public bool remove(String o) { + return remove(stringcast(o)); + } public bool remove(Object o) { getterCalled(); bool removed = wrappedSet.remove(o);
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/CheckboxViewerCheckedElementsObservableSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/CheckboxViewerCheckedElementsObservableSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -10,11 +10,15 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.CheckboxViewerCheckedElementsObservableSet; +import org.eclipse.jface.internal.databinding.viewers.ViewerElementSet; +import org.eclipse.jface.internal.databinding.viewers.CheckableCheckedElementsObservableSet; import java.lang.all; import java.util.Arrays; import java.util.Set; +import java.util.Collection; +import java.util.Iterator; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.jface.databinding.viewers.IViewerObservableSet; @@ -31,6 +35,69 @@ */ public class CheckboxViewerCheckedElementsObservableSet : CheckableCheckedElementsObservableSet , IViewerObservableSet { + public override Object getElementType(){ + return super.getElementType(); + } + public override bool add(Object o){ + return super.add(o); + } + public override bool add(String o){ + return super.add(o); + } + public override bool addAll(Collection o){ + return super.addAll(o); + } + public override bool contains(Object o){ + return super.contains(o); + } + public override bool containsAll(Collection o){ + return super.containsAll(o); + } + public override void clear(){ + super.clear(); + } + public override bool isEmpty(){ + return super.isEmpty(); + } + public override equals_t opEquals(Object o){ + return super.opEquals(o); + } + public override Iterator iterator(){ + return super.iterator(); + } + public override hash_t toHash(){ + return super.toHash(); + } + public override bool remove(String o){ + return super.remove(o); + } + public override bool remove(Object o){ + return super.remove(o); + } + //public override Object remove(int o){ + // return super.remove(o); + //} + public override bool removeAll(Collection o){ + return super.removeAll(o); + } + public override bool retainAll(Collection o){ + return super.retainAll(o); + } + public override int size(){ + return super.size(); + } + public override Object[] toArray(){ + return super.toArray(); + } + public override Object[] toArray(Object[] o){ + return super.toArray(o); + } + //public override String[] toArray(String[] o){ + // return super.toArray(o); + //} + public override int opApply( int delegate( ref Object v ) dg ){ + return super.opApply(dg); + } private StructuredViewer viewer; /**
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/LeafNodesSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/LeafNodesSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -35,9 +35,9 @@ */ public class LeafNodesSet : AbstractObservableSet { - private HashSet leafNodes = new HashSet(); + private HashSet leafNodes; - private HashMap mapElementsOntoNodeInfo = new HashMap(); + private HashMap mapElementsOntoNodeInfo; private IUnorderedTreeProvider tree; @@ -120,6 +120,8 @@ * tree whose leaf nodes will be computed */ public this(Object initialInput, IUnorderedTreeProvider tree) { +leafNodes = new HashSet(); +mapElementsOntoNodeInfo = new HashMap(); super(tree.getRealm()); this.tree = tree; if (initialInput !is null) {
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ListViewerUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ListViewerUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ListViewerUpdater; +import org.eclipse.jface.internal.databinding.viewers.ViewerUpdater; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ObservableCollectionContentProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ObservableCollectionContentProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,10 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ObservableCollectionContentProvider; +import org.eclipse.jface.internal.databinding.viewers.ViewerUpdater; +import org.eclipse.jface.internal.databinding.viewers.TableViewerUpdater; +import org.eclipse.jface.internal.databinding.viewers.ListViewerUpdater; +import org.eclipse.jface.internal.databinding.viewers.ObservableViewerElementSet; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ObservableCollectionTreeContentProvider.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ObservableCollectionTreeContentProvider.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,10 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ObservableCollectionTreeContentProvider; +import org.eclipse.jface.internal.databinding.viewers.ViewerElementSet; +import org.eclipse.jface.internal.databinding.viewers.TreeViewerUpdater; +import org.eclipse.jface.internal.databinding.viewers.ViewerElementMap; +import org.eclipse.jface.internal.databinding.viewers.ObservableViewerElementSet; import java.lang.all; @@ -104,7 +108,7 @@ .unmodifiableObservableSet(knownElements); Assert - .isNotNull(collectionFactory, + .isNotNull(cast(Object)collectionFactory, "Collection factory cannot be null"); //$NON-NLS-1$ this.collectionFactory = collectionFactory; } @@ -293,8 +297,8 @@ private bool equal(Object left, Object right) { if (comparer is null) - return Util.equals(left, right); - return comparer.equals(left, right); + return Util.opEquals(left, right); + return cast(bool)comparer.opEquals(left, right); } public void addParent(Object newParent) { @@ -344,7 +348,7 @@ children = Observables.emptyObservableSet(realm); } else { Assert - .isTrue(Util.equals(realm, children.getRealm()), + .isTrue(Util.opEquals(realm, children.getRealm()), "Children observable collection must be on the Display realm"); //$NON-NLS-1$ listener = createCollectionChangeListener(element); addCollectionChangeListener(children, listener);
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ObservableViewerElementSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ObservableViewerElementSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ObservableViewerElementSet; +import org.eclipse.jface.internal.databinding.viewers.ViewerElementSet; import java.lang.all; @@ -62,7 +63,7 @@ IElementComparer comparer) { super(realm); - Assert.isNotNull(comparer); + Assert.isNotNull(cast(Object)comparer); this.wrappedSet = new ViewerElementSet(comparer); this.elementType = elementType; this.comparer = comparer; @@ -157,7 +158,7 @@ // Cannot rely on c.contains(element) because we must compare // elements using IElementComparer. for (int i = 0; i < toRetain.length; i++) { - if (comparer.equals(element, toRetain[i])) + if (comparer.opEquals(element, toRetain[i])) continue outer; } iterator.remove();
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderMultipleSelectionObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderMultipleSelectionObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -39,7 +39,7 @@ protected ISelectionProvider selectionProvider; protected bool handlingSelection; protected bool updating; - protected SelectionListener selectionListener = new SelectionListener(); + protected SelectionListener selectionListener; class SelectionListener : ISelectionChangedListener { public void selectionChanged(SelectionChangedEvent event) { @@ -66,6 +66,7 @@ */ public this(Realm realm, ISelectionProvider selectionProvider, Object elementType) { +selectionListener = new SelectionListener(); super(realm, new ArrayList(getSelectionList(selectionProvider)), elementType); this.selectionProvider = selectionProvider; selectionProvider.addSelectionChangedListener(selectionListener); @@ -93,7 +94,7 @@ protected static List getSelectionList(ISelectionProvider selectionProvider) { if (selectionProvider is null) { - throw new IllegalArgumentException(); + throw new IllegalArgumentException(null); } return getSelectionList(selectionProvider.getSelection()); }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderSingleSelectionObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/SelectionProviderSingleSelectionObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -96,7 +96,7 @@ .setSelection(value is null ? StructuredSelection.EMPTY : new StructuredSelection(value)); currentSelection = doGetValue(); - if (!Util.equals(oldSelection, currentSelection)) { + if (!Util.opEquals(oldSelection, currentSelection)) { fireValueChange(Diffs.createValueDiff(oldSelection, currentSelection)); }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/TableViewerUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/TableViewerUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.TableViewerUpdater; +import org.eclipse.jface.internal.databinding.viewers.ViewerUpdater; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/TreeViewerUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/TreeViewerUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -118,8 +118,8 @@ for (int j = 0; j < path.getSegmentCount(); j++) { Object pathElement = path.getSegment(j); if (comparer is null ? Util - .equals(element, pathElement) : comparer - .equals(element, pathElement)) { + .opEquals(element, pathElement) : comparer + .opEquals(element, pathElement)) { viewer.setSelection(selection); break outer; }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerElementMap.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerElementMap.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ViewerElementMap; +import org.eclipse.jface.internal.databinding.viewers.ViewerElementWrapper; import java.lang.all; @@ -40,6 +41,48 @@ * @since 1.2 */ public class ViewerElementMap : Map { + +public bool containsKey(String o) { + return containsKey(stringcast(o)); +} +public bool containsValue(String o) { + return containsValue(stringcast(o)); +} +public Object put(Object k, String v) { + return put((k),stringcast(v)); +} +public Object put(String k, Object v) { + return put(stringcast(k),(v)); +} +public Object put(String k, String v) { + return put(stringcast(k),stringcast(v)); +} +public Object get(String k) { + return get(stringcast(k)); +} +public Object remove(String k) { + return remove(stringcast(k)); +} +public int opApply (int delegate(ref Object value) dg){ + foreach( entry; entrySet() ){ + auto me = cast(Map.Entry)entry; + auto v = me.getValue(); + int res = dg( v ); + if( res ) return res; + } + return 0; +} +public int opApply (int delegate(ref Object key, ref Object value) dg){ + foreach( entry; entrySet() ){ + auto me = cast(Map.Entry)entry; + auto k = me.getKey(); + auto v = me.getValue(); + int res = dg( k, v ); + if( res ) return res; + } + return 0; +} + private Map wrappedMap; private IElementComparer comparer; @@ -50,7 +93,7 @@ * the {@link IElementComparer} used for comparing keys. */ public this(IElementComparer comparer) { - Assert.isNotNull(comparer); + Assert.isNotNull(cast(Object)comparer); this.wrappedMap = new HashMap(); this.comparer = comparer; } @@ -66,7 +109,7 @@ */ public this(Map map, IElementComparer comparer) { this(comparer); - Assert.isNotNull(map); + Assert.isNotNull(cast(Object)map); putAll(map); } @@ -85,6 +128,27 @@ public Set entrySet() { final Set wrappedEntrySet = wrappedMap.entrySet(); return new class() Set { +public bool add(String o) { + return add(stringcast(o)); +} +public bool remove(String o) { + return remove(stringcast(o)); +} +public bool contains(String o) { + return contains(stringcast(o)); +} +public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; +} +public String toString(){ + return super.toString(); +} public bool add(Object o) { throw new UnsupportedOperationException(); } @@ -99,7 +163,7 @@ public bool contains(Object o) { for (Iterator iterator = iterator(); iterator.hasNext();) - if (iterator.next().equals(o)) + if (iterator.next().opEquals(o)) return true; return false; } @@ -139,20 +203,20 @@ return wrappedEntry.setValue(value); } - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (obj is this) return true; if (obj is null || !(null !is cast(Map.Entry)obj)) return false; Map.Entry that = cast(Map.Entry) obj; - return comparer.equals(this.getKey(), that + return comparer.opEquals(this.getKey(), that .getKey()) - && Util.equals(this.getValue(), that + && Util.opEquals(this.getValue(), that .getValue()); } - public int hashCode() { - return wrappedEntry.hashCode(); + public override hash_t toHash() { + return wrappedEntry.toHash(); } }; } @@ -180,25 +244,25 @@ throw new UnsupportedOperationException(); } - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (obj is this) return true; if (obj is null || !(null !is cast(Map.Entry)obj)) return false; Map.Entry that = cast(Map.Entry) obj; - return Util.equals(wrappedKey, that.getKey()) + return Util.opEquals(wrappedKey, that.getKey()) && Util - .equals(this.getValue(), that + .opEquals(this.getValue(), that .getValue()); } - public int hashCode() { - return wrappedKey.hashCode() + public override hash_t toHash() { + return wrappedKey.toHash() ^ (getValue() is null ? 0 : getValue() - .hashCode()); + .toHash()); } }; - return wrappedEntrySet.remove(wrappedEntry); + return wrappedEntrySet.remove(cast(Object)wrappedEntry); } public bool removeAll(Collection c) { @@ -214,7 +278,7 @@ outer: for (Iterator iterator = iterator(); iterator.hasNext();) { Object entry = iterator.next(); for (int i = 0; i < toRetain.length; i++) - if (entry.equals(toRetain[i])) + if (entry.opEquals(toRetain[i])) continue outer; iterator.remove(); changed = true; @@ -233,8 +297,7 @@ public Object[] toArray(Object[] a) { int size = size(); if (a.length < size) { - a = cast(Object[]) Array.newInstance(a.getClass() - .getComponentType(), size); + a = new Object[size]; } int i = 0; for (Iterator iterator = iterator(); iterator.hasNext();) { @@ -244,7 +307,7 @@ return a; } - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (obj is this) return true; if (obj is null || !(null !is cast(Set)obj)) @@ -253,8 +316,8 @@ return this.size() is that.size() && containsAll(that); } - public int hashCode() { - return wrappedEntrySet.hashCode(); + public override hash_t toHash() { + return wrappedEntrySet.toHash(); } }; } @@ -270,6 +333,27 @@ public Set keySet() { final Set wrappedKeySet = wrappedMap.keySet(); return new class() Set { +public bool add(String o) { + return add(stringcast(o)); +} +public bool remove(String o) { + return remove(stringcast(o)); +} +public bool contains(String o) { + return contains(stringcast(o)); +} +public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; +} +public String toString(){ + return super.toString(); +} public bool add(Object o) { throw new UnsupportedOperationException(); } @@ -332,7 +416,7 @@ outer: for (Iterator iterator = iterator(); iterator.hasNext();) { Object element = iterator.next(); for (int i = 0; i < toRetain.length; i++) - if (comparer.equals(element, toRetain[i])) + if (comparer.opEquals(element, toRetain[i])) continue outer; // element not contained in collection, remove. remove(element); @@ -355,15 +439,14 @@ .toArray(new ViewerElementWrapper[size]); Object[] result = a; if (a.length < size) { - result = cast(Object[]) Array.newInstance(a.getClass() - .getComponentType(), size); + result = new Object[size]; } for (int i = 0; i < size; i++) result[i] = wrappedArray[i].unwrap(); return result; } - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (obj is this) return true; if (obj is null || !(null !is cast(Set)obj)) @@ -372,8 +455,8 @@ return this.size() is that.size() && containsAll(that); } - public int hashCode() { - return wrappedKeySet.hashCode(); + public override hash_t toHash() { + return wrappedKeySet.toHash(); } }; } @@ -402,17 +485,17 @@ return wrappedMap.values(); } - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (obj is this) return true; if (obj is null || !(null !is cast(Map)obj)) return false; Map that = cast(Map) obj; - return this.entrySet().equals(that.entrySet()); + return (cast(Object)this.entrySet()).opEquals(cast(Object)that.entrySet()); } - public int hashCode() { - return wrappedMap.hashCode(); + public override hash_t toHash() { + return wrappedMap.toHash(); } /**
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerElementSet.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerElementSet.d Sat Apr 18 13:54:50 2009 +0200 @@ -11,6 +11,7 @@ ******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ViewerElementSet; +import org.eclipse.jface.internal.databinding.viewers.ViewerElementWrapper; import java.lang.all; @@ -38,6 +39,31 @@ * @since 1.2 */ public class ViewerElementSet : Set { +// DWT start: additional methods in Set + public bool add(String o) { + return add(stringcast(o)); + } + public bool remove(String o) { + return remove(stringcast(o)); + } + public bool contains(String o) { + return contains(stringcast(o)); + } + public int opApply (int delegate(ref Object value) dg){ + auto it = iterator(); + while(it.hasNext()){ + auto v = it.next(); + int res = dg( v ); + if( res ) return res; + } + return 0; + } + public String toString(){ + return super.toString(); + } + +// DWT end: additional methods in Set + private final Set wrappedSet; private final IElementComparer comparer; @@ -48,7 +74,7 @@ * the {@link IElementComparer} used for comparing elements. */ public this(IElementComparer comparer) { - Assert.isNotNull(comparer); + Assert.isNotNull(cast(Object)comparer); this.wrappedSet = new HashSet(); this.comparer = comparer; } @@ -136,7 +162,7 @@ outer: for (Iterator iterator = iterator(); iterator.hasNext();) { Object element = iterator.next(); for (int i = 0; i < retainAll.length; i++) { - if (comparer.equals(element, retainAll[i])) { + if (comparer.opEquals(element, retainAll[i])) { continue outer; } } @@ -160,15 +186,16 @@ .toArray(new ViewerElementWrapper[size]); Object[] result = a; if (a.length < size) { - result = cast(Object[]) Array.newInstance(a.getClass() - .getComponentType(), size); + //result = cast(Object[]) Array.newInstance(a.getClass() + // .getComponentType(), size); + result = new Object[size]; } for (int i = 0; i < size; i++) result[i] = wrappedArray[i].unwrap(); return result; } - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (obj is this) return true; if (!(null !is cast(Set)obj)) @@ -177,11 +204,11 @@ return size() is that.size() && containsAll(that); } - public int hashCode() { + public override hash_t toHash() { int hash = 0; for (Iterator iterator = iterator(); iterator.hasNext();) { Object element = iterator.next(); - hash += element is null ? 0 : element.hashCode(); + hash += element is null ? 0 : element.toHash(); } return hash; }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerElementWrapper.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerElementWrapper.d Sat Apr 18 13:54:50 2009 +0200 @@ -41,15 +41,15 @@ this.comparer = comparer; } - public bool equals(Object obj) { + public override equals_t opEquals(Object obj) { if (!(null !is cast(ViewerElementWrapper)obj)) { return false; } - return comparer.equals(element, (cast(ViewerElementWrapper) obj).element); + return comparer.opEquals(element, (cast(ViewerElementWrapper) obj).element); } - public int hashCode() { - return comparer.hashCode(element); + public override hash_t toHash() { + return comparer.toHash(element); } Object unwrap() {
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerInputObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerInputObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -55,7 +55,7 @@ protected void doSetValue( Object value ) { Object oldValue = doGetValue(); viewer.setInput( value ); - if ( !Util.equals( oldValue, value ) ) { + if ( !Util.opEquals( oldValue, value ) ) { fireValueChange( Diffs.createValueDiff( oldValue, value ) ); } }
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerMultipleSelectionObservableList.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerMultipleSelectionObservableList.d Sat Apr 18 13:54:50 2009 +0200 @@ -14,8 +14,11 @@ *******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ViewerMultipleSelectionObservableList; +import org.eclipse.jface.internal.databinding.viewers.SelectionProviderMultipleSelectionObservableList; import java.lang.all; +import java.util.Collection; +import java.util.Iterator; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.jface.databinding.viewers.IViewerObservableList; @@ -29,6 +32,69 @@ public class ViewerMultipleSelectionObservableList : SelectionProviderMultipleSelectionObservableList , IViewerObservableList { + public override Object getElementType(){ + return super.getElementType(); + } + public override bool add(Object o){ + return super.add(o); + } + public override bool add(String o){ + return add(stringcast(o)); + } + public override bool addAll(Collection o){ + return super.addAll(o); + } + public override void clear(){ + return super.clear(); + } + public override bool contains(Object o){ + return super.contains(o); + } + public override bool containsAll(Collection o){ + return super.containsAll(o); + } + public override int size(){ + return super.size(); + } + public override bool isEmpty(){ + return super.isEmpty(); + } + public override hash_t toHash(){ + return super.toHash(); + } + public override equals_t opEquals(Object o){ + return super.opEquals(o); + } + public override bool remove(String o){ + return super.remove(o); + } + public override bool remove(Object o){ + return super.remove(o); + } + public override Object remove(int o){ + return super.remove(o); + } + public override Iterator iterator(){ + return super.iterator(); + } + public override bool removeAll(Collection o){ + return super.removeAll(o); + } + public override bool retainAll(Collection o){ + return super.retainAll(o); + } + public override int opApply (int delegate(ref Object value) dg){ + return super.opApply(dg); + } + public override Object[] toArray( Object[] a ){ + return super.toArray(a); + } + public override Object[] toArray(){ + return super.toArray(); + } + public override String[] toArray( String[] a ){ + return super.toArray(a); + } private Viewer viewer;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerSingleSelectionObservableValue.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerSingleSelectionObservableValue.d Sat Apr 18 13:54:50 2009 +0200 @@ -14,6 +14,7 @@ *******************************************************************************/ module org.eclipse.jface.internal.databinding.viewers.ViewerSingleSelectionObservableValue; +import org.eclipse.jface.internal.databinding.viewers.SelectionProviderSingleSelectionObservableValue; import java.lang.all;
--- a/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerUpdater.d Sat Apr 18 09:25:29 2009 +0200 +++ b/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/viewers/ViewerUpdater.d Sat Apr 18 13:54:50 2009 +0200 @@ -96,8 +96,8 @@ IElementComparer comparer = viewer.getComparer(); Object[] selectedElements = selection.toArray(); for (int i = 0; i < selectedElements.length; i++) { - if (comparer is null ? Util.equals(element, - selectedElements[i]) : comparer.equals(element, + if (comparer is null ? Util.opEquals(element, + selectedElements[i]) : comparer.opEquals(element, selectedElements[i])) { viewer.setSelection(selection); break;