Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt')
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/DefaultLoadingContext.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ICLRFactory.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IConstants.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBinding.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBindingInfo.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProvider.java16
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProviderFactory.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventConstants.java20
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventGroup.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventHandler.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventInvoker.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IIndexedElement.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILoadingContext.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILogger.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMetaclassFactory.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMultiValueConverter.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/INamespaceHandler.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IObservableValueListener.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IStyle.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIExtensionProvider.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIResource.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValidationRule.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValueConverter.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IXWTLoader.java207
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/InverseValueConverter.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ResourceDictionary.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/Tracking.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWT.java221
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTException.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoader.java272
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoaderManager.java20
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTMaps.java334
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/animation/Drawing.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/Containment.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UI.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UIBounds.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/IBeforeParsingCallback.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ICreatedCallback.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ILoadedCallback.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionView.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionViewSource.java26
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/GroupDescription.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/ListSortDirection.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/SortDescription.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/AbstractMultiValueConverter.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/BindingToObject.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToBoolean.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToInteger.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/DateToString.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/EnumToString.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToBoolean.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToString.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToIObservableCollection.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToSet.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToBoolean.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToISelection.java14
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToObject.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToString.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SelectionToBoolean.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SetToIObservableCollection.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringMultiValueConerter.java18
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToBoolean.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToColor.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToDoubleArray.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToEnum.java14
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFont.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFormAttachment.java16
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValidationRule.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValueConverter.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToImage.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIntArray.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToInteger.java66
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToPoint.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToRectangle.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToType.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToURL.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ValueConverterAdapter.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/AbstractEventGroup.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Condition.java62
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/DataTrigger.java75
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/EventTrigger.java39
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IBinding.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/ICollectionView.java26
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IDynamicBinding.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IElementLoaderFactory.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IRenderingContext.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IVisualElementLoader.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiDataTrigger.java27
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiTrigger.java18
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Operator.java87
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/RadioEventGroup.java18
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Setter.java20
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/SetterBase.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Style.java14
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Trigger.java36
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerAction.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerBase.java16
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AbstractDataBinding.java14
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AggregateObservableValue.java19
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingContext.java19
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingMode.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ControlDataBinding.java32
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/DataBinding.java62
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/Event.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventListener.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventManager.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventPropertyObservableValue.java7
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/IBindingContext.java35
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/JFaceXWTDataBinding.java200
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ListToArrayObservableValue.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/TypedViewerObservableValueDecorator.java16
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/XWTObservableValue.java24
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/AbstractDataProvider.java48
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/IObjectDataProvider.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/ObjectDataProvider.java84
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Color.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Point.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Rect.java26
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CanExecuteChangedListener.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CommandBinding.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ICommand.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/InputBinding.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyBinding.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyGesture.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ModifierKeys.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/MouseAction.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/RoutedCommand.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Binding.java92
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingExpressionPath.java60
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingGate.java142
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Core.java220
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DataBindingTrack.java70
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicBinding.java58
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicValueBinding.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassManager.java44
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassService.java34
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MultiBinding.java68
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeKeeper.java74
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeManager.java154
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/UpdateSourceTrigger.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/AbstractMenuItemObservableValue.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemEnabledObservableValue.java9
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemSelectionObservableValue.java9
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ClassLoaderUtil.java48
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/DocumentObjectSorter.java22
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/LoggerManager.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/NamespaceHelper.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObjectUtil.java150
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObservableValueManager.java22
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/TableEditorHelper.java16
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/UserData.java324
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Attribute.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DefaultElementCache.java15
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentObject.java34
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentRoot.java112
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Element.java72
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementHandler.java249
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementManager.java40
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/IElementCache.java14
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/XDataHandler.java33
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/Controller.java130
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoader.java730
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoaderFactory.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/StaticResourceBinding.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ValueConvertorRegister.java28
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/AbstractMetaclass.java209
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BeanEvent.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Behavior.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BindingMetaclass.java24
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ComboBoxCellEditorMetaclass.java25
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ExpandItemHeightAction.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/LoadedEvent.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Metaclass.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java14
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableViewerColumnMetaClass.java18
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TypedEvent.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/AbstractProperty.java24
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/BeanProperty.java36
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/ColumnViewerColumnsProperty.java18
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DataProperty.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicBeanProperty.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicProperty.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/EventProperty.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/FieldProperty.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/InputBeanProperty.java82
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/MultiSelectionBeanProperty.java30
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/PropertiesConstants.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/SingleSelectionBeanProperty.java16
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/StyleProperty.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableColumnEditorProperty.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableEditorDynamicProperty.java84
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemEditorProperty.java20
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemProperty.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnDynamicProperty.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnImageProperty.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnTextProperty.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnWidthProperty.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TriggersProperty.java12
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/AbstractDialog.java15
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/CellEditorHelper.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ComboBoxCellEditor.java26
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultCellModifier.java18
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultListContentProvider.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultViewerLabelProvider.java24
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFaceInitializer.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFacesHelper.java101
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableMapLabelProvider.java15
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableTreeContentProvider.java26
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/TextCellEditor.java18
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ViewerFilter.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTDialog.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTObservableWrapper.java16
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTTitleAreaDialog.java23
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DefaultLoadingType.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DelegateProperty.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IBehavior.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IEvent.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ILoadingType.java8
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IMetaclass.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IObjectInitializer.java6
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IProperty.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ISetPostAction.java2
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IValueLoading.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ModelUtils.java10
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/NamedColorsUtil.java24
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/OperatorExceptionMessage.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/PathHelper.java54
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/ResourceManager.java54
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/AbstractValidationRule.java4
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/InverseValidationRule.java4
230 files changed, 3611 insertions, 3560 deletions
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/DefaultLoadingContext.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/DefaultLoadingContext.java
index 8676be2e340..a53700e3363 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/DefaultLoadingContext.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/DefaultLoadingContext.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -26,7 +26,7 @@ public class DefaultLoadingContext implements ILoadingContext {
}
public ClassLoader getClassLoader() {
- if(classLoader == null) {
+ if (classLoader == null) {
return Thread.currentThread().getContextClassLoader();
}
return classLoader;
@@ -42,14 +42,14 @@ public class DefaultLoadingContext implements ILoadingContext {
public Class<?> loadClass(String name) {
Class<?> type = doLoadClass(name);
- if(type != null) {
+ if (type != null) {
return type;
}
int index = name.lastIndexOf('.');
- while(index != -1) {
+ while (index != -1) {
name = name.substring(0, index) + "$" + name.substring(index + 1);
type = doLoadClass(name);
- if(type != null) {
+ if (type != null) {
return type;
}
index = name.lastIndexOf('.');
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ICLRFactory.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ICLRFactory.java
index 1cbdac9c618..65cf3e9f4b0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ICLRFactory.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ICLRFactory.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
@@ -17,10 +17,10 @@ public interface ICLRFactory {
/**
* This method is used to create a CLR instance to handle events.
- *
+ *
* @param args
- * null if the default CLRFactory comes from XWT.getCLRFactory()
- * or CLASS_FACTORY. Otherwise, it is the value x:ClassFactory
+ * null if the default CLRFactory comes from XWT.getCLRFactory()
+ * or CLASS_FACTORY. Otherwise, it is the value x:ClassFactory
* @options contains structures used by XWT (ex : URL, DataContext). Keys of
* this Map come from {@link IXWTLoader}.
* @return
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IConstants.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IConstants.java
index 85878984d63..0670125faa6 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IConstants.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IConstants.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.xwt.internal.xml.DocumentObject;
/**
* Shared constants
- *
+ *
* @author yyang
*/
public interface IConstants {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBinding.java
index eff21832e8a..9afa7fe14c1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBinding.java
@@ -4,21 +4,21 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface IDataBinding extends IDataBindingInfo {
/**
* The argument is used to determine the filtering. If type is null, no filtering
- *
+ *
* @return
*/
public Object getValue(Class<?> targetType);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBindingInfo.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBindingInfo.java
index 0464fab681c..a2235ca2936 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBindingInfo.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataBindingInfo.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProvider.java
index 81b0dab980c..f8a266b1ea8 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProvider.java
@@ -15,14 +15,14 @@ import org.eclipse.core.databinding.property.value.IValueProperty;
/**
* A Data Binding provider defines the nature of Data Binding such as Bean Object Binding, EMF Object Binding, XML data Binding or Data Base binding
- *
+ *
* @author yyang
*/
public interface IDataProvider {
/**
* Return the data of the provider, this value can be not used for databindings.
- *
+ *
* @param path
* @return
*/
@@ -30,7 +30,7 @@ public interface IDataProvider {
/**
* Return the data of the provider, this value can be not used for databindings.
- *
+ *
* @param path
* @return
*/
@@ -38,7 +38,7 @@ public interface IDataProvider {
/**
* Return the data of the provider, this value can be not used for databindings.
- *
+ *
* @param path
* @return
*/
@@ -46,7 +46,7 @@ public interface IDataProvider {
/**
* Return the data of the provider, this value can be not used for databindings.
- *
+ *
* @param path
* @return
*/
@@ -54,7 +54,7 @@ public interface IDataProvider {
/**
* Return the data type of the provider.lue
- *
+ *
* @param path
* @return
*/
@@ -62,7 +62,7 @@ public interface IDataProvider {
/**
* check if the property is read only.
- *
+ *
* @param path
* @return
*/
@@ -84,7 +84,7 @@ public interface IDataProvider {
/**
* get the type of this object
- *
+ *
* @param object
* @return
*/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProviderFactory.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProviderFactory.java
index b46e470ea83..d9d75e8489d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProviderFactory.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IDataProviderFactory.java
@@ -4,27 +4,27 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface IDataProviderFactory {
/**
* The type of the Data provider
- *
+ *
* @return
*/
Class<?> getType();
/**
- *
+ *
* @param dataContext
* @return null if this factory doesn't match with the data context
*/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventConstants.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventConstants.java
index e1de975dd5c..6741514f66c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventConstants.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventConstants.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
@@ -24,7 +24,7 @@ public final class IEventConstants {
public static final String KEY_UP = "KeyUp";
- public static final String[] KEY_GROUP = new String[]{ KEY_DOWN, KEY_UP };
+ public static final String[] KEY_GROUP = new String[] { KEY_DOWN, KEY_UP };
public static final String XWT_KEY_DOWN = "KeyDown" + SUFFIX;
@@ -34,7 +34,7 @@ public final class IEventConstants {
public static final String MOUSE_UP = "MouseUp";
- public static final String[] MOUSE_GROUP = new String[]{ MOUSE_DOWN, MOUSE_UP };
+ public static final String[] MOUSE_GROUP = new String[] { MOUSE_DOWN, MOUSE_UP };
public static final String XWT_MOUSE_DOWN = "MouseDown" + SUFFIX;
@@ -48,7 +48,7 @@ public final class IEventConstants {
public static final String MOUSE_HOVER = "MouseHover";
- public static final String[] MOUSE_MOVING_GROUP = new String[]{ MOUSE_ENTER, MOUSE_EXIT };
+ public static final String[] MOUSE_MOVING_GROUP = new String[] { MOUSE_ENTER, MOUSE_EXIT };
public static final String XWT_MOUSE_MOVE = "MouseMove" + SUFFIX;
@@ -90,7 +90,7 @@ public final class IEventConstants {
public static final String FOCUS_OUT = "FocusOut";
- public static final String[] FOCUS_GROUP = new String[]{ FOCUS_IN, FOCUS_OUT };
+ public static final String[] FOCUS_GROUP = new String[] { FOCUS_IN, FOCUS_OUT };
public static final String XWT_FOCUS_IN = "FocusIn" + SUFFIX;
@@ -100,7 +100,7 @@ public final class IEventConstants {
public static final String COLLAPSE = "Collapse";
- public static final String[] EXPAND_GROUP = new String[]{ EXPAND, COLLAPSE };
+ public static final String[] EXPAND_GROUP = new String[] { EXPAND, COLLAPSE };
public static final String XWT_EXPAND = "Expand" + SUFFIX;
@@ -116,7 +116,7 @@ public final class IEventConstants {
public static final String HIDE = "Hide";
- public static final String[] WINDOW_GROUP = new String[]{ ICONIFY, DEICONIFY, CLOSE, SHOW, HIDE };
+ public static final String[] WINDOW_GROUP = new String[] { ICONIFY, DEICONIFY, CLOSE, SHOW, HIDE };
public static final String XWT_ICONIFY = "Iconify" + SUFFIX;
@@ -140,7 +140,7 @@ public final class IEventConstants {
public static final String DEACTIVATE = "Deactivate";
- public static final String[] ACTIVATION_GROUP = new String[]{ ACTIVATE, DEACTIVATE };
+ public static final String[] ACTIVATION_GROUP = new String[] { ACTIVATE, DEACTIVATE };
public static final String XWT_ACTIVATE = "Activate" + SUFFIX;
@@ -166,7 +166,7 @@ public final class IEventConstants {
public static final String HARD_KEY_UP = "HardKeyUp";
- public static final String[] HARD_KEY = new String[]{ HARD_KEY_DOWN, HARD_KEY_UP };
+ public static final String[] HARD_KEY = new String[] { HARD_KEY_DOWN, HARD_KEY_UP };
public static final String XWT_HARD_KEY_DOWN = "HardKeyDown" + SUFFIX;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventGroup.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventGroup.java
index 3335d307f13..5c9d239dd20 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventGroup.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventGroup.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
@@ -14,7 +14,7 @@ import org.eclipse.papyrus.xwt.metadata.IProperty;
/**
* This class manages the coordination between events' state
- *
+ *
* @author yyang
*/
public interface IEventGroup {
@@ -23,7 +23,7 @@ public interface IEventGroup {
/**
* Fire the event to update other when an event occurs
- *
+ *
* @param object
* @param property
*/
@@ -31,7 +31,7 @@ public interface IEventGroup {
/**
* Register the event
- *
+ *
* @param manager
* @param property
*/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventHandler.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventHandler.java
index 8fe58150c82..d7ec3feacba 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventHandler.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventHandler.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
@@ -15,7 +15,7 @@ package org.eclipse.papyrus.xwt;
* XWT uses Java reflection to find the method to handle an event. If the class
* specified by <code>x:Class</code> implements this interface, this class can provide
* the IEventInvoker for each event.
- *
+ *
* @author yyang
*/
public interface IEventHandler {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventInvoker.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventInvoker.java
index 84191187fed..902771a2590 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventInvoker.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IEventInvoker.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IIndexedElement.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IIndexedElement.java
index c382da8c2ce..9eb6cec31fc 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IIndexedElement.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IIndexedElement.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILoadingContext.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILoadingContext.java
index 5544ad0aa06..c5aa3081c3f 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILoadingContext.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILoadingContext.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILogger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILogger.java
index 1110c2a0fe5..850cd1cc725 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILogger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ILogger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import java.util.Set;
/**
* Looger interface
- *
+ *
* @author yyang
*/
public interface ILogger {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMetaclassFactory.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMetaclassFactory.java
index ed1dab8bbe8..9d1bed23751 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMetaclassFactory.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMetaclassFactory.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,9 +14,9 @@ import org.eclipse.papyrus.xwt.metadata.IMetaclass;
/**
* Metaclass factory provides a customizable Metaclass creation mechanism.
- *
+ *
* @author yyang
- *
+ *
*/
public interface IMetaclassFactory {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMultiValueConverter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMultiValueConverter.java
index 3f0457e4479..7e8a7a4be4c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMultiValueConverter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IMultiValueConverter.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,9 +12,9 @@ package org.eclipse.papyrus.xwt;
/**
* Data converter used in MultiBinding
- *
+ *
* @author yyang
- *
+ *
*/
public interface IMultiValueConverter extends IValueConverter {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/INamespaceHandler.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/INamespaceHandler.java
index 564132c26bd..f0374c69b77 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/INamespaceHandler.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/INamespaceHandler.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import org.eclipse.swt.widgets.Widget;
/**
* This class defines the public behavior to handle the foreigner namespace
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface INamespaceHandler {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IObservableValueListener.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IObservableValueListener.java
index bc9591928ee..ddd97c4c9f9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IObservableValueListener.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IObservableValueListener.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IStyle.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IStyle.java
index 4cc6197feec..cca4aa3a6f4 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IStyle.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IStyle.java
@@ -4,21 +4,21 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface IStyle {
/**
* The element to apply the style. The argument is an instance created through XML. It can be a Widget, or others such as TableViewer.
- *
+ *
* @param target
*/
void applyStyle(Object target);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIExtensionProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIExtensionProvider.java
index 7cd368fbdc2..98fde0e43d5 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIExtensionProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIExtensionProvider.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,7 +12,7 @@ package org.eclipse.papyrus.xwt;
/**
* In some UI elements, property data may not be provided in the element it-self.
- *
+ *
* @author yyang
*/
public interface IUIExtensionProvider {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIResource.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIResource.java
index 10a5c2044b9..c227c2d83da 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIResource.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IUIResource.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValidationRule.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValidationRule.java
index d70cd207823..2f3c4695e36 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValidationRule.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValidationRule.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.IStatus;
/**
* @author hceylan
- *
+ *
*/
public interface IValidationRule extends IValidator {
@@ -35,7 +35,7 @@ public interface IValidationRule extends IValidator {
/**
* Returns the direction of the validation
- *
+ *
* @return {@link Direction} indicating the direction of the validation.
* Never null
*/
@@ -43,16 +43,16 @@ public interface IValidationRule extends IValidator {
/**
* Returns the phase this validator applies to
- *
+ *
* @return {@link Phase} to indicate the phase of the validation. Never null
*/
public Phase getPhase();
/**
* Determines if the given value is valid.
- *
+ *
* @param value
- * the value to validate
+ * the value to validate
* @return a status object indicating whether the validation succeeded {@link IStatus#isOK()} or not. Never null.
*/
public IStatus validateBack(Object value);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValueConverter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValueConverter.java
index 05ef460142b..da0dc962c0e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValueConverter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IValueConverter.java
@@ -14,9 +14,9 @@ import org.eclipse.core.databinding.conversion.IConverter;
/**
* For a data binding, the conversion could be bidirectional. The standard IConverter is not enough. This class is designed to meet this requirement.
- *
+ *
* @author yyang
- *
+ *
*/
public interface IValueConverter extends IConverter {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IXWTLoader.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IXWTLoader.java
index dd8713bf5be..026d04af5a9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IXWTLoader.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/IXWTLoader.java
@@ -8,7 +8,7 @@
* Contributors:
* Soyatec - initial API and implementation
* Christian W. Damus (CEA) - bug 417409
- *
+ *
*******************************************************************************/
package org.eclipse.papyrus.xwt;
@@ -40,7 +40,7 @@ import org.eclipse.swt.widgets.Composite;
/**
* XWT loader interface
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface IXWTLoader {
@@ -49,7 +49,7 @@ public interface IXWTLoader {
/**
* The URL which open XWT file
- *
+ *
*/
String URL_PROPERTY = "XWT.URL";
@@ -68,100 +68,101 @@ public interface IXWTLoader {
/**
* Default styles to apply. The value should be a collection or Array of
* IStyle
- *
+ *
*/
String DEFAULT_STYLES_PROPERTY = "XWT.DefaultStyles";
/**
* Enabled or disabled the styles. By default, it is enabled
- *
+ *
*/
String DISABLE_STYLES_PROPERTY = "XWT.DisabledStyles";
/**
* The DataContext to setup in root element
- *
+ *
*/
String DATACONTEXT_PROPERTY = "XWT.DataContext";
/**
* The BindingContext to setup in root element
- *
+ *
*/
String BINDING_CONTEXT_PROPERTY = "XWT.BindingContext";
/**
* The CLR class
- *
+ *
*/
String CLASS_PROPERTY = "XWT.Class";
/**
* The CLR class factory
- *
+ *
*/
String CLASS_FACTORY_PROPERTY = "XWT.ClassFactory";
/**
* Resources to associate to root element
- *
+ *
*/
String RESOURCE_DICTIONARY_PROPERTY = "XWT.Resources";
/**
* Resources to associate to root element
- *
+ *
*/
String LOADED_CALLBACK = ILoadedCallback.class.getName();
/**
* Action to invoke after the creation of each UI element before the properties setting
- *
+ *
*/
String CREATED_CALLBACK = ICreatedCallback.class.getName();
/**
* Action to invoke before parsing the XML file
- *
+ *
*/
String BEFORE_PARSING_CALLBACK = IBeforeParsingCallback.class.getName();
-
+
/**
* Parsed XML element caching option. In the public API, this may be only either a {@link Boolean} indicating whether to cache the XML content
* parsed from XWT resources (the cache having some unspecified default size) or a positive {@link Integer} indicating the size of XML cache.
* This load option is a bit odd in that, if specified, it is replaced by the actual cache, which then should be supplied as the option value
* for subsequent calls. Thus, the following idiom is recommended:
- *
+ *
* <pre>
- * private Object xmlCache; // the XML cache
- *
- * // other fields ...
- *
- * void whatever() {
- * Map<String, Object> options = new HashMap&lt;String, Object&gt;();
- * options.put(IXWTLoader.XML_CACHE_PROPERTY, (xmlCache != null) ? xmlCache : Boolean.TRUE);
- * // ... set other options as needed ...
- *
- * URL url = getResourceURL(); // however this is obtained
- *
- * Object ui = XWT.loadWithOptions(url, options);
- *
- * // Get the cache to reuse next time
- * xmlCache = options.get(IXWTLoader.XML_CACHE_PROPERTY);
- *
- * doSomethingWithTheUI(ui);
- * }
+ * private Object xmlCache; // the XML cache
+ *
+ * // other fields ...
+ *
+ * void whatever() {
+ * Map&lt;String, Object&gt; options = new HashMap&lt;String, Object&gt;();
+ * options.put(IXWTLoader.XML_CACHE_PROPERTY, (xmlCache != null) ? xmlCache : Boolean.TRUE);
+ * // ... set other options as needed ...
+ *
+ * URL url = getResourceURL(); // however this is obtained
+ *
+ * Object ui = XWT.loadWithOptions(url, options);
+ *
+ * // Get the cache to reuse next time
+ * xmlCache = options.get(IXWTLoader.XML_CACHE_PROPERTY);
+ *
+ * doSomethingWithTheUI(ui);
+ * }
* </pre>
*/
String XML_CACHE_PROPERTY = IElementCache.class.getName();
- String[] ALL_PROPERTIES = { URL_PROPERTY, CONTAINER_PROPERTY, INIT_STYLE_PROPERTY, DATACONTEXT_PROPERTY, BINDING_CONTEXT_PROPERTY, RESOURCE_DICTIONARY_PROPERTY, CLASS_PROPERTY, CLASS_FACTORY_PROPERTY, LOADED_CALLBACK, CREATED_CALLBACK, BEFORE_PARSING_CALLBACK, DESIGN_MODE_PROPERTY, XML_CACHE_PROPERTY };
+ String[] ALL_PROPERTIES = { URL_PROPERTY, CONTAINER_PROPERTY, INIT_STYLE_PROPERTY, DATACONTEXT_PROPERTY, BINDING_CONTEXT_PROPERTY, RESOURCE_DICTIONARY_PROPERTY, CLASS_PROPERTY, CLASS_FACTORY_PROPERTY, LOADED_CALLBACK, CREATED_CALLBACK,
+ BEFORE_PARSING_CALLBACK, DESIGN_MODE_PROPERTY, XML_CACHE_PROPERTY };
/**
* Register an Observable IChangeListener for a given UI element. The second
* registration of the same listener on the same UI Element has no effect.
- *
+ *
* @param control
* @param listener
* @return
@@ -171,7 +172,7 @@ public interface IXWTLoader {
/**
* Undo the registration of the Observable IChangeListener for a given UI
* element.
- *
+ *
* @param context
* @param listener
*/
@@ -179,7 +180,7 @@ public interface IXWTLoader {
/**
* Find the used IObservable value for given data.
- *
+ *
* @param nsmapace
* @return
*/
@@ -187,7 +188,7 @@ public interface IXWTLoader {
/**
* Find the used IObservableFactory value for given data.
- *
+ *
* @param nsmapace
* @return
*/
@@ -195,7 +196,7 @@ public interface IXWTLoader {
/**
* Find the used IObservableValue value for given data.
- *
+ *
* @param nsmapace
* @return
*/
@@ -203,7 +204,7 @@ public interface IXWTLoader {
/**
* Find the used IObservableList value for given data.
- *
+ *
* @param nsmapace
* @return
*/
@@ -211,7 +212,7 @@ public interface IXWTLoader {
/**
* Find the used IObservableList value for given data.
- *
+ *
* @param nsmapace
* @return
*/
@@ -219,7 +220,7 @@ public interface IXWTLoader {
/**
* Find the used IObservableValue value for given data.
- *
+ *
* @param context
* @param data
* @param propertyName
@@ -230,7 +231,7 @@ public interface IXWTLoader {
/**
* Find the resource in Resources Dictionary attached in the UI Element.
* If the key isn't found, the research will be propagated in its parent.
- *
+ *
* @param object
* @param key
* @return
@@ -239,48 +240,48 @@ public interface IXWTLoader {
/**
* Get the Resources Dictionary attached in the UI Element.
- *
+ *
* @param object
* @return
*/
Map<String, Object> getResources(Object object);
/**
- *
+ *
* @param nsmapace
* @param handler
*/
void registerNamespaceHandler(String nsmapace, INamespaceHandler handler);
/**
- *
+ *
* @param nsmapace
*/
void unregisterNamespaceHandler(String nsmapace);
/**
- *
+ *
* @param nsmapace
* @return
*/
INamespaceHandler getNamespaceHandler(String nsmapace);
/**
- *
+ *
* @return
*/
Realm getRealm();
/**
* Get the system logger.
- *
+ *
* @return
*/
ILogger getLogger();
/**
* Change the system logger
- *
+ *
* @param logger
*/
void setLogger(ILogger log);
@@ -288,7 +289,7 @@ public interface IXWTLoader {
/**
* This namespace service returns the associated or declared namespace for a
* given class.
- *
+ *
* @param javaclass
* @return
*/
@@ -296,7 +297,7 @@ public interface IXWTLoader {
/**
* Get the name of the element, which is defined by <code>Name</code> or <code>x:Name</code>. Return <code>null</code>
- *
+ *
* @param object
* @return
*/
@@ -304,9 +305,9 @@ public interface IXWTLoader {
/**
* Find a named UI element.
- *
+ *
* @param context
- * the start point of research.
+ * the start point of research.
* @param name
* @return
*/
@@ -314,7 +315,7 @@ public interface IXWTLoader {
/**
* Get the DataContext of given element
- *
+ *
* @param context
* @return
*/
@@ -322,7 +323,7 @@ public interface IXWTLoader {
/**
* Get the Triggers of given element
- *
+ *
* @param context
* @return
*/
@@ -330,7 +331,7 @@ public interface IXWTLoader {
/**
* Change the DataContext of given element
- *
+ *
* @param context
* @return
*/
@@ -338,7 +339,7 @@ public interface IXWTLoader {
/**
* Changes the default data context of given element
- *
+ *
* @param widget
* @param dataBindingContext
*/
@@ -346,7 +347,7 @@ public interface IXWTLoader {
/**
* Change the Triggers of given element
- *
+ *
* @param context
* @return
*/
@@ -354,7 +355,7 @@ public interface IXWTLoader {
/**
* Find the closet parent of type Composite
- *
+ *
* @param context
* @return
*/
@@ -362,7 +363,7 @@ public interface IXWTLoader {
/**
* Get the Metaclass of the given object
- *
+ *
* @param context
* @return
*/
@@ -371,7 +372,7 @@ public interface IXWTLoader {
/**
* Load the file content. All widget will be created but they are showed.
* This method return the root element.
- *
+ *
*/
Object load(URL file) throws Exception;
@@ -472,7 +473,7 @@ public interface IXWTLoader {
/**
* Data conversion service from String to a given type
- *
+ *
* @param type
* @param string
* @return
@@ -481,7 +482,7 @@ public interface IXWTLoader {
/**
* Data conversion service from String to a given type
- *
+ *
* @param targetType
* @param string
* @return
@@ -491,7 +492,7 @@ public interface IXWTLoader {
Object loadWithOptions(URL url, Map<String, Object> options) throws Exception;
/**
- *
+ *
* @param stream
* @param url
* @param options
@@ -512,7 +513,7 @@ public interface IXWTLoader {
/**
* Generic load method
- *
+ *
* @param stream
* @param url
* @param loadData
@@ -525,7 +526,7 @@ public interface IXWTLoader {
/**
* Metaclass services to return all registered Metaclasses.
- *
+ *
* @param stream
* @param url
* @param loadData
@@ -536,66 +537,66 @@ public interface IXWTLoader {
/**
* Get the corresponding Metaclass
- *
+ *
* @param tagName
* @param ns
- * The namespace
+ * The namespace
* @return
*/
IMetaclass getMetaclass(String tagName, String ns);
/**
* Register UI type
- *
+ *
* @param javaclass
*/
IMetaclass registerMetaclass(Class<?> type);
/**
* Register UI type
- *
+ *
* @param javaclass
*/
void registerMetaclass(IMetaclass type);
/**
* Get the dynamic property value
- *
+ *
* @param javaclass
*/
Object getPropertyValue(Object uiElement, IProperty property);
/**
* Set the dynamic property value
- *
+ *
* @param javaclass
*/
void setPropertyValue(Object uiElement, IProperty property, Object value);
/**
* Remove the dynamic property value
- *
+ *
* @param javaclass
*/
void removePropertyValue(Object uiElement, IProperty property);
/**
* Remove the dynamic property value
- *
+ *
* @param javaclass
*/
boolean hasPropertyValue(Object uiElement, IProperty property);
/**
* Register Metaclass factory
- *
+ *
* @param javaclass
*/
void registerMetaclassFactory(IMetaclassFactory metaclassFactory);
/**
* Find a Data converter
- *
+ *
* @param converter
* @param type
*/
@@ -603,7 +604,7 @@ public interface IXWTLoader {
/**
* Register a Data converter
- *
+ *
* @param converter
* @param type
*/
@@ -611,14 +612,14 @@ public interface IXWTLoader {
/**
* Add a tracking option
- *
+ *
* @param tracking
*/
void addTracking(Tracking tracking);
/**
* Test if the tracking on argument is enabled.
- *
+ *
* @param tracking
* @return
*/
@@ -626,21 +627,21 @@ public interface IXWTLoader {
/**
* Get all tracking options
- *
+ *
* @return
*/
Set<Tracking> getTrackings();
/**
* Remove a tracking option.
- *
+ *
* @param tracking
*/
void removeTracking(Tracking tracking);
/**
* Register a command to a name
- *
+ *
* @param name
* @param command
*/
@@ -648,7 +649,7 @@ public interface IXWTLoader {
/**
* Register a command to a name
- *
+ *
* @param name
* @param command
*/
@@ -656,7 +657,7 @@ public interface IXWTLoader {
/**
* Find a command by name
- *
+ *
* @param name
* @return
*/
@@ -664,21 +665,21 @@ public interface IXWTLoader {
/**
* Return all registered commands
- *
+ *
* @return
*/
Map<String, ICommand> getCommands();
/**
* Unregister a command
- *
+ *
* @param name
*/
void unregisterCommand(String name);
/**
* Add a default style
- *
+ *
* @param style
* @return
*/
@@ -686,7 +687,7 @@ public interface IXWTLoader {
/**
* Remove a default style
- *
+ *
* @param style
* @return
*/
@@ -714,7 +715,7 @@ public interface IXWTLoader {
/**
* Create a UI Profile with the provide data and apply it immediately.
- *
+ *
* @param profileData
* @return
*/
@@ -722,7 +723,7 @@ public interface IXWTLoader {
/**
* Put the Profile in place
- *
+ *
* @param profile
* @return
*/
@@ -730,28 +731,28 @@ public interface IXWTLoader {
/**
* Restore the previous profile
- *
+ *
* @return
*/
public Object restoreProfile();
/**
* Set up the default ICLRFactory
- *
+ *
* @param factory
*/
public void setCLRFactory(ICLRFactory factory);
/**
* The default CLRFactory.
- *
+ *
* @return
*/
public ICLRFactory getCLRFactory();
/**
* Returns the {@link BindingContext} of the element
- *
+ *
* @param element
* @param contextName
* @return
@@ -760,27 +761,27 @@ public interface IXWTLoader {
/**
* Check if the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
boolean isFileResolveType(Class<?> type);
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
void registerFileResolveType(Class<?> type);
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
void unregisterFileResolveType(Class<?> type);
@@ -788,8 +789,8 @@ public interface IXWTLoader {
public class Utilities {
public static boolean isPropertyName(String name) {
- for(String propertyName : ALL_PROPERTIES) {
- if(propertyName.equalsIgnoreCase(name)) {
+ for (String propertyName : ALL_PROPERTIES) {
+ if (propertyName.equalsIgnoreCase(name)) {
return true;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/InverseValueConverter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/InverseValueConverter.java
index 7270d39e7e2..84294990a53 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/InverseValueConverter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/InverseValueConverter.java
@@ -12,9 +12,9 @@ package org.eclipse.papyrus.xwt;
/**
* The operation to inverse the converter direction.
- *
+ *
* @author yyang
- *
+ *
*/
public class InverseValueConverter implements IValueConverter {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ResourceDictionary.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ResourceDictionary.java
index f0757517425..b82b138d024 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ResourceDictionary.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/ResourceDictionary.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/Tracking.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/Tracking.java
index a25a3ee9060..2847b125d7e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/Tracking.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/Tracking.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWT.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWT.java
index 07a50b90c6a..ef3a31942c6 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWT.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWT.java
@@ -49,7 +49,7 @@ import org.eclipse.swt.widgets.Widget;
/**
* XWT is the main class of the XWT framework. It provides most of the services
* in API.
- *
+ *
* @author yyang
*/
public class XWT {
@@ -62,7 +62,7 @@ public class XWT {
/**
* Get the system logger.
- *
+ *
* @returnF
*/
public static ILogger getLogger() {
@@ -71,7 +71,7 @@ public class XWT {
/**
* Create a UI Profile with the provide data and apply it immediately.
- *
+ *
* @param profileData
* @return
*/
@@ -81,7 +81,7 @@ public class XWT {
/**
* Put the Profile in place
- *
+ *
* @param profile
* @return
*/
@@ -91,7 +91,7 @@ public class XWT {
/**
* Restore the previous profile
- *
+ *
* @return
*/
public static Object restoreProfile() {
@@ -99,7 +99,7 @@ public class XWT {
}
/**
- *
+ *
* @param nsmapace
* @param handler
*/
@@ -108,7 +108,7 @@ public class XWT {
}
/**
- *
+ *
* @param nsmapace
*/
public static void unregisterNamespaceHandler(String nsmapace) {
@@ -116,7 +116,7 @@ public class XWT {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -127,7 +127,7 @@ public class XWT {
/**
* Register an Observable IChangeListener for a given UI element. The second
* registration of the same listener on the same UI Element has no effect.
- *
+ *
* @param context
* @param listener
* @return
@@ -139,7 +139,7 @@ public class XWT {
/**
* Undo the registration of the Observable IChangeListener for a given UI
* element.
- *
+ *
* @param context
* @param listener
*/
@@ -149,7 +149,7 @@ public class XWT {
/**
* Find an existing IObservableValue
- *
+ *
* @param nsmapace
* @return null if it doesn't exist.
*/
@@ -159,7 +159,7 @@ public class XWT {
/**
* Find an existing IObservableValue
- *
+ *
* @param nsmapace
* @return null if it doesn't exist.
*/
@@ -169,7 +169,7 @@ public class XWT {
/**
* Find an existing IObservableValue
- *
+ *
* @param nsmapace
* @return null if it doesn't exist.
*/
@@ -179,7 +179,7 @@ public class XWT {
/**
* get or create a IObservableValue
- *
+ *
* @param nsmapace
* @return return null or raises an exception XWTException if fails
*/
@@ -189,7 +189,7 @@ public class XWT {
/**
* get or create a IObservable
- *
+ *
* @param nsmapace
* @return return null or raises an exception XWTException if fails
*/
@@ -199,7 +199,7 @@ public class XWT {
/**
* get or create a IObservable
- *
+ *
* @param nsmapace
* @return return null or raises an exception XWTException if fails
*/
@@ -209,7 +209,7 @@ public class XWT {
/**
* get or create a IObservableValue
- *
+ *
* @param nsmapace
* @return return null or raises an exception XWTException if fails
*/
@@ -219,7 +219,7 @@ public class XWT {
/**
* Change the system logger
- *
+ *
* @param logger
*/
public static void setLogger(ILogger log) {
@@ -228,7 +228,7 @@ public class XWT {
/**
* Get the name of the element, which is defined by <code>Name</code> or <code>x:Name</code>. Return <code>null</code>
- *
+ *
* @param object
* @return
*/
@@ -238,9 +238,9 @@ public class XWT {
/**
* Find a named UI element.
- *
+ *
* @param context
- * the start point of research.
+ * the start point of research.
* @param name
* @return
*/
@@ -250,18 +250,18 @@ public class XWT {
/**
* Get the DataContext of given element
- *
+ *
* @param context
* @return
*/
public static Object getDataContext(Object element, Class<?> targetType) {
Object value = XWTLoaderManager.getActive().getDataContext(element);
- if(targetType == null || !targetType.isInstance(value)) {
- if(value instanceof IBinding) {
- return ((IBinding)value).getValue(targetType);
+ if (targetType == null || !targetType.isInstance(value)) {
+ if (value instanceof IBinding) {
+ return ((IBinding) value).getValue(targetType);
}
- if(value instanceof IObservableValue) {
- return ((IObservableValue)value).getValue();
+ if (value instanceof IObservableValue) {
+ return ((IObservableValue) value).getValue();
}
}
return value;
@@ -270,13 +270,12 @@ public class XWT {
/**
* Returns the {@link BindingContext} within the upper scope of the control.
* <p>
- * Each UI Element may have a local DataBindingContext property. While locating DataBindingContext, if the current UI Element has not the
- * property, the parent's will be used.
+ * Each UI Element may have a local DataBindingContext property. While locating DataBindingContext, if the current UI Element has not the property, the parent's will be used.
* <p>
* If none is found, a default one will be created as default for the current scope
* <p>
* If still not found {@link XWTException} thrown...
- *
+ *
* @param element
* @return
*/
@@ -286,7 +285,7 @@ public class XWT {
/**
* Get the DataContext of given element
- *
+ *
* @param context
* @return
*/
@@ -296,7 +295,7 @@ public class XWT {
/**
* Set the DataContext of given element
- *
+ *
* @param context
* @return
*/
@@ -306,7 +305,7 @@ public class XWT {
/**
* Get the Triggers of given element
- *
+ *
* @param context
* @return
*/
@@ -316,7 +315,7 @@ public class XWT {
/**
* Get the Triggers of given element
- *
+ *
* @param context
* @return
*/
@@ -327,7 +326,7 @@ public class XWT {
/**
* Get the CLR (Common Language Runtime) object. If no CLR object is found
* in this element, the research will be propagated in it parent.
- *
+ *
* @param widget
* @return
*/
@@ -337,7 +336,7 @@ public class XWT {
/**
* Find the root shell
- *
+ *
* @param context
* @return
*/
@@ -370,7 +369,7 @@ public class XWT {
/**
* Load the file content. All widget will be created but they are showed.
* This method return the root element.
- *
+ *
*/
static public Object load(URL file) throws Exception {
XWT.checkInitialization();
@@ -380,7 +379,7 @@ public class XWT {
/**
* Load the content from IUIResource. All widget will be created but they
* are showed. This method return the root element.
- *
+ *
*/
static public Object load(IUIResource resource) throws Exception {
XWT.checkInitialization();
@@ -390,7 +389,7 @@ public class XWT {
/**
* Load the file content. All widget will be created but they are showed.
* This method return the root element.
- *
+ *
*/
static public Object load(URL file, Object dataContext) throws Exception {
XWT.checkInitialization();
@@ -400,7 +399,7 @@ public class XWT {
/**
* Load the content from IUIResource. All widget will be created but they
* are showed. This method return the root element.
- *
+ *
*/
static public Object load(IUIResource resource, Object dataContext) throws Exception {
XWT.checkInitialization();
@@ -420,7 +419,7 @@ public class XWT {
* Load the file content under a UI Object. All widget will be created. This
* method returns the root element. The DataContext will be associated to
* the root element.
- *
+ *
*/
static public Object load(Object parent, IUIResource resource) throws Exception {
return XWTLoaderManager.getActive().load(parent, resource);
@@ -437,11 +436,11 @@ public class XWT {
/**
* Load the content from IUIResource.
- *
+ *
* @param stream
* @param input
* @param parsingCallback
- * null if the callback is not necessary
+ * null if the callback is not necessary
* @return
* @throws Exception
*/
@@ -451,11 +450,11 @@ public class XWT {
/**
* Load the content from IUIResource.
- *
+ *
* @param stream
* @param input
* @param parsingCallback
- * null if the callback is not necessary
+ * null if the callback is not necessary
* @return
* @throws Exception
*/
@@ -465,10 +464,10 @@ public class XWT {
/**
* Load the content from IUIResource.
- *
+ *
* @param input
* @param parsingCallback
- * null if the callback is not necessary
+ * null if the callback is not necessary
* @return
* @throws Exception
*/
@@ -478,7 +477,7 @@ public class XWT {
/**
* Load the content from IUIResource.
- *
+ *
* @param input
* @return
* @throws Exception
@@ -586,7 +585,7 @@ public class XWT {
}
/**
- *
+ *
* @param stream
* @param url
* @param options
@@ -599,7 +598,7 @@ public class XWT {
}
/**
- *
+ *
* @param stream
* @param url
* @param options
@@ -613,7 +612,7 @@ public class XWT {
/**
* Metaclass services to return all registered Metaclasses.
- *
+ *
* @param stream
* @param url
* @param loadData
@@ -626,10 +625,10 @@ public class XWT {
/**
* Get the corresponding Metaclass
- *
+ *
* @param tagName
* @param ns
- * The namespace
+ * The namespace
* @return
*/
static public IMetaclass getMetaclass(String tagName, String ns) {
@@ -638,7 +637,7 @@ public class XWT {
/**
* Register a Data converter
- *
+ *
* @param converter
* @param type
*/
@@ -648,7 +647,7 @@ public class XWT {
/**
* Register a Data converter
- *
+ *
* @param converter
* @param type
*/
@@ -658,7 +657,7 @@ public class XWT {
/**
* Register a command to a name
- *
+ *
* @param name
* @param command
*/
@@ -668,7 +667,7 @@ public class XWT {
/**
* Add a default style
- *
+ *
* @param style
* @return
*/
@@ -694,7 +693,7 @@ public class XWT {
/**
* Register UI type
- *
+ *
* @param javaclass
*/
static public IMetaclass registerMetaclass(Class<?> type) {
@@ -703,7 +702,7 @@ public class XWT {
/**
* Register UI type
- *
+ *
* @param javaclass
*/
static public void registerMetaclass(IMetaclass type) {
@@ -712,7 +711,7 @@ public class XWT {
/**
* Get the dynamic property value
- *
+ *
* @param javaclass
*/
static public Object getPropertyValue(Object uiElement, IProperty property) {
@@ -721,13 +720,13 @@ public class XWT {
/**
* Get the dynamic property value
- *
+ *
* @param javaclass
*/
static public Object getPropertyValue(Object uiElement, String propertyName) {
IMetaclass metaclass = XWT.getMetaclass(uiElement);
IProperty property = metaclass.findProperty(propertyName);
- if(property == null) {
+ if (property == null) {
return null;
}
return XWTLoaderManager.getActive().getPropertyValue(uiElement, property);
@@ -735,7 +734,7 @@ public class XWT {
/**
* Set the dynamic property value
- *
+ *
* @param javaclass
*/
static public void setPropertyValue(Object uiElement, IProperty property, Object value) {
@@ -744,13 +743,13 @@ public class XWT {
/**
* Set the dynamic property value
- *
+ *
* @param javaclass
*/
static public void setPropertyValue(Object uiElement, String propertyName, Object value) {
IMetaclass metaclass = XWT.getMetaclass(uiElement);
IProperty property = metaclass.findProperty(propertyName);
- if(property == null) {
+ if (property == null) {
throw new XWTException("Property " + propertyName + " not found.");
}
XWTLoaderManager.getActive().setPropertyValue(uiElement, property, value);
@@ -758,7 +757,7 @@ public class XWT {
/**
* Remove the dynamic property value
- *
+ *
* @param javaclass
*/
static public void removePropertyValue(Object uiElement, IProperty property) {
@@ -767,7 +766,7 @@ public class XWT {
/**
* Remove the dynamic property value
- *
+ *
* @param javaclass
*/
static public boolean hasPropertyValue(Object uiElement, IProperty property) {
@@ -776,7 +775,7 @@ public class XWT {
/**
* Find a Data converter
- *
+ *
* @param converter
* @param type
*/
@@ -786,7 +785,7 @@ public class XWT {
/**
* Switch current loading context
- *
+ *
*/
public static void setLoadingContext(ILoadingContext loadingContext) {
XWTLoaderManager.getActive().setLoadingContext(loadingContext);
@@ -794,7 +793,7 @@ public class XWT {
/**
* Return current loading context
- *
+ *
* @return ILoadingContext
*/
public static ILoadingContext getLoadingContext() {
@@ -803,7 +802,7 @@ public class XWT {
/**
* Add a tracking option
- *
+ *
* @param tracking
*/
static public void addTracking(Tracking tracking) {
@@ -812,7 +811,7 @@ public class XWT {
/**
* Test if the tracking on argument is enabled.
- *
+ *
* @param tracking
* @return
*/
@@ -822,7 +821,7 @@ public class XWT {
/**
* Get all tracking options
- *
+ *
* @return
*/
static public Set<Tracking> getTrackings() {
@@ -831,7 +830,7 @@ public class XWT {
/**
* Set up the default ICLRFactory
- *
+ *
* @param factory
*/
static public void setCLRFactory(ICLRFactory factory) {
@@ -839,7 +838,7 @@ public class XWT {
}
static public boolean checkInitialization() {
- if(isAllInitializersInitialized()) {
+ if (isAllInitializersInitialized()) {
return false;
}
return checkInitialization(-1);
@@ -847,12 +846,12 @@ public class XWT {
static public boolean checkInitialization(long timeoutMillis) {
long started = System.currentTimeMillis();
- while(true) {
- if(timeoutMillis != -1 && System.currentTimeMillis() - started > timeoutMillis) {
+ while (true) {
+ if (timeoutMillis != -1 && System.currentTimeMillis() - started > timeoutMillis) {
return false;
}
- if(isAllInitializersInitialized()) {
+ if (isAllInitializersInitialized()) {
return false;
}
@@ -865,9 +864,9 @@ public class XWT {
}
private static boolean isAllInitializersInitialized() {
- synchronized(initializers) {
- for(IXWTInitializer initializer : initializers) {
- if(!initializer.isInitialized()) {
+ synchronized (initializers) {
+ for (IXWTInitializer initializer : initializers) {
+ if (!initializer.isInitialized()) {
return false;
}
}
@@ -877,7 +876,7 @@ public class XWT {
/**
* The default CLRFactory.
- *
+ *
* @return
*/
static public ICLRFactory getCLRFactory() {
@@ -886,7 +885,7 @@ public class XWT {
/**
* Find a command by name
- *
+ *
* @param name
* @return
*/
@@ -908,9 +907,9 @@ public class XWT {
/**
* Check if the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public static boolean isFileResolveType(Class<?> type) {
@@ -919,9 +918,9 @@ public class XWT {
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public static void registerFileResolveType(Class<?> type) {
@@ -930,9 +929,9 @@ public class XWT {
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public static void unregisterFileResolveType(Class<?> type) {
@@ -957,26 +956,26 @@ public class XWT {
/**
* Run in UI context.
- *
+ *
* @param runnable
*/
public static void runOnUIThread(final Runnable runnable) {
String platform = SWT.getPlatform();
- if(platform.startsWith("win")) {
+ if (platform.startsWith("win")) {
XWTLoaderManager.getDefault();
runnable.run();
- } else if(platform.startsWith("rap")) {
+ } else if (platform.startsWith("rap")) {
XWTLoaderManager.getDefault();
runnable.run();
- } else if(platform.endsWith("gtk") || platform.endsWith("cocoa")) {
- synchronized(displayLock) {
- if(displayThread == null || !displayThread.isAlive()) {
+ } else if (platform.endsWith("gtk") || platform.endsWith("cocoa")) {
+ synchronized (displayLock) {
+ if (displayThread == null || !displayThread.isAlive()) {
try {
Field field = Display.class.getDeclaredField("Default");
- if(field != null) {
+ if (field != null) {
field.setAccessible(true);
- Display defaultDisplay = (Display)field.get(null);
- if(defaultDisplay != null) {
+ Display defaultDisplay = (Display) field.get(null);
+ if (defaultDisplay != null) {
displayThread = defaultDisplay.getThread();
}
}
@@ -984,7 +983,7 @@ public class XWT {
}
}
- if(displayThread == null || !displayThread.isAlive()) {
+ if (displayThread == null || !displayThread.isAlive()) {
displayThread = new Thread() {
private long startTime = -1;
@@ -998,14 +997,14 @@ public class XWT {
protected Runnable runnable = new Runnable() {
public void run() {
- if(ignoreNotification) {
+ if (ignoreNotification) {
startTime = -1;
return;
}
- if(startTime == -1) {
+ if (startTime == -1) {
startTime = System.currentTimeMillis();
} else {
- if((System.currentTimeMillis() - startTime) > 10000 && display.getActiveShell() == null && display.getShells().length == 0) {
+ if ((System.currentTimeMillis() - startTime) > 10000 && display.getActiveShell() == null && display.getShells().length == 0) {
toStop = true;
display.wake();
} else {
@@ -1021,13 +1020,13 @@ public class XWT {
XWTLoaderManager.getDefault();
display = Display.getDefault();
runnable.run();
- while(true) {
- if(!display.readAndDispatch()) {
+ while (true) {
+ if (!display.readAndDispatch()) {
display.timerExec(10000, runnable);
display.sleep();
ignoreNotification = true;
}
- if(toStop) {
+ if (toStop) {
break;
}
startTime = -1;
@@ -1039,7 +1038,7 @@ public class XWT {
XWTLoaderManager.getDefault();
XWT.checkInitialization();
Display display = Display.findDisplay(displayThread);
- if(display != null) {
+ if (display != null) {
display.syncExec(runnable);
}
}
@@ -1050,8 +1049,8 @@ public class XWT {
}
public static void addInitializer(IXWTInitializer initializer) {
- synchronized(initializers) {
- if(!XWTLoaderManager.isStarted()) {
+ synchronized (initializers) {
+ if (!XWTLoaderManager.isStarted()) {
initializers.add(initializer);
}
}
@@ -1063,15 +1062,15 @@ public class XWT {
public static Object findParent(Object element, Class<?> type) {
Widget widget = UserData.getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
return UserData.findParent(widget, type);
}
static void runInitializers(IXWTLoader loader) {
- synchronized(initializers) {
- for(IXWTInitializer initializer : XWT.getInitializers()) {
+ synchronized (initializers) {
+ for (IXWTInitializer initializer : XWT.getInitializers()) {
initializer.initialize(loader);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTException.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTException.java
index e46b4532f13..dddf166eec9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTException.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTException.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoader.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoader.java
index e354a8e49d5..b05a2bc15e7 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoader.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoader.java
@@ -156,7 +156,7 @@ import org.eclipse.swt.widgets.TreeItem;
/**
* Default XWT loader
- *
+ *
* @author yyang (yves.yang@soyatec.com) jliu (jin.liu@soyatec.com)
*/
public class XWTLoader implements IXWTLoader {
@@ -177,29 +177,29 @@ public class XWTLoader implements IXWTLoader {
}
public boolean applyProfile(Object profile) {
- if(profile instanceof Core) {
- if(cores.peek() == profile) {
+ if (profile instanceof Core) {
+ if (cores.peek() == profile) {
return false;
}
- cores.push((Core)profile);
+ cores.push((Core) profile);
return true;
}
throw new XWTException("Wrong UI Profile.");
}
public Object restoreProfile() {
- if(cores.size() > 1) {
+ if (cores.size() > 1) {
return cores.pop();
}
throw new XWTException("No user-defined UI Profile.");
}
public Realm getRealm() {
- if(realm != null) {
+ if (realm != null) {
return realm;
}
Display display = Display.getCurrent();
- if(display == null) {
+ if (display == null) {
display = Display.getDefault();
}
return SWTObservables.getRealm(display);
@@ -229,7 +229,7 @@ public class XWTLoader implements IXWTLoader {
/**
* Get the dynamic property value
- *
+ *
* @param javaclass
*/
public Object getPropertyValue(Object uiElement, IProperty property) {
@@ -238,7 +238,7 @@ public class XWTLoader implements IXWTLoader {
/**
* Set the dynamic property value
- *
+ *
* @param javaclass
*/
public void setPropertyValue(Object uiElement, IProperty property, Object value) {
@@ -247,7 +247,7 @@ public class XWTLoader implements IXWTLoader {
/**
* Remove the dynamic property value
- *
+ *
* @param javaclass
*/
public void removePropertyValue(Object uiElement, IProperty property) {
@@ -256,7 +256,7 @@ public class XWTLoader implements IXWTLoader {
/**
* Remove the dynamic property value
- *
+ *
* @param javaclass
*/
public boolean hasPropertyValue(Object uiElement, IProperty property) {
@@ -266,7 +266,7 @@ public class XWTLoader implements IXWTLoader {
/**
* Register an Observable IChangeListener for a given UI element. The second
* registration of the same listener on the same UI Element has no effect.
- *
+ *
* @param context
* @param listener
* @return <code>true</code> the listener is added, <code>false</code> if
@@ -274,7 +274,7 @@ public class XWTLoader implements IXWTLoader {
*/
public boolean addObservableChangeListener(Object control, IChangeListener listener) {
ScopeKeeper scope = UserData.findScopeKeeper(control);
- if(scope != null) {
+ if (scope != null) {
return scope.addChangeListener(listener);
}
return false;
@@ -283,19 +283,19 @@ public class XWTLoader implements IXWTLoader {
/**
* Undo the registration of the Observable IChangeListener for a given UI
* element.
- *
+ *
* @param context
* @param listener
*/
public void removeObservableChangeListener(Object control, IChangeListener listener) {
ScopeKeeper scope = UserData.findScopeKeeper(control);
- if(scope != null) {
+ if (scope != null) {
scope.removeChangeListener(listener);
}
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -304,7 +304,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -313,7 +313,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -322,7 +322,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -331,7 +331,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -340,7 +340,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -349,7 +349,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
*/
public Object findResource(Object object, String key) {
return UserData.findResource(object, key);
@@ -360,7 +360,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
* @param handler
*/
@@ -369,7 +369,7 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
*/
public void unregisterNamespaceHandler(String nsmapace) {
@@ -377,15 +377,15 @@ public class XWTLoader implements IXWTLoader {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
public INamespaceHandler getNamespaceHandler(String nsmapace) {
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
INamespaceHandler handler = core.getNamespaceHandler(nsmapace);
- if(handler != null) {
+ if (handler != null) {
return handler;
}
}
@@ -398,11 +398,11 @@ public class XWTLoader implements IXWTLoader {
* @see org.eclipse.papyrus.xwt.IXWTLoader#getNamespace(java.lang.Class)
*/
public String getNamespace(Class<?> javaclass) {
- if(getMetaclass(javaclass) != null) {
+ if (getMetaclass(javaclass) != null) {
return IConstants.XWT_NAMESPACE;
}
Package javaPackage = javaclass.getPackage();
- if(javaPackage == null) {
+ if (javaPackage == null) {
return IConstants.XAML_CLR_NAMESPACE_PROTO;
}
return IConstants.XAML_CLR_NAMESPACE_PROTO + javaclass.getPackage().getName();
@@ -437,17 +437,17 @@ public class XWTLoader implements IXWTLoader {
*/
public IBindingContext getBindingContext(Object element) {
IBindingContext dataBindingContext = UserData.getBindingContext(element);
- if(dataBindingContext == null) {
+ if (dataBindingContext == null) {
dataBindingContext = UserData.createBindingContext(element);
}
return dataBindingContext;
}
public ICLRFactory getCLRFactory() {
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
ICLRFactory factory = core.getCLRFactory();
- if(factory != null) {
+ if (factory != null) {
return factory;
}
}
@@ -504,7 +504,7 @@ public class XWTLoader implements IXWTLoader {
/**
* Get the Triggers of given element
- *
+ *
* @param context
* @return
*/
@@ -529,22 +529,22 @@ public class XWTLoader implements IXWTLoader {
* @see org.eclipse.papyrus.xwt.IXWTLoader#getMetaclass(java.lang.Object)
*/
public IMetaclass getMetaclass(Object object) {
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
IMetaclass metaclass = core.findMetaclass(object);
- if(metaclass != null) {
+ if (metaclass != null) {
return metaclass;
}
}
Class<?> javaClass = null;
- if(object instanceof Class<?>) {
- javaClass = (Class<?>)object;
+ if (object instanceof Class<?>) {
+ javaClass = (Class<?>) object;
} else {
javaClass = object.getClass();
}
Class<?> superclass = javaClass.getSuperclass();
IMetaclass superMetaclass = null;
- if(superclass != null) {
+ if (superclass != null) {
superMetaclass = getMetaclass(superclass);
}
return getCurrentCore().registerMetaclass(javaClass, IConstants.XWT_NAMESPACE, superMetaclass);
@@ -613,7 +613,7 @@ public class XWTLoader implements IXWTLoader {
}
public Object load(Object parent, IUIResource resource, Map<String, Object> options) throws Exception {
- if(options.isEmpty()) {
+ if (options.isEmpty()) {
options = new HashMap<String, Object>();
}
options.put(CONTAINER_PROPERTY, parent);
@@ -635,25 +635,25 @@ public class XWTLoader implements IXWTLoader {
}
protected Map<String, Object> prepareOptions(Map<String, Object> options, URL url) {
- Boolean disabledStyle = (Boolean)options.get(DISABLE_STYLES_PROPERTY);
- if(!Boolean.TRUE.equals(disabledStyle)) {
+ Boolean disabledStyle = (Boolean) options.get(DISABLE_STYLES_PROPERTY);
+ if (!Boolean.TRUE.equals(disabledStyle)) {
Collection<IStyle> defaultStyles = getDefaultStyles();
Object styles = options.get(DEFAULT_STYLES_PROPERTY);
- if(styles != null) {
- if(styles instanceof IStyle) {
- defaultStyles.add((IStyle)styles);
- } else if(styles instanceof Collection) {
- for(Object element : (Collection<?>)styles) {
- if(element instanceof IStyle) {
- defaultStyles.add((IStyle)element);
+ if (styles != null) {
+ if (styles instanceof IStyle) {
+ defaultStyles.add((IStyle) styles);
+ } else if (styles instanceof Collection) {
+ for (Object element : (Collection<?>) styles) {
+ if (element instanceof IStyle) {
+ defaultStyles.add((IStyle) element);
} else {
throw new XWTException("IStyle is expected in [styles] parameters.");
}
}
- } else if(styles instanceof Object[]) {
- for(Object element : (Object[])styles) {
- if(element instanceof IStyle) {
- defaultStyles.add((IStyle)element);
+ } else if (styles instanceof Object[]) {
+ for (Object element : (Object[]) styles) {
+ if (element instanceof IStyle) {
+ defaultStyles.add((IStyle) element);
} else {
throw new XWTException("IStyle is expected in [styles] parameters.");
}
@@ -661,11 +661,11 @@ public class XWTLoader implements IXWTLoader {
}
options.remove(DEFAULT_STYLES_PROPERTY);
}
- if(!defaultStyles.isEmpty()) {
- ResourceDictionary dictionary = (ResourceDictionary)options.get(RESOURCE_DICTIONARY_PROPERTY);
- if(dictionary == null) {
+ if (!defaultStyles.isEmpty()) {
+ ResourceDictionary dictionary = (ResourceDictionary) options.get(RESOURCE_DICTIONARY_PROPERTY);
+ if (dictionary == null) {
dictionary = new ResourceDictionary();
- if(options == Collections.EMPTY_MAP) {
+ if (options == Collections.EMPTY_MAP) {
options = new HashMap<String, Object>();
}
options.put(RESOURCE_DICTIONARY_PROPERTY, dictionary);
@@ -674,7 +674,7 @@ public class XWTLoader implements IXWTLoader {
}
}
// Register URL property
- if(options == Collections.EMPTY_MAP) {
+ if (options == Collections.EMPTY_MAP) {
options = new HashMap<String, Object>();
}
options.put(URL_PROPERTY, url);
@@ -783,34 +783,34 @@ public class XWTLoader implements IXWTLoader {
* @see org.eclipse.papyrus.xwt.IXWTLoader#open(java.net.URL, java.util.Map)
*/
public void open(final URL url, final Map<String, Object> options) throws Exception {
- if(SWT.getPlatform().startsWith("win")) {
- if(Display.getCurrent() == null) {
+ if (SWT.getPlatform().startsWith("win")) {
+ if (Display.getCurrent() == null) {
new Display();
}
Realm.runWithDefault(getRealm(), new Runnable() {
public void run() {
try {
- if(url == null) {
+ if (url == null) {
throw new XWTException("UI Resource is not found.");
}
Object element = loadWithOptions(url, options);
Shell shell = XWT.findShell(element);
- if(shell == null) {
+ if (shell == null) {
throw new XWTException("Root element must be a control.");
}
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
Shell[] shells = Display.getCurrent().getShells();
- if(shells.length == 0) {
+ if (shells.length == 0) {
ResourceManager.resources.dispose();
}
}
});
shell.open();
- while(!shell.isDisposed()) {
- if(!shell.getDisplay().readAndDispatch()) {
+ while (!shell.isDisposed()) {
+ if (!shell.getDisplay().readAndDispatch()) {
shell.getDisplay().sleep();
}
}
@@ -822,27 +822,27 @@ public class XWTLoader implements IXWTLoader {
return;
}
Display defaultDisplay = Display.getDefault();
- if(Thread.currentThread() == defaultDisplay.getThread()) {
+ if (Thread.currentThread() == defaultDisplay.getThread()) {
Realm.runWithDefault(getRealm(), new Runnable() {
public void run() {
try {
- if(url == null) {
+ if (url == null) {
throw new XWTException("UI Resource is not found.");
}
Object element = loadWithOptions(url, options);
Shell shell = XWT.findShell(element);
shell.open();
long startTime = -1;
- while(true) {
- if(!Display.getDefault().readAndDispatch()) {
+ while (true) {
+ if (!Display.getDefault().readAndDispatch()) {
Display.getDefault().sleep();
}
Shell[] shells = Display.getDefault().getShells();
- if(shells.length == 0) {
- if(startTime == -1) {
+ if (shells.length == 0) {
+ if (startTime == -1) {
startTime = System.currentTimeMillis();
- } else if((System.currentTimeMillis() - startTime) > 1000) {
+ } else if ((System.currentTimeMillis() - startTime) > 1000) {
break;
}
} else {
@@ -862,12 +862,12 @@ public class XWTLoader implements IXWTLoader {
public void run() {
try {
- if(url == null) {
+ if (url == null) {
throw new XWTException("UI Resource is not found.");
}
Object element = loadWithOptions(url, options);
Shell shell = XWT.findShell(element);
- if(shell == null) {
+ if (shell == null) {
throw new XWTException("Root element must be a control.");
}
shell.open();
@@ -882,8 +882,8 @@ public class XWTLoader implements IXWTLoader {
}
public void open(final IUIResource resource, final Map<String, Object> options) throws Exception {
- if(SWT.getPlatform().startsWith("win")) {
- if(Display.getCurrent() == null) {
+ if (SWT.getPlatform().startsWith("win")) {
+ if (Display.getCurrent() == null) {
new Display();
}
Realm.runWithDefault(getRealm(), new Runnable() {
@@ -892,21 +892,21 @@ public class XWTLoader implements IXWTLoader {
try {
Object element = loadWithOptions(resource, options);
Shell shell = XWT.findShell(element);
- if(shell == null) {
+ if (shell == null) {
throw new XWTException("Root element must be a control.");
}
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
Shell[] shells = Display.getCurrent().getShells();
- if(shells.length == 0) {
+ if (shells.length == 0) {
ResourceManager.resources.dispose();
}
}
});
shell.open();
- while(!shell.isDisposed()) {
- if(!shell.getDisplay().readAndDispatch()) {
+ while (!shell.isDisposed()) {
+ if (!shell.getDisplay().readAndDispatch()) {
shell.getDisplay().sleep();
}
}
@@ -918,27 +918,27 @@ public class XWTLoader implements IXWTLoader {
return;
}
Display defaultDisplay = Display.getDefault();
- if(Thread.currentThread() == defaultDisplay.getThread()) {
+ if (Thread.currentThread() == defaultDisplay.getThread()) {
Realm.runWithDefault(getRealm(), new Runnable() {
public void run() {
try {
Object element = loadWithOptions(resource, options);
Shell shell = XWT.findShell(element);
- if(shell == null) {
+ if (shell == null) {
throw new XWTException("Root element must be a control.");
}
shell.open();
long startTime = -1;
- while(true) {
- if(!Display.getDefault().readAndDispatch()) {
+ while (true) {
+ if (!Display.getDefault().readAndDispatch()) {
Display.getDefault().sleep();
}
Shell[] shells = Display.getDefault().getShells();
- if(shells.length == 0) {
- if(startTime == -1) {
+ if (shells.length == 0) {
+ if (startTime == -1) {
startTime = System.currentTimeMillis();
- } else if((System.currentTimeMillis() - startTime) > 1000) {
+ } else if ((System.currentTimeMillis() - startTime) > 1000) {
break;
}
} else {
@@ -960,7 +960,7 @@ public class XWTLoader implements IXWTLoader {
try {
Object element = loadWithOptions(resource, options);
Shell shell = XWT.findShell(element);
- if(shell == null) {
+ if (shell == null) {
throw new XWTException("Root element must be a control.");
}
shell.open();
@@ -993,14 +993,14 @@ public class XWTLoader implements IXWTLoader {
* java.lang.String)
*/
public Object convertFrom(Class<?> targetType, String string) {
- if(targetType == String.class) {
+ if (targetType == String.class) {
return string;
}
IConverter converter = findConvertor(String.class, targetType);
- if(converter != null) {
+ if (converter != null) {
return converter.convert(string);
}
- if(targetType == Object.class) {
+ if (targetType == Object.class) {
return string;
}
throw new XWTException("Converter is missing of type: " + targetType.getName() + " from String");
@@ -1013,10 +1013,10 @@ public class XWTLoader implements IXWTLoader {
* java.util.Map)
*/
public Object loadWithOptions(URL url, Map<String, Object> options) throws Exception {
- if(url == null) {
+ if (url == null) {
throw new XWTException("UI Resource is not found.");
}
- Composite object = (Composite)options.get(CONTAINER_PROPERTY);
+ Composite object = (Composite) options.get(CONTAINER_PROPERTY);
ILoadingContext loadingContext = (object != null ? getLoadingContext(object) : getLoadingContext());
options = prepareOptions(options, url);
Object visualObject = getCurrentCore().load(loadingContext, url, options);
@@ -1024,7 +1024,7 @@ public class XWTLoader implements IXWTLoader {
}
public Object loadWithOptions(IUIResource resource, Map<String, Object> options) throws Exception {
- UIResource uiResource = (UIResource)resource;
+ UIResource uiResource = (UIResource) resource;
Object object = options.get(CONTAINER_PROPERTY);
ILoadingContext loadingContext = (object != null ? getLoadingContext(object) : getLoadingContext());
options = prepareOptions(options, uiResource.getURL());
@@ -1053,7 +1053,7 @@ public class XWTLoader implements IXWTLoader {
* java.net.URL, java.util.Map)
*/
public Object loadWithOptions(InputStream stream, URL base, Map<String, Object> options) throws Exception {
- Composite object = (Composite)options.get(CONTAINER_PROPERTY);
+ Composite object = (Composite) options.get(CONTAINER_PROPERTY);
ILoadingContext loadingContext = (object != null ? getLoadingContext(object) : getLoadingContext());
options = prepareOptions(options, base);
Control visualObject = getCurrentCore().load(loadingContext, stream, base, options);
@@ -1067,7 +1067,7 @@ public class XWTLoader implements IXWTLoader {
*/
public IMetaclass[] getAllMetaclasses() {
Collection<IMetaclass> collector = new ArrayList<IMetaclass>();
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
Collection<IMetaclass> metaclasses = core.getAllMetaclasses(IConstants.XWT_NAMESPACE);
collector.addAll(metaclasses);
@@ -1082,10 +1082,10 @@ public class XWTLoader implements IXWTLoader {
* java.lang.String)
*/
public IMetaclass getMetaclass(String tagName, String ns) {
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
IMetaclass metaclass = core.getMetaclass(getLoadingContext(), tagName, ns);
- if(metaclass != null) {
+ if (metaclass != null) {
return metaclass;
}
}
@@ -1130,10 +1130,10 @@ public class XWTLoader implements IXWTLoader {
public IConverter findConvertor(Class<?> source, Class<?> target) {
source = ObjectUtil.normalizedType(source);
target = ObjectUtil.normalizedType(target);
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
IConverter converter = core.findConvertor(source, target);
- if(converter != null) {
+ if (converter != null) {
return converter;
}
}
@@ -1222,10 +1222,10 @@ public class XWTLoader implements IXWTLoader {
* @see org.eclipse.papyrus.xwt.IXWTLoader#getCommand(java.lang.String)
*/
public ICommand getCommand(String name) {
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
ICommand command = core.getCommand(name);
- if(command != null) {
+ if (command != null) {
return command;
}
}
@@ -1239,10 +1239,10 @@ public class XWTLoader implements IXWTLoader {
*/
public Map<String, ICommand> getCommands() {
HashMap<String, ICommand> collector = new HashMap<String, ICommand>();
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
Map<String, ICommand> map = core.getCommands();
- if(map != null) {
+ if (map != null) {
collector.putAll(map);
}
}
@@ -1260,7 +1260,7 @@ public class XWTLoader implements IXWTLoader {
/**
* Register a command to a name
- *
+ *
* @param name
* @param command
*/
@@ -1340,10 +1340,10 @@ public class XWTLoader implements IXWTLoader {
*/
public Collection<IDataProviderFactory> getDataProviderFactories() {
ArrayList<IDataProviderFactory> collector = new ArrayList<IDataProviderFactory>();
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
Collection<IDataProviderFactory> factories = core.getDataProviderFactories();
- if(factories != null) {
+ if (factories != null) {
collector.addAll(factories);
}
}
@@ -1356,10 +1356,10 @@ public class XWTLoader implements IXWTLoader {
* @see org.eclipse.papyrus.xwt.IXWTLoader#findDataProvider(java.lang.Object)
*/
public IDataProvider findDataProvider(Object dataContext) {
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
IDataProvider provider = core.findDataProvider(dataContext);
- if(provider != null) {
+ if (provider != null) {
return provider;
}
}
@@ -1430,13 +1430,13 @@ public class XWTLoader implements IXWTLoader {
registerConvertor(SetToIObservableCollection.instance);
registerConvertor(ObjectToISelection.instance);
registerConvertor(ListToSet.instance);
- // registerConvertor(StringToKeyTime.instance);
- // registerConvertor(StringToKeySpline.instance);
+ // registerConvertor(StringToKeyTime.instance);
+ // registerConvertor(StringToKeySpline.instance);
registerConvertor(IStatusToString.instance);
registerConvertor(IStatusToBoolean.instance);
- ValueConvertorRegister convertorRegister = (ValueConvertorRegister)core.getService(ValueConvertorRegister.class);
+ ValueConvertorRegister convertorRegister = (ValueConvertorRegister) core.getService(ValueConvertorRegister.class);
convertorRegister.register(String.class, float.class, StringToNumberConverter.toFloat(true));
convertorRegister.register(String.class, int.class, StringToInteger.instance);
@@ -1477,8 +1477,8 @@ public class XWTLoader implements IXWTLoader {
IProperty drawingProperty = new AbstractProperty(IUserDataConstants.XWT_DRAWING_KEY, Drawing.class) {
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- if(!ObjectUtil.isAssignableFrom(IBinding.class, getType())) {
- if(value != null) {
+ if (!ObjectUtil.isAssignableFrom(IBinding.class, getType())) {
+ if (value != null) {
value = ObjectUtil.resolveValue(value, getType(), value);
}
}
@@ -1491,7 +1491,7 @@ public class XWTLoader implements IXWTLoader {
metaclass.addProperty(drawingProperty);
IProperty dataContextProperty = new DataProperty(IConstants.XAML_DATA_CONTEXT, IUserDataConstants.XWT_DATACONTEXT_KEY);
metaclass.addProperty(dataContextProperty);
- ILoadingType loadingType = new DefaultLoadingType(IValueLoading.PostChildren, new IProperty[]{ dataContextProperty });
+ ILoadingType loadingType = new DefaultLoadingType(IValueLoading.PostChildren, new IProperty[] { dataContextProperty });
metaclass.addProperty(new DataProperty(IConstants.XAML_BINDING_CONTEXT, IUserDataConstants.XWT_BINDING_CONTEXT_KEY));
metaclass.addProperty(new TriggersProperty(loadingType));
@@ -1516,7 +1516,7 @@ public class XWTLoader implements IXWTLoader {
registerMetaclass(org.eclipse.swt.widgets.Canvas.class);
registerMetaclass(org.eclipse.swt.widgets.Caret.class);
metaclass = registerMetaclass(org.eclipse.swt.widgets.Combo.class);
- if(metaclass != null) {
+ if (metaclass != null) {
IProperty property = metaclass.findProperty("text");
IProperty inputProperty = new DelegateProperty(property, loadingType);
metaclass.addProperty(inputProperty);
@@ -1583,7 +1583,7 @@ public class XWTLoader implements IXWTLoader {
registerMetaclass(type);
metaclass = registerMetaclass(type);
metaclass.addProperty(new DynamicBeanProperty(TreeItem.class, String[].class, PropertiesConstants.PROPERTY_TEXTS, PropertiesConstants.PROPERTY_TEXT));
- if(metaclass != null) {
+ if (metaclass != null) {
IProperty property = metaclass.findProperty("expanded");
IProperty expandedProperty = new DelegateProperty(property, loadingType);
metaclass.addProperty(expandedProperty);
@@ -1602,7 +1602,7 @@ public class XWTLoader implements IXWTLoader {
registerMetaclass(org.eclipse.swt.custom.CLabel.class);
metaclass = registerMetaclass(org.eclipse.swt.custom.CCombo.class);
- if(metaclass != null) {
+ if (metaclass != null) {
IProperty property = metaclass.findProperty("text");
IProperty inputProperty = new DelegateProperty(property, loadingType);
metaclass.addProperty(inputProperty);
@@ -1610,7 +1610,7 @@ public class XWTLoader implements IXWTLoader {
registerMetaclass(org.eclipse.swt.custom.CTabFolder.class);
registerMetaclass(org.eclipse.swt.custom.CTabItem.class);
metaclass = registerMetaclass(org.eclipse.swt.custom.SashForm.class);
- if(metaclass != null) {
+ if (metaclass != null) {
IProperty property = metaclass.findProperty("weights");
IProperty inputProperty = new DelegateProperty(property, loadingType);
metaclass.addProperty(inputProperty);
@@ -1625,7 +1625,7 @@ public class XWTLoader implements IXWTLoader {
type = org.eclipse.jface.viewers.Viewer.class;
metaclass = core.getMetaclass(type, IConstants.XWT_NAMESPACE);
- if(metaclass != null) {
+ if (metaclass != null) {
IProperty property = metaclass.findProperty("Input");
IProperty inputProperty = new InputBeanProperty(property, loadingType);
metaclass.addProperty(inputProperty);
@@ -1636,34 +1636,34 @@ public class XWTLoader implements IXWTLoader {
metaclass.addProperty(new DataProperty(PropertiesConstants.PROPERTY_BINDING_PATH, IUserDataConstants.XWT_PROPERTY_DATA_KEY, String.class));
metaclass.addProperty(new DataProperty(PropertiesConstants.PROPERTY_ITEM_TEXT, IUserDataConstants.XWT_PROPERTY_ITEM_TEXT_KEY, IBinding.class));
metaclass.addProperty(new DataProperty(PropertiesConstants.PROPERTY_ITEM_IMAGE, IUserDataConstants.XWT_PROPERTY_ITEM_IMAGE_KEY, IBinding.class));
- ILoadingType inputLoadingType = new DefaultLoadingType(IValueLoading.PostChildren, new IProperty[]{ inputProperty });
+ ILoadingType inputLoadingType = new DefaultLoadingType(IValueLoading.PostChildren, new IProperty[] { inputProperty });
metaclass.addProperty(new SingleSelectionBeanProperty(PropertiesConstants.PROPERTY_SINGLE_SELECTION, inputLoadingType));
metaclass.addProperty(new MultiSelectionBeanProperty(PropertiesConstants.PROPERTY_MULTI_SELECTION, inputLoadingType));
}
type = org.eclipse.jface.viewers.AbstractListViewer.class;
metaclass = core.getMetaclass(type, IConstants.XWT_NAMESPACE);
- if(metaclass != null) {
+ if (metaclass != null) {
metaclass.addInitializer(new JFaceInitializer());
}
type = org.eclipse.jface.viewers.ColumnViewer.class;
metaclass = core.getMetaclass(type, IConstants.XWT_NAMESPACE);
- if(metaclass != null) {
+ if (metaclass != null) {
metaclass.addProperty(new DynamicBeanProperty(type, String[].class, PropertiesConstants.PROPERTY_COLUMN_PROPERTIES));
metaclass.addProperty(new ColumnViewerColumnsProperty());
metaclass.addInitializer(new JFaceInitializer());
}
- for(Class<?> cls : JFacesHelper.getSupportedElements()) {
+ for (Class<?> cls : JFacesHelper.getSupportedElements()) {
registerMetaclass(cls);
}
type = org.eclipse.jface.viewers.TableViewer.class;
metaclass = core.getMetaclass(type, IConstants.XWT_NAMESPACE);
IProperty property = metaclass.findProperty("table");
- if(property instanceof AbstractProperty) {
- AbstractProperty abstractProperty = (AbstractProperty)property;
+ if (property instanceof AbstractProperty) {
+ AbstractProperty abstractProperty = (AbstractProperty) property;
abstractProperty.setValueAsParent(true);
}
@@ -1701,9 +1701,9 @@ public class XWTLoader implements IXWTLoader {
registerMetaclass(MultiDataTrigger.class);
registerMetaclass(Condition.class);
- // registerConvertor(StringToDuration.instance);
- // registerConvertor(StringToTimeSpan.instance);
- // registerConvertor(StringToRepeatBehavior.instance);
+ // registerConvertor(StringToDuration.instance);
+ // registerConvertor(StringToTimeSpan.instance);
+ // registerConvertor(StringToRepeatBehavior.instance);
registerMetaclass(CollectionViewSource.class);
@@ -1721,10 +1721,10 @@ public class XWTLoader implements IXWTLoader {
* @see org.eclipse.papyrus.xwt.IXWTLoader#findLoadingContext(java.lang.Object)
*/
public ILoadingContext findLoadingContext(Object container) {
- for(int i = cores.size() - 1; i >= 0; i--) {
+ for (int i = cores.size() - 1; i >= 0; i--) {
Core core = cores.get(i);
ILoadingContext context = core.findLoadingContext(container);
- if(context != null) {
+ if (context != null) {
return context;
}
}
@@ -1763,9 +1763,9 @@ public class XWTLoader implements IXWTLoader {
/**
* Check if the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public boolean isFileResolveType(Class<?> type) {
@@ -1774,9 +1774,9 @@ public class XWTLoader implements IXWTLoader {
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public void registerFileResolveType(Class<?> type) {
@@ -1785,9 +1785,9 @@ public class XWTLoader implements IXWTLoader {
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public void unregisterFileResolveType(Class<?> type) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoaderManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoaderManager.java
index 365a24b99bc..16b21696713 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoaderManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTLoaderManager.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
* Anyware-tech - add multiple loaders
@@ -24,11 +24,11 @@ public class XWTLoaderManager {
/**
* Returns the default instance of the XWT loader
- *
+ *
* @return the default instance of the XWT loader
*/
public static IXWTLoader getDefault() {
- if(defaultXWTLoader == null) {
+ if (defaultXWTLoader == null) {
defaultXWTLoader = new XWTLoader();
XWT.runInitializers(defaultXWTLoader);
}
@@ -41,12 +41,12 @@ public class XWTLoaderManager {
/**
* Returns the instance of the XWT loader active. If no XWT loader are active, returns the default XWT loader
- *
+ *
* @return the instance of the XWT loader active
*/
public static IXWTLoader getActive() {
IXWTLoader xwtLoader = activeXWTLoader;
- if(xwtLoader == null) {
+ if (xwtLoader == null) {
xwtLoader = getDefault();
}
return xwtLoader;
@@ -54,16 +54,16 @@ public class XWTLoaderManager {
/**
* Sets the active XWT loader
- *
+ *
* @param xwtLoader
- * the XWT loader
+ * the XWT loader
* @param active
- * true if the XWT loader is active, otherwise false
+ * true if the XWT loader is active, otherwise false
*/
public static void setActive(IXWTLoader xwtLoader, boolean active) {
- if(active) {
+ if (active) {
activeXWTLoader = xwtLoader;
- } else if(xwtLoader != null && xwtLoader.equals(activeXWTLoader)) {
+ } else if (xwtLoader != null && xwtLoader.equals(activeXWTLoader)) {
activeXWTLoader = null;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTMaps.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTMaps.java
index 7a7d870fba6..2c6e34b79e1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTMaps.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/XWTMaps.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -34,7 +34,7 @@ public class XWTMaps {
}
private static void checkAndInit() {
- if(styles.isEmpty() || colors.isEmpty() || events.isEmpty() || accelerators.isEmpty()) {
+ if (styles.isEmpty() || colors.isEmpty() || events.isEmpty() || accelerators.isEmpty()) {
init();
}
}
@@ -272,12 +272,12 @@ public class XWTMaps {
}
public static int getStyle(String key) {
- if(key == null) {
+ if (key == null) {
return SWT.NONE;
}
checkAndInit();
String mapKey = key.toUpperCase();
- if(!mapKey.startsWith("SWT.")) {
+ if (!mapKey.startsWith("SWT.")) {
mapKey = "SWT." + mapKey;
}
Integer style = styles.get(mapKey);
@@ -290,12 +290,12 @@ public class XWTMaps {
}
public static int getColor(String key) {
- if(key == null || key.equals("")) {
+ if (key == null || key.equals("")) {
return SWT.NONE;
}
checkAndInit();
String mapKey = key.toUpperCase();
- if(!mapKey.startsWith("SWT.")) {
+ if (!mapKey.startsWith("SWT.")) {
mapKey = "SWT." + mapKey;
}
Integer color = colors.get(mapKey);
@@ -308,12 +308,12 @@ public class XWTMaps {
}
public static int getEvent(String key) {
- if(key == null || key.equals("")) {
+ if (key == null || key.equals("")) {
return SWT.None;
}
checkAndInit();
String mapKey = key.toLowerCase();
- if(!mapKey.startsWith("swt.")) {
+ if (!mapKey.startsWith("swt.")) {
mapKey = "swt." + mapKey;
}
Integer event = events.get(mapKey);
@@ -327,32 +327,32 @@ public class XWTMaps {
public static int getAccelerator(String key) {
char letter;
- if(key == null || key.equals("")) {
+ if (key == null || key.equals("")) {
return SWT.NONE;
}
checkAndInit();
- if(key.equals("BS")) {
+ if (key.equals("BS")) {
Integer accelerator = Integer.valueOf(SWT.BS);
return accelerator == null ? SWT.NONE : accelerator;
- } else if(key.equals("ENTER")) {
+ } else if (key.equals("ENTER")) {
Integer accelerator = Integer.valueOf(SWT.CR);
return accelerator == null ? SWT.NONE : accelerator;
- } else if(key.equals("DEL")) {
+ } else if (key.equals("DEL")) {
Integer accelerator = Integer.valueOf(SWT.DEL);
return accelerator == null ? SWT.NONE : accelerator;
- } else if(key.equals("SPACE")) {
+ } else if (key.equals("SPACE")) {
Integer accelerator = Integer.valueOf(' ');
return accelerator == null ? SWT.NONE : accelerator;
- } else if(key.length() == 1) {
+ } else if (key.length() == 1) {
letter = key.charAt(0);
- if(letter >= 'A' && letter <= 'Z' || letter >= 'a' && letter <= 'z') {
+ if (letter >= 'A' && letter <= 'Z' || letter >= 'a' && letter <= 'z') {
Integer accelerator = Integer.valueOf(letter);
return accelerator == null ? SWT.NONE : accelerator;
}
}
String mapKey = key.toUpperCase();
- if(!mapKey.startsWith("SWT.")) {
+ if (!mapKey.startsWith("SWT.")) {
mapKey = "SWT." + mapKey;
}
@@ -362,314 +362,314 @@ public class XWTMaps {
public static int getValue(String key) {
int value = getStyle(key);
- if(value == SWT.NONE) {
+ if (value == SWT.NONE) {
value = getColor(key);
}
- if(value == SWT.NONE) {
+ if (value == SWT.NONE) {
value = getEvent(key);
}
- if(value == SWT.NONE) {
+ if (value == SWT.NONE) {
value = getAccelerator(key);
}
return value;
}
public static String getCombAccelerator(String content) {
- if(content.equals("Alt0")) {
+ if (content.equals("Alt0")) {
return "SWT.ALT | SWT.KEYPAD_0";
- } else if(content.equals("Alt1")) {
+ } else if (content.equals("Alt1")) {
return "SWT.ALT | SWT.KEYPAD_1";
- } else if(content.equals("Alt2")) {
+ } else if (content.equals("Alt2")) {
return "SWT.ALT | SWT.KEYPAD_2";
- } else if(content.equals("Alt3")) {
+ } else if (content.equals("Alt3")) {
return "SWT.ALT | SWT.KEYPAD_3";
- } else if(content.equals("Alt4")) {
+ } else if (content.equals("Alt4")) {
return "SWT.ALT | SWT.KEYPAD_4";
- } else if(content.equals("Alt5")) {
+ } else if (content.equals("Alt5")) {
return "SWT.ALT | SWT.KEYPAD_5";
- } else if(content.equals("Alt6")) {
+ } else if (content.equals("Alt6")) {
return "SWT.ALT | SWT.KEYPAD_6";
- } else if(content.equals("Alt7")) {
+ } else if (content.equals("Alt7")) {
return "SWT.ALT | SWT.KEYPAD_7";
- } else if(content.equals("Alt8")) {
+ } else if (content.equals("Alt8")) {
return "SWT.ALT | SWT.KEYPAD_8";
- } else if(content.equals("Alt9")) {
+ } else if (content.equals("Alt9")) {
return "SWT.ALT | SWT.KEYPAD_9";
- } else if(content.equals("AltBksp")) {
+ } else if (content.equals("AltBksp")) {
return "SWT.ALT | BS";
- } else if(content.equals("AltDownArrow")) {
+ } else if (content.equals("AltDownArrow")) {
return "SWT.ALT | SWT.ARROW_DOWN";
- } else if(content.equals("AltF1")) {
+ } else if (content.equals("AltF1")) {
return "SWT.ALT | SWT.F1";
- } else if(content.equals("AltF10")) {
+ } else if (content.equals("AltF10")) {
return "SWT.ALT | SWT.F10";
- } else if(content.equals("AltF11")) {
+ } else if (content.equals("AltF11")) {
return "SWT.ALT | SWT.F11";
- } else if(content.equals("AltF12")) {
+ } else if (content.equals("AltF12")) {
return "SWT.ALT | SWT.F12";
- } else if(content.equals("AltF2")) {
+ } else if (content.equals("AltF2")) {
return "SWT.ALT | SWT.F2";
- } else if(content.equals("AltF3")) {
+ } else if (content.equals("AltF3")) {
return "SWT.ALT | SWT.F3";
- } else if(content.equals("AltF4")) {
+ } else if (content.equals("AltF4")) {
return "SWT.ALT | SWT.F4";
- } else if(content.equals("AltF5")) {
+ } else if (content.equals("AltF5")) {
return "SWT.ALT | SWT.F5";
- } else if(content.equals("AltF6")) {
+ } else if (content.equals("AltF6")) {
return "SWT.ALT | SWT.F6";
- } else if(content.equals("AltF7")) {
+ } else if (content.equals("AltF7")) {
return "SWT.ALT | SWT.F7";
- } else if(content.equals("AltF8")) {
+ } else if (content.equals("AltF8")) {
return "SWT.ALT | SWT.F8";
- } else if(content.equals("AltF9")) {
+ } else if (content.equals("AltF9")) {
return "SWT.ALT | SWT.F9";
- } else if(content.equals("AltLeftArrow")) {
+ } else if (content.equals("AltLeftArrow")) {
return "SWT.ALT | SWT.ARROW_LEFT";
- } else if(content.equals("AltRightArrow")) {
+ } else if (content.equals("AltRightArrow")) {
return "SWT.ALT | SWT.ARROW_RIGHT";
- } else if(content.equals("AltUpArrow")) {
+ } else if (content.equals("AltUpArrow")) {
return "SWT.ALT | SWT.ARROW_UP";
- } else if(content.equals("AltEnter")) {
+ } else if (content.equals("AltEnter")) {
return "SWT.ALT | Enter";
- } else if(content.equals("AltSpace")) {
+ } else if (content.equals("AltSpace")) {
return "SWT.ALT | Space";
- } else if(content.equals("Ctrl0")) {
+ } else if (content.equals("Ctrl0")) {
return "SWT.CTRL | SWT.KEYPAD_0";
- } else if(content.equals("Ctrl1")) {
+ } else if (content.equals("Ctrl1")) {
return "SWT.CTRL | SWT.KEYPAD_1";
- } else if(content.equals("Ctrl2")) {
+ } else if (content.equals("Ctrl2")) {
return "SWT.CTRL | SWT.KEYPAD_2";
- } else if(content.equals("Ctrl3")) {
+ } else if (content.equals("Ctrl3")) {
return "SWT.CTRL | SWT.KEYPAD_3";
- } else if(content.equals("Ctrl4")) {
+ } else if (content.equals("Ctrl4")) {
return "SWT.CTRL | SWT.KEYPAD_4";
- } else if(content.equals("Ctrl5")) {
+ } else if (content.equals("Ctrl5")) {
return "SWT.CTRL | SWT.KEYPAD_5";
- } else if(content.equals("Ctrl6")) {
+ } else if (content.equals("Ctrl6")) {
return "SWT.CTRL | SWT.KEYPAD_6";
- } else if(content.equals("Ctrl7")) {
+ } else if (content.equals("Ctrl7")) {
return "SWT.CTRL | SWT.KEYPAD_7";
- } else if(content.equals("Ctrl8")) {
+ } else if (content.equals("Ctrl8")) {
return "SWT.CTRL | SWT.KEYPAD_8";
- } else if(content.equals("Ctrl9")) {
+ } else if (content.equals("Ctrl9")) {
return "SWT.CTRL | SWT.KEYPAD_9";
- } else if(content.equals("CtrlA")) {
+ } else if (content.equals("CtrlA")) {
return "SWT.CTRL | A";
- } else if(content.equals("CtrlB")) {
+ } else if (content.equals("CtrlB")) {
return "SWT.CTRL | B";
- } else if(content.equals("CtrlC")) {
+ } else if (content.equals("CtrlC")) {
return "SWT.CTRL | C";
- } else if(content.equals("CtrlD")) {
+ } else if (content.equals("CtrlD")) {
return "SWT.CTRL | D";
- } else if(content.equals("CtrlDel")) {
+ } else if (content.equals("CtrlDel")) {
return "SWT.CTRL | DEL";
- } else if(content.equals("CtrlEnter")) {
+ } else if (content.equals("CtrlEnter")) {
return "SWT.CTRL | Enter";
- } else if(content.equals("CtrlSpace")) {
+ } else if (content.equals("CtrlSpace")) {
return "SWT.CTRL | Space";
- } else if(content.equals("CtrlE")) {
+ } else if (content.equals("CtrlE")) {
return "SWT.CTRL | E";
- } else if(content.equals("CtrlF")) {
+ } else if (content.equals("CtrlF")) {
return "SWT.CTRL | F";
- } else if(content.equals("CtrlF1")) {
+ } else if (content.equals("CtrlF1")) {
return "SWT.CTRL | SWT.F1";
- } else if(content.equals("CtrlF10")) {
+ } else if (content.equals("CtrlF10")) {
return "SWT.CTRL | SWT.F10";
- } else if(content.equals("CtrlF11")) {
+ } else if (content.equals("CtrlF11")) {
return "SWT.CTRL | SWT.F11";
- } else if(content.equals("CtrlF12")) {
+ } else if (content.equals("CtrlF12")) {
return "SWT.CTRL | SWT.F12";
- } else if(content.equals("CtrlF2")) {
+ } else if (content.equals("CtrlF2")) {
return "SWT.CTRL | SWT.F2";
- } else if(content.equals("CtrlF3")) {
+ } else if (content.equals("CtrlF3")) {
return "SWT.CTRL | SWT.F3";
- } else if(content.equals("CtrlF4")) {
+ } else if (content.equals("CtrlF4")) {
return "SWT.CTRL | SWT.F4";
- } else if(content.equals("CtrlF5")) {
+ } else if (content.equals("CtrlF5")) {
return "SWT.CTRL | SWT.F5";
- } else if(content.equals("CtrlF6")) {
+ } else if (content.equals("CtrlF6")) {
return "SWT.CTRL | SWT.F6";
- } else if(content.equals("CtrlF7")) {
+ } else if (content.equals("CtrlF7")) {
return "SWT.CTRL | SWT.F7";
- } else if(content.equals("CtrlF8")) {
+ } else if (content.equals("CtrlF8")) {
return "SWT.CTRL | SWT.F8";
- } else if(content.equals("CtrlF9")) {
+ } else if (content.equals("CtrlF9")) {
return "SWT.CTRL | SWT.F9";
- } else if(content.equals("CtrlG")) {
+ } else if (content.equals("CtrlG")) {
return "SWT.CTRL | G";
- } else if(content.equals("CtrlH")) {
+ } else if (content.equals("CtrlH")) {
return "SWT.CTRL | H";
- } else if(content.equals("CtrlI")) {
+ } else if (content.equals("CtrlI")) {
return "SWT.CTRL | I";
- } else if(content.equals("CtrlIns")) {
+ } else if (content.equals("CtrlIns")) {
return "SWT.CTRL | SWT.INSERT";
- } else if(content.equals("CtrlJ")) {
+ } else if (content.equals("CtrlJ")) {
return "SWT.CTRL | J";
- } else if(content.equals("CtrlK")) {
+ } else if (content.equals("CtrlK")) {
return "SWT.CTRL | K";
- } else if(content.equals("CtrlL")) {
+ } else if (content.equals("CtrlL")) {
return "SWT.CTRL | L";
- } else if(content.equals("CtrlM")) {
+ } else if (content.equals("CtrlM")) {
return "SWT.CTRL | M";
- } else if(content.equals("CtrlN")) {
+ } else if (content.equals("CtrlN")) {
return "SWT.CTRL | N";
- } else if(content.equals("CtrlO")) {
+ } else if (content.equals("CtrlO")) {
return "SWT.CTRL | O";
- } else if(content.equals("CtrlP")) {
+ } else if (content.equals("CtrlP")) {
return "SWT.CTRL | P";
- } else if(content.equals("CtrlQ")) {
+ } else if (content.equals("CtrlQ")) {
return "SWT.CTRL | Q";
- } else if(content.equals("CtrlR")) {
+ } else if (content.equals("CtrlR")) {
return "SWT.CTRL | R";
- } else if(content.equals("CtrlS")) {
+ } else if (content.equals("CtrlS")) {
return "SWT.CTRL | S";
- } else if(content.equals("CtrlShift0")) {
+ } else if (content.equals("CtrlShift0")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_0";
- } else if(content.equals("CtrlShift1")) {
+ } else if (content.equals("CtrlShift1")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_1";
- } else if(content.equals("CtrlShift2")) {
+ } else if (content.equals("CtrlShift2")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_2";
- } else if(content.equals("CtrlShift3")) {
+ } else if (content.equals("CtrlShift3")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_3";
- } else if(content.equals("CtrlShift4")) {
+ } else if (content.equals("CtrlShift4")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_4";
- } else if(content.equals("CtrlShift5")) {
+ } else if (content.equals("CtrlShift5")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_5";
- } else if(content.equals("CtrlShift6")) {
+ } else if (content.equals("CtrlShift6")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_6";
- } else if(content.equals("CtrlShift7")) {
+ } else if (content.equals("CtrlShift7")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_7";
- } else if(content.equals("CtrlShift8")) {
+ } else if (content.equals("CtrlShift8")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_8";
- } else if(content.equals("CtrlShift9")) {
+ } else if (content.equals("CtrlShift9")) {
return "SWT.CTRL | SWT.SHIFT | SWT.KEYPAD_9";
- } else if(content.equals("CtrlShiftA")) {
+ } else if (content.equals("CtrlShiftA")) {
return "SWT.CTRL | SWT.SHIFT | A";
- } else if(content.equals("CtrlShiftB")) {
+ } else if (content.equals("CtrlShiftB")) {
return "SWT.CTRL | SWT.SHIFT | B";
- } else if(content.equals("CtrlShiftC")) {
+ } else if (content.equals("CtrlShiftC")) {
return "SWT.CTRL | SWT.SHIFT | C";
- } else if(content.equals("CtrlShiftD")) {
+ } else if (content.equals("CtrlShiftD")) {
return "SWT.CTRL | SWT.SHIFT | D";
- } else if(content.equals("CtrlShiftE")) {
+ } else if (content.equals("CtrlShiftE")) {
return "SWT.CTRL | SWT.SHIFT | E";
- } else if(content.equals("CtrlShiftF")) {
+ } else if (content.equals("CtrlShiftF")) {
return "SWT.CTRL | SWT.SHIFT | F";
- } else if(content.equals("CtrlShiftF1")) {
+ } else if (content.equals("CtrlShiftF1")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F1";
- } else if(content.equals("CtrlShiftF10")) {
+ } else if (content.equals("CtrlShiftF10")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F10";
- } else if(content.equals("CtrlShiftF11")) {
+ } else if (content.equals("CtrlShiftF11")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F11";
- } else if(content.equals("CtrlShiftF12")) {
+ } else if (content.equals("CtrlShiftF12")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F12";
- } else if(content.equals("CtrlShiftF2")) {
+ } else if (content.equals("CtrlShiftF2")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F2";
- } else if(content.equals("CtrlShiftF3")) {
+ } else if (content.equals("CtrlShiftF3")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F3";
- } else if(content.equals("CtrlShiftF4")) {
+ } else if (content.equals("CtrlShiftF4")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F4";
- } else if(content.equals("CtrlShiftF5")) {
+ } else if (content.equals("CtrlShiftF5")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F5";
- } else if(content.equals("CtrlShiftF6")) {
+ } else if (content.equals("CtrlShiftF6")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F6";
- } else if(content.equals("CtrlShiftF7")) {
+ } else if (content.equals("CtrlShiftF7")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F7";
- } else if(content.equals("CtrlShiftF8")) {
+ } else if (content.equals("CtrlShiftF8")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F8";
- } else if(content.equals("CtrlShiftF9")) {
+ } else if (content.equals("CtrlShiftF9")) {
return "SWT.CTRL | SWT.SHIFT | SWT.F9";
- } else if(content.equals("CtrlShiftH")) {
+ } else if (content.equals("CtrlShiftH")) {
return "SWT.CTRL | SWT.SHIFT | H";
- } else if(content.equals("CtrlShiftI")) {
+ } else if (content.equals("CtrlShiftI")) {
return "SWT.CTRL | SWT.SHIFT | I";
- } else if(content.equals("CtrlShiftJ")) {
+ } else if (content.equals("CtrlShiftJ")) {
return "SWT.CTRL | SWT.SHIFT | J";
- } else if(content.equals("CtrlShiftK")) {
+ } else if (content.equals("CtrlShiftK")) {
return "SWT.CTRL | SWT.SHIFT | K";
- } else if(content.equals("CtrlShiftL")) {
+ } else if (content.equals("CtrlShiftL")) {
return "SWT.CTRL | SWT.SHIFT | L";
- } else if(content.equals("CtrlShiftM")) {
+ } else if (content.equals("CtrlShiftM")) {
return "SWT.CTRL | SWT.SHIFT | M";
- } else if(content.equals("CtrlShiftN")) {
+ } else if (content.equals("CtrlShiftN")) {
return "SWT.CTRL | SWT.SHIFT | N";
- } else if(content.equals("CtrlShiftO")) {
+ } else if (content.equals("CtrlShiftO")) {
return "SWT.CTRL | SWT.SHIFT | O";
- } else if(content.equals("CtrlShiftP")) {
+ } else if (content.equals("CtrlShiftP")) {
return "SWT.CTRL | SWT.SHIFT | P";
- } else if(content.equals("CtrlShiftQ")) {
+ } else if (content.equals("CtrlShiftQ")) {
return "SWT.CTRL | SWT.SHIFT | Q";
- } else if(content.equals("CtrlShiftR")) {
+ } else if (content.equals("CtrlShiftR")) {
return "SWT.CTRL | SWT.SHIFT | R";
- } else if(content.equals("CtrlShiftS")) {
+ } else if (content.equals("CtrlShiftS")) {
return "SWT.CTRL | SWT.SHIFT | S";
- } else if(content.equals("CtrlShiftT")) {
+ } else if (content.equals("CtrlShiftT")) {
return "SWT.CTRL | SWT.SHIFT | T";
- } else if(content.equals("CtrlShiftU")) {
+ } else if (content.equals("CtrlShiftU")) {
return "SWT.CTRL | SWT.SHIFT | U";
- } else if(content.equals("CtrlShiftV")) {
+ } else if (content.equals("CtrlShiftV")) {
return "SWT.CTRL | SWT.SHIFT | V";
- } else if(content.equals("CtrlShiftW")) {
+ } else if (content.equals("CtrlShiftW")) {
return "SWT.CTRL | SWT.SHIFT | W";
- } else if(content.equals("CtrlShiftX")) {
+ } else if (content.equals("CtrlShiftX")) {
return "SWT.CTRL | SWT.SHIFT | X";
- } else if(content.equals("CtrlShiftY")) {
+ } else if (content.equals("CtrlShiftY")) {
return "SWT.CTRL | SWT.SHIFT | Y";
- } else if(content.equals("CtrlShiftZ")) {
+ } else if (content.equals("CtrlShiftZ")) {
return "SWT.CTRL | SWT.SHIFT | Z";
- } else if(content.equals("CtrlShiftEnter")) {
+ } else if (content.equals("CtrlShiftEnter")) {
return "SWT.CTRL | SWT.SHIFT | Enter";
- } else if(content.equals("CtrlShiftSpace")) {
+ } else if (content.equals("CtrlShiftSpace")) {
return "SWT.CTRL | SWT.SHIFT | Space";
- } else if(content.equals("CtrlT")) {
+ } else if (content.equals("CtrlT")) {
return "SWT.CTRL | T";
- } else if(content.equals("CtrlU")) {
+ } else if (content.equals("CtrlU")) {
return "SWT.CTRL | U";
- } else if(content.equals("CtrlV")) {
+ } else if (content.equals("CtrlV")) {
return "SWT.CTRL | V";
- } else if(content.equals("CtrlW")) {
+ } else if (content.equals("CtrlW")) {
return "SWT.CTRL | W";
- } else if(content.equals("CtrlX")) {
+ } else if (content.equals("CtrlX")) {
return "SWT.CTRL | X";
- } else if(content.equals("CtrlY")) {
+ } else if (content.equals("CtrlY")) {
return "SWT.CTRL | Y";
- } else if(content.equals("CtrlZ")) {
+ } else if (content.equals("CtrlZ")) {
return "SWT.CTRL | Z";
- } else if(content.equals("ShiftDel")) {
+ } else if (content.equals("ShiftDel")) {
return "SWT.SHIFT | DEL";
- } else if(content.equals("ShiftF1")) {
+ } else if (content.equals("ShiftF1")) {
return "SWT.SHIFT | SWT.F1";
- } else if(content.equals("ShiftF10")) {
+ } else if (content.equals("ShiftF10")) {
return "SWT.SHIFT | SWT.F10";
- } else if(content.equals("ShiftF11")) {
+ } else if (content.equals("ShiftF11")) {
return "SWT.SHIFT | SWT.F11";
- } else if(content.equals("ShiftF12")) {
+ } else if (content.equals("ShiftF12")) {
return "SWT.SHIFT | SWT.F12";
- } else if(content.equals("ShiftF3")) {
+ } else if (content.equals("ShiftF3")) {
return "SWT.SHIFT | SWT.F2";
- } else if(content.equals("ShiftF3")) {
+ } else if (content.equals("ShiftF3")) {
return "SWT.SHIFT | SWT.F3";
- } else if(content.equals("ShiftF4")) {
+ } else if (content.equals("ShiftF4")) {
return "SWT.SHIFT | SWT.F4";
- } else if(content.equals("ShiftF5")) {
+ } else if (content.equals("ShiftF5")) {
return "SWT.SHIFT | SWT.F5";
- } else if(content.equals("ShiftF6")) {
+ } else if (content.equals("ShiftF6")) {
return "SWT.SHIFT | SWT.F6";
- } else if(content.equals("ShiftF7")) {
+ } else if (content.equals("ShiftF7")) {
return "SWT.SHIFT | SWT.F7";
- } else if(content.equals("ShiftF8")) {
+ } else if (content.equals("ShiftF8")) {
return "SWT.SHIFT | SWT.F8";
- } else if(content.equals("ShiftF9")) {
+ } else if (content.equals("ShiftF9")) {
return "SWT.SHIFT | SWT.F9";
- } else if(content.equals("ShiftIns")) {
+ } else if (content.equals("ShiftIns")) {
return "SWT.SHIFT | SWT.INSERT";
- } else if(content.equals("ShiftEnter")) {
+ } else if (content.equals("ShiftEnter")) {
return "SWT.SHIFT | Enter";
- } else if(content.equals("ShiftSpace")) {
+ } else if (content.equals("ShiftSpace")) {
return "SWT.SHIFT | Space";
- } else if(content.equals("Enter")) {
+ } else if (content.equals("Enter")) {
return "Enter";
- } else if(content.equals("Space")) {
+ } else if (content.equals("Space")) {
return "Space";
} else {
return content;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/animation/Drawing.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/animation/Drawing.java
index 5e2a8855aa6..78c73f45ebc 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/animation/Drawing.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/animation/Drawing.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
* Anyware-tech - add multiple loaders
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/Containment.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/Containment.java
index 425dcf1fd21..3dea6f09de8 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/Containment.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/Containment.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -17,7 +17,7 @@ import java.lang.annotation.Target;
/**
* To annotate which field should be containment
- *
+ *
* @author yyang
*/
@Retention(RetentionPolicy.RUNTIME)
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UI.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UI.java
index 3a18d50fd69..f3b65fc0279 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UI.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UI.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UIBounds.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UIBounds.java
index 570fa7aaa67..7af36740183 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UIBounds.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/annotation/UIBounds.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/IBeforeParsingCallback.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/IBeforeParsingCallback.java
index 4e62b823779..2737074f120 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/IBeforeParsingCallback.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/IBeforeParsingCallback.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ICreatedCallback.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ICreatedCallback.java
index f427d323152..04801ee43fb 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ICreatedCallback.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ICreatedCallback.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ILoadedCallback.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ILoadedCallback.java
index 87fe146038e..a99a3b80e11 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ILoadedCallback.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/callback/ILoadedCallback.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionView.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionView.java
index e73406f83a0..8e5a36c2ef6 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionView.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionView.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.xwt.core.ICollectionView;
/**
* Represents a view for grouping, sorting, filtering, and navigating a data
* collection.`
- *
+ *
* @author yyang
*/
public class CollectionView<T> implements ICollectionView<T> {
@@ -107,7 +107,7 @@ public class CollectionView<T> implements ICollectionView<T> {
}
public boolean isEmpty() {
- if(canGroup()) {
+ if (canGroup()) {
return groups.isEmpty();
}
return sourceCollection.isEmpty();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionViewSource.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionViewSource.java
index 077c5e350b5..4afce9904d0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionViewSource.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/CollectionViewSource.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -23,7 +23,7 @@ import org.eclipse.papyrus.xwt.XWT;
/**
* The proxy of a CollectionView class.
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class CollectionViewSource {
@@ -35,7 +35,7 @@ public class CollectionViewSource {
/**
* Gets the view object that is currently associated with this instance of CollectionViewSource. This is a dependency property.
- *
+ *
*/
private IObservableCollection view;
@@ -51,14 +51,14 @@ public class CollectionViewSource {
private Class<?> collectionViewType = Object.class;
public Object getSource() {
- if(source == null) {
+ if (source == null) {
source = new ArrayList<Object>();
}
return source;
}
public void setSource(Object source) {
- if(this.source == source) {
+ if (this.source == source) {
return;
}
view = null;
@@ -66,19 +66,19 @@ public class CollectionViewSource {
}
public IObservableCollection getView() {
- if(view == null) {
+ if (view == null) {
Object source = getSource();
- if(!(source instanceof IObservableCollection)) {
+ if (!(source instanceof IObservableCollection)) {
Class<?> elementType = getCollectionViewType();
- if(source.getClass().isArray()) {
- Object[] array = (Object[])source;
+ if (source.getClass().isArray()) {
+ Object[] array = (Object[]) source;
elementType = source.getClass().getComponentType();
source = Arrays.asList(array);
}
- if(source instanceof List<?>) {
- view = new WritableList(XWT.getRealm(), (List<?>)source, elementType);
- } else if(source instanceof Set<?>) {
- view = new WritableSet(XWT.getRealm(), (List<?>)source, elementType);
+ if (source instanceof List<?>) {
+ view = new WritableList(XWT.getRealm(), (List<?>) source, elementType);
+ } else if (source instanceof Set<?>) {
+ view = new WritableSet(XWT.getRealm(), (List<?>) source, elementType);
}
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/GroupDescription.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/GroupDescription.java
index 3975bc4bb57..8e221e7890c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/GroupDescription.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/GroupDescription.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,7 +12,7 @@ package org.eclipse.papyrus.xwt.collection;
/**
* Provides an abstract base class for types that describe how to divide the items in a collection into groups.
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class GroupDescription {
@@ -25,7 +25,7 @@ public class GroupDescription {
protected String[] groupNames;
/**
- *
+ *
* @return
*/
public String[] getGroupNames() {
@@ -33,7 +33,7 @@ public class GroupDescription {
}
/**
- *
+ *
* @param groupNames
*/
public void setGroupNames(String[] groupNames) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/ListSortDirection.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/ListSortDirection.java
index 867f60b2a18..88fb6daebfe 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/ListSortDirection.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/ListSortDirection.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,7 +12,7 @@ package org.eclipse.papyrus.xwt.collection;
/**
* Specifies the direction of a sort operation.
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public enum ListSortDirection {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/SortDescription.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/SortDescription.java
index 9eb9331ef16..b7e1d4fb2a5 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/SortDescription.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/collection/SortDescription.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,7 +12,7 @@ package org.eclipse.papyrus.xwt.collection;
/**
* Defines the direction and the property name to be used as the criteria for sorting a collection.
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class SortDescription {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/AbstractMultiValueConverter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/AbstractMultiValueConverter.java
index 09a07ae6a01..b1d0084eb4c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/AbstractMultiValueConverter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/AbstractMultiValueConverter.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,15 +14,15 @@ import org.eclipse.papyrus.xwt.IMultiValueConverter;
/**
* Default implementation class of IMultiValueConverter
- *
+ *
* @author yyang <yesc.yang@soyatec.com>
*/
public abstract class AbstractMultiValueConverter implements IMultiValueConverter {
public Object convert(Object fromObject) {
- if(!fromObject.getClass().isArray()) {
- fromObject = new Object[]{ fromObject };
+ if (!fromObject.getClass().isArray()) {
+ fromObject = new Object[] { fromObject };
}
- return convert((Object[])fromObject);
+ return convert((Object[]) fromObject);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/BindingToObject.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/BindingToObject.java
index a022425c8be..962db11fd2d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/BindingToObject.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/BindingToObject.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.papyrus.xwt.core.IBinding;
/**
* Binding to Object covnerter
- *
+ *
* @author yyang
*/
public class BindingToObject implements IConverter {
@@ -23,7 +23,7 @@ public class BindingToObject implements IConverter {
public static BindingToObject instance = new BindingToObject();
public Object convert(Object fromObject) {
- IBinding binding = (IBinding)fromObject;
+ IBinding binding = (IBinding) fromObject;
return binding.getValue(null);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToBoolean.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToBoolean.java
index ac8df855a7a..e2fb32ef76a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToBoolean.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToBoolean.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ import org.eclipse.core.databinding.conversion.IConverter;
/**
* String to Boolean converter
- *
+ *
* @author yyang
*/
public class CollectionToBoolean implements IConverter {
@@ -24,7 +24,7 @@ public class CollectionToBoolean implements IConverter {
public static CollectionToBoolean instance = new CollectionToBoolean();
public Object convert(Object fromObject) {
- Collection<?> collection = (Collection<?>)fromObject;
+ Collection<?> collection = (Collection<?>) fromObject;
return !collection.isEmpty();
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToInteger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToInteger.java
index cc9ce10b764..e9ce9f9a468 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToInteger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/CollectionToInteger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ import org.eclipse.core.databinding.conversion.IConverter;
/**
* String to Boolean converter
- *
+ *
* @author yyang
*/
public class CollectionToInteger implements IConverter {
@@ -24,7 +24,7 @@ public class CollectionToInteger implements IConverter {
public static CollectionToInteger instance = new CollectionToInteger();
public Object convert(Object fromObject) {
- Collection<?> collection = (Collection<?>)fromObject;
+ Collection<?> collection = (Collection<?>) fromObject;
return collection.size();
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/DateToString.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/DateToString.java
index cdaa1d986b3..34c4e1c5ea7 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/DateToString.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/DateToString.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import java.util.Date;
/**
* Date to String converter
- *
+ *
* @author yyang
*/
public class DateToString extends ObjectToString {
@@ -32,13 +32,15 @@ public class DateToString extends ObjectToString {
super(fromType);
}
+ @Override
public Object convert(Object fromObject) {
- if(fromObject == null) {
+ if (fromObject == null) {
return super.convert(null);
}
- return FORMATTER.format((Date)fromObject);
+ return FORMATTER.format((Date) fromObject);
}
+ @Override
public Object getToType() {
return String.class;
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/EnumToString.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/EnumToString.java
index f80d3209b2d..d1158189e77 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/EnumToString.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/EnumToString.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -23,7 +23,7 @@ public class EnumToString implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object)
*/
public Object convert(Object fromObject) {
- return ((Enum<?>)fromObject).toString();
+ return ((Enum<?>) fromObject).toString();
}
/*
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToBoolean.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToBoolean.java
index 28091df5276..aa8cf526e0a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToBoolean.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToBoolean.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.IStatus;
/**
* Binding to Object covnerter
- *
+ *
* @author yyang
*/
public class IStatusToBoolean implements IConverter {
@@ -30,7 +30,7 @@ public class IStatusToBoolean implements IConverter {
* Object)
*/
public Object convert(Object fromObject) {
- IStatus status = (IStatus)fromObject;
+ IStatus status = (IStatus) fromObject;
return status.isOK();
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToString.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToString.java
index 27086fc73ce..7c74644bb1d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToString.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/IStatusToString.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.core.runtime.IStatus;
/**
* Binding to Object covnerter
- *
+ *
* @author yyang
*/
public class IStatusToString implements IConverter {
@@ -30,8 +30,8 @@ public class IStatusToString implements IConverter {
* Object)
*/
public Object convert(Object fromObject) {
- IStatus status = (IStatus)fromObject;
- if(status.isOK()) {
+ IStatus status = (IStatus) fromObject;
+ if (status.isOK()) {
return "";
}
return status.getMessage();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToIObservableCollection.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToIObservableCollection.java
index df911898720..57589794aac 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToIObservableCollection.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToIObservableCollection.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.xwt.XWT;
/**
* List to IObservableCollection converter
- *
+ *
* @author yyang
*/
public class ListToIObservableCollection implements IConverter {
@@ -27,8 +27,8 @@ public class ListToIObservableCollection implements IConverter {
public static ListToIObservableCollection instance = new ListToIObservableCollection();
public Object convert(Object fromObject) {
- List<?> list = (List<?>)fromObject;
- return new WritableList(XWT.getRealm(), (List<?>)list, Object.class);
+ List<?> list = (List<?>) fromObject;
+ return new WritableList(XWT.getRealm(), list, Object.class);
}
public Object getFromType() {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToSet.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToSet.java
index e9d673ba305..0a0ca091d64 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToSet.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ListToSet.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -18,7 +18,7 @@ import org.eclipse.core.databinding.conversion.IConverter;
/**
* String to Boolean converter
- *
+ *
* @author yyang
*/
public class ListToSet implements IConverter {
@@ -26,7 +26,7 @@ public class ListToSet implements IConverter {
public static ListToSet instance = new ListToSet();
public Object convert(Object fromObject) {
- List<?> list = (List<?>)fromObject;
+ List<?> list = (List<?>) fromObject;
return new HashSet<Object>(list);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToBoolean.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToBoolean.java
index 4c1e01e5743..3fbc87d2aa9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToBoolean.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToBoolean.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import org.eclipse.core.databinding.conversion.IConverter;
/**
* String to Boolean converter
- *
+ *
* @author yyang
*/
public class ObjectToBoolean implements IConverter {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToISelection.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToISelection.java
index 59cd56de292..4f0c171054f 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToISelection.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToISelection.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
/**
* Safely SWT context values, it used to avoid a NullPointerException when set
* text values to SWT Widgets.
- *
+ *
* @author jliu
*/
public class ObjectToISelection implements IConverter {
@@ -35,13 +35,13 @@ public class ObjectToISelection implements IConverter {
* Object)
*/
public Object convert(Object fromObject) {
- if(fromObject == null) {
+ if (fromObject == null) {
return new StructuredSelection();
}
- if(fromObject instanceof Collection<?>) {
- return new StructuredSelection(((Collection<?>)fromObject).toArray());
- } else if(fromObject.getClass().isArray()) {
- return new StructuredSelection((Object[])fromObject);
+ if (fromObject instanceof Collection<?>) {
+ return new StructuredSelection(((Collection<?>) fromObject).toArray());
+ } else if (fromObject.getClass().isArray()) {
+ return new StructuredSelection((Object[]) fromObject);
}
return new StructuredSelection(fromObject);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToObject.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToObject.java
index 02943c56f5f..433a4f4d49f 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToObject.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToObject.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import org.eclipse.core.databinding.conversion.IConverter;
/**
* Object to Object converter: null converter
- *
+ *
* @author yyang
*/
public class ObjectToObject implements IConverter {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToString.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToString.java
index 36dbb505f83..e1d3aed2c3a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToString.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ObjectToString.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.core.databinding.conversion.IConverter;
/**
* Safely SWT context values, it used to avoid a NullPointerException when set text values to SWT Widgets.
- *
+ *
* @author jliu
*/
public class ObjectToString implements IConverter {
@@ -40,7 +40,7 @@ public class ObjectToString implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object)
*/
public Object convert(Object fromObject) {
- if(fromObject == null) {
+ if (fromObject == null) {
return "";
}
return fromObject.toString();
@@ -52,7 +52,7 @@ public class ObjectToString implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#getFromType()
*/
public Object getFromType() {
- if(fromType == null) {
+ if (fromType == null) {
return Object.class;
}
return fromType;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SelectionToBoolean.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SelectionToBoolean.java
index ca3405628d6..032d6ba7f83 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SelectionToBoolean.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SelectionToBoolean.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.jface.viewers.ISelection;
/**
* String to Boolean converter
- *
+ *
* @author yyang
*/
public class SelectionToBoolean implements IConverter {
@@ -23,7 +23,7 @@ public class SelectionToBoolean implements IConverter {
public static SelectionToBoolean instance = new SelectionToBoolean();
public Object convert(Object fromObject) {
- ISelection selection = (ISelection)fromObject;
+ ISelection selection = (ISelection) fromObject;
return !selection.isEmpty();
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SetToIObservableCollection.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SetToIObservableCollection.java
index aa694a9ff8b..3acd35c456e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SetToIObservableCollection.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/SetToIObservableCollection.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.xwt.XWT;
/**
* Set to IObservableCollection converter
- *
+ *
* @author yyang
*/
public class SetToIObservableCollection implements IConverter {
@@ -27,8 +27,8 @@ public class SetToIObservableCollection implements IConverter {
public static SetToIObservableCollection instance = new SetToIObservableCollection();
public Object convert(Object fromObject) {
- Set<?> set = (Set<?>)fromObject;
- return new WritableSet(XWT.getRealm(), (Set<?>)set, Object.class);
+ Set<?> set = (Set<?>) fromObject;
+ return new WritableSet(XWT.getRealm(), set, Object.class);
}
public Object getFromType() {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringMultiValueConerter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringMultiValueConerter.java
index 08f558227fd..8d501e6b145 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringMultiValueConerter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringMultiValueConerter.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,24 +12,24 @@ package org.eclipse.papyrus.xwt.converters;
/**
* Default implementation of MultiValueConverter from a string
- *
+ *
* @author yyang <yesc.yang@soyatec.com>
- *
+ *
*/
public class StringMultiValueConerter extends AbstractMultiValueConverter {
private String separatorExpression = null;
public Object[] convertBack(Object value) {
- if(value instanceof Object[]) {
- return (Object[])value;
+ if (value instanceof Object[]) {
+ return (Object[]) value;
}
String valueString = value.toString();
return valueString.split(getSeparatorExpression());
}
public String getSeparatorExpression() {
- if(separatorExpression == null) {
+ if (separatorExpression == null) {
return "[ \t\r\n]+";
}
return separatorExpression;
@@ -40,7 +40,7 @@ public class StringMultiValueConerter extends AbstractMultiValueConverter {
}
protected String getSeparator() {
- if(separatorExpression == null || separatorExpression.length() == 0) {
+ if (separatorExpression == null || separatorExpression.length() == 0) {
return " ";
}
return "" + separatorExpression.charAt(0);
@@ -49,8 +49,8 @@ public class StringMultiValueConerter extends AbstractMultiValueConverter {
public Object convert(Object[] value) {
StringBuffer buffer = new StringBuffer();
String separator = getSeparator();
- for(int i = 0; i < value.length; i++) {
- if(i != 0) {
+ for (int i = 0; i < value.length; i++) {
+ if (i != 0) {
buffer.append(separator);
}
buffer.append(value[i]);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToBoolean.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToBoolean.java
index 3916aede3b1..ce26bdbfee0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToBoolean.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToBoolean.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.papyrus.xwt.XWTException;
/**
* String to Boolean converter
- *
+ *
* @author yyang
*/
public class StringToBoolean implements IConverter {
@@ -23,12 +23,12 @@ public class StringToBoolean implements IConverter {
public static StringToBoolean instance = new StringToBoolean();
public Object convert(Object fromObject) {
- String str = (String)fromObject;
- if(str == null || "".equalsIgnoreCase(str)) {
+ String str = (String) fromObject;
+ if (str == null || "".equalsIgnoreCase(str)) {
return false;
- } else if("true".equalsIgnoreCase(str)) {
+ } else if ("true".equalsIgnoreCase(str)) {
return true;
- } else if("false".equalsIgnoreCase(str)) {
+ } else if ("false".equalsIgnoreCase(str)) {
return false;
}
throw new XWTException(str + " is not a boolean");
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToColor.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToColor.java
index a057fa83bd3..08ce9d69019 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToColor.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToColor.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ import org.eclipse.swt.graphics.Color;
/**
* String to Color converter
- *
+ *
* @author jliu
*/
public class StringToColor implements IConverter {
@@ -29,7 +29,7 @@ public class StringToColor implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object)
*/
public Object convert(Object fromObject) {
- return ResourceManager.resources.getColor((String)fromObject);
+ return ResourceManager.resources.getColor((String) fromObject);
}
/*
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToDoubleArray.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToDoubleArray.java
index e46de8a76fe..a5c7d3cc6cc 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToDoubleArray.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToDoubleArray.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.xwt.XWTException;
/**
* String to double[] converter
- *
+ *
* @author jliu
*/
public class StringToDoubleArray implements IConverter {
@@ -32,10 +32,10 @@ public class StringToDoubleArray implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang. Object)
*/
public Object convert(Object fromObject) {
- String source = (String)fromObject;
+ String source = (String) fromObject;
List<Double> result = new ArrayList<Double>();
StringTokenizer stk = new StringTokenizer(source, ", \t\n\r\f");
- while(stk.hasMoreTokens()) {
+ while (stk.hasMoreTokens()) {
String nextToken = stk.nextToken();
try {
result.add(Double.parseDouble(nextToken.trim()));
@@ -44,7 +44,7 @@ public class StringToDoubleArray implements IConverter {
}
}
double[] intArray = new double[result.size()];
- for(int i = 0; i < result.size(); i++) {
+ for (int i = 0; i < result.size(); i++) {
intArray[i] = result.get(i);
}
return intArray;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToEnum.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToEnum.java
index 48bb8b03ffa..7dee4ba9791 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToEnum.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToEnum.java
@@ -3,9 +3,9 @@
* 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: *
- * Soyatec - initial API and implementation *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * Contributors: *
+ * Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.converters;
@@ -28,15 +28,15 @@ public class StringToEnum implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object)
*/
public Object convert(Object fromObject) {
- if(fromObject == null || "".equals(fromObject)) {
- Class<?> type = (Class<?>)getToType();
+ if (fromObject == null || "".equals(fromObject)) {
+ Class<?> type = (Class<?>) getToType();
Object[] values = type.getEnumConstants();
- if(values != null && values.length > 0) {
+ if (values != null && values.length > 0) {
return values[0];
}
}
- return Enum.valueOf((Class)getToType(), (String)fromObject);
+ return Enum.valueOf((Class) getToType(), (String) fromObject);
}
/*
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFont.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFont.java
index a6701ae7df8..e7568b11496 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFont.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFont.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ import org.eclipse.swt.graphics.Font;
/**
* String to Font converter
- *
+ *
* @author yyang
*/
public class StringToFont implements IConverter {
@@ -24,7 +24,7 @@ public class StringToFont implements IConverter {
public static StringToFont instance = new StringToFont();
public Object convert(Object fromObject) {
- return ResourceManager.resources.getFont((String)fromObject);
+ return ResourceManager.resources.getFont((String) fromObject);
}
public Object getFromType() {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFormAttachment.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFormAttachment.java
index 4db2206f283..34ebda722b0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFormAttachment.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToFormAttachment.java
@@ -3,9 +3,9 @@
* 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: *
- * Soyatec - initial API and implementation *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * Contributors: *
+ * Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.converters;
@@ -23,7 +23,7 @@ import org.eclipse.swt.layout.FormAttachment;
* <li><FormData top="0,100,20"></li> would be parsed to FormAttachment(0, 100, 20).
* <nl>
* This converter can not parse some arguments which have Control type.
- *
+ *
* @author jliu (jin.liu@soyatec.com)
*/
public class StringToFormAttachment implements IConverter {
@@ -36,14 +36,14 @@ public class StringToFormAttachment implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object)
*/
public Object convert(Object fromObject) {
- if(fromObject == null) {
+ if (fromObject == null) {
return null;
}
String strValue = fromObject.toString();
int numerator = 0, denominator = 100, offset = 0;
List<Integer> intValues = new ArrayList<Integer>();
String[] split = strValue.split(",");
- for(int i = 0; i < split.length; i++) {
+ for (int i = 0; i < split.length; i++) {
String trim = split[i].trim();
try {
int value = Integer.parseInt(trim);
@@ -55,9 +55,9 @@ public class StringToFormAttachment implements IConverter {
int size = intValues.size();
try {
numerator = intValues.get(0);
- if(size == 2) {
+ if (size == 2) {
offset = intValues.get(1);
- } else if(size == 3) {
+ } else if (size == 3) {
denominator = intValues.get(1);
offset = intValues.get(2);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValidationRule.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValidationRule.java
index a22563550d4..ccb57b1710d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValidationRule.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValidationRule.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.converters;
@@ -30,7 +30,7 @@ public class StringToIValidationRule implements IConverter {
public Object convert(Object fromObject) {
try {
Class<?> type = XWT.getLoadingContext().loadClass(fromObject.toString());
- if(type == null) {
+ if (type == null) {
throw new XWTException("Class " + fromObject.toString() + " is not found.");
}
return type.newInstance();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValueConverter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValueConverter.java
index 9ba8d90480f..8a62f02b1e7 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValueConverter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIValueConverter.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.converters;
@@ -30,7 +30,7 @@ public class StringToIValueConverter implements IConverter {
public Object convert(Object fromObject) {
try {
Class<?> type = XWT.getLoadingContext().loadClass(fromObject.toString());
- if(type == null) {
+ if (type == null) {
throw new XWTException("Class " + fromObject.toString() + " is not found.");
}
return type.newInstance();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToImage.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToImage.java
index f9a9466127d..8cfbba5a940 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToImage.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToImage.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ import org.eclipse.swt.graphics.Image;
/**
* String to Image converter
- *
+ *
* @author jliu
*/
public class StringToImage implements IConverter {
@@ -29,7 +29,7 @@ public class StringToImage implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang.Object)
*/
public Object convert(Object fromObject) {
- return ResourceManager.resources.getImage((String)fromObject);
+ return ResourceManager.resources.getImage((String) fromObject);
}
/*
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIntArray.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIntArray.java
index a64e0ae440d..d4be559d14e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIntArray.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToIntArray.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.xwt.XWTException;
/**
* String to int[] converter
- *
+ *
* @author jliu
*/
public class StringToIntArray implements IConverter {
@@ -32,10 +32,10 @@ public class StringToIntArray implements IConverter {
* @see org.eclipse.core.databinding.conversion.IConverter#convert(java.lang. Object)
*/
public Object convert(Object fromObject) {
- String source = (String)fromObject;
+ String source = (String) fromObject;
List<Integer> result = new ArrayList<Integer>();
StringTokenizer stk = new StringTokenizer(source, ",");
- while(stk.hasMoreTokens()) {
+ while (stk.hasMoreTokens()) {
String nextToken = stk.nextToken();
try {
result.add(Integer.parseInt(nextToken.trim()));
@@ -44,7 +44,7 @@ public class StringToIntArray implements IConverter {
}
}
int[] intArray = new int[result.size()];
- for(int i = 0; i < result.size(); i++) {
+ for (int i = 0; i < result.size(); i++) {
intArray[i] = result.get(i);
}
return intArray;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToInteger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToInteger.java
index 02be7ae714e..351380727b9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToInteger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToInteger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -27,7 +27,7 @@ import org.eclipse.swt.layout.GridData;
/**
* String to Integer converter
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class StringToInteger implements IConverter {
@@ -41,15 +41,15 @@ public class StringToInteger implements IConverter {
protected StringToNumberConverter toNumberConverter = StringToNumberConverter.toInteger(false);
public Object convert(Object fromObject) {
- String str = (String)fromObject;
- if(str.indexOf(STYLES_SEP) != -1) {
+ String str = (String) fromObject;
+ if (str.indexOf(STYLES_SEP) != -1) {
List<String> values = new ArrayList<String>();
StringTokenizer stk = new StringTokenizer(str, STYLES_SEP);
- while(stk.hasMoreTokens()) {
+ while (stk.hasMoreTokens()) {
values.add(stk.nextToken());
}
int result = 0;
- for(String value : values) {
+ for (String value : values) {
result |= convertInt(value.trim());
}
return result;
@@ -58,39 +58,39 @@ public class StringToInteger implements IConverter {
}
protected int convertInt(String str) {
- if(str == null || str.equals("")) {
+ if (str == null || str.equals("")) {
return 0;
}
try {
- // Quick solution for numbers.
- return (Integer)toNumberConverter.convert(str);
+ // Quick solution for numbers.
+ return (Integer) toNumberConverter.convert(str);
} catch (Exception e) {
String normalizedStr = str.toUpperCase().trim();
- if(normalizedStr.startsWith(GRIDDATA_PREFIX)) {
+ if (normalizedStr.startsWith(GRIDDATA_PREFIX)) {
return convertGridDataInt(normalizedStr);
}
try {
int index = str.lastIndexOf('.');
- if(str.indexOf('.') != -1) {
+ if (str.indexOf('.') != -1) {
String className = str.substring(0, index);
- if(className.startsWith("(") && className.endsWith("")) {
+ if (className.startsWith("(") && className.endsWith("")) {
className = className.substring(1, className.length() - 1);
Class<?> type = XWT.getLoadingContext().loadClass(className);
- if(type != null) {
+ if (type != null) {
String memberName = str.substring(index + 1);
Field field = type.getField(memberName);
- if(Modifier.isStatic(field.getModifiers())) {
+ if (Modifier.isStatic(field.getModifiers())) {
return field.getInt(null);
}
}
} else {
IMetaclass metaclass = XWT.getMetaclass(className, IConstants.XWT_NAMESPACE);
- if(metaclass != null) {
+ if (metaclass != null) {
Class<?> type = metaclass.getType();
- if(type != null) {
+ if (type != null) {
String memberName = str.substring(index + 1);
Field field = type.getField(memberName);
- if(Modifier.isStatic(field.getModifiers())) {
+ if (Modifier.isStatic(field.getModifiers())) {
return field.getInt(null);
}
}
@@ -108,37 +108,37 @@ public class StringToInteger implements IConverter {
}
protected int convertGridDataInt(String str) {
- if("GridData.BEGINNING".equalsIgnoreCase(str)) {
+ if ("GridData.BEGINNING".equalsIgnoreCase(str)) {
return GridData.BEGINNING;
- } else if("GridData.CENTER".equalsIgnoreCase(str)) {
+ } else if ("GridData.CENTER".equalsIgnoreCase(str)) {
return GridData.CENTER;
- } else if("GridData.END".equalsIgnoreCase(str)) {
+ } else if ("GridData.END".equalsIgnoreCase(str)) {
return GridData.END;
- } else if("GridData.FILL".equalsIgnoreCase(str)) {
+ } else if ("GridData.FILL".equalsIgnoreCase(str)) {
return GridData.FILL;
- } else if("GridData.FILL_BOTH".equalsIgnoreCase(str)) {
+ } else if ("GridData.FILL_BOTH".equalsIgnoreCase(str)) {
return GridData.FILL_BOTH;
- } else if("GridData.FILL_HORIZONTAL".equalsIgnoreCase(str)) {
+ } else if ("GridData.FILL_HORIZONTAL".equalsIgnoreCase(str)) {
return GridData.FILL_HORIZONTAL;
- } else if("GridData.GRAB_HORIZONTAL".equalsIgnoreCase(str)) {
+ } else if ("GridData.GRAB_HORIZONTAL".equalsIgnoreCase(str)) {
return GridData.GRAB_HORIZONTAL;
- } else if("GridData.GRAB_VERTICAL".equalsIgnoreCase(str)) {
+ } else if ("GridData.GRAB_VERTICAL".equalsIgnoreCase(str)) {
return GridData.GRAB_VERTICAL;
- } else if("GridData.HORIZONTAL_ALIGN_BEGINNING".equalsIgnoreCase(str)) {
+ } else if ("GridData.HORIZONTAL_ALIGN_BEGINNING".equalsIgnoreCase(str)) {
return GridData.HORIZONTAL_ALIGN_BEGINNING;
- } else if("GridData.HORIZONTAL_ALIGN_CENTER".equalsIgnoreCase(str)) {
+ } else if ("GridData.HORIZONTAL_ALIGN_CENTER".equalsIgnoreCase(str)) {
return GridData.HORIZONTAL_ALIGN_CENTER;
- } else if("GridData.HORIZONTAL_ALIGN_END".equalsIgnoreCase(str)) {
+ } else if ("GridData.HORIZONTAL_ALIGN_END".equalsIgnoreCase(str)) {
return GridData.HORIZONTAL_ALIGN_END;
- } else if("GridData.HORIZONTAL_ALIGN_FILL".equalsIgnoreCase(str)) {
+ } else if ("GridData.HORIZONTAL_ALIGN_FILL".equalsIgnoreCase(str)) {
return GridData.HORIZONTAL_ALIGN_FILL;
- } else if("GridData.VERTICAL_ALIGN_BEGINNING".equalsIgnoreCase(str)) {
+ } else if ("GridData.VERTICAL_ALIGN_BEGINNING".equalsIgnoreCase(str)) {
return GridData.VERTICAL_ALIGN_BEGINNING;
- } else if("GridData.VERTICAL_ALIGN_CENTER".equalsIgnoreCase(str)) {
+ } else if ("GridData.VERTICAL_ALIGN_CENTER".equalsIgnoreCase(str)) {
return GridData.VERTICAL_ALIGN_CENTER;
- } else if("GridData.VERTICAL_ALIGN_END".equalsIgnoreCase(str)) {
+ } else if ("GridData.VERTICAL_ALIGN_END".equalsIgnoreCase(str)) {
return GridData.VERTICAL_ALIGN_END;
- } else if("GridData.VERTICAL_ALIGN_FILL".equalsIgnoreCase(str)) {
+ } else if ("GridData.VERTICAL_ALIGN_FILL".equalsIgnoreCase(str)) {
return GridData.VERTICAL_ALIGN_FILL;
}
return 0;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToPoint.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToPoint.java
index acdb36963ec..ab0b69175af 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToPoint.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToPoint.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.swt.graphics.Point;
/**
* String to Point converter
- *
+ *
* @author yyang
*/
public class StringToPoint implements IConverter {
@@ -25,10 +25,10 @@ public class StringToPoint implements IConverter {
public Object convert(Object fromObject) {
int x = 0;
int y = 0;
- if(fromObject != null) {
+ if (fromObject != null) {
StringToIntArray convArray = new StringToIntArray();
- int[] array = (int[])convArray.convert(fromObject);
- if(array.length == 2) {
+ int[] array = (int[]) convArray.convert(fromObject);
+ if (array.length == 2) {
x = array[0];
y = array[1];
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToRectangle.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToRectangle.java
index dfb68007de0..c6df69190a8 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToRectangle.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToRectangle.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,7 +15,7 @@ import org.eclipse.swt.graphics.Rectangle;
/**
* String to Rectangle converter
- *
+ *
* @author yyang
*/
public class StringToRectangle implements IConverter {
@@ -27,10 +27,10 @@ public class StringToRectangle implements IConverter {
int y = 0;
int width = 0;
int height = 0;
- if(fromObject != null) {
+ if (fromObject != null) {
StringToIntArray arrayConvertor = new StringToIntArray();
- int[] array = (int[])arrayConvertor.convert(fromObject);
- if(array.length == 4) {
+ int[] array = (int[]) arrayConvertor.convert(fromObject);
+ if (array.length == 4) {
x = array[0];
y = array[1];
width = array[2];
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToType.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToType.java
index fd84ec08468..b27a322cf42 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToType.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToType.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -17,7 +17,7 @@ import org.eclipse.papyrus.xwt.metadata.IMetaclass;
/**
* String to Type converter
- *
+ *
* @author yyang
*/
public class StringToType implements IConverter {
@@ -25,16 +25,16 @@ public class StringToType implements IConverter {
public static StringToType instance = new StringToType();
public Object convert(Object fromObject) {
- String str = (String)fromObject;
+ String str = (String) fromObject;
String typeName = str;
String namespace = IConstants.XWT_NAMESPACE;
int index = str.lastIndexOf(':');
- if(index != -1) {
+ if (index != -1) {
typeName = str.substring(index + 1);
namespace = str.substring(0, index);
}
IMetaclass metaclass = XWT.getMetaclass(typeName, namespace);
- if(metaclass != null) {
+ if (metaclass != null) {
return metaclass.getType();
}
return null;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToURL.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToURL.java
index 8435f87d64b..514fda4ae18 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToURL.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/StringToURL.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.converters;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ValueConverterAdapter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ValueConverterAdapter.java
index 9a17df4712d..a55449c1476 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ValueConverterAdapter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/converters/ValueConverterAdapter.java
@@ -16,9 +16,9 @@ import org.eclipse.papyrus.xwt.XWT;
/**
* The operation to inverse the converter direction.
- *
+ *
* @author yyang
- *
+ *
*/
public class ValueConverterAdapter implements IValueConverter {
@@ -49,11 +49,11 @@ public class ValueConverterAdapter implements IValueConverter {
public static ValueConverterAdapter create(Class<?> sourceType, Class<?> targetType) {
IConverter fromConvertor = XWT.findConvertor(sourceType, targetType);
- if(fromConvertor == null) {
+ if (fromConvertor == null) {
return null;
}
IConverter toConvertor = XWT.findConvertor(targetType, sourceType);
- if(toConvertor == null) {
+ if (toConvertor == null) {
return null;
}
return new ValueConverterAdapter(fromConvertor, toConvertor);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/AbstractEventGroup.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/AbstractEventGroup.java
index 643fececb19..19d58a4b3e8 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/AbstractEventGroup.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/AbstractEventGroup.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -13,7 +13,7 @@ package org.eclipse.papyrus.xwt.core;
import org.eclipse.papyrus.xwt.IEventGroup;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public abstract class AbstractEventGroup implements IEventGroup {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Condition.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Condition.java
index fd5d4b8897a..43f1dee3cd0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Condition.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Condition.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -18,7 +18,7 @@ import org.eclipse.papyrus.xwt.metadata.IMetaclass;
import org.eclipse.papyrus.xwt.metadata.IProperty;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class Condition {
@@ -89,17 +89,17 @@ public class Condition {
String sourceName = getSourceName();
IBinding binding = getBinding();
Object value = getValue();
- if(value == null) {
+ if (value == null) {
return false;
}
- while(value instanceof IObservableValue) {
- value = ((IObservableValue)value).getValue();
+ while (value instanceof IObservableValue) {
+ value = ((IObservableValue) value).getValue();
}
Object dataObject = TriggerBase.getElementByName(element, sourceName);
- if(propertyName != null) {
- if(cacheData != null) {
+ if (propertyName != null) {
+ if (cacheData != null) {
try {
Object existingValue = cacheData.property.getValue(dataObject);
return Operator.compare(existingValue, operator, cacheData.value);
@@ -111,12 +111,12 @@ public class Condition {
IMetaclass metaclass = XWT.getMetaclass(dataObject);
IProperty prop = metaclass.findProperty(propertyName);
- if(prop != null && value != null) {
+ if (prop != null && value != null) {
cacheData.property = prop;
Class<?> valueType = value.getClass();
IConverter converter = XWT.findConvertor(valueType, prop.getType());
Object trueValue = value;
- if(converter != null) {
+ if (converter != null) {
trueValue = converter.convert(trueValue);
}
cacheData.value = trueValue;
@@ -127,31 +127,31 @@ public class Condition {
LoggerManager.log(e);
}
}
- } else if(binding != null) {
+ } else if (binding != null) {
Object existingValue = binding.getValue(null);
- if(existingValue == null) {
+ if (existingValue == null) {
return false;
}
- while(existingValue instanceof IObservableValue) {
- existingValue = ((IObservableValue)existingValue).getValue();
+ while (existingValue instanceof IObservableValue) {
+ existingValue = ((IObservableValue) existingValue).getValue();
}
Class<?> existingValueType = existingValue.getClass();
Class<?> valueType = value.getClass();
Object normalizedValue = value;
- if(!existingValueType.isAssignableFrom(valueType) && !valueType.isAssignableFrom(existingValueType)) {
+ if (!existingValueType.isAssignableFrom(valueType) && !valueType.isAssignableFrom(existingValueType)) {
IConverter converter = XWT.findConvertor(valueType, existingValueType);
- if(converter != null) {
+ if (converter != null) {
normalizedValue = converter.convert(normalizedValue);
- } else if(value.toString().trim().length() > 0) {
+ } else if (value.toString().trim().length() > 0) {
boolean found = false;
// in case where the value is a boolean
converter = XWT.findConvertor(valueType, Boolean.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, Boolean.class);
- if(converter != null) {
+ if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
@@ -160,14 +160,14 @@ public class Condition {
} catch (RuntimeException e) {
}
}
- if(!found) {
+ if (!found) {
converter = XWT.findConvertor(valueType, int.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, int.class);
- if(converter != null) {
+ if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
@@ -177,14 +177,14 @@ public class Condition {
}
}
}
- if(!found) {
+ if (!found) {
converter = XWT.findConvertor(valueType, double.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, double.class);
- if(converter != null) {
+ if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
@@ -194,14 +194,14 @@ public class Condition {
}
}
}
- if(!found) {
+ if (!found) {
converter = XWT.findConvertor(valueType, String.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(existingValueType, String.class);
- if(converter != null) {
+ if (converter != null) {
existingValue = converter.convert(existingValue);
normalizedValue = booleanValue;
found = true;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/DataTrigger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/DataTrigger.java
index 7eee717cbde..7dff41bf01e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/DataTrigger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/DataTrigger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.xwt.internal.utils.UserData;
import org.eclipse.swt.widgets.Widget;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class DataTrigger extends TriggerBase {
@@ -60,8 +60,8 @@ public class DataTrigger extends TriggerBase {
}
public SetterBase[] getSetters() {
- if(setters == null) {
- return Setter.EMPTY_SETTERS;
+ if (setters == null) {
+ return SetterBase.EMPTY_SETTERS;
}
return setters;
}
@@ -82,34 +82,34 @@ public class DataTrigger extends TriggerBase {
public void doHandleChange(boolean update) {
Widget widget = UserData.getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return;
}
Object currentValue = binding.getValue(null);
- if(currentValue == null) {
+ if (currentValue == null) {
return;
}
- while(currentValue instanceof IObservableValue) {
- currentValue = ((IObservableValue)currentValue).getValue();
+ while (currentValue instanceof IObservableValue) {
+ currentValue = ((IObservableValue) currentValue).getValue();
}
Class<?> currentValueType = currentValue.getClass();
Class<?> valueType = value.getClass();
Object normalizedValue = value;
- if(!currentValueType.isAssignableFrom(valueType) && !valueType.isAssignableFrom(currentValueType)) {
+ if (!currentValueType.isAssignableFrom(valueType) && !valueType.isAssignableFrom(currentValueType)) {
IConverter converter = XWT.findConvertor(valueType, currentValueType);
- if(converter != null) {
+ if (converter != null) {
normalizedValue = converter.convert(normalizedValue);
- } else if(value != null && value.toString().trim().length() > 0) {
+ } else if (value != null && value.toString().trim().length() > 0) {
boolean found = false;
// in case where the value is a boolean
converter = XWT.findConvertor(valueType, Boolean.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(currentValueType, Boolean.class);
- if(converter != null) {
+ if (converter != null) {
currentValue = converter.convert(currentValue);
normalizedValue = booleanValue;
found = true;
@@ -118,14 +118,14 @@ public class DataTrigger extends TriggerBase {
} catch (RuntimeException e) {
}
}
- if(!found) {
+ if (!found) {
converter = XWT.findConvertor(valueType, Integer.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(currentValueType, Integer.class);
- if(converter != null) {
+ if (converter != null) {
currentValue = converter.convert(currentValue);
normalizedValue = booleanValue;
found = true;
@@ -135,14 +135,14 @@ public class DataTrigger extends TriggerBase {
}
}
}
- if(!found) {
+ if (!found) {
converter = XWT.findConvertor(valueType, Double.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(currentValueType, Double.class);
- if(converter != null) {
+ if (converter != null) {
currentValue = converter.convert(currentValue);
normalizedValue = booleanValue;
found = true;
@@ -152,14 +152,14 @@ public class DataTrigger extends TriggerBase {
}
}
}
- if(!found) {
+ if (!found) {
converter = XWT.findConvertor(valueType, String.class);
- if(converter != null) {
+ if (converter != null) {
try {
Object booleanValue = converter.convert(value);
- if(booleanValue != null) {
+ if (booleanValue != null) {
converter = XWT.findConvertor(currentValueType, String.class);
- if(converter != null) {
+ if (converter != null) {
currentValue = converter.convert(currentValue);
normalizedValue = booleanValue;
found = true;
@@ -171,16 +171,16 @@ public class DataTrigger extends TriggerBase {
}
}
}
- if(!Operator.compare(currentValue, operator, normalizedValue) && update) {
+ if (!Operator.compare(currentValue, operator, normalizedValue) && update) {
restoreValues();
return;
}
- for(SetterBase setter : getSetters()) {
+ for (SetterBase setter : getSetters()) {
try {
Object oldValue = setter.applyTo(element, update);
- if(!update) {
- if(oldvalues == null) {
+ if (!update) {
+ if (oldvalues == null) {
oldvalues = new HashMap<SetterBase, Object>();
}
oldvalues.put(setter, oldValue);
@@ -192,18 +192,19 @@ public class DataTrigger extends TriggerBase {
}
}
+ @Override
public void prepare(Object target) {
- if(value == null) {
+ if (value == null) {
return;
}
Widget widget = UserData.getWidget(target);
- if(widget == null) {
+ if (widget == null) {
return;
}
Object bindingTarget = null;
- if(binding != null) {
- if(binding instanceof IDynamicBinding) {
- IDynamicBinding dynamicBinding = (IDynamicBinding)binding;
+ if (binding != null) {
+ if (binding instanceof IDynamicBinding) {
+ IDynamicBinding dynamicBinding = (IDynamicBinding) binding;
bindingTarget = dynamicBinding.createBoundSource();
} else {
bindingTarget = binding.getValue(null);
@@ -211,10 +212,10 @@ public class DataTrigger extends TriggerBase {
} else {
bindingTarget = XWT.getDataContext(widget);
}
- if(!(bindingTarget instanceof IObservableValue)) {
+ if (!(bindingTarget instanceof IObservableValue)) {
return;
}
- IObservableValue observableValue = (IObservableValue)bindingTarget;
+ IObservableValue observableValue = (IObservableValue) bindingTarget;
changeListener = new ValueChangeListener(target);
observableValue.addChangeListener(changeListener);
changeListener.doHandleChange(false); // get default value
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/EventTrigger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/EventTrigger.java
index 3831e23f17a..fe3b82930c6 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/EventTrigger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/EventTrigger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -30,7 +30,7 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class EventTrigger extends TriggerBase {
@@ -69,12 +69,12 @@ public class EventTrigger extends TriggerBase {
@Override
public void prepare(Object target) {
String routedEvent = getRoutedEvent();
- if(routedEvent != null) {
+ if (routedEvent != null) {
Object source = getElementByName(target, getSourceName());
IMetaclass metaclass = XWT.getMetaclass(source);
IEvent event = metaclass.findEvent(ModelUtils.normalizeEventName(routedEvent));
- if(event == null) {
- if(routedEvent != null && !routedEvent.toLowerCase().endsWith(IEventConstants.SUFFIX_KEY)) {
+ if (event == null) {
+ if (routedEvent != null && !routedEvent.toLowerCase().endsWith(IEventConstants.SUFFIX_KEY)) {
LoggerManager.log("Event " + routedEvent + " is not found in " + source.getClass().getName() + ". Please add a suffix \"Event\"!");
} else {
LoggerManager.log("Event " + routedEvent + " is not found in " + source.getClass().getName());
@@ -82,12 +82,12 @@ public class EventTrigger extends TriggerBase {
return;
}
- for(TriggerAction triggerAction : getActions()) {
+ for (TriggerAction triggerAction : getActions()) {
triggerAction.initialize(target);
}
String name = event.getName();
- if("loadedevent".equalsIgnoreCase(name)) {
+ if ("loadedevent".equalsIgnoreCase(name)) {
Widget widget = UserData.getWidget(source);
IEventController eventController = UserData.updateEventController(source);
RunablePaintAction paintRunnable = createPaintRunnable(source);
@@ -108,6 +108,7 @@ public class EventTrigger extends TriggerBase {
}
}
+ @Override
public void on(Object target) {
}
@@ -128,7 +129,7 @@ public class EventTrigger extends TriggerBase {
}
public void run(Object object, Event event) {
- for(TriggerAction triggerAction : EventTrigger.this.getActions()) {
+ for (TriggerAction triggerAction : EventTrigger.this.getActions()) {
triggerAction.run(event, target, null);
}
}
@@ -154,22 +155,22 @@ public class EventTrigger extends TriggerBase {
public void run() {
count--;
- if(count == 0 && !event.widget.isDisposed()) {
+ if (count == 0 && !event.widget.isDisposed()) {
final Display display = event.widget.getDisplay();
display.syncExec(new Runnable() {
public void run() {
- if(transition) {
- for(TriggerAction triggerAction : getActions()) {
+ if (transition) {
+ for (TriggerAction triggerAction : getActions()) {
triggerAction.initialize(target);
}
} else {
- for(TriggerAction triggerAction : getActions()) {
+ for (TriggerAction triggerAction : getActions()) {
triggerAction.endFinalize(target);
}
}
display.removeFilter(eventType, RunableAction.this);
- if(!event.widget.isDisposed()) {
+ if (!event.widget.isDisposed()) {
event.widget.notifyListeners(eventType, event);
display.addFilter(eventType, RunableAction.this);
}
@@ -183,7 +184,7 @@ public class EventTrigger extends TriggerBase {
Widget widget = UserData.getWidget(target);
String name = event.getName();
this.eventType = Controller.getEventTypeByName(name);
- if(this.eventType != SWT.None) {
+ if (this.eventType != SWT.None) {
widget.getDisplay().addFilter(this.eventType, this);
transition = (this.eventType == XWTMaps.getEvent("swt.move") || this.eventType == XWTMaps.getEvent("swt.resize"));
}
@@ -191,10 +192,10 @@ public class EventTrigger extends TriggerBase {
public void handleEvent(Event event) {
Widget widget = UserData.getWidget(target);
- if(event.widget != widget || widget.isDisposed()) {
+ if (event.widget != widget || widget.isDisposed()) {
return;
}
- if(started) {
+ if (started) {
event.type = SWT.NONE;
return;
}
@@ -205,13 +206,13 @@ public class EventTrigger extends TriggerBase {
try {
this.event = Controller.copy(event);
- if(!transition) {
- for(TriggerAction triggerAction : getActions()) {
+ if (!transition) {
+ for (TriggerAction triggerAction : getActions()) {
triggerAction.initialize(target);
}
}
- for(TriggerAction triggerAction : EventTrigger.this.getActions()) {
+ for (TriggerAction triggerAction : EventTrigger.this.getActions()) {
triggerAction.run(event, target, this);
}
} catch (Exception e) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IBinding.java
index 53ce68c4fc3..289ce4c9c30 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IBinding.java
@@ -4,21 +4,21 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.core;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface IBinding {
/**
* The argument is used to determine the filtering. If type is null, no filtering
- *
+ *
* @return
*/
Object getValue(Class<?> type);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/ICollectionView.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/ICollectionView.java
index 2a0bc0a247c..7aeba7d52ec 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/ICollectionView.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/ICollectionView.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -18,21 +18,21 @@ import org.eclipse.papyrus.xwt.collection.SortDescription;
/**
* The interface is implemented by the CollectionView class, which is the base class for Collection
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface ICollectionView<T> {
/**
* Gets a value that indicates whether this view supports filtering via the Filter property.
- *
+ *
* @return
*/
boolean canFilter();
/**
* Gets a value that indicates whether this view supports grouping via the GroupDescriptions property.
- *
+ *
* @return
*/
boolean canGroup();
@@ -40,21 +40,21 @@ public interface ICollectionView<T> {
/**
* Gets a value that indicates whether this view supports sorting via the SortDescriptions property.
- *
+ *
* @return
*/
boolean canSort();
/**
* Gets the current item in the view.
- *
+ *
* @return
*/
T getCurrentItem();
/**
* Gets the ordinal position of the CurrentItem within the view.
- *
+ *
* @return
*/
int getCurrentPosition();
@@ -62,42 +62,42 @@ public interface ICollectionView<T> {
/**
* Returns a value that indicates whether the resulting view is empty.
- *
+ *
* @return
*/
boolean isEmpty();
/**
* Source collection
- *
+ *
* @return
*/
Collection<T> getSourceCollection();
/**
* Gets a collection of GroupDescription objects that describe how the items in the collection are grouped in the view.
- *
+ *
* @return
*/
GroupDescription[] getGroupDescription();
/**
* Gets a collection of SortDescription objects that describe how the items in the collection are sorted in the view.
- *
+ *
* @return
*/
SortDescription[] getSortDescription();
/**
* Gets the top-level groups.
- *
+ *
* @return
*/
Collection<T> getGroups();
/**
* Gets or sets the cultural info for any operations of the view that may differ by culture, such as sorting.
- *
+ *
* @return
*/
Locale getLocale();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IDynamicBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IDynamicBinding.java
index 527fcc160c1..2fb1a25c154 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IDynamicBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IDynamicBinding.java
@@ -13,7 +13,7 @@ package org.eclipse.papyrus.xwt.core;
import org.eclipse.papyrus.xwt.databinding.IBindingContext;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface IDynamicBinding extends IBinding {
@@ -37,14 +37,14 @@ public interface IDynamicBinding extends IBinding {
/**
* Returns the {@link BindingContext} associated with this binding
- *
+ *
* @return the {@link BindingContext}
*/
IBindingContext getBindingContext();
/**
* Sets the {@link BindingContext} this binding is associated with
- *
+ *
* @param dataBindingContext
*/
void setBindingContext(IBindingContext dataBindingContext);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IElementLoaderFactory.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IElementLoaderFactory.java
index c5af27554e7..074d81c4dd6 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IElementLoaderFactory.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IElementLoaderFactory.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IRenderingContext.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IRenderingContext.java
index 3add2a35aae..98ff0cd76e1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IRenderingContext.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IRenderingContext.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IVisualElementLoader.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IVisualElementLoader.java
index d17955334ff..9af4e36f3ab 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IVisualElementLoader.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/IVisualElementLoader.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiDataTrigger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiDataTrigger.java
index 4c62f68ea82..43b0821e77e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiDataTrigger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiDataTrigger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -53,17 +53,17 @@ public class MultiDataTrigger extends TriggerBase {
}
public void doHandleChange(boolean update) {
- for(Condition condition : getConditions()) {
- if(!condition.evaluate(element)) {
+ for (Condition condition : getConditions()) {
+ if (!condition.evaluate(element)) {
restoreValues();
return;
}
}
- for(SetterBase setter : getSetters()) {
+ for (SetterBase setter : getSetters()) {
try {
Object oldValue = setter.applyTo(element, update);
- if(oldvalues == null) {
+ if (oldvalues == null) {
oldvalues = new HashMap<SetterBase, Object>();
}
oldvalues.put(setter, oldValue);
@@ -76,23 +76,23 @@ public class MultiDataTrigger extends TriggerBase {
@Override
public void prepare(Object target) {
- if(getConditions().length == 0) {
+ if (getConditions().length == 0) {
return;
}
Widget widget = UserData.getWidget(target);
- if(widget == null) {
+ if (widget == null) {
return;
}
changeListener = new ValueChangeListener(target);
- for(Condition condition : getConditions()) {
+ for (Condition condition : getConditions()) {
String sourceName = condition.getSourceName();
IBinding binding = condition.getBinding();
Object bindingTarget = null;
- if(binding != null) {
- if(binding instanceof IDynamicBinding) {
- IDynamicBinding dynamicBinding = (IDynamicBinding)binding;
+ if (binding != null) {
+ if (binding instanceof IDynamicBinding) {
+ IDynamicBinding dynamicBinding = (IDynamicBinding) binding;
bindingTarget = dynamicBinding.createBoundSource();
} else {
bindingTarget = binding.getValue(null);
@@ -103,15 +103,16 @@ public class MultiDataTrigger extends TriggerBase {
bindingTarget = XWT.getDataContext(sourceWidget);
}
- if(!(bindingTarget instanceof IObservableValue)) {
+ if (!(bindingTarget instanceof IObservableValue)) {
return;
}
- IObservableValue observableValue = (IObservableValue)bindingTarget;
+ IObservableValue observableValue = (IObservableValue) bindingTarget;
observableValue.addChangeListener(changeListener);
}
changeListener.doHandleChange(false);
}
+ @Override
public void on(Object target) {
changeListener.doHandleChange(true);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiTrigger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiTrigger.java
index 334f47e31c4..70cd419005f 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiTrigger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/MultiTrigger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -47,21 +47,21 @@ public class MultiTrigger extends TriggerBase {
}
public void handleChange(ChangeEvent event) {
- for(Condition condition : getConditions()) {
- if(!condition.evaluate(element)) {
+ for (Condition condition : getConditions()) {
+ if (!condition.evaluate(element)) {
restoreValues();
return;
}
}
- if(oldvalues != null && !oldvalues.isEmpty()) {
+ if (oldvalues != null && !oldvalues.isEmpty()) {
return;
}
- for(SetterBase setter : getSetters()) {
+ for (SetterBase setter : getSetters()) {
try {
Object oldValue = setter.applyTo(element, true);
- if(oldvalues == null) {
+ if (oldvalues == null) {
oldvalues = new HashMap<SetterBase, Object>();
}
oldvalues.put(setter, oldValue);
@@ -78,16 +78,16 @@ public class MultiTrigger extends TriggerBase {
@Override
public void prepare(Object target) {
- if(getConditions().length == 0) {
+ if (getConditions().length == 0) {
return;
}
ValueChangeListener changeListener = new ValueChangeListener(target);
- for(Condition condition : getConditions()) {
+ for (Condition condition : getConditions()) {
String propertyName = condition.getProperty();
String sourceName = condition.getSourceName();
Object source = getElementByName(target, sourceName);
- if(source == null) {
+ if (source == null) {
throw new XWTException("No element is found with the name = " + sourceName);
}
IObservable observableValue = ScopeManager.observeValue(source, source, propertyName, UpdateSourceTrigger.PropertyChanged);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Operator.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Operator.java
index baea4d09a00..77cd7d34d27 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Operator.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Operator.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -22,7 +22,7 @@ public enum Operator {
/**
* The utility helper method, to implement the compare between two objects
- *
+ *
* @param operant1
* @param operator
* @param operant2
@@ -32,35 +32,37 @@ public enum Operator {
public static boolean compare(Object operant1, Operator operator, Object operant2) throws XWTException {
boolean result = false;
- switch(operator) {
+ switch (operator) {
case EQ:
result = objectCompare(operant1, operant2);
break;
case NE:
- if(!objectCompare(operant1, operant2))
+ if (!objectCompare(operant1, operant2)) {
result = true;
+ }
break;
case GT:
- if(numberCompare(operant1, operant2) == 1)
+ if (numberCompare(operant1, operant2) == 1) {
return true;
+ }
break;
case LT:
- if(numberCompare(operant1, operant2) == -1) {
+ if (numberCompare(operant1, operant2) == -1) {
result = true;
}
break;
case GE:
- if(numberCompare(operant1, operant2) == 1 || numberCompare(operant1, operant2) == 0) {
+ if (numberCompare(operant1, operant2) == 1 || numberCompare(operant1, operant2) == 0) {
result = true;
}
break;
case LE:
- if(numberCompare(operant1, operant2) == -1 || numberCompare(operant1, operant2) == 0) {
+ if (numberCompare(operant1, operant2) == -1 || numberCompare(operant1, operant2) == 0) {
result = true;
}
break;
@@ -69,8 +71,8 @@ public enum Operator {
return LikeCompare(operant1, operant2);
case IS_A:
- if(operant2 instanceof Class<?>) {
- return ISACompare(operant1, (Class<?>)operant2);
+ if (operant2 instanceof Class<?>) {
+ return ISACompare(operant1, (Class<?>) operant2);
} else {
throw new XWTException(OperatorExceptionMessage.TYPE_WRONG);
}
@@ -92,7 +94,7 @@ public enum Operator {
* @throws XWTException
*/
private static int numberCompare(Object operant1, Object operant2) throws XWTException {
- if(operant1 == null || operant2 == null) {
+ if (operant1 == null || operant2 == null) {
throw new XWTException(OperatorExceptionMessage.OPRERANR_NULL);
}
Double longoperant1 = convertToDouble(operant1);
@@ -102,63 +104,64 @@ public enum Operator {
/**
* convert the type of operant to the Double
- *
+ *
* @param operant
* @return
* @throws XWTException
*/
private static Double convertToDouble(Object operant) throws XWTException {
- if(operant instanceof Double) {
- return (Double)operant;
+ if (operant instanceof Double) {
+ return (Double) operant;
}
- if(operant instanceof Float) {
- Float floatvalue = (Float)operant;
+ if (operant instanceof Float) {
+ Float floatvalue = (Float) operant;
return Double.parseDouble(String.valueOf(floatvalue));
}
- if(operant instanceof Integer) {
- Integer integer = (Integer)operant;
+ if (operant instanceof Integer) {
+ Integer integer = (Integer) operant;
return Double.parseDouble(String.valueOf(integer));
}
- if(operant instanceof Character) {
- Character character = (Character)operant;
- if(Character.isDigit(character)) {
+ if (operant instanceof Character) {
+ Character character = (Character) operant;
+ if (Character.isDigit(character)) {
int numericValue = Character.getNumericValue(character);
return Double.parseDouble(String.valueOf(numericValue));
}
}
- if(operant instanceof Short) {
- Short shortvalue = (Short)operant;
+ if (operant instanceof Short) {
+ Short shortvalue = (Short) operant;
return Double.parseDouble(String.valueOf(shortvalue));
}
- if(operant instanceof Byte) {
- Byte bytevalue = (Byte)operant;
+ if (operant instanceof Byte) {
+ Byte bytevalue = (Byte) operant;
return Double.parseDouble(String.valueOf(bytevalue));
}
- if(operant instanceof Long) {
- Long floatvalue = (Long)operant;
+ if (operant instanceof Long) {
+ Long floatvalue = (Long) operant;
return Double.parseDouble(String.valueOf(floatvalue));
}
- if(operant instanceof BigDecimal) {
- BigDecimal bigdecimalvalue = (BigDecimal)operant;
+ if (operant instanceof BigDecimal) {
+ BigDecimal bigdecimalvalue = (BigDecimal) operant;
return Double.parseDouble(String.valueOf(bigdecimalvalue));
- } else
+ } else {
throw new XWTException(OperatorExceptionMessage.TYPE_WRONG);
+ }
}
/**
* the compare of two object for NE,EQ
- *
+ *
* @param operant1
* @param operant2
* @return
*/
private static boolean objectCompare(Object operant1, Object operant2) {
- if(operant1 == operant2) {
+ if (operant1 == operant2) {
return true;
}
- if(operant1 != null) {
+ if (operant1 != null) {
return operant1.equals(operant2);
- } else if(operant1 != null) {
+ } else if (operant1 != null) {
return operant2.equals(operant1);
}
return false;
@@ -166,7 +169,7 @@ public enum Operator {
/**
* the compare of two object for ISA
- *
+ *
* @param operant1
* @param operant2
* @return
@@ -178,7 +181,7 @@ public enum Operator {
/**
* the compare of two Double
- *
+ *
* @param operant1
* @param operant2
* @return
@@ -189,19 +192,19 @@ public enum Operator {
/**
* the compare of two String for Like
- *
+ *
* @param operant1
* @param operant2
* @return
* @throws XWTException
*/
private static boolean LikeCompare(Object operant1, Object operant2) throws XWTException {
- if(operant1 == null || operant2 == null) {
+ if (operant1 == null || operant2 == null) {
throw new XWTException(OperatorExceptionMessage.OPRERANR_NULL);
}
- if(operant1 instanceof String && operant2 instanceof String) {
- String operant1String = (String)operant1;
- String operant2String = (String)operant2;
+ if (operant1 instanceof String && operant2 instanceof String) {
+ String operant1String = (String) operant1;
+ String operant2String = (String) operant2;
String queryString = parseRegularExpressionString(operant1String);
Pattern pattern = Pattern.compile(queryString);
Matcher matcher = pattern.matcher(operant2String);
@@ -212,7 +215,7 @@ public enum Operator {
/**
* build the regular expressions
- *
+ *
* @param queryString
* @return
*/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/RadioEventGroup.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/RadioEventGroup.java
index b461bc282ce..49e922e2d69 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/RadioEventGroup.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/RadioEventGroup.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -32,17 +32,17 @@ public class RadioEventGroup extends AbstractEventGroup {
Object host = manager.getHost();
IMetaclass metaclass = XWT.getMetaclass(host);
- EventProperty reaisedEventProperty = (EventProperty)property;
+ EventProperty reaisedEventProperty = (EventProperty) property;
String raisedName = reaisedEventProperty.getEvent().getName();
- for(String name : getEventNames()) {
- if(name.equalsIgnoreCase(raisedName)) {
+ for (String name : getEventNames()) {
+ if (name.equalsIgnoreCase(raisedName)) {
continue;
}
String eventPropertyName = IEventConstants.getEventPropertyName(name);
IProperty eventProperty = metaclass.findProperty(eventPropertyName);
IObservableValue value = manager.getValue(eventProperty);
- if(value != null) {
+ if (value != null) {
value.setValue(false);
}
}
@@ -51,15 +51,15 @@ public class RadioEventGroup extends AbstractEventGroup {
public void registerEvent(IObservableValueListener manager, IProperty property) {
Object host = manager.getHost();
IEventController controller = UserData.findEventController(host);
- if(controller == null) {
+ if (controller == null) {
controller = UserData.updateEventController(host);
}
IMetaclass metaclass = XWT.getMetaclass(host);
- EventProperty reaisedEventProperty = (EventProperty)property;
+ EventProperty reaisedEventProperty = (EventProperty) property;
String raisedName = reaisedEventProperty.getEvent().getName();
- for(String name : getEventNames()) {
- if(name.equalsIgnoreCase(raisedName)) {
+ for (String name : getEventNames()) {
+ if (name.equalsIgnoreCase(raisedName)) {
continue;
}
String eventPropertyName = IEventConstants.getEventPropertyName(name);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Setter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Setter.java
index 4228f20e6d2..e69589f39fe 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Setter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Setter.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.xwt.metadata.IProperty;
/**
* Setter of the class Style, which is used to define the in-line XAML style
- *
+ *
* @see Style
* @author yyang
*/
@@ -55,24 +55,25 @@ public class Setter extends SetterBase {
this.value = value;
}
+ @Override
public Object applyTo(Object element, boolean update) {
String propName = getProperty();
Object propValue = getValue();
String targetName = getTargetName();
Object setterTarget = element;
Object oldValue = null;
- if(targetName != null) {
+ if (targetName != null) {
setterTarget = TriggerBase.getElementByName(element, targetName);
}
IMetaclass metaclass = XWT.getMetaclass(setterTarget);
IProperty prop = metaclass.findProperty(propName);
- if(prop != null && propValue != null) {
+ if (prop != null && propValue != null) {
Object toValue = propValue;
Class<?> valueType = propValue.getClass();
Class<?> targetType = prop.getType();
- if(targetType != null && !targetType.isAssignableFrom(valueType)) {
+ if (targetType != null && !targetType.isAssignableFrom(valueType)) {
IConverter converter = XWT.findConvertor(valueType, targetType);
- if(converter != null) {
+ if (converter != null) {
toValue = converter.convert(propValue);
} else {
throw new XWTException("Converter doesn't exist from \"" + valueType.getName() + "\" to \"" + targetType.getName());
@@ -80,7 +81,7 @@ public class Setter extends SetterBase {
}
try {
oldValue = prop.getValue(setterTarget);
- if(update) {
+ if (update) {
prop.setValue(setterTarget, toValue);
}
} catch (Exception e) {
@@ -90,16 +91,17 @@ public class Setter extends SetterBase {
return oldValue;
}
+ @Override
public void undo(Object element, Object value) {
String propName = getProperty();
String targetName = getTargetName();
Object setterTarget = element;
- if(targetName != null) {
+ if (targetName != null) {
setterTarget = TriggerBase.getElementByName(element, targetName);
}
IMetaclass metaclass = XWT.getMetaclass(setterTarget);
IProperty prop = metaclass.findProperty(propName);
- if(prop != null) {
+ if (prop != null) {
try {
prop.setValue(setterTarget, value);
} catch (Exception e) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/SetterBase.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/SetterBase.java
index b530b2c4107..ebbb28b5253 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/SetterBase.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/SetterBase.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Style.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Style.java
index 9711c0cc5f3..63084d9b007 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Style.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Style.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,7 +12,7 @@ package org.eclipse.papyrus.xwt.core;
/**
* The class defines the in-line XAML style
- *
+ *
* @author yyang
*/
public class Style {
@@ -24,7 +24,7 @@ public class Style {
protected TriggerBase[] triggers;
public TriggerBase[] getTriggers() {
- if(triggers == null) {
+ if (triggers == null) {
return TriggerBase.EMPTY_ARRAY;
}
return triggers;
@@ -43,7 +43,7 @@ public class Style {
}
public SetterBase[] getSetters() {
- if(setters == null) {
+ if (setters == null) {
return SetterBase.EMPTY_SETTERS;
}
return setters;
@@ -54,15 +54,15 @@ public class Style {
}
public void apply(Object target) {
- for(SetterBase setter : getSetters()) {
+ for (SetterBase setter : getSetters()) {
setter.applyTo(target, true);
}
- for(TriggerBase triggerBase : getTriggers()) {
+ for (TriggerBase triggerBase : getTriggers()) {
triggerBase.prepare(target);
}
- for(TriggerBase triggerBase : getTriggers()) {
+ for (TriggerBase triggerBase : getTriggers()) {
triggerBase.on(target);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Trigger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Trigger.java
index 42b2b8c4ee5..385b933640e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Trigger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/Trigger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -70,7 +70,7 @@ public class Trigger extends TriggerBase {
}
public SetterBase[] getSetters() {
- if(setters == null) {
+ if (setters == null) {
return SetterBase.EMPTY_SETTERS;
}
return setters;
@@ -80,13 +80,15 @@ public class Trigger extends TriggerBase {
this.setters = setters;
}
+ @Override
public void on(Object target) {
}
+ @Override
public void prepare(Object target) {
- if(property != null) {
+ if (property != null) {
final Object source = getElementByName(target, sourceName);
- if(source == null) {
+ if (source == null) {
throw new XWTException("No element is found with the name = " + sourceName);
}
IObservable observableValue = ScopeManager.observeValue(source, source, property, UpdateSourceTrigger.PropertyChanged);
@@ -94,12 +96,12 @@ public class Trigger extends TriggerBase {
public void handleChange(ChangeEvent event) {
Class<?> valueType = JFaceXWTDataBinding.getValueType(source.getClass(), property);
- if(valueType == null) {
+ if (valueType == null) {
LoggerManager.log("Type of the property " + property + " is not found in " + source.getClass().getName());
return;
}
Widget widget = UserData.getWidget(source);
- if(widget == null) {
+ if (widget == null) {
return;
}
@@ -107,40 +109,40 @@ public class Trigger extends TriggerBase {
// test value ==
//
Object realValue = value;
- if(value != null) {
+ if (value != null) {
IConverter converter = XWT.findConvertor(value.getClass(), valueType);
- if(converter != null) {
+ if (converter != null) {
realValue = converter.convert(value);
}
}
Object newValue = event.getSource();
- if(newValue instanceof IObservableValue) {
- IObservableValue observableValue = (IObservableValue)newValue;
+ if (newValue instanceof IObservableValue) {
+ IObservableValue observableValue = (IObservableValue) newValue;
newValue = observableValue.getValue();
}
- if(newValue != null) {
+ if (newValue != null) {
IConverter newConverter = XWT.findConvertor(newValue.getClass(), valueType);
- if(newConverter != null) {
+ if (newConverter != null) {
newValue = newConverter.convert(newValue);
}
}
- if(!Operator.compare(newValue, operator, realValue)) {
+ if (!Operator.compare(newValue, operator, realValue)) {
restoreValues();
- if(oldvalues != null) {
+ if (oldvalues != null) {
oldvalues.clear();
}
return;
}
- if(oldvalues != null && !oldvalues.isEmpty()) {
+ if (oldvalues != null && !oldvalues.isEmpty()) {
return;
}
- for(SetterBase setter : getSetters()) {
+ for (SetterBase setter : getSetters()) {
try {
Object oldValue = setter.applyTo(element, true);
- if(oldvalues == null) {
+ if (oldvalues == null) {
oldvalues = new HashMap<SetterBase, Object>();
}
oldvalues.put(setter, oldValue);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerAction.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerAction.java
index 7bc6314af69..1149bc0fc91 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerAction.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerAction.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerBase.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerBase.java
index 70d514518f0..66638abe59e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerBase.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/core/TriggerBase.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -27,7 +27,7 @@ public abstract class TriggerBase {
protected TriggerAction[] exitActions;
public TriggerAction[] getEntryActions() {
- if(entryActions == null) {
+ if (entryActions == null) {
return TriggerAction.EMPTY_ARRAY;
}
return entryActions;
@@ -38,7 +38,7 @@ public abstract class TriggerBase {
}
public TriggerAction[] getExitActions() {
- if(exitActions == null) {
+ if (exitActions == null) {
return TriggerAction.EMPTY_ARRAY;
}
return exitActions;
@@ -63,21 +63,21 @@ public abstract class TriggerBase {
}
protected void restoreValues() {
- if(oldvalues == null) {
+ if (oldvalues == null) {
return;
}
- for(SetterBase setter : oldvalues.keySet()) {
+ for (SetterBase setter : oldvalues.keySet()) {
setter.undo(element, oldvalues.get(setter));
}
}
}
public static Object getElementByName(Object target, String elementName) {
- if(elementName != null && elementName.length() > 0) {
+ if (elementName != null && elementName.length() > 0) {
Widget widget = UserData.getWidget(target);
- if(widget != null) {
+ if (widget != null) {
Object element = XWT.findElementByName(widget, elementName);
- if(element != null) {
+ if (element != null) {
return element;
}
LoggerManager.log("EventTrigger: Source \n" + elementName + "\n is not found in " + target.getClass().getName());
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AbstractDataBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AbstractDataBinding.java
index 6db1c45ca0a..02002f91737 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AbstractDataBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AbstractDataBinding.java
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.xwt.internal.core.BindingExpressionPath;
import org.eclipse.papyrus.xwt.internal.core.UpdateSourceTrigger;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public abstract class AbstractDataBinding implements IDataBinding {
@@ -55,7 +55,7 @@ public abstract class AbstractDataBinding implements IDataBinding {
/**
* @param dataProvider
- * the dataProvider to set
+ * the dataProvider to set
*/
public void setDataProvider(IDataProvider dataProvider) {
this.dataProvider = dataProvider;
@@ -71,7 +71,7 @@ public abstract class AbstractDataBinding implements IDataBinding {
/**
* Returns the name of the data binding context this binding is associated
* with
- *
+ *
* @return
*/
protected IBindingContext getDataBindingContext() {
@@ -100,7 +100,7 @@ public abstract class AbstractDataBinding implements IDataBinding {
}
/**
- *
+ *
* @return
*/
public BindingMode getMode() {
@@ -108,7 +108,7 @@ public abstract class AbstractDataBinding implements IDataBinding {
}
/**
- *
+ *
* @param mode
*/
public void setMode(BindingMode mode) {
@@ -116,7 +116,7 @@ public abstract class AbstractDataBinding implements IDataBinding {
}
/**
- *
+ *
* @return
*/
protected String getSourceProperty() {
@@ -124,7 +124,7 @@ public abstract class AbstractDataBinding implements IDataBinding {
}
/**
- *
+ *
* @return
*/
protected String getTargetProperty() {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AggregateObservableValue.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AggregateObservableValue.java
index c4495b633f3..286fc2c2b51 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AggregateObservableValue.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/AggregateObservableValue.java
@@ -22,7 +22,7 @@ import org.eclipse.papyrus.xwt.XWT;
/**
* @since 3.2
- *
+ *
*/
public class AggregateObservableValue extends AbstractObservableValue {
@@ -37,7 +37,7 @@ public class AggregateObservableValue extends AbstractObservableValue {
private IValueChangeListener listener = new IValueChangeListener() {
public void handleValueChange(ValueChangeEvent event) {
- if(!updating) {
+ if (!updating) {
fireValueChange(Diffs.createValueDiff(currentValue, doGetValue()));
}
}
@@ -52,27 +52,28 @@ public class AggregateObservableValue extends AbstractObservableValue {
this.converter = converter;
this.observableValues = observableValues;
- for(int i = 0; i < observableValues.length; i++) {
+ for (int i = 0; i < observableValues.length; i++) {
observableValues[i].addValueChangeListener(listener);
}
doGetValue();
}
private static Realm findRealm(IObservableValue[] observableValues) {
- for(IObservableValue observableValue : observableValues) {
+ for (IObservableValue observableValue : observableValues) {
return observableValue.getRealm();
}
return XWT.getRealm();
}
+ @Override
public void doSetValue(Object value) {
Object oldValue = doGetValue();
try {
updating = true;
Object[] values = converter.convertBack(value);
- for(int i = 0; i < observableValues.length; i++) {
- if(i < values.length) {
+ for (int i = 0; i < observableValues.length; i++) {
+ if (i < values.length) {
observableValues[i].setValue(values[i]);
} else {
observableValues[i].setValue(null);
@@ -86,9 +87,10 @@ public class AggregateObservableValue extends AbstractObservableValue {
fireValueChange(Diffs.createValueDiff(oldValue, value));
}
+ @Override
public Object doGetValue() {
Object[] values = new Object[observableValues.length];
- for(int i = 0; i < values.length; i++) {
+ for (int i = 0; i < values.length; i++) {
values[i] = observableValues[i].getValue();
}
return converter.convert(values);
@@ -98,8 +100,9 @@ public class AggregateObservableValue extends AbstractObservableValue {
return String[].class;
}
+ @Override
public synchronized void dispose() {
- for(int i = 0; i < observableValues.length; i++) {
+ for (int i = 0; i < observableValues.length; i++) {
observableValues[i].removeValueChangeListener(listener);
}
super.dispose();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingContext.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingContext.java
index 9ee6e165908..a107023e0fc 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingContext.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingContext.java
@@ -52,14 +52,14 @@ public class BindingContext implements IBindingContext {
* @see org.eclipse.papyrus.xwt.databinding.IDataBindingContext#getContext()
*/
public org.eclipse.core.databinding.DataBindingContext getContext() {
- if(this.context == null) {
- if(this.realm != null) {
+ if (this.context == null) {
+ if (this.realm != null) {
this.context = new org.eclipse.core.databinding.DataBindingContext(this.realm);
} else {
this.context = new org.eclipse.core.databinding.DataBindingContext(XWT.getRealm());
}
- if(this.parent != null) {
+ if (this.parent != null) {
this.parent.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
@@ -86,9 +86,9 @@ public class BindingContext implements IBindingContext {
* @see org.eclipse.papyrus.xwt.databinding.IDataBindingContext#getStatus()
*/
public AggregateValidationStatus getStatus() {
- if(this.status == null) {
+ if (this.status == null) {
this.status = new AggregateValidationStatus(getContext(), this.statusType);
- if(this.parent != null) {
+ if (this.parent != null) {
this.parent.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
@@ -124,15 +124,16 @@ public class BindingContext implements IBindingContext {
*
* @see org.eclipse.papyrus.xwt.databinding.IDataBindingContext#equals(java.lang.Object)
*/
+ @Override
public boolean equals(Object obj) {
- if(!(obj instanceof BindingContext)) {
+ if (!(obj instanceof BindingContext)) {
return false;
}
org.eclipse.core.databinding.DataBindingContext context = getContext();
- if(context != null) {
- return context.equals(((BindingContext)obj).getContext());
+ if (context != null) {
+ return context.equals(((BindingContext) obj).getContext());
}
- if(((BindingContext)obj).getContext() != null) {
+ if (((BindingContext) obj).getContext() != null) {
return false;
}
return super.equals(obj);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingMode.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingMode.java
index 60bf3f96519..35fc777f1f3 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingMode.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/BindingMode.java
@@ -4,14 +4,14 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.databinding;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public enum BindingMode {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ControlDataBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ControlDataBinding.java
index d51b7eed3b1..a2fe4a57caa 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ControlDataBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ControlDataBinding.java
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.xwt.internal.core.ScopeManager;
import org.eclipse.papyrus.xwt.internal.utils.UserData;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class ControlDataBinding extends AbstractDataBinding {
@@ -38,31 +38,31 @@ public class ControlDataBinding extends AbstractDataBinding {
public Object getValue(Class<?> targetType) {
IObservableValue targetWidget = null;
Object target = getControl();
- if(target != null) {
+ if (target != null) {
targetWidget = ScopeManager.observeValue(target, target, getTargetProperty(), getUpdateSourceTrigger());
}
- if(source == null) {
+ if (source == null) {
return null;
}
Object control = UserData.getWidget(source);
- if(control == null) {
+ if (control == null) {
control = getControl();
}
IObservableValue sourceWidget = ScopeManager.observeValue(control, source, getSourceProperty(), getUpdateSourceTrigger());
- if(targetWidget == null) {
- if(sourceWidget != null) {
- if(targetType != null && !targetType.isInstance(sourceWidget)) {
+ if (targetWidget == null) {
+ if (sourceWidget != null) {
+ if (targetType != null && !targetType.isInstance(sourceWidget)) {
return sourceWidget;
}
Object value = sourceWidget.getValue();
- while(value instanceof IObservableValue) {
- value = ((IObservableValue)value).getValue();
+ while (value instanceof IObservableValue) {
+ value = ((IObservableValue) value).getValue();
}
IValueConverter converter = getConverter();
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
}
return value;
@@ -73,17 +73,17 @@ public class ControlDataBinding extends AbstractDataBinding {
IBindingContext dataBindingContext = getDataBindingContext();
BindingGate bindingGate = new BindingGate(dataBindingContext);
bindingGate.bind(sourceWidget, targetWidget, this);
- if(sourceWidget != null) {
- if(targetType != null && !targetType.isInstance(sourceWidget)) {
+ if (sourceWidget != null) {
+ if (targetType != null && !targetType.isInstance(sourceWidget)) {
return sourceWidget;
}
// convert to final value
Object value = sourceWidget.getValue();
- while(value instanceof IObservableValue) {
- value = ((IObservableValue)value).getValue();
+ while (value instanceof IObservableValue) {
+ value = ((IObservableValue) value).getValue();
}
IValueConverter converter = getConverter();
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
}
return value;
@@ -92,7 +92,7 @@ public class ControlDataBinding extends AbstractDataBinding {
}
/**
- *
+ *
* @return
*/
protected Object getSource() {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/DataBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/DataBinding.java
index 4c1b9e790d8..4164a32a657 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/DataBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/DataBinding.java
@@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Text;
/**
* The default implementation of the dataBinding object.
- *
+ *
* @author jliu (jin.liu@soyatec.com)
*/
public class DataBinding extends AbstractDataBinding {
@@ -60,65 +60,65 @@ public class DataBinding extends AbstractDataBinding {
* If observableWidget is null, we need only return the data from
* provider.
*/
- if(observableWidget == null) {
- if(observableSource == null) {
+ if (observableWidget == null) {
+ if (observableSource == null) {
// TODO should raise an exception
return null;
}
- if(targetType != null && !targetType.isInstance(observableSource)) {
+ if (targetType != null && !targetType.isInstance(observableSource)) {
return observableSource;
}
// convert to final value
Object value = observableSource;
- if(observableSource instanceof IObservableValue) {
- value = ((IObservableValue)observableSource).getValue();
+ if (observableSource instanceof IObservableValue) {
+ value = ((IObservableValue) observableSource).getValue();
}
return convertedValue(value);
}
BindingGate bindingContext = getBindingGate();
- if(bindingContext != null && observableSource != null) {
+ if (bindingContext != null && observableSource != null) {
Object target = getControl();
- if(target instanceof Text && getTargetProperty().equalsIgnoreCase("text")) {
- if(isSourcePropertyReadOnly()) {
- Text text = (Text)target;
+ if (target instanceof Text && getTargetProperty().equalsIgnoreCase("text")) {
+ if (isSourcePropertyReadOnly()) {
+ Text text = (Text) target;
text.setEditable(false);
}
- } else if(target instanceof Button && getTargetProperty().equalsIgnoreCase("selection")) {
- if(isSourcePropertyReadOnly()) {
- Button button = (Button)target;
+ } else if (target instanceof Button && getTargetProperty().equalsIgnoreCase("selection")) {
+ if (isSourcePropertyReadOnly()) {
+ Button button = (Button) target;
button.setEnabled(false);
}
- } else if((target instanceof Combo || target instanceof CCombo) && getTargetProperty().equalsIgnoreCase("text")) {
- if(isSourcePropertyReadOnly()) {
- Control control = (Control)target;
+ } else if ((target instanceof Combo || target instanceof CCombo) && getTargetProperty().equalsIgnoreCase("text")) {
+ if (isSourcePropertyReadOnly()) {
+ Control control = (Control) target;
control.setEnabled(false);
}
- } else if(target instanceof MenuItem && getTargetProperty().equalsIgnoreCase("selection")) {
- if(isSourcePropertyReadOnly()) {
- MenuItem menuItem = (MenuItem)target;
+ } else if (target instanceof MenuItem && getTargetProperty().equalsIgnoreCase("selection")) {
+ if (isSourcePropertyReadOnly()) {
+ MenuItem menuItem = (MenuItem) target;
menuItem.setEnabled(false);
}
}
bindingContext.bind(observableSource, observableWidget, this);
}
- if(targetType != null && !targetType.isInstance(observableSource)) {
+ if (targetType != null && !targetType.isInstance(observableSource)) {
return observableSource;
}
// convert to final value
Object value = observableSource;
- while(value instanceof IObservableValue) {
- value = ((IObservableValue)value).getValue();
+ while (value instanceof IObservableValue) {
+ value = ((IObservableValue) value).getValue();
}
return convertedValue(value);
}
private BindingGate getBindingGate() {
- if(this.bindingGate == null) {
+ if (this.bindingGate == null) {
IBindingContext dataBindingContext = getDataBindingContext();
this.bindingGate = new BindingGate(dataBindingContext);
}
@@ -128,7 +128,7 @@ public class DataBinding extends AbstractDataBinding {
private Object convertedValue(Object value) {
IValueConverter converter = getConverter();
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
}
return value;
@@ -145,10 +145,10 @@ public class DataBinding extends AbstractDataBinding {
public IObservable getObservableSource(int observeKind) {
IObservable observableSource = getObservableSource();
- if(observableSource == null) {
+ if (observableSource == null) {
IDataProvider dataProvider = getDataProvider();
observableSource = ScopeManager.observe(getControl(), dataProvider.getData(null), getSourcePropertyExpression(), getUpdateSourceTrigger(), observeKind);
- if(observableSource != null) {
+ if (observableSource != null) {
setObservableSource(observableSource);
}
}
@@ -156,25 +156,25 @@ public class DataBinding extends AbstractDataBinding {
}
public IObservable getObservableWidget() {
- if(observableWidget == null) {
+ if (observableWidget == null) {
Object target = getControl();
Object host = getHost();
String targetProperty = getTargetProperty();
targetProperty = ModelUtils.normalizePropertyName(targetProperty);
int observeKind = ScopeManager.AUTO;
- if(host instanceof Viewer && "input".equals(targetProperty)) {
+ if (host instanceof Viewer && "input".equals(targetProperty)) {
// It is possible to use List
getObservableSource(ScopeManager.COLLECTION);
IObservable observableSource = getObservableSource();
- if(observableSource instanceof IObservableList) {
+ if (observableSource instanceof IObservableList) {
return null;
- } else if(observableSource instanceof IObservableSet) {
+ } else if (observableSource instanceof IObservableSet) {
return null;
}
}
try {
BindingExpressionPath path = getTargetPropertyExpression();
- if(path.isEmptyPath()) {
+ if (path.isEmptyPath()) {
return null;
}
observableWidget = ScopeManager.observe(target, host, path, getUpdateSourceTrigger(), observeKind);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/Event.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/Event.java
index 76c1ba0efd8..73876d55356 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/Event.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/Event.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -39,7 +39,7 @@ public class Event {
/**
* @param eventTarget
- * the eventTarget to set
+ * the eventTarget to set
*/
public void setEventTarget(Object eventTarget) {
this.eventTarget = eventTarget;
@@ -54,7 +54,7 @@ public class Event {
/**
* @param oldValue
- * the oldValue to set
+ * the oldValue to set
*/
public void setOldValue(Object oldValue) {
this.oldValue = oldValue;
@@ -69,7 +69,7 @@ public class Event {
/**
* @param newValue
- * the newValue to set
+ * the newValue to set
*/
public void setNewValue(Object newValue) {
this.newValue = newValue;
@@ -84,7 +84,7 @@ public class Event {
/**
* @param eventType
- * the eventType to set
+ * the eventType to set
*/
public void setEventType(String eventType) {
this.eventType = eventType;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventListener.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventListener.java
index 440bb59b597..67b4a2fbc14 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventListener.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventListener.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventManager.java
index 7387aac7fc1..c9b842c1494 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventManager.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.core.databinding.observable.Realm;
/**
* This class <code>EventManager</code> is used to manage all event listeners for a observed object.
- *
+ *
* @author jliu jin.liu@soyatec.com
*/
public class EventManager {
@@ -39,7 +39,7 @@ public class EventManager {
public static EventManager getEventManager(Object eventTarget, Realm realm) {
EventManager eventManager = managers.get(eventTarget);
- if(eventManager == null || eventManager.realm != realm) {
+ if (eventManager == null || eventManager.realm != realm) {
eventManager = new EventManager(eventTarget, realm);
managers.put(eventTarget, eventManager);
}
@@ -49,14 +49,14 @@ public class EventManager {
public void dispatchEvent(Event event) {
String eventType = event.getEventType();
List<EventListener> listeners = type2listeners.get(eventType);
- for(EventListener l : listeners) {
+ for (EventListener l : listeners) {
l.handleEvent(event);
}
}
public void addEventListener(String eventType, EventListener eventListener) {
List<EventListener> listeners = type2listeners.get(eventType);
- if(listeners == null) {
+ if (listeners == null) {
listeners = new ArrayList<EventListener>();
type2listeners.put(eventType, listeners);
}
@@ -65,7 +65,7 @@ public class EventManager {
public void removeEventListener(String eventType, EventListener eventListener) {
List<EventListener> listeners = type2listeners.get(eventType);
- if(listeners != null) {
+ if (listeners != null) {
listeners.remove(eventListener);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventPropertyObservableValue.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventPropertyObservableValue.java
index 0744ba44cd5..e4194bfbc87 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventPropertyObservableValue.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/EventPropertyObservableValue.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -26,13 +26,13 @@ public class EventPropertyObservableValue extends XWTObservableValue {
super(Boolean.class, observed, property.getName());
this.property = property;
IEventController controller = UserData.findEventController(observed);
- if(controller == null) {
+ if (controller == null) {
controller = UserData.updateEventController(observed);
}
IEvent event = property.getEvent();
IObservableValueListener manager = UserData.getObservableValueManager(observed);
- if(manager == null) {
+ if (manager == null) {
manager = new ObservableValueManager(observed);
UserData.setObservableValueManager(observed, manager);
}
@@ -50,6 +50,7 @@ public class EventPropertyObservableValue extends XWTObservableValue {
UserData.setLocalData(getObserved(), property.getName(), value);
}
+ @Override
protected Object doGetValue() {
return UserData.getLocalData(getObserved(), property.getName());
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/IBindingContext.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/IBindingContext.java
index 6f4f679943d..4bf65b3b9c2 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/IBindingContext.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/IBindingContext.java
@@ -25,13 +25,13 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
public interface IBindingContext {
/**
- *
+ *
* @see @see org.eclipse.core.databinding.AggregateValidationStatus#MERGED
*/
public static final int MERGED = org.eclipse.core.databinding.AggregateValidationStatus.MERGED;
/**
- *
+ *
* @see org.eclipse.core.databinding.AggregateValidationStatus#MAX_SEVERITY
*/
public static final int MAX_SEVERITY = org.eclipse.core.databinding.AggregateValidationStatus.MAX_SEVERITY;
@@ -53,7 +53,7 @@ public interface IBindingContext {
/**
* The status type of the status. One of the values
- *
+ *
* @return the statusType
*/
public abstract int getStatusType();
@@ -62,8 +62,7 @@ public interface IBindingContext {
* @param targetObservableValue
* @param modelObservableValue
* @return
- * @see org.eclipse.core.databinding.DataBindingContext#bindValue(org.eclipse.core.databinding.observable.value.IObservableValue,
- * org.eclipse.core.databinding.observable.value.IObservableValue)
+ * @see org.eclipse.core.databinding.DataBindingContext#bindValue(org.eclipse.core.databinding.observable.value.IObservableValue, org.eclipse.core.databinding.observable.value.IObservableValue)
*/
public abstract Binding bindValue(IObservableValue targetObservableValue, IObservableValue modelObservableValue);
@@ -80,8 +79,7 @@ public interface IBindingContext {
* @param targetToModel
* @param modelToTarget
* @return
- * @see org.eclipse.core.databinding.DataBindingContext#bindValue(org.eclipse.core.databinding.observable.value.IObservableValue,
- * org.eclipse.core.databinding.observable.value.IObservableValue, org.eclipse.core.databinding.UpdateValueStrategy,
+ * @see org.eclipse.core.databinding.DataBindingContext#bindValue(org.eclipse.core.databinding.observable.value.IObservableValue, org.eclipse.core.databinding.observable.value.IObservableValue, org.eclipse.core.databinding.UpdateValueStrategy,
* org.eclipse.core.databinding.UpdateValueStrategy)
*/
public abstract Binding bindValue(IObservableValue targetObservableValue, IObservableValue modelObservableValue, UpdateValueStrategy targetToModel, UpdateValueStrategy modelToTarget);
@@ -90,8 +88,7 @@ public interface IBindingContext {
* @param targetObservableList
* @param modelObservableList
* @return
- * @see org.eclipse.core.databinding.DataBindingContext#bindList(org.eclipse.core.databinding.observable.list.IObservableList,
- * org.eclipse.core.databinding.observable.list.IObservableList)
+ * @see org.eclipse.core.databinding.DataBindingContext#bindList(org.eclipse.core.databinding.observable.list.IObservableList, org.eclipse.core.databinding.observable.list.IObservableList)
*/
public abstract Binding bindList(IObservableList targetObservableList, IObservableList modelObservableList);
@@ -101,8 +98,7 @@ public interface IBindingContext {
* @param targetToModel
* @param modelToTarget
* @return
- * @see org.eclipse.core.databinding.DataBindingContext#bindList(org.eclipse.core.databinding.observable.list.IObservableList,
- * org.eclipse.core.databinding.observable.list.IObservableList, org.eclipse.core.databinding.UpdateListStrategy,
+ * @see org.eclipse.core.databinding.DataBindingContext#bindList(org.eclipse.core.databinding.observable.list.IObservableList, org.eclipse.core.databinding.observable.list.IObservableList, org.eclipse.core.databinding.UpdateListStrategy,
* org.eclipse.core.databinding.UpdateListStrategy)
*/
public abstract Binding bindList(IObservableList targetObservableList, IObservableList modelObservableList, UpdateListStrategy targetToModel, UpdateListStrategy modelToTarget);
@@ -111,8 +107,7 @@ public interface IBindingContext {
* @param targetObservableSet
* @param modelObservableSet
* @return
- * @see org.eclipse.core.databinding.DataBindingContext#bindSet(org.eclipse.core.databinding.observable.set.IObservableSet,
- * org.eclipse.core.databinding.observable.set.IObservableSet)
+ * @see org.eclipse.core.databinding.DataBindingContext#bindSet(org.eclipse.core.databinding.observable.set.IObservableSet, org.eclipse.core.databinding.observable.set.IObservableSet)
*/
public abstract Binding bindSet(IObservableSet targetObservableSet, IObservableSet modelObservableSet);
@@ -122,14 +117,13 @@ public interface IBindingContext {
* @param targetToModel
* @param modelToTarget
* @return
- * @see org.eclipse.core.databinding.DataBindingContext#bindSet(org.eclipse.core.databinding.observable.set.IObservableSet,
- * org.eclipse.core.databinding.observable.set.IObservableSet, org.eclipse.core.databinding.UpdateSetStrategy,
+ * @see org.eclipse.core.databinding.DataBindingContext#bindSet(org.eclipse.core.databinding.observable.set.IObservableSet, org.eclipse.core.databinding.observable.set.IObservableSet, org.eclipse.core.databinding.UpdateSetStrategy,
* org.eclipse.core.databinding.UpdateSetStrategy)
*/
public abstract Binding bindSet(IObservableSet targetObservableSet, IObservableSet modelObservableSet, UpdateSetStrategy targetToModel, UpdateSetStrategy modelToTarget);
/**
- *
+ *
* @see org.eclipse.core.databinding.DataBindingContext#dispose()
*/
public abstract void dispose();
@@ -151,6 +145,7 @@ public interface IBindingContext {
* @deprecated
* @see org.eclipse.core.databinding.DataBindingContext#getValidationStatusMap()
*/
+ @Deprecated
public abstract IObservableMap getValidationStatusMap();
/**
@@ -166,13 +161,13 @@ public interface IBindingContext {
public abstract void addValidationStatusProvider(ValidationStatusProvider validationStatusProvider);
/**
- *
+ *
* @see org.eclipse.core.databinding.DataBindingContext#updateModels()
*/
public abstract void updateModels();
/**
- *
+ *
* @see org.eclipse.core.databinding.DataBindingContext#updateTargets()
*/
public abstract void updateTargets();
@@ -199,13 +194,13 @@ public interface IBindingContext {
/**
* @param realm
- * the realm to set
+ * the realm to set
*/
public abstract void setRealm(Realm realm);
/**
* @param statusType
- * the statusType to set
+ * the statusType to set
*/
public abstract void setStatusType(int statusType);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/JFaceXWTDataBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/JFaceXWTDataBinding.java
index 3e693e1b932..6784003a53f 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/JFaceXWTDataBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/JFaceXWTDataBinding.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -44,7 +44,7 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Text;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class JFaceXWTDataBinding {
@@ -55,22 +55,22 @@ public class JFaceXWTDataBinding {
static final String TEXT = "text";
- public static final Class<?>[] CONTROL_ARGUMENT_TYPES = new Class[]{ Control.class };
+ public static final Class<?>[] CONTROL_ARGUMENT_TYPES = new Class[] { Control.class };
- public static final Class<?>[] VIEWER_ARGUMENT_TYPES = new Class[]{ Viewer.class };
+ public static final Class<?>[] VIEWER_ARGUMENT_TYPES = new Class[] { Viewer.class };
static String[] VIEWERS_PROPERTIES = null;
static {
Method[] methods = ViewerProperties.class.getDeclaredMethods();
VIEWERS_PROPERTIES = new String[methods.length];
- for(int i = 0; i < methods.length; i++) {
+ for (int i = 0; i < methods.length; i++) {
VIEWERS_PROPERTIES[i] = methods[i].getName();
}
}
public static boolean isViewerProperty(String propertyName) {
- for(String name : VIEWERS_PROPERTIES) {
- if(name.equals(propertyName)) {
+ for (String name : VIEWERS_PROPERTIES) {
+ if (name.equals(propertyName)) {
return true;
}
}
@@ -78,13 +78,13 @@ public class JFaceXWTDataBinding {
}
public static Class<?> getValueType(Class<?> type, String propertyName) {
- if(type == null || propertyName == null || propertyName.indexOf(".") != -1) {
+ if (type == null || propertyName == null || propertyName.indexOf(".") != -1) {
return null;
}
try {
IMetaclass metaclass = XWT.getMetaclass(type);
IProperty property = metaclass.findProperty(propertyName);
- if(property != null) {
+ if (property != null) {
return property.getType();
}
} catch (Exception e) {
@@ -94,24 +94,24 @@ public class JFaceXWTDataBinding {
}
public static Object getValue(Object target, String propertyName) {
- if(target == null || propertyName == null || propertyName.indexOf(".") != -1) {
+ if (target == null || propertyName == null || propertyName.indexOf(".") != -1) {
return target;
}
Class<?> type = target.getClass();
try {
BeanInfo beanInfo = java.beans.Introspector.getBeanInfo(type);
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for(PropertyDescriptor pd : propertyDescriptors) {
- if(propertyName.equalsIgnoreCase(pd.getName())) {
+ for (PropertyDescriptor pd : propertyDescriptors) {
+ if (propertyName.equalsIgnoreCase(pd.getName())) {
Method readMethod = pd.getReadMethod();
- if(readMethod != null) {
+ if (readMethod != null) {
return readMethod.invoke(target);
}
}
}
Field[] fields = type.getDeclaredFields();
- for(Field field : fields) {
- if(propertyName.equalsIgnoreCase(field.getName())) {
+ for (Field field : fields) {
+ if (propertyName.equalsIgnoreCase(field.getName())) {
Object object = field.get(target);
return object;
}
@@ -128,50 +128,50 @@ public class JFaceXWTDataBinding {
try {
BeanInfo beanInfo = java.beans.Introspector.getBeanInfo(type);
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for(PropertyDescriptor pd : propertyDescriptors) {
- if(propertyName.equals(pd.getName())) {
+ for (PropertyDescriptor pd : propertyDescriptors) {
+ if (propertyName.equals(pd.getName())) {
Method writeMethod = pd.getWriteMethod();
- if(writeMethod == null) {
+ if (writeMethod == null) {
return;
}
- if(!writeMethod.isAccessible()) {
+ if (!writeMethod.isAccessible()) {
writeMethod.setAccessible(true);
}
Class<?>[] parameterTypes = writeMethod.getParameterTypes();
Class targetType = parameterTypes[0];
- if(targetType != value.getClass()) {
- if(targetType.isEnum() && value instanceof String) {
+ if (targetType != value.getClass()) {
+ if (targetType.isEnum() && value instanceof String) {
try {
- writeMethod.invoke(target, new Object[]{ Enum.valueOf(targetType, (String)value) });
+ writeMethod.invoke(target, new Object[] { Enum.valueOf(targetType, (String) value) });
return;
} catch (Exception e) {
}
}
IConverter c = XWT.findConvertor(value.getClass(), targetType);
- if(c != null) {
+ if (c != null) {
value = c.convert(value);
}
}
- writeMethod.invoke(target, new Object[]{ value });
+ writeMethod.invoke(target, new Object[] { value });
return;
}
}
Field[] fields = type.getDeclaredFields();
- for(Field field : fields) {
- if(propertyName.equals(field.getName())) {
- if(!field.isAccessible()) {
+ for (Field field : fields) {
+ if (propertyName.equals(field.getName())) {
+ if (!field.isAccessible()) {
field.setAccessible(true);
}
Class fieldType = field.getType();
- if(fieldType.isEnum() && value instanceof String) {
+ if (fieldType.isEnum() && value instanceof String) {
try {
- field.set(target, Enum.valueOf(fieldType, (String)value));
+ field.set(target, Enum.valueOf(fieldType, (String) value));
return;
} catch (Exception e) {
}
}
IConverter c = XWT.findConvertor(value.getClass(), fieldType);
- if(c != null) {
+ if (c != null) {
value = c.convert(value);
}
field.set(target, value);
@@ -181,7 +181,7 @@ public class JFaceXWTDataBinding {
IMetaclass metaclass = XWT.getMetaclass(type);
IProperty property = metaclass.findProperty(propertyName);
- if(property != null) {
+ if (property != null) {
property.setValue(target, value);
}
} catch (Exception e) {
@@ -190,13 +190,13 @@ public class JFaceXWTDataBinding {
}
public static boolean isPropertyReadOnly(Class<?> type, String propertyName) {
- if(type == null || propertyName == null || propertyName.indexOf(".") != -1) {
+ if (type == null || propertyName == null || propertyName.indexOf(".") != -1) {
return true;
}
try {
IMetaclass metaclass = XWT.getMetaclass(type);
IProperty property = metaclass.findProperty(propertyName);
- if(property != null) {
+ if (property != null) {
return property.isReadOnly();
}
} catch (Exception e) {
@@ -211,9 +211,9 @@ public class JFaceXWTDataBinding {
Method method = null;
try {
try {
- method = type.getMethod("addPropertyChangeListener", new Class[]{ String.class, PropertyChangeListener.class });
+ method = type.getMethod("addPropertyChangeListener", new Class[] { String.class, PropertyChangeListener.class });
} catch (NoSuchMethodException e) {
- method = type.getMethod("addPropertyChangeListener", new Class[]{ PropertyChangeListener.class });
+ method = type.getMethod("addPropertyChangeListener", new Class[] { PropertyChangeListener.class });
}
} catch (SecurityException e) {
} catch (NoSuchMethodException e) {
@@ -223,55 +223,55 @@ public class JFaceXWTDataBinding {
public static Class<?> toType(Object target) {
Class<?> type = null;
- if(target instanceof IObservableValue) {
- IObservableValue value = (IObservableValue)target;
+ if (target instanceof IObservableValue) {
+ IObservableValue value = (IObservableValue) target;
Object valueType = value.getValueType();
- if(valueType instanceof Class<?>) {
- type = (Class<?>)valueType;
+ if (valueType instanceof Class<?>) {
+ type = (Class<?>) valueType;
}
- } else if(target instanceof Class<?>) {
- type = (Class<?>)target;
+ } else if (target instanceof Class<?>) {
+ type = (Class<?>) target;
} else {
type = target.getClass();
}
- if(type == null) {
+ if (type == null) {
return Object.class;
}
return type;
}
public static boolean isValueProperty(Class<?> object, String propertyName) {
- if(propertyName == null) {
+ if (propertyName == null) {
return false;
}
- if(Viewer.class.isAssignableFrom(object)) {
+ if (Viewer.class.isAssignableFrom(object)) {
return isViewerValueProperty(object, propertyName);
- } else if(MenuItem.class.isAssignableFrom(object)) {
+ } else if (MenuItem.class.isAssignableFrom(object)) {
//
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=280157
// testcase:
// org.eclipse.papyrus.xwt.tests.databinding.bindcontrol.BindMenuItem
//
- if(ENABLED.equalsIgnoreCase(propertyName)) {
+ if (ENABLED.equalsIgnoreCase(propertyName)) {
return true;
- } else if(SELECTION.equalsIgnoreCase(propertyName)) {
+ } else if (SELECTION.equalsIgnoreCase(propertyName)) {
return true;
}
}
boolean isProperty = isControlValueProperty(object, propertyName);
- if(isProperty) {
+ if (isProperty) {
return true;
}
return false;
}
public static IObservable observeWidget(Object object, String propertyName, UpdateSourceTrigger updateSourceTrigger, int observedKind) {
- if(propertyName == null) {
+ if (propertyName == null) {
return null;
}
try {
- switch(observedKind) {
+ switch (observedKind) {
case ScopeManager.AUTO:
return observePropertyValue(object, propertyName, updateSourceTrigger);
case ScopeManager.COLLECTION:
@@ -289,43 +289,43 @@ public class JFaceXWTDataBinding {
}
protected static IObservable observePropertyValue(Object object, String propertyName, UpdateSourceTrigger updateSourceTrigger) {
- if(object instanceof Viewer) {
- if("input".equals(propertyName)) {
- Viewer viewer = (Viewer)object;
- SimpleValueProperty property = (SimpleValueProperty)ViewerProperties.input();
+ if (object instanceof Viewer) {
+ if ("input".equals(propertyName)) {
+ Viewer viewer = (Viewer) object;
+ SimpleValueProperty property = (SimpleValueProperty) ViewerProperties.input();
IObservableValue observableValue = new SimplePropertyObservableValue(XWT.getRealm(), viewer, property);
return new TypedViewerObservableValueDecorator(observableValue, viewer);
- } else if("singleSelection".equals(propertyName)) {
- Viewer viewer = (Viewer)object;
- SimpleValueProperty property = (SimpleValueProperty)ViewerProperties.singleSelection();
+ } else if ("singleSelection".equals(propertyName)) {
+ Viewer viewer = (Viewer) object;
+ SimpleValueProperty property = (SimpleValueProperty) ViewerProperties.singleSelection();
IObservableValue observableValue = new SimplePropertyObservableValue(XWT.getRealm(), viewer, property);
return new TypedViewerObservableValueDecorator(observableValue, viewer);
}
- return observePropertyValue((Viewer)object, propertyName, updateSourceTrigger);
- } else if(object instanceof MenuItem) {
+ return observePropertyValue((Viewer) object, propertyName, updateSourceTrigger);
+ } else if (object instanceof MenuItem) {
//
// TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=280157
// testcase:
// org.eclipse.papyrus.xwt.tests.databinding.bindcontrol.BindMenuItem
//
- if(ENABLED.equalsIgnoreCase(propertyName)) {
- return new MenuItemEnabledObservableValue((MenuItem)object);
- } else if(SELECTION.equalsIgnoreCase(propertyName)) {
- return new MenuItemSelectionObservableValue((MenuItem)object);
+ if (ENABLED.equalsIgnoreCase(propertyName)) {
+ return new MenuItemEnabledObservableValue((MenuItem) object);
+ } else if (SELECTION.equalsIgnoreCase(propertyName)) {
+ return new MenuItemSelectionObservableValue((MenuItem) object);
}
- } else if(object instanceof Control) {
- return observePropertyValue((Control)object, propertyName, updateSourceTrigger);
+ } else if (object instanceof Control) {
+ return observePropertyValue((Control) object, propertyName, updateSourceTrigger);
}
return null;
}
protected static boolean isControlValueProperty(Class<?> type, String propertyName) {
- if(TEXT.equalsIgnoreCase(propertyName)) {
- if(Text.class.isAssignableFrom(type)) {
+ if (TEXT.equalsIgnoreCase(propertyName)) {
+ if (Text.class.isAssignableFrom(type)) {
return true;
}
// widget button is not supported at 3.4 version.
- if(SWT.getVersion() == 3449 && Button.class.isAssignableFrom(type)) {
+ if (SWT.getVersion() == 3449 && Button.class.isAssignableFrom(type)) {
return false;
}
}
@@ -333,12 +333,12 @@ public class JFaceXWTDataBinding {
Method method;
try {
method = SWTObservables.class.getMethod(getterName, CONTROL_ARGUMENT_TYPES);
- if(method == null) {
- for(Method element : SWTObservables.class.getMethods()) {
- if(element.getParameterTypes().length != 0) {
+ if (method == null) {
+ for (Method element : SWTObservables.class.getMethods()) {
+ if (element.getParameterTypes().length != 0) {
continue;
}
- if(element.getName().equalsIgnoreCase(getterName)) {
+ if (element.getName().equalsIgnoreCase(getterName)) {
return true;
}
}
@@ -348,17 +348,17 @@ public class JFaceXWTDataBinding {
}
IMetaclass mateclass = XWT.getMetaclass(type);
IProperty property = mateclass.findProperty(propertyName);
- if(property instanceof EventProperty) {
+ if (property instanceof EventProperty) {
return true;
}
return false;
}
protected static IObservableValue observePropertyValue(Control control, String propertyName, UpdateSourceTrigger updateSourceTrigger) {
- if(TEXT.equalsIgnoreCase(propertyName)) {
- if(control instanceof Text || control instanceof StyledText) {
+ if (TEXT.equalsIgnoreCase(propertyName)) {
+ if (control instanceof Text || control instanceof StyledText) {
int event = SWT.None;
- switch(updateSourceTrigger) {
+ switch (updateSourceTrigger) {
case Default:
event = SWT.FocusOut;
break;
@@ -372,44 +372,44 @@ public class JFaceXWTDataBinding {
throw new IllegalStateException("UpdateSourceTrigger of value " + updateSourceTrigger.name());
}
IObservableValue observableValue = SWTObservables.observeText(control, event);
- if(observableValue != null) {
+ if (observableValue != null) {
return observableValue;
}
}
// widget button is not supported at 3.4 version.
- if(SWT.getVersion() == 3449 && control instanceof Button) {
+ if (SWT.getVersion() == 3449 && control instanceof Button) {
return null;
}
try {
IObservableValue observableValue = SWTObservables.observeText(control);
- if(observableValue != null) {
+ if (observableValue != null) {
return observableValue;
}
} catch (IllegalArgumentException e) {
throw new XWTException(e);
}
} else {
- if(propertyName == null) {
+ if (propertyName == null) {
return null;
}
String getterName = "observe" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
Method method;
try {
method = SWTObservables.class.getMethod(getterName, CONTROL_ARGUMENT_TYPES);
- if(method == null) {
- for(Method element : SWTObservables.class.getMethods()) {
- if(element.getParameterTypes().length != 0) {
+ if (method == null) {
+ for (Method element : SWTObservables.class.getMethods()) {
+ if (element.getParameterTypes().length != 0) {
continue;
}
- if(element.getName().equalsIgnoreCase(getterName)) {
+ if (element.getName().equalsIgnoreCase(getterName)) {
method = element;
break;
}
}
}
- if(method != null) {
- IObservableValue observableValue = (IObservableValue)method.invoke(null, control);
- if(observableValue != null) {
+ if (method != null) {
+ IObservableValue observableValue = (IObservableValue) method.invoke(null, control);
+ if (observableValue != null) {
return observableValue;
}
}
@@ -419,8 +419,8 @@ public class JFaceXWTDataBinding {
}
IMetaclass mateclass = XWT.getMetaclass(control);
IProperty property = mateclass.findProperty(propertyName);
- if(property instanceof EventProperty) {
- return new EventPropertyObservableValue(control, (EventProperty)property);
+ if (property instanceof EventProperty) {
+ return new EventPropertyObservableValue(control, (EventProperty) property);
}
return null;
}
@@ -429,12 +429,12 @@ public class JFaceXWTDataBinding {
String getterName = "observe" + property.substring(0, 1).toUpperCase() + property.substring(1);
try {
Method method = ViewersObservables.class.getMethod(getterName, VIEWER_ARGUMENT_TYPES);
- if(method == null) {
- for(Method element : ViewersObservables.class.getMethods()) {
- if(element.getParameterTypes().length != 0) {
+ if (method == null) {
+ for (Method element : ViewersObservables.class.getMethods()) {
+ if (element.getParameterTypes().length != 0) {
continue;
}
- if(element.getName().equalsIgnoreCase(getterName)) {
+ if (element.getName().equalsIgnoreCase(getterName)) {
return true;
}
}
@@ -450,20 +450,20 @@ public class JFaceXWTDataBinding {
Method method;
try {
method = ViewersObservables.class.getMethod(getterName, VIEWER_ARGUMENT_TYPES);
- if(method == null) {
- for(Method element : ViewersObservables.class.getMethods()) {
- if(element.getParameterTypes().length != 0) {
+ if (method == null) {
+ for (Method element : ViewersObservables.class.getMethods()) {
+ if (element.getParameterTypes().length != 0) {
continue;
}
- if(element.getName().equalsIgnoreCase(getterName)) {
+ if (element.getName().equalsIgnoreCase(getterName)) {
method = element;
break;
}
}
}
- if(method != null) {
- IObservable observableValue = (IObservable)method.invoke(null, viewer);
- if(observableValue != null) {
+ if (method != null) {
+ IObservable observableValue = (IObservable) method.invoke(null, viewer);
+ if (observableValue != null) {
return observableValue;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ListToArrayObservableValue.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ListToArrayObservableValue.java
index c8fc9d322b3..c5c45f8b33d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ListToArrayObservableValue.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/ListToArrayObservableValue.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -24,7 +24,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
/**
* Manage the Array to List and then update from List to Array
- *
+ *
* @author yyang
*/
public class ListToArrayObservableValue extends AbstractObservableValue {
@@ -57,10 +57,12 @@ public class ListToArrayObservableValue extends AbstractObservableValue {
});
}
+ @Override
protected Object doGetValue() {
return source;
}
+ @Override
protected void doSetValue(Object value) {
super.doSetValue(value);
}
@@ -80,9 +82,9 @@ public class ListToArrayObservableValue extends AbstractObservableValue {
protected void handleChange() {
try {
- Object elements = Array.newInstance((Class<?>)getValueType(), source.size());
- Object[] objects = source.toArray((Object[])elements);
- if(cacheData == null) {
+ Object elements = Array.newInstance((Class<?>) getValueType(), source.size());
+ Object[] objects = source.toArray((Object[]) elements);
+ if (cacheData == null) {
cacheData = target.getValue();
}
target.setValue(objects);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/TypedViewerObservableValueDecorator.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/TypedViewerObservableValueDecorator.java
index 86855d66a73..dfe6df7bed0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/TypedViewerObservableValueDecorator.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/TypedViewerObservableValueDecorator.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -32,15 +32,15 @@ public class TypedViewerObservableValueDecorator extends ViewerObservableValueDe
@Override
public boolean equals(Object obj) {
- if(!(obj instanceof TypedViewerObservableValueDecorator)) {
+ if (!(obj instanceof TypedViewerObservableValueDecorator)) {
return false;
}
- TypedViewerObservableValueDecorator decorator = (TypedViewerObservableValueDecorator)obj;
- if(elementType != null) {
- if(!elementType.equals(decorator.elementType)) {
+ TypedViewerObservableValueDecorator decorator = (TypedViewerObservableValueDecorator) obj;
+ if (elementType != null) {
+ if (!elementType.equals(decorator.elementType)) {
return false;
}
- } else if(decorator.elementType != null) {
+ } else if (decorator.elementType != null) {
return false;
}
return super.equals(obj);
@@ -48,7 +48,7 @@ public class TypedViewerObservableValueDecorator extends ViewerObservableValueDe
@Override
public int hashCode() {
- if(elementType == null) {
+ if (elementType == null) {
return super.hashCode();
}
return elementType.hashCode() * super.hashCode();
@@ -57,7 +57,7 @@ public class TypedViewerObservableValueDecorator extends ViewerObservableValueDe
@Override
public Object getValueType() {
Object elementType = getElementType();
- if(elementType != null) {
+ if (elementType != null) {
return elementType;
}
return super.getValueType();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/XWTObservableValue.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/XWTObservableValue.java
index 5da1f172c7a..4289370fcfe 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/XWTObservableValue.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/databinding/XWTObservableValue.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.xwt.XWT;
/**
* Notes: Binding type is java.lang.String.
- *
+ *
* @author jliu (jin.liu@soyatec.com)
*/
public abstract class XWTObservableValue extends AbstractObservableValue implements IObserving {
@@ -38,7 +38,7 @@ public abstract class XWTObservableValue extends AbstractObservableValue impleme
private boolean updating = false;
/**
- *
+ *
*/
public XWTObservableValue(Class<?> valueType, Object observed, String path) {
super(XWT.getRealm());
@@ -52,11 +52,11 @@ public abstract class XWTObservableValue extends AbstractObservableValue impleme
* Add listener to observed.
*/
private void init() {
- if(eventListener == null) {
+ if (eventListener == null) {
eventListener = new EventListener() {
public void handleEvent(Event evt) {
- if(!updating) {
+ if (!updating) {
final ValueDiff diff = Diffs.createValueDiff(evt.getOldValue(), evt.getNewValue());
getRealm().exec(new Runnable() {
@@ -84,11 +84,12 @@ public abstract class XWTObservableValue extends AbstractObservableValue impleme
*
* @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
*/
+ @Override
protected void doSetValue(Object value) {
updating = true;
Object oldValue = doGetValue();
value = convert(oldValue == null ? null : oldValue.getClass(), value);
- if(!Util.equals(oldValue, value)) {
+ if (!Util.equals(oldValue, value)) {
doSetApprovedValue(value);
fireValueChange(Diffs.createValueDiff(oldValue, value));
eventManager.dispatchEvent(new Event(observed, oldValue, value, getPath()));
@@ -101,12 +102,12 @@ public abstract class XWTObservableValue extends AbstractObservableValue impleme
* @return
*/
protected Object convert(Class type, Object value) {
- if(value != null) {
- if(type != null && type.isEnum() && value instanceof String) {
- return Enum.valueOf(type, (String)value);
+ if (value != null) {
+ if (type != null && type.isEnum() && value instanceof String) {
+ return Enum.valueOf(type, (String) value);
}
- IConverter c = XWT.findConvertor(value.getClass(), (Class<?>)getValueType());
- if(c != null) {
+ IConverter c = XWT.findConvertor(value.getClass(), getValueType());
+ if (c != null) {
return c.convert(value);
}
}
@@ -123,6 +124,7 @@ public abstract class XWTObservableValue extends AbstractObservableValue impleme
*
* @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
*/
+ @Override
protected Object doGetValue() {
return observed;
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/AbstractDataProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/AbstractDataProvider.java
index e325a673093..f5d013b2d47 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/AbstractDataProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/AbstractDataProvider.java
@@ -52,7 +52,7 @@ public abstract class AbstractDataProvider implements IDataProvider {
public IObservable observe(Object data, String path, Object elementType, int observeKind) {
Object type = null;
- if(elementType == null) {
+ if (elementType == null) {
type = getModelService().toModelType(data);
} else {
type = elementType;
@@ -60,62 +60,62 @@ public abstract class AbstractDataProvider implements IDataProvider {
Object propertyType = getModelService().toModelPropertyType(type, path);
Class<?> propertyTypeClass = null;
- if(propertyType instanceof Class<?>) {
- propertyTypeClass = (Class<?>)propertyType;
- if(IBinding.class.isAssignableFrom(propertyTypeClass)) {
+ if (propertyType instanceof Class<?>) {
+ propertyTypeClass = (Class<?>) propertyType;
+ if (IBinding.class.isAssignableFrom(propertyTypeClass)) {
return null;
}
}
- switch(observeKind) {
+ switch (observeKind) {
case ScopeManager.AUTO:
- if(propertyTypeClass != null && (propertyTypeClass.isArray() || List.class.isAssignableFrom(propertyTypeClass))) {
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ if (propertyTypeClass != null && (propertyTypeClass.isArray() || List.class.isAssignableFrom(propertyTypeClass))) {
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailList(observable, type, path, propertyType);
}
return observeList(data, path);
- } else if(propertyTypeClass != null && (Set.class.isAssignableFrom(propertyTypeClass))) {
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ } else if (propertyTypeClass != null && (Set.class.isAssignableFrom(propertyTypeClass))) {
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailSet(observable, type, path, propertyType);
}
return observeSet(data, path);
} else {
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailValue(observable, type, path, propertyType);
}
return observeValue(data, path);
}
case ScopeManager.VALUE:
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailValue(observable, type, path, propertyType);
}
return observeValue(data, path);
case ScopeManager.COLLECTION:
- if(propertyTypeClass != null && Set.class.isAssignableFrom(propertyTypeClass)) {
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ if (propertyTypeClass != null && Set.class.isAssignableFrom(propertyTypeClass)) {
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailSet(observable, type, path, propertyType);
}
return observeSet(data, path);
}
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailList(observable, type, path, propertyType);
}
return observeList(data, path);
case ScopeManager.SET:
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailSet(observable, type, path, propertyType);
}
return observeSet(data, path);
case ScopeManager.LIST:
- if(data instanceof IObservableValue) {
- IObservableValue observable = (IObservableValue)data;
+ if (data instanceof IObservableValue) {
+ IObservableValue observable = (IObservableValue) data;
return observeDetailList(observable, type, path, propertyType);
}
return observeList(data, path);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/IObjectDataProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/IObjectDataProvider.java
index 668af6c9ed0..6eead72aa82 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/IObjectDataProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/IObjectDataProvider.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.dataproviders;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/ObjectDataProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/ObjectDataProvider.java
index 04e4db8ee5d..b945f10a8ab 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/ObjectDataProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/dataproviders/ObjectDataProvider.java
@@ -49,7 +49,7 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
IMetaclass metaclass = XWT.getMetaclass(type);
IProperty property = metaclass.findProperty(propertyName);
- if(property == null) {
+ if (property == null) {
throw new XWTException(" Property \"" + propertyName + "\" is not found in the class " + metaclass.getType().getName());
}
return property.getType();
@@ -91,7 +91,7 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
* org.eclipse.papyrus.xwt.dataproviders.IObjectDataProvider#getObjectInstance()
*/
public Object getObjectInstance() {
- if(objectInstance == null && objectType != null) {
+ if (objectInstance == null && objectType != null) {
try {
objectInstance = objectType.newInstance();
} catch (Exception e) {
@@ -107,7 +107,7 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
* @see org.eclipse.papyrus.xwt.dataproviders.IObjectDataProvider#getObjectType()
*/
public Class<?> getObjectType() {
- if(objectType == null && objectInstance != null) {
+ if (objectType == null && objectInstance != null) {
objectType = objectInstance.getClass();
}
return objectType;
@@ -159,20 +159,20 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
protected Object getTarget() {
Object target = getObjectInstance();
- if(target == null) {
+ if (target == null) {
return null;
}
Class<?> targetType = getObjectType();
Method method = null;
- if(methodName != null) {
+ if (methodName != null) {
List<Class<?>> paras = new ArrayList<Class<?>>();
- if(methodParameters != null) {
- for(Object p : methodParameters) {
+ if (methodParameters != null) {
+ for (Object p : methodParameters) {
paras.add(p.getClass());
}
}
try {
- if(paras.isEmpty()) {
+ if (paras.isEmpty()) {
method = targetType.getDeclaredMethod(methodName);
return method.invoke(target);
} else {
@@ -196,7 +196,7 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
* org.eclipse.papyrus.xwt.dataproviders.IDataProvider#getData(java.lang.String)
*/
public Object getData(String path) {
- if(path == null) {
+ if (path == null) {
return getTarget();
}
return getData(getTarget(), path);
@@ -209,14 +209,14 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
* org.eclipse.papyrus.xwt.dataproviders.IDataProvider#getData(java.lang.String)
*/
public Object getData(Object object, String path) {
- if(object instanceof IObservableValue) {
- object = ((IObservableValue)object).getValue();
+ if (object instanceof IObservableValue) {
+ object = ((IObservableValue) object).getValue();
}
- if(path == null || path.trim().length() == 0 || path.equals(".")) {
+ if (path == null || path.trim().length() == 0 || path.equals(".")) {
return JFaceXWTDataBinding.getValue(object, null);
}
int index = path.indexOf(".");
- while(index != -1 && object != null) {
+ while (index != -1 && object != null) {
object = JFaceXWTDataBinding.getValue(object, path.substring(0, index));
path = path.substring(index + 1);
index = path.indexOf(".");
@@ -225,11 +225,11 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
}
public void setData(Object object, String path, Object value) {
- if(object instanceof IObservableValue) {
- object = ((IObservableValue)object).getValue();
+ if (object instanceof IObservableValue) {
+ object = ((IObservableValue) object).getValue();
}
int index = path.indexOf(".");
- while(index != -1 && object != null) {
+ while (index != -1 && object != null) {
object = JFaceXWTDataBinding.getValue(object, path.substring(0, index));
path = path.substring(index + 1);
index = path.indexOf(".");
@@ -250,11 +250,11 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
*/
public Class<?> getDataType(String path) {
Object target = getTarget();
- if(target == null) {
+ if (target == null) {
return null;
}
Class<?> type = JFaceXWTDataBinding.toType(target);
- if(path == null) {
+ if (path == null) {
return type;
}
return JFaceXWTDataBinding.getValueType(type, path);
@@ -262,21 +262,22 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
/**
* check if the property is read only
- *
+ *
* @param path
* @return
*/
+ @Override
public boolean isPropertyReadOnly(String path) {
Object target = getTarget();
- if(target == null || path == null) {
+ if (target == null || path == null) {
return true;
}
- if(target instanceof IBinding) {
- target = ((IBinding)target).getValue(null);
+ if (target instanceof IBinding) {
+ target = ((IBinding) target).getValue(null);
}
Class<?> type = JFaceXWTDataBinding.toType(target);
int index = path.indexOf(".");
- while(index != -1 && target != null) {
+ while (index != -1 && target != null) {
type = JFaceXWTDataBinding.getValueType(type, path.substring(0, index));
path = path.substring(index + 1);
index = path.indexOf(".");
@@ -286,54 +287,59 @@ public class ObjectDataProvider extends AbstractDataProvider implements IObjectD
@Override
protected IObservableValue observeValue(Object bean, String propertyName) {
- if(JFaceXWTDataBinding.isBeanSupport(bean)) {
+ if (JFaceXWTDataBinding.isBeanSupport(bean)) {
return BeansObservables.observeValue(XWT.getRealm(), bean, propertyName);
}
return PojoObservables.observeValue(XWT.getRealm(), bean, propertyName);
}
+ @Override
protected IObservableList observeList(Object bean, String propertyName) {
- if(JFaceXWTDataBinding.isBeanSupport(bean)) {
+ if (JFaceXWTDataBinding.isBeanSupport(bean)) {
return BeansObservables.observeList(XWT.getRealm(), bean, propertyName);
}
return PojoObservables.observeList(XWT.getRealm(), bean, propertyName);
}
+ @Override
protected IObservableSet observeSet(Object bean, String propertyName) {
- if(JFaceXWTDataBinding.isBeanSupport(bean)) {
+ if (JFaceXWTDataBinding.isBeanSupport(bean)) {
return BeansObservables.observeSet(XWT.getRealm(), bean, propertyName);
}
return PojoObservables.observeSet(XWT.getRealm(), bean, propertyName);
}
+ @Override
protected IObservableList observeDetailList(IObservableValue bean, Object elementType, String propertyName, Object propertyType) {
- if(JFaceXWTDataBinding.isBeanSupport(bean)) {
- return BeansObservables.observeDetailList(bean, propertyName, (Class<?>)propertyType);
+ if (JFaceXWTDataBinding.isBeanSupport(bean)) {
+ return BeansObservables.observeDetailList(bean, propertyName, (Class<?>) propertyType);
}
- return PojoObservables.observeDetailList(bean, propertyName, (Class<?>)propertyType);
+ return PojoObservables.observeDetailList(bean, propertyName, (Class<?>) propertyType);
}
+ @Override
protected IObservableSet observeDetailSet(IObservableValue bean, Object elementType, String propertyName, Object propertyType) {
- if(JFaceXWTDataBinding.isBeanSupport(bean)) {
- return BeansObservables.observeDetailSet(bean, propertyName, (Class<?>)propertyType);
+ if (JFaceXWTDataBinding.isBeanSupport(bean)) {
+ return BeansObservables.observeDetailSet(bean, propertyName, (Class<?>) propertyType);
}
- return PojoObservables.observeDetailSet(bean, propertyName, (Class<?>)propertyType);
+ return PojoObservables.observeDetailSet(bean, propertyName, (Class<?>) propertyType);
}
@Override
protected IObservableValue observeDetailValue(IObservableValue master, Object elementType, String propertyName, Object propertyType) {
- Class<?> beanClass = (Class<?>)elementType;
- if(beanClass == null && master.getValueType() instanceof Class<?>) {
- beanClass = (Class<?>)master.getValueType();
+ Class<?> beanClass = (Class<?>) elementType;
+ if (beanClass == null && master.getValueType() instanceof Class<?>) {
+ beanClass = (Class<?>) master.getValueType();
}
- if(JFaceXWTDataBinding.isBeanSupport(beanClass)) {
- return BeanProperties.value(beanClass, propertyName, (Class<?>)propertyType).observeDetail(master);
+ if (JFaceXWTDataBinding.isBeanSupport(beanClass)) {
+ return BeanProperties.value(beanClass, propertyName, (Class<?>) propertyType).observeDetail(master);
}
- return PojoProperties.value(beanClass, propertyName, (Class<?>)propertyType).observeDetail(master);
+ return PojoProperties.value(beanClass, propertyName, (Class<?>) propertyType).observeDetail(master);
}
+ @Override
public IValueProperty createValueProperty(Object type, String propertyName) {
- if(JFaceXWTDataBinding.isBeanSupport(type)) {
+ if (JFaceXWTDataBinding.isBeanSupport(type)) {
return BeanProperties.value(JFaceXWTDataBinding.toType(type), propertyName);
}
return PojoProperties.value(JFaceXWTDataBinding.toType(type), propertyName);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Color.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Color.java
index d111d2417a8..7d56cd89b06 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Color.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Color.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,7 +12,7 @@ package org.eclipse.papyrus.xwt.graphics;
/**
* Color consists of four elements: alpha, blue, green and red.
- *
+ *
* @author yyang
*/
public class Color {
@@ -67,7 +67,7 @@ public class Color {
}
public org.eclipse.swt.graphics.Color toSWTColor() {
- if(swtColor == null) {
+ if (swtColor == null) {
swtColor = new org.eclipse.swt.graphics.Color(null, red, green, blue);
}
return swtColor;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Point.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Point.java
index aa4f5bc311c..0d6f52524a7 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Point.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Point.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,12 +12,12 @@ package org.eclipse.papyrus.xwt.graphics;
/**
* Color consists of four elements: alpha, blue, green and red.
- *
+ *
* @author yyang
*/
public class Point {
- public static final Point[] EMPTY_ARRAY = new Point[]{};
+ public static final Point[] EMPTY_ARRAY = new Point[] {};
private double x;
@@ -49,10 +49,10 @@ public class Point {
@Override
public boolean equals(Object obj) {
- if(!(obj instanceof Point)) {
+ if (!(obj instanceof Point)) {
return false;
}
- Point point = (Point)obj;
+ Point point = (Point) obj;
return x == point.getX() && y == point.getY();
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Rect.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Rect.java
index 84c48a98984..f4d581e2fac 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Rect.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/graphics/Rect.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import org.eclipse.swt.graphics.Rectangle;
/**
* Color consists of four elements: alpha, blue, green and red.
- *
+ *
* @author yyang
*/
public class Rect {
@@ -78,10 +78,10 @@ public class Rect {
@Override
public boolean equals(Object obj) {
- if(!(obj instanceof Rect)) {
+ if (!(obj instanceof Rect)) {
return false;
}
- Rect rect = (Rect)obj;
+ Rect rect = (Rect) obj;
return x == rect.getX() && y == rect.getY() && width == rect.getWidth() && height == rect.getHeight();
}
@@ -93,11 +93,11 @@ public class Rect {
/**
* Returns <code>true</code> if the point specified by the arguments is
* inside the area specified by the receiver, and <code>false</code> otherwise.
- *
+ *
* @param x
- * the x coordinate of the point to test for containment
+ * the x coordinate of the point to test for containment
* @param y
- * the y coordinate of the point to test for containment
+ * the y coordinate of the point to test for containment
* @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise
*/
public boolean contains(double x, double y) {
@@ -107,15 +107,15 @@ public class Rect {
/**
* Returns <code>true</code> if the given point is inside the area specified
* by the receiver, and <code>false</code> otherwise.
- *
+ *
* @param pt
- * the point to test for containment
+ * the point to test for containment
* @return <code>true</code> if the rectangle contains the point and <code>false</code> otherwise
- *
+ *
* @exception IllegalArgumentException
- * <ul>
- * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
- * </ul>
+ * <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * </ul>
*/
public boolean contains(Point pt) {
return contains(pt.getX(), pt.getY());
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CanExecuteChangedListener.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CanExecuteChangedListener.java
index 036d5174ac1..e970c4eba81 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CanExecuteChangedListener.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CanExecuteChangedListener.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -13,7 +13,7 @@ package org.eclipse.papyrus.xwt.input;
import java.beans.PropertyChangeListener;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface CanExecuteChangedListener extends PropertyChangeListener {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CommandBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CommandBinding.java
index 43dd85e1dea..5d218ec853c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CommandBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/CommandBinding.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeSupport;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class CommandBinding {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ICommand.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ICommand.java
index ef7e905f582..f0d01c3c692 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ICommand.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ICommand.java
@@ -4,14 +4,14 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.input;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public interface ICommand {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/InputBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/InputBinding.java
index 98f5fa81592..8482f6c0b31 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/InputBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/InputBinding.java
@@ -4,14 +4,14 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.input;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class InputBinding {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyBinding.java
index 4a0cbf26ee4..59cb926695b 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyBinding.java
@@ -4,14 +4,14 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.input;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class KeyBinding extends InputBinding {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyGesture.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyGesture.java
index 3393500d72b..b8b3987c614 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyGesture.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/KeyGesture.java
@@ -4,14 +4,14 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.input;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class KeyGesture {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ModifierKeys.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ModifierKeys.java
index 7e221b9645c..77af985bac1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ModifierKeys.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/ModifierKeys.java
@@ -4,14 +4,14 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.input;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public enum ModifierKeys {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/MouseAction.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/MouseAction.java
index ab9695580a4..3aefbb34e58 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/MouseAction.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/MouseAction.java
@@ -4,14 +4,14 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.input;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public enum MouseAction {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/RoutedCommand.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/RoutedCommand.java
index 92d52665286..fa11122427d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/RoutedCommand.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/input/RoutedCommand.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeSupport;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class RoutedCommand implements ICommand {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Binding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Binding.java
index fcfd5b3c162..55ae3dc40a8 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Binding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Binding.java
@@ -28,7 +28,7 @@ import org.eclipse.swt.widgets.Widget;
/**
* Generic Binding definition
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class Binding extends DynamicBinding {
@@ -55,14 +55,14 @@ public class Binding extends DynamicBinding {
* <p>
* Default
* </p>
- *
+ *
*/
private UpdateSourceTrigger updateSourceTrigger = UpdateSourceTrigger.Default;
private BindingExpressionPath pathSegments;
public BindingExpressionPath getPathPropertySegments() {
- if(pathSegments == null) {
+ if (pathSegments == null) {
pathSegments = new BindingExpressionPath(getPath());
}
return pathSegments;
@@ -94,8 +94,8 @@ public class Binding extends DynamicBinding {
public void setSource(Object source) {
this.source = source;
- if(this.source instanceof IObservable) {
- this.observableSource = (IObservable)this.source;
+ if (this.source instanceof IObservable) {
+ this.observableSource = (IObservable) this.source;
}
}
@@ -112,45 +112,45 @@ public class Binding extends DynamicBinding {
}
protected Object getSourceObject() {
- if(source != null) {
+ if (source != null) {
return source;
- } else if(elementName != null) {
+ } else if (elementName != null) {
return XWT.findElementByName(getControl(), elementName);
}
return null;
}
protected boolean isSelfBinding(Object data) {
- if(data != this) {
+ if (data != this) {
return false;
}
- Binding binding = (Binding)data;
+ Binding binding = (Binding) data;
return BindingExpressionPath.isEmptyPath(binding.getPath());
}
public Object createBoundSource() {
Object control = getControl();
Object source = getSourceObject();
- if(source == null) {
+ if (source == null) {
source = XWT.getDataContext(control, IDynamicBinding.class);
Object localDataContext = UserData.getLocalDataContext(control);
- if(localDataContext == this) {
+ if (localDataContext == this) {
return source;
}
}
- if(source instanceof IDynamicBinding) {
- Object value = ((IDynamicBinding)source).createBoundSource();
- if(value != null && path != null) {
+ if (source instanceof IDynamicBinding) {
+ Object value = ((IDynamicBinding) source).createBoundSource();
+ if (value != null && path != null) {
Widget widget = UserData.getWidget(value);
- if(widget == null) {
+ if (widget == null) {
widget = UserData.getWidget(control);
}
return ScopeManager.observeValue(widget, value, getPathPropertySegments(), getUpdateSourceTrigger());
}
}
- if(source != null && !BindingExpressionPath.isEmptyPath(path)) {
+ if (source != null && !BindingExpressionPath.isEmptyPath(path)) {
Widget widget = UserData.getWidget(source);
- if(widget == null) {
+ if (widget == null) {
widget = UserData.getWidget(control);
}
return ScopeManager.observeValue(widget, source, getPathPropertySegments(), getUpdateSourceTrigger());
@@ -160,38 +160,38 @@ public class Binding extends DynamicBinding {
public boolean isSourceControl() {
Object source = getSourceObject();
- if(source == null) {
+ if (source == null) {
Object dataContextHost = getDataContextHost();
- if(dataContextHost != null) {
+ if (dataContextHost != null) {
source = UserData.getLocalDataContext(dataContextHost);
}
}
- if(source instanceof IDynamicBinding) {
- return ((IDynamicBinding)source).isSourceControl();
+ if (source instanceof IDynamicBinding) {
+ return ((IDynamicBinding) source).isSourceControl();
}
- if(source instanceof IBinding) {
- source = ((IBinding)source).getValue(null);
+ if (source instanceof IBinding) {
+ source = ((IBinding) source).getValue(null);
}
- if(path == null) {
+ if (path == null) {
return false;
}
int index = BindingExpressionPath.lastIndexOf(path);
- if(index == -1) {
+ if (index == -1) {
return (source instanceof Control || source instanceof Viewer);
}
- if(source instanceof IDataProvider) {
+ if (source instanceof IDataProvider) {
return false;
}
String parentPath = path.substring(0, index);
IObservable observable = ScopeManager.observeValue(getControl(), source, parentPath, getUpdateSourceTrigger());
- if(observable != null) {
- IObservableValue observableValue = (IObservableValue)observable;
+ if (observable != null) {
+ IObservableValue observableValue = (IObservableValue) observable;
Object type = observableValue.getValueType();
- if(type != null) {
+ if (type != null) {
return UserData.isUIElementType(type);
}
}
@@ -200,14 +200,14 @@ public class Binding extends DynamicBinding {
public Object getValue(Class<?> targetType) {
Object dataContext = getSourceObject();
- if(dataContext == null) {
+ if (dataContext == null) {
Object dataContextHost = getDataContextHost();
- if(dataContextHost != null) {
+ if (dataContextHost != null) {
dataContext = UserData.getLocalDataContext(dataContextHost);
- if(dataContext instanceof IDynamicBinding) {
- IDynamicBinding dynamicBinding = (IDynamicBinding)dataContext;
+ if (dataContext instanceof IDynamicBinding) {
+ IDynamicBinding dynamicBinding = (IDynamicBinding) dataContext;
Object boundSource = dynamicBinding.createBoundSource();
- if(boundSource != null) {
+ if (boundSource != null) {
dataContext = boundSource;
}
}
@@ -215,14 +215,14 @@ public class Binding extends DynamicBinding {
}
// direct binding
- if(dataContext instanceof IBinding) {
- dataContext = ((IBinding)dataContext).getValue(null);
+ if (dataContext instanceof IBinding) {
+ dataContext = ((IBinding) dataContext).getValue(null);
}
IDataProvider dataProvider = getDataProvider(dataContext);
try {
- if(isSourceControl()) {
+ if (isSourceControl()) {
ControlDataBinding controlDataBinding = new ControlDataBinding(dataContext, this, dataProvider);
return controlDataBinding.getValue(targetType);
}
@@ -231,10 +231,10 @@ public class Binding extends DynamicBinding {
}
DataBinding dataBinding = null;
- if(dataProvider != null && (path != null || dataContext instanceof IObservable)) {
+ if (dataProvider != null && (path != null || dataContext instanceof IObservable)) {
dataBinding = new DataBinding(this, dataProvider);
}
- if(dataBinding != null) {
+ if (dataBinding != null) {
return dataBinding.getValue(targetType);
}
return convertedValue(dataContext);
@@ -242,7 +242,7 @@ public class Binding extends DynamicBinding {
private Object convertedValue(Object value) {
IValueConverter converter = getConverter();
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
}
return value;
@@ -267,7 +267,7 @@ public class Binding extends DynamicBinding {
/**
* Returns the validationRules for the binding
- *
+ *
* @return the array of validationRules
*/
public IValidationRule[] getValidationRules() {
@@ -276,11 +276,11 @@ public class Binding extends DynamicBinding {
/**
* Sets a single validationRule
- *
+ *
* @param validator
*/
public IValidationRule getValidationRule() {
- if(this.validationRules != null && this.validationRules.length > 0) {
+ if (this.validationRules != null && this.validationRules.length > 0) {
return this.validationRules[0];
}
return null;
@@ -288,7 +288,7 @@ public class Binding extends DynamicBinding {
/**
* Set the validationRules for the binding
- *
+ *
* @param validators
*/
public void setValidationRules(IValidationRule[] validationRules) {
@@ -297,11 +297,11 @@ public class Binding extends DynamicBinding {
/**
* Sets a single validationRule
- *
+ *
* @param validator
*/
public void setValidationRule(IValidationRule validationRule) {
- this.validationRules = new IValidationRule[]{ validationRule };
+ this.validationRules = new IValidationRule[] { validationRule };
}
public void reset() {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingExpressionPath.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingExpressionPath.java
index 975ce2bd512..4accebe278a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingExpressionPath.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingExpressionPath.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -25,7 +25,7 @@ public class BindingExpressionPath {
protected String[] segments;
public BindingExpressionPath(String value) {
- if(value == null) {
+ if (value == null) {
return;
}
this.fullPath = value;
@@ -38,40 +38,37 @@ public class BindingExpressionPath {
int stripStart = 0;
int stripEnd = 0;
char[] array = value.toCharArray();
- for(int i = 0; i < array.length; i++) {
- switch(array[i]) {
- case '}':
- {
+ for (int i = 0; i < array.length; i++) {
+ switch (array[i]) {
+ case '}': {
Character character = separators.pop();
- if(character.charValue() != '{') {
+ if (character.charValue() != '{') {
throw new XWTException("Syntax error is binding expression " + value + " at " + i);
}
}
level--;
break;
- case ']':
- {
+ case ']': {
Character character = separators.pop();
- if(character.charValue() != '[') {
+ if (character.charValue() != '[') {
throw new XWTException("Syntax error is binding expression " + value + " at " + i);
}
}
level--;
break;
- case ')':
- {
+ case ')': {
Character character = separators.pop();
- if(character.charValue() != '(') {
+ if (character.charValue() != '(') {
throw new XWTException("Syntax error is binding expression " + value + " at " + i);
}
}
level--;
- if(level == 0) {
+ if (level == 0) {
stripEnd = i - 1;
}
break;
case '(':
- if(level == 0) {
+ if (level == 0) {
stripStart = i + 1;
}
separators.push(array[i]);
@@ -83,7 +80,7 @@ public class BindingExpressionPath {
level++;
break;
case '.':
- if(level == 0) {
+ if (level == 0) {
String element = value.substring(start, i);
element = ModelUtils.normalizePropertyName(element);
collector.add(element);
@@ -93,7 +90,7 @@ public class BindingExpressionPath {
break;
}
}
- if(level == 0) {
+ if (level == 0) {
String element = value.substring(start, array.length);
element = ModelUtils.normalizePropertyName(element);
collector.add(element);
@@ -105,16 +102,16 @@ public class BindingExpressionPath {
}
private void updateStripped(String value, int stripStart, int stripEnd, String element) {
- if(stripStart != 0) {
+ if (stripStart != 0) {
element = value.substring(stripStart, stripEnd + 1);
int index = element.lastIndexOf('.');
- if(index != -1) {
+ if (index != -1) {
element = element.substring(index + 1);
}
element = ModelUtils.normalizePropertyName(element);
}
- if(this.stripedPath == null) {
+ if (this.stripedPath == null) {
this.stripedPath = element;
} else {
this.stripedPath += "." + element;
@@ -145,30 +142,27 @@ public class BindingExpressionPath {
int level = 0;
Stack<Character> separators = new Stack<Character>();
char[] array = value.toCharArray();
- for(int i = array.length - 1; i >= 0; i--) {
- switch(array[i]) {
- case '{':
- {
+ for (int i = array.length - 1; i >= 0; i--) {
+ switch (array[i]) {
+ case '{': {
Character character = separators.pop();
- if(character.charValue() != '}') {
+ if (character.charValue() != '}') {
throw new XWTException("Syntax error is binding expression " + value + " at " + i);
}
}
level--;
break;
- case '[':
- {
+ case '[': {
Character character = separators.pop();
- if(character.charValue() != '}') {
+ if (character.charValue() != '}') {
throw new XWTException("Syntax error is binding expression " + value + " at " + i);
}
}
level--;
break;
- case '(':
- {
+ case '(': {
Character character = separators.pop();
- if(character.charValue() != ')') {
+ if (character.charValue() != ')') {
throw new XWTException("Syntax error is binding expression " + value + " at " + i);
}
}
@@ -181,13 +175,13 @@ public class BindingExpressionPath {
level++;
break;
case '.':
- if(level == 0) {
+ if (level == 0) {
return i;
}
break;
}
- if(array[i] == '.') {
+ if (array[i] == '.') {
}
}
return -1;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingGate.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingGate.java
index b5ff8b15466..57780bd495b 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingGate.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/BindingGate.java
@@ -56,15 +56,15 @@ public class BindingGate {
* org.eclipse.core.databinding.observable.value.IObservableValue)
*/
public Binding bind(IObservable source, IObservable target, IDataBindingInfo dataBinding) {
- if(source instanceof IObservableValue && target instanceof IObservableValue) {
- return bindValue((IObservableValue)source, (IObservableValue)target, dataBinding);
- } else if(source instanceof IObservableSet && target instanceof IObservableSet) {
+ if (source instanceof IObservableValue && target instanceof IObservableValue) {
+ return bindValue((IObservableValue) source, (IObservableValue) target, dataBinding);
+ } else if (source instanceof IObservableSet && target instanceof IObservableSet) {
IValueConverter converter = null;
int sourceToTargetPolicy = UpdateSetStrategy.POLICY_UPDATE;
int targetToSourcePolicy = UpdateSetStrategy.POLICY_UPDATE;
// Set policy to UpdateValueStrategy.
- if(dataBinding != null) {
- switch(dataBinding.getMode()) {
+ if (dataBinding != null) {
+ switch (dataBinding.getMode()) {
case OneWay:
targetToSourcePolicy = UpdateSetStrategy.POLICY_NEVER;
break;
@@ -79,14 +79,14 @@ public class BindingGate {
}
UpdateSetStrategy sourceToTarget = new UpdateSetStrategy(sourceToTargetPolicy);
UpdateSetStrategy targetToSource = new UpdateSetStrategy(targetToSourcePolicy);
- return bindSet((IObservableSet)target, (IObservableSet)source, targetToSource, sourceToTarget, converter);
- } else if(source instanceof IObservableList && target instanceof IObservableList) {
+ return bindSet((IObservableSet) target, (IObservableSet) source, targetToSource, sourceToTarget, converter);
+ } else if (source instanceof IObservableList && target instanceof IObservableList) {
IValueConverter converter = null;
int sourceToTargetPolicy = UpdateListStrategy.POLICY_UPDATE;
int targetToSourcePolicy = UpdateListStrategy.POLICY_UPDATE;
// Set policy to UpdateValueStrategy.
- if(dataBinding != null) {
- switch(dataBinding.getMode()) {
+ if (dataBinding != null) {
+ switch (dataBinding.getMode()) {
case OneWay:
targetToSourcePolicy = UpdateListStrategy.POLICY_NEVER;
break;
@@ -101,7 +101,7 @@ public class BindingGate {
}
UpdateListStrategy sourceToTarget = new UpdateListStrategy(sourceToTargetPolicy);
UpdateListStrategy targetToSource = new UpdateListStrategy(targetToSourcePolicy);
- return bindList((IObservableList)target, (IObservableList)source, targetToSource, sourceToTarget, converter);
+ return bindList((IObservableList) target, (IObservableList) source, targetToSource, sourceToTarget, converter);
}
throw new IllegalStateException();
@@ -116,7 +116,7 @@ public class BindingGate {
* org.eclipse.core.databinding.observable.value.IObservableValue)
*/
public Binding bindList(IObservableList source, IObservableList target, UpdateListStrategy sourceToTarget, UpdateListStrategy targetToSource, IValueConverter converter) {
- if(converter != null) {
+ if (converter != null) {
return bindList(source, target, sourceToTarget, targetToSource, converter, new InverseValueConverter(converter));
} else {
return bindList(source, target, sourceToTarget, targetToSource, null, null);
@@ -124,32 +124,32 @@ public class BindingGate {
}
/**
- *
+ *
* @param source
* @param target
* @param sourceToTarget
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param targetToSource
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param sourceToTargetConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
* @param targetToSourceConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
*/
public Binding bindList(IObservableList source, IObservableList target, UpdateListStrategy sourceToTarget, UpdateListStrategy targetToSource, IConverter sourceToTargetConvertor, IConverter targetToSourceConvertor) {
- if(source != null && target != null) {
- if(sourceToTarget == null) {
+ if (source != null && target != null) {
+ if (sourceToTarget == null) {
sourceToTarget = new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE);
}
- if(targetToSource == null) {
+ if (targetToSource == null) {
targetToSource = new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE);
}
- if(sourceToTargetConvertor != null) {
+ if (sourceToTargetConvertor != null) {
sourceToTarget.setConverter(sourceToTargetConvertor);
}
- if(targetToSourceConvertor != null) {
+ if (targetToSourceConvertor != null) {
targetToSource.setConverter(targetToSourceConvertor);
}
@@ -167,7 +167,7 @@ public class BindingGate {
* org.eclipse.core.databinding.observable.value.IObservableValue)
*/
public Binding bindSet(IObservableSet source, IObservableSet target, UpdateSetStrategy sourceToTarget, UpdateSetStrategy targetToSource, IValueConverter converter) {
- if(converter != null) {
+ if (converter != null) {
return bindSet(source, target, sourceToTarget, targetToSource, converter, new InverseValueConverter(converter));
} else {
return bindSet(source, target, sourceToTarget, targetToSource, null, null);
@@ -175,32 +175,32 @@ public class BindingGate {
}
/**
- *
+ *
* @param source
* @param target
* @param sourceToTarget
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param targetToSource
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param sourceToTargetConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
* @param targetToSourceConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
*/
public Binding bindSet(IObservableSet source, IObservableSet target, UpdateSetStrategy sourceToTarget, UpdateSetStrategy targetToSource, IConverter sourceToTargetConvertor, IConverter targetToSourceConvertor) {
- if(source != null && target != null) {
- if(sourceToTarget == null) {
+ if (source != null && target != null) {
+ if (sourceToTarget == null) {
sourceToTarget = new UpdateSetStrategy(UpdateSetStrategy.POLICY_UPDATE);
}
- if(targetToSource == null) {
+ if (targetToSource == null) {
targetToSource = new UpdateSetStrategy(UpdateSetStrategy.POLICY_UPDATE);
}
- if(sourceToTargetConvertor != null) {
+ if (sourceToTargetConvertor != null) {
sourceToTarget.setConverter(sourceToTargetConvertor);
}
- if(targetToSourceConvertor != null) {
+ if (targetToSourceConvertor != null) {
targetToSource.setConverter(targetToSourceConvertor);
}
@@ -210,32 +210,32 @@ public class BindingGate {
}
/**
- *
+ *
* @param source
* @param target
* @param sourceToTarget
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param targetToSource
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param sourceToTargetConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
* @param targetToSourceConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
*/
public Binding bind(IObservableList source, IObservableList target, UpdateListStrategy sourceToTarget, UpdateListStrategy targetToSource, IConverter sourceToTargetConvertor, IConverter targetToSourceConvertor) {
- if(source != null && target != null) {
- if(sourceToTarget == null) {
+ if (source != null && target != null) {
+ if (sourceToTarget == null) {
sourceToTarget = new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE);
}
- if(targetToSource == null) {
+ if (targetToSource == null) {
targetToSource = new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE);
}
- if(sourceToTargetConvertor != null) {
+ if (sourceToTargetConvertor != null) {
sourceToTarget.setConverter(sourceToTargetConvertor);
}
- if(targetToSourceConvertor != null) {
+ if (targetToSourceConvertor != null) {
targetToSource.setConverter(targetToSourceConvertor);
}
@@ -258,8 +258,8 @@ public class BindingGate {
int sourceToTargetPolicy = UpdateValueStrategy.POLICY_UPDATE;
int targetToSourcePolicy = UpdateValueStrategy.POLICY_UPDATE;
// Set policy to UpdateValueStrategy.
- if(dataBinding != null) {
- switch(dataBinding.getMode()) {
+ if (dataBinding != null) {
+ switch (dataBinding.getMode()) {
case OneWay:
targetToSourcePolicy = UpdateValueStrategy.POLICY_NEVER;
break;
@@ -282,9 +282,9 @@ public class BindingGate {
}
private void bindValidators(IValidationRule[] validators, UpdateValueStrategy sourceToTarget, UpdateValueStrategy targetToSource) {
- if(validators != null) {
- for(IValidationRule validator : validators) {
- switch(validator.getBindingMode()) {
+ if (validators != null) {
+ for (IValidationRule validator : validators) {
+ switch (validator.getBindingMode()) {
case SourceToTarget:
addValidatorToStrategy(sourceToTarget, validator);
break;
@@ -301,7 +301,7 @@ public class BindingGate {
}
private void addValidatorToStrategy(UpdateValueStrategy strategy, IValidationRule validator) {
- switch(validator.getPhase()) {
+ switch (validator.getPhase()) {
case AfterGet:
strategy.setAfterGetValidator(validator);
break;
@@ -323,7 +323,7 @@ public class BindingGate {
* org.eclipse.core.databinding.observable.value.IObservableValue)
*/
public Binding bind(IObservableValue source, IObservableValue target, UpdateValueStrategy sourceToTarget, UpdateValueStrategy targetToSource, IValueConverter converter) {
- if(converter != null) {
+ if (converter != null) {
return bind(source, target, sourceToTarget, targetToSource, converter, new InverseValueConverter(converter));
} else {
return bind(source, target, sourceToTarget, targetToSource, null, null);
@@ -331,69 +331,69 @@ public class BindingGate {
}
/**
- *
+ *
* @param source
* @param target
* @param sourceToTarget
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param targetToSource
- * if it is null, the default converter will be update policy
+ * if it is null, the default converter will be update policy
* @param sourceToTargetConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
* @param targetToSourceConvertor
- * if it is null, the default converter will be used
+ * if it is null, the default converter will be used
*/
public Binding bind(IObservableValue source, IObservableValue target, UpdateValueStrategy sourceToTarget, UpdateValueStrategy targetToSource, IConverter sourceToTargetConvertor, IConverter targetToSourceConvertor) {
- if(source != null && target != null) {
- if(sourceToTarget == null) {
+ if (source != null && target != null) {
+ if (sourceToTarget == null) {
sourceToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
}
- if(targetToSource == null) {
+ if (targetToSource == null) {
targetToSource = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
}
// Add converter to UpdateValueStrategy.
IDataProvider sourceDataProvider = XWT.findDataProvider(source);
Object sourceValueType = sourceDataProvider.getDataType(null);
- if(sourceValueType == null) {
+ if (sourceValueType == null) {
sourceValueType = Object.class;
}
IDataProvider targetDataProvider = XWT.findDataProvider(target);
Object targetValueType = targetDataProvider.getDataType(null);
- if(targetValueType == null) {
+ if (targetValueType == null) {
targetValueType = Object.class;
}
- Class<?> sourceType = (sourceValueType instanceof Class<?>) ? (Class<?>)sourceValueType : sourceValueType.getClass();
- Class<?> targetType = (targetValueType instanceof Class<?>) ? (Class<?>)targetValueType : targetValueType.getClass();
- if(sourceType == null) {
+ Class<?> sourceType = (sourceValueType instanceof Class<?>) ? (Class<?>) sourceValueType : sourceValueType.getClass();
+ Class<?> targetType = (targetValueType instanceof Class<?>) ? (Class<?>) targetValueType : targetValueType.getClass();
+ if (sourceType == null) {
sourceType = Object.class;
} else {
sourceType = ObjectUtil.normalizedType(sourceType);
}
- if(targetType == null) {
+ if (targetType == null) {
targetType = Object.class;
} else {
targetType = ObjectUtil.normalizedType(targetType);
}
- if(sourceToTarget.getUpdatePolicy() != UpdateValueStrategy.POLICY_NEVER) {
- if(sourceToTargetConvertor != null) {
+ if (sourceToTarget.getUpdatePolicy() != UpdateValueStrategy.POLICY_NEVER) {
+ if (sourceToTargetConvertor != null) {
sourceToTarget.setConverter(sourceToTargetConvertor);
- } else if(!targetType.isAssignableFrom(sourceType)) {
+ } else if (!targetType.isAssignableFrom(sourceType)) {
IConverter m2t = XWT.findConvertor(sourceType, targetType);
- if(m2t != null) {
+ if (m2t != null) {
sourceToTarget.setConverter(m2t);
}
}
}
- if(targetToSource.getUpdatePolicy() != UpdateValueStrategy.POLICY_NEVER) {
- if(targetToSourceConvertor != null) {
+ if (targetToSource.getUpdatePolicy() != UpdateValueStrategy.POLICY_NEVER) {
+ if (targetToSourceConvertor != null) {
targetToSource.setConverter(targetToSourceConvertor);
- } else if(!sourceType.isAssignableFrom(targetType)) {
+ } else if (!sourceType.isAssignableFrom(targetType)) {
IConverter t2m = XWT.findConvertor(targetType, sourceType);
- if(t2m != null) {
+ if (t2m != null) {
targetToSource.setConverter(t2m);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Core.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Core.java
index f28065ffbc5..8616058bd99 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Core.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/Core.java
@@ -4,11 +4,11 @@
* 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:
* Soyatec - initial API and implementation
* Christian W. Damus (CEA) - bug 417409
- *
+ *
*******************************************************************************/
package org.eclipse.papyrus.xwt.internal.core;
@@ -123,8 +123,8 @@ public class Core {
public void printInfo(String message, Tracking tracking, Set<Tracking> trackType) {
String printMessage = "";
- if(trackType != null && trackType.size() > 0) {
- if(trackType.contains(tracking)) {
+ if (trackType != null && trackType.size() > 0) {
+ if (trackType.contains(tracking)) {
printMessage = messageMap.get(tracking);
}
}
@@ -132,14 +132,14 @@ public class Core {
}
public void addMessage(String message, Tracking tracking) {
- if(messageMap.containsKey(tracking)) {
+ if (messageMap.containsKey(tracking)) {
messageMap.remove(tracking);
}
messageMap.put(tracking, message);
}
public void removeMessage(Tracking tracking) {
- if(messageMap.containsKey(tracking)) {
+ if (messageMap.containsKey(tracking)) {
messageMap.remove(tracking);
}
}
@@ -158,7 +158,7 @@ public class Core {
* @see org.eclipse.papyrus.xwt.IXWTLoader#getLogger()
*/
public ILogger getLogger() {
- if(logger == null) {
+ if (logger == null) {
return Core.nullLog;
}
return logger;
@@ -182,7 +182,7 @@ public class Core {
}
/**
- *
+ *
* @param nsmapace
* @param handler
*/
@@ -191,7 +191,7 @@ public class Core {
}
/**
- *
+ *
* @param nsmapace
*/
public void unregisterNamespaceHandler(String nsmapace) {
@@ -199,7 +199,7 @@ public class Core {
}
/**
- *
+ *
* @param nsmapace
* @return
*/
@@ -213,7 +213,7 @@ public class Core {
public IConverter getConverter(Class<?> type) {
IConverter converter = converters.get(type);
- if(converter != null) {
+ if (converter != null) {
return converter;
}
@@ -232,14 +232,14 @@ public class Core {
* java.lang.Class)
*/
public IConverter findConvertor(Class<?> source, Class<?> target) {
- if(source == target || (source != Object.class && source.isAssignableFrom(target))) {
+ if (source == target || (source != Object.class && source.isAssignableFrom(target))) {
return ObjectToObject.instance;
}
- if(String.class == source && target.isEnum()) {
+ if (String.class == source && target.isEnum()) {
return new StringToEnum(target);
}
- ValueConvertorRegister convertorRegister = (ValueConvertorRegister)getService(ValueConvertorRegister.class);
- if(convertorRegister == null) {
+ ValueConvertorRegister convertorRegister = (ValueConvertorRegister) getService(ValueConvertorRegister.class);
+ if (convertorRegister == null) {
return null;
}
return convertorRegister.findConverter(source, target);
@@ -253,9 +253,9 @@ public class Core {
* .conversion.IConverter)
*/
public void registerConvertor(IConverter converter) {
- Class<?> source = (Class<?>)converter.getFromType();
- Class<?> target = (Class<?>)converter.getToType();
- ValueConvertorRegister convertorRegister = (ValueConvertorRegister)getService(ValueConvertorRegister.class);
+ Class<?> source = (Class<?>) converter.getFromType();
+ Class<?> target = (Class<?>) converter.getToType();
+ ValueConvertorRegister convertorRegister = (ValueConvertorRegister) getService(ValueConvertorRegister.class);
convertorRegister.register(source, target, converter);
}
@@ -263,8 +263,8 @@ public class Core {
try {
Method method = converter.getDeclaredMethod(methodName);
Object object = method.invoke(null);
- if(object instanceof IConverter) {
- registerConvertor((IConverter)object);
+ if (object instanceof IConverter) {
+ registerConvertor((IConverter) object);
}
} catch (SecurityException e) {
} catch (IllegalArgumentException e) {
@@ -276,14 +276,14 @@ public class Core {
public void registerConvertor(Class<?> converterType, String methodName, boolean value) {
IConverter converter = loadConvertor(converterType, methodName, value);
- if(converter != null) {
+ if (converter != null) {
registerConvertor(converter);
}
}
public void registerConvertor(ValueConvertorRegister convertorRegister, Class<?> source, Class<?> target, Class<?> converterType, String methodName, boolean value) {
IConverter converter = loadConvertor(converterType, methodName, value);
- if(converter != null) {
+ if (converter != null) {
convertorRegister.register(source, target, converter);
}
}
@@ -292,8 +292,8 @@ public class Core {
try {
Method method = converter.getDeclaredMethod(methodName);
Object object = method.invoke(null, value);
- if(object instanceof IConverter) {
- return (IConverter)object;
+ if (object instanceof IConverter) {
+ return (IConverter) object;
}
} catch (SecurityException e) {
} catch (IllegalArgumentException e) {
@@ -310,8 +310,8 @@ public class Core {
* @see org.eclipse.papyrus.xwt.IXWTLoader#getConverterService()
*/
public ConverterService getConverterService() {
- ConverterService service = (ConverterService)getService(ConverterService.class);
- if(service == null) {
+ ConverterService service = (ConverterService) getService(ConverterService.class);
+ if (service == null) {
service = new ConverterService();
registerService(ConverterService.class, service);
service.register(Object.class, new IConverter() {
@@ -339,7 +339,7 @@ public class Core {
* org.eclipse.papyrus.xwt.IXWTLoader#addTracking(org.eclipse.papyrus.xwt.Tracking)
*/
public void addTracking(Tracking tracking) {
- if(!trackingSet.contains(tracking)) {
+ if (!trackingSet.contains(tracking)) {
trackingSet.add(tracking);
}
}
@@ -370,7 +370,7 @@ public class Core {
* org.eclipse.papyrus.xwt.IXWTLoader#removeTracking(org.eclipse.papyrus.xwt.Tracking)
*/
public void removeTracking(Tracking tracking) {
- if(trackingSet.contains(tracking)) {
+ if (trackingSet.contains(tracking)) {
trackingSet.remove(tracking);
}
}
@@ -450,7 +450,7 @@ public class Core {
* .IDataProviderFactory)
*/
public void addDataProviderFactory(String name, IDataProviderFactory dataProviderFactory) {
- if(dataProviderFactory == null) {
+ if (dataProviderFactory == null) {
return;
}
dataProviderFactories.put(name, dataProviderFactory);
@@ -474,7 +474,7 @@ public class Core {
* .xwt.IDataProviderFactory)
*/
public void removeDataProviderFactory(String name) {
- if(name == null) {
+ if (name == null) {
return;
}
dataProviderFactories.remove(name);
@@ -488,12 +488,12 @@ public class Core {
* .xwt.IDataProviderFactory)
*/
public void removeDataProviderFactory(IDataProviderFactory dataProviderFactory) {
- if(dataProviderFactory == null) {
+ if (dataProviderFactory == null) {
return;
}
- for(String name : dataProviderFactories.keySet()) {
+ for (String name : dataProviderFactories.keySet()) {
IDataProviderFactory value = dataProviderFactories.get(name);
- if(dataProviderFactory == value) {
+ if (dataProviderFactory == value) {
dataProviderFactories.remove(name);
}
}
@@ -514,12 +514,12 @@ public class Core {
* @see org.eclipse.papyrus.xwt.IXWTLoader#findDataProvider(java.lang.Object)
*/
public IDataProvider findDataProvider(Object dataContext) {
- if(dataContext instanceof IDataProvider) {
- return (IDataProvider)dataContext;
+ if (dataContext instanceof IDataProvider) {
+ return (IDataProvider) dataContext;
}
- for(IDataProviderFactory factory : dataProviderFactories.values()) {
+ for (IDataProviderFactory factory : dataProviderFactories.values()) {
IDataProvider dataProvider = factory.create(dataContext);
- if(dataProvider != null) {
+ if (dataProvider != null) {
return dataProvider;
}
}
@@ -534,7 +534,7 @@ public class Core {
* @see org.eclipse.papyrus.xwt.IXWTLoader#getLoadingContext()
*/
public ILoadingContext getLoadingContext() {
- if(_loadingContext == null) {
+ if (_loadingContext == null) {
return DefaultLoadingContext.defaultLoadingContext;
}
return _loadingContext;
@@ -564,22 +564,22 @@ public class Core {
}
public IMetaclass findMetaclass(Object object) {
- if(object instanceof Class<?>) {
- return getMetaclassService().findMetaclass((Class<?>)object);
+ if (object instanceof Class<?>) {
+ return getMetaclassService().findMetaclass((Class<?>) object);
}
return getMetaclassService().findMetaclass(object.getClass());
}
public IMetaclass getMetaclass(Object object) {
- if(object instanceof Class<?>) {
- return getMetaclassService().getMetaclass((Class<?>)object);
+ if (object instanceof Class<?>) {
+ return getMetaclassService().getMetaclass((Class<?>) object);
}
return getMetaclassService().getMetaclass(object.getClass());
}
public IMetaclass getMetaclass(Object object, String namespace) {
- if(object instanceof Class) {
- return getMetaclassService().getMetaclass((Class<?>)object, namespace);
+ if (object instanceof Class) {
+ return getMetaclassService().getMetaclass((Class<?>) object, namespace);
}
return getMetaclassService().getMetaclass(object.getClass(), namespace);
}
@@ -618,7 +618,7 @@ public class Core {
protected Object createCLRElement(IRenderingContext context, Element element, Map<String, Object> options) {
IVisualElementLoader loader = findElementLoader(element);
- if(loader != null) {
+ if (loader != null) {
return loader.createUIElement(element, options);
}
loader = createElementLoader(context, element);
@@ -629,10 +629,10 @@ public class Core {
protected IVisualElementLoader findElementLoader(DocumentObject element) {
IVisualElementLoader loader = elementsLoaders.get(element);
- if(loader != null) {
+ if (loader != null) {
return loader;
}
- if(element.getParent() != null) {
+ if (element.getParent() != null) {
return findElementLoader(element.getParent());
}
return null;
@@ -655,11 +655,11 @@ public class Core {
public IUIResource loadAsResource(InputStream stream, URL input, IBeforeParsingCallback parsingCallback) throws Exception {
ElementManager manager = new ElementManager();
Element element = null;
- if(stream == null) {
+ if (stream == null) {
element = manager.load(input, parsingCallback);
} else {
InputStream inputStream = stream;
- if(parsingCallback != null) {
+ if (parsingCallback != null) {
int size = stream.read();
byte[] buffer = new byte[size];
stream.read(buffer);
@@ -675,36 +675,36 @@ public class Core {
}
public Object load(ILoadingContext loadingContext, IUIResource pattern, Map<String, Object> options) throws Exception {
- UIResource uiResource = (UIResource)pattern;
+ UIResource uiResource = (UIResource) pattern;
Control control = null;
ElementManager manager = new ElementManager(uiResource.getURL());
Element element = uiResource.getContent();
IRenderingContext context = new ExtensionContext(loadingContext, manager, element.getNamespace());
Object visual = createCLRElement(context, element, options);
- if(visual instanceof Control) {
- control = (Control)visual;
- } else if(visual instanceof Viewer) {
- control = ((Viewer)visual).getControl();
+ if (visual instanceof Control) {
+ control = (Control) visual;
+ } else if (visual instanceof Viewer) {
+ control = ((Viewer) visual).getControl();
} else {
Class<?> jfaceWindow = Class.forName("org.eclipse.jface.window.Window");
- if(jfaceWindow != null && jfaceWindow.isInstance(visual)) {
+ if (jfaceWindow != null && jfaceWindow.isInstance(visual)) {
Method createMethod = jfaceWindow.getDeclaredMethod("create");
createMethod.invoke(visual);
Method method = jfaceWindow.getDeclaredMethod("getShell");
- control = (Control)method.invoke(visual);
+ control = (Control) method.invoke(visual);
}
}
- if(control instanceof Composite) {
+ if (control instanceof Composite) {
Object parent = options.get(IXWTLoader.CONTAINER_PROPERTY);
Object designMode = options.get(IXWTLoader.DESIGN_MODE_PROPERTY);
- if(parent instanceof Composite) {
- Composite parentComposite = (Composite)parent;
- if(parentComposite.getLayout() == null || designMode == Boolean.TRUE) {
+ if (parent instanceof Composite) {
+ Composite parentComposite = (Composite) parent;
+ if (parentComposite.getLayout() == null || designMode == Boolean.TRUE) {
autoLayout(parentComposite, element);
}
- } else if(parent == null || designMode == Boolean.TRUE) {
- if(control instanceof Shell) {
+ } else if (parent == null || designMode == Boolean.TRUE) {
+ if (control instanceof Shell) {
autoLayout(control, element);
} else {
autoLayout(control.getShell(), element);
@@ -719,24 +719,24 @@ public class Core {
long start = System.currentTimeMillis();
Control control = null;
ElementManager manager = new ElementManager();
- if(input != null) {
+ if (input != null) {
Element element = null;
IElementCache cache = getCache(options);
element = cache.getElement(input);
- if(element != null) {
+ if (element != null) {
manager.setRootElement(element);
-
+
// Got an element from the cache, so we don't need an input stream
- if(stream != null) {
+ if (stream != null) {
stream.close();
}
} else {
- if(stream == null) {
- element = manager.load(input, (IBeforeParsingCallback)options.get(IXWTLoader.BEFORE_PARSING_CALLBACK));
+ if (stream == null) {
+ element = manager.load(input, (IBeforeParsingCallback) options.get(IXWTLoader.BEFORE_PARSING_CALLBACK));
} else {
- IBeforeParsingCallback callback = (IBeforeParsingCallback)options.get(IXWTLoader.BEFORE_PARSING_CALLBACK);
+ IBeforeParsingCallback callback = (IBeforeParsingCallback) options.get(IXWTLoader.BEFORE_PARSING_CALLBACK);
InputStream inputStream = stream;
- if(callback != null) {
+ if (callback != null) {
int size = stream.read();
byte[] buffer = new byte[size];
stream.read(buffer);
@@ -749,46 +749,46 @@ public class Core {
element = manager.load(inputStream, input);
}
- if(cache != null) {
+ if (cache != null) {
cache.cache(input, element);
}
}
-
+
IRenderingContext context = new ExtensionContext(loadingContext, manager, manager.getRootElement().getNamespace());
Object visual = createCLRElement(context, element, options);
- if(TRACE_BENCH) {
+ if (TRACE_BENCH) {
System.out.println("Loaded: " + (System.currentTimeMillis() - start) + " " + input.toString());
}
- if(visual instanceof Control) {
- control = (Control)visual;
- } else if(visual instanceof Viewer) {
- control = ((Viewer)visual).getControl();
+ if (visual instanceof Control) {
+ control = (Control) visual;
+ } else if (visual instanceof Viewer) {
+ control = ((Viewer) visual).getControl();
} else {
Class<?> jfaceWindow = Class.forName("org.eclipse.jface.window.Window");
- if(jfaceWindow != null && jfaceWindow.isInstance(visual)) {
+ if (jfaceWindow != null && jfaceWindow.isInstance(visual)) {
Method createMethod = jfaceWindow.getDeclaredMethod("create");
createMethod.invoke(visual);
Method method = jfaceWindow.getDeclaredMethod("getShell");
- control = (Control)method.invoke(visual);
+ control = (Control) method.invoke(visual);
}
}
Object parent = options.get(IXWTLoader.CONTAINER_PROPERTY);
Object designMode = options.get(IXWTLoader.DESIGN_MODE_PROPERTY);
- if(control instanceof Composite) {
- if(parent instanceof Composite) {
- Composite parentComposite = (Composite)parent;
- if(parentComposite.getLayout() == null || designMode == Boolean.TRUE) {
+ if (control instanceof Composite) {
+ if (parent instanceof Composite) {
+ Composite parentComposite = (Composite) parent;
+ if (parentComposite.getLayout() == null || designMode == Boolean.TRUE) {
autoLayout(parentComposite, element);
}
- } else if(parent == null || designMode == Boolean.TRUE) {
- if(control instanceof Shell) {
+ } else if (parent == null || designMode == Boolean.TRUE) {
+ if (control instanceof Shell) {
autoLayout(control, element);
} else {
autoLayoutShell(control, element);
}
}
- } else if(control != null && (parent == null || designMode == Boolean.TRUE)) {
+ } else if (control != null && (parent == null || designMode == Boolean.TRUE)) {
autoLayoutShell(control, element);
}
}
@@ -797,56 +797,56 @@ public class Core {
private IElementCache getCache(Map<String, Object> options) {
Object option = (options == null) ? IElementCache.NULL : options.get(XML_CACHE_PROPERTY);
- if(option instanceof Boolean) {
+ if (option instanceof Boolean) {
// Enable caching according to the option
- if(((Boolean)option).booleanValue()) {
+ if (((Boolean) option).booleanValue()) {
option = new DefaultElementCache();
} else {
option = IElementCache.NULL;
}
options.put(XML_CACHE_PROPERTY, option);
- } else if(option instanceof Number) {
+ } else if (option instanceof Number) {
// create a default cache of this size
- option = new DefaultElementCache(((Number)option).intValue());
+ option = new DefaultElementCache(((Number) option).intValue());
options.put(XML_CACHE_PROPERTY, option);
- } else if(!(option instanceof IElementCache)) {
+ } else if (!(option instanceof IElementCache)) {
option = IElementCache.NULL;
options.put(XML_CACHE_PROPERTY, option);
}
- return (IElementCache)option;
+ return (IElementCache) option;
}
-
+
protected void autoLayout(Control composite, Element element) {
- if(element == null) {
+ if (element == null) {
return;
}
Attribute bounds = element.getAttribute("Bounds");
- if(bounds == null) {
+ if (bounds == null) {
bounds = element.getAttribute("Bounds", IConstants.XWT_NAMESPACE);
}
Attribute size = element.getAttribute("Size");
- if(size == null) {
+ if (size == null) {
size = element.getAttribute("Size", IConstants.XWT_NAMESPACE);
}
- if(bounds == null && size == null) {
+ if (bounds == null && size == null) {
composite.pack();
}
}
protected void autoLayoutShell(Control control, Element element) {
- if(element == null) {
+ if (element == null) {
return;
}
Attribute bounds = element.getAttribute("Bounds");
- if(bounds == null) {
+ if (bounds == null) {
bounds = element.getAttribute("Bounds", IConstants.XWT_NAMESPACE);
}
Attribute size = element.getAttribute("Size");
- if(size == null) {
+ if (size == null) {
size = element.getAttribute("Size", IConstants.XWT_NAMESPACE);
}
- if(bounds == null && size == null) {
+ if (bounds == null && size == null) {
control.pack();
} else {
Shell shell = control.getShell();
@@ -921,14 +921,14 @@ public class Core {
/**
* Check if the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public boolean isFileResolveType(Class<?> type) {
- for(Class<?> resolveType : resolveTypes) {
- if(resolveType.isAssignableFrom(type)) {
+ for (Class<?> resolveType : resolveTypes) {
+ if (resolveType.isAssignableFrom(type)) {
return true;
}
}
@@ -937,22 +937,22 @@ public class Core {
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public void registerFileResolveType(Class<?> type) {
- if(!resolveTypes.contains(type)) {
+ if (!resolveTypes.contains(type)) {
resolveTypes.add(type);
}
}
/**
* Register the value of a property is to resolve.
- *
+ *
* @param type
- * type of property
+ * type of property
* @return
*/
public void unregisterFileResolveType(Class<?> type) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DataBindingTrack.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DataBindingTrack.java
index 0dc91f5d574..4474146642a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DataBindingTrack.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DataBindingTrack.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Widget;
/**
* @author liang.zhang
- *
+ *
*/
public class DataBindingTrack {
@@ -65,11 +65,11 @@ public class DataBindingTrack {
private int validateParentElementError(Element bindingElement) {
int isError = 0;
- if(!bindingError.equals("")) {
+ if (!bindingError.equals("")) {
Object parentObj = bindingElement.getParent();
- while(parentObj != null) {
- bindingElement = (Element)parentObj;
- if(errorElements.contains(bindingElement.getId())) {
+ while (parentObj != null) {
+ bindingElement = (Element) parentObj;
+ if (errorElements.contains(bindingElement.getId())) {
isError = 1;
break;
}
@@ -80,8 +80,8 @@ public class DataBindingTrack {
}
private String getCurrentWidgetPosition(Element element) {
- if(element.getParent() != null) {
- return " " + getCurrentWidgetPosition((Element)element.getParent());
+ if (element.getParent() != null) {
+ return " " + getCurrentWidgetPosition((Element) element.getParent());
}
return "";
}
@@ -90,27 +90,27 @@ public class DataBindingTrack {
StringBuffer message = new StringBuffer("");
Iterator<Element> widgetIt = widgetList.iterator();
Set<Element> keys = bindingMap.keySet();
- while(widgetIt.hasNext()) {
+ while (widgetIt.hasNext()) {
Element element = widgetIt.next();
int parentHasError = validateParentElementError(element);
- if(parentHasError == 0) {
+ if (parentHasError == 0) {
String content = getCurrentWidgetPosition(element);
- if(!message.toString().equals("")) {
+ if (!message.toString().equals("")) {
content += "+ ";
}
content = content + element.getName();
- if(XWT.isTracking(Tracking.NAME)) {
+ if (XWT.isTracking(Tracking.NAME)) {
Attribute nameAttr = element.getAttribute("Name");
- if(nameAttr == null) {
+ if (nameAttr == null) {
nameAttr = element.getAttribute(IConstants.XWT_X_NAMESPACE, "Name");
}
- if(nameAttr != null) {
+ if (nameAttr != null) {
content += " <" + nameAttr.getContent() + ">";
}
}
message.append(content);
- if(XWT.isTracking(Tracking.DATABINDING)) {
- if(keys.contains(element)) {
+ if (XWT.isTracking(Tracking.DATABINDING)) {
+ if (keys.contains(element)) {
message.append(bindingMap.get(element));
} else {
message.append("\n");
@@ -127,25 +127,27 @@ public class DataBindingTrack {
public void tracking(Object swtObject, Element element, Object dataContext) {
String bindingMessage = "";
- if(swtObject instanceof Binding) {
+ if (swtObject instanceof Binding) {
String error = "";
- Binding newInstance = (Binding)swtObject;
+ Binding newInstance = (Binding) swtObject;
String path = null;
Attribute attr = element.getAttribute("Path");
- if(null == attr)
+ if (null == attr) {
attr = element.getAttribute("path");
- if(null != attr)
+ }
+ if (null != attr) {
path = attr.getContent();
+ }
Object dataContext2 = null;
try {
dataContext2 = newInstance.getValue(null);
- if(path != null && path.length() > 0) {
+ if (path != null && path.length() > 0) {
String[] paths = path.trim().split("\\.");
- if(paths.length > 1) {
+ if (paths.length > 1) {
String path1 = "";
- for(int i = 0; i < paths.length - 1; i++) {
+ for (int i = 0; i < paths.length - 1; i++) {
path1 = paths[i];
- if(dataContext2 != null) {
+ if (dataContext2 != null) {
dataContext2 = getObserveData(dataContext2, path1);
}
}
@@ -156,26 +158,26 @@ public class DataBindingTrack {
setBindingErrorMessage("-> Error");
error = "-> Error";
}
- if(dataContext2 != null) {
+ if (dataContext2 != null) {
bindingMessage = " (DataContext=" + dataContext2.getClass().getSimpleName() + ", Path=" + path + ")" + error + "\n";
- addBindingMessageToMap((Element)element.getParent().getParent(), bindingMessage);// bindingMap.put((Element) element.getParent().getParent(), bindingMessage);
+ addBindingMessageToMap((Element) element.getParent().getParent(), bindingMessage);// bindingMap.put((Element) element.getParent().getParent(), bindingMessage);
}
- } else if(swtObject instanceof Widget) {
+ } else if (swtObject instanceof Widget) {
addWidgetElement(element);
- if(dataContext != null) {
+ if (dataContext != null) {
bindingMessage = " (DataContext=" + dataContext.getClass().getSimpleName() + ")\n";
addBindingMessageToMap(element, bindingMessage);
}
- } else if(JFacesHelper.isViewer(swtObject)) {
- if(dataContext != null) {
+ } else if (JFacesHelper.isViewer(swtObject)) {
+ if (dataContext != null) {
bindingMessage = " (DataContext=" + dataContext.getClass().getSimpleName() + ")\n";
addBindingMessageToMap(element, bindingMessage);// bindingMap.put(element, bindingMessage);
}
- } else if(element.attributeNames(IConstants.XWT_X_NAMESPACE).length > 0) {
+ } else if (element.attributeNames(IConstants.XWT_X_NAMESPACE).length > 0) {
// ??
- if(element.getParent() != null && element.getParent().getParent() != null) {
+ if (element.getParent() != null && element.getParent().getParent() != null) {
bindingMessage = " (DataContext=" + element.getName() + ")\n";
- addBindingMessageToMap((Element)element.getParent().getParent(), bindingMessage);// bindingMap.put((Element) element.getParent().getParent(), bindingMessage);
+ addBindingMessageToMap((Element) element.getParent().getParent(), bindingMessage);// bindingMap.put((Element) element.getParent().getParent(), bindingMessage);
}
}
}
@@ -184,7 +186,7 @@ public class DataBindingTrack {
try {
Class<?> dataContextClass = dataContext.getClass();
Method getMethod = ObjectUtil.findGetter(dataContextClass, path, null);
- if(getMethod != null) {
+ if (getMethod != null) {
return getMethod.invoke(dataContext);
}
} catch (SecurityException e) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicBinding.java
index 370a43eff52..cd5c7e8295e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicBinding.java
@@ -29,7 +29,7 @@ import org.eclipse.swt.widgets.Widget;
/**
* Generic Binding definition
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public abstract class DynamicBinding implements IDynamicBinding {
@@ -59,7 +59,7 @@ public abstract class DynamicBinding implements IDynamicBinding {
* @see org.eclipse.papyrus.xwt.core.IDynamicBinding#getContextName()
*/
public IBindingContext getBindingContext() {
- if(this.bindingContext == null) {
+ if (this.bindingContext == null) {
Object element = (control == null ? host : control);
this.bindingContext = XWT.getBindingContext(element);
}
@@ -95,7 +95,7 @@ public abstract class DynamicBinding implements IDynamicBinding {
/**
* @param type
- * the type to set
+ * the type to set
*/
public void setType(String type) {
this.type = type;
@@ -122,16 +122,16 @@ public abstract class DynamicBinding implements IDynamicBinding {
protected Object getDataContextHost() {
Object control = getControl();
- if(control == null) {
+ if (control == null) {
return null;
}
Object data = UserData.getLocalDataContext(control);
- if(data == null || data == this) {
- if(data == null && UserData.hasLocalData(control, IUserDataConstants.XWT_DATACONTEXT_KEY)) {
+ if (data == null || data == this) {
+ if (data == null && UserData.hasLocalData(control, IUserDataConstants.XWT_DATACONTEXT_KEY)) {
return control;
}
Widget parent = UserData.getParent(control);
- if(parent != null) {
+ if (parent != null) {
return UserData.getDataContextHost(parent);
}
return null;
@@ -140,16 +140,16 @@ public abstract class DynamicBinding implements IDynamicBinding {
}
protected Object getDataContext() {
- if(control != null) {
+ if (control != null) {
return UserData.getDataContext(control);
}
return null;
}
protected IDataProvider getDataProvider(Object dataContext) {
- if(dataContext != null) {
- if(dataContext instanceof IDataProvider) {
- return (IDataProvider)dataContext;
+ if (dataContext != null) {
+ if (dataContext instanceof IDataProvider) {
+ return (IDataProvider) dataContext;
} else {
return xwtLoader.findDataProvider(dataContext);
}
@@ -162,16 +162,16 @@ public abstract class DynamicBinding implements IDynamicBinding {
}
protected Rectangle getControlBounds() {
- Widget widget = (Widget)getControl();
- if(widget instanceof Control) {
- Control control = (Control)widget;
+ Widget widget = (Widget) getControl();
+ if (widget instanceof Control) {
+ Control control = (Control) widget;
return control.getBounds();
}
Method drawMethod = findBoundsMethod(widget.getClass());
- if(drawMethod != null) {
+ if (drawMethod != null) {
try {
drawMethod.setAccessible(true);
- return (Rectangle)drawMethod.invoke(widget);
+ return (Rectangle) drawMethod.invoke(widget);
} catch (Exception e) {
throw new XWTException(e);
}
@@ -181,13 +181,13 @@ public abstract class DynamicBinding implements IDynamicBinding {
}
protected Control findHostControl() {
- Widget widget = (Widget)getControl();
+ Widget widget = (Widget) getControl();
Control host;
- if(widget instanceof Item) {
- Item item = (Item)widget;
- host = (Control)XWT.findParent(item, Control.class);
- } else if(widget instanceof Control) {
- host = (Control)widget;
+ if (widget instanceof Item) {
+ Item item = (Item) widget;
+ host = (Control) XWT.findParent(item, Control.class);
+ } else if (widget instanceof Control) {
+ host = (Control) widget;
} else {
throw new XWTException();
}
@@ -195,27 +195,27 @@ public abstract class DynamicBinding implements IDynamicBinding {
}
private Method findBoundsMethod(Class<?> type) {
- for(Method method : type.getDeclaredMethods()) {
- if(method.getAnnotation(UIBounds.class) != null && method.getTypeParameters().length == 0 && method.getReturnType() == Rectangle.class) {
+ for (Method method : type.getDeclaredMethods()) {
+ if (method.getAnnotation(UIBounds.class) != null && method.getTypeParameters().length == 0 && method.getReturnType() == Rectangle.class) {
return method;
}
}
Class<?> supertype = type.getSuperclass();
- if(supertype != null && supertype != Widget.class) {
+ if (supertype != null && supertype != Widget.class) {
Method method = findBoundsMethod(supertype);
- if(method != null) {
+ if (method != null) {
return method;
}
}
- for(Class<?> anInterface : type.getInterfaces()) {
+ for (Class<?> anInterface : type.getInterfaces()) {
Method method = findBoundsMethod(anInterface);
- if(method != null) {
+ if (method != null) {
return method;
}
}
try {
Method method = type.getDeclaredMethod("getBounds");
- if(method.getReturnType() == Rectangle.class) {
+ if (method.getReturnType() == Rectangle.class) {
return method;
}
} catch (Exception e) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicValueBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicValueBinding.java
index 70d56d631ec..0db8c21cdba 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicValueBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/DynamicValueBinding.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassManager.java
index d8a5a92cd53..13cd5781c6e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassManager.java
@@ -51,7 +51,7 @@ public class MetaclassManager {
public void register(IMetaclass metaclass) {
Class<?> type = metaclass.getType();
- if(classRegister.contains(type)) {
+ if (classRegister.contains(type)) {
return;
}
String key = type.getSimpleName();
@@ -65,12 +65,12 @@ public class MetaclassManager {
public IMetaclass register(Class<?> javaClass, IMetaclass superMetaclass) {
IMetaclass metaclass = getMetaclass(javaClass);
- if(metaclass != null) {
+ if (metaclass != null) {
return metaclass;
}
- if(superMetaclass == null) {
+ if (superMetaclass == null) {
Class<?> superclass = javaClass.getSuperclass();
- if(superclass != null && superclass != Object.class) {
+ if (superclass != null && superclass != Object.class) {
register(superclass, null);
}
superMetaclass = getMetaclass(superclass);
@@ -81,9 +81,9 @@ public class MetaclassManager {
}
protected IMetaclass createMetaclass(Class<?> javaClass, IMetaclass superMetaclass) {
- if(service != null) {
+ if (service != null) {
IMetaclassFactory factory = service.findFactory(javaClass);
- if(factory != null) {
+ if (factory != null) {
return factory.create(javaClass, superMetaclass, xwtLoader);
}
}
@@ -93,30 +93,30 @@ public class MetaclassManager {
public IMetaclass getMetaclass(ILoadingContext context, String name, String namespace) {
IMetaclass metaclass = nameRegister.get(name);
- if(metaclass != null) {
- if(namespace == null || namespace.equals(IConstants.XWT_NAMESPACE)) {
+ if (metaclass != null) {
+ if (namespace == null || namespace.equals(IConstants.XWT_NAMESPACE)) {
return metaclass;
}
- if(namespace != null && namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
+ if (namespace != null && namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
String packageName = namespace.substring(IConstants.XAML_CLR_NAMESPACE_PROTO.length());
int index = packageName.indexOf('=');
- if(index != -1) {
+ if (index != -1) {
packageName = packageName.substring(0, index);
}
// if using default package(null), use only name as class name,
// else use package.class as class name
String className = packageName.length() == 0 ? name : (packageName + "." + name);
- if(metaclass.getType().getName().equals(className)) {
+ if (metaclass.getType().getName().equals(className)) {
return metaclass;
}
}
}
- if(namespace == null || !namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
+ if (namespace == null || !namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
return null;
}
String packageName = namespace.substring(IConstants.XAML_CLR_NAMESPACE_PROTO.length());
int index = packageName.indexOf('=');
- if(index != -1) {
+ if (index != -1) {
packageName = packageName.substring(0, index);
}
// if using default package(null), use only name as class name, else use
@@ -124,7 +124,7 @@ public class MetaclassManager {
String className = packageName.length() == 0 ? name : (packageName + "." + name);
// try {
Class<?> type = ClassLoaderUtil.loadClass(context, className);
- if(type == null) {
+ if (type == null) {
throw new XWTException("Cannot load " + className);
}
metaclass = register(type, null);
@@ -135,25 +135,25 @@ public class MetaclassManager {
}
public IMetaclass getMetaclass(Object object) {
- if(object instanceof Class) {
- return getMetaclass((Class<?>)object);
- } else if(object instanceof String) {
- return getMetaclass((String)object);
+ if (object instanceof Class) {
+ return getMetaclass((Class<?>) object);
+ } else if (object instanceof String) {
+ return getMetaclass(object);
}
Class<?> type = object.getClass();
return getMetaclass(type);
}
public IMetaclass getMetaclass(Class<?> type) {
- if(classRegister.contains(type)) {
+ if (classRegister.contains(type)) {
IMetaclass metaclass = nameRegister.get(type.getSimpleName());
- if(metaclass != null && metaclass.getType() == type) {
+ if (metaclass != null && metaclass.getType() == type) {
return metaclass;
}
}
- if(parent != null) {
+ if (parent != null) {
IMetaclass metaclass = parent.getMetaclass(type);
- if(metaclass != null) {
+ if (metaclass != null) {
return metaclass;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassService.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassService.java
index 7ed56b7e9db..9bbb1195948 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassService.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MetaclassService.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -38,7 +38,7 @@ public class MetaclassService {
public IMetaclass getMetaclass(ILoadingContext context, String name, String namespace) {
MetaclassManager manager = map.get(namespace);
- if(manager == null) {
+ if (manager == null) {
manager = new MetaclassManager(this, map.get(IConstants.XWT_NAMESPACE), xwtLoader);
map.put(namespace, manager);
}
@@ -47,7 +47,7 @@ public class MetaclassService {
public IMetaclass findMetaclass(Class<?> type) {
MetaclassManager manager = map.get(IConstants.XWT_NAMESPACE);
- if(manager == null) {
+ if (manager == null) {
return null;
}
return manager.getMetaclass(type);
@@ -55,24 +55,24 @@ public class MetaclassService {
public IMetaclass getMetaclass(Class<?> type) {
MetaclassManager manager = map.get(IConstants.XWT_NAMESPACE);
- if(manager == null) {
+ if (manager == null) {
return null;
}
IMetaclass metaclass = manager.getMetaclass(type);
- if(metaclass == null) {
+ if (metaclass == null) {
String packageName = "";
Package packageObject = type.getPackage();
- if(packageObject != null) {
+ if (packageObject != null) {
packageName = packageObject.getName();
}
String key = IConstants.XAML_CLR_NAMESPACE_PROTO + ":" + packageName;
MetaclassManager childManager = map.get(key);
- if(childManager == null) {
+ if (childManager == null) {
childManager = new MetaclassManager(this, manager, xwtLoader);
map.put(key, childManager);
}
metaclass = childManager.getMetaclass(type);
- if(metaclass == null) {
+ if (metaclass == null) {
childManager.register(type);
metaclass = childManager.getMetaclass(type);
}
@@ -82,14 +82,14 @@ public class MetaclassService {
public IMetaclass getMetaclass(Class<?> type, String namespace) {
MetaclassManager manager = map.get(namespace);
- if(manager == null) {
+ if (manager == null) {
manager = new MetaclassManager(this, null, xwtLoader);
map.put(namespace, manager);
}
IMetaclass metaclass = manager.getMetaclass(type);
- if(metaclass == null) {
+ if (metaclass == null) {
metaclass = manager.getMetaclass(type);
- if(metaclass == null) {
+ if (metaclass == null) {
manager.register(type);
metaclass = manager.getMetaclass(type);
}
@@ -99,7 +99,7 @@ public class MetaclassService {
public IMetaclass register(Class<?> metaclass, String namespace) {
MetaclassManager manager = map.get(namespace);
- if(manager == null) {
+ if (manager == null) {
throw new IllegalStateException();
}
return manager.register(metaclass);
@@ -107,7 +107,7 @@ public class MetaclassService {
public IMetaclass register(Class<?> metaclass, String namespace, IMetaclass superMetaclass) {
MetaclassManager manager = map.get(namespace);
- if(manager == null) {
+ if (manager == null) {
throw new IllegalStateException();
}
return manager.register(metaclass, superMetaclass);
@@ -115,7 +115,7 @@ public class MetaclassService {
public void register(IMetaclass metaclass, String namespace) {
MetaclassManager manager = map.get(namespace);
- if(manager == null) {
+ if (manager == null) {
manager = new MetaclassManager(this, null, xwtLoader);
map.put(namespace, manager);
}
@@ -124,7 +124,7 @@ public class MetaclassService {
public Collection<IMetaclass> getAllMetaclasses(String namespace) {
MetaclassManager manager = map.get(namespace);
- if(manager == null) {
+ if (manager == null) {
throw new IllegalStateException();
}
return manager.getAllMetaclasses();
@@ -139,9 +139,9 @@ public class MetaclassService {
}
public IMetaclassFactory findFactory(Class<?> javaClass) {
- for(int i = factories.size() - 1; i >= 0; i--) {
+ for (int i = factories.size() - 1; i >= 0; i--) {
IMetaclassFactory factory = factories.get(i);
- if(factory.isFactoryOf(javaClass)) {
+ if (factory.isFactoryOf(javaClass)) {
return factory;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MultiBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MultiBinding.java
index 615009fbc49..c2a6094a2c3 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MultiBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/MultiBinding.java
@@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Text;
/**
* Support the aggregation of data binding
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
@@ -54,7 +54,7 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
* <p>
* Default
* </p>
- *
+ *
*/
private UpdateSourceTrigger updateSourceTrigger = UpdateSourceTrigger.Default;
@@ -77,7 +77,7 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
}
public IMultiValueConverter getConverter() {
- if(valueConverter == null) {
+ if (valueConverter == null) {
valueConverter = new StringMultiValueConerter();
}
return valueConverter;
@@ -88,8 +88,8 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
}
public boolean isSourcePropertyReadOnly() {
- for(Binding binding : bindings) {
- if(binding.isSourcePropertyReadOnly()) {
+ for (Binding binding : bindings) {
+ if (binding.isSourcePropertyReadOnly()) {
return true;
}
}
@@ -97,13 +97,13 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
}
public Object getValue(Class<?> targetType) {
- if(observableValue == null) {
+ if (observableValue == null) {
IObservableValue[] values = new IObservableValue[bindings.length];
- for(int i = 0; i < values.length; i++) {
+ for (int i = 0; i < values.length; i++) {
bindings[i].getValue(targetType);
IObservable observable = bindings[i].getObservableSource();
- if(observable instanceof IObservableValue) {
- values[i] = (IObservableValue)observable;
+ if (observable instanceof IObservableValue) {
+ values[i] = (IObservableValue) observable;
} else {
LoggerManager.log("Binding expression has a problem with " + bindings[i].getPath());
return null;
@@ -116,28 +116,28 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
IObservableValue observableWidget = getObservableWidget();
IDataProvider dataProvider = getDataProvider();
- if(dataProvider != null) {
+ if (dataProvider != null) {
BindingGate bindingGate = getBindingGate();
- if(bindingGate != null) {
+ if (bindingGate != null) {
Object target = getControl();
- if(target instanceof Text && getType().equalsIgnoreCase("text")) {
- if(isSourcePropertyReadOnly()) {
- Text text = (Text)target;
+ if (target instanceof Text && getType().equalsIgnoreCase("text")) {
+ if (isSourcePropertyReadOnly()) {
+ Text text = (Text) target;
text.setEditable(false);
}
- } else if(target instanceof Button && getType().equalsIgnoreCase("selection")) {
- if(isSourcePropertyReadOnly()) {
- Button button = (Button)target;
+ } else if (target instanceof Button && getType().equalsIgnoreCase("selection")) {
+ if (isSourcePropertyReadOnly()) {
+ Button button = (Button) target;
button.setEnabled(false);
}
- } else if((target instanceof Combo || target instanceof CCombo) && getType().equalsIgnoreCase("text")) {
- if(isSourcePropertyReadOnly()) {
- Control control = (Control)target;
+ } else if ((target instanceof Combo || target instanceof CCombo) && getType().equalsIgnoreCase("text")) {
+ if (isSourcePropertyReadOnly()) {
+ Control control = (Control) target;
control.setEnabled(false);
}
- } else if(target instanceof MenuItem && getType().equalsIgnoreCase("selection")) {
- if(isSourcePropertyReadOnly()) {
- MenuItem menuItem = (MenuItem)target;
+ } else if (target instanceof MenuItem && getType().equalsIgnoreCase("selection")) {
+ if (isSourcePropertyReadOnly()) {
+ MenuItem menuItem = (MenuItem) target;
menuItem.setEnabled(false);
}
}
@@ -145,14 +145,14 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
bindingGate.bind(observableValue, observableWidget, this);
}
- if(targetType == null || !targetType.isInstance(observableValue)) {
+ if (targetType == null || !targetType.isInstance(observableValue)) {
return observableValue.getValue();
}
return observableValue;
}
private BindingGate getBindingGate() {
- if(this.bindingGate == null) {
+ if (this.bindingGate == null) {
IBindingContext dataBindingContext = XWT.getBindingContext(getControl());
this.bindingGate = new BindingGate(dataBindingContext);
}
@@ -161,7 +161,7 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
}
public IObservableValue getObservableWidget() {
- if(observableWidget == null) {
+ if (observableWidget == null) {
Object target = getControl();
Object host = getHost();
try {
@@ -176,12 +176,12 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
Object control = getControl();
Object source = XWT.getDataContext(control);
Object localDataContext = UserData.getLocalDataContext(control);
- if(localDataContext == this) {
+ if (localDataContext == this) {
return source;
}
- if(source instanceof IDynamicBinding) {
- return ((IDynamicBinding)source).createBoundSource();
+ if (source instanceof IDynamicBinding) {
+ return ((IDynamicBinding) source).createBoundSource();
}
return source;
}
@@ -189,18 +189,18 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
public boolean isSourceControl() {
Object source = null;
Object dataContextHost = getDataContextHost();
- if(dataContextHost != null) {
+ if (dataContextHost != null) {
source = UserData.getLocalDataContext(dataContextHost);
}
- if(source instanceof IDynamicBinding) {
- return ((IDynamicBinding)source).isSourceControl();
+ if (source instanceof IDynamicBinding) {
+ return ((IDynamicBinding) source).isSourceControl();
}
return false;
}
public BindingExpressionPath getTargettPropertyExpression() {
- if(targetPropertySegments == null) {
+ if (targetPropertySegments == null) {
targetPropertySegments = new BindingExpressionPath(getType());
}
return targetPropertySegments;
@@ -215,7 +215,7 @@ public class MultiBinding extends DynamicBinding implements IDataBindingInfo {
}
public void reset() {
- for(Binding binding : bindings) {
+ for (Binding binding : bindings) {
binding.reset();
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeKeeper.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeKeeper.java
index ef5d159029c..c122c67989d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeKeeper.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeKeeper.java
@@ -46,23 +46,23 @@ public class ScopeKeeper implements DisposeListener {
private List<IChangeListener> changeListeners = Collections.emptyList();
public void handleChange(ChangeEvent event) {
- for(IChangeListener changeListener : changeListeners) {
+ for (IChangeListener changeListener : changeListeners) {
changeListener.handleChange(event);
}
// notify to parent as well.
Widget parent = UserData.getTreeParent(host);
ScopeKeeper scopeKeeper = UserData.findScopeKeeper(parent);
- if(scopeKeeper != null) {
+ if (scopeKeeper != null) {
scopeKeeper.fireChangeListener(event);
}
}
public boolean addChangeListener(IChangeListener listener) {
- if(changeListeners.contains(listener)) {
+ if (changeListeners.contains(listener)) {
return false;
}
- if(changeListeners == Collections.EMPTY_LIST) {
+ if (changeListeners == Collections.EMPTY_LIST) {
changeListeners = new ArrayList<IChangeListener>();
}
changeListeners.add(listener);
@@ -87,10 +87,10 @@ public class ScopeKeeper implements DisposeListener {
public void widgetDisposed(DisposeEvent e) {
Widget source = e.widget;
- if(source == host) {
- for(HashMap<Object, HashMap<String, IObservable>> hashMap : bindingData.values()) {
- for(HashMap<String, IObservable> map : hashMap.values()) {
- for(IObservable observable : map.values()) {
+ if (source == host) {
+ for (HashMap<Object, HashMap<String, IObservable>> hashMap : bindingData.values()) {
+ for (HashMap<String, IObservable> map : hashMap.values()) {
+ for (IObservable observable : map.values()) {
observable.removeChangeListener(changeListenerSupport);
}
}
@@ -98,9 +98,9 @@ public class ScopeKeeper implements DisposeListener {
changeListenerSupport.dispose();
}
HashMap<Object, HashMap<String, IObservable>> hashMap = bindingData.get(source);
- if(hashMap != null) {
- for(HashMap<String, IObservable> map : hashMap.values()) {
- for(IObservable observable : map.values()) {
+ if (hashMap != null) {
+ for (HashMap<String, IObservable> map : hashMap.values()) {
+ for (IObservable observable : map.values()) {
observable.removeChangeListener(changeListenerSupport);
}
}
@@ -118,7 +118,7 @@ public class ScopeKeeper implements DisposeListener {
public Object getNamedObject(String name) {
Object object = nameMap.get(name);
- if(object != null) {
+ if (object != null) {
return object;
}
return parent == null ? null : parent.getNamedObject(name);
@@ -129,7 +129,7 @@ public class ScopeKeeper implements DisposeListener {
}
public boolean containsName(String name) {
- if(nameMap.containsKey(name)) {
+ if (nameMap.containsKey(name)) {
return true;
}
return parent == null ? false : parent.containsName(name);
@@ -138,7 +138,7 @@ public class ScopeKeeper implements DisposeListener {
/**
* Register a change listener. The second call to register a same listener
* has no effect.
- *
+ *
* @param listener
*/
public boolean addChangeListener(IChangeListener listener) {
@@ -147,7 +147,7 @@ public class ScopeKeeper implements DisposeListener {
/**
* Remove the registered change listener
- *
+ *
* @param listener
*/
public void removeChangeListener(IChangeListener listener) {
@@ -159,24 +159,24 @@ public class ScopeKeeper implements DisposeListener {
}
void addObservableValue(Widget widget, Object data, String property, IObservable value) {
- if(widget == null) {
+ if (widget == null) {
widget = host;
} else {
widget.addDisposeListener(this);
}
HashMap<Object, HashMap<String, IObservable>> widgetData = bindingData.get(widget);
- if(widgetData == null) {
+ if (widgetData == null) {
widgetData = new HashMap<Object, HashMap<String, IObservable>>();
bindingData.put(widget, widgetData);
}
HashMap<String, IObservable> objectData = widgetData.get(data);
- if(objectData == null) {
+ if (objectData == null) {
objectData = new HashMap<String, IObservable>();
widgetData.put(data, objectData);
}
- if(objectData.containsKey(property)) {
+ if (objectData.containsKey(property)) {
throw new IllegalStateException();
}
objectData.put(property, value);
@@ -186,8 +186,8 @@ public class ScopeKeeper implements DisposeListener {
IObservableValue getObservableValue(Widget control, Object data, String property) {
IObservable observable = getObservable(control, data, property);
- if(observable instanceof IObservableValue) {
- return (IObservableValue)observable;
+ if (observable instanceof IObservableValue) {
+ return (IObservableValue) observable;
}
return null;
@@ -195,28 +195,28 @@ public class ScopeKeeper implements DisposeListener {
IObservableList getObservableList(Widget control, Object data, String property) {
IObservable observable = getObservable(control, data, property);
- if(observable instanceof IObservableList) {
- return (IObservableList)observable;
+ if (observable instanceof IObservableList) {
+ return (IObservableList) observable;
}
return null;
}
IObservableSet getObservableSet(Widget control, Object data, String property) {
IObservable observable = getObservable(control, data, property);
- if(observable instanceof IObservableSet) {
- return (IObservableSet)observable;
+ if (observable instanceof IObservableSet) {
+ return (IObservableSet) observable;
}
return null;
}
IObservable localGetObservable(Widget control, Object data, String property) {
// find locally
- for(HashMap<Object, HashMap<String, IObservable>> widgetData : bindingData.values()) {
- if(widgetData != null) {
+ for (HashMap<Object, HashMap<String, IObservable>> widgetData : bindingData.values()) {
+ if (widgetData != null) {
HashMap<String, IObservable> objectData = widgetData.get(data);
- if(objectData != null) {
+ if (objectData != null) {
IObservable observable = objectData.get(property);
- if(observable != null) {
+ if (observable != null) {
return observable;
}
}
@@ -228,14 +228,14 @@ public class ScopeKeeper implements DisposeListener {
IObservable getObservable(Widget control, Object data, String property) {
// find locally
IObservable observable = localGetObservable(control, data, property);
- if(observable != null) {
+ if (observable != null) {
return observable;
}
// find in other ScopeKeeper and then keep it in this ScopeKeeper.
Widget rootWidget = UserData.findRootWidget(control);
observable = deepFindObservable(rootWidget, data, property);
- if(observable != null) {
+ if (observable != null) {
addObservableValue(control, data, property, observable);
}
return observable;
@@ -243,17 +243,17 @@ public class ScopeKeeper implements DisposeListener {
static IObservable deepFindObservable(Widget control, Object data, String property) {
ScopeKeeper scopeKeeper = UserData.getLocalScopeKeeper(control);
- if(scopeKeeper != null) {
+ if (scopeKeeper != null) {
IObservable observable = scopeKeeper.localGetObservable(control, data, property);
- if(observable != null) {
+ if (observable != null) {
return observable;
}
}
- if(control instanceof Composite) {
- Composite composite = (Composite)control;
- for(Control child : composite.getChildren()) {
+ if (control instanceof Composite) {
+ Composite composite = (Composite) control;
+ for (Control child : composite.getChildren()) {
IObservable observable = deepFindObservable(child, data, property);
- if(observable != null) {
+ if (observable != null) {
return observable;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeManager.java
index 51496c5cb0b..cbe5598a4bb 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/ScopeManager.java
@@ -57,7 +57,7 @@ public class ScopeManager {
public static IObservableList observableList(Object control, Object value, String fullPath, UpdateSourceTrigger updateSourceTrigger) {
try {
- return (IObservableList)observe(control, value, fullPath, updateSourceTrigger, ScopeManager.LIST);
+ return (IObservableList) observe(control, value, fullPath, updateSourceTrigger, ScopeManager.LIST);
} catch (Exception e) {
}
return null;
@@ -65,7 +65,7 @@ public class ScopeManager {
public static IObservableSet observableSet(Object control, Object value, String fullPath, UpdateSourceTrigger updateSourceTrigger) {
try {
- return (IObservableSet)observe(control, value, fullPath, updateSourceTrigger, ScopeManager.SET);
+ return (IObservableSet) observe(control, value, fullPath, updateSourceTrigger, ScopeManager.SET);
} catch (Exception e) {
}
return null;
@@ -73,7 +73,7 @@ public class ScopeManager {
/**
* Reserved only for the calling from XWTLoader
- *
+ *
* @param context
* @param data
* @param propertyName
@@ -81,7 +81,7 @@ public class ScopeManager {
*/
public static IObservableValue findObservableValue(Object context, Object control, Object data, String propertyName) {
ScopeKeeper scope = UserData.findScopeKeeper(context);
- if(control == null) {
+ if (control == null) {
control = context;
}
return scope.getObservableValue(UserData.getWidget(control), data, propertyName);
@@ -89,7 +89,7 @@ public class ScopeManager {
/**
* Reserved only for the calling from XWTLoader
- *
+ *
* @param context
* @param data
* @param propertyName
@@ -97,7 +97,7 @@ public class ScopeManager {
*/
public static IObservableSet findObservableSet(Object context, Object control, Object data, String propertyName) {
ScopeKeeper scope = UserData.findScopeKeeper(context);
- if(control == null) {
+ if (control == null) {
control = context;
}
return scope.getObservableSet(UserData.getWidget(control), data, propertyName);
@@ -105,7 +105,7 @@ public class ScopeManager {
/**
* Reserved only for the calling from XWTLoader
- *
+ *
* @param context
* @param data
* @param propertyName
@@ -113,7 +113,7 @@ public class ScopeManager {
*/
public static IObservableList findObservableList(Object context, Object control, Object data, String propertyName) {
ScopeKeeper scope = UserData.findScopeKeeper(context);
- if(control == null) {
+ if (control == null) {
control = context;
}
return scope.getObservableList(UserData.getWidget(control), data, propertyName);
@@ -151,20 +151,20 @@ public class ScopeManager {
this.value = targetValue;
widget = UserData.getWidget(control);
ScopeKeeper scopeManager = UserData.findScopeKeeper(widget);
- if(scopeManager == null) {
+ if (scopeManager == null) {
return null;
}
- if(expressionPath.getFullPath() == null) {
- if(targetValue instanceof IObservable) {
- return (IObservable)targetValue;
+ if (expressionPath.getFullPath() == null) {
+ if (targetValue instanceof IObservable) {
+ return (IObservable) targetValue;
}
}
IObservable observable = scopeManager.getObservable(widget, value, expressionPath.getStripedPath());
- if(observable != null) {
- while(observable instanceof IObservableValue && ((IObservableValue)observable).getValue() instanceof IObservable) {
- observable = (IObservable)((IObservableValue)observable).getValue();
+ if (observable != null) {
+ while (observable instanceof IObservableValue && ((IObservableValue) observable).getValue() instanceof IObservable) {
+ observable = (IObservable) ((IObservableValue) observable).getValue();
}
return observable;
}
@@ -173,22 +173,22 @@ public class ScopeManager {
currentPath = null;
Object type = elementType;
String[] segments = expressionPath.getSegments();
- if(segments == null || segments.length == 0) {
+ if (segments == null || segments.length == 0) {
String segment = ModelUtils.normalizePropertyName(expressionPath.getFullPath());
observable = resolveObservablevalue(scopeManager, dataValue, type, segment);
} else {
- if(observeKind == COLLECTION) {
+ if (observeKind == COLLECTION) {
// if the first is viewers' property
- if(!JFaceXWTDataBinding.isViewerProperty(segments[0])) {
+ if (!JFaceXWTDataBinding.isViewerProperty(segments[0])) {
int kindValue = VALUE;
Object targetValueType = dataValue;
- if(dataValue instanceof IObservableValue) {
- targetValueType = ((IObservableValue)dataValue).getValueType();
+ if (dataValue instanceof IObservableValue) {
+ targetValueType = ((IObservableValue) dataValue).getValueType();
}
Object propertyType = dataProvider.getModelService().toModelPropertyType(targetValueType, segments[0]);
- if(propertyType instanceof Class<?>) {
- Class<?> propertyTypeClass = (Class<?>)propertyType;
- if(Collection.class.isAssignableFrom(propertyTypeClass) || propertyTypeClass.isArray()) {
+ if (propertyType instanceof Class<?>) {
+ Class<?> propertyTypeClass = (Class<?>) propertyType;
+ if (Collection.class.isAssignableFrom(propertyTypeClass) || propertyTypeClass.isArray()) {
kindValue = COLLECTION;
}
}
@@ -198,21 +198,21 @@ public class ScopeManager {
int size = segments.length;
int lastObserveKind = observeKind;
observeKind = VALUE;
- for(int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++) {
String segment = segments[i];
- if(i == (size - 1)) {
+ if (i == (size - 1)) {
observeKind = lastObserveKind;
}
observable = resolveObservablevalue(scopeManager, dataValue, type, segment);
// Hasan: As long as this is already an IObservableValue we
// should look deep into the chain
- while(observable instanceof IObservableValue && ((IObservableValue)observable).getValue() instanceof IObservable) {
- observable = (IObservable)((IObservableValue)observable).getValue();
+ while (observable instanceof IObservableValue && ((IObservableValue) observable).getValue() instanceof IObservable) {
+ observable = (IObservable) ((IObservableValue) observable).getValue();
}
dataValue = observable;
- if(i != size - 1) {
+ if (i != size - 1) {
type = dataProvider.getModelService().toModelType(dataValue);
- if(type != null) {
+ if (type != null) {
dataProvider = XWT.findDataProvider(type);
}
}
@@ -222,60 +222,60 @@ public class ScopeManager {
}
private IObservable resolveObservablevalue(ScopeKeeper scopeManager, Object dataValue, Object type, String segment) {
- if(!BindingExpressionPath.isEmptyPath(segment)) {
+ if (!BindingExpressionPath.isEmptyPath(segment)) {
int length = segment.length();
- if(length > 1 && segment.charAt(0) == '(' && segment.charAt(length - 1) == ')') {
+ if (length > 1 && segment.charAt(0) == '(' && segment.charAt(length - 1) == ')') {
// It is class
String path = segment.substring(1, segment.length() - 1);
int index = path.lastIndexOf('.');
- if(index != -1) {
+ if (index != -1) {
String className = path.substring(0, index);
segment = path.substring(index + 1);
type = dataProvider.getModelService().loadModelType(className);
- if(type == null) {
+ if (type == null) {
type = dataProvider.getModelService().loadModelType(path);
- if(type != null) {
+ if (type != null) {
segment = null;
}
}
- if(type == null) {
+ if (type == null) {
throw new XWTException("Class " + className + " not found");
}
dataProvider = XWT.findDataProvider(type);
}
}
}
- if(currentPath == null) {
+ if (currentPath == null) {
currentPath = segment;
- } else if(segment != null) {
+ } else if (segment != null) {
currentPath = currentPath + '.' + segment;
}
IObservable segmentValue = scopeManager.getObservableValue(widget, value, currentPath);
try {
- if(segmentValue == null) {
- if(segment != null) {
+ if (segmentValue == null) {
+ if (segment != null) {
segmentValue = createValueProperty(dataValue, segment, type);
- if(segmentValue == null) {
+ if (segmentValue == null) {
throw new XWTException(" Property " + segment + " is not found in " + expressionPath.getFullPath());
// maybe to
// raise an
// exception
}
scopeManager.addObservableValue(widget, value, currentPath, segmentValue);
- } else if(dataValue instanceof IObservable) {
- segmentValue = (IObservable)dataValue;
+ } else if (dataValue instanceof IObservable) {
+ segmentValue = (IObservable) dataValue;
}
- } else if(segment == null && type != null) {
- if(segmentValue instanceof TypedViewerObservableValueDecorator) {
- TypedViewerObservableValueDecorator typedViewerObservableValueDecorator = (TypedViewerObservableValueDecorator)segmentValue;
+ } else if (segment == null && type != null) {
+ if (segmentValue instanceof TypedViewerObservableValueDecorator) {
+ TypedViewerObservableValueDecorator typedViewerObservableValueDecorator = (TypedViewerObservableValueDecorator) segmentValue;
typedViewerObservableValueDecorator.setElementType(type);
}
}
} catch (IllegalArgumentException e) {
// Property is not found
String message = e.getMessage();
- if(!message.startsWith("Could not find property with name")) {
+ if (!message.startsWith("Could not find property with name")) {
throw e;
}
throw new XWTException(" Property " + segment + " is not found in " + expressionPath.getFullPath()); // maybe
@@ -290,44 +290,44 @@ public class ScopeManager {
protected IObservable createValueProperty(Object object, String propertyName, Object targetType) {
IObservable observable = null;
Object type = null;
- if(targetType == null) {
+ if (targetType == null) {
type = dataProvider.getModelService().toModelType(object);
} else {
type = targetType;
}
- if(UserData.getWidget(object) != null) {
+ if (UserData.getWidget(object) != null) {
observable = JFaceXWTDataBinding.observeWidget(object, propertyName, updateSourceTrigger, observeKind);
}
- if(observable == null && dataProvider instanceof IObjectDataProvider) {
+ if (observable == null && dataProvider instanceof IObjectDataProvider) {
IMetaclass mateclass = XWT.getMetaclass(type);
IProperty property = mateclass.findProperty(propertyName);
- if(property instanceof EventProperty) {
- observable = new EventPropertyObservableValue(object, (EventProperty)property);
+ if (property instanceof EventProperty) {
+ observable = new EventPropertyObservableValue(object, (EventProperty) property);
}
}
- if(observable != null) {
+ if (observable != null) {
return observable;
}
observable = dataProvider.observe(object, propertyName, type, observeKind);
- if(observable instanceof IObservableValue) {
- IObservableValue activeValue = (IObservableValue)observable;
+ if (observable instanceof IObservableValue) {
+ IObservableValue activeValue = (IObservableValue) observable;
Object valueType = activeValue.getValueType();
- if(valueType instanceof Class<?>) {
+ if (valueType instanceof Class<?>) {
// TODO maybe need to moved in IDataProvider
- Class<?> classType = (Class<?>)valueType;
- if(valueType != null && classType.isArray()) {
+ Class<?> classType = (Class<?>) valueType;
+ if (valueType != null && classType.isArray()) {
// Create a IObserableValue to handle the connection
// between
// Array and List
Object values = dataProvider.getData(propertyName);
ArrayList<Object> array = new ArrayList<Object>();
- if(values != null) {
- for(Object value : (Object[])values) {
+ if (values != null) {
+ for (Object value : (Object[]) values) {
array.add(value);
}
}
@@ -357,11 +357,11 @@ public class ScopeManager {
}
public static IObservableValue observeValue(Object control, Object value, BindingExpressionPath expressionPath, UpdateSourceTrigger updateSourceTrigger) {
- if(value == null) {
+ if (value == null) {
value = control;
}
ObservableValueBuilder builder = new ObservableValueBuilder(control, null, expressionPath, updateSourceTrigger, ScopeManager.VALUE);
- return (IObservableValue)builder.observe(value);
+ return (IObservableValue) builder.observe(value);
}
public static IObservable observe(Object control, Object value, BindingExpressionPath expressionPath, UpdateSourceTrigger updateSourceTrigger) {
@@ -377,7 +377,7 @@ public class ScopeManager {
}
public static IObservable observe(Object control, Object value, BindingExpressionPath expressionPath, UpdateSourceTrigger updateSourceTrigger, int observeKind) {
- if(value == null) {
+ if (value == null) {
value = control;
}
ObservableValueBuilder builder = new ObservableValueBuilder(control, null, expressionPath, updateSourceTrigger, observeKind);
@@ -386,20 +386,20 @@ public class ScopeManager {
public static IObservableValue observeValue(Object control, Object value, Class<?> type, BindingExpressionPath expressionPath, UpdateSourceTrigger updateSourceTrigger) {
ObservableValueBuilder builder = new ObservableValueBuilder(control, type, expressionPath, updateSourceTrigger, ScopeManager.VALUE);
- return (IObservableValue)builder.observe(value);
+ return (IObservableValue) builder.observe(value);
}
public static IValueProperty createValueProperty(Object control, Object type, BindingExpressionPath expressionPath) {
IValueProperty valueProperty = null;
String[] segments = expressionPath.getSegments();
- if(segments == null || segments.length == 0) {
+ if (segments == null || segments.length == 0) {
String segment = expressionPath.getFullPath();
valueProperty = doCreateValueProperty(type, segment);
} else {
- for(String segment : segments) {
+ for (String segment : segments) {
IValueProperty segmentValueProperty = doCreateValueProperty(type, segment);
- if(valueProperty == null) {
+ if (valueProperty == null) {
valueProperty = segmentValueProperty;
} else {
valueProperty = valueProperty.value(segmentValueProperty);
@@ -418,7 +418,7 @@ public class ScopeManager {
/**
* Reserved only for the calling from XWTLoader
- *
+ *
* @param context
* @param data
* @param propertyName
@@ -426,25 +426,25 @@ public class ScopeManager {
*/
public static boolean isPropertyReadOnly(IDataProvider dataProvider, BindingExpressionPath expressionPath) {
String[] segments = expressionPath.getSegments();
- if(segments == null || segments.length == 0) {
+ if (segments == null || segments.length == 0) {
String segment = expressionPath.getFullPath();
return dataProvider.isPropertyReadOnly(segment);
} else {
Object type = null;
int last = segments.length - 1;
- for(int i = 0; i < last; i++) {
+ for (int i = 0; i < last; i++) {
String segment = segments[i];
int length = segment.length();
- if(length > 1 && segment.charAt(0) == '(' && segment.charAt(length - 1) == ')') {
+ if (length > 1 && segment.charAt(0) == '(' && segment.charAt(length - 1) == ')') {
// It is class
String path = segment.substring(1, segment.length() - 1);
int index = path.lastIndexOf('.');
- if(index != -1) {
+ if (index != -1) {
String className = path.substring(0, index);
segment = path.substring(index + 1);
type = dataProvider.getModelService().loadModelType(className);
- if(type == null) {
+ if (type == null) {
throw new XWTException("Class " + className + " not found");
}
dataProvider = XWT.findDataProvider(type);
@@ -453,9 +453,9 @@ public class ScopeManager {
type = dataProvider.getDataType(segment);
- if(type != null) {
+ if (type != null) {
dataProvider = XWT.findDataProvider(type);
- if(dataProvider == null) {
+ if (dataProvider == null) {
throw new XWTException("Data probider is not found for the type " + type.toString());
}
} else {
@@ -465,15 +465,15 @@ public class ScopeManager {
String segment = segments[last];
int length = segment.length();
- if(length > 1 && segment.charAt(0) == '(' && segment.charAt(length - 1) == ')') {
+ if (length > 1 && segment.charAt(0) == '(' && segment.charAt(length - 1) == ')') {
// It is class
String path = segment.substring(1, segment.length() - 1);
int index = path.lastIndexOf('.');
- if(index != -1) {
+ if (index != -1) {
String className = path.substring(0, index);
segment = path.substring(index + 1);
type = dataProvider.getModelService().loadModelType(className);
- if(type == null) {
+ if (type == null) {
throw new XWTException("Class " + className + " not found");
}
dataProvider = XWT.findDataProvider(type);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/UpdateSourceTrigger.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/UpdateSourceTrigger.java
index 399a682aab8..373f6ff7439 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/UpdateSourceTrigger.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/core/UpdateSourceTrigger.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,12 +15,10 @@ package org.eclipse.papyrus.xwt.internal.core;
* Default
* </p>
* <p>
- * The default UpdateSourceTrigger value of the binding target property. The default value for most dependency properties is PropertyChanged, while
- * the Text property has a default value of LostFocus.
+ * The default UpdateSourceTrigger value of the binding target property. The default value for most dependency properties is PropertyChanged, while the Text property has a default value of LostFocus.
* </p>
* <p>
- * A programmatic way to determine the default UpdateSourceTrigger value of a dependency property is to get the property metadata of the property
- * using GetMetadata and then check the value of the DefaultUpdateSourceTrigger property.
+ * A programmatic way to determine the default UpdateSourceTrigger value of a dependency property is to get the property metadata of the property using GetMetadata and then check the value of the DefaultUpdateSourceTrigger property.
* </p>
* <p/>
* <p>
@@ -36,9 +34,9 @@ package org.eclipse.papyrus.xwt.internal.core;
* <p>
* Updates the binding source whenever the binding target element loses focus.
* </p>
- *
+ *
* @author yyang
- *
+ *
*/
public enum UpdateSourceTrigger {
Default, PropertyChanged, LostFocus;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/AbstractMenuItemObservableValue.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/AbstractMenuItemObservableValue.java
index e6eb29617ad..1d94deb91f9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/AbstractMenuItemObservableValue.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/AbstractMenuItemObservableValue.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.internal.databinding.menuitem;
@@ -18,7 +18,7 @@ import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.MenuItem;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public abstract class AbstractMenuItemObservableValue extends AbstractObservableValue {
@@ -27,7 +27,7 @@ public abstract class AbstractMenuItemObservableValue extends AbstractObservable
/**
* Standard constructor for a MenuItem ObservableValue. Makes sure that the observable gets disposed when the MenuItem is disposed.
- *
+ *
* @param widget
*/
protected AbstractMenuItemObservableValue(MenuItem menuItem) {
@@ -36,7 +36,7 @@ public abstract class AbstractMenuItemObservableValue extends AbstractObservable
/**
* Constructor that allows for the setting of the realm. Makes sure that the observable gets disposed when the MenuItem is disposed.
- *
+ *
* @param realm
* @param widget
* @since 1.2
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemEnabledObservableValue.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemEnabledObservableValue.java
index decf0505e80..d9fcd47cee1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemEnabledObservableValue.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemEnabledObservableValue.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.internal.databinding.menuitem;
@@ -14,7 +14,7 @@ import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.swt.widgets.MenuItem;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class MenuItemEnabledObservableValue extends AbstractMenuItemObservableValue {
@@ -36,7 +36,8 @@ public class MenuItemEnabledObservableValue extends AbstractMenuItemObservableVa
return Boolean.class;
}
+ @Override
protected void doSetValue(Object value) {
- getMenuItem().setEnabled((Boolean)value);
+ getMenuItem().setEnabled((Boolean) value);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemSelectionObservableValue.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemSelectionObservableValue.java
index a3efcb2b0fe..9e4f05d0a75 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemSelectionObservableValue.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/databinding/menuitem/MenuItemSelectionObservableValue.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.internal.databinding.menuitem;
@@ -14,7 +14,7 @@ import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.swt.widgets.MenuItem;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class MenuItemSelectionObservableValue extends AbstractMenuItemObservableValue {
@@ -36,7 +36,8 @@ public class MenuItemSelectionObservableValue extends AbstractMenuItemObservable
return Boolean.class;
}
+ @Override
protected void doSetValue(Object value) {
- getMenuItem().setSelection((Boolean)value);
+ getMenuItem().setSelection((Boolean) value);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ClassLoaderUtil.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ClassLoaderUtil.java
index 577d6f4c2a0..14c89d7e9df 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ClassLoaderUtil.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ClassLoaderUtil.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -21,22 +21,22 @@ import org.eclipse.papyrus.xwt.internal.xml.Element;
public class ClassLoaderUtil {
- static final String[] DefaultPackages = new String[]{
- /*
- * UIElement.class.getPackage().getName(), Validation.class.getPackage().getName(), Timeline.class.getPackage().getName(),
- * Binding.class.getPackage().getName(),
- */};
+ static final String[] DefaultPackages = new String[] {
+ /*
+ * UIElement.class.getPackage().getName(), Validation.class.getPackage().getName(), Timeline.class.getPackage().getName(),
+ * Binding.class.getPackage().getName(),
+ */};
static public Class<?> loadClass(ILoadingContext loadingContext, String className) {
Class<?> type = doLoadClass(loadingContext, className);
- if(type != null) {
+ if (type != null) {
return type;
}
int index = className.indexOf('.');
- if(index == -1) {
- for(String packageName : DefaultPackages) {
+ if (index == -1) {
+ for (String packageName : DefaultPackages) {
type = doLoadClass(loadingContext, packageName + "." + className);
- if(type != null) {
+ if (type != null) {
return type;
}
}
@@ -46,7 +46,7 @@ public class ClassLoaderUtil {
private static Class<?> doLoadClass(ILoadingContext loadingContext, String className) {
Class<?> type = loadingContext.loadClass(className);
- if(type != null) {
+ if (type != null) {
return type;
}
try {
@@ -65,14 +65,14 @@ public class ClassLoaderUtil {
try {
Field field = type.getField(memberName);
- if(raiseException && !Modifier.isStatic(field.getModifiers())) {
+ if (raiseException && !Modifier.isStatic(field.getModifiers())) {
throw new IllegalStateException(type.getName() + "." + memberName + " is not static member.");
}
return field.get(null);
} catch (Exception e) {
- if(e instanceof NoSuchFieldException) {
+ if (e instanceof NoSuchFieldException) {
Method method = ObjectUtil.findGetter(type, memberName, null);
- if(raiseException && (method == null || !Modifier.isStatic(method.getModifiers()))) {
+ if (raiseException && (method == null || !Modifier.isStatic(method.getModifiers()))) {
throw new IllegalStateException(type.getName() + "." + memberName + " is not static member.");
}
try {
@@ -81,7 +81,7 @@ public class ClassLoaderUtil {
e = exception;
}
}
- if(raiseException) {
+ if (raiseException) {
e.printStackTrace();
throw new IllegalStateException(e);
}
@@ -93,19 +93,19 @@ public class ClassLoaderUtil {
String name = element.getName();
String namespace = element.getNamespace();
Object value = doLoadMember(loadingContext, name, namespace);
- if(value != null) {
+ if (value != null) {
return value;
}
String content = element.getContent();
- if(content == null) {
+ if (content == null) {
DocumentObject member = element.getAttribute(IConstants.XWT_NAMESPACE, IConstants.XAML_X_STATIC_MEMBER);
- if(member == null) {
+ if (member == null) {
member = element;
}
- if(member != null) {
+ if (member != null) {
content = member.getContent();
- if(content == null) {
- for(DocumentObject documentObject : member.getChildren()) {
+ if (content == null) {
+ for (DocumentObject documentObject : member.getChildren()) {
String ns = documentObject.getNamespace();
String n = documentObject.getName();
return doLoadMember(loadingContext, n, ns);
@@ -113,7 +113,7 @@ public class ClassLoaderUtil {
}
}
} else {
- if(IConstants.XAML_X_STATIC.equals(name) && IConstants.XWT_X_NAMESPACE.equals(namespace)) {
+ if (IConstants.XAML_X_STATIC.equals(name) && IConstants.XWT_X_NAMESPACE.equals(namespace)) {
namespace = IConstants.XWT_NAMESPACE;
return doLoadMember(loadingContext, content, namespace);
}
@@ -124,7 +124,7 @@ public class ClassLoaderUtil {
protected static Object doLoadMember(ILoadingContext loadingContext, String name, String namespace) {
int lastIndex = name.lastIndexOf('.');
- if(lastIndex == -1) {
+ if (lastIndex == -1) {
throw new IllegalStateException("Separator '.' is missing in:" + name);
}
String className = name.substring(0, lastIndex);
@@ -132,7 +132,7 @@ public class ClassLoaderUtil {
try {
Class<?> type = NamespaceHelper.loadCLRClass(loadingContext, className, namespace);
- if(type != null) {
+ if (type != null) {
return ClassLoaderUtil.loadMember(loadingContext, type, memberName, true);
}
} catch (ClassNotFoundException e) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/DocumentObjectSorter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/DocumentObjectSorter.java
index 9330cfb1b2e..03b4e8bdb01 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/DocumentObjectSorter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/DocumentObjectSorter.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.internal.utils;
@@ -28,29 +28,29 @@ public class DocumentObjectSorter {
public static List<DocumentObject> sortWithAttr(DocumentObject[] sourceArray, Comparator<Element> comparator, String attrName) {
List<DocumentObject> columnsList = new LinkedList<DocumentObject>();
- for(DocumentObject column : sourceArray) {
- Element columnElement = (Element)column;
+ for (DocumentObject column : sourceArray) {
+ Element columnElement = (Element) column;
Attribute indexAttr = columnElement.getAttribute(attrName);
- if(indexAttr == null) {
+ if (indexAttr == null) {
columnsList.add(column);
}
}
List<Element> tempList = new LinkedList<Element>();
- for(DocumentObject column : sourceArray) {
- Element columnElement = (Element)column;
+ for (DocumentObject column : sourceArray) {
+ Element columnElement = (Element) column;
Attribute indexAttr = columnElement.getAttribute(attrName);
- if(indexAttr != null) {
+ if (indexAttr != null) {
tempList.add(columnElement);
}
}
- if(comparator == null) {
+ if (comparator == null) {
comparator = new AttrComparator(attrName);
}
Collections.sort(tempList, comparator);
- for(Element columnElement : tempList) {
+ for (Element columnElement : tempList) {
Attribute indexAttr = columnElement.getAttribute(attrName);
try {
int index = Integer.parseInt(indexAttr.getContent());
@@ -78,7 +78,7 @@ public class DocumentObjectSorter {
Attribute attr2 = e2.getAttribute(attrName);
String compare1 = attr1.getContent();
String compare2 = attr2.getContent();
- if(compare1 == null || compare2 == null) {
+ if (compare1 == null || compare2 == null) {
return 0;
}
try {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/LoggerManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/LoggerManager.java
index 9f70cc9512f..1ecbfbbed14 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/LoggerManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/LoggerManager.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ import java.util.logging.Logger;
/**
* Logger Manager.
- *
+ *
* @author jliu
*/
public class LoggerManager {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/NamespaceHelper.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/NamespaceHelper.java
index 553340a1eb7..e64a71306d1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/NamespaceHelper.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/NamespaceHelper.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -17,24 +17,24 @@ public class NamespaceHelper {
static public Class<?> loadCLRClass(ILoadingContext loadingContext, String name, String namespace) throws ClassNotFoundException {
// xmlns:custom="clr-namespace:SDKSample;assembly=SDKSampleLibrary"
- if(namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
+ if (namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
String contentSegment = namespace.substring(IConstants.XAML_CLR_NAMESPACE_PROTO.length());
String packageName = contentSegment;
String assembly = null;
int index = contentSegment.indexOf(";");
- if(index != -1) {
+ if (index != -1) {
packageName = contentSegment.substring(0, index);
contentSegment = contentSegment.substring(index + 1);
- if(contentSegment.startsWith(IConstants.XAML_CLR_ASSEMBLY)) {
+ if (contentSegment.startsWith(IConstants.XAML_CLR_ASSEMBLY)) {
assembly = contentSegment.substring(IConstants.XAML_CLR_ASSEMBLY.length());
} else {
throw new IllegalStateException(IConstants.XAML_CLR_ASSEMBLY);
}
}
- if(assembly != null) {
+ if (assembly != null) {
// TODO Load jar using URLClassLoader
}
- if(packageName != null && packageName.length() > 0) {
+ if (packageName != null && packageName.length() > 0) {
name = packageName + "." + name;
}
return ClassLoaderUtil.loadClass(loadingContext, name);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObjectUtil.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObjectUtil.java
index 227a54ae30d..2e3449788bf 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObjectUtil.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObjectUtil.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -22,7 +22,7 @@ import org.eclipse.papyrus.xwt.XWT;
/**
* Object Tools.
- *
+ *
* @author yyang (yves.yang@soyatec.com)
* @version 1.0
*/
@@ -34,23 +34,23 @@ public class ObjectUtil {
}
public static Class<?> normalizedType(Class<?> type) {
- if(type == int.class) {
+ if (type == int.class) {
return Integer.class;
}
- if(type == double.class) {
+ if (type == double.class) {
return Double.class;
}
- if(type == float.class) {
+ if (type == float.class) {
return Float.class;
}
- if(type == boolean.class) {
+ if (type == boolean.class) {
return Boolean.class;
}
return type;
}
public static boolean isAssignableFrom(Class<?> source, Class<?> target) {
- if(normalizedType(source) == normalizedType(target)) {
+ if (normalizedType(source) == normalizedType(target)) {
return true;
}
return source.isAssignableFrom(target);
@@ -58,9 +58,9 @@ public class ObjectUtil {
/**
* Find the compatible class. This includes superclasses, interfaces and so on.
- *
+ *
* @param clazz
- * the specified class.
+ * the specified class.
* @return Returns the class array includes its superclasses, interfaces and itself.
*/
public static final Class<?>[] findCompatibleClasses(Class<?> clazz) {
@@ -70,37 +70,37 @@ public class ObjectUtil {
classes.add(clazz);
// Add primitive compatible type
- if(clazz == Boolean.class) {
+ if (clazz == Boolean.class) {
classes.add(boolean.class);
- } else if(clazz == Byte.class) {
+ } else if (clazz == Byte.class) {
classes.add(byte.class);
- } else if(clazz == Short.class) {
+ } else if (clazz == Short.class) {
classes.add(short.class);
- } else if(clazz == Integer.class) {
+ } else if (clazz == Integer.class) {
classes.add(int.class);
- } else if(clazz == Long.class) {
+ } else if (clazz == Long.class) {
classes.add(long.class);
- } else if(clazz == Float.class) {
+ } else if (clazz == Float.class) {
classes.add(float.class);
- } else if(clazz == Double.class) {
+ } else if (clazz == Double.class) {
classes.add(double.class);
- } else if(clazz == Character.class) {
+ } else if (clazz == Character.class) {
classes.add(char.class);
- } else if(clazz == boolean.class) {
+ } else if (clazz == boolean.class) {
classes.add(Boolean.class);
- } else if(clazz == byte.class) {
+ } else if (clazz == byte.class) {
classes.add(Byte.class);
- } else if(clazz == short.class) {
+ } else if (clazz == short.class) {
classes.add(Short.class);
- } else if(clazz == int.class) {
+ } else if (clazz == int.class) {
classes.add(Integer.class);
- } else if(clazz == long.class) {
+ } else if (clazz == long.class) {
classes.add(Long.class);
- } else if(clazz == float.class) {
+ } else if (clazz == float.class) {
classes.add(Float.class);
- } else if(clazz == double.class) {
+ } else if (clazz == double.class) {
classes.add(Double.class);
- } else if(clazz == char.class) {
+ } else if (clazz == char.class) {
classes.add(Character.class);
}
@@ -122,7 +122,7 @@ public class ObjectUtil {
public static Object resolveValue(Object value, Class<?> sourceType, Class<?> targetType, Object defaultValue) {
IConverter converter = XWT.findConvertor(sourceType, targetType);
- if(converter != null) {
+ if (converter != null) {
return converter.convert(value);
}
return defaultValue;
@@ -130,31 +130,31 @@ public class ObjectUtil {
/**
* Find compatible constructor for specified class.
- *
+ *
* @param clazz
- * the specified class.
+ * the specified class.
* @param argumentTypes
- * constructor argument types.
+ * constructor argument types.
* @return Returns constructor instance. If snot find, returns null.
*/
public static final Constructor<?> findConstructor(Class<?> clazz, Class<?>... argumentTypes) {
Class<?>[][] classesArray = new Class[argumentTypes.length][];
- for(int i = 0, len = argumentTypes.length; i < len; i++) {
+ for (int i = 0, len = argumentTypes.length; i < len; i++) {
Class<?>[] classes = findCompatibleClasses(argumentTypes[i]);
classesArray[i] = classes;
}
int totalPossibles = 1;
- for(int i = 0; i < classesArray.length; i++) {
+ for (int i = 0; i < classesArray.length; i++) {
totalPossibles *= classesArray[i].length;
}
List<Class<?>[]> classList = new ArrayList<Class<?>[]>(totalPossibles);
computeArguments(classList, classesArray, new Class[classesArray.length], 0);
- for(Class<?>[] arguments : classList) {
+ for (Class<?>[] arguments : classList) {
try {
return clazz.getConstructor(arguments);
} catch (NoSuchMethodException e) {
@@ -167,35 +167,35 @@ public class ObjectUtil {
/**
* Find compatible public method for specified class.
- *
+ *
* @param clazz
- * the specified class.
+ * the specified class.
* @param name
- * method name.
+ * method name.
* @param argumentTypes
- * method argument types. If it is a null value, system will find method without argument types.
+ * method argument types. If it is a null value, system will find method without argument types.
* @return Returns method instance. If not find, returns null.
*/
public static final Method findMethod(Class<?> clazz, String name, Class<?>... argumentTypes) {
- if(argumentTypes != null && argumentTypes.length > 0) {
+ if (argumentTypes != null && argumentTypes.length > 0) {
Class<?>[][] classesArray = new Class[argumentTypes.length][];
- for(int i = 0, len = argumentTypes.length; i < len; i++) {
+ for (int i = 0, len = argumentTypes.length; i < len; i++) {
Class<?>[] classes = findCompatibleClasses(argumentTypes[i]);
classesArray[i] = classes;
}
int totalPossibles = 1;
- for(int i = 0; i < classesArray.length; i++) {
+ for (int i = 0; i < classesArray.length; i++) {
totalPossibles *= classesArray[i].length;
}
List<Class<?>[]> classList = new ArrayList<Class<?>[]>(totalPossibles);
computeArguments(classList, classesArray, new Class[classesArray.length], 0);
- for(Class<?>[] arguments : classList) {
+ for (Class<?>[] arguments : classList) {
try {
return clazz.getDeclaredMethod(name, arguments);
} catch (NoSuchMethodException e) {
@@ -207,8 +207,8 @@ public class ObjectUtil {
// find method without argument types;
Method[] methods = clazz.getMethods();
- for(Method method : methods) {
- if(method.getName().equals(name)) {
+ for (Method method : methods) {
+ if (method.getName().equals(name)) {
return method;
}
}
@@ -219,35 +219,35 @@ public class ObjectUtil {
/**
* Find compatible method for specified class.
- *
+ *
* @param clazz
- * the specified class.
+ * the specified class.
* @param name
- * method name.
+ * method name.
* @param argumentTypes
- * method argument types. If it is a null value, system will find method without argument types.
+ * method argument types. If it is a null value, system will find method without argument types.
* @return Returns method instance. If not find, returns null.
*/
public static final Method findDeclaredMethod(Class<?> clazz, String name, Class<?>... argumentTypes) {
- if(argumentTypes != null && argumentTypes.length > 0) {
+ if (argumentTypes != null && argumentTypes.length > 0) {
Class<?>[][] classesArray = new Class[argumentTypes.length][];
- for(int i = 0, len = argumentTypes.length; i < len; i++) {
+ for (int i = 0, len = argumentTypes.length; i < len; i++) {
Class<?>[] classes = findCompatibleClasses(argumentTypes[i]);
classesArray[i] = classes;
}
int totalPossibles = 1;
- for(int i = 0; i < classesArray.length; i++) {
+ for (int i = 0; i < classesArray.length; i++) {
totalPossibles *= classesArray[i].length;
}
List<Class<?>[]> classList = new ArrayList<Class<?>[]>(totalPossibles);
computeArguments(classList, classesArray, new Class[classesArray.length], 0);
- for(Class<?>[] arguments : classList) {
+ for (Class<?>[] arguments : classList) {
try {
return clazz.getDeclaredMethod(name, arguments);
} catch (NoSuchMethodException e) {
@@ -258,14 +258,14 @@ public class ObjectUtil {
// find method without argument types;
Method[] methods = clazz.getDeclaredMethods();
- for(Method method : methods) {
- if(method.getName().equals(name) && method.getParameterTypes().length == 0) {
+ for (Method method : methods) {
+ if (method.getName().equals(name) && method.getParameterTypes().length == 0) {
return method;
}
}
}
Class<?> superclass = clazz.getSuperclass();
- if(superclass != null) {
+ if (superclass != null) {
return findDeclaredMethod(superclass, name, argumentTypes);
}
@@ -274,17 +274,17 @@ public class ObjectUtil {
/**
* Find property getter method for specified class.
- *
+ *
* @param clazz
- * the specified class.
+ * the specified class.
* @param name
- * property name
+ * property name
* @param type
- * property type. If it is a null value, system will find the suitable method.
+ * property type. If it is a null value, system will find the suitable method.
* @return Returns method instance. If not find, returns null.
*/
public static final Method findGetter(Class<?> clazz, String name, Class<?> type) {
- if(name == null || name.length() == 0) {
+ if (name == null || name.length() == 0) {
throw new IllegalArgumentException("Invalid getter method name, null value found");
}
@@ -292,7 +292,7 @@ public class ObjectUtil {
Method method;
try {
- if(clazz.isEnum()) {
+ if (clazz.isEnum()) {
method = clazz.getClass().getMethod(getterName, EMPTY);
} else {
method = clazz.getMethod(getterName, EMPTY);
@@ -303,7 +303,7 @@ public class ObjectUtil {
getterName = "is" + name.substring(0, 1).toUpperCase() + name.substring(1);
try {
method = clazz.getMethod(getterName, EMPTY);
- if(method.getReturnType() != Boolean.class && method.getReturnType() != boolean.class) {
+ if (method.getReturnType() != Boolean.class && method.getReturnType() != boolean.class) {
return null;
}
} catch (NoSuchMethodException e2) {
@@ -312,14 +312,14 @@ public class ObjectUtil {
// :~
}
- if(type == null) {
+ if (type == null) {
return method;
} else {
- if(method != null) {
+ if (method != null) {
Class<?> returnType = method.getReturnType();
Class<?>[] types = findCompatibleClasses(type);
- for(Class<?> t : types) {
- if(t == returnType) {
+ for (Class<?> t : types) {
+ if (t == returnType) {
return method;
}
}
@@ -333,14 +333,14 @@ public class ObjectUtil {
String getterName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
String isName = "is" + name.substring(0, 1).toUpperCase() + name.substring(1);
- for(Method element : clazz.getMethods()) {
- if(element.getParameterTypes().length != 0) {
+ for (Method element : clazz.getMethods()) {
+ if (element.getParameterTypes().length != 0) {
continue;
}
- if(element.getName().equalsIgnoreCase(getterName)) {
+ if (element.getName().equalsIgnoreCase(getterName)) {
return element;
}
- if(element.getName().equalsIgnoreCase(isName) && element.getReturnType() != Boolean.class && element.getReturnType() != boolean.class) {
+ if (element.getName().equalsIgnoreCase(isName) && element.getReturnType() != Boolean.class && element.getReturnType() != boolean.class) {
return element;
}
}
@@ -351,10 +351,10 @@ public class ObjectUtil {
* Find superclasses and add them to list.
*/
private static void findSuperClasses(Set<Class<?>> list, Class<?> clazz) {
- if(clazz != null) {
+ if (clazz != null) {
Class<?> superClass = clazz.getSuperclass();
- if(superClass != Object.class) {
+ if (superClass != Object.class) {
list.add(superClass);
findInterfaces(list, superClass);
@@ -368,10 +368,10 @@ public class ObjectUtil {
* Find interfaces and add them to list.
*/
private static void findInterfaces(Set<Class<?>> list, Class<?> clazz) {
- if(clazz != null) {
+ if (clazz != null) {
Class<?>[] interfaces = clazz.getInterfaces();
- for(Class<?> interfac1 : interfaces) {
+ for (Class<?> interfac1 : interfaces) {
list.add(interfac1);
findInterfaces(list, interfac1);
}
@@ -382,16 +382,16 @@ public class ObjectUtil {
* Combine arithmetic.
*/
private static void computeArguments(List<Class<?>[]> list, Class<?>[][] arguments, Class<?>[] buffer, int start) {
- if(start >= arguments.length) {
+ if (start >= arguments.length) {
Class<?>[] classes = new Class<?>[arguments.length];
- for(int i = 0; i < arguments.length; ++i) {
+ for (int i = 0; i < arguments.length; ++i) {
classes[i] = buffer[i];
}
list.add(classes);
return;
}
- for(int i = 0; i < arguments[start].length; ++i) {
+ for (int i = 0; i < arguments[start].length; ++i) {
buffer[start] = arguments[start][i];
computeArguments(list, arguments, buffer, start + 1);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObservableValueManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObservableValueManager.java
index 26e8b359e0b..56fc585feb0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObservableValueManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/ObservableValueManager.java
@@ -37,12 +37,12 @@ public class ObservableValueManager implements IObservableValueListener {
}
public void changeValueHandle(Object object, Event event) {
- // TODO the cast is not clean.
- EventProperty property = (EventProperty)object;
+ // TODO the cast is not clean.
+ EventProperty property = (EventProperty) object;
IObservableValue value = map.get(property.getName());
- if(value != null) {
- Boolean oldValue = (Boolean)value.getValue();
- if(oldValue == null) {
+ if (value != null) {
+ Boolean oldValue = (Boolean) value.getValue();
+ if (oldValue == null) {
oldValue = false;
}
value.setValue(!oldValue);
@@ -53,31 +53,31 @@ public class ObservableValueManager implements IObservableValueListener {
// TODO this conversion should be simplied
String eventName = ModelUtils.normalizePropertyName(property.getEvent().getName());
IEventGroup eventGroup = metaclass.getEventGroup(eventName);
- if(eventGroup != null) {
+ if (eventGroup != null) {
eventGroup.fireEvent(this, property);
}
}
public void registerValue(IProperty property, IObservableValue observableValue) {
- if(map == null) {
+ if (map == null) {
map = new HashMap<String, IObservableValue>();
}
map.put(property.getName(), observableValue);
IMetaclass metaclass = XWT.getMetaclass(host);
- // TODO it is not clean.
- EventProperty eventProperty = (EventProperty)property;
+ // TODO it is not clean.
+ EventProperty eventProperty = (EventProperty) property;
// TODO this conversion should be simplied
String eventName = ModelUtils.normalizePropertyName(eventProperty.getEvent().getName());
IEventGroup eventGroup = metaclass.getEventGroup(eventName);
- if(eventGroup != null) {
+ if (eventGroup != null) {
eventGroup.registerEvent(this, property);
}
}
public IObservableValue getValue(IProperty property) {
- if(map == null) {
+ if (map == null) {
return null;
}
return map.get(property.getName());
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/TableEditorHelper.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/TableEditorHelper.java
index 10c974074a2..721a3ac0840 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/TableEditorHelper.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/TableEditorHelper.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.internal.utils;
@@ -23,8 +23,8 @@ import org.eclipse.swt.widgets.Text;
public class TableEditorHelper {
public static void initEditor(final TableItem tableItem, Control editor, final int column) {
- if(editor instanceof Text) {
- final Text text = (Text)editor;
+ if (editor instanceof Text) {
+ final Text text = (Text) editor;
text.setText(tableItem.getText(column));
text.addModifyListener(new ModifyListener() {
@@ -32,8 +32,8 @@ public class TableEditorHelper {
tableItem.setText(column, text.getText());
}
});
- } else if(editor instanceof CCombo) {
- final CCombo combo = (CCombo)editor;
+ } else if (editor instanceof CCombo) {
+ final CCombo combo = (CCombo) editor;
combo.setText(tableItem.getText(column));
combo.addSelectionListener(new SelectionListener() {
@@ -45,8 +45,8 @@ public class TableEditorHelper {
tableItem.setText(column, combo.getItem(combo.getSelectionIndex()));
}
});
- } else if(editor instanceof Combo) {
- final Combo combo = (Combo)editor;
+ } else if (editor instanceof Combo) {
+ final Combo combo = (Combo) editor;
combo.setText(tableItem.getText(column));
combo.addSelectionListener(new SelectionListener() {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/UserData.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/UserData.java
index 1c7c7e05275..17c38a32cbc 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/UserData.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/utils/UserData.java
@@ -67,47 +67,47 @@ public class UserData {
}
public void setData(Object key, Object value) {
- if(dictionary == null) {
+ if (dictionary == null) {
dictionary = new HashMap<Object, Object>();
}
dictionary.put(key, value);
- if(observableValueManager != null && (key instanceof IProperty)) {
- IObservableValue observableValue = observableValueManager.getValue((IProperty)key);
+ if (observableValueManager != null && (key instanceof IProperty)) {
+ IObservableValue observableValue = observableValueManager.getValue((IProperty) key);
observableValue.setValue(value);
}
}
public Object getData(Object key) {
- if(dictionary == null) {
+ if (dictionary == null) {
return null;
}
return dictionary.get(key);
}
public Object removeData(Object key) {
- if(dictionary == null) {
+ if (dictionary == null) {
return null;
}
return dictionary.remove(key);
}
public boolean containsKey(Object key) {
- if(dictionary == null) {
+ if (dictionary == null) {
return false;
}
return dictionary.containsKey(key);
}
public Collection<Object> keySet() {
- if(dictionary == null) {
+ if (dictionary == null) {
return Collections.emptyList();
}
return dictionary.keySet();
}
public static boolean isUIElementType(Object element) {
- if(element instanceof Class<?>) {
- Class<?> elementType = (Class<?>)element;
+ if (element instanceof Class<?>) {
+ Class<?> elementType = (Class<?>) element;
return Widget.class.isAssignableFrom(elementType) || Viewer.class.isAssignableFrom(elementType) || ControlEditor.class.isAssignableFrom(elementType);
}
return false;
@@ -115,11 +115,11 @@ public class UserData {
public static void bindNameContext(Object element, ScopeKeeper nameContext) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return;
}
UserData dataDictionary = updateDataDictionary(widget);
- if(dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY) != null) {
+ if (dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY) != null) {
throw new IllegalStateException("Name context is already set");
}
dataDictionary.setData(IUserDataConstants.XWT_NAMECONTEXT_KEY, nameContext);
@@ -127,11 +127,11 @@ public class UserData {
protected static UserData updateDataDictionary(Object target) {
Widget widget = getWidget(target);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary == null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary == null) {
dataDictionary = new UserData();
widget.setData(IUserDataConstants.XWT_USER_DATA_KEY, dataDictionary);
}
@@ -140,14 +140,14 @@ public class UserData {
public static Shell findShell(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- if(widget instanceof Shell) {
- return (Shell)widget;
+ if (widget instanceof Shell) {
+ return (Shell) widget;
}
- Control parent = (Control)findParent(widget, Control.class);
- if(parent != null) {
+ Control parent = (Control) findParent(widget, Control.class);
+ if (parent != null) {
return parent.getShell();
}
return null;
@@ -156,16 +156,16 @@ public class UserData {
/**
* Find the root widget used by XWT. In fact, it tries to find the root
* ScopeKeeper
- *
+ *
* @param element
* @return
*/
public static Widget findRootWidget(Object element) {
Widget root = null;
Widget current = getWidget(element);
- while(current != null) {
+ while (current != null) {
ScopeKeeper scopeKeeper = findScopeKeeper(current);
- if(scopeKeeper != null) {
+ if (scopeKeeper != null) {
root = current;
}
current = getTreeParent(current);
@@ -176,19 +176,19 @@ public class UserData {
public static Composite findCompositeParent(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
Control control = getParent(widget);
- while(control != null && !(control instanceof Composite)) {
+ while (control != null && !(control instanceof Composite)) {
control = getParent(control);
}
- return (Composite)control;
+ return (Composite) control;
}
public static Object findParent(Widget element, Class<?> type) {
Widget widget = getTreeParent(element);
- while(widget != null && !(type.isInstance(widget))) {
+ while (widget != null && !(type.isInstance(widget))) {
widget = getTreeParent(widget);
}
return widget;
@@ -196,11 +196,11 @@ public class UserData {
public static ScopeKeeper findScopeKeeper(Object element) {
ScopeKeeper scopeKeeper = getLocalScopeKeeper(element);
- if(scopeKeeper != null) {
+ if (scopeKeeper != null) {
return scopeKeeper;
}
Widget parent = getTreeParent(element);
- if(parent != null && !parent.isDisposed()) {
+ if (parent != null && !parent.isDisposed()) {
return findScopeKeeper(parent);
}
return null;
@@ -208,16 +208,16 @@ public class UserData {
public static Widget findScopeRoot(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
Widget current = widget;
- while(current != null) {
- UserData dataDictionary = (UserData)current.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
+ while (current != null) {
+ UserData dataDictionary = (UserData) current.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
Object data = dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY);
- if(data != null) {
+ if (data != null) {
return current;
}
}
@@ -230,14 +230,14 @@ public class UserData {
public static ScopeKeeper getLocalScopeKeeper(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
Object data = dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY);
- if(data != null) {
- return (ScopeKeeper)data;
+ if (data != null) {
+ return (ScopeKeeper) data;
}
}
return null;
@@ -245,21 +245,21 @@ public class UserData {
public static Object findElementByName(Object context, String name) {
Widget widget = getWidget(context);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
- ScopeKeeper nameContext = (ScopeKeeper)dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY);
- if(nameContext != null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
+ ScopeKeeper nameContext = (ScopeKeeper) dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY);
+ if (nameContext != null) {
Object element = nameContext.getNamedObject(name);
- if(element != null) {
+ if (element != null) {
return element;
}
}
}
Widget parent = getTreeParent(widget);
- if(parent != null) {
+ if (parent != null) {
return findElementByName(parent, name);
}
return null;
@@ -267,21 +267,21 @@ public class UserData {
public static String getElementName(Object object) {
Widget widget = getWidget(object);
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
- return (String)dataDictionary.getData(IUserDataConstants.XWT_NAME_KEY);
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
+ return (String) dataDictionary.getData(IUserDataConstants.XWT_NAME_KEY);
}
return null;
}
public static void setElementName(Object object, String name, boolean updateScope) {
Widget widget = getWidget(object);
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
dataDictionary.setData(IUserDataConstants.XWT_NAME_KEY, name);
- if(updateScope) {
+ if (updateScope) {
ScopeKeeper keeper = findScopeKeeper(object);
- if(keeper != null) {
+ if (keeper != null) {
keeper.addNamedObject(name, object);
}
}
@@ -294,18 +294,18 @@ public class UserData {
public static Object getCLR(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
Object data = dataDictionary.getData(IUserDataConstants.XWT_CLR_KEY);
- if(data != null) {
+ if (data != null) {
return data;
}
}
Widget parent = getParent(widget);
- if(parent != null) {
+ if (parent != null) {
return getCLR(parent);
}
return null;
@@ -313,13 +313,13 @@ public class UserData {
public static Widget getTreeParent(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
- widget = (Widget)dataDictionary.getData(IUserDataConstants.XWT_PARENT_KEY);
- if(widget != null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
+ widget = (Widget) dataDictionary.getData(IUserDataConstants.XWT_PARENT_KEY);
+ if (widget != null) {
return widget;
}
}
@@ -328,64 +328,64 @@ public class UserData {
public static Control getParent(Object element) {
Widget widget = getWidget(element);
- if(widget instanceof Control) {
- Control control = (Control)widget;
+ if (widget instanceof Control) {
+ Control control = (Control) widget;
return control.getParent();
- } else if(widget instanceof Menu) {
- Menu item = (Menu)widget;
+ } else if (widget instanceof Menu) {
+ Menu item = (Menu) widget;
return item.getParent();
- } else if(widget instanceof MenuItem) {
- MenuItem item = (MenuItem)widget;
+ } else if (widget instanceof MenuItem) {
+ MenuItem item = (MenuItem) widget;
Menu menu = item.getParent();
- if(menu == null) {
+ if (menu == null) {
return null;
}
return menu.getParent();
- } else if(widget instanceof ScrollBar) {
- ScrollBar item = (ScrollBar)widget;
+ } else if (widget instanceof ScrollBar) {
+ ScrollBar item = (ScrollBar) widget;
return item.getParent();
- } else if(widget instanceof ToolTip) {
- ToolTip item = (ToolTip)widget;
+ } else if (widget instanceof ToolTip) {
+ ToolTip item = (ToolTip) widget;
return item.getParent();
- } else if(widget instanceof CoolItem) {
- CoolItem item = (CoolItem)widget;
+ } else if (widget instanceof CoolItem) {
+ CoolItem item = (CoolItem) widget;
return item.getParent();
- } else if(widget instanceof CTabItem) {
- CTabItem item = (CTabItem)widget;
+ } else if (widget instanceof CTabItem) {
+ CTabItem item = (CTabItem) widget;
return item.getParent();
- } else if(widget instanceof ExpandItem) {
- ExpandItem item = (ExpandItem)widget;
+ } else if (widget instanceof ExpandItem) {
+ ExpandItem item = (ExpandItem) widget;
return item.getParent();
- } else if(widget instanceof TabItem) {
- TabItem item = (TabItem)widget;
+ } else if (widget instanceof TabItem) {
+ TabItem item = (TabItem) widget;
return item.getParent();
- } else if(widget instanceof TableColumn) {
- TableColumn item = (TableColumn)widget;
+ } else if (widget instanceof TableColumn) {
+ TableColumn item = (TableColumn) widget;
return item.getParent();
- } else if(widget instanceof TableItem) {
- TableItem item = (TableItem)widget;
+ } else if (widget instanceof TableItem) {
+ TableItem item = (TableItem) widget;
return item.getParent();
- } else if(widget instanceof TableTreeItem) {
- TableTreeItem item = (TableTreeItem)widget;
+ } else if (widget instanceof TableTreeItem) {
+ TableTreeItem item = (TableTreeItem) widget;
return item.getParent();
- } else if(widget instanceof ToolItem) {
- ToolItem item = (ToolItem)widget;
+ } else if (widget instanceof ToolItem) {
+ ToolItem item = (ToolItem) widget;
return item.getParent();
- } else if(widget instanceof TreeColumn) {
- TreeColumn item = (TreeColumn)widget;
+ } else if (widget instanceof TreeColumn) {
+ TreeColumn item = (TreeColumn) widget;
return item.getParent();
- } else if(widget instanceof TreeItem) {
- TreeItem item = (TreeItem)widget;
+ } else if (widget instanceof TreeItem) {
+ TreeItem item = (TreeItem) widget;
return item.getParent();
- } else if(widget instanceof Caret) {
- Caret item = (Caret)widget;
+ } else if (widget instanceof Caret) {
+ Caret item = (Caret) widget;
return item.getParent();
}
return null;
}
public static IEventController findEventController(Object widget) {
- return (IEventController)findData(widget, IUserDataConstants.XWT_CONTROLLER_KEY);
+ return (IEventController) findData(widget, IUserDataConstants.XWT_CONTROLLER_KEY);
}
public static Object getDataContext(Object widget) {
@@ -393,18 +393,18 @@ public class UserData {
}
public static IBindingContext getBindingContext(Object widget) {
- return (IBindingContext)findData(widget, IUserDataConstants.XWT_BINDING_CONTEXT_KEY);
+ return (IBindingContext) findData(widget, IUserDataConstants.XWT_BINDING_CONTEXT_KEY);
}
public static TriggerBase[] getTriggers(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return TriggerBase.EMPTY_ARRAY;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
- TriggerBase[] triggers = (TriggerBase[])dataDictionary.getData(IUserDataConstants.XWT_TRIGGERS_KEY);
- if(triggers != null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
+ TriggerBase[] triggers = (TriggerBase[]) dataDictionary.getData(IUserDataConstants.XWT_TRIGGERS_KEY);
+ if (triggers != null) {
return triggers;
}
}
@@ -417,26 +417,26 @@ public class UserData {
public static Widget getDataContextHost(Object element) {
Widget widget = getWidget(element);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
Object host = null;
- if(dataDictionary != null) {
+ if (dataDictionary != null) {
host = dataDictionary.getData(IUserDataConstants.XWT_DATACONTEXT_KEY);
- if(host != null) {
+ if (host != null) {
return widget;
}
}
Widget parent = widget;
- while(parent != null) {
- dataDictionary = (UserData)parent.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
+ while (parent != null) {
+ dataDictionary = (UserData) parent.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
host = dataDictionary.getData(IUserDataConstants.XWT_DATACONTEXT_KEY);
- if(host != null) {
+ if (host != null) {
return parent;
}
- parent = (Widget)dataDictionary.getData(IUserDataConstants.XWT_PARENT_KEY);
+ parent = (Widget) dataDictionary.getData(IUserDataConstants.XWT_PARENT_KEY);
} else {
parent = getParent(parent);
}
@@ -453,20 +453,20 @@ public class UserData {
}
public static Widget getWidget(Object target) {
- if(JFacesHelper.isViewer(target)) {
+ if (JFacesHelper.isViewer(target)) {
return JFacesHelper.getControl(target);
- } else if(target instanceof Widget) {
- return (Widget)target;
- } else if(target instanceof TableViewerColumn) {
- return ((TableViewerColumn)target).getColumn();
- } else if(target instanceof ControlEditor) {
- return ((ControlEditor)target).getEditor();
+ } else if (target instanceof Widget) {
+ return (Widget) target;
+ } else if (target instanceof TableViewerColumn) {
+ return ((TableViewerColumn) target).getColumn();
+ } else if (target instanceof ControlEditor) {
+ return ((ControlEditor) target).getEditor();
}
return null;
}
public static Viewer getLocalViewer(Object object) {
- return (Viewer)getLocalData(object, IUserDataConstants.XWT_VIEWER_KEY);
+ return (Viewer) getLocalData(object, IUserDataConstants.XWT_VIEWER_KEY);
}
public static Object getLocalDataContext(Object object) {
@@ -479,11 +479,11 @@ public class UserData {
public static Object getLocalData(Object object, IProperty property) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary == null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary == null) {
return null;
}
return dataDictionary.getData(property);
@@ -491,11 +491,11 @@ public class UserData {
public static Object getLocalData(Object object, String key) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary == null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary == null) {
return null;
}
return dataDictionary.getData(key);
@@ -503,11 +503,11 @@ public class UserData {
public static boolean hasLocalData(Object object, String propertyName) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return false;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary == null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary == null) {
return false;
}
return dataDictionary.containsKey(propertyName);
@@ -515,11 +515,11 @@ public class UserData {
public static boolean hasLocalData(Object object, IProperty property) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return false;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary == null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary == null) {
return false;
}
return dataDictionary.containsKey(property);
@@ -527,11 +527,11 @@ public class UserData {
public static void removeLocalData(Object object, IProperty property) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary == null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary == null) {
return;
}
dataDictionary.removeData(property);
@@ -539,28 +539,28 @@ public class UserData {
public static void removeLocalData(Object object, String key) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary == null) {
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary == null) {
return;
}
dataDictionary.removeData(key);
}
public static Map<String, Object> getLocalResources(Object object) {
- return (Map<String, Object>)getLocalData(object, IUserDataConstants.XWT_RESOURCES_KEY);
+ return (Map<String, Object>) getLocalData(object, IUserDataConstants.XWT_RESOURCES_KEY);
}
public static Object findResource(Object object, String key) {
- Map<String, Object> map = (Map<String, Object>)getLocalData(object, IUserDataConstants.XWT_RESOURCES_KEY);
- if(map.containsKey(key)) {
+ Map<String, Object> map = (Map<String, Object>) getLocalData(object, IUserDataConstants.XWT_RESOURCES_KEY);
+ if (map.containsKey(key)) {
return map.get(key);
}
Object parent = getTreeParent(object);
- if(parent != null) {
+ if (parent != null) {
return findResource(parent, key);
}
return null;
@@ -584,8 +584,8 @@ public class UserData {
public static IEventController updateEventController(Object object) {
UserData dataDictionary = updateDataDictionary(object);
- IEventController controller = (IEventController)dataDictionary.getData(IUserDataConstants.XWT_CONTROLLER_KEY);
- if(controller == null) {
+ IEventController controller = (IEventController) dataDictionary.getData(IUserDataConstants.XWT_CONTROLLER_KEY);
+ if (controller == null) {
controller = new Controller();
dataDictionary.setData(IUserDataConstants.XWT_CONTROLLER_KEY, controller);
}
@@ -604,12 +604,12 @@ public class UserData {
public static IObservableValueListener getObservableValueManager(Object object) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return null;
}
- UserData userData = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(userData != null) {
+ UserData userData = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (userData != null) {
return userData.getObservableValueManager();
}
return null;
@@ -617,7 +617,7 @@ public class UserData {
public static void setObservableValueManager(Object object, IObservableValueListener eventManager) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
throw new IllegalStateException("Not SWT Widget");
}
UserData userData = updateDataDictionary(object);
@@ -626,27 +626,27 @@ public class UserData {
public static Object findData(Object object, String key) {
Widget widget = getWidget(object);
- if(widget == null) {
+ if (widget == null) {
return Collections.EMPTY_MAP;
}
- UserData dataDictionary = (UserData)widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ UserData dataDictionary = (UserData) widget.getData(IUserDataConstants.XWT_USER_DATA_KEY);
Object resources = null;
- if(dataDictionary != null) {
+ if (dataDictionary != null) {
resources = dataDictionary.getData(key);
- if(resources != null) {
+ if (resources != null) {
return resources;
}
}
Widget parent = widget;
- while(parent != null) {
- dataDictionary = (UserData)parent.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
+ while (parent != null) {
+ dataDictionary = (UserData) parent.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
resources = dataDictionary.getData(key);
- if(resources != null) {
+ if (resources != null) {
return resources;
}
- parent = (Widget)dataDictionary.getData(IUserDataConstants.XWT_PARENT_KEY);
+ parent = (Widget) dataDictionary.getData(IUserDataConstants.XWT_PARENT_KEY);
} else {
parent = getParent(parent);
}
@@ -655,21 +655,21 @@ public class UserData {
}
public static Map<?, ?> getResources(Object object) {
- return (Map<?, ?>)findData(object, IUserDataConstants.XWT_RESOURCES_KEY);
+ return (Map<?, ?>) findData(object, IUserDataConstants.XWT_RESOURCES_KEY);
}
public static void setObjectName(Object object, String name) {
Widget widget = getWidget(object);
ScopeKeeper nameScoped;
- if(UserData.findElementByName(widget, name) != null) {
+ if (UserData.findElementByName(widget, name) != null) {
// throw an exception or log a message?
return;
}
Widget parent = UserData.getTreeParent(widget);
- UserData dataDictionary = (UserData)parent.getData(IUserDataConstants.XWT_USER_DATA_KEY);
- if(dataDictionary != null) {
- if(dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY) != null) {
- nameScoped = (ScopeKeeper)dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY);
+ UserData dataDictionary = (UserData) parent.getData(IUserDataConstants.XWT_USER_DATA_KEY);
+ if (dataDictionary != null) {
+ if (dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY) != null) {
+ nameScoped = (ScopeKeeper) dataDictionary.getData(IUserDataConstants.XWT_NAMECONTEXT_KEY);
} else {
ScopeKeeper parentNameScope = findScopeKeeper(parent);
nameScoped = new ScopeKeeper(parentNameScope, widget);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Attribute.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Attribute.java
index 6cd357207f4..6adfd9cc6b3 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Attribute.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Attribute.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -40,7 +40,7 @@ public class Attribute extends Element {
@Override
public Object clone() throws CloneNotSupportedException {
- Attribute attribute = (Attribute)super.clone();
+ Attribute attribute = (Attribute) super.clone();
attribute.setId(getId());
return attribute;
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DefaultElementCache.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DefaultElementCache.java
index b7c3e1e98cb..074bd324835 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DefaultElementCache.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DefaultElementCache.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014 CEA 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
@@ -22,7 +22,7 @@ import java.util.Map;
*/
public class DefaultElementCache implements IElementCache {
- /** The default cache size (currently {@value}). */
+ /** The default cache size (currently {@value} ). */
static int DEFAULT_CACHE_SIZE = 128;
private final int cacheSize;
@@ -31,6 +31,7 @@ public class DefaultElementCache implements IElementCache {
private static final long serialVersionUID = 1L;
+ @Override
protected boolean removeEldestEntry(Map.Entry<String, Element> eldest) {
return size() > cacheSize;
}
@@ -46,17 +47,17 @@ public class DefaultElementCache implements IElementCache {
/**
* Initializes me with a specific size of cache.
- *
+ *
* @param cacheSize
- * the maximal number of cached XML elements to keep
- *
+ * the maximal number of cached XML elements to keep
+ *
* @throws IllegalArgumentException
- * if the {@code cacheSize} is not positive
+ * if the {@code cacheSize} is not positive
*/
public DefaultElementCache(int cacheSize) {
super();
- if(cacheSize <= 0) {
+ if (cacheSize <= 0) {
throw new IllegalArgumentException("non-positive cacheSize"); //$NON-NLS-1$
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentObject.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentObject.java
index 38ac56fe253..aadf5c8109b 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentObject.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentObject.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -59,9 +59,9 @@ public class DocumentObject extends Observable implements Cloneable {
public void addChild(DocumentObject child) {
assert child != null;
- if(children.add(child)) {
+ if (children.add(child)) {
DocumentObject oParent = (child).getParent();
- if(oParent != null) {
+ if (oParent != null) {
oParent.delChild(child);
}
// Assign the new parent.
@@ -143,7 +143,7 @@ public class DocumentObject extends Observable implements Cloneable {
*/
public void include(ElementManager elementManager, String path) throws IOException {
InputStream input = elementManager.getDocumentRoot().openStream(path);
- if(input != null) {
+ if (input != null) {
include(elementManager, input);
}
input.close();
@@ -160,14 +160,14 @@ public class DocumentObject extends Observable implements Cloneable {
@Override
public Object clone() throws CloneNotSupportedException {
- DocumentObject docobj = (DocumentObject)super.clone();
+ DocumentObject docobj = (DocumentObject) super.clone();
// Clear object id.
docobj.id = null;
// Clone children.
- for(DocumentObject child : getChildren()) {
- DocumentObject nChild = (DocumentObject)child.clone();
+ for (DocumentObject child : getChildren()) {
+ DocumentObject nChild = (DocumentObject) child.clone();
docobj.addChild(nChild);
}
@@ -176,10 +176,10 @@ public class DocumentObject extends Observable implements Cloneable {
/**
* @param id
- * the id to set
+ * the id to set
*/
protected void setId(String id) {
- if(this.id != null) {
+ if (this.id != null) {
throw new IllegalStateException("Element id is already defined");
}
@@ -190,7 +190,7 @@ public class DocumentObject extends Observable implements Cloneable {
/**
* @param namespace
- * the namespace to set
+ * the namespace to set
* @uml.property name="namespace"
*/
protected void setNamespace(String namespace) {
@@ -202,7 +202,7 @@ public class DocumentObject extends Observable implements Cloneable {
/**
* @param name
- * the name to set
+ * the name to set
* @uml.property name="name"
*/
protected void setName(String name) {
@@ -214,18 +214,18 @@ public class DocumentObject extends Observable implements Cloneable {
/**
* Remove child from parent.
- *
+ *
* @param child
- * the removed parent.
+ * the removed parent.
*/
protected void delChild(DocumentObject child) {
assert child != null;
- if(child instanceof Element) {
- DocumentObject parent = ((Element)child).getParent();
- if(parent != null && parent.equals(this)) {
+ if (child instanceof Element) {
+ DocumentObject parent = ((Element) child).getParent();
+ if (parent != null && parent.equals(this)) {
children.remove(child);
- ((Element)child).setParent(null);
+ ((Element) child).setParent(null);
}
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentRoot.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentRoot.java
index 5cedea62717..2cb349bb003 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentRoot.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/DocumentRoot.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
* Christian W. Damus (CEA) - Fix failure to propagate stream handlers of URLs (CDO)
@@ -134,7 +134,7 @@ public class DocumentRoot {
* @see org.soyatec.xaml.IDocumentRoot#openStream()
*/
public InputStream openStream() throws IOException {
- switch(format) {
+ switch (format) {
case FORMAT_GZIP:
return new GZIPInputStream(new URL(basePath + "/" + baseFile).openStream());
default:
@@ -154,18 +154,18 @@ public class DocumentRoot {
assert path != null;
InputStream in = null;
- if(path.indexOf(':') < 0) {
- if(format == FORMAT_ZIP) {
+ if (path.indexOf(':') < 0) {
+ if (format == FORMAT_ZIP) {
// If it is zip format, that means all directories and files in
// zip file are extracted to temporary directory.
File file = new File(basePath + "/" + path);
in = new FileInputStream(file);
} else {
// Else, maybe the file parent or url path.
- switch(type) {
+ switch (type) {
case TYPE_FILE:
File file;
- if(path.startsWith("/")) {
+ if (path.startsWith("/")) {
// Use absolute path
file = new File(path);
} else {
@@ -181,22 +181,22 @@ public class DocumentRoot {
}
}
} else {
- if(path.startsWith("classpath:")) {
+ if (path.startsWith("classpath:")) {
// Use class path
String p = path.substring(10);
in = getClass().getResourceAsStream(p);
- if(in == null) {
+ if (in == null) {
in = String.class.getResourceAsStream(p);
}
- if(in == null) {
+ if (in == null) {
in = Thread.currentThread().getClass().getResourceAsStream(p);
}
- if(in == null) {
+ if (in == null) {
throw new IOException("File not found in classpath: " + p);
}
} else {
File file = new File(path);
- if(file.exists()) {
+ if (file.exists()) {
// Use Windows File path. For example, G:\\somefile.txt
in = new FileInputStream(file);
} else {
@@ -208,13 +208,15 @@ public class DocumentRoot {
// Automatically select the stream type
PushbackInputStream pis = new PushbackInputStream(in, 4);
- if(Format.isGZIP(pis)) {
+ if (Format.isGZIP(pis)) {
return new GZIPInputStream(pis);
- } else if(Format.isZIP(pis)) {
+ } else if (Format.isZIP(pis)) {
ZipInputStream zis = new ZipInputStream(pis);
// Skip entry of directory or file which contains directory
// path("someDirectory/someFile.suffix").
- for(ZipEntry entry = zis.getNextEntry(); entry != null && (entry.isDirectory() || entry.getName().indexOf('/') != -1); entry = zis.getNextEntry());
+ for (ZipEntry entry = zis.getNextEntry(); entry != null && (entry.isDirectory() || entry.getName().indexOf('/') != -1); entry = zis.getNextEntry()) {
+ ;
+ }
return zis;
} else {
return pis;
@@ -223,20 +225,20 @@ public class DocumentRoot {
/**
* This method is used in <code>ModelLoader</code>
- *
+ *
* @param file
- * the xaml file path.
+ * the xaml file path.
*/
protected void init(InputStream inputStream, URL url) throws IOException {
File file = null;
-
+
try {
file = "file".equals(url.getProtocol()) ? new File(url.toURI()) : null;
} catch (URISyntaxException e) {
- // not a valid file URL. Fine
+ // not a valid file URL. Fine
}
-
- if((inputStream == null) && (file != null) && file.exists()) {
+
+ if ((inputStream == null) && (file != null) && file.exists()) {
// Is file
init(file);
} else {
@@ -245,36 +247,36 @@ public class DocumentRoot {
baseURL = url;
PushbackInputStream pis = null;
boolean shouldClose_pis = false;
- if(inputStream instanceof PushbackInputStream) {
- pis = (PushbackInputStream)inputStream;
+ if (inputStream instanceof PushbackInputStream) {
+ pis = (PushbackInputStream) inputStream;
} else {
- if(inputStream == null) {
+ if (inputStream == null) {
pis = new PushbackInputStream(baseURL.openStream(), 4);
shouldClose_pis = true;
} else {
pis = new PushbackInputStream(inputStream, 4);
}
}
- if(Format.isGZIP(pis)) {
+ if (Format.isGZIP(pis)) {
format = FORMAT_GZIP;
- } else if(Format.isZIP(pis)) {
+ } else if (Format.isZIP(pis)) {
format = FORMAT_ZIP;
File tempDir = extractZipToTemporary(pis);
basePath = "file:/" + tempDir.getAbsolutePath();
baseFile = getMainFile(tempDir);
}
- if(shouldClose_pis) {
+ if (shouldClose_pis) {
pis.close();
}
- if(basePath == null) {
+ if (basePath == null) {
String path = url.getPath();
- while(path.endsWith("/")) {
+ while (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
int lastIndex = path.lastIndexOf("/");
- if(lastIndex > 0) {
+ if (lastIndex > 0) {
basePath = path.substring(0, lastIndex);
baseFile = path.substring(lastIndex + 1);
baseURL = new URL(url, basePath); // be sure to preserve the stream handler
@@ -306,9 +308,9 @@ public class DocumentRoot {
/**
* This method is used in <code>ModelLoader</code>
- *
+ *
* @param file
- * the XAML file.
+ * the XAML file.
*/
private void init(File file) throws IOException {
FileInputStream fis = new FileInputStream(file);
@@ -316,9 +318,9 @@ public class DocumentRoot {
baseURL = file.getParentFile().toURI().toURL();
basePath = baseURL.toString();
baseFile = file.getName();
- if(Format.isGZIP(pis)) {
+ if (Format.isGZIP(pis)) {
format = FORMAT_GZIP;
- } else if(Format.isZIP(pis)) {
+ } else if (Format.isZIP(pis)) {
format = FORMAT_ZIP;
File tempDir = extractZipToTemporary(pis);
basePath = "file:/" + tempDir.getAbsolutePath();
@@ -336,7 +338,7 @@ public class DocumentRoot {
return pathname.isFile() && pathname.getName().toLowerCase().endsWith(IConstants.XWT_EXTENSION_SUFFIX);
}
});
- for(File tempFile : tempFiles) {
+ for (File tempFile : tempFiles) {
return tempFile.getName();
}
return null;
@@ -344,14 +346,14 @@ public class DocumentRoot {
/**
* Extract zip stream to temporary directory.
- *
+ *
* @param stream
- * zip stream.
+ * zip stream.
* @return Returns the directory file the zip stream extracted.
*/
private File extractZipToTemporary(InputStream stream) throws IOException {
File file = new File(System.getProperty("java.io.tmpdir") + "/cb" + System.currentTimeMillis() + Math.random());
- if(!file.mkdir()) {
+ if (!file.mkdir()) {
throw new XWTException("Folder creation fails: " + file.toString());
}
file.deleteOnExit();
@@ -359,24 +361,24 @@ public class DocumentRoot {
String directory = file.getAbsolutePath();
ZipInputStream in = new ZipInputStream(stream);
ZipEntry z;
- while((z = in.getNextEntry()) != null) {
- if(z.isDirectory()) {
+ while ((z = in.getNextEntry()) != null) {
+ if (z.isDirectory()) {
String name = z.getName();
name = name.substring(0, name.length() - 1);
File f = new File(directory + File.separator + name);
- if(!f.mkdir()) {
+ if (!f.mkdir()) {
throw new XWTException("Folder creation fails: " + f.toString());
}
f.deleteOnExit();
} else {
File f = new File(directory + File.separator + z.getName());
- if(!f.createNewFile()) {
+ if (!f.createNewFile()) {
throw new XWTException("File creation fails: " + f.toString());
}
f.deleteOnExit();
FileOutputStream out = new FileOutputStream(f);
byte[] cache = new byte[4096];
- for(int i = in.read(cache); i != -1; i = in.read(cache)) {
+ for (int i = in.read(cache); i != -1; i = in.read(cache)) {
out.write(cache, 0, i);
}
out.close();
@@ -392,27 +394,27 @@ public class DocumentRoot {
* <p>
* To check the format of file or stream.
* </p>
- *
+ *
*/
static class Format {
/**
* Check the stream is a gzip format or not.
- *
+ *
* @param stream
- * the checked stream.
+ * the checked stream.
* @return Returns true is the stream is a gzip format.
*/
public static boolean isGZIP(PushbackInputStream stream) throws IOException {
assert stream != null;
byte[] cachedBytes = new byte[2];
- if(stream.read(cachedBytes) != cachedBytes.length) {
+ if (stream.read(cachedBytes) != cachedBytes.length) {
throw new RuntimeException("data content wrong.");
}
stream.unread(cachedBytes);
// GZIP's header data starts with two bytes{1F,8B},
- if((cachedBytes[0] & 0xff) == 0x1f && (cachedBytes[1] & 0xff) == 0x8b) {
+ if ((cachedBytes[0] & 0xff) == 0x1f && (cachedBytes[1] & 0xff) == 0x8b) {
return true;
} else {
return false;
@@ -421,9 +423,9 @@ public class DocumentRoot {
/**
* Check the file is a gzip format or not.
- *
+ *
* @param file
- * the checked file.
+ * the checked file.
* @return Returns true is the file is a gzip format.
*/
public static boolean isGZIP(File file) throws IOException {
@@ -438,21 +440,21 @@ public class DocumentRoot {
/**
* Check the stream is a zip format or not.
- *
+ *
* @param stream
- * the checked stream.
+ * the checked stream.
* @return Returns true is the stream is a zip format.
*/
public static boolean isZIP(PushbackInputStream stream) throws IOException {
assert stream != null;
byte[] cachedBytes = new byte[4];
- if(stream.read(cachedBytes) != cachedBytes.length) {
+ if (stream.read(cachedBytes) != cachedBytes.length) {
throw new RuntimeException("data content wrong.");
}
stream.unread(cachedBytes);
// ZIP's header data starts with four bytes{0x50, 0x4b, 0x03, 0x04},
- if((cachedBytes[0] & 0xff) == 0x50 && (cachedBytes[1] & 0xff) == 0x4b && (cachedBytes[2] & 0xff) == 0x03 && (cachedBytes[3] & 0xff) == 0x04) {
+ if ((cachedBytes[0] & 0xff) == 0x50 && (cachedBytes[1] & 0xff) == 0x4b && (cachedBytes[2] & 0xff) == 0x03 && (cachedBytes[3] & 0xff) == 0x04) {
return true;
} else {
return false;
@@ -461,9 +463,9 @@ public class DocumentRoot {
/**
* Check the file is a zip format or not.
- *
+ *
* @param file
- * the checked file.
+ * the checked file.
* @return Returns true is the file is a zip format.
*/
public static boolean isZIP(File file) throws IOException {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Element.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Element.java
index 8f5f6f5dadb..2eaeb42020a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Element.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/Element.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -43,12 +43,12 @@ public class Element extends DocumentObject {
}
public String getXmlns(String prefix) {
- if(prefix == null) {
+ if (prefix == null) {
prefix = "";
}
- if(xmlnsMapping != null) {
- for(int i = 0; i < xmlnsMapping.length; i++) {
- if(prefix.equals(xmlnsMapping[i++])) {
+ if (xmlnsMapping != null) {
+ for (int i = 0; i < xmlnsMapping.length; i++) {
+ if (prefix.equals(xmlnsMapping[i++])) {
return xmlnsMapping[i];
}
}
@@ -58,15 +58,15 @@ public class Element extends DocumentObject {
/**
* Default constructor
- *
+ *
* @param context
- * bundle context
+ * bundle context
* @param namespace
- * element namespace
+ * element namespace
* @param name
- * element name
+ * element name
* @param originalAttributes
- * element arributes
+ * element arributes
*/
public Element(String namespace, String name, Map<String, String> xmlnsMapping) {
this(namespace, name, null, null, xmlnsMapping);
@@ -75,12 +75,12 @@ public class Element extends DocumentObject {
public Element(String namespace, String name, String path, Collection<Attribute> attributes, Map<String, String> xmlnsMapping) {
super(namespace, name);
this.path = path;
- if(xmlnsMapping != null) {
+ if (xmlnsMapping != null) {
this.xmlnsMapping = new String[xmlnsMapping.size() * 2];
int i = 0;
- for(Map.Entry<String, String> entry : xmlnsMapping.entrySet()) {
+ for (Map.Entry<String, String> entry : xmlnsMapping.entrySet()) {
String key = entry.getKey();
- if(key == null) {
+ if (key == null) {
key = "";
}
this.xmlnsMapping[i++] = key;
@@ -91,8 +91,8 @@ public class Element extends DocumentObject {
this.originalAttributes = Collections.emptyMap();
this.externalAttributes = Collections.emptyMap();
- if(attributes != null) {
- for(Attribute attribute : attributes) {
+ if (attributes != null) {
+ for (Attribute attribute : attributes) {
setInternalAttribute(attribute);
}
}
@@ -132,11 +132,11 @@ public class Element extends DocumentObject {
* @see com.soyatec.eface.IElement#attributeNames(java.lang.String)
*/
public String[] attributeNames(String namespace) {
- if(getNamespace().equals(namespace)) {
+ if (getNamespace().equals(namespace)) {
return attributeNames();
}
Map<String, Attribute> externalAttribute = externalAttributes.get(namespace);
- if(externalAttribute != null) {
+ if (externalAttribute != null) {
return externalAttribute.keySet().toArray(EMPTY_STRING_ARRAY);
} else {
return Core.EMPTY_STRING_ARRAY;
@@ -160,7 +160,7 @@ public class Element extends DocumentObject {
*/
public Attribute getAttribute(String namespace, String name) {
Map<String, Attribute> externalAttribute = externalAttributes.get(namespace);
- if(externalAttribute != null) {
+ if (externalAttribute != null) {
return externalAttribute.get(name);
} else {
return null;
@@ -169,30 +169,30 @@ public class Element extends DocumentObject {
@Override
public Object clone() throws CloneNotSupportedException {
- Element element = (Element)super.clone();
+ Element element = (Element) super.clone();
element.parent = null;
- if(originalAttributes.isEmpty()) {
+ if (originalAttributes.isEmpty()) {
originalAttributes = Collections.emptyMap();
} else {
element.originalAttributes = new LinkedHashMap<String, Attribute>(originalAttributes.size());
- for(String attrName : originalAttributes.keySet()) {
- Attribute attrValue = (Attribute)originalAttributes.get(attrName).clone();
+ for (String attrName : originalAttributes.keySet()) {
+ Attribute attrValue = (Attribute) originalAttributes.get(attrName).clone();
element.originalAttributes.put(attrName, attrValue);
}
}
- if(externalAttributes.isEmpty()) {
+ if (externalAttributes.isEmpty()) {
element.originalAttributes = Collections.emptyMap();
} else {
element.externalAttributes = new LinkedHashMap<String, Map<String, Attribute>>(externalAttributes.size());
- for(String ns : externalAttributes.keySet()) {
+ for (String ns : externalAttributes.keySet()) {
Map<String, Attribute> oAttributes = externalAttributes.get(ns);
Map<String, Attribute> nAttributes = new LinkedHashMap<String, Attribute>(oAttributes.size());
- for(Map.Entry<String, Attribute> entry : oAttributes.entrySet()) {
+ for (Map.Entry<String, Attribute> entry : oAttributes.entrySet()) {
String attrName = entry.getKey();
- Attribute attrValue = (Attribute)entry.getValue().clone();
+ Attribute attrValue = (Attribute) entry.getValue().clone();
nAttributes.put(attrName, attrValue);
}
element.externalAttributes.put(ns, nAttributes);
@@ -203,7 +203,7 @@ public class Element extends DocumentObject {
}
protected void setAttributes(Collection<Attribute> attributes) {
- for(Attribute attribute : attributes) {
+ for (Attribute attribute : attributes) {
setInternalAttribute(attribute);
}
firePropertyChanged(attributes);
@@ -219,10 +219,10 @@ public class Element extends DocumentObject {
private boolean isXWTNamespace(String namespace) {
String scopeNamespace = getNamespace();
- if(namespace == null || "".equals(namespace)) {
+ if (namespace == null || "".equals(namespace)) {
return true;
}
- if(scopeNamespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO) || scopeNamespace.equals(IConstants.XWT_NAMESPACE)) {
+ if (scopeNamespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO) || scopeNamespace.equals(IConstants.XWT_NAMESPACE)) {
return namespace.equalsIgnoreCase(scopeNamespace) || namespace.equals(IConstants.XWT_NAMESPACE);
}
return false;
@@ -230,9 +230,9 @@ public class Element extends DocumentObject {
/**
* Set attribute without notifying event.
- *
+ *
* @param attribute
- * the modified attribute.
+ * the modified attribute.
*/
private void setInternalAttribute(Attribute attribute) {
assert attribute != null;
@@ -240,22 +240,22 @@ public class Element extends DocumentObject {
String namespace = attribute.getNamespace();
String name = attribute.getName();
- if(isXWTNamespace(namespace)) {
- if(originalAttributes == Collections.EMPTY_MAP) {
+ if (isXWTNamespace(namespace)) {
+ if (originalAttributes == Collections.EMPTY_MAP) {
originalAttributes = new LinkedHashMap<String, Attribute>();
}
originalAttributes.put(name, attribute);
} else {
Map<String, Attribute> externalAttribute = externalAttributes.get(namespace);
- if(externalAttribute == null) {
+ if (externalAttribute == null) {
externalAttribute = new HashMap<String, Attribute>();
}
- if(externalAttributes == Collections.EMPTY_MAP) {
+ if (externalAttributes == Collections.EMPTY_MAP) {
externalAttributes = new LinkedHashMap<String, Map<String, Attribute>>();
}
externalAttribute.put(name, attribute);
externalAttributes.put(namespace, externalAttribute);
}
- ((DocumentObject)attribute).setParent(this);
+ ((DocumentObject) attribute).setParent(this);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementHandler.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementHandler.java
index bb65bc61ea7..b425d33b8f7 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementHandler.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementHandler.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -31,7 +31,7 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* XAML-DOM handler.
- *
+ *
* @author yyang
* @version 1.0
*/
@@ -39,7 +39,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
private Stack<StringBuffer> bufferStack = new Stack<StringBuffer>();
- private static final String[] BINDING_PROPERTIES = new String[]{ "path", "validationRule", "converter" };
+ private static final String[] BINDING_PROPERTIES = new String[] { "path", "validationRule", "converter" };
/**
@@ -72,9 +72,9 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
/**
* Parse the XAML extension Markup: {StaticResource test} {StaticResource RessourceKey=test} {DynamicResource {x:Static
* SystemColors.ControlBrushKey}}
- *
+ *
* @author yyang
- *
+ *
*/
private class ExtensionParser {
@@ -83,7 +83,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
private DocumentObject current;
public void parse(DocumentObject element, String text) {
- if(root != null) {
+ if (root != null) {
ExtensionParser parser = new ExtensionParser();
parser.parse(element, text);
return;
@@ -92,35 +92,35 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
StringTokenizer stringTokenizer = new StringTokenizer(text, "{}", true);
String previous = null;
String nextPrevious = null;
- while(stringTokenizer.hasMoreTokens()) {
+ while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
- if(previous != null) {
- if(previous.equals("{")) {
- if(token.equals("}")) {
+ if (previous != null) {
+ if (previous.equals("{")) {
+ if (token.equals("}")) {
// escape sequence
- if(stringTokenizer.hasMoreTokens()) {
+ if (stringTokenizer.hasMoreTokens()) {
handleBlock(stringTokenizer.nextToken(" \t\n\r\f"), false);
}
} else {
startBlock();
}
- } else if(previous.equals("}")) {
+ } else if (previous.equals("}")) {
endBlock();
} else {
StringBuilder builder = new StringBuilder();
builder.append(previous);
- if(token.equals("{")) {
+ if (token.equals("{")) {
int level = 1;
builder.append(token);
- while(stringTokenizer.hasMoreTokens() && level >= 0) {
+ while (stringTokenizer.hasMoreTokens() && level >= 0) {
String value = stringTokenizer.nextToken();
- if(value.equals("{")) {
+ if (value.equals("{")) {
level++;
- } else if(value.equals("}")) {
+ } else if (value.equals("}")) {
level--;
}
- if(level >= 0) {
+ if (level >= 0) {
builder.append(value);
}
}
@@ -140,7 +140,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
}
protected void endBlock() {
- if(current != null) {
+ if (current != null) {
current = current.getParent().getParent();
}
}
@@ -149,20 +149,20 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
int index = token.indexOf(':');
String namespace = null;
String name = token;
- if(index != -1) {
+ if (index != -1) {
String prefix = token.substring(0, index);
name = token.substring(index + 1);
namespace = namespaceMapping.get(prefix);
}
- if(namespace == null) {
+ if (namespace == null) {
namespace = defaultNamespace;
}
Element element = new Element(namespace, name, namespaceMapping);
element.setId(ElementManager.generateID(name));
- if(current != null) {
+ if (current != null) {
current.addChild(element);
} else {
- if(root == null) {
+ if (root == null) {
root = element;
}
}
@@ -177,35 +177,35 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
String attributeValue = null;
boolean equals = false;
Element element = null;
- if(!newElement && current instanceof Element) {
- element = (Element)current;
+ if (!newElement && current instanceof Element) {
+ element = (Element) current;
}
boolean skip = false;
String token = null;
- while(skip || tokenizer.hasMoreTokens()) {
- if(!skip) {
+ while (skip || tokenizer.hasMoreTokens()) {
+ if (!skip) {
token = tokenizer.nextToken(rootPattern).trim();
}
skip = false;
- if(token.length() == 0) {
+ if (token.length() == 0) {
continue;
}
- if(element == null) {
+ if (element == null) {
element = createElement(token);
} else {
- if(token.equals("=")) {
+ if (token.equals("=")) {
equals = true;
- if("xpath".equalsIgnoreCase(attributeName)) {
+ if ("xpath".equalsIgnoreCase(attributeName)) {
attributeValue = tokenizer.nextToken(",");
}
continue;
}
- if(token.equals(",")) {
- if(attributeName != null) {
- if(attributeValue != null) {
+ if (token.equals(",")) {
+ if (attributeName != null) {
+ if (attributeValue != null) {
Attribute attribute = new Attribute(normalizeAttrNamespace(current.getNamespace()), attributeName, ElementManager.generateID(current.getName()));
- if(isExpendedProperty(attributeName) && "Binding".equalsIgnoreCase(element.getName())) {
+ if (isExpendedProperty(attributeName) && "Binding".equalsIgnoreCase(element.getName())) {
attributeValue = expandNamespaces(element, attributeValue);
}
handleContent(attribute, attributeValue);
@@ -219,18 +219,18 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
equals = false;
}
} else {
- if(attributeName == null) {
+ if (attributeName == null) {
attributeName = token;
} else {
StringBuilder builder = new StringBuilder();
builder.append(token);
- if(token.startsWith("{")) {
+ if (token.startsWith("{")) {
int level = 1;
- while(tokenizer.hasMoreTokens() && level > 0) {
+ while (tokenizer.hasMoreTokens() && level > 0) {
String value = tokenizer.nextToken("{}");
- if(value.equals("{")) {
+ if (value.equals("{")) {
level++;
- } else if(value.equals("}")) {
+ } else if (value.equals("}")) {
level--;
}
builder.append(value);
@@ -250,22 +250,22 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
skip = false;
}
- if(equals) {
+ if (equals) {
Attribute attribute = new Attribute(normalizeAttrNamespace(current.getNamespace()), attributeName, ElementManager.generateID(current.getName()));
- if(isExpendedProperty(attributeName) && "Binding".equalsIgnoreCase(element.getName())) {
+ if (isExpendedProperty(attributeName) && "Binding".equalsIgnoreCase(element.getName())) {
attributeValue = expandNamespaces(element, attributeValue);
}
- if(attributeValue != null) {
+ if (attributeValue != null) {
handleContent(attribute, attributeValue);
element.setAttribute(attribute);
} else {
element.setAttribute(attribute);
current = attribute;
}
- } else if(attributeName != null) {
+ } else if (attributeName != null) {
int index = attributeName.indexOf(":");
- if(index != -1) {
+ if (index != -1) {
element = createElement(attributeName);
current = current.getParent();
} else {
@@ -276,9 +276,9 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
};
static boolean isExpendedProperty(String name) {
- // TODO need a generic solution for each property of Binding
- for(String propertyName : BINDING_PROPERTIES) {
- if(propertyName.equalsIgnoreCase(name)) {
+ // TODO need a generic solution for each property of Binding
+ for (String propertyName : BINDING_PROPERTIES) {
+ if (propertyName.equalsIgnoreCase(name)) {
return true;
}
}
@@ -286,13 +286,13 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
}
protected String expandNamespaces(DocumentObject element, String value) {
- if(value.startsWith("{") || (value.indexOf(':') == -1)) {
+ if (value.startsWith("{") || (value.indexOf(':') == -1)) {
return value;
}
int length = IConstants.XAML_CLR_NAMESPACE_PROTO.length();
- for(String prefix : namespaceMapping.keySet()) {
+ for (String prefix : namespaceMapping.keySet()) {
String namespace = namespaceMapping.get(prefix);
- if(namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
+ if (namespace.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
String packageName = namespace.substring(length);
value = value.replace(prefix + ":", packageName + '.');
}
@@ -302,9 +302,9 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
/**
* Default constructor.
- *
+ *
* @param manager
- * loader instance.
+ * loader instance.
*/
public ElementHandler(ElementManager elementManager) {
this.ignoreSystemProcession = false;
@@ -314,14 +314,14 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
/**
* Internal constructor.
- *
+ *
* @param loader
- * loader instance.
+ * loader instance.
* @param parent
- * the parent element of loading stream.
+ * the parent element of loading stream.
*/
public ElementHandler(DocumentObject parent, ElementManager elementManager) {
- if(parent != null) {
+ if (parent != null) {
elementStack.push(parent);
bufferStack.push(textBuffer);
}
@@ -358,7 +358,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
*/
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
- if(prefix.length() == 0 && !ignoreSystemProcession) {
+ if (prefix.length() == 0 && !ignoreSystemProcession) {
defaultNamespace = uri;
}
namespaceMapping.put(prefix, uri);
@@ -391,13 +391,13 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
@Override
public void characters(char[] arg0, int arg1, int arg2) throws SAXException {
- if(!switchStack.isEmpty() && !switchStack.peek()) {
+ if (!switchStack.isEmpty() && !switchStack.peek()) {
return;
}
String string = new String(arg0, arg1, arg2);
- if(string.length() > 0) {
- if(textBuffer == null) {
+ if (string.length() > 0) {
+ if (textBuffer == null) {
textBuffer = new StringBuffer(string);
} else {
textBuffer.append(string);
@@ -424,11 +424,11 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
// Set xml's encoding to default.
- if(!ignoreSystemProcession && !hasSetDefaultEncoding) {
- if(locator instanceof Locator2) {
- Locator2 locator2 = (Locator2)locator;
+ if (!ignoreSystemProcession && !hasSetDefaultEncoding) {
+ if (locator instanceof Locator2) {
+ Locator2 locator2 = (Locator2) locator;
String encoding = locator2.getEncoding();
- if(encoding != null && encoding.length() > 0) {
+ if (encoding != null && encoding.length() > 0) {
elementManager.setEncoding(encoding);
}
}
@@ -438,9 +438,9 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
uri = normalizeNamespace(uri);
// If super condition does not allow parse children, ignore it.
- if(!switchStack.isEmpty() && !switchStack.peek()) {
- if(uri.equalsIgnoreCase(IConstants.XWT_NAMESPACE)) {
- if("Switch".equals(localName)) {
+ if (!switchStack.isEmpty() && !switchStack.peek()) {
+ if (uri.equalsIgnoreCase(IConstants.XWT_NAMESPACE)) {
+ if ("Switch".equals(localName)) {
// If children is switch element, than set false to it.
switchStack.push(false);
}
@@ -448,7 +448,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
return;
}
- if(localName.indexOf('.') > 0) {
+ if (localName.indexOf('.') > 0) {
preProperty(uri, localName, attrs);
} else {
preElement(uri, localName, attrs);
@@ -466,7 +466,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
public void endElement(String uri, String localName, String qName) throws SAXException {
elementIndexStack.pop();
- if(!elementIndexStack.isEmpty()) {
+ if (!elementIndexStack.isEmpty()) {
int nextIndex = elementIndexStack.pop();
elementIndexStack.push(nextIndex + 1);
}
@@ -474,20 +474,20 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
uri = normalizeNamespace(uri);
// If super condition does not allow parse children, ignore it.
- if(!switchStack.isEmpty() && !switchStack.peek()) {
- if(uri.equalsIgnoreCase(IConstants.XWT_NAMESPACE)) {
- if("Switch".equals(localName)) {
+ if (!switchStack.isEmpty() && !switchStack.peek()) {
+ if (uri.equalsIgnoreCase(IConstants.XWT_NAMESPACE)) {
+ if ("Switch".equals(localName)) {
switchStack.pop();
}
}
return;
}
- if(!elementStack.isEmpty()) {
+ if (!elementStack.isEmpty()) {
// remove current node from stack
DocumentObject element = elementStack.peek();
- if(element instanceof Attribute) {
+ if (element instanceof Attribute) {
postProperty(uri, localName);
} else {
postElement(uri, localName);
@@ -501,26 +501,26 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
namespace = normalizeNamespace(namespace);
name = normalizeName(name);
- if(name.equalsIgnoreCase("xdata")) {
+ if (name.equalsIgnoreCase("xdata")) {
needNormalizeName = false;
}
// Check the reference element.
String id = ElementManager.generateID(name);
// Check the same id elements.
- if(elementManager.hasElement(id)) {
+ if (elementManager.hasElement(id)) {
throw new SAXException(getFormattedMessage("Element already exists: ", id));
}
// Process attributes: original, external
Set<Attribute> attributes = new HashSet<Attribute>();
- for(int i = 0, len = attrs.getLength(); i < len; i++) {
+ for (int i = 0, len = attrs.getLength(); i < len; i++) {
String attrUri = normalizeAttrNamespace(attrs.getURI(i));
String attrName = attrs.getLocalName(i);
Attribute attribute;
int index = attrName.lastIndexOf('.');
- if(index != -1) {
+ if (index != -1) {
String prefix = normalizeName(attrName.substring(0, index));
String attributeName = (XWT.isXWTNamespace(attrUri) ? normalizeName(attrName.substring(index + 1)) : attrName);
@@ -538,7 +538,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
element.setId(id);
// Add current node to stack
- if(!elementStack.isEmpty()) {
+ if (!elementStack.isEmpty()) {
elementStack.peek().addChild(element);
}
@@ -554,41 +554,41 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
// : The same as postReference : //
- if(!elementStack.isEmpty()) {
+ if (!elementStack.isEmpty()) {
// remove current node from stack
DocumentObject element = elementStack.pop();
// Setting element text content
- if(textBuffer != null) {
+ if (textBuffer != null) {
String text = textBuffer.toString().trim();
- if(text.length() > 0) {
+ if (text.length() > 0) {
handleContent(element, text);
}
}
textBuffer = bufferStack.pop();
// Post the element registration.
- elementManager.postElement((Element)element);
+ elementManager.postElement((Element) element);
}
- if(name.equalsIgnoreCase("xdata")) {
+ if (name.equalsIgnoreCase("xdata")) {
needNormalizeName = true;
}
}
protected void handleContent(DocumentObject element, String text) {
- if(text.startsWith("{") && text.endsWith("}")) {
+ if (text.startsWith("{") && text.endsWith("}")) {
extensionParser.parse(element, text);
return;
} else {
// handle the case: <x:Array Type="ns:Type" >
- if(IConstants.XAML_X_TYPE.equals(element.getName()) || IConstants.XAML_X_STATIC.equals(element.getName())) {
+ if (IConstants.XAML_X_TYPE.equals(element.getName()) || IConstants.XAML_X_STATIC.equals(element.getName())) {
int index = text.indexOf(':');
- if(index != -1) {
+ if (index != -1) {
String ns = text.substring(0, index);
String content = text.substring(index + 1);
String namespace = namespaceMapping.get(ns);
- if(namespace != null) {
+ if (namespace != null) {
Element childElement = new Element(namespace, content, namespaceMapping);
childElement.setId(ElementManager.generateID(element.getName()));
element.addChild(childElement);
@@ -597,8 +597,8 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
}
}
}
- if(element instanceof Attribute && IConstants.XWT_X_NAMESPACE.equals(element.getNamespace())) {
- if(IConstants.XAML_STYLE.equalsIgnoreCase(element.getName()) || IConstants.XAML_X_CLASS.equalsIgnoreCase(element.getName()) || IConstants.XAML_X_CLASS_FACTORY.equalsIgnoreCase(element.getName())) {
+ if (element instanceof Attribute && IConstants.XWT_X_NAMESPACE.equals(element.getNamespace())) {
+ if (IConstants.XAML_STYLE.equalsIgnoreCase(element.getName()) || IConstants.XAML_X_CLASS.equalsIgnoreCase(element.getName()) || IConstants.XAML_X_CLASS_FACTORY.equalsIgnoreCase(element.getName())) {
// handle the expansion of x:Style = "(j:class).variable"
// and handle the expansion of x:Class = "(j:class).variable"
text = expandNamespaces(element, text);
@@ -611,21 +611,20 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
* It is compatible with XAML.
* <p>
* It must support the following features:
- *
+ *
* 1. <Panel> <Button> <Button.Content>Hello World</Button.Content> </Button> </Panel>
- *
+ *
* 2. <Panel> <Panel.Composite> <Button Content="Hello World" /> </Panel.Composite> </Panel>
- *
+ *
* 3. <Panel> <Panel.Composite> <Button> <Button.Content>Hello World</Button.Content> </Button> </Panel.Composite> </Panel>
- *
- * 4. <Panel> <Panel.Composite> <Button> <Button.Content>Hello</Button.Content> </Button> <Button> <Button.Content>World</Button.Content>
- * </Button> </Panel.Composite> </Panel>
+ *
+ * 4. <Panel> <Panel.Composite> <Button> <Button.Content>Hello</Button.Content> </Button> <Button> <Button.Content>World</Button.Content> </Button> </Panel.Composite> </Panel>
* </p>
- *
+ *
* @param namespace
- * attribute namespace
+ * attribute namespace
* @param name
- * attribute full name. like: Button.Content
+ * attribute full name. like: Button.Content
*/
private void preProperty(String namespace, String name, Attributes attrs) throws SAXException {
String elementTag = normalizeName(name.substring(0, name.indexOf('.')));
@@ -633,28 +632,28 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
String elementId = null;
// Search the owner element and get the ID.
- for(int i = elementStack.size() - 1; i >= 0; i--) {
+ for (int i = elementStack.size() - 1; i >= 0; i--) {
DocumentObject element = elementStack.get(i);
- if(element instanceof Element && element.getName().equals(elementTag)) {
+ if (element instanceof Element && element.getName().equals(elementTag)) {
elementId = element.getId();
break;
}
}
- if(elementId == null) {
+ if (elementId == null) {
preElement(namespace, name, attrs);
} else {
namespace = normalizeNamespace(namespace);
// Process attributes: original, external
Collection<Attribute> collection = new ArrayList<Attribute>();
- for(int i = 0, len = attrs.getLength(); i < len; i++) {
+ for (int i = 0, len = attrs.getLength(); i < len; i++) {
String attrUri = normalizeNamespace(attrs.getURI(i));
String attrName = attrs.getLocalName(i);
Attribute attr;
int index = attrName.lastIndexOf('.');
- if(index != -1) {
+ if (index != -1) {
String prefix = normalizeName(attrName.substring(0, index));
String aName = (XWT.isXWTNamespace(namespace) ? normalizeName(attrName.substring(index + 1)) : attrName);
attr = new Attribute(attrUri, aName, elementId);
@@ -677,14 +676,14 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
* @see #preProperty(String, String)
*/
private void postProperty(String namespace, String name) throws SAXException {
- if(!elementStack.isEmpty()) {
+ if (!elementStack.isEmpty()) {
// remove current node from stack
- Attribute attribute = (Attribute)elementStack.pop();
+ Attribute attribute = (Attribute) elementStack.pop();
// Setting attribute content
- if(textBuffer != null) {
+ if (textBuffer != null) {
String text = textBuffer.toString().trim();
- if(text.length() > 0) {
+ if (text.length() > 0) {
handleContent(attribute, text);
}
}
@@ -697,16 +696,16 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
/**
* Normalize the namespace string. If uri is null or length is zero, returns default namespace.
- *
+ *
* @param uri
- * The namespace which to normalize.
+ * The namespace which to normalize.
* @return Returns the normalized namespace.
*/
private String normalizeNamespace(String uri) {
- if(uri == null || uri.length() == 0) {
+ if (uri == null || uri.length() == 0) {
uri = defaultNamespace;
}
- if(uri.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
+ if (uri.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
return uri;
}
return uri.toLowerCase();
@@ -714,16 +713,16 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
/**
* Normalize the namespace string. If uri is null or length is zero, returns default namespace.
- *
+ *
* @param uri
- * The namespace which to normalize.
+ * The namespace which to normalize.
* @return Returns the normalized namespace.
*/
private String normalizeAttrNamespace(String uri) {
- if(uri == null || uri.length() == 0) {
+ if (uri == null || uri.length() == 0) {
uri = defaultNamespace;
}
- if(uri.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
+ if (uri.startsWith(IConstants.XAML_CLR_NAMESPACE_PROTO)) {
uri = defaultNamespace;
}
return uri.toLowerCase();
@@ -736,24 +735,24 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
* <p>
* e.g. Normalize &quot;font-face-name&quot; to &quot;FontFaceName&quot;
* </p>
- *
+ *
* @param tagName
- * The tag name which to normalize.
+ * The tag name which to normalize.
* @return the normalized tag name.
*/
private String normalizeName(String tagName) {
- if(!needNormalizeName) {
+ if (!needNormalizeName) {
return tagName;
}
StringBuffer buffer = new StringBuffer();
boolean isH = false;
- for(int i = 0, len = tagName.length(); i < len; i++) {
+ for (int i = 0, len = tagName.length(); i < len; i++) {
char c = tagName.charAt(i);
- if(i == 0) {
+ if (i == 0) {
buffer.append(Character.toUpperCase(c));
} else {
- switch(c) {
+ switch (c) {
case '-':
isH = true;
break;
@@ -762,7 +761,7 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
buffer.append(c);
break;
default:
- if(isH) {
+ if (isH) {
buffer.append(Character.toUpperCase(c));
isH = false;
} else {
@@ -786,8 +785,8 @@ class ElementHandler extends DefaultHandler implements ContentHandler {
*/
private String getIndexPath() {
StringBuilder sb = new StringBuilder();
- for(Integer index : elementIndexStack) {
- if(sb.length() != 0) {
+ for (Integer index : elementIndexStack) {
+ if (sb.length() != 0) {
sb.append('/');
}
sb.append(index.intValue());
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementManager.java
index 3648cf458a6..48472fefade 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/ElementManager.java
@@ -4,12 +4,12 @@
* 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:
* Soyatec - initial API and implementation
* Christian W. Damus (CEA) - Fix failure to propagate stream handlers of URLs (CDO)
* Christian W. Damus (CEA) - bug 417409
- *
+ *
*******************************************************************************/
package org.eclipse.papyrus.xwt.internal.xml;
@@ -77,7 +77,7 @@ public class ElementManager {
this.parserFactory = SAXParserFactory.newInstance();
this.parserFactory.setNamespaceAware(true);
this.parserFactory.setValidating(true);
- if(url != null) {
+ if (url != null) {
try {
documentRoot.init(null, url);
} catch (IOException e) {
@@ -98,13 +98,13 @@ public class ElementManager {
public void error(SAXParseException exception) throws SAXException {
Exception cause = exception.getException();
try {
- if(cause != null) {
+ if (cause != null) {
XWT.getLogger().error(cause);
} else {
XWT.getLogger().error(exception);
}
} catch (Exception e) {
- if(cause != null) {
+ if (cause != null) {
throw new SAXException(exception.getLocalizedMessage(), cause);
} else {
throw new SAXException(exception);
@@ -122,13 +122,13 @@ public class ElementManager {
public void fatalError(SAXParseException exception) throws SAXException {
Exception cause = exception.getException();
try {
- if(cause != null) {
+ if (cause != null) {
XWT.getLogger().error(cause);
} else {
XWT.getLogger().error(exception);
}
} catch (Exception e) {
- if(cause != null) {
+ if (cause != null) {
throw new SAXException(exception.getLocalizedMessage(), cause);
} else {
throw new SAXException(exception);
@@ -146,13 +146,13 @@ public class ElementManager {
public void warning(SAXParseException exception) throws SAXException {
Exception cause = exception.getException();
try {
- if(cause != null) {
+ if (cause != null) {
XWT.getLogger().error(cause);
} else {
XWT.getLogger().error(exception);
}
} catch (Exception e) {
- if(cause != null) {
+ if (cause != null) {
throw new SAXException(exception.getLocalizedMessage(), cause);
} else {
throw new SAXException(exception);
@@ -207,12 +207,12 @@ public class ElementManager {
public Element getRootElement() {
return rootElement;
}
-
+
/**
* Sets my root element (either loaded by me or perhaps obtained from some cache or other source).
- *
+ *
* @param rootElement
- * my root element
+ * my root element
*/
public void setRootElement(Element rootElement) {
this.rootElement = rootElement;
@@ -240,7 +240,7 @@ public class ElementManager {
reset();
- if(callback == null) {
+ if (callback == null) {
// Initialize document root
documentRoot.init(null, url);
@@ -288,9 +288,9 @@ public class ElementManager {
// Initialize document root
PushbackInputStream pis = null;
- if(stream != null) {
- if(stream instanceof PushbackInputStream) {
- pis = (PushbackInputStream)stream;
+ if (stream != null) {
+ if (stream instanceof PushbackInputStream) {
+ pis = (PushbackInputStream) stream;
} else {
pis = new PushbackInputStream(stream, 4);
}
@@ -299,7 +299,7 @@ public class ElementManager {
documentRoot.init(pis, url);
InputStream input = pis;
- if(pis == null) {
+ if (pis == null) {
input = documentRoot.openStream();
}
doLoad(input);
@@ -329,7 +329,7 @@ public class ElementManager {
}
private void loadXData(InputStream stream) {
- if(xDataElement != null) {
+ if (xDataElement != null) {
try {
SAXParser parser = parserFactory.newSAXParser();
parser.getXMLReader().setErrorHandler(errorHandler);
@@ -355,7 +355,7 @@ public class ElementManager {
elements.put(element.getId(), element);
// If it is a runnable element, add to top-level cache.
- if(element.getParent() == null && rootElement == null) {
+ if (element.getParent() == null && rootElement == null) {
rootElement = element;
}
}
@@ -366,7 +366,7 @@ public class ElementManager {
protected void postElement(Element element) {
assert element != null;
assert elements.containsKey(element.getId()) : "Element not found in registry: " + element.getId();
- if("xdata".equalsIgnoreCase(element.getName()) && IConstants.XWT_X_NAMESPACE.equals(element.getNamespace())) {
+ if ("xdata".equalsIgnoreCase(element.getName()) && IConstants.XWT_X_NAMESPACE.equals(element.getNamespace())) {
xDataElement = element;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/IElementCache.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/IElementCache.java
index f5f2293024b..0c3ba493700 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/IElementCache.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/IElementCache.java
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014 CEA 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
@@ -36,21 +36,21 @@ public interface IElementCache {
/**
* Obtains the previously cached element parsed from the given {@code url}.
- *
+ *
* @param url
- * the URL of an XWT resource
- *
+ * the URL of an XWT resource
+ *
* @return the previously parsed contents of the resource, or {@code null} if the cache has nothing for this {@code url}
*/
Element getElement(URL url);
/**
* Adds an {@code element} parsed from the resource indicated by the given {@code url}.
- *
+ *
* @param url
- * the URL of an XWT resource that was parsed
+ * the URL of an XWT resource that was parsed
* @param element
- * the element that was parsed from it
+ * the element that was parsed from it
*/
void cache(URL url, Element element);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/XDataHandler.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/XDataHandler.java
index 592bf0ec309..884baf38aec 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/XDataHandler.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/internal/xml/XDataHandler.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -33,62 +33,69 @@ public class XDataHandler extends DefaultHandler implements ContentHandler {
this.out = out;
}
+ @Override
public void startPrefixMapping(String prefix, String uri) {
namespaceBegin = true;
currentNamespace = prefix;
currentNamespaceUri = uri;
}
+ @Override
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
- if(started) {
+ if (started) {
out.append("<" + qName);
- if(namespaceBegin) {
+ if (namespaceBegin) {
out.append(" xmlns:" + currentNamespace + "=\"" + currentNamespaceUri + "\"");
namespaceBegin = false;
}
- for(int i = 0; i < atts.getLength(); i++) {
+ for (int i = 0; i < atts.getLength(); i++) {
out.append(" " + atts.getQName(i) + "=\"" + atts.getValue(i) + "\"");
}
out.append(">");
}
- if(localName.equalsIgnoreCase("xdata")) {
+ if (localName.equalsIgnoreCase("xdata")) {
started = true;
}
}
+ @Override
public void endElement(String namespaceURI, String localName, String qName) {
- if(localName.equalsIgnoreCase("xdata")) {
+ if (localName.equalsIgnoreCase("xdata")) {
started = false;
}
- if(started) {
+ if (started) {
out.append("</" + qName + ">");
}
}
+ @Override
public void characters(char[] ch, int start, int length) {
- if(started) {
- for(int i = start; i < start + length; i++) {
+ if (started) {
+ for (int i = start; i < start + length; i++) {
out.append(ch[i]);
}
}
}
+ @Override
public void ignorableWhitespace(char[] ch, int start, int length) {
- if(started) {
- for(int i = start; i < start + length; i++) {
+ if (started) {
+ for (int i = start; i < start + length; i++) {
out.append(ch[i]);
}
}
}
+ @Override
public void processingInstruction(String target, String data) {
- if(started) {
+ if (started) {
out.append("<?" + target + " " + data + "?>");
}
}
+ @Override
public void skippedEntity(String name) {
- if(started) {
+ if (started) {
out.append("&" + name + ";");
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/Controller.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/Controller.java
index ac706050f70..5e63498dc24 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/Controller.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/Controller.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -39,15 +39,15 @@ public class Controller implements Listener, IEventController {
protected void fireEvent(Event e) {
int eventType = e.type;
- if(eventTypes == null) {
+ if (eventTypes == null) {
return;
}
- for(int i = 0; i < eventTypes.length; i++) {
- if(eventTypes[i] == eventType) {
+ for (int i = 0; i < eventTypes.length; i++) {
+ if (eventTypes[i] == eventType) {
Object handler = handlers[i];
- if(handler instanceof IEventInvoker) {
- IEventInvoker eventInvoker = (IEventInvoker)handler;
+ if (handler instanceof IEventInvoker) {
+ IEventInvoker eventInvoker = (IEventInvoker) handler;
try {
eventInvoker.invoke(args[i], e);
} catch (Exception e1) {
@@ -55,11 +55,11 @@ public class Controller implements Listener, IEventController {
return;
}
} else {
- Method method = (Method)handler;
+ Method method = (Method) handler;
try {
method.setAccessible(true);
// support old style
- if(method.getParameterTypes().length == 1) {
+ if (method.getParameterTypes().length == 1) {
method.invoke(receivers[i], e);
} else {
method.invoke(receivers[i], args[i], e);
@@ -80,11 +80,11 @@ public class Controller implements Listener, IEventController {
* org.eclipse.papyrus.xwt.metadata.IEvent)
*/
public boolean hasEvent(Object receiver, IEvent event) {
- if(receivers == null) {
+ if (receivers == null) {
return false;
}
- for(int i = 0; i < receivers.length; i++) {
- if(receivers[i] == receiver && names[i].equalsIgnoreCase(event.getName())) {
+ for (int i = 0; i < receivers.length; i++) {
+ if (receivers[i] == receiver && names[i].equalsIgnoreCase(event.getName())) {
return true;
}
}
@@ -108,20 +108,20 @@ public class Controller implements Listener, IEventController {
}
protected void doAddEvent(int eventType, String name, IEvent event, Widget control, Object receiver, Object arg, Object method) {
- if(eventTypes == null) {
+ if (eventTypes == null) {
eventTypes = new int[3];
handlers = new Method[3];
names = new String[3];
receivers = new Object[3];
args = new Object[3];
} else {
- for(int i = 0; i < eventTypes.length; i++) {
- if(eventTypes[i] == eventType && handlers[i] == method && receivers[i] == receivers && args[i] == arg) {
+ for (int i = 0; i < eventTypes.length; i++) {
+ if (eventTypes[i] == eventType && handlers[i] == method && receivers[i] == receivers && args[i] == arg) {
return;
}
}
}
- if(waterMark >= eventTypes.length) {
+ if (waterMark >= eventTypes.length) {
int[] oldEventTypes = eventTypes;
Object[] oldHandlers = handlers;
Object[] oldReceivers = receivers;
@@ -147,16 +147,16 @@ public class Controller implements Listener, IEventController {
args[waterMark] = arg;
names[waterMark++] = name;
- if(eventType == IEventConstants.XWT_SWT_LOADED) {
+ if (eventType == IEventConstants.XWT_SWT_LOADED) {
int swt_paint = XWTMaps.getEvent("swt.paint");
- if(swt_paint != SWT.None) { // for RAP integration
+ if (swt_paint != SWT.None) { // for RAP integration
Listener[] listeners = control.getListeners(swt_paint);
- if(listeners.length > 0) {
- for(Listener listener : listeners) {
+ if (listeners.length > 0) {
+ for (Listener listener : listeners) {
control.removeListener(swt_paint, listener);
}
control.addListener(swt_paint, new LoadedEventListener(control));
- for(Listener listener : listeners) {
+ for (Listener listener : listeners) {
control.addListener(swt_paint, listener);
}
} else {
@@ -178,7 +178,7 @@ public class Controller implements Listener, IEventController {
public void handleEvent(Event event) {
Event loadedEvent = copy(event);
loadedEvent.type = IEventConstants.XWT_SWT_LOADED;
- if(XWTMaps.getEvent("swt.paint") != SWT.None) {
+ if (XWTMaps.getEvent("swt.paint") != SWT.None) {
control.removeListener(XWTMaps.getEvent("swt.paint"), this);
}
Controller.this.handleEvent(loadedEvent);
@@ -196,7 +196,7 @@ public class Controller implements Listener, IEventController {
public void setEvent(IEvent event, Widget control, Object receiver, Object arg, Method method) {
String name = event.getName();
int eventType = getEventTypeByName(name);
- if(eventType != SWT.None) {
+ if (eventType != SWT.None) {
addEvent(eventType, name, event, control, receiver, arg, method);
}
}
@@ -204,14 +204,14 @@ public class Controller implements Listener, IEventController {
public void setEvent(IEvent event, Widget control, Object arg, IEventInvoker eventInvoker) {
String name = event.getName();
int eventType = getEventTypeByName(name);
- if(eventType != SWT.None) {
+ if (eventType != SWT.None) {
doAddEvent(eventType, name, event, control, null, arg, eventInvoker);
}
}
public static Event copy(Event event) {
Event copyEvent = new Event();
- for(Field field : event.getClass().getDeclaredFields()) {
+ for (Field field : event.getClass().getDeclaredFields()) {
try {
field.set(copyEvent, field.get(event));
} catch (Exception e) {
@@ -222,87 +222,87 @@ public class Controller implements Listener, IEventController {
}
public static int getEventTypeByName(String name) {
- if(IEventConstants.KEY_DOWN.equalsIgnoreCase(name)) {
+ if (IEventConstants.KEY_DOWN.equalsIgnoreCase(name)) {
return SWT.KeyDown;
- } else if(IEventConstants.KEY_UP.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.KEY_UP.equalsIgnoreCase(name)) {
return SWT.KeyUp;
- } else if(IEventConstants.MOUSE_DOWN.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_DOWN.equalsIgnoreCase(name)) {
return SWT.MouseDown;
- } else if(IEventConstants.MOUSE_UP.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_UP.equalsIgnoreCase(name)) {
return SWT.MouseUp;
- } else if(IEventConstants.MOUSE_MOVE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_MOVE.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.mousemove");
- } else if(IEventConstants.MOUSE_ENTER.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_ENTER.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.mouseenter");
- } else if(IEventConstants.MOUSE_EXIT.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_EXIT.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.mouseexit");
- } else if(IEventConstants.MOUSE_DOUBLE_CLICK.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_DOUBLE_CLICK.equalsIgnoreCase(name)) {
return SWT.MouseDoubleClick;
- } else if(IEventConstants.PAINT.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.PAINT.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.paint");
- } else if(IEventConstants.MOVE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOVE.equalsIgnoreCase(name)) {
return SWT.Move;
- } else if(IEventConstants.RESIZE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.RESIZE.equalsIgnoreCase(name)) {
return SWT.Resize;
- } else if(IEventConstants.DISPOSE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.DISPOSE.equalsIgnoreCase(name)) {
return SWT.Dispose;
- } else if(IEventConstants.SELECTION.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.SELECTION.equalsIgnoreCase(name)) {
return SWT.Selection;
- } else if(IEventConstants.DEFAULT_SELECTION.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.DEFAULT_SELECTION.equalsIgnoreCase(name)) {
return SWT.DefaultSelection;
- } else if(IEventConstants.FOCUS_IN.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.FOCUS_IN.equalsIgnoreCase(name)) {
return SWT.FocusIn;
- } else if(IEventConstants.FOCUS_OUT.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.FOCUS_OUT.equalsIgnoreCase(name)) {
return SWT.FocusOut;
- } else if(IEventConstants.EXPAND.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.EXPAND.equalsIgnoreCase(name)) {
return SWT.Expand;
- } else if(IEventConstants.COLLAPSE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.COLLAPSE.equalsIgnoreCase(name)) {
return SWT.Collapse;
- } else if(IEventConstants.ICONIFY.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.ICONIFY.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.iconify");
- } else if(IEventConstants.DEICONIFY.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.DEICONIFY.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.deiconify");
- } else if(IEventConstants.CLOSE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.CLOSE.equalsIgnoreCase(name)) {
return SWT.Close;
- } else if(IEventConstants.SHOW.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.SHOW.equalsIgnoreCase(name)) {
return SWT.Show;
- } else if(IEventConstants.HIDE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.HIDE.equalsIgnoreCase(name)) {
return SWT.Hide;
- } else if(IEventConstants.MODIFY.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MODIFY.equalsIgnoreCase(name)) {
return SWT.Modify;
- } else if(IEventConstants.VERIFY.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.VERIFY.equalsIgnoreCase(name)) {
return SWT.Verify;
- } else if(IEventConstants.ACTIVATE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.ACTIVATE.equalsIgnoreCase(name)) {
return SWT.Activate;
- } else if(IEventConstants.DEACTIVATE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.DEACTIVATE.equalsIgnoreCase(name)) {
return SWT.Deactivate;
- } else if(IEventConstants.HELP.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.HELP.equalsIgnoreCase(name)) {
return SWT.Help;
- } else if(IEventConstants.DRAG_SELECT.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.DRAG_SELECT.equalsIgnoreCase(name)) {
return SWT.DragDetect;
- } else if(IEventConstants.ARM.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.ARM.equalsIgnoreCase(name)) {
return SWT.Arm;
- } else if(IEventConstants.TRAVERSE.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.TRAVERSE.equalsIgnoreCase(name)) {
return SWT.Traverse;
- } else if(IEventConstants.MOUSE_HOVER.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_HOVER.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.mousehover");
- } else if(IEventConstants.HARD_KEY_DOWN.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.HARD_KEY_DOWN.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.hardkeydown");
- } else if(IEventConstants.HARD_KEY_UP.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.HARD_KEY_UP.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.hardkeyup");
- } else if(IEventConstants.MENU_DETECT.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MENU_DETECT.equalsIgnoreCase(name)) {
return SWT.MenuDetect;
- } else if(IEventConstants.MOUSE_WHEEL.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MOUSE_WHEEL.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.mousewheel");
- } else if(IEventConstants.SETTINGS.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.SETTINGS.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.settings");
- } else if(IEventConstants.ERASE_ITEM.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.ERASE_ITEM.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.eraseitem");
- } else if(IEventConstants.MEASURE_ITEM.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.MEASURE_ITEM.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.measureitem");
- } else if(IEventConstants.PAINT_ITEM.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.PAINT_ITEM.equalsIgnoreCase(name)) {
return XWTMaps.getEvent("swt.paintitem");
- } else if(IEventConstants.XWT_LOADED.equalsIgnoreCase(name) || IEventConstants.XWT_LOADED_EVENT.equalsIgnoreCase(name)) {
+ } else if (IEventConstants.XWT_LOADED.equalsIgnoreCase(name) || IEventConstants.XWT_LOADED_EVENT.equalsIgnoreCase(name)) {
return IEventConstants.XWT_SWT_LOADED;
}
// case SWT.PaintItem:
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoader.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoader.java
index 0adaa7863d9..e4681fa4224 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoader.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoader.java
@@ -153,10 +153,10 @@ public class ResourceLoader implements IVisualElementLoader {
}
public Object findElement(Class<?> type) {
- if(type.isInstance(currentWidget)) {
+ if (type.isInstance(currentWidget)) {
return currentWidget;
}
- if(parent != null) {
+ if (parent != null) {
return parent.findElement(type);
}
return null;
@@ -204,16 +204,16 @@ public class ResourceLoader implements IVisualElementLoader {
protected void doInject(Object targetObject, String name, Object previousClr) {
Class<?> filedType = targetObject.getClass();
- if(clr != null && (previousClr != clr || previousClr == null)) {
- for(Field field : clr.getClass().getDeclaredFields()) {
+ if (clr != null && (previousClr != clr || previousClr == null)) {
+ for (Field field : clr.getClass().getDeclaredFields()) {
UI annotation = field.getAnnotation(UI.class);
- if(annotation != null) {
- if(!field.getType().isAssignableFrom(filedType)) {
+ if (annotation != null) {
+ if (!field.getType().isAssignableFrom(filedType)) {
continue;
}
String annotationValue = annotation.value();
- if(annotationValue == null || annotationValue.length() == 0) {
- if(field.getName().equals(name)) {
+ if (annotationValue == null || annotationValue.length() == 0) {
+ if (field.getName().equals(name)) {
field.setAccessible(true);
try {
field.set(clr, targetObject);
@@ -221,7 +221,7 @@ public class ResourceLoader implements IVisualElementLoader {
} catch (Exception e) {
}
}
- } else if(annotationValue.equals(name)) {
+ } else if (annotationValue.equals(name)) {
field.setAccessible(true);
try {
field.set(clr, targetObject);
@@ -232,7 +232,7 @@ public class ResourceLoader implements IVisualElementLoader {
}
}
}
- if(parent != null) {
+ if (parent != null) {
parent.doInject(targetObject, name, clr);
}
}
@@ -243,49 +243,49 @@ public class ResourceLoader implements IVisualElementLoader {
Object clrObject = null;
LoadingData current = this;
ResourceLoader currentParentLoader = parentLoader;
- while(current != null) {
+ while (current != null) {
Object receiver = current.getClr();
- if(receiver instanceof IEventHandler) {
- IEventHandler eventManager = (IEventHandler)receiver;
+ if (receiver instanceof IEventHandler) {
+ IEventHandler eventManager = (IEventHandler) receiver;
IEventInvoker eventInvoker = eventManager.getEventInvoker(handler, control.getClass(), Event.class);
- if(eventInvoker != null) {
+ if (eventInvoker != null) {
eventController.setEvent(event, control, control, eventInvoker);
}
- } else if(receiver != null) {
+ } else if (receiver != null) {
Class<?> clazz = receiver.getClass();
method = ObjectUtil.findMethod(clazz, handler, control.getClass(), Event.class);
- if(method == null) {
+ if (method == null) {
method = ObjectUtil.findMethod(clazz, handler, Event.class);
}
- if(method == null) {
+ if (method == null) {
// Load again.
clazz = ClassLoaderUtil.loadClass(context.getLoadingContext(), clazz.getName());
method = ObjectUtil.findMethod(clazz, handler, Event.class);
}
- if(method != null) {
+ if (method != null) {
clrObject = receiver;
eventController.setEvent(event, control, clrObject, control, method);
break;
}
}
current = current.getParent();
- if(current == null && currentParentLoader != null) {
+ if (current == null && currentParentLoader != null) {
current = currentParentLoader.loadData;
currentParentLoader = currentParentLoader.parentLoader;
}
}
- if(method == null) {
+ if (method == null) {
LoggerManager.log(new XWTException("Event handler \"" + handler + "\" is not found."));
}
}
public void end() {
- if(parent == null || clr != parent.getClr()) {
+ if (parent == null || clr != parent.getClr()) {
Method method = ObjectUtil.findDeclaredMethod(clr.getClass(), "initializeComponent");
- if(method == null) {
+ if (method == null) {
method = ObjectUtil.findDeclaredMethod(clr.getClass(), "InitializeComponent");
}
- if(method != null) {
+ if (method != null) {
try {
method.setAccessible(true);
method.invoke(clr);
@@ -297,7 +297,7 @@ public class ResourceLoader implements IVisualElementLoader {
}
public void addStyle(IStyle style) {
- if(styles == Collections.EMPTY_LIST) {
+ if (styles == Collections.EMPTY_LIST) {
styles = new ArrayList<IStyle>();
}
styles.add(style);
@@ -326,25 +326,25 @@ public class ResourceLoader implements IVisualElementLoader {
this.options = options;
Object container = options.get(IXWTLoader.CONTAINER_PROPERTY);
Widget parent = UserData.getWidget(container);
- if(!loader.getTrackings().isEmpty()) {
+ if (!loader.getTrackings().isEmpty()) {
dataBindingTrack = new DataBindingTrack();
}
- parentLoader = (ResourceLoader)options.get(RESOURCE_LOADER_PROPERTY);
+ parentLoader = (ResourceLoader) options.get(RESOURCE_LOADER_PROPERTY);
options.remove(RESOURCE_LOADER_PROPERTY);
- ResourceDictionary resourceDictionary = (ResourceDictionary)options.get(IXWTLoader.RESOURCE_DICTIONARY_PROPERTY);
+ ResourceDictionary resourceDictionary = (ResourceDictionary) options.get(IXWTLoader.RESOURCE_DICTIONARY_PROPERTY);
- if(resourceDictionary != null) {
+ if (resourceDictionary != null) {
Object styles = resourceDictionary.get(Core.DEFAULT_STYLES_KEY);
- if(styles != null) {
- loadData.setStyles((Collection<IStyle>)styles);
+ if (styles != null) {
+ loadData.setStyles((Collection<IStyle>) styles);
resourceDictionary.remove(Core.DEFAULT_STYLES_KEY);
}
}
- if(!options.containsKey(IXWTLoader.CLASS_FACTORY_PROPERTY)) {
+ if (!options.containsKey(IXWTLoader.CLASS_FACTORY_PROPERTY)) {
try {
options.put(IXWTLoader.CLASS_FACTORY_PROPERTY, loader.getCLRFactory());
} catch (UnsupportedOperationException e) {
- if(options.isEmpty()) {
+ if (options.isEmpty()) {
options = new HashMap<String, Object>();
options.put(IXWTLoader.CLASS_FACTORY_PROPERTY, loader.getCLRFactory());
} else {
@@ -356,23 +356,23 @@ public class ResourceLoader implements IVisualElementLoader {
Object control = doCreate(parent, element, null, options);
// get databinding messages and print into console view
- if(dataBindingTrack != null) {
+ if (dataBindingTrack != null) {
String dataBindingMessage = dataBindingTrack.getDataBindMessage();// getDataBindMessage();
org.eclipse.papyrus.xwt.ILogger log = loader.getLogger();
log.addMessage(dataBindingMessage, Tracking.DATABINDING);
log.printInfo(dataBindingMessage, Tracking.DATABINDING, loader.getTrackings());
}
- if(control instanceof Composite) {
- ((Composite)control).layout();
+ if (control instanceof Composite) {
+ ((Composite) control).layout();
}
- ILoadedCallback loadedAction = (ILoadedCallback)options.get(IXWTLoader.LOADED_CALLBACK);
- if(loadedAction != null) {
+ ILoadedCallback loadedAction = (ILoadedCallback) options.get(IXWTLoader.LOADED_CALLBACK);
+ if (loadedAction != null) {
loadedAction.onLoaded(control);
}
return control;
} catch (Exception e) {
- if(e instanceof RuntimeException) {
- throw ((RuntimeException)e);
+ if (e instanceof RuntimeException) {
+ throw ((RuntimeException) e);
}
throw new XWTException(e);
@@ -381,26 +381,26 @@ public class ResourceLoader implements IVisualElementLoader {
protected Object doCreate(Object parent, Element element, Class<?> constraintType, Map<String, Object> options) throws Exception {
int styles = -1;
- if(options.containsKey(IXWTLoader.INIT_STYLE_PROPERTY)) {
- styles = (Integer)options.get(IXWTLoader.INIT_STYLE_PROPERTY);
+ if (options.containsKey(IXWTLoader.INIT_STYLE_PROPERTY)) {
+ styles = (Integer) options.get(IXWTLoader.INIT_STYLE_PROPERTY);
}
- ResourceDictionary dico = (ResourceDictionary)options.get(IXWTLoader.RESOURCE_DICTIONARY_PROPERTY);
+ ResourceDictionary dico = (ResourceDictionary) options.get(IXWTLoader.RESOURCE_DICTIONARY_PROPERTY);
Object dataContext = options.get(IXWTLoader.DATACONTEXT_PROPERTY);
Object bindingContext = options.get(IXWTLoader.BINDING_CONTEXT_PROPERTY);
String name = element.getName();
String namespace = element.getNamespace();
- if(IConstants.XWT_X_NAMESPACE.equalsIgnoreCase(namespace)) {
- if(IConstants.XAML_X_NULL.equalsIgnoreCase(name)) {
+ if (IConstants.XWT_X_NAMESPACE.equalsIgnoreCase(namespace)) {
+ if (IConstants.XAML_X_NULL.equalsIgnoreCase(name)) {
return null;
}
- if(IConstants.XAML_X_TYPE.equalsIgnoreCase(name) && constraintType != null && constraintType instanceof Class<?>) {
+ if (IConstants.XAML_X_TYPE.equalsIgnoreCase(name) && constraintType != null && constraintType instanceof Class<?>) {
DocumentObject[] children = element.getChildren();
- if(children != null && children.length > 0) {
- if(children[0] instanceof Element) {
- Element type = (Element)children[0];
+ if (children != null && children.length > 0) {
+ if (children[0] instanceof Element) {
+ Element type = (Element) children[0];
IMetaclass metaclass = loader.getMetaclass(type.getName(), type.getNamespace());
- if(metaclass != null) {
+ if (metaclass != null) {
return metaclass.getType();
}
}
@@ -412,10 +412,10 @@ public class ResourceLoader implements IVisualElementLoader {
return null;
}
IMetaclass metaclass = loader.getMetaclass(name, namespace);
- if(constraintType != null && !(IBinding.class.isAssignableFrom(metaclass.getType())) && (!constraintType.isAssignableFrom(metaclass.getType()))) {
- if(!constraintType.isArray() || !constraintType.getComponentType().isAssignableFrom(metaclass.getType())) {
+ if (constraintType != null && !(IBinding.class.isAssignableFrom(metaclass.getType())) && (!constraintType.isAssignableFrom(metaclass.getType()))) {
+ if (!constraintType.isArray() || !constraintType.getComponentType().isAssignableFrom(metaclass.getType())) {
IConverter converter = XWT.findConvertor(metaclass.getType(), constraintType);
- if(converter == null) {
+ if (converter == null) {
return null;
}
}
@@ -423,12 +423,12 @@ public class ResourceLoader implements IVisualElementLoader {
Object targetObject = null;
Integer styleValue = getStyleValue(element, styles);
- if(parent == null || metaclass.getType() == Shell.class) {
- if(dataBindingTrack != null) {
+ if (parent == null || metaclass.getType() == Shell.class) {
+ if (dataBindingTrack != null) {
dataBindingTrack.addWidgetElement(element);
}
Shell shell = null;
- if((parent == null && metaclass.getType() != Shell.class) || styleValue == null || styleValue == -1) {
+ if ((parent == null && metaclass.getType() != Shell.class) || styleValue == null || styleValue == -1) {
styleValue = SWT.SHELL_TRIM;
}
Display display = Display.getCurrent();
@@ -437,14 +437,14 @@ public class ResourceLoader implements IVisualElementLoader {
invokeCreatededAction(element, targetObject);
loadData.setCurrentWidget(shell);
- if(metaclass.getType() != Shell.class) {
+ if (metaclass.getType() != Shell.class) {
shell.setLayout(new FillLayout());
return doCreate(targetObject, element, constraintType, options);
} else {
- if(bindingContext != null) {
+ if (bindingContext != null) {
setBindingContext(metaclass, targetObject, dico, bindingContext);
}
- if(dataContext != null) {
+ if (dataContext != null) {
setDataContext(metaclass, targetObject, dico, dataContext);
}
}
@@ -452,19 +452,19 @@ public class ResourceLoader implements IVisualElementLoader {
// for Shell
Attribute classAttribute = element.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_CLASS);
- if(classAttribute != null) {
+ if (classAttribute != null) {
String className = classAttribute.getContent();
loadShellCLR(className, shell);
} else {
Attribute classFactoryAttribute = element.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_CLASS_FACTORY);
- ICLRFactory clrFactory = (ICLRFactory)options.get(XWTLoader.CLASS_FACTORY_PROPERTY);
- if(classFactoryAttribute != null) {
+ ICLRFactory clrFactory = (ICLRFactory) options.get(IXWTLoader.CLASS_FACTORY_PROPERTY);
+ if (classFactoryAttribute != null) {
String content = classFactoryAttribute.getContent();
Object clr = loadFactoryCLR(content, clrFactory);
loadData.setClr(clr);
UserData.setCLR(shell, clr);
} else {
- if(clrFactory != null) {
+ if (clrFactory != null) {
Object clr = clrFactory.createCLR(null, options);
loadData.setClr(clr);
UserData.setCLR(shell, clr);
@@ -479,19 +479,19 @@ public class ResourceLoader implements IVisualElementLoader {
//
Class<?> type = metaclass.getType();
URL file = type.getResource(type.getSimpleName() + IConstants.XWT_EXTENSION_SUFFIX);
- if(file != null && nameScoped != null) {
- if(parent instanceof Composite) {
- Object childDataContext = getDataContext(element, (Widget)parent);
- Object childBindingContext = getBindingContext(element, (Widget)parent);
- if(dataContext != null) {
+ if (file != null && nameScoped != null) {
+ if (parent instanceof Composite) {
+ Object childDataContext = getDataContext(element, (Widget) parent);
+ Object childBindingContext = getBindingContext(element, (Widget) parent);
+ if (dataContext != null) {
childDataContext = dataContext;
}
- if(bindingContext != null) {
+ if (bindingContext != null) {
childBindingContext = bindingContext;
}
Map<String, Object> nestedOptions = new HashMap<String, Object>();
nestedOptions.put(IXWTLoader.CONTAINER_PROPERTY, parent);
- if(styleValue != null) {
+ if (styleValue != null) {
nestedOptions.put(IXWTLoader.INIT_STYLE_PROPERTY, styleValue);
}
nestedOptions.put(IXWTLoader.DATACONTEXT_PROPERTY, childDataContext);
@@ -502,7 +502,7 @@ public class ResourceLoader implements IVisualElementLoader {
// global
// setting
targetObject = loader.loadWithOptions(file, nestedOptions);
- if(targetObject == null) {
+ if (targetObject == null) {
return null;
}
invokeCreatededAction(element, targetObject);
@@ -511,50 +511,50 @@ public class ResourceLoader implements IVisualElementLoader {
}
} else {
Object[] parameters = null;
- if(TableViewerColumn.class.isAssignableFrom(type)) {
+ if (TableViewerColumn.class.isAssignableFrom(type)) {
int columnIndex = getColumnIndex(element);
- parameters = (styleValue != null ? new Object[]{ parent, styleValue, columnIndex } : new Object[]{ parent, SWT.NONE, columnIndex });
+ parameters = (styleValue != null ? new Object[] { parent, styleValue, columnIndex } : new Object[] { parent, SWT.NONE, columnIndex });
} else {
- parameters = (styleValue != null ? new Object[]{ parent, styleValue } : new Object[]{ parent });
+ parameters = (styleValue != null ? new Object[] { parent, styleValue } : new Object[] { parent });
}
// x:Class
{
boolean hasClass = false;
Attribute classAttribute = element.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_CLASS);
- if(classAttribute != null) {
+ if (classAttribute != null) {
String className = classAttribute.getContent();
targetObject = loadCLR(className, parameters, metaclass.getType(), options);
hasClass = true;
} else {
- Object clr = options.get(XWTLoader.CLASS_PROPERTY);
- if(clr != null) {
+ Object clr = options.get(IXWTLoader.CLASS_PROPERTY);
+ if (clr != null) {
loadData.setClr(clr);
hasClass = true;
}
}
- if(!hasClass) {
+ if (!hasClass) {
Attribute classFactoryAttribute = element.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_CLASS_FACTORY);
- ICLRFactory clrFactory = (ICLRFactory)options.get(XWTLoader.CLASS_FACTORY_PROPERTY);
- if(classFactoryAttribute != null) {
+ ICLRFactory clrFactory = (ICLRFactory) options.get(IXWTLoader.CLASS_FACTORY_PROPERTY);
+ if (classFactoryAttribute != null) {
Object clr = loadFactoryCLR(classFactoryAttribute.getContent(), clrFactory);
- if(clr != null) {
+ if (clr != null) {
loadData.setClr(clr);
}
} else {
- if(clrFactory != null) {
+ if (clrFactory != null) {
loadData.setClr(clrFactory.createCLR(null, options));
}
}
}
- if(targetObject == null) {
+ if (targetObject == null) {
targetObject = metaclass.newInstance(parameters);
invokeCreatededAction(element, targetObject);
Widget widget = UserData.getWidget(targetObject);
- if(widget != null) {
+ if (widget != null) {
Object clr = loadData.getClr();
- if(clr != null) {
+ if (clr != null) {
UserData.setCLR(widget, clr);
}
}
@@ -563,16 +563,16 @@ public class ResourceLoader implements IVisualElementLoader {
}
}
- if(targetObject == null) {
+ if (targetObject == null) {
return null;
}
}
}
Widget widget = UserData.getWidget(targetObject);
- if(widget != null) {
+ if (widget != null) {
loadData.setCurrentWidget(targetObject);
}
- if(scopedObject == null && widget != null) {
+ if (scopedObject == null && widget != null) {
scopedObject = widget;
nameScoped = new ScopeKeeper((parent == null ? null : UserData.findScopeKeeper(parent)), widget);
UserData.bindNameContext(widget, nameScoped);
@@ -580,35 +580,35 @@ public class ResourceLoader implements IVisualElementLoader {
// set first data context and resource dictionary
setDataContext(metaclass, targetObject, dico, dataContext);
- if(bindingContext != null) {
+ if (bindingContext != null) {
setBindingContext(metaclass, targetObject, dico, bindingContext);
}
- if(dataBindingTrack != null) {
+ if (dataBindingTrack != null) {
dataBindingTrack.tracking(targetObject, element, dataContext);
}
// set parent relationship and viewer
- if(targetObject instanceof Widget) {
- if(parent != null) {
+ if (targetObject instanceof Widget) {
+ if (parent != null) {
UserData.setParent(targetObject, parent);
}
- } else if(JFacesHelper.isViewer(targetObject)) {
+ } else if (JFacesHelper.isViewer(targetObject)) {
UserData.setParent(targetObject, parent);
UserData.setViewer(targetObject, targetObject);
- } else if(targetObject instanceof TableItemProperty.Cell) {
- ((TableItemProperty.Cell)targetObject).setParent((TableItem)parent);
+ } else if (targetObject instanceof TableItemProperty.Cell) {
+ ((TableItemProperty.Cell) targetObject).setParent((TableItem) parent);
}
applyStyles(element, targetObject);
- for(Map.Entry<String, Object> entry : options.entrySet()) {
+ for (Map.Entry<String, Object> entry : options.entrySet()) {
String key = entry.getKey();
- if(IXWTLoader.Utilities.isPropertyName(key)) {
+ if (IXWTLoader.Utilities.isPropertyName(key)) {
continue;
}
IProperty property = metaclass.findProperty(key);
- if(property == null) {
+ if (property == null) {
throw new XWTException("Property " + key + " not found.");
}
property.setValue(targetObject, entry.getValue());
@@ -616,36 +616,36 @@ public class ResourceLoader implements IVisualElementLoader {
Map<String, IProperty> delayedAttributes = new HashMap<String, IProperty>();
init(metaclass, targetObject, element, delayedAttributes);
- if(targetObject instanceof Style && element.getChildren().length > 0) {
+ if (targetObject instanceof Style && element.getChildren().length > 0) {
Collection<Setter> setters = new ArrayList<Setter>();
- for(DocumentObject doc : element.getChildren()) {
- Object child = doCreate(targetObject, (Element)doc, null, Collections.<String, Object> emptyMap());
- if(!(child instanceof Setter)) {
+ for (DocumentObject doc : element.getChildren()) {
+ Object child = doCreate(targetObject, (Element) doc, null, Collections.<String, Object> emptyMap());
+ if (!(child instanceof Setter)) {
throw new XWTException("Setter is expected in Style.");
}
- setters.add((Setter)child);
- }
- ((Style)targetObject).setSetters(setters.toArray(new Setter[setters.size()]));
- } else if(targetObject instanceof ControlEditor) {
- for(DocumentObject doc : element.getChildren()) {
- Object editor = doCreate(parent, (Element)doc, null, Collections.<String, Object> emptyMap());
- if(editor != null && editor instanceof Control) {
- ((ControlEditor)targetObject).setEditor((Control)editor);
- ((Control)editor).setData(PropertiesConstants.DATA_CONTROLEDITOR_OF_CONTROL, targetObject);
+ setters.add((Setter) child);
+ }
+ ((Style) targetObject).setSetters(setters.toArray(new Setter[setters.size()]));
+ } else if (targetObject instanceof ControlEditor) {
+ for (DocumentObject doc : element.getChildren()) {
+ Object editor = doCreate(parent, (Element) doc, null, Collections.<String, Object> emptyMap());
+ if (editor != null && editor instanceof Control) {
+ ((ControlEditor) targetObject).setEditor((Control) editor);
+ ((Control) editor).setData(PropertiesConstants.DATA_CONTROLEDITOR_OF_CONTROL, targetObject);
}
}
- } else if(targetObject instanceof IDataProvider) {
- for(DocumentObject doc : element.getChildren()) {
- if(IConstants.XWT_X_NAMESPACE.equals(doc.getNamespace())) {
+ } else if (targetObject instanceof IDataProvider) {
+ for (DocumentObject doc : element.getChildren()) {
+ if (IConstants.XWT_X_NAMESPACE.equals(doc.getNamespace())) {
String content = doc.getContent();
- if(content != null) {
- ((IDataProvider)targetObject).setProperty(doc.getName(), content);
+ if (content != null) {
+ ((IDataProvider) targetObject).setProperty(doc.getName(), content);
}
}
}
} else {
- for(DocumentObject doc : element.getChildren()) {
- doCreate(targetObject, (Element)doc, null, Collections.<String, Object> emptyMap());
+ for (DocumentObject doc : element.getChildren()) {
+ doCreate(targetObject, (Element) doc, null, Collections.<String, Object> emptyMap());
}
}
@@ -658,20 +658,20 @@ public class ResourceLoader implements IVisualElementLoader {
protected void iniDelayedAttribute(IMetaclass metaclass, Object targetObject, Element element, String namespace, Map<String, IProperty> delayedAttributes) throws Exception {
Set<String> keys = delayedAttributes.keySet();
- while(!keys.isEmpty()) {
- for(String delayed : keys.toArray(new String[keys.size()])) {
+ while (!keys.isEmpty()) {
+ for (String delayed : keys.toArray(new String[keys.size()])) {
IProperty property = delayedAttributes.get(delayed);
boolean hasDependency = false;
IProperty[] dependencies = property.getLoadingType().getDependencies();
- if(dependencies.length > 0) {
- for(IProperty dependency : dependencies) {
- if(delayedAttributes.containsValue(dependency)) {
+ if (dependencies.length > 0) {
+ for (IProperty dependency : dependencies) {
+ if (delayedAttributes.containsValue(dependency)) {
hasDependency = true;
break;
}
}
}
- if(!hasDependency) {
+ if (!hasDependency) {
initAttribute(metaclass, targetObject, element, null, delayed);
keys.remove(delayed);
}
@@ -682,22 +682,22 @@ public class ResourceLoader implements IVisualElementLoader {
/**
* This method is invoked directly after creation of component instance, but
* before applying its attributes and creating children.
- *
+ *
* @param element
- * the source element in XML.
+ * the source element in XML.
* @param targetObject
- * the created visual object.
+ * the created visual object.
*/
protected void postCreation0(Element element, Object targetObject) {
}
private void invokeCreatededAction(Element element, Object targetObject) {
- if(targetObject != null) {
+ if (targetObject != null) {
postCreation0(element, targetObject);
}
- if(options != null) {
- ICreatedCallback createdAction = (ICreatedCallback)options.get(IXWTLoader.CREATED_CALLBACK);
- if(createdAction != null) {
+ if (options != null) {
+ ICreatedCallback createdAction = (ICreatedCallback) options.get(IXWTLoader.CREATED_CALLBACK);
+ if (createdAction != null) {
createdAction.onCreated(targetObject);
}
}
@@ -713,27 +713,27 @@ public class ResourceLoader implements IVisualElementLoader {
protected void setDataContext(IMetaclass metaclass, Object targetObject, ResourceDictionary dico, Object dataContext) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException {
Object control = null;
IMetaclass widgetMetaclass = metaclass;
- if(JFacesHelper.isViewer(targetObject)) {
+ if (JFacesHelper.isViewer(targetObject)) {
Widget widget = JFacesHelper.getControl(targetObject);
widgetMetaclass = loader.getMetaclass(widget.getClass());
control = targetObject;
- } else if(targetObject instanceof Widget) {
+ } else if (targetObject instanceof Widget) {
control = targetObject;
} else {
control = loadData.getCurrentWidget();
}
- if(control != null) {
- if(targetObject instanceof IDynamicBinding) {
- IDynamicBinding dynamicBinding = (IDynamicBinding)targetObject;
+ if (control != null) {
+ if (targetObject instanceof IDynamicBinding) {
+ IDynamicBinding dynamicBinding = (IDynamicBinding) targetObject;
dynamicBinding.setControl(control);
dynamicBinding.setHost(loadData.getHost());
}
- if(dico != null) {
+ if (dico != null) {
UserData.setResources(control, dico);
}
- if(dataContext != null) {
+ if (dataContext != null) {
IProperty property = widgetMetaclass.findProperty(IConstants.XAML_DATA_CONTEXT);
- if(property != null) {
+ if (property != null) {
property.setValue(UserData.getWidget(control), dataContext);
} else {
throw new XWTException("DataContext is missing in " + widgetMetaclass.getType().getName());
@@ -745,27 +745,27 @@ public class ResourceLoader implements IVisualElementLoader {
protected void setBindingContext(IMetaclass metaclass, Object targetObject, ResourceDictionary dico, Object bindingContext) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException {
Object control = null;
IMetaclass widgetMetaclass = metaclass;
- if(JFacesHelper.isViewer(targetObject)) {
+ if (JFacesHelper.isViewer(targetObject)) {
Widget widget = JFacesHelper.getControl(targetObject);
widgetMetaclass = loader.getMetaclass(widget.getClass());
control = targetObject;
- } else if(targetObject instanceof Widget) {
+ } else if (targetObject instanceof Widget) {
control = targetObject;
} else {
control = loadData.getCurrentWidget();
}
- if(control != null) {
- if(targetObject instanceof IDynamicBinding) {
- IDynamicBinding dynamicBinding = (IDynamicBinding)targetObject;
+ if (control != null) {
+ if (targetObject instanceof IDynamicBinding) {
+ IDynamicBinding dynamicBinding = (IDynamicBinding) targetObject;
dynamicBinding.setControl(control);
dynamicBinding.setHost(loadData.getHost());
}
- if(dico != null) {
+ if (dico != null) {
UserData.setResources(control, dico);
}
- if(bindingContext != null) {
+ if (bindingContext != null) {
IProperty property = widgetMetaclass.findProperty(IConstants.XAML_BINDING_CONTEXT);
- if(property != null) {
+ if (property != null) {
property.setValue(UserData.getWidget(control), bindingContext);
} else {
throw new XWTException("DataContext is missing in " + widgetMetaclass.getType().getName());
@@ -775,32 +775,32 @@ public class ResourceLoader implements IVisualElementLoader {
}
protected void applyStyles(Element element, Object targetObject) throws Exception {
- if(targetObject instanceof Widget) {
- Widget widget = (Widget)targetObject;
+ if (targetObject instanceof Widget) {
+ Widget widget = (Widget) targetObject;
Map<String, Object> dico = UserData.getLocalResources(widget);
Attribute attribute = element.getAttribute(IConstants.XAML_RESOURCES);
- if(attribute == null) {
+ if (attribute == null) {
attribute = element.getAttribute(IConstants.XWT_NAMESPACE, IConstants.XAML_RESOURCES);
}
- if(attribute != null) {
- if(attribute.getChildren().length > 0) {
- if(dico == null) {
+ if (attribute != null) {
+ if (attribute.getChildren().length > 0) {
+ if (dico == null) {
dico = new ResourceDictionary();
UserData.setResources(widget, dico);
}
- for(DocumentObject doc : attribute.getChildren()) {
- Element elem = (Element)doc;
+ for (DocumentObject doc : attribute.getChildren()) {
+ Element elem = (Element) doc;
Object doCreate = doCreate(widget, elem, null, EMPTY_MAP);
Attribute keyAttribute = elem.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_KEY);
- if(keyAttribute == null) {
+ if (keyAttribute == null) {
keyAttribute = elem.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_TYPE);
}
- if(keyAttribute != null) {
+ if (keyAttribute != null) {
dico.put(keyAttribute.getContent(), doCreate);
}
- if(doCreate instanceof IStyle) {
- IStyle style = (IStyle)doCreate;
+ if (doCreate instanceof IStyle) {
+ IStyle style = (IStyle) doCreate;
loadData.addStyle(style);
}
}
@@ -809,14 +809,14 @@ public class ResourceLoader implements IVisualElementLoader {
// apply the styles defined in parent's resources via TargetType
Widget current = widget;
- while(current != null) {
+ while (current != null) {
dico = UserData.getLocalResources(current);
- if(dico != null) {
- for(Object value : dico.values()) {
- if(value instanceof Style) {
- Style style = (Style)value;
+ if (dico != null) {
+ for (Object value : dico.values()) {
+ if (value instanceof Style) {
+ Style style = (Style) value;
Class<?> targetType = style.getTargetType();
- if(targetType != null && targetType.isInstance(widget)) {
+ if (targetType != null && targetType.isInstance(widget)) {
style.apply(targetObject);
}
}
@@ -826,7 +826,7 @@ public class ResourceLoader implements IVisualElementLoader {
}
}
- for(IStyle style : loadData.getStyles()) {
+ for (IStyle style : loadData.getStyles()) {
style.applyStyle(targetObject);
}
}
@@ -837,7 +837,7 @@ public class ResourceLoader implements IVisualElementLoader {
IMetaclass metaclass = loader.getMetaclass(name, namespace);
int index = -1;
Class<?> type = metaclass.getType();
- if(TableViewerColumn.class.isAssignableFrom(type)) {
+ if (TableViewerColumn.class.isAssignableFrom(type)) {
DocumentObject parent = columnElement.getParent();
List<DocumentObject> children = DocumentObjectSorter.sortWithAttr(parent.getChildren(), "Index");
index = children.indexOf(columnElement);
@@ -852,19 +852,19 @@ public class ResourceLoader implements IVisualElementLoader {
protected void installTableEditors(TableItem tableItem) {
Table table = tableItem.getParent();
TableColumn[] columns = table.getColumns();
- if(columns == null || columns.length == 0) {
+ if (columns == null || columns.length == 0) {
return;
}
- for(TableColumn tableColumn : columns) {
+ for (TableColumn tableColumn : columns) {
Object data = tableColumn.getData(PropertiesConstants.DATA_DEFINED_EDITOR);
- if(data == null || !(data instanceof Element)) {
+ if (data == null || !(data instanceof Element)) {
continue;
}
int column = table.indexOf(tableColumn);
- Element editor = (Element)data;
+ Element editor = (Element) data;
try {
- TableEditor tableEditor = (TableEditor)doCreate(table, editor, null, EMPTY_MAP);
- if(tableEditor != null) {
+ TableEditor tableEditor = (TableEditor) doCreate(table, editor, null, EMPTY_MAP);
+ if (tableEditor != null) {
tableEditor.setColumn(column);
tableEditor.setItem(tableItem);
}
@@ -878,21 +878,21 @@ public class ResourceLoader implements IVisualElementLoader {
// x:DataContext
try {
Object dataContext = loadData.getDataContext();
- if(dataContext != null) {
+ if (dataContext != null) {
return dataContext;
}
{
Attribute dataContextAttribute = element.getAttribute(IConstants.XAML_DATA_CONTEXT);
- if(dataContextAttribute != null) {
+ if (dataContextAttribute != null) {
Widget composite = swtObject;
DocumentObject documentObject = dataContextAttribute.getChildren()[0];
- if(IConstants.XAML_STATICRESOURCES.equals(documentObject.getName()) || IConstants.XAML_DYNAMICRESOURCES.equals(documentObject.getName())) {
+ if (IConstants.XAML_STATICRESOURCES.equals(documentObject.getName()) || IConstants.XAML_DYNAMICRESOURCES.equals(documentObject.getName())) {
String key = documentObject.getContent();
dataContext = new StaticResourceBinding(composite, key);
loadData.setDataContext(dataContext);
return dataContext;
- } else if(IConstants.XAML_BINDING.equals(documentObject.getName())) {
- dataContext = doCreate(swtObject, (Element)documentObject, null, EMPTY_MAP);
+ } else if (IConstants.XAML_BINDING.equals(documentObject.getName())) {
+ dataContext = doCreate(swtObject, (Element) documentObject, null, EMPTY_MAP);
loadData.setDataContext(dataContext);
return dataContext;
} else {
@@ -912,14 +912,14 @@ public class ResourceLoader implements IVisualElementLoader {
try {
{
Attribute dataContextAttribute = element.getAttribute(IConstants.XAML_BINDING_CONTEXT);
- if(dataContextAttribute != null) {
+ if (dataContextAttribute != null) {
Widget composite = swtObject;
DocumentObject documentObject = dataContextAttribute.getChildren()[0];
- if(IConstants.XAML_STATICRESOURCES.equals(documentObject.getName()) || IConstants.XAML_DYNAMICRESOURCES.equals(documentObject.getName())) {
+ if (IConstants.XAML_STATICRESOURCES.equals(documentObject.getName()) || IConstants.XAML_DYNAMICRESOURCES.equals(documentObject.getName())) {
String key = documentObject.getContent();
return new StaticResourceBinding(composite, key);
- } else if(IConstants.XAML_BINDING.equals(documentObject.getName())) {
- return doCreate(swtObject, (Element)documentObject, null, EMPTY_MAP);
+ } else if (IConstants.XAML_BINDING.equals(documentObject.getName())) {
+ return doCreate(swtObject, (Element) documentObject, null, EMPTY_MAP);
} else {
LoggerManager.log(new UnsupportedOperationException(documentObject.getName()));
}
@@ -945,36 +945,36 @@ public class ResourceLoader implements IVisualElementLoader {
protected Integer getStyleValue(Element element, int styles) {
Attribute attribute = element.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_STYLE);
- if(attribute == null) {
- if(styles != -1) {
+ if (attribute == null) {
+ if (styles != -1) {
return styles;
}
return null;
}
- if(styles == -1) {
- return (Integer)loader.findConvertor(String.class, Integer.class).convert(attribute.getContent());
+ if (styles == -1) {
+ return (Integer) loader.findConvertor(String.class, Integer.class).convert(attribute.getContent());
}
- return styles | (Integer)loader.findConvertor(String.class, Integer.class).convert(attribute.getContent());
+ return styles | (Integer) loader.findConvertor(String.class, Integer.class).convert(attribute.getContent());
}
protected void init(IMetaclass metaclass, Object targetObject, Element element, Map<String, IProperty> delayedAttributes) throws Exception {
// editors for TableItem,
- if(targetObject instanceof TableItem) {
- installTableEditors((TableItem)targetObject);
+ if (targetObject instanceof TableItem) {
+ installTableEditors((TableItem) targetObject);
}
// x:DataContext
- if(loadData.getDataContext() == null) {
+ if (loadData.getDataContext() == null) {
Attribute dataContextAttribute = element.getAttribute(IConstants.XAML_DATA_CONTEXT);
- if(dataContextAttribute != null) {
+ if (dataContextAttribute != null) {
IProperty property = metaclass.findProperty(IConstants.XAML_DATA_CONTEXT);
Widget composite = UserData.getWidget(targetObject);
DocumentObject documentObject = dataContextAttribute.getChildren()[0];
- if(IConstants.XAML_STATICRESOURCES.equals(documentObject.getName()) || IConstants.XAML_DYNAMICRESOURCES.equals(documentObject.getName())) {
+ if (IConstants.XAML_STATICRESOURCES.equals(documentObject.getName()) || IConstants.XAML_DYNAMICRESOURCES.equals(documentObject.getName())) {
String key = documentObject.getContent();
property.setValue(composite, new StaticResourceBinding(composite, key));
- } else if(IConstants.XAML_BINDING.equals(documentObject.getName())) {
- Object object = doCreate(targetObject, (Element)documentObject, null, EMPTY_MAP);
+ } else if (IConstants.XAML_BINDING.equals(documentObject.getName())) {
+ Object object = doCreate(targetObject, (Element) documentObject, null, EMPTY_MAP);
property.setValue(composite, object);
} else {
LoggerManager.log(new UnsupportedOperationException(documentObject.getName()));
@@ -985,10 +985,10 @@ public class ResourceLoader implements IVisualElementLoader {
HashSet<String> done = new HashSet<String>();
Attribute nameAttr = element.getAttribute(IConstants.XAML_X_NAME);
- if(nameAttr == null) {
+ if (nameAttr == null) {
nameAttr = element.getAttribute(IConstants.XWT_X_NAMESPACE, IConstants.XAML_X_NAME);
}
- if(nameAttr != null && UserData.getWidget(targetObject) != null) {
+ if (nameAttr != null && UserData.getWidget(targetObject) != null) {
String value = nameAttr.getContent();
loadData.inject(targetObject, value);
@@ -997,41 +997,41 @@ public class ResourceLoader implements IVisualElementLoader {
done.add(IConstants.XAML_X_NAME);
}
- for(String attrName : element.attributeNames()) {
+ for (String attrName : element.attributeNames()) {
IProperty property = metaclass.findProperty(attrName);
- if(IConstants.XWT_X_NAMESPACE.equals(element.getAttribute(attrName).getNamespace())) {
+ if (IConstants.XWT_X_NAMESPACE.equals(element.getAttribute(attrName).getNamespace())) {
continue;
- } else if(delayedAttributes != null && property != null && property.getLoadingType().getValueLoading() != IValueLoading.Normal) {
+ } else if (delayedAttributes != null && property != null && property.getLoadingType().getValueLoading() != IValueLoading.Normal) {
delayedAttributes.put(attrName, property);
} else {
- if(!done.contains(attrName)) {
+ if (!done.contains(attrName)) {
initAttribute(metaclass, targetObject, element, null, attrName);
done.add(attrName);
}
}
}
- for(String namespace : element.attributeNamespaces()) {
- if(IConstants.XWT_X_NAMESPACE.equals(namespace)) {
- for(String attrName : element.attributeNames(namespace)) {
- if("class".equalsIgnoreCase(attrName) || IConstants.XAML_STYLE.equalsIgnoreCase(attrName)) {
+ for (String namespace : element.attributeNamespaces()) {
+ if (IConstants.XWT_X_NAMESPACE.equals(namespace)) {
+ for (String attrName : element.attributeNames(namespace)) {
+ if ("class".equalsIgnoreCase(attrName) || IConstants.XAML_STYLE.equalsIgnoreCase(attrName)) {
continue; // done before
- } else if(IConstants.XAML_X_NAME.equalsIgnoreCase(attrName)) {
+ } else if (IConstants.XAML_X_NAME.equalsIgnoreCase(attrName)) {
nameScoped.addNamedObject(element.getAttribute(namespace, attrName).getContent(), targetObject);
done.add(attrName);
- } else if(IConstants.XAML_DATA_CONTEXT.equalsIgnoreCase(attrName)) {
+ } else if (IConstants.XAML_DATA_CONTEXT.equalsIgnoreCase(attrName)) {
continue; // done before
- } else if(IConstants.XAML_X_ARRAY.equalsIgnoreCase(attrName)) {
+ } else if (IConstants.XAML_X_ARRAY.equalsIgnoreCase(attrName)) {
IProperty property = metaclass.findProperty(attrName);
Class<?> type = property.getType();
Object value = getArrayProperty(type, targetObject, element, attrName);
- if(value != null) {
+ if (value != null) {
property.setValue(targetObject, value);
}
- } else if(IConstants.XAML_RESOURCES.equalsIgnoreCase(attrName)) {
+ } else if (IConstants.XAML_RESOURCES.equalsIgnoreCase(attrName)) {
continue;
} else {
- if(!done.contains(attrName)) {
+ if (!done.contains(attrName)) {
initAttribute(metaclass, targetObject, element, namespace, attrName);
done.add(attrName);
}
@@ -1040,21 +1040,21 @@ public class ResourceLoader implements IVisualElementLoader {
continue;
}
- for(String attrName : element.attributeNames(namespace)) {
- if(IConstants.XAML_X_NAME.equalsIgnoreCase(attrName) && (targetObject instanceof Widget)) {
+ for (String attrName : element.attributeNames(namespace)) {
+ if (IConstants.XAML_X_NAME.equalsIgnoreCase(attrName) && (targetObject instanceof Widget)) {
continue;
}
- if(!done.contains(attrName)) {
+ if (!done.contains(attrName)) {
initAttribute(metaclass, targetObject, element, namespace, attrName);
done.add(attrName);
}
}
}
- for(String attrName : element.attributeNames()) {
- if(IConstants.XAML_X_NAME.equalsIgnoreCase(attrName) && UserData.getWidget(targetObject) != null) {
+ for (String attrName : element.attributeNames()) {
+ if (IConstants.XAML_X_NAME.equalsIgnoreCase(attrName) && UserData.getWidget(targetObject) != null) {
continue;
}
- if(!done.contains(attrName) && !delayedAttributes.containsKey(attrName)) {
+ if (!done.contains(attrName) && !delayedAttributes.containsKey(attrName)) {
initAttribute(metaclass, targetObject, element, null, attrName);
done.add(attrName);
}
@@ -1063,13 +1063,13 @@ public class ResourceLoader implements IVisualElementLoader {
//
// handle foreigner namespace
//
- for(String namespace : element.attributeNamespaces()) {
- if(XWT.isXWTNamespace(namespace)) {
+ for (String namespace : element.attributeNamespaces()) {
+ if (XWT.isXWTNamespace(namespace)) {
continue;
}
INamespaceHandler namespaceHandler = loader.getNamespaceHandler(namespace);
- if(namespaceHandler != null) {
- for(String attrName : element.attributeNames(namespace)) {
+ if (namespaceHandler != null) {
+ for (String attrName : element.attributeNames(namespace)) {
Attribute attribute = element.getAttribute(namespace, attrName);
Widget widget = UserData.getWidget(loadData.getCurrentWidget());
namespaceHandler.handleAttribute(widget, targetObject, attrName, attribute.getContent());
@@ -1080,41 +1080,41 @@ public class ResourceLoader implements IVisualElementLoader {
protected Object getArrayProperty(Class<?> type, Object swtObject, DocumentObject docObject, String attrName) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException {
Class<?> arrayType = null;
- if(type == Object.class) {
- if(docObject instanceof Element) {
- Element element = (Element)docObject;
+ if (type == Object.class) {
+ if (docObject instanceof Element) {
+ Element element = (Element) docObject;
Attribute attribute = element.getAttribute(IConstants.XWT_NAMESPACE, IConstants.XAML_X_TYPE);
- if(attribute == null) {
+ if (attribute == null) {
throw new XWTException("The type attribute is missing in the element x:Array.");
}
String value = attribute.getContent();
IMetaclass metaclass = XWT.getMetaclass(value, attribute.getNamespace());
- if(metaclass == null) {
+ if (metaclass == null) {
throw new XWTException("The type \"" + value + "\" is not found.");
}
arrayType = metaclass.getType();
}
} else {
- if(!type.isArray()) {
+ if (!type.isArray()) {
throw new XWTException("Type mismatch: property " + attrName + " isn't an array.");
}
arrayType = type.getComponentType();
}
- if(arrayType != null) {
+ if (arrayType != null) {
List<Object> list = new ArrayList<Object>();
- for(DocumentObject childModel : docObject.getChildren()) {
- if(!(childModel instanceof Element)) {
+ for (DocumentObject childModel : docObject.getChildren()) {
+ if (!(childModel instanceof Element)) {
continue;
}
- Object child = createInstance(swtObject, (Element)childModel);
+ Object child = createInstance(swtObject, (Element) childModel);
list.add(child);
}
- Object[] array = (Object[])Array.newInstance(arrayType, list.size());
+ Object[] array = (Object[]) Array.newInstance(arrayType, list.size());
list.toArray(array);
- for(int i = 0; i < array.length; i++) {
- if(array[i] instanceof IIndexedElement) {
- ((IIndexedElement)array[i]).setIndex(swtObject, i);
+ for (int i = 0; i < array.length; i++) {
+ if (array[i] instanceof IIndexedElement) {
+ ((IIndexedElement) array[i]).setIndex(swtObject, i);
}
}
return array;
@@ -1125,47 +1125,47 @@ public class ResourceLoader implements IVisualElementLoader {
@SuppressWarnings("unchecked")
protected Object getCollectionProperty(Class<?> type, Object swtObject, DocumentObject element, String attrName) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException {
Collection<Object> collector = null;
- if(type.isInterface()) {
+ if (type.isInterface()) {
collector = new ArrayList<Object>();
} else {
- if(Modifier.isAbstract(type.getModifiers())) {
+ if (Modifier.isAbstract(type.getModifiers())) {
LoggerManager.log(new XWTException("Collection " + type.getSimpleName() + " is abstract type"));
}
try {
- collector = (Collection)type.newInstance();
+ collector = (Collection) type.newInstance();
} catch (InstantiationException e) {
LoggerManager.log(new XWTException(e));
}
}
- for(DocumentObject childModel : element.getChildren()) {
- if(!(childModel instanceof Element)) {
+ for (DocumentObject childModel : element.getChildren()) {
+ if (!(childModel instanceof Element)) {
continue;
}
- Object child = createInstance(swtObject, (Element)childModel);
+ Object child = createInstance(swtObject, (Element) childModel);
collector.add(child);
- if(child instanceof IIndexedElement) {
- ((IIndexedElement)child).setIndex(swtObject, collector.size() - 1);
+ if (child instanceof IIndexedElement) {
+ ((IIndexedElement) child).setIndex(swtObject, collector.size() - 1);
}
}
return collector;
}
protected String findNamespace(DocumentObject context, String prefix) {
- while(context != null && !(context instanceof Element)) {
+ while (context != null && !(context instanceof Element)) {
context = context.getParent();
}
- if(context == null) {
+ if (context == null) {
return null;
}
- Element element = (Element)context;
+ Element element = (Element) context;
- if(prefix != null) {
+ if (prefix != null) {
prefix = (prefix.length() == 0 ? null : prefix);
}
String namespace = element.getXmlns(prefix);
- if(namespace != null) {
+ if (namespace != null) {
return namespace;
}
DocumentObject parent = element.getParent();
@@ -1175,35 +1175,35 @@ public class ResourceLoader implements IVisualElementLoader {
protected Object createInstance(Object swtObject, Element element) {
String name = element.getName();
String namespace = element.getNamespace();
- if(IConstants.XWT_X_NAMESPACE.equalsIgnoreCase(namespace) && IConstants.XAML_X_NULL.equalsIgnoreCase(name)) {
+ if (IConstants.XWT_X_NAMESPACE.equalsIgnoreCase(namespace) && IConstants.XAML_X_NULL.equalsIgnoreCase(name)) {
return null;
}
try {
Class<?> type = NamespaceHelper.loadCLRClass(context.getLoadingContext(), name, namespace);
IMetaclass metaclass = loader.getMetaclass(name, namespace);
- if(type == null) {
- if(metaclass != null) {
+ if (type == null) {
+ if (metaclass != null) {
type = metaclass.getType();
}
}
- if(metaclass == null) {
+ if (metaclass == null) {
throw new XWTException("Class for " + name + " is not found.");
}
// type = expected type;
// Need to support the
String content = element.getContent();
Object instance = null;
- if(content == null) {
- instance = metaclass.newInstance(new Object[]{ swtObject });
+ if (content == null) {
+ instance = metaclass.newInstance(new Object[] { swtObject });
invokeCreatededAction(element, instance);
- if(instance instanceof TableEditor) {
+ if (instance instanceof TableEditor) {
// TODO should be moved into IMetaclass
- TableEditor tableEditor = (TableEditor)instance;
- if(swtObject instanceof TableItem) {
- TableItem item = (TableItem)swtObject;
+ TableEditor tableEditor = (TableEditor) instance;
+ if (swtObject instanceof TableItem) {
+ TableItem item = (TableItem) swtObject;
tableEditor.setItem(item);
- for(DocumentObject doc : element.getChildren()) {
- Control control = (Control)doCreate(((TableItem)swtObject).getParent(), (Element)doc, null, EMPTY_MAP);
+ for (DocumentObject doc : element.getChildren()) {
+ Control control = (Control) doCreate(((TableItem) swtObject).getParent(), (Element) doc, null, EMPTY_MAP);
tableEditor.setEditor(control);
int column = getColumnValue(element);
TableEditorHelper.initEditor(item, control, column);
@@ -1212,7 +1212,7 @@ public class ResourceLoader implements IVisualElementLoader {
}
} else {
Constructor<?> constructor = type.getConstructor(type);
- if(constructor != null) {
+ if (constructor != null) {
instance = constructor.newInstance(loader.convertFrom(type, content));
invokeCreatededAction(element, instance);
} else {
@@ -1223,8 +1223,8 @@ public class ResourceLoader implements IVisualElementLoader {
init(metaclass, instance, element, delayedAttributes);
iniDelayedAttribute(metaclass, instance, element, null, delayedAttributes);
- for(DocumentObject doc : element.getChildren()) {
- doCreate(instance, (Element)doc, null, Collections.<String, Object> emptyMap());
+ for (DocumentObject doc : element.getChildren()) {
+ doCreate(instance, (Element) doc, null, Collections.<String, Object> emptyMap());
}
return instance;
} catch (Exception e) {
@@ -1235,9 +1235,9 @@ public class ResourceLoader implements IVisualElementLoader {
static protected int getColumnValue(Element context) {
Attribute attribute = context.getAttribute(COLUMN);
- if(attribute != null) {
+ if (attribute != null) {
String content = attribute.getContent();
- if(content != null) {
+ if (content != null) {
return Integer.parseInt(content);
}
}
@@ -1258,39 +1258,39 @@ public class ResourceLoader implements IVisualElementLoader {
protected Object loadFactoryCLR(String value, ICLRFactory factory) {
String token;
String arg;
- if(value.startsWith("+")) {
- if(factory == null) {
+ if (value.startsWith("+")) {
+ if (factory == null) {
throw new XWTException("ICLRFactory option is missing.");
}
arg = value.substring(1).trim();
return factory.createCLR(arg, options);
} else {
StringTokenizer stringTokenizer = new StringTokenizer(value);
- if(!stringTokenizer.hasMoreTokens()) {
+ if (!stringTokenizer.hasMoreTokens()) {
throw new XWTException("x:ClassFactory is empty");
}
token = stringTokenizer.nextToken();
arg = value.substring(token.length()).trim();
}
int index = token.lastIndexOf('.');
- if(index != -1) {
+ if (index != -1) {
String memberName = token.substring(index + 1);
String typeName = token.substring(0, index);
Class<?> type = ClassLoaderUtil.loadClass(context.getLoadingContext(), typeName);
- if(type != null) {
+ if (type != null) {
Object member = ClassLoaderUtil.loadMember(context.getLoadingContext(), type, memberName, false);
- if(member instanceof ICLRFactory) {
- factory = (ICLRFactory)member;
+ if (member instanceof ICLRFactory) {
+ factory = (ICLRFactory) member;
}
- if(factory != null) {
+ if (factory != null) {
return factory.createCLR(arg, options);
}
}
}
Class<?> type = ClassLoaderUtil.loadClass(context.getLoadingContext(), token);
- if(type != null && ICLRFactory.class.isAssignableFrom(type)) {
+ if (type != null && ICLRFactory.class.isAssignableFrom(type)) {
try {
- ICLRFactory localFactory = (ICLRFactory)type.newInstance();
+ ICLRFactory localFactory = (ICLRFactory) type.newInstance();
return localFactory.createCLR(arg, options);
} catch (Exception e) {
throw new XWTException(e);
@@ -1301,29 +1301,29 @@ public class ResourceLoader implements IVisualElementLoader {
protected Object loadCLR(String className, Object[] parameters, Class<?> currentTagType, Map<String, Object> options) {
Class<?> type = ClassLoaderUtil.loadClass(context.getLoadingContext(), className);
- if(type == null) {
+ if (type == null) {
return null;
}
try {
- Object clr = options.get(XWTLoader.CLASS_PROPERTY);
- if(clr != null && type.isInstance(clr)) {
+ Object clr = options.get(IXWTLoader.CLASS_PROPERTY);
+ if (clr != null && type.isInstance(clr)) {
loadData.setClr(clr);
- if(clr instanceof Widget) {
+ if (clr instanceof Widget) {
UserData.setCLR(clr, clr);
}
- } else if(currentTagType != null && currentTagType.isAssignableFrom(type)) {
+ } else if (currentTagType != null && currentTagType.isAssignableFrom(type)) {
IMetaclass metaclass = loader.getMetaclass(type);
Object instance = metaclass.newInstance(parameters);
loadData.setClr(instance);
// use x:Class's instance
- if(instance instanceof Widget) {
+ if (instance instanceof Widget) {
UserData.setCLR(instance, instance);
}
return instance;
} else {
Object instance = type.newInstance();
loadData.setClr(instance);
- if(instance instanceof Widget) {
+ if (instance instanceof Widget) {
UserData.setCLR(instance, instance);
}
}
@@ -1334,15 +1334,15 @@ public class ResourceLoader implements IVisualElementLoader {
}
protected void initAttribute(IMetaclass metaclass, Object targetObject, Element element, String namespace, String attrName) throws Exception {
- if(attrName.indexOf('.') != -1) {
+ if (attrName.indexOf('.') != -1) {
String[] segments = attrName.split("\\.");
IMetaclass currentMetaclass = metaclass;
Object target = targetObject;
- for(int i = 0; i < segments.length - 1; i++) {
+ for (int i = 0; i < segments.length - 1; i++) {
IProperty property = currentMetaclass.findProperty(segments[i]);
- if(property != null) {
+ if (property != null) {
target = property.getValue(target);
- if(target == null) {
+ if (target == null) {
LoggerManager.log(new XWTException("Property \"" + segments[i] + "\" is null."));
}
currentMetaclass = loader.getMetaclass(target);
@@ -1358,7 +1358,7 @@ public class ResourceLoader implements IVisualElementLoader {
protected void addCommandExecuteListener(String commandName, final Widget targetButton) {
final ICommand commandObj = loader.getCommand(commandName);
- if(commandObj != null) {
+ if (commandObj != null) {
targetButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
@@ -1370,19 +1370,19 @@ public class ResourceLoader implements IVisualElementLoader {
protected void initSegmentAttribute(IMetaclass metaclass, String propertyName, Object target, Element element, String namespace, String attrName) throws Exception {
Attribute attribute = namespace == null ? element.getAttribute(attrName) : element.getAttribute(namespace, attrName);
- if(attribute == null) {
+ if (attribute == null) {
attribute = element.getAttribute(attrName);
}
IProperty property = null;
boolean isAttached = false;
{
String namePrefix = attribute.getNamePrefix();
- if(namePrefix == null) {
+ if (namePrefix == null) {
property = metaclass.findProperty(propertyName);
} else {
//
IMetaclass metaclassAttached = loader.getMetaclass(namePrefix, attribute.getNamespace());
- if(metaclassAttached != null) {
+ if (metaclassAttached != null) {
property = metaclassAttached.findProperty(propertyName);
isAttached = true;
} else {
@@ -1392,44 +1392,44 @@ public class ResourceLoader implements IVisualElementLoader {
}
}
- if(propertyName.equals(IConstants.XAML_DATA_CONTEXT)) {
+ if (propertyName.equals(IConstants.XAML_DATA_CONTEXT)) {
property = null;
}
- if(IConstants.XAML_COMMAND.equalsIgnoreCase(propertyName) && ICommand.class.isAssignableFrom(property.getType()) && (target instanceof Widget)) {
- addCommandExecuteListener(attribute.getContent(), (Widget)target);
+ if (IConstants.XAML_COMMAND.equalsIgnoreCase(propertyName) && ICommand.class.isAssignableFrom(property.getType()) && (target instanceof Widget)) {
+ addCommandExecuteListener(attribute.getContent(), (Widget) target);
}
- if(property == null) {
- if(options.get(IXWTLoader.DESIGN_MODE_PROPERTY) == Boolean.TRUE) {
+ if (property == null) {
+ if (options.get(IXWTLoader.DESIGN_MODE_PROPERTY) == Boolean.TRUE) {
return;
}
// prepare event
IEvent event = metaclass.findEvent(attrName);
- if(event == null) {
+ if (event == null) {
return;
}
// add events for controls and items.
- if(!(target instanceof Widget)) {
+ if (!(target instanceof Widget)) {
return;
}
- loadData.updateEvent(context, (Widget)target, event, attribute.getContent());
+ loadData.updateEvent(context, (Widget) target, event, attribute.getContent());
return;
}
String contentValue = attribute.getContent();
- if("MenuItem".equalsIgnoreCase(element.getName()) && "Text".equalsIgnoreCase(attrName)) {
+ if ("MenuItem".equalsIgnoreCase(element.getName()) && "Text".equalsIgnoreCase(attrName)) {
Attribute attributeAccelerator = element.getAttribute("Accelerator");
- if(attributeAccelerator != null) {
+ if (attributeAccelerator != null) {
contentValue = contentValue + '\t' + getContentValue(attributeAccelerator.getContent());
}
}
- if(contentValue != null && "Accelerator".equalsIgnoreCase(attrName)) {
+ if (contentValue != null && "Accelerator".equalsIgnoreCase(attrName)) {
contentValue = XWTMaps.getCombAccelerator(contentValue);
- if(contentValue.contains("'")) {
+ if (contentValue.contains("'")) {
contentValue = removeSubString(contentValue, "'");
}
}
- if(contentValue != null && loader.isFileResolveType(property.getType())) {
+ if (contentValue != null && loader.isFileResolveType(property.getType())) {
contentValue = getImagePath(contentValue);
}
// if (contentValue != null
@@ -1439,23 +1439,23 @@ public class ResourceLoader implements IVisualElementLoader {
Object value = null;
DocumentObject[] children = attribute.getChildren();
boolean usingExistingValue = false;
- if(contentValue == null) {
+ if (contentValue == null) {
Class<?> type = property.getType();
- if(Collection.class.isAssignableFrom(type)) {
+ if (Collection.class.isAssignableFrom(type)) {
value = getCollectionProperty(type, target, attribute, attrName);
} else {
Object directTarget = null;
- if(TableViewerColumn.class.isAssignableFrom(type) && attrName.equalsIgnoreCase("columns")) {
+ if (TableViewerColumn.class.isAssignableFrom(type) && attrName.equalsIgnoreCase("columns")) {
children = DocumentObjectSorter.sortWithAttr(children, "Index").toArray(new DocumentObject[children.length]);
} else {
try {
Object propertyValue = property.getValue(target);
- if(UserData.getWidget(propertyValue) != null) {
+ if (UserData.getWidget(propertyValue) != null) {
directTarget = propertyValue;
// use the existing property value as parent,
// not need to add the constraint
- if(!property.isValueAsParent()) {
- if(isChildTypeCompatible(attribute, type)) {
+ if (!property.isValueAsParent()) {
+ if (isChildTypeCompatible(attribute, type)) {
directTarget = null;
} else {
type = null;
@@ -1466,65 +1466,65 @@ public class ResourceLoader implements IVisualElementLoader {
} catch (Exception e) {
}
}
- if(directTarget == null) {
+ if (directTarget == null) {
directTarget = target;
}
- for(DocumentObject child : children) {
+ for (DocumentObject child : children) {
String name = child.getName();
String ns = child.getNamespace();
- if(name.equalsIgnoreCase(IConstants.XAML_X_STATIC) && ns.equals(IConstants.XWT_X_NAMESPACE)) {
+ if (name.equalsIgnoreCase(IConstants.XAML_X_STATIC) && ns.equals(IConstants.XWT_X_NAMESPACE)) {
value = getStaticValue(child);
- } else if(name.equalsIgnoreCase(IConstants.XAML_STATICRESOURCES) && ns.equals(IConstants.XWT_NAMESPACE)) {
+ } else if (name.equalsIgnoreCase(IConstants.XAML_STATICRESOURCES) && ns.equals(IConstants.XWT_NAMESPACE)) {
String key = child.getContent();
value = new StaticResourceBinding(loadData.getCurrentWidget(), key);
- } else if((IConstants.XWT_X_NAMESPACE.equals(ns) && IConstants.XAML_X_ARRAY.equalsIgnoreCase(name))) {
+ } else if ((IConstants.XWT_X_NAMESPACE.equals(ns) && IConstants.XAML_X_ARRAY.equalsIgnoreCase(name))) {
value = getArrayProperty(property.getType(), directTarget, child, name);
- } else if(property.getType().isArray()) {
+ } else if (property.getType().isArray()) {
value = getArrayProperty(property.getType(), directTarget, attribute, name);
break;
- } else if(isAssignableFrom(element, TableColumn.class) && isAssignableFrom(child, TableEditor.class)) {
+ } else if (isAssignableFrom(element, TableColumn.class) && isAssignableFrom(child, TableEditor.class)) {
value = child;
- } else if(TableViewerColumn.class.isAssignableFrom(property.getType()) && attribute.getContent() != null) {
+ } else if (TableViewerColumn.class.isAssignableFrom(property.getType()) && attribute.getContent() != null) {
value = attribute.getContent();
} else {
- if("Null".equals(child.getName()) && IConstants.XWT_X_NAMESPACE.equals(child.getNamespace())) {
+ if ("Null".equals(child.getName()) && IConstants.XWT_X_NAMESPACE.equals(child.getNamespace())) {
property.setValue(directTarget, null);
return;
} else {
- value = doCreate(directTarget, (Element)child, type, EMPTY_MAP);
- if(value == null && type != null && !(type == Table.class && "TableColumn".equals(child.getName()) && Table.class.isInstance(directTarget))) {
+ value = doCreate(directTarget, (Element) child, type, EMPTY_MAP);
+ if (value == null && type != null && !(type == Table.class && "TableColumn".equals(child.getName()) && Table.class.isInstance(directTarget))) {
throw new XWTException(child.getName() + " cannot be a content of " + type.getName() + " " + target.getClass().getName() + "." + property.getName());
}
- if(value instanceof IDynamicBinding) {
- ((IDynamicBinding)value).setType(attrName);
+ if (value instanceof IDynamicBinding) {
+ ((IDynamicBinding) value).setType(attrName);
}
}
}
}
}
}
- if(contentValue != null && value == null && !IConstants.XAML_COMMAND.equalsIgnoreCase(propertyName)) {
- if(property.getType().isInstance(Class.class)) {
+ if (contentValue != null && value == null && !IConstants.XAML_COMMAND.equalsIgnoreCase(propertyName)) {
+ if (property.getType().isInstance(Class.class)) {
int index = contentValue.lastIndexOf(':');
- if(index != -1) {
+ if (index != -1) {
String prefix = contentValue.substring(0, index);
contentValue = findNamespace(attribute, prefix) + contentValue.substring(index);
}
}
value = loader.convertFrom(property.getType(), contentValue);
}
- if(!usingExistingValue) {
- if(value != null) {
+ if (!usingExistingValue) {
+ if (value != null) {
Class<?> propertyType = property.getType();
- if(!propertyType.isAssignableFrom(value.getClass()) || (value instanceof IBinding && !(IBinding.class.isAssignableFrom(propertyType)))) {
+ if (!propertyType.isAssignableFrom(value.getClass()) || (value instanceof IBinding && !(IBinding.class.isAssignableFrom(propertyType)))) {
Object orginalValue = value;
IConverter converter = loader.findConvertor(value.getClass(), propertyType);
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
- if(value != null && orginalValue instanceof IBinding && !propertyType.isAssignableFrom(value.getClass())) {
+ if (value != null && orginalValue instanceof IBinding && !propertyType.isAssignableFrom(value.getClass())) {
converter = loader.findConvertor(value.getClass(), propertyType);
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
} else {
LoggerManager.log(new XWTException("Convertor " + value.getClass().getSimpleName() + "->" + propertyType.getSimpleName() + " is not found"));
@@ -1534,11 +1534,11 @@ public class ResourceLoader implements IVisualElementLoader {
LoggerManager.log(new XWTException("Convertor " + value.getClass().getSimpleName() + "->" + propertyType.getSimpleName() + " is not found"));
}
}
- if(isAttached) {
+ if (isAttached) {
UserData.setLocalData(target, property, value);
} else {
- if(value instanceof IDynamicValueBinding) {
- IDynamicValueBinding dynamicValueBinding = (IDynamicValueBinding)value;
+ if (value instanceof IDynamicValueBinding) {
+ IDynamicValueBinding dynamicValueBinding = (IDynamicValueBinding) value;
dynamicValueBinding.setControl(loadData.findElement(Widget.class));
dynamicValueBinding.setProperty(property);
dynamicValueBinding.setObject(target);
@@ -1546,18 +1546,18 @@ public class ResourceLoader implements IVisualElementLoader {
property.setValue(target, value);
}
} else {
- if(value == null) {
+ if (value == null) {
value = property.getValue(target);
}
- if(value != null) {
+ if (value != null) {
// create children.
- for(DocumentObject child : children) {
+ for (DocumentObject child : children) {
String name = child.getName();
String ns = child.getNamespace();
- if(!IConstants.XWT_X_NAMESPACE.equals(ns) || !IConstants.XAML_X_ARRAY.equalsIgnoreCase(name)) {
+ if (!IConstants.XWT_X_NAMESPACE.equals(ns) || !IConstants.XAML_X_ARRAY.equalsIgnoreCase(name)) {
Class<?> type = property.getType();
- if(!Collection.class.isAssignableFrom(type)) {
- doCreate(value, (Element)child, null, EMPTY_MAP);
+ if (!Collection.class.isAssignableFrom(type)) {
+ doCreate(value, (Element) child, null, EMPTY_MAP);
}
}
}
@@ -1565,12 +1565,12 @@ public class ResourceLoader implements IVisualElementLoader {
}
}
- if(attribute.attributeNames(IConstants.XWT_NAMESPACE).length > 0) {
+ if (attribute.attributeNames(IConstants.XWT_NAMESPACE).length > 0) {
IMetaclass propertyMetaclass = loader.getMetaclass(property.getType());
- if(value == null) {
+ if (value == null) {
value = property.getValue(target);
}
- if(value != null) {
+ if (value != null) {
Map<String, IProperty> delayedAttributes = new HashMap<String, IProperty>();
init(propertyMetaclass, value, attribute, delayedAttributes);
iniDelayedAttribute(metaclass, target, element, namespace, delayedAttributes);
@@ -1580,19 +1580,19 @@ public class ResourceLoader implements IVisualElementLoader {
protected boolean isChildTypeCompatible(Attribute attribute, Class<?> type) {
DocumentObject[] children = attribute.getChildren();
- if(children.length != 1) {
+ if (children.length != 1) {
return false;
}
DocumentObject child = children[0];
- if(!(child instanceof Element)) {
+ if (!(child instanceof Element)) {
return false;
}
- Element childElement = (Element)child;
+ Element childElement = (Element) child;
String name = childElement.getName();
String namespace = childElement.getNamespace();
IMetaclass metaclass = loader.getMetaclass(name, namespace);
- if(metaclass == null) {
+ if (metaclass == null) {
return false;
}
return type.isAssignableFrom(metaclass.getType());
@@ -1607,12 +1607,12 @@ public class ResourceLoader implements IVisualElementLoader {
try {
url = new URL(contentValue);
} catch (MalformedURLException e) {
- if(!contentValue.startsWith("/")) {
+ if (!contentValue.startsWith("/")) {
contentValue = "/" + contentValue;
}
ILoadingContext loadingContext = context.getLoadingContext();
URL resource = loadingContext.getResource(contentValue);
- if(resource == null) {
+ if (resource == null) {
try {
resource = new URL(context.getResourcePath() + contentValue);
return resource.toString();
@@ -1622,7 +1622,7 @@ public class ResourceLoader implements IVisualElementLoader {
return resource.toString();
}
}
- if(url != null) {
+ if (url != null) {
return url.toString();
}
return contentValue;
@@ -1631,11 +1631,11 @@ public class ResourceLoader implements IVisualElementLoader {
protected Class<?> getJavaType(DocumentObject element) {
String name = element.getName();
String namespace = element.getNamespace();
- if(IConstants.XWT_X_NAMESPACE.equalsIgnoreCase(namespace) && IConstants.XAML_X_NULL.equalsIgnoreCase(name)) {
+ if (IConstants.XWT_X_NAMESPACE.equalsIgnoreCase(namespace) && IConstants.XAML_X_NULL.equalsIgnoreCase(name)) {
return null;
}
IMetaclass metaclass = loader.getMetaclass(name, namespace);
- if(metaclass == null) {
+ if (metaclass == null) {
return null;
}
return metaclass.getType();
@@ -1643,7 +1643,7 @@ public class ResourceLoader implements IVisualElementLoader {
protected boolean isAssignableFrom(DocumentObject element, Class<?> type) {
Class<?> targetType = getJavaType(element);
- if(targetType == null) {
+ if (targetType == null) {
return false;
}
return targetType.isAssignableFrom(type);
@@ -1651,9 +1651,9 @@ public class ResourceLoader implements IVisualElementLoader {
protected Object getStaticValue(DocumentObject child) {
DocumentObject[] children = child.getChildren();
- if(children.length == 1) {
- Element element = (Element)children[0];
- if(element != null) {
+ if (children.length == 1) {
+ Element element = (Element) children[0];
+ if (element != null) {
return ClassLoaderUtil.loadStaticMember(context.getLoadingContext(), element);
}
}
@@ -1664,23 +1664,23 @@ public class ResourceLoader implements IVisualElementLoader {
String value = contentValue;
try {
File file = new File(contentValue);
- if(file.exists()) {
+ if (file.exists()) {
return file.toURI().toURL().toString();
}
- if(!contentValue.startsWith("/")) {
+ if (!contentValue.startsWith("/")) {
URL url = context.getResourcePath();
- if(url != null) {
+ if (url != null) {
return url.toString() + "/" + contentValue;
}
contentValue = "/" + contentValue;
}
ILoadingContext loadingContext = context.getLoadingContext();
URL resource = loadingContext.getResource(contentValue);
- if(resource == null) {
+ if (resource == null) {
URL resourcePath = context.getResourcePath();
String fPath = resourcePath.toString();
String absolutePath = PathHelper.getAbsolutePath(fPath, contentValue);
- if((file = new File(absolutePath)).exists()) {
+ if ((file = new File(absolutePath)).exists()) {
return file.toURI().toURL().toString();
}
resource = new URL(absolutePath);
@@ -1696,10 +1696,10 @@ public class ResourceLoader implements IVisualElementLoader {
int lenOfsource = str.length();
int i;
int posStart;
- for(posStart = 0; (i = str.indexOf(subString, posStart)) >= 0; posStart = i + subString.length()) {
+ for (posStart = 0; (i = str.indexOf(subString, posStart)) >= 0; posStart = i + subString.length()) {
stringBuffer.append(str.substring(posStart, i));
}
- if(posStart < lenOfsource) {
+ if (posStart < lenOfsource) {
stringBuffer.append(str.substring(posStart));
}
return stringBuffer.toString();
@@ -1710,16 +1710,16 @@ public class ResourceLoader implements IVisualElementLoader {
String subString = "SWT.";
String str = XWTMaps.getCombAccelerator(text);
- if(str.contains(subString)) {
+ if (str.contains(subString)) {
str = removeSubString(str, subString);
}
- if(str.contains("'")) {
+ if (str.contains("'")) {
str = removeSubString(str, "'");
}
- if(str.contains(" ")) {
+ if (str.contains(" ")) {
str = removeSubString(str, " ");
}
- if(str.contains("|")) {
+ if (str.contains("|")) {
str = str.replace('|', '+');
}
stringBuffer.append(str);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoaderFactory.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoaderFactory.java
index 18e1d9fd262..584c86404b4 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoaderFactory.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ResourceLoaderFactory.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/StaticResourceBinding.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/StaticResourceBinding.java
index 91b9aa9100a..e04b7a443fd 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/StaticResourceBinding.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/StaticResourceBinding.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -30,16 +30,16 @@ public class StaticResourceBinding implements IBinding {
public Object getValue(Class<?> targetType) {
Widget parent = UserData.getWidget(widget);
- while(parent != null) {
+ while (parent != null) {
Map<String, Object> dico = UserData.getLocalResources(parent);
- if(dico != null && dico.containsKey(key)) {
+ if (dico != null && dico.containsKey(key)) {
Object data = dico.get(key);
- if(data instanceof IBinding) {
- return ((IBinding)data).getValue(targetType);
+ if (data instanceof IBinding) {
+ return ((IBinding) data).getValue(targetType);
}
return data;
}
- parent = (Widget)UserData.getParent(parent);
+ parent = UserData.getParent(parent);
}
throw new XWTException("Key " + key + " is not found.");
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ValueConvertorRegister.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ValueConvertorRegister.java
index 5437fba9c2c..3376e773267 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ValueConvertorRegister.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/ValueConvertorRegister.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ public class ValueConvertorRegister {
public void register(Class<?> source, Class<?> target, IConverter converter) {
HashMap<Class<?>, IConverter> convertors = register.get(source);
- if(convertors == null) {
+ if (convertors == null) {
convertors = new HashMap<Class<?>, IConverter>();
register.put(source, convertors);
}
@@ -29,24 +29,24 @@ public class ValueConvertorRegister {
public IConverter findConverter(Class<?> source, Class<?> target) {
HashMap<Class<?>, IConverter> convertors = register.get(source);
- if(convertors == null) {
- if(source.isEnum()) {
+ if (convertors == null) {
+ if (source.isEnum()) {
convertors = register.get(Enum.class);
- if(convertors == null) {
+ if (convertors == null) {
return null;
}
} else {
Class<?>[] interfacees = source.getInterfaces();
- for(Class<?> class1 : interfacees) {
+ for (Class<?> class1 : interfacees) {
IConverter converter = findConverter(class1, target);
- if(converter != null) {
+ if (converter != null) {
return converter;
}
}
Class<?> superclass = source.getSuperclass();
- if(superclass != null) {
+ if (superclass != null) {
IConverter converter = findConverter(superclass, target);
- if(converter != null) {
+ if (converter != null) {
return converter;
}
}
@@ -58,17 +58,17 @@ public class ValueConvertorRegister {
private IConverter findConverter(HashMap<Class<?>, IConverter> convertors, Class<?> current) {
IConverter converter = convertors.get(current);
- if(converter == null) {
- if(current.isEnum()) {
+ if (converter == null) {
+ if (current.isEnum()) {
converter = convertors.get(Enum.class);
}
}
- if(converter == null) {
+ if (converter == null) {
Class<?> superclass = current.getSuperclass();
- if(superclass == null && current != Object.class) {
+ if (superclass == null && current != Object.class) {
superclass = Object.class;
}
- if(superclass != null) {
+ if (superclass != null) {
converter = findConverter(convertors, superclass);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/AbstractMetaclass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/AbstractMetaclass.java
index 3ff5f3aecdc..2413a837349 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/AbstractMetaclass.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/AbstractMetaclass.java
@@ -53,7 +53,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
/**
- *
+ *
* @author xye (xiaowei.ye@soyatec.com)
*/
public abstract class AbstractMetaclass implements IMetaclass {
@@ -86,16 +86,17 @@ public abstract class AbstractMetaclass implements IMetaclass {
protected boolean shouldIgnored(Class<?> declaredType, String propertyName, Class<?> propertyType) {
String packageName = "";
- if(type.getPackage() != null) {
+ if (type.getPackage() != null) {
packageName = declaredType.getPackage().getName();
}
- if(("data".equals(propertyName) && packageName.startsWith("org.eclipse.swt."))) {
+ if (("data".equals(propertyName) && packageName.startsWith("org.eclipse.swt."))) {
return true;
}
- if("class".equals(propertyName)) {
+ if ("class".equals(propertyName)) {
return true;
}
- if(("handle".equals(propertyName) && int.class == propertyType) || ("monitor".equals(propertyName) && Monitor.class == propertyType) || ("region".equals(propertyName) && Region.class == propertyType) || ("parent".equals(propertyName) && Composite.class == propertyType) || ("shell".equals(propertyName) && Shell.class == propertyType) || ("display".equals(propertyName) && Display.class == propertyType)) {
+ if (("handle".equals(propertyName) && int.class == propertyType) || ("monitor".equals(propertyName) && Monitor.class == propertyType) || ("region".equals(propertyName) && Region.class == propertyType)
+ || ("parent".equals(propertyName) && Composite.class == propertyType) || ("shell".equals(propertyName) && Shell.class == propertyType) || ("display".equals(propertyName) && Display.class == propertyType)) {
return true;
}
return false;
@@ -103,8 +104,8 @@ public abstract class AbstractMetaclass implements IMetaclass {
protected boolean isWidgetType(Class<?> type) {
Class<?> superClass = type.getSuperclass();
- if(superClass != null) {
- if(superClass.getName().equalsIgnoreCase(Widget.class.getName())) {
+ if (superClass != null) {
+ if (superClass.getName().equalsIgnoreCase(Widget.class.getName())) {
return true;
} else {
return isWidgetType(superClass);
@@ -128,10 +129,10 @@ public abstract class AbstractMetaclass implements IMetaclass {
}
private void buildTypedEvents() {
- if(buildTypedEvents) {
+ if (buildTypedEvents) {
return;
}
- if(isSubclassOf(getXWTLoader().getMetaclass(Widget.class))) {
+ if (isSubclassOf(getXWTLoader().getMetaclass(Widget.class))) {
addTypedEvent(IEventConstants.ACTIVATE, SWT.Activate);
addTypedEvent(IEventConstants.ARM, SWT.Arm);
addTypedEvent(IEventConstants.CLOSE, SWT.Close);
@@ -181,7 +182,7 @@ public abstract class AbstractMetaclass implements IMetaclass {
private void addTypedEvent(String name, int eventType) {
String eventName = IEventConstants.getEventName(name);
- if(!routedEventCache.containsKey(eventName)) {
+ if (!routedEventCache.containsKey(eventName)) {
TypedEvent typedEvent = new TypedEvent(name, eventType);
routedEventCache.put(eventName, typedEvent);
String eventPropertyName = IEventConstants.getEventPropertyName(name);
@@ -219,17 +220,17 @@ public abstract class AbstractMetaclass implements IMetaclass {
public IProperty findProperty(String name) {
assertInitialize();
IProperty property = propertyCache.get(normalize(name));
- if(property == null && superClass != null) {
+ if (property == null && superClass != null) {
property = superClass.findProperty(name);
}
- if(property == null) {
+ if (property == null) {
try {
Method getter = DynamicProperty.createGetter(type, name);
- if(getter == null) {
+ if (getter == null) {
return null;
}
Class<?> propertyType = getter.getReturnType();
- if(shouldIgnored(getter.getDeclaringClass(), name, propertyType)) {
+ if (shouldIgnored(getter.getDeclaringClass(), name, propertyType)) {
return null;
}
Method setter = DynamicProperty.createSetter(type, propertyType, name);
@@ -253,7 +254,7 @@ public abstract class AbstractMetaclass implements IMetaclass {
*/
public IEvent[] getEvents() {
assertInitialize();
- return routedEventCache.values().toArray(new IEvent[]{});
+ return routedEventCache.values().toArray(new IEvent[] {});
}
/*
@@ -332,16 +333,16 @@ public abstract class AbstractMetaclass implements IMetaclass {
*/
public boolean isSubclassOf(IMetaclass metaclass) {
assertInitialize();
- if(metaclass == null) {
+ if (metaclass == null) {
return false;
}
- if(this == metaclass) {
+ if (this == metaclass) {
return true;
}
- if(superClass == metaclass) {
+ if (superClass == metaclass) {
return true;
}
- if(superClass != null) {
+ if (superClass != null) {
return superClass.isSubclassOf(metaclass);
}
return false;
@@ -366,7 +367,7 @@ public abstract class AbstractMetaclass implements IMetaclass {
public Object newInstance(Object[] parameters) {
assertInitialize();
Object object = doNewInstance(parameters);
- if(parameters != null && parameters.length > 0) {
+ if (parameters != null && parameters.length > 0) {
try {
updateContainment(parameters[0], object);
initialize(object);
@@ -378,7 +379,7 @@ public abstract class AbstractMetaclass implements IMetaclass {
}
private void updateContainment(Object parent, Object childElement) throws IllegalAccessException, InvocationTargetException, NoSuchFieldException {
- if(childElement != null && parent != null && !(parent instanceof Widget)) {
+ if (childElement != null && parent != null && !(parent instanceof Widget)) {
//
// Add to default property identified by the type
//
@@ -388,27 +389,27 @@ public abstract class AbstractMetaclass implements IMetaclass {
int count = 0;
Class<?> childType = childElement.getClass();
- for(IProperty property : properties) {
+ for (IProperty property : properties) {
Class<?> propertyType = property.getType();
- if(propertyType == null || propertyType == Object.class) {
+ if (propertyType == null || propertyType == Object.class) {
continue;
}
- if(property.isContainement()) {
+ if (property.isContainement()) {
useProperty = property;
count++;
}
}
- if(count > 1) {
+ if (count > 1) {
StringBuilder builder = new StringBuilder();
builder.append("Class has more containment properties: ");
count = 0;
- for(IProperty property : properties) {
+ for (IProperty property : properties) {
Class<?> propertyType = property.getType();
- if(propertyType == null || propertyType == Object.class) {
+ if (propertyType == null || propertyType == Object.class) {
continue;
}
- if(property.isContainement()) {
- if(count != 0) {
+ if (property.isContainement()) {
+ if (count != 0) {
builder.append(", ");
}
builder.append(property.getName());
@@ -418,56 +419,56 @@ public abstract class AbstractMetaclass implements IMetaclass {
throw new XWTException("Class has more containment properties: ");
}
- if(count == 0) {
- for(IProperty property : properties) {
+ if (count == 0) {
+ for (IProperty property : properties) {
Class<?> propertyType = property.getType();
- if(propertyType == null || propertyType == Object.class) {
+ if (propertyType == null || propertyType == Object.class) {
continue;
}
- if(propertyType.isArray()) {
+ if (propertyType.isArray()) {
Class<?> dataType = propertyType.getComponentType();
- if(dataType.isAssignableFrom(childType)) {
- if(useProperty == null) {
+ if (dataType.isAssignableFrom(childType)) {
+ if (useProperty == null) {
useProperty = property;
}
count++;
}
- } else if(Collection.class.isAssignableFrom(propertyType)) {
- if(useProperty == null) {
+ } else if (Collection.class.isAssignableFrom(propertyType)) {
+ if (useProperty == null) {
useProperty = property;
}
count++;
- } else if(propertyType.isAssignableFrom(childType)) {
- if(useProperty == null) {
+ } else if (propertyType.isAssignableFrom(childType)) {
+ if (useProperty == null) {
useProperty = property;
}
count++;
}
}
}
- if(count == 1) {
+ if (count == 1) {
Class<?> propertyType = useProperty.getType();
- if(propertyType.isArray()) {
- Object[] existingValue = (Object[])useProperty.getValue(parent);
+ if (propertyType.isArray()) {
+ Object[] existingValue = (Object[]) useProperty.getValue(parent);
Class<?> dataType = propertyType.getComponentType();
Object[] value = null;
- if(existingValue == null) {
- value = (Object[])Array.newInstance(dataType, 1);
+ if (existingValue == null) {
+ value = (Object[]) Array.newInstance(dataType, 1);
value[0] = childElement;
} else {
- value = (Object[])Array.newInstance(dataType, existingValue.length + 1);
+ value = (Object[]) Array.newInstance(dataType, existingValue.length + 1);
System.arraycopy(existingValue, 0, value, 0, existingValue.length);
value[existingValue.length] = childElement;
}
useProperty.setValue(parent, value);
- } else if(Collection.class.isAssignableFrom(propertyType) && !(childElement instanceof IBinding)) {
- Collection<Object> existingValue = (Collection)useProperty.getValue(parent);
- if(existingValue == null) {
+ } else if (Collection.class.isAssignableFrom(propertyType) && !(childElement instanceof IBinding)) {
+ Collection<Object> existingValue = (Collection) useProperty.getValue(parent);
+ if (existingValue == null) {
existingValue = new ArrayList<Object>();
}
existingValue.add(childElement);
useProperty.setValue(parent, existingValue);
- } else if(propertyType.isAssignableFrom(childType)) {
+ } else if (propertyType.isAssignableFrom(childType)) {
useProperty.setValue(parent, childElement);
}
}
@@ -482,7 +483,7 @@ public abstract class AbstractMetaclass implements IMetaclass {
public Object doNewInstance(Object[] parameters) {
assertInitialize();
try {
- if(parameters.length == 0 || (!(parameters[0] instanceof Widget || JFacesHelper.isViewer(parameters[0])))) {
+ if (parameters.length == 0 || (!(parameters[0] instanceof Widget || JFacesHelper.isViewer(parameters[0])))) {
return getType().newInstance();
}
} catch (InstantiationException e1) {
@@ -493,78 +494,78 @@ public abstract class AbstractMetaclass implements IMetaclass {
Object swtObject = null;
Object parent = parameters[0];
Widget directParent = UserData.getWidget(parent);
- if(directParent == null) {
+ if (directParent == null) {
directParent = UserData.getTreeParent(parent);
}
- if(directParent != null && Control.class.isAssignableFrom(getType()) && !(directParent instanceof Composite)) {
+ if (directParent != null && Control.class.isAssignableFrom(getType()) && !(directParent instanceof Composite)) {
directParent = getXWTLoader().findCompositeParent(directParent);
}
Object styleValue = null;
- if(parameters.length == 2 && parameters[1] != null && (parameters[1].getClass() == int.class || parameters[1].getClass() == Integer.class)) {
+ if (parameters.length == 2 && parameters[1] != null && (parameters[1].getClass() == int.class || parameters[1].getClass() == Integer.class)) {
styleValue = parameters[1];
}
Constructor<?> defaultConstructor = null;
- for(Constructor<?> constructor : getType().getConstructors()) {
+ for (Constructor<?> constructor : getType().getConstructors()) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
- if(parameterTypes.length > 2 || parameterTypes.length == 0) {
- if(parameterTypes.length == 0) {
+ if (parameterTypes.length > 2 || parameterTypes.length == 0) {
+ if (parameterTypes.length == 0) {
defaultConstructor = constructor;
}
continue;
}
- if(parameterTypes[0].isAssignableFrom(parent.getClass())) {
- if(parameterTypes.length == 1) {
- if(styleValue == null) {
- swtObject = constructor.newInstance(new Object[]{ parent });
+ if (parameterTypes[0].isAssignableFrom(parent.getClass())) {
+ if (parameterTypes.length == 1) {
+ if (styleValue == null) {
+ swtObject = constructor.newInstance(new Object[] { parent });
break;
}
- } else if(parameterTypes[1].isAssignableFrom(int.class)) {
- if(styleValue == null) {
- swtObject = constructor.newInstance(new Object[]{ parent, 0 });
+ } else if (parameterTypes[1].isAssignableFrom(int.class)) {
+ if (styleValue == null) {
+ swtObject = constructor.newInstance(new Object[] { parent, 0 });
} else {
- swtObject = constructor.newInstance(new Object[]{ parent, styleValue });
+ swtObject = constructor.newInstance(new Object[] { parent, styleValue });
}
break;
}
}
}
- if(swtObject == null) {
- for(Constructor<?> constructor : getType().getConstructors()) {
+ if (swtObject == null) {
+ for (Constructor<?> constructor : getType().getConstructors()) {
Class<?>[] parameterTypes = constructor.getParameterTypes();
- if(parameterTypes.length > 2 || parameterTypes.length == 0) {
- if(parameterTypes.length == 0) {
+ if (parameterTypes.length > 2 || parameterTypes.length == 0) {
+ if (parameterTypes.length == 0) {
defaultConstructor = constructor;
}
continue;
}
- if(directParent != null && parameterTypes[0].isAssignableFrom(directParent.getClass())) {
- if(parameterTypes.length == 1) {
- swtObject = constructor.newInstance(new Object[]{ directParent });
+ if (directParent != null && parameterTypes[0].isAssignableFrom(directParent.getClass())) {
+ if (parameterTypes.length == 1) {
+ swtObject = constructor.newInstance(new Object[] { directParent });
break;
- } else if(parameterTypes[1].isAssignableFrom(int.class)) {
- if(styleValue == null) {
- swtObject = constructor.newInstance(new Object[]{ directParent, 0 });
+ } else if (parameterTypes[1].isAssignableFrom(int.class)) {
+ if (styleValue == null) {
+ swtObject = constructor.newInstance(new Object[] { directParent, 0 });
} else {
- swtObject = constructor.newInstance(new Object[]{ directParent, styleValue });
+ swtObject = constructor.newInstance(new Object[] { directParent, styleValue });
}
break;
}
}
}
}
- if(swtObject == null) {
- if(defaultConstructor == null) {
- if(UserData.isUIElementType(getType())) {
+ if (swtObject == null) {
+ if (defaultConstructor == null) {
+ if (UserData.isUIElementType(getType())) {
// this is used for Visual
Shell shell = new Shell();
try {
Constructor<?> constructor = getType().getConstructor(Composite.class, int.class);
- if(constructor != null) {
+ if (constructor != null) {
return constructor.newInstance(shell, SWT.NONE);
}
} catch (Exception e) {
@@ -603,48 +604,48 @@ public abstract class AbstractMetaclass implements IMetaclass {
}
protected void initialize(Class<?> type, IMetaclass superClass) {
- if(isInitialize()) {
+ if (isInitialize()) {
return;
}
try {
BeanInfo beanInfo = java.beans.Introspector.getBeanInfo(type);
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for(PropertyDescriptor p : propertyDescriptors) {
+ for (PropertyDescriptor p : propertyDescriptors) {
String propertyName = p.getName();
Class<?> propertyType = p.getPropertyType();
- if(p.getReadMethod() == null) {
+ if (p.getReadMethod() == null) {
continue;
}
- if(shouldIgnored(p.getReadMethod().getDeclaringClass(), propertyName, propertyType) || propertyCache.containsKey(propertyName.toLowerCase())) {
+ if (shouldIgnored(p.getReadMethod().getDeclaringClass(), propertyName, propertyType) || propertyCache.containsKey(propertyName.toLowerCase())) {
continue;
}
- if(p.getPropertyType() != null) {
+ if (p.getPropertyType() != null) {
IProperty property = (superClass != null ? superClass.findProperty(p.getName().toLowerCase()) : null);
- if(property != null && !property.isDefault()) {
+ if (property != null && !property.isDefault()) {
addProperty(property);
} else {
- if(p.getWriteMethod() != null || !p.getPropertyType().isPrimitive()) {
+ if (p.getWriteMethod() != null || !p.getPropertyType().isPrimitive()) {
addProperty(new BeanProperty(p));
}
}
}
}
- for(Field f : type.getDeclaredFields()) {
- if(Modifier.isStatic(f.getModifiers())) {
+ for (Field f : type.getDeclaredFields()) {
+ if (Modifier.isStatic(f.getModifiers())) {
continue;
}
String propertyName = f.getName();
Class<?> propertyType = f.getType();
- if(shouldIgnored(f.getDeclaringClass(), propertyName, propertyType)) {
+ if (shouldIgnored(f.getDeclaringClass(), propertyName, propertyType)) {
continue;
}
- if(!propertyCache.containsKey(normalize(propertyName)) && !Modifier.isFinal(f.getModifiers()) && Modifier.isPublic(f.getModifiers())) {
+ if (!propertyCache.containsKey(normalize(propertyName)) && !Modifier.isFinal(f.getModifiers()) && Modifier.isPublic(f.getModifiers())) {
addProperty(new FieldProperty(f));
}
}
- for(EventSetDescriptor eventSetDescriptor : beanInfo.getEventSetDescriptors()) {
+ for (EventSetDescriptor eventSetDescriptor : beanInfo.getEventSetDescriptors()) {
String name = IEventConstants.getEventName(eventSetDescriptor.getName());
BeanEvent event = new BeanEvent(eventSetDescriptor.getName(), eventSetDescriptor);
routedEventCache.put(name, event);
@@ -652,7 +653,7 @@ public abstract class AbstractMetaclass implements IMetaclass {
String propertyDataName = IEventConstants.getEventPropertyDataName(eventSetDescriptor.getName());
addProperty(new EventProperty(propertyName, propertyDataName, event));
}
- if(isWidgetType(type)) {
+ if (isWidgetType(type)) {
LoadedEvent loadedEvent = new LoadedEvent(IEventConstants.XWT_LOADED_EVENT);
routedEventCache.put(normalize(IEventConstants.XWT_LOADED), loadedEvent);
routedEventCache.put(normalize(IEventConstants.XWT_LOADED_EVENT), loadedEvent);
@@ -676,15 +677,15 @@ public abstract class AbstractMetaclass implements IMetaclass {
}
public void addEventGroup(IEventGroup eventGroup) {
- if(eventGroupCache == Collections.<String, IEventGroup> emptyMap()) {
+ if (eventGroupCache == Collections.<String, IEventGroup> emptyMap()) {
eventGroupCache = new HashMap<String, IEventGroup>();
}
- for(String string : eventGroup.getEventNames()) {
- if(eventGroupCache.containsKey(string)) {
+ for (String string : eventGroup.getEventNames()) {
+ if (eventGroupCache.containsKey(string)) {
throw new IllegalArgumentException("Event \"" + string + "\" already existis in a group.");
}
String key = normalize(string);
- if("menudetecteventevent".equals(key)) {
+ if ("menudetecteventevent".equals(key)) {
System.out.println(string);
}
@@ -694,15 +695,15 @@ public abstract class AbstractMetaclass implements IMetaclass {
public IEventGroup getEventGroup(String event) {
IEventGroup eventGroup = eventGroupCache.get(event);
- if(eventGroup == null && superClass != null) {
+ if (eventGroup == null && superClass != null) {
return superClass.getEventGroup(event);
}
return eventGroup;
}
public void addInitializer(IObjectInitializer initializer) {
- for(int i = 0; i < initializers.length; i++) {
- if(initializers[i] == initializer) {
+ for (int i = 0; i < initializers.length; i++) {
+ if (initializers[i] == initializer) {
return;
}
}
@@ -713,8 +714,8 @@ public abstract class AbstractMetaclass implements IMetaclass {
}
public void removeInitializer(IObjectInitializer initializer) {
- for(int i = 0; i < initializers.length; i++) {
- if(initializers[i] == initializer) {
+ for (int i = 0; i < initializers.length; i++) {
+ if (initializers[i] == initializer) {
IObjectInitializer[] oldValue = initializers;
initializers = new IObjectInitializer[oldValue.length - 1];
System.arraycopy(oldValue, 0, initializers, 0, i);
@@ -729,12 +730,12 @@ public abstract class AbstractMetaclass implements IMetaclass {
}
public void initialize(Object instance) {
- if(superClass != null) {
+ if (superClass != null) {
superClass.initialize(instance);
}
- for(int i = 0; i < initializers.length; i++) {
- if(initializers[i] != null) {
+ for (int i = 0; i < initializers.length; i++) {
+ if (initializers[i] != null) {
initializers[i].initialize(instance);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BeanEvent.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BeanEvent.java
index 4ee3a760e9e..e46fb0e6197 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BeanEvent.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BeanEvent.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Behavior.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Behavior.java
index 31999d57589..22b8df58723 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Behavior.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Behavior.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BindingMetaclass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BindingMetaclass.java
index 39acb399cfa..5230fa78dc8 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BindingMetaclass.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/BindingMetaclass.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class BindingMetaclass extends Metaclass {
@@ -35,17 +35,17 @@ public class BindingMetaclass extends Metaclass {
@Override
public Object newInstance(Object[] parameters) {
- DynamicBinding newInstance = (DynamicBinding)super.newInstance(parameters);
- if(JFacesHelper.isViewer(parameters[0]))
+ DynamicBinding newInstance = (DynamicBinding) super.newInstance(parameters);
+ if (JFacesHelper.isViewer(parameters[0])) {
+ newInstance.setControl(parameters[0]);
+ } else if (parameters[0] instanceof Control) {
+ newInstance.setControl(parameters[0]);
+ } else if (parameters[0] instanceof TableItemProperty.Cell) {
+ newInstance.setControl(((TableItemProperty.Cell) parameters[0]).getParent());
+ } else if (parameters[0] instanceof Item) {
+ newInstance.setControl(parameters[0]);
+ } else if (parameters[0] instanceof ViewerColumn) {
newInstance.setControl(parameters[0]);
- else if(parameters[0] instanceof Control)
- newInstance.setControl((Control)parameters[0]);
- else if(parameters[0] instanceof TableItemProperty.Cell)
- newInstance.setControl(((TableItemProperty.Cell)parameters[0]).getParent());
- else if(parameters[0] instanceof Item)
- newInstance.setControl((Item)parameters[0]);
- else if(parameters[0] instanceof ViewerColumn) {
- newInstance.setControl((ViewerColumn)parameters[0]);
}
newInstance.setXWTLoader(xwtLoader);
return newInstance;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ComboBoxCellEditorMetaclass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ComboBoxCellEditorMetaclass.java
index f1cfefda764..ad166036750 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ComboBoxCellEditorMetaclass.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ComboBoxCellEditorMetaclass.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata;
@@ -33,13 +33,13 @@ public class ComboBoxCellEditorMetaclass extends Metaclass {
@Override
public Object newInstance(Object[] parameters) {
try {
- if(parameters.length == 1) {
+ if (parameters.length == 1) {
Constructor<?> constructor = getType().getConstructor(Composite.class, String[].class);
- return constructor.newInstance(getParent(parameters[0]), new String[]{});
- } else if(parameters.length == 2) {
+ return constructor.newInstance(getParent(parameters[0]), new String[] {});
+ } else if (parameters.length == 2) {
Constructor<?> constructor = getType().getConstructor(Composite.class, String[].class, int.class);
- return constructor.newInstance(getParent(parameters[0]), new String[]{}, parameters[2]);
- } else if(parameters.length == 3) {
+ return constructor.newInstance(getParent(parameters[0]), new String[] {}, parameters[2]);
+ } else if (parameters.length == 3) {
Constructor<?> constructor = getType().getConstructor(Composite.class, String[].class, int.class);
return constructor.newInstance(getParent(parameters[0]), parameters[1], parameters[2]);
}
@@ -57,13 +57,14 @@ public class ComboBoxCellEditorMetaclass extends Metaclass {
Widget parent = null;
Widget directParent = null;
- if(object instanceof Widget) {
- directParent = parent = (Widget)object;
- } else if(JFacesHelper.isViewer(object)) {
+ if (object instanceof Widget) {
+ directParent = parent = (Widget) object;
+ } else if (JFacesHelper.isViewer(object)) {
directParent = parent = JFacesHelper.getControl(object);
- } else
+ } else {
throw new IllegalStateException();
- if(Control.class.isAssignableFrom(getType()) && !(parent instanceof Composite)) {
+ }
+ if (Control.class.isAssignableFrom(getType()) && !(parent instanceof Composite)) {
directParent = xwtLoader.findCompositeParent(parent);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ExpandItemHeightAction.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ExpandItemHeightAction.java
index 150fb07d7f5..6a66e9fbe1b 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ExpandItemHeightAction.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/ExpandItemHeightAction.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -22,9 +22,9 @@ import org.eclipse.swt.widgets.ExpandItem;
public class ExpandItemHeightAction implements ISetPostAction {
public void action(Object target, IProperty property, Object value) {
- if(target instanceof ExpandItem && value instanceof Control) {
- ExpandItem targetControl = (ExpandItem)target;
- Control valueControl = (Control)value;
+ if (target instanceof ExpandItem && value instanceof Control) {
+ ExpandItem targetControl = (ExpandItem) target;
+ Control valueControl = (Control) value;
targetControl.setHeight(valueControl.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/LoadedEvent.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/LoadedEvent.java
index 8e26324703d..c18bdbf7be1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/LoadedEvent.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/LoadedEvent.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Metaclass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Metaclass.java
index f37cdd86db2..21e16b4c221 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Metaclass.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/Metaclass.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.xwt.metadata.IMetaclass;
public class Metaclass extends AbstractMetaclass {
/**
- *
+ *
* @param type
* @param superClass
* @param initialize
@@ -30,7 +30,7 @@ public class Metaclass extends AbstractMetaclass {
}
/**
- *
+ *
* @param type
* @param superClass
* @param initialize
@@ -41,14 +41,14 @@ public class Metaclass extends AbstractMetaclass {
this.name = type.getSimpleName();
this.superClass = superClass;
this.xwtLoader = xwtLoader;
- if(initialize) {
+ if (initialize) {
initialize(type, superClass);
}
}
/**
* Default initialize it
- *
+ *
* @param type
* @param superClass
*/
@@ -58,7 +58,7 @@ public class Metaclass extends AbstractMetaclass {
/**
* Default initialize it
- *
+ *
* @param type
* @param superClass
*/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java
index 7ba87f8ab48..65147bc679d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -29,18 +29,18 @@ public class TableEditorMetaclass extends Metaclass {
@Override
public Object newInstance(Object[] parameters) {
Object widget = parameters[0];
- if(parameters.length == 0 || !(widget instanceof Widget)) {
+ if (parameters.length == 0 || !(widget instanceof Widget)) {
throw new IllegalStateException("Table parent is missing.");
}
Table table = null;
- if(widget instanceof Table) {
- table = (Table)widget;
+ if (widget instanceof Table) {
+ table = (Table) widget;
} else {
- table = (Table)UserData.findParent((Widget)widget, Table.class);
+ table = (Table) UserData.findParent((Widget) widget, Table.class);
}
- if(table == null) {
+ if (table == null) {
throw new IllegalStateException("Table parent is missing.");
}
- return super.newInstance(new Object[]{ table });
+ return super.newInstance(new Object[] { table });
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableViewerColumnMetaClass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableViewerColumnMetaClass.java
index 825636953c9..a7a87893b0d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableViewerColumnMetaClass.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableViewerColumnMetaClass.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata;
@@ -32,7 +32,7 @@ public class TableViewerColumnMetaClass extends Metaclass {
@Override
public Object newInstance(Object[] parameters) {
Object object = doNewInstance(parameters);
- if(object != null) {
+ if (object != null) {
initialize(object);
}
return object;
@@ -41,20 +41,20 @@ public class TableViewerColumnMetaClass extends Metaclass {
@Override
public Object doNewInstance(Object[] parameters) {
try {
- if(parameters.length == 1 && parameters[0] instanceof TableViewer) {
+ if (parameters.length == 1 && parameters[0] instanceof TableViewer) {
Constructor<?> constructor = getType().getConstructor(TableViewer.class, int.class);
return constructor.newInstance(parameters[0], SWT.NONE);
- } else if(parameters.length == 2) {
- if(parameters[0] instanceof TableViewer && parameters[1] instanceof Integer) {
+ } else if (parameters.length == 2) {
+ if (parameters[0] instanceof TableViewer && parameters[1] instanceof Integer) {
Constructor<?> constructor = getType().getConstructor(TableViewer.class, int.class);
return constructor.newInstance(parameters);
- } else if(parameters[0] instanceof TableViewer && parameters[1] instanceof TableColumn) {
+ } else if (parameters[0] instanceof TableViewer && parameters[1] instanceof TableColumn) {
Constructor<?> constructor = getType().getConstructor(TableViewer.class, TableColumn.class);
return constructor.newInstance(parameters);
}
- } else if(parameters.length == 3 && parameters[0] instanceof TableViewer && parameters[1] instanceof Integer && parameters[2] instanceof Integer) {
+ } else if (parameters.length == 3 && parameters[0] instanceof TableViewer && parameters[1] instanceof Integer && parameters[2] instanceof Integer) {
Constructor<?> constructor = getType().getConstructor(TableViewer.class, int.class, int.class);
- return constructor.newInstance(parameters[0], ((Integer)parameters[1]).intValue(), ((Integer)parameters[2]).intValue());
+ return constructor.newInstance(parameters[0], ((Integer) parameters[1]).intValue(), ((Integer) parameters[2]).intValue());
}
} catch (SecurityException e) {
} catch (IllegalArgumentException e) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TypedEvent.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TypedEvent.java
index 96be32f340b..17ac22c173c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TypedEvent.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TypedEvent.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/AbstractProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/AbstractProperty.java
index e38ebb8fdbe..8048661e813 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/AbstractProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/AbstractProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -40,10 +40,10 @@ public abstract class AbstractProperty extends Behavior implements IProperty {
}
public void addSetPostAction(ISetPostAction setPostAction) {
- if(setPostActions == Collections.EMPTY_LIST) {
+ if (setPostActions == Collections.EMPTY_LIST) {
setPostActions = new ArrayList<ISetPostAction>();
}
- if(!setPostActions.contains(setPostAction)) {
+ if (!setPostActions.contains(setPostAction)) {
setPostActions.add(setPostAction);
}
}
@@ -53,7 +53,7 @@ public abstract class AbstractProperty extends Behavior implements IProperty {
}
protected void fireSetPostAction(Object target, IProperty property, Object value) {
- for(ISetPostAction setPostAction : setPostActions) {
+ for (ISetPostAction setPostAction : setPostActions) {
setPostAction.action(target, property, value);
}
}
@@ -76,21 +76,21 @@ public abstract class AbstractProperty extends Behavior implements IProperty {
* @see org.eclipse.papyrus.xwt.metadata.IProperty#setType(java.lang.Class)
*/
public void setType(Class<?> type) {
- if(type == boolean.class) {
+ if (type == boolean.class) {
type = Boolean.class;
- } else if(type == int.class) {
+ } else if (type == int.class) {
type = Integer.class;
- } else if(type == long.class) {
+ } else if (type == long.class) {
type = Long.class;
- } else if(type == char.class) {
+ } else if (type == char.class) {
type = Character.class;
- } else if(type == float.class) {
+ } else if (type == float.class) {
type = Float.class;
- } else if(type == double.class) {
+ } else if (type == double.class) {
type = Double.class;
- } else if(type == byte.class) {
+ } else if (type == byte.class) {
type = Byte.class;
- } else if(type == short.class) {
+ } else if (type == short.class) {
type = Short.class;
}
this.type = type;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/BeanProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/BeanProperty.java
index a0219a93f27..aaf237bc383 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/BeanProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/BeanProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -37,59 +37,59 @@ public class BeanProperty extends AbstractProperty {
this.descriptor = descriptor;
Method readMethod = descriptor.getReadMethod();
- if(readMethod != null) {
+ if (readMethod != null) {
Annotation annotation = readMethod.getAnnotation(Containment.class);
- if(annotation != null) {
+ if (annotation != null) {
containment = true;
}
}
Method writeMethod = descriptor.getWriteMethod();
- if(writeMethod != null) {
+ if (writeMethod != null) {
Annotation annotation = writeMethod.getAnnotation(Containment.class);
- if(annotation != null) {
+ if (annotation != null) {
containment = true;
}
}
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- if(descriptor != null && descriptor.getWriteMethod() != null) {
+ if (descriptor != null && descriptor.getWriteMethod() != null) {
Method writeMethod = descriptor.getWriteMethod();
// Bug of invoke boolean value.
Class<?>[] parameterTypes = writeMethod.getParameterTypes();
- if(parameterTypes.length == 1) {
+ if (parameterTypes.length == 1) {
Class<?> type = parameterTypes[0];
Class<?> propertyType = getType();
- if(propertyType != Object.class) {
+ if (propertyType != Object.class) {
type = propertyType;
}
- if(!ObjectUtil.isAssignableFrom(IBinding.class, propertyType)) {
- if(value != null && type != value.getClass()) {
+ if (!ObjectUtil.isAssignableFrom(IBinding.class, propertyType)) {
+ if (value != null && type != value.getClass()) {
value = ObjectUtil.resolveValue(value, type, value);
}
}
Object oldValue = null;
Method readMethod = descriptor.getReadMethod();
- if(readMethod != null) {
+ if (readMethod != null) {
oldValue = readMethod.invoke(target);
}
- if(value == null && type != null && UserData.getWidget(target) != null) {
- if(type == String.class) {
+ if (value == null && type != null && UserData.getWidget(target) != null) {
+ if (type == String.class) {
value = "";
- } else if(type == Boolean.class) {
+ } else if (type == Boolean.class) {
value = false;
}
}
- if(oldValue != value) {
+ if (oldValue != value) {
writeMethod.setAccessible(true);
try {
writeMethod.invoke(target, value);
fireSetPostAction(target, this, value);
} catch (IllegalArgumentException e) {
- if(value == null) {
+ if (value == null) {
throw new XWTException("Property type " + getName() + " of " + target.getClass().getName() + " cannot be null.", e);
}
throw new XWTException("Property type " + getName() + " of " + target.getClass().getName() + " is mismatch with " + value.getClass().getName() + " expected type is " + parameterTypes[0].getName(), e);
@@ -102,7 +102,7 @@ public class BeanProperty extends AbstractProperty {
}
public Object getValue(Object target) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- if(descriptor != null && descriptor.getReadMethod() != null) {
+ if (descriptor != null && descriptor.getReadMethod() != null) {
Method readMethod = descriptor.getReadMethod();
readMethod.setAccessible(true);
return readMethod.invoke(target);
@@ -115,10 +115,12 @@ public class BeanProperty extends AbstractProperty {
return true;
}
+ @Override
public boolean isContainement() {
return containment;
}
+ @Override
public boolean isReadOnly() {
return descriptor.getWriteMethod() == null;
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/ColumnViewerColumnsProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/ColumnViewerColumnsProperty.java
index a62179786a1..2c8c2158d04 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/ColumnViewerColumnsProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/ColumnViewerColumnsProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -20,7 +20,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class ColumnViewerColumnsProperty extends AbstractProperty {
@@ -34,15 +34,15 @@ public class ColumnViewerColumnsProperty extends AbstractProperty {
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableViewer tableViewer = (TableViewer)target;
- Table table = (Table)tableViewer.getControl();
+ TableViewer tableViewer = (TableViewer) target;
+ Table table = (Table) tableViewer.getControl();
int count = table.getColumnCount();
- if(count != 0) {
+ if (count != 0) {
String[] columnProperties = new String[count];
- for(int i = 0; i < columnProperties.length; i++) {
+ for (int i = 0; i < columnProperties.length; i++) {
TableColumn column = table.getColumn(i);
- columnProperties[i] = (String)UserData.getLocalData(column, IUserDataConstants.XWT_PROPERTY_DATA_KEY);
- if(columnProperties[i] != null) {
+ columnProperties[i] = (String) UserData.getLocalData(column, IUserDataConstants.XWT_PROPERTY_DATA_KEY);
+ if (columnProperties[i] != null) {
UserData.setLocalData(column, IUserDataConstants.XWT_PROPERTY_DATA_KEY, null);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DataProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DataProperty.java
index 1470df85c67..cc7f3d47432 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DataProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DataProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,9 +15,9 @@ import org.eclipse.papyrus.xwt.metadata.ILoadingType;
/**
* Additional property to store in user data in widget
- *
+ *
* @author yyang
- *
+ *
*/
public class DataProperty extends AbstractProperty {
@@ -45,7 +45,7 @@ public class DataProperty extends AbstractProperty {
public Object getValue(Object target) {
Object object = UserData.getLocalData(target, key);
- if(object == null) {
+ if (object == null) {
return defaultValue;
}
return object;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicBeanProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicBeanProperty.java
index fc2800db743..2d2e7c84248 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicBeanProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicBeanProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -13,12 +13,12 @@ package org.eclipse.papyrus.xwt.javabean.metadata.properties;
import java.lang.reflect.InvocationTargetException;
/**
- *
+ *
* This is a new type of dynamic properties, some properties, such as texts for TableItem and TreeItem, we used the setText(String[]) and String =
* getText();
- *
+ *
* @author jliu
- *
+ *
*/
public class DynamicBeanProperty extends DynamicProperty {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicProperty.java
index 4b1d0bb5132..d4197500c15 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/DynamicProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -18,7 +18,7 @@ import org.eclipse.papyrus.xwt.metadata.ILoadingType;
/**
* This class is used to extend the Java Bean model
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class DynamicProperty extends AbstractProperty {
@@ -51,7 +51,7 @@ public class DynamicProperty extends AbstractProperty {
}
public Object getValue(Object target) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- return getter.invoke(target, (Object[])null);
+ return getter.invoke(target, (Object[]) null);
}
protected static Method createSetter0(Class<?> type, Class<?> propertyType, String name) {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/EventProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/EventProperty.java
index aa8be5ea52c..e23aaf030e9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/EventProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/EventProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -14,7 +14,7 @@ import org.eclipse.papyrus.xwt.metadata.IEvent;
/**
* A property to hold the event state
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class EventProperty extends DataProperty {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/FieldProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/FieldProperty.java
index 0ca05228ba7..bfc75d2c89b 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/FieldProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/FieldProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.xwt.internal.utils.ObjectUtil;
/**
* @author jliu
- *
+ *
*/
public class FieldProperty extends AbstractProperty {
@@ -46,12 +46,12 @@ public class FieldProperty extends AbstractProperty {
* @see org.eclipse.papyrus.xwt.metadata.IProperty#setValue(java.lang.Object, java.lang.Object)
*/
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- if(value != null) {
+ if (value != null) {
Class<?> fieldType = field.getType();
Class<?> valueType = value.getClass();
- if(!ObjectUtil.isAssignableFrom(fieldType, value.getClass())) {
+ if (!ObjectUtil.isAssignableFrom(fieldType, value.getClass())) {
IConverter converter = XWT.findConvertor(valueType, fieldType);
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
} else {
throw new XWTException("Converter " + valueType.getName() + "->" + fieldType.getName());
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/InputBeanProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/InputBeanProperty.java
index ccad270a5f3..53633c04337 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/InputBeanProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/InputBeanProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -40,15 +40,15 @@ import org.eclipse.papyrus.xwt.metadata.IProperty;
/**
* Handle manually the type conversion. Maybe it can be done using the
* IConverter. Only the type of IProperty should be IObservableCollection
- *
+ *
* @author yyang
- *
+ *
*/
public class InputBeanProperty extends DelegateProperty {
- // public InputBeanProperty(IProperty delegate) {
- // super(delegate);
- // }
+ // public InputBeanProperty(IProperty delegate) {
+ // super(delegate);
+ // }
public InputBeanProperty(IProperty delegate, ILoadingType loadingType) {
super(delegate, loadingType);
@@ -56,78 +56,78 @@ public class InputBeanProperty extends DelegateProperty {
@Override
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- if(value == null) {
+ if (value == null) {
return;
}
- if(value instanceof Class<?>) {
- Class<?> type = (Class<?>)value;
- if(type.isEnum()) {
+ if (value instanceof Class<?>) {
+ Class<?> type = (Class<?>) value;
+ if (type.isEnum()) {
value = new WritableList(XWT.getRealm(), Arrays.asList(type.getEnumConstants()), type);
}
}
Class<?> elementType = getElementType();
- if(value.getClass().isArray()) {
+ if (value.getClass().isArray()) {
elementType = value.getClass().getComponentType();
}
- if(value instanceof IObservableList) {
- IObservableList list = (IObservableList)value;
+ if (value instanceof IObservableList) {
+ IObservableList list = (IObservableList) value;
Object listElementType = list.getElementType();
- if(listElementType instanceof Class<?>) {
- elementType = (Class<?>)listElementType;
+ if (listElementType instanceof Class<?>) {
+ elementType = (Class<?>) listElementType;
}
- } else if(elementType == Object.class && value instanceof Collection<?>) {
- Collection<?> collection = (Collection<?>)value;
- for(Iterator<?> iterator = collection.iterator(); iterator.hasNext();) {
- Object object = (Object)iterator.next();
- if(object != null) {
+ } else if (elementType == Object.class && value instanceof Collection<?>) {
+ Collection<?> collection = (Collection<?>) value;
+ for (Iterator<?> iterator = collection.iterator(); iterator.hasNext();) {
+ Object object = iterator.next();
+ if (object != null) {
elementType = object.getClass();
break;
}
}
}
- if(target instanceof ContentViewer) {
- ContentViewer viewer = (ContentViewer)target;
+ if (target instanceof ContentViewer) {
+ ContentViewer viewer = (ContentViewer) target;
String[] propertyNames = JFacesHelper.getViewerProperties(viewer);
- if(target instanceof AbstractTreeViewer) {
- IContentProvider contentProvider = (IContentProvider)viewer.getContentProvider();
- if(contentProvider instanceof ObservableTreeContentProvider) {
- ObservableTreeContentProvider xwtContentProvider = (ObservableTreeContentProvider)contentProvider;
+ if (target instanceof AbstractTreeViewer) {
+ IContentProvider contentProvider = viewer.getContentProvider();
+ if (contentProvider instanceof ObservableTreeContentProvider) {
+ ObservableTreeContentProvider xwtContentProvider = (ObservableTreeContentProvider) contentProvider;
xwtContentProvider.updateContext(viewer, value);
}
- if(contentProvider instanceof ObservableTreeContentProvider) {
- ObservableTreeContentProvider listContentProvider = (ObservableTreeContentProvider)contentProvider;
+ if (contentProvider instanceof ObservableTreeContentProvider) {
+ ObservableTreeContentProvider listContentProvider = (ObservableTreeContentProvider) contentProvider;
viewer.setLabelProvider(new ObservableMapLabelProvider(viewer, listContentProvider.getKnownElements(), propertyNames));
}
} else {
IContentProvider contentProvider = viewer.getContentProvider();
- if(value instanceof List<?> || value.getClass().isArray()) {
- if(contentProvider == null) {
+ if (value instanceof List<?> || value.getClass().isArray()) {
+ if (contentProvider == null) {
contentProvider = new ObservableListContentProvider();
viewer.setContentProvider(contentProvider);
}
- if(propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer) && contentProvider instanceof ObservableListContentProvider) {
- ObservableListContentProvider listContentProvider = (ObservableListContentProvider)contentProvider;
+ if (propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer) && contentProvider instanceof ObservableListContentProvider) {
+ ObservableListContentProvider listContentProvider = (ObservableListContentProvider) contentProvider;
viewer.setLabelProvider(new ObservableMapLabelProvider(viewer, listContentProvider.getKnownElements(), propertyNames));
}
- } else if(value instanceof Set<?>) {
- if(contentProvider == null) {
+ } else if (value instanceof Set<?>) {
+ if (contentProvider == null) {
contentProvider = new ObservableSetContentProvider();
viewer.setContentProvider(contentProvider);
}
- if(propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer) && contentProvider instanceof ObservableSetContentProvider) {
- ObservableSetContentProvider setContentProvider = (ObservableSetContentProvider)contentProvider;
+ if (propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer) && contentProvider instanceof ObservableSetContentProvider) {
+ ObservableSetContentProvider setContentProvider = (ObservableSetContentProvider) contentProvider;
viewer.setLabelProvider(new ObservableMapLabelProvider(viewer, setContentProvider.getKnownElements(), propertyNames));
}
}
}
}
- if(value instanceof CollectionViewSource) {
- value = ((CollectionViewSource)value).getView();
- } else if((value instanceof Collection<?>) && !(value instanceof IObservableCollection)) {
+ if (value instanceof CollectionViewSource) {
+ value = ((CollectionViewSource) value).getView();
+ } else if ((value instanceof Collection<?>) && !(value instanceof IObservableCollection)) {
value = ObjectUtil.resolveValue(value, IObservableCollection.class, value);
}
super.setValue(target, value);
@@ -141,10 +141,10 @@ public class InputBeanProperty extends DelegateProperty {
protected Class<?> getElementType() {
IProperty property = getDelegate();
Class<?> type = property.getType();
- if(type == null) {
+ if (type == null) {
return Object.class;
}
- if(type.isArray()) {
+ if (type.isArray()) {
return type.getComponentType();
}
return Object.class;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/MultiSelectionBeanProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/MultiSelectionBeanProperty.java
index ec60da2fc6b..742622615a2 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/MultiSelectionBeanProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/MultiSelectionBeanProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -24,9 +24,9 @@ import org.eclipse.papyrus.xwt.metadata.ILoadingType;
/**
* Handle manually the type conversion. Maybe it can be done using the
* IConverter. Only the type of IProperty should be IObservableCollection
- *
+ *
* @author yyang
- *
+ *
*/
public class MultiSelectionBeanProperty extends AbstractProperty {
@@ -39,25 +39,25 @@ public class MultiSelectionBeanProperty extends AbstractProperty {
}
public Object getValue(Object source) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- ISelection selection = ((ISelectionProvider)source).getSelection();
- if(selection instanceof IStructuredSelection) {
- return ((IStructuredSelection)selection).toList();
+ ISelection selection = ((ISelectionProvider) source).getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return ((IStructuredSelection) selection).toList();
}
return Collections.EMPTY_LIST;
}
public void setValue(Object source, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- if(value instanceof List<?>) {
- List<?> list = (List<?>)value;
- ((ISelectionProvider)source).setSelection(new StructuredSelection(list));
- } else if(value instanceof Set<?>) {
- Set<?> set = (Set<?>)value;
- ((ISelectionProvider)source).setSelection(new StructuredSelection(set.toArray()));
+ if (value instanceof List<?>) {
+ List<?> list = (List<?>) value;
+ ((ISelectionProvider) source).setSelection(new StructuredSelection(list));
+ } else if (value instanceof Set<?>) {
+ Set<?> set = (Set<?>) value;
+ ((ISelectionProvider) source).setSelection(new StructuredSelection(set.toArray()));
return;
- } else if(value.getClass().isArray()) {
- ((ISelectionProvider)source).setSelection(new StructuredSelection((Object[])value));
+ } else if (value.getClass().isArray()) {
+ ((ISelectionProvider) source).setSelection(new StructuredSelection((Object[]) value));
return;
}
- ((ISelectionProvider)source).setSelection(StructuredSelection.EMPTY);
+ ((ISelectionProvider) source).setSelection(StructuredSelection.EMPTY);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/PropertiesConstants.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/PropertiesConstants.java
index 0c6a81fd6d8..aabafef0c3d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/PropertiesConstants.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/PropertiesConstants.java
@@ -4,15 +4,15 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
/**
* @author jliu
- *
+ *
*/
public final class PropertiesConstants {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/SingleSelectionBeanProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/SingleSelectionBeanProperty.java
index 842f56c9f16..2101cec8cd0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/SingleSelectionBeanProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/SingleSelectionBeanProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.xwt.metadata.ILoadingType;
/**
* IViewer property
- *
+ *
* @author yyang
*/
public class SingleSelectionBeanProperty extends AbstractProperty {
@@ -35,19 +35,19 @@ public class SingleSelectionBeanProperty extends AbstractProperty {
}
public Object getValue(Object source) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- ISelection selection = ((ISelectionProvider)source).getSelection();
- if(selection instanceof IStructuredSelection) {
- return ((IStructuredSelection)selection).getFirstElement();
+ ISelection selection = ((ISelectionProvider) source).getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return ((IStructuredSelection) selection).getFirstElement();
}
return null;
}
public void setValue(Object source, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
IStructuredSelection selection = value == null ? StructuredSelection.EMPTY : new StructuredSelection(value);
- if(source instanceof Viewer) {
- ((Viewer)source).setSelection(selection, true);
+ if (source instanceof Viewer) {
+ ((Viewer) source).setSelection(selection, true);
} else {
- ((ISelectionProvider)source).setSelection(selection);
+ ((ISelectionProvider) source).setSelection(selection);
}
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/StyleProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/StyleProperty.java
index bc10cb094b8..15fcaad0447 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/StyleProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/StyleProperty.java
@@ -17,7 +17,7 @@ import org.eclipse.papyrus.xwt.XWTException;
import org.eclipse.papyrus.xwt.core.Style;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class StyleProperty extends AbstractProperty {
@@ -31,10 +31,10 @@ public class StyleProperty extends AbstractProperty {
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- if(!(value instanceof Style)) {
+ if (!(value instanceof Style)) {
throw new XWTException("Style is expected.");
}
- Style style = (Style)value;
+ Style style = (Style) value;
style.apply(target);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableColumnEditorProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableColumnEditorProperty.java
index 443cc06cf69..9e6e2ed812e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableColumnEditorProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableColumnEditorProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -16,7 +16,7 @@ import org.eclipse.papyrus.xwt.internal.xml.Element;
import org.eclipse.swt.widgets.TableColumn;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableColumnEditorProperty extends AbstractProperty {
@@ -26,12 +26,12 @@ public class TableColumnEditorProperty extends AbstractProperty {
}
public Object getValue(Object target) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableColumn tableColumn = (TableColumn)target;
+ TableColumn tableColumn = (TableColumn) target;
return tableColumn.getData(PropertiesConstants.DATA_DEFINED_EDITOR);
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableColumn tableColumn = (TableColumn)target;
+ TableColumn tableColumn = (TableColumn) target;
tableColumn.setData(PropertiesConstants.DATA_DEFINED_EDITOR, value);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableEditorDynamicProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableEditorDynamicProperty.java
index 46a9ac02efe..ad81e5baf91 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableEditorDynamicProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableEditorDynamicProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -35,7 +35,7 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableEditorDynamicProperty extends AbstractProperty {
@@ -60,21 +60,21 @@ public class TableEditorDynamicProperty extends AbstractProperty {
*/
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- Boolean isDynamic = (Boolean)value;
- TableEditor tableEditor = (TableEditor)target;
+ Boolean isDynamic = (Boolean) value;
+ TableEditor tableEditor = (TableEditor) target;
final Control control = tableEditor.getEditor();
Table tableParent = null;
Composite parent = control.getParent();
- if(parent instanceof Table) {
- tableParent = (Table)parent;
- } else if(tableEditor.getItem() != null) {
+ if (parent instanceof Table) {
+ tableParent = (Table) parent;
+ } else if (tableEditor.getItem() != null) {
tableParent = tableEditor.getItem().getParent();
}
- if(tableParent == null) {
+ if (tableParent == null) {
return;
}
final Table table = tableParent;
- if(isDynamic) {
+ if (isDynamic) {
control.setVisible(false);
control.addFocusListener(new FocusAdapter() {
@@ -88,14 +88,14 @@ public class TableEditorDynamicProperty extends AbstractProperty {
@Override
public void keyPressed(KeyEvent e) {
- if(e.character == SWT.CR && control.isFocusControl()) {
+ if (e.character == SWT.CR && control.isFocusControl()) {
table.notifyListeners(SWT.DefaultSelection, new Event());
}
}
});
Object mouseHander = table.getData(PropertiesConstants.DATA_TABLE_UTIL);
- if(mouseHander == null) {
+ if (mouseHander == null) {
TableUtil tableUtil = new TableUtil(table);
table.setData(PropertiesConstants.DATA_TABLE_UTIL, tableUtil);
}
@@ -117,10 +117,10 @@ public class TableEditorDynamicProperty extends AbstractProperty {
public void widgetDefaultSelected(SelectionEvent e) {
Control editor = tableEditor.getEditor();
- if(editor.isDisposed()) {
+ if (editor.isDisposed()) {
return;
}
- if(editor.isFocusControl()) {
+ if (editor.isFocusControl()) {
editor.setVisible(false);
} else {
editor.setFocus();
@@ -129,14 +129,14 @@ public class TableEditorDynamicProperty extends AbstractProperty {
public void widgetSelected(SelectionEvent e) {
Control editor = tableEditor.getEditor();
- if(editor.isDisposed()) {
+ if (editor.isDisposed()) {
return;
}
- TableUtil tableUtil = (TableUtil)table.getData(PropertiesConstants.DATA_TABLE_UTIL);
+ TableUtil tableUtil = (TableUtil) table.getData(PropertiesConstants.DATA_TABLE_UTIL);
TableItem item = tableUtil.getItem();
int column = tableUtil.getColumn();
- if(item == tableEditor.getItem() && column == tableEditor.getColumn()) {
+ if (item == tableEditor.getItem() && column == tableEditor.getColumn()) {
editor.setVisible(true);
} else {
editor.setVisible(false);
@@ -160,8 +160,9 @@ public class TableEditorDynamicProperty extends AbstractProperty {
@Override
public void mouseDown(MouseEvent e) {
- if(table.isDisposed() || !table.isVisible())
+ if (table.isDisposed() || !table.isVisible()) {
return;
+ }
Point pt = new Point(e.x, e.y);
int lineWidth = table.getLinesVisible() ? table.getGridLineWidth() : 0;
TableItem item = table.getItem(pt);
@@ -169,44 +170,48 @@ public class TableEditorDynamicProperty extends AbstractProperty {
int start = item != null ? table.indexOf(item) : table.getTopIndex();
int end = table.getItemCount();
Rectangle clientRect = table.getClientArea();
- for(int i = start; i < end; i++) {
+ for (int i = start; i < end; i++) {
TableItem nextItem = table.getItem(i);
Rectangle rect = nextItem.getBounds(0);
- if(pt.y >= rect.y && pt.y < rect.y + rect.height + lineWidth) {
+ if (pt.y >= rect.y && pt.y < rect.y + rect.height + lineWidth) {
item = nextItem;
break;
}
- if(rect.y > clientRect.y + clientRect.height)
+ if (rect.y > clientRect.y + clientRect.height) {
return;
+ }
}
- if(item == null)
+ if (item == null) {
return;
+ }
this.item = item;
TableColumn newColumn = null;
int columnCount = table.getColumnCount();
- if(columnCount == 0) {
- if((table.getStyle() & SWT.FULL_SELECTION) == 0) {
+ if (columnCount == 0) {
+ if ((table.getStyle() & SWT.FULL_SELECTION) == 0) {
Rectangle rect = item.getBounds(0);
rect.width += lineWidth;
rect.height += lineWidth;
- if(!rect.contains(pt))
+ if (!rect.contains(pt)) {
return;
+ }
}
} else {
- for(int i = 0; i < columnCount; i++) {
+ for (int i = 0; i < columnCount; i++) {
Rectangle rect = item.getBounds(i);
rect.width += lineWidth;
rect.height += lineWidth;
- if(rect.contains(pt)) {
+ if (rect.contains(pt)) {
newColumn = table.getColumn(i);
break;
}
}
- if(newColumn == null) {
- if((table.getStyle() & SWT.FULL_SELECTION) == 0)
+ if (newColumn == null) {
+ if ((table.getStyle() & SWT.FULL_SELECTION) == 0) {
return;
+ }
newColumn = table.getColumn(0);
}
}
@@ -224,7 +229,7 @@ public class TableEditorDynamicProperty extends AbstractProperty {
}
public void setRow(int rowIndex) {
- if(rowIndex >= 0 && rowIndex < table.getItemCount()) {
+ if (rowIndex >= 0 && rowIndex < table.getItemCount()) {
item = table.getItem(rowIndex);
} else {
item = null;
@@ -236,7 +241,7 @@ public class TableEditorDynamicProperty extends AbstractProperty {
}
public void setColumn(int columnIndex) {
- if(columnIndex >= 0 && columnIndex < table.getColumnCount()) {
+ if (columnIndex >= 0 && columnIndex < table.getColumnCount()) {
column = table.getColumn(columnIndex);
} else {
column = null;
@@ -247,7 +252,7 @@ public class TableEditorDynamicProperty extends AbstractProperty {
int rowIndex = getRow();
int columnIndex = column == null ? 0 : table.indexOf(column);
- switch(event.keyCode) {
+ switch (event.keyCode) {
case SWT.ARROW_UP:
setRow(Math.max(0, rowIndex - 1));
break;
@@ -257,19 +262,22 @@ public class TableEditorDynamicProperty extends AbstractProperty {
case SWT.ARROW_LEFT:
case SWT.ARROW_RIGHT:
int columnCount = table.getColumnCount();
- if(columnCount == 0)
+ if (columnCount == 0) {
break;
+ }
int[] order = table.getColumnOrder();
int index = 0;
- while(index < order.length) {
- if(order[index] == columnIndex)
+ while (index < order.length) {
+ if (order[index] == columnIndex) {
break;
+ }
index++;
}
- if(index == order.length)
+ if (index == order.length) {
index = 0;
+ }
int leadKey = (XWTMaps.getStyle("SWT.RIGHT_TO_LEFT") != SWT.NONE) ? ((table.getStyle() & XWTMaps.getStyle("SWT.RIGHT_TO_LEFT")) != 0 ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT) : SWT.ARROW_LEFT;
- if(event.keyCode == leadKey) {
+ if (event.keyCode == leadKey) {
setColumn(order[Math.max(0, index - 1)]);
} else {
setColumn(order[Math.min(columnCount - 1, index + 1)]);
@@ -286,7 +294,7 @@ public class TableEditorDynamicProperty extends AbstractProperty {
break;
case SWT.PAGE_UP:
int topIndex = table.getTopIndex();
- if(topIndex == rowIndex) {
+ if (topIndex == rowIndex) {
Rectangle rect = table.getClientArea();
TableItem item = table.getItem(topIndex);
Rectangle itemRect = item.getBounds(0);
@@ -308,7 +316,7 @@ public class TableEditorDynamicProperty extends AbstractProperty {
int page = Math.max(1, rect.height / height);
int end = table.getItemCount() - 1;
downIndex = Math.min(end, downIndex + page - 1);
- if(downIndex == rowIndex) {
+ if (downIndex == rowIndex) {
downIndex = Math.min(end, downIndex + page - 1);
}
setRow(downIndex);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemEditorProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemEditorProperty.java
index 4f2a50a9c5f..20bd6cf6785 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemEditorProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemEditorProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,7 +19,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableItemEditorProperty extends AbstractProperty {
@@ -33,11 +33,11 @@ public class TableItemEditorProperty extends AbstractProperty {
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableItem tableItem = (TableItem)target;
- Collection<TableEditor> tableEditors = (Collection<TableEditor>)value;
+ TableItem tableItem = (TableItem) target;
+ Collection<TableEditor> tableEditors = (Collection<TableEditor>) value;
- for(TableEditor tableEditor : tableEditors) {
- if(tableEditor != null) {
+ for (TableEditor tableEditor : tableEditors) {
+ if (tableEditor != null) {
disposeOldEditor(tableEditor.getColumn(), tableItem);
tableEditor.setItem(tableItem);
}
@@ -46,19 +46,19 @@ public class TableItemEditorProperty extends AbstractProperty {
/**
* Dispose old Table editors for current tableItem at given column index.
- *
+ *
* @param column
* @param tableItem
*/
private void disposeOldEditor(int column, TableItem tableItem) {
Table table = tableItem.getParent();
Control[] children = table.getChildren();
- for(Control control : children) {
+ for (Control control : children) {
Object editor = control.getData(PropertiesConstants.DATA_CONTROLEDITOR_OF_CONTROL);
- if(editor == null || !(editor instanceof TableEditor)) {
+ if (editor == null || !(editor instanceof TableEditor)) {
continue;
}
- if(column == ((TableEditor)editor).getColumn() && tableItem == ((TableEditor)editor).getItem()) {
+ if (column == ((TableEditor) editor).getColumn() && tableItem == ((TableEditor) editor).getItem()) {
control.dispose();
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemProperty.java
index 05e16ee6881..00ab10b60d7 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableItemProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -17,7 +17,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.TableItem;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableItemProperty extends AbstractProperty {
@@ -64,14 +64,14 @@ public class TableItemProperty extends AbstractProperty {
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- Collection<Cell> cells = (Collection<Cell>)value;
- TableItem tableItem = (TableItem)target;
+ Collection<Cell> cells = (Collection<Cell>) value;
+ TableItem tableItem = (TableItem) target;
String[] texts = new String[cells.size()];
Image[] images = new Image[cells.size()];
int i = 0;
- for(Cell cell : cells) {
+ for (Cell cell : cells) {
String text = (cell).getText();
texts[i] = text == null ? "" : text;
images[i] = cell.getImage();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnDynamicProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnDynamicProperty.java
index 3bbdd734581..f9ca1b1dbbe 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnDynamicProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnDynamicProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -17,7 +17,7 @@ import org.eclipse.papyrus.xwt.internal.utils.UserData;
import org.eclipse.swt.widgets.TableColumn;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableViewerColumnDynamicProperty extends AbstractProperty {
@@ -38,7 +38,7 @@ public class TableViewerColumnDynamicProperty extends AbstractProperty {
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableViewerColumn tableViewerColumn = (TableViewerColumn)target;
+ TableViewerColumn tableViewerColumn = (TableViewerColumn) target;
TableColumn tableColumn = tableViewerColumn.getColumn();
UserData.setLocalData(tableColumn, getPropertyKey(), value);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnImageProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnImageProperty.java
index 72708cb999d..08a85b84174 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnImageProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnImageProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -17,7 +17,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.TableColumn;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableViewerColumnImageProperty extends AbstractProperty {
@@ -31,9 +31,9 @@ public class TableViewerColumnImageProperty extends AbstractProperty {
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableViewerColumn tableViewerColumn = (TableViewerColumn)target;
+ TableViewerColumn tableViewerColumn = (TableViewerColumn) target;
TableColumn tableColumn = tableViewerColumn.getColumn();
- Image image = (Image)value;
+ Image image = (Image) value;
tableColumn.setImage(image);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnTextProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnTextProperty.java
index d78132f4ff9..6131077eeb9 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnTextProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnTextProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -16,7 +16,7 @@ import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.widgets.TableColumn;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableViewerColumnTextProperty extends AbstractProperty {
@@ -30,9 +30,9 @@ public class TableViewerColumnTextProperty extends AbstractProperty {
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableViewerColumn tableViewerColumn = (TableViewerColumn)target;
+ TableViewerColumn tableViewerColumn = (TableViewerColumn) target;
TableColumn tableColumn = tableViewerColumn.getColumn();
- String text = (String)value;
+ String text = (String) value;
tableColumn.setText(text);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnWidthProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnWidthProperty.java
index ca620f78641..2b098a078af 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnWidthProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TableViewerColumnWidthProperty.java
@@ -4,8 +4,8 @@
* 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: *
+ * *
+ * Contributors: *
* Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.javabean.metadata.properties;
@@ -16,7 +16,7 @@ import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.widgets.TableColumn;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class TableViewerColumnWidthProperty extends AbstractProperty {
@@ -30,9 +30,9 @@ public class TableViewerColumnWidthProperty extends AbstractProperty {
}
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException {
- TableViewerColumn tableViewerColumn = (TableViewerColumn)target;
+ TableViewerColumn tableViewerColumn = (TableViewerColumn) target;
TableColumn tableColumn = tableViewerColumn.getColumn();
- int width = (Integer)value;
+ int width = (Integer) value;
tableColumn.setWidth(width);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TriggersProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TriggersProperty.java
index 00da9d711f9..1dd3adb5bea 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TriggersProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/properties/TriggersProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -25,14 +25,14 @@ public class TriggersProperty extends DataProperty {
public void setValue(Object target, Object value) {
super.setValue(target, value);
- TriggerBase[] triggers = (TriggerBase[])value;
- for(TriggerBase triggerBase : triggers) {
- if(triggerBase != null) {
+ TriggerBase[] triggers = (TriggerBase[]) value;
+ for (TriggerBase triggerBase : triggers) {
+ if (triggerBase != null) {
triggerBase.prepare(target);
}
}
- for(TriggerBase triggerBase : triggers) {
- if(triggerBase != null) {
+ for (TriggerBase triggerBase : triggers) {
+ if (triggerBase != null) {
triggerBase.on(target);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/AbstractDialog.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/AbstractDialog.java
index a320dadd28d..6ef9d6387d3 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/AbstractDialog.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/AbstractDialog.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -15,6 +15,7 @@ import java.util.HashMap;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.papyrus.xwt.IXWTLoader;
import org.eclipse.papyrus.xwt.XWT;
import org.eclipse.papyrus.xwt.XWTException;
import org.eclipse.papyrus.xwt.XWTLoader;
@@ -36,7 +37,7 @@ public abstract class AbstractDialog extends Dialog {
@Override
protected Control createDialogArea(Composite parent) {
- if(title != null) {
+ if (title != null) {
getShell().setText(title);
}
@@ -46,12 +47,12 @@ public abstract class AbstractDialog extends Dialog {
HashMap<String, Object> newOptions = new HashMap<String, Object>();
initOptions(parent, newOptions);
Object element = XWT.loadWithOptions(getContentURL(), newOptions);
- if(!(element instanceof Control)) {
+ if (!(element instanceof Control)) {
throw new XWTException("Root element must a control.");
}
GridLayoutFactory.fillDefaults().generateLayout(parent);
parent.layout(true, true);
- return (Control)element;
+ return (Control) element;
} catch (Exception e) {
e.printStackTrace();
} finally {
@@ -62,9 +63,9 @@ public abstract class AbstractDialog extends Dialog {
}
protected void initOptions(Composite parent, HashMap<String, Object> newOptions) {
- newOptions.put(XWTLoader.CONTAINER_PROPERTY, parent);
- newOptions.put(XWTLoader.DATACONTEXT_PROPERTY, dataContext);
- newOptions.put(XWTLoader.CLASS_PROPERTY, geCLR());
+ newOptions.put(IXWTLoader.CONTAINER_PROPERTY, parent);
+ newOptions.put(IXWTLoader.DATACONTEXT_PROPERTY, dataContext);
+ newOptions.put(IXWTLoader.CLASS_PROPERTY, geCLR());
}
protected abstract URL getContentURL();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/CellEditorHelper.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/CellEditorHelper.java
index 5cf4bc83f5d..bd80f870ddb 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/CellEditorHelper.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/CellEditorHelper.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -32,16 +32,16 @@ public class CellEditorHelper {
public Class<?> getTargetType() {
ISelection selection = this.tableViewer.getSelection();
- if(!selection.isEmpty() && selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
Object element = structuredSelection.getFirstElement();
Object property = this.tableViewer.getColumnProperties()[index];
String propertyName = property.toString();
try {
BeanInfo beanInfo = java.beans.Introspector.getBeanInfo(element.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for(PropertyDescriptor propertyDescriptor : propertyDescriptors) {
- if(propertyDescriptor.getName().equalsIgnoreCase(propertyName)) {
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ if (propertyDescriptor.getName().equalsIgnoreCase(propertyName)) {
return propertyDescriptor.getPropertyType();
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ComboBoxCellEditor.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ComboBoxCellEditor.java
index 9428fbc468a..57b040c146c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ComboBoxCellEditor.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ComboBoxCellEditor.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -35,17 +35,17 @@ public class ComboBoxCellEditor extends org.eclipse.jface.viewers.ComboBoxCellEd
@Override
protected void doSetValue(Object value) {
- if(value != null) {
+ if (value != null) {
Class<?> targetType = getTargetType();
- if(targetType != String.class) {
+ if (targetType != String.class) {
IConverter converter = XWT.findConvertor(targetType, String.class);
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
}
}
String[] items = getItems();
- for(int i = 0; i < items.length; i++) {
- if(items[i].equals(value)) {
+ for (int i = 0; i < items.length; i++) {
+ if (items[i].equals(value)) {
super.doSetValue(i);
return;
}
@@ -58,15 +58,15 @@ public class ComboBoxCellEditor extends org.eclipse.jface.viewers.ComboBoxCellEd
protected Object doGetValue() {
Object value = super.doGetValue();
String[] items = getItems();
- int selected = (Integer)value;
- if(selected < 0) {
+ int selected = (Integer) value;
+ if (selected < 0) {
return null;
}
String selectedString = items[selected];
Class<?> targetType = getTargetType();
- if(targetType != String.class) {
+ if (targetType != String.class) {
IConverter converter = XWT.findConvertor(String.class, targetType);
- if(converter != null) {
+ if (converter != null) {
return converter.convert(value);
}
}
@@ -74,16 +74,16 @@ public class ComboBoxCellEditor extends org.eclipse.jface.viewers.ComboBoxCellEd
}
protected Class<?> getTargetType() {
- if(cellEditorHelper != null) {
+ if (cellEditorHelper != null) {
return cellEditorHelper.getTargetType();
}
return Object.class;
}
public void setIndex(Object parent, int index) {
- if(!(parent instanceof TableViewer)) {
+ if (!(parent instanceof TableViewer)) {
throw new XWTException("TableView is expected, not \"" + parent.getClass().getName() + "\"");
}
- cellEditorHelper = new CellEditorHelper((TableViewer)parent, index);
+ cellEditorHelper = new CellEditorHelper((TableViewer) parent, index);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultCellModifier.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultCellModifier.java
index 26638b07a63..835881989c4 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultCellModifier.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultCellModifier.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -44,7 +44,7 @@ public class DefaultCellModifier implements ICellModifier {
public Object getValue(Object element, String property) {
PropertyDescriptor descriptor = getDescriptor(element, property);
- if(descriptor != null) {
+ if (descriptor != null) {
try {
return descriptor.getReadMethod().invoke(element);
} catch (Exception e) {
@@ -55,15 +55,15 @@ public class DefaultCellModifier implements ICellModifier {
}
public void modify(Object element, String property, Object value) {
- if(element instanceof TableItem) {
- TableItem tableItem = (TableItem)element;
+ if (element instanceof TableItem) {
+ TableItem tableItem = (TableItem) element;
Object data = tableItem.getData();
PropertyDescriptor descriptor = getDescriptor(data, property);
- if(descriptor != null) {
+ if (descriptor != null) {
try {
Class<?> type = descriptor.getPropertyType();
IConverter converter = XWT.findConvertor(value.getClass(), type);
- if(converter != null) {
+ if (converter != null) {
Object newValue = converter.convert(value);
descriptor.getWriteMethod().invoke(data, newValue);
tableViewer.refresh(data);
@@ -79,10 +79,10 @@ public class DefaultCellModifier implements ICellModifier {
private PropertyDescriptor getDescriptor(Object element, String property) {
BeanInfo beanInfo = getBeanInfo(element);
- if(beanInfo != null) {
+ if (beanInfo != null) {
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
- for(PropertyDescriptor propertyDescriptor : propertyDescriptors) {
- if(propertyDescriptor.getName().equalsIgnoreCase(property)) {
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ if (propertyDescriptor.getName().equalsIgnoreCase(property)) {
return propertyDescriptor;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultListContentProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultListContentProvider.java
index 6622457bab0..8a755fee316 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultListContentProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultListContentProvider.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -19,12 +19,12 @@ import org.eclipse.papyrus.xwt.internal.core.Core;
public class DefaultListContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object inputElement) {
- if(inputElement instanceof Collection<?>) {
- Collection<?> collection = (Collection<?>)inputElement;
+ if (inputElement instanceof Collection<?>) {
+ Collection<?> collection = (Collection<?>) inputElement;
return collection.toArray();
}
- if(inputElement instanceof Object[]) {
- return (Object[])inputElement;
+ if (inputElement instanceof Object[]) {
+ return (Object[]) inputElement;
}
return Core.EMPTY_ARRAY;
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultViewerLabelProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultViewerLabelProvider.java
index 84452120569..f1934731ed3 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultViewerLabelProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/DefaultViewerLabelProvider.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -26,7 +26,7 @@ import org.eclipse.papyrus.xwt.metadata.IProperty;
import org.eclipse.swt.graphics.Image;
/**
- *
+ *
* @author yyang (yves.yang@soyatec.com)
*/
public class DefaultViewerLabelProvider implements ITableLabelProvider, ILabelProvider {
@@ -50,10 +50,10 @@ public class DefaultViewerLabelProvider implements ITableLabelProvider, ILabelPr
}
protected IProperty getColumnsProperty() {
- if(columnsProperty == null) {
+ if (columnsProperty == null) {
IMetaclass metaclass = XWT.getMetaclass(viewer.getClass());
columnsProperty = metaclass.findProperty(PropertiesConstants.PROPERTY_COLUMNS);
- if(columnsProperty == null) {
+ if (columnsProperty == null) {
throw new XWTException("Columns property is not found.");
}
}
@@ -95,22 +95,22 @@ public class DefaultViewerLabelProvider implements ITableLabelProvider, ILabelPr
protected Object[] getPaths() {
Viewer viewer = getViewer();
- if(viewer instanceof AbstractTableViewer) {
- Object[] objects = ((AbstractTableViewer)getViewer()).getColumnProperties();
- for(int i = 0; i < objects.length; i++) {
- if((objects[i] == null)) {
+ if (viewer instanceof AbstractTableViewer) {
+ Object[] objects = ((AbstractTableViewer) getViewer()).getColumnProperties();
+ for (int i = 0; i < objects.length; i++) {
+ if ((objects[i] == null)) {
objects[i] = getBindingPath();
}
}
return objects;
}
String path = bindingPath;
- if(path == null) {
- path = (String)UserData.getLocalData(getViewer(), IUserDataConstants.XWT_PROPERTY_DATA_KEY);
+ if (path == null) {
+ path = (String) UserData.getLocalData(getViewer(), IUserDataConstants.XWT_PROPERTY_DATA_KEY);
}
- if(path == null) {
+ if (path == null) {
return Core.EMPTY_ARRAY;
}
- return new String[]{ path };
+ return new String[] { path };
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFaceInitializer.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFaceInitializer.java
index 01e2d6fc63e..9da9c876c3e 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFaceInitializer.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFaceInitializer.java
@@ -17,11 +17,11 @@ import org.eclipse.papyrus.xwt.metadata.IObjectInitializer;
public class JFaceInitializer implements IObjectInitializer {
public void initialize(Object object) {
- if(object instanceof AbstractListViewer) {
- AbstractListViewer viewer = (AbstractListViewer)object;
+ if (object instanceof AbstractListViewer) {
+ AbstractListViewer viewer = (AbstractListViewer) object;
viewer.setLabelProvider(new DefaultViewerLabelProvider(viewer));
- } else if(object instanceof AbstractTableViewer) {
- AbstractTableViewer viewer = (AbstractTableViewer)object;
+ } else if (object instanceof AbstractTableViewer) {
+ AbstractTableViewer viewer = (AbstractTableViewer) object;
viewer.setLabelProvider(new DefaultViewerLabelProvider(viewer));
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFacesHelper.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFacesHelper.java
index 24342c1af41..0d1727f1546 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFacesHelper.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/JFacesHelper.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -40,17 +40,19 @@ public class JFacesHelper {
}
public static boolean isViewer(Object obj) {
- if(JFACES_VIEWER == null || obj == null)
+ if (JFACES_VIEWER == null || obj == null) {
return false;
+ }
return JFACES_VIEWER.isAssignableFrom(obj.getClass());
}
public static Control getControl(Object obj) {
- if(!isViewer(obj))
+ if (!isViewer(obj)) {
throw new XWTException("Expecting a JFaces viewer:" + obj);
+ }
try {
Method method = JFACES_VIEWER.getMethod("getControl");
- return (Control)method.invoke(obj);
+ return (Control) method.invoke(obj);
} catch (Exception e) {
e.printStackTrace();
return null;
@@ -66,12 +68,13 @@ public class JFacesHelper {
try {
JFACES_VIEWER = Class.forName("org.eclipse.jface.viewers.Viewer");
- String[] jfaceClasses = new String[]{ "org.eclipse.jface.viewers.ComboViewer", "org.eclipse.jface.viewers.ListViewer", "org.eclipse.jface.viewers.TreeViewer", "org.eclipse.jface.viewers.TableViewer", "org.eclipse.jface.viewers.TableTreeViewer", "org.eclipse.jface.viewers.CheckboxTableViewer", "org.eclipse.jface.viewers.CheckboxTreeViewer",
- // Dialogs
- "org.eclipse.jface.dialogs.TrayDialog", "org.eclipse.jface.dialogs.TitleAreaDialog",
- // Add CellEditors for JFave Viewers.
- "org.eclipse.jface.viewers.CellEditor", "org.eclipse.jface.viewers.ComboBoxViewerCellEditor", TextCellEditor.class.getName(), CheckboxCellEditor.class.getName() };
- for(String clazz : jfaceClasses) {
+ String[] jfaceClasses = new String[] { "org.eclipse.jface.viewers.ComboViewer", "org.eclipse.jface.viewers.ListViewer", "org.eclipse.jface.viewers.TreeViewer", "org.eclipse.jface.viewers.TableViewer", "org.eclipse.jface.viewers.TableTreeViewer",
+ "org.eclipse.jface.viewers.CheckboxTableViewer", "org.eclipse.jface.viewers.CheckboxTreeViewer",
+ // Dialogs
+ "org.eclipse.jface.dialogs.TrayDialog", "org.eclipse.jface.dialogs.TitleAreaDialog",
+ // Add CellEditors for JFave Viewers.
+ "org.eclipse.jface.viewers.CellEditor", "org.eclipse.jface.viewers.ComboBoxViewerCellEditor", TextCellEditor.class.getName(), CheckboxCellEditor.class.getName() };
+ for (String clazz : jfaceClasses) {
try {
collector.add(Class.forName(clazz));
} catch (Throwable e) {
@@ -85,56 +88,56 @@ public class JFacesHelper {
}
public static String[] getViewerProperties(Viewer viewer) {
- if(viewer instanceof ColumnViewer) {
- ColumnViewer columnViewer = (ColumnViewer)viewer;
+ if (viewer instanceof ColumnViewer) {
+ ColumnViewer columnViewer = (ColumnViewer) viewer;
Object[] properties = columnViewer.getColumnProperties();
String[] propertyNames = Core.EMPTY_STRING_ARRAY;
- if(properties != null) {
+ if (properties != null) {
int size = 0;
- for(int i = 0; i < properties.length; i++) {
- if(properties[i] != null) {
+ for (int i = 0; i < properties.length; i++) {
+ if (properties[i] != null) {
size++;
}
}
propertyNames = new String[size];
- for(int i = 0, j = 0; i < properties.length; i++) {
- if(properties[i] != null) {
+ for (int i = 0, j = 0; i < properties.length; i++) {
+ if (properties[i] != null) {
propertyNames[j++] = properties[i].toString();
}
}
}
- if(propertyNames.length != 0) {
+ if (propertyNames.length != 0) {
return propertyNames;
}
}
- String path = (String)UserData.getLocalData(viewer, IUserDataConstants.XWT_PROPERTY_DATA_KEY);
- if(path != null) {
- return new String[]{ path };
+ String path = (String) UserData.getLocalData(viewer, IUserDataConstants.XWT_PROPERTY_DATA_KEY);
+ if (path != null) {
+ return new String[] { path };
}
return Core.EMPTY_STRING_ARRAY;
}
public static Object getColumnObject(Object element, int columnIndex, Object[] properties) {
- if(element == null) {
+ if (element == null) {
return null;
}
Object dataContext = element;
- if(properties != null && columnIndex < properties.length) {
+ if (properties != null && columnIndex < properties.length) {
Object propertyElement = properties[columnIndex];
- if(propertyElement != null) {
+ if (propertyElement != null) {
String propertyName = propertyElement.toString();
- if(propertyName != null) {
+ if (propertyName != null) {
try {
IMetaclass metaclass = XWT.getMetaclass(dataContext);
IProperty property = metaclass.findProperty(propertyName.toLowerCase());
- if(property != null) {
+ if (property != null) {
dataContext = property.getValue(dataContext);
- if(dataContext != null) {
+ if (dataContext != null) {
Class<?> type = dataContext.getClass();
Class<?> propertyType = property.getType();
- if(propertyType != null && !propertyType.isAssignableFrom(type)) {
+ if (propertyType != null && !propertyType.isAssignableFrom(type)) {
dataContext = ObjectUtil.resolveValue(dataContext, type, propertyType, dataContext);
}
}
@@ -157,28 +160,28 @@ public class JFacesHelper {
Object value = getColumnObject(element, columnIndex, properties);
try {
- if(viewer instanceof TableViewer) {
- Table table = ((TableViewer)viewer).getTable();
+ if (viewer instanceof TableViewer) {
+ Table table = ((TableViewer) viewer).getTable();
TableColumn[] columns = table.getColumns();
TableColumn column = columns[columnIndex];
- if(UserData.hasLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_TEXT_KEY)) {
+ if (UserData.hasLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_TEXT_KEY)) {
Object userDataValue = UserData.getLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_TEXT_KEY);
- if(userDataValue instanceof IBinding) {
- IBinding binding = (IBinding)userDataValue;
+ if (userDataValue instanceof IBinding) {
+ IBinding binding = (IBinding) userDataValue;
binding.reset();
UserData.setDataContext(column, value);
value = binding.getValue(null);
} else {
value = userDataValue;
}
- } else if(UserData.hasLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_IMAGE_KEY)) {
+ } else if (UserData.hasLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_IMAGE_KEY)) {
return null;
}
}
} catch (Exception e) {
throw new XWTException(e);
}
- if(value != null) {
+ if (value != null) {
return value.toString();
}
return "";
@@ -191,18 +194,18 @@ public class JFacesHelper {
public static Image getColumnImage(Viewer viewer, Object element, int columnIndex, Object[] properties) {
Object value = getColumnObject(element, columnIndex, properties);
- if(value == null) {
+ if (value == null) {
return null;
}
try {
- if(viewer instanceof TableViewer) {
- Table table = ((TableViewer)viewer).getTable();
+ if (viewer instanceof TableViewer) {
+ Table table = ((TableViewer) viewer).getTable();
TableColumn[] columns = table.getColumns();
TableColumn column = columns[columnIndex];
- if(UserData.hasLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_IMAGE_KEY)) {
+ if (UserData.hasLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_IMAGE_KEY)) {
Object userDataValue = UserData.getLocalData(column, IUserDataConstants.XWT_PROPERTY_ITEM_IMAGE_KEY);
- if(userDataValue instanceof IBinding) {
- IBinding binding = (IBinding)userDataValue;
+ if (userDataValue instanceof IBinding) {
+ IBinding binding = (IBinding) userDataValue;
binding.reset();
UserData.setDataContext(column, value);
value = binding.getValue(null);
@@ -216,19 +219,19 @@ public class JFacesHelper {
} catch (Exception e) {
throw new XWTException(e);
}
- if(value instanceof IObservableValue) {
- IObservableValue observableValue = (IObservableValue)value;
+ if (value instanceof IObservableValue) {
+ IObservableValue observableValue = (IObservableValue) value;
value = observableValue.getValue();
}
- if(value instanceof Image) {
- return (Image)value;
- } else if(value != null) {
+ if (value instanceof Image) {
+ return (Image) value;
+ } else if (value != null) {
value = ObjectUtil.resolveValue(value, Image.class, value);
- if(value == null) {
+ if (value == null) {
return null;
}
- if(value instanceof Image) {
- return (Image)value;
+ if (value instanceof Image) {
+ return (Image) value;
}
throw new XWTException("Converter from " + value.getClass() + " to Image is missing.");
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableMapLabelProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableMapLabelProvider.java
index 9a3b3cb9072..0fbb054a161 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableMapLabelProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableMapLabelProvider.java
@@ -31,9 +31,9 @@ import org.eclipse.swt.graphics.Image;
* that this label provider uses for display. Clients may customize by
* subclassing and overriding {@link #getColumnText(Object, int)}, {@link #getColumnImage(Object, int)}, for tables or trees with columns, or by
* implementing additional mixin interfaces for colors, fonts etc.
- *
+ *
* @since 1.1
- *
+ *
*/
public class ObservableMapLabelProvider extends LabelProvider implements ILabelProvider, ITableLabelProvider {
@@ -56,38 +56,41 @@ public class ObservableMapLabelProvider extends LabelProvider implements ILabelP
public ObservableMapLabelProvider(Viewer viewer, IObservableSet domain, String[] propertyNames) {
textMaps = new XWTObservableWrapper[propertyNames.length];
- for(int i = 0; i < textMaps.length; i++) {
+ for (int i = 0; i < textMaps.length; i++) {
textMaps[i] = new XWTObservableWrapper(domain, viewer, propertyNames[i]);
textMaps[i].addMapChangeListener(mapChangeListener);
}
this.viewer = viewer;
}
+ @Override
public void dispose() {
- for(int i = 0; i < textMaps.length; i++) {
+ for (int i = 0; i < textMaps.length; i++) {
textMaps[i].removeMapChangeListener(mapChangeListener);
}
super.dispose();
}
+ @Override
public Image getImage(Object element) {
return getColumnImage(element, 0);
}
public Image getColumnImage(Object element, int columnIndex) {
- if(columnIndex < textMaps.length) {
+ if (columnIndex < textMaps.length) {
Object result = textMaps[columnIndex].get(element);
return JFacesHelper.getColumnImage(viewer, result, columnIndex);
}
return null;
}
+ @Override
public String getText(Object element) {
return getColumnText(element, 0);
}
public String getColumnText(Object element, int columnIndex) {
- if(columnIndex < textMaps.length) {
+ if (columnIndex < textMaps.length) {
Object result = textMaps[columnIndex].get(element);
return JFacesHelper.getColumnText(viewer, result, columnIndex);
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableTreeContentProvider.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableTreeContentProvider.java
index 0581fcac890..bb068bb9ea5 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableTreeContentProvider.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ObservableTreeContentProvider.java
@@ -41,14 +41,14 @@ public class ObservableTreeContentProvider implements ITreeContentProvider {
}
public void dispose() {
- if(delegate == null) {
+ if (delegate == null) {
return;
}
delegate.dispose();
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if(newInput == null) {
+ if (newInput == null) {
return;
}
updateContext(viewer, newInput);
@@ -57,7 +57,7 @@ public class ObservableTreeContentProvider implements ITreeContentProvider {
public Object[] getChildren(Object parentElement) {
- if(delegate == null) {
+ if (delegate == null) {
return Core.EMPTY_ARRAY;
}
return delegate.getChildren(parentElement);
@@ -68,36 +68,36 @@ public class ObservableTreeContentProvider implements ITreeContentProvider {
}
public boolean hasChildren(Object element) {
- if(delegate == null) {
+ if (delegate == null) {
return false;
}
return delegate.hasChildren(element);
}
public Object getParent(Object element) {
- if(delegate == null) {
+ if (delegate == null) {
return null;
}
return delegate.getParent(element);
}
public IObservableSet getKnownElements() {
- if(delegate == null) {
+ if (delegate == null) {
return null;
}
- if(delegate instanceof ObservableSetTreeContentProvider) {
- ObservableSetTreeContentProvider contentProvider = (ObservableSetTreeContentProvider)delegate;
+ if (delegate instanceof ObservableSetTreeContentProvider) {
+ ObservableSetTreeContentProvider contentProvider = (ObservableSetTreeContentProvider) delegate;
return contentProvider.getKnownElements();
}
- if(delegate instanceof ObservableListTreeContentProvider) {
- ObservableListTreeContentProvider contentProvider = (ObservableListTreeContentProvider)delegate;
+ if (delegate instanceof ObservableListTreeContentProvider) {
+ ObservableListTreeContentProvider contentProvider = (ObservableListTreeContentProvider) delegate;
return contentProvider.getKnownElements();
}
throw new IllegalStateException();
}
public void updateContext(Object context, Object value) {
- if(context == this.context && this.value == value) {
+ if (context == this.context && this.value == value) {
return;
}
this.context = context;
@@ -105,9 +105,9 @@ public class ObservableTreeContentProvider implements ITreeContentProvider {
IObservableFactory observableFactory = XWT.observableFactory(context, getContentPath(), UpdateSourceTrigger.Default);
IObservable observable = observableFactory.createObservable(value);
- if(observable instanceof IObservableList) {
+ if (observable instanceof IObservableList) {
delegate = new ObservableListTreeContentProvider(observableFactory, null);
- } else if(observable instanceof IObservableSet) {
+ } else if (observable instanceof IObservableSet) {
delegate = new ObservableSetTreeContentProvider(observableFactory, null);
} else {
throw new UnsupportedOperationException(observable.getClass().getName());
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/TextCellEditor.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/TextCellEditor.java
index a763d2f5952..02fba068589 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/TextCellEditor.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/TextCellEditor.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -31,13 +31,13 @@ public class TextCellEditor extends org.eclipse.jface.viewers.TextCellEditor imp
@Override
protected void doSetValue(Object value) {
- if(value == null) {
+ if (value == null) {
super.doSetValue("");
} else {
Class<?> targetType = getTargetType();
- if(targetType != String.class) {
+ if (targetType != String.class) {
IConverter converter = XWT.findConvertor(targetType, String.class);
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
}
}
@@ -49,9 +49,9 @@ public class TextCellEditor extends org.eclipse.jface.viewers.TextCellEditor imp
protected Object doGetValue() {
Object value = super.doGetValue();
Class<?> targetType = getTargetType();
- if(targetType != value.getClass()) {
+ if (targetType != value.getClass()) {
IConverter converter = XWT.findConvertor(value.getClass(), targetType);
- if(converter != null) {
+ if (converter != null) {
value = converter.convert(value);
}
}
@@ -59,16 +59,16 @@ public class TextCellEditor extends org.eclipse.jface.viewers.TextCellEditor imp
}
protected Class<?> getTargetType() {
- if(cellEditorHelper != null) {
+ if (cellEditorHelper != null) {
return cellEditorHelper.getTargetType();
}
return Object.class;
}
public void setIndex(Object parent, int index) {
- if(!(parent instanceof TableViewer)) {
+ if (!(parent instanceof TableViewer)) {
throw new XWTException("TableView is expected, not \"" + parent.getClass().getName() + "\"");
}
- cellEditorHelper = new CellEditorHelper((TableViewer)parent, index);
+ cellEditorHelper = new CellEditorHelper((TableViewer) parent, index);
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ViewerFilter.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ViewerFilter.java
index 1467a0a7df8..305180e54bd 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ViewerFilter.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/ViewerFilter.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -28,11 +28,11 @@ public class ViewerFilter extends org.eclipse.jface.viewers.ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
// No condition is same as no filter
- if(conditions.length == 0) {
+ if (conditions.length == 0) {
return false;
}
- for(Condition condition : conditions) {
- if(!condition.evaluate(element)) {
+ for (Condition condition : conditions) {
+ if (!condition.evaluate(element)) {
return false;
}
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTDialog.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTDialog.java
index 241b5b78daf..3a14dfcfe4a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTDialog.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTDialog.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -17,7 +17,7 @@ import org.eclipse.swt.widgets.Shell;
/**
* Default XWT Dialog with a content via static URL
- *
+ *
* @author yyang <yves.yang@soyatec.com>
*/
public class XWTDialog extends AbstractDialog {
@@ -31,7 +31,7 @@ public class XWTDialog extends AbstractDialog {
@Override
protected URL getContentURL() {
- if(contentForm != null) {
+ if (contentForm != null) {
return contentForm.getResource(contentForm.getSimpleName() + IConstants.XWT_EXTENSION_SUFFIX);
}
return null;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTObservableWrapper.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTObservableWrapper.java
index 596495dd806..b91b65ea1b7 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTObservableWrapper.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTObservableWrapper.java
@@ -57,8 +57,8 @@ public class XWTObservableWrapper implements IObservableMap {
}
public void addMapChangeListener(IMapChangeListener listener) {
- if(delegate == null) {
- if(changeListeners.isEmpty()) {
+ if (delegate == null) {
+ if (changeListeners.isEmpty()) {
changeListeners = new ArrayList<IMapChangeListener>();
}
changeListeners.add(listener);
@@ -87,13 +87,14 @@ public class XWTObservableWrapper implements IObservableMap {
return delegate.entrySet();
}
+ @Override
public boolean equals(Object o) {
checkDelegated();
return delegate.equals(o);
}
public Object get(Object key) {
- if(data == null) {
+ if (data == null) {
data = key;
}
checkDelegated();
@@ -110,6 +111,7 @@ public class XWTObservableWrapper implements IObservableMap {
return delegate.getValueType();
}
+ @Override
public int hashCode() {
checkDelegated();
return delegate.hashCode();
@@ -141,7 +143,7 @@ public class XWTObservableWrapper implements IObservableMap {
}
public void removeMapChangeListener(IMapChangeListener listener) {
- if(delegate == null) {
+ if (delegate == null) {
changeListeners.remove(listener);
} else {
delegate.removeMapChangeListener(listener);
@@ -174,7 +176,7 @@ public class XWTObservableWrapper implements IObservableMap {
}
public void dispose() {
- if(delegate != null) {
+ if (delegate != null) {
delegate.dispose();
}
}
@@ -210,10 +212,10 @@ public class XWTObservableWrapper implements IObservableMap {
}
protected void checkDelegated() {
- if(delegate == null) {
+ if (delegate == null) {
IValueProperty property = ScopeManager.createValueProperty(control, data, new BindingExpressionPath(path));
delegate = property.observeDetail(domain);
- for(IMapChangeListener listener : changeListeners) {
+ for (IMapChangeListener listener : changeListeners) {
delegate.addMapChangeListener(listener);
}
changeListeners.clear();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTTitleAreaDialog.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTTitleAreaDialog.java
index 2aa5c9222e6..622122e4360 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTTitleAreaDialog.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/jface/XWTTitleAreaDialog.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.papyrus.xwt.IConstants;
+import org.eclipse.papyrus.xwt.IXWTLoader;
import org.eclipse.papyrus.xwt.XWT;
import org.eclipse.papyrus.xwt.XWTLoader;
import org.eclipse.papyrus.xwt.databinding.BindingContext;
@@ -28,7 +29,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
/**
- *
+ *
* @author yyang <yves.yang@soyatec.com>
*/
public class XWTTitleAreaDialog extends TitleAreaDialog {
@@ -62,14 +63,14 @@ public class XWTTitleAreaDialog extends TitleAreaDialog {
protected Control createDialogArea(Composite parent) {
Control control = super.createDialogArea(parent);
- if(bindingContext == null) {
+ if (bindingContext == null) {
bindingContext = new BindingContext(parent);
}
validationStatus = bindingContext.getStatus();
validationStatus.addChangeListener(new IChangeListener() {
public void handleChange(ChangeEvent event) {
- IStatus status = (IStatus)validationStatus.getValue();
+ IStatus status = (IStatus) validationStatus.getValue();
setMessage(status.getMessage(), status.getSeverity());
}
});
@@ -78,16 +79,16 @@ public class XWTTitleAreaDialog extends TitleAreaDialog {
try {
Thread.currentThread().setContextClassLoader(contentCLS.getClassLoader());
HashMap<String, Object> newOptions = new HashMap<String, Object>();
- newOptions.put(XWTLoader.CONTAINER_PROPERTY, parent);
+ newOptions.put(IXWTLoader.CONTAINER_PROPERTY, parent);
Object dataContext = getDataContext();
- if(dataContext != null) {
- newOptions.put(XWTLoader.DATACONTEXT_PROPERTY, dataContext);
+ if (dataContext != null) {
+ newOptions.put(IXWTLoader.DATACONTEXT_PROPERTY, dataContext);
}
BindingContext bindingContext = getBindingContext();
- if(bindingContext != null) {
- newOptions.put(XWTLoader.BINDING_CONTEXT_PROPERTY, bindingContext);
+ if (bindingContext != null) {
+ newOptions.put(IXWTLoader.BINDING_CONTEXT_PROPERTY, bindingContext);
}
- newOptions.put(XWTLoader.CLASS_PROPERTY, contentCLS);
+ newOptions.put(IXWTLoader.CLASS_PROPERTY, contentCLS);
XWT.loadWithOptions(getContentURL(), newOptions);
GridLayoutFactory.fillDefaults().generateLayout(parent);
@@ -102,7 +103,7 @@ public class XWTTitleAreaDialog extends TitleAreaDialog {
}
public URL getContentURL() {
- if(contentCLS != null) {
+ if (contentCLS != null) {
return contentCLS.getResource(contentCLS.getSimpleName() + IConstants.XWT_EXTENSION_SUFFIX);
}
return null;
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DefaultLoadingType.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DefaultLoadingType.java
index b55fe1cc011..88e4b9da1b8 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DefaultLoadingType.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DefaultLoadingType.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DelegateProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DelegateProperty.java
index f2c0c33badf..75106015ec1 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DelegateProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/DelegateProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -13,9 +13,9 @@ package org.eclipse.papyrus.xwt.metadata;
import java.lang.reflect.InvocationTargetException;
/**
- *
+ *
* Facility class to override the default behavior
- *
+ *
* @author yyang
*/
public class DelegateProperty implements IProperty {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IBehavior.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IBehavior.java
index 48b207b02d4..f07c180262a 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IBehavior.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IBehavior.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,14 +12,14 @@ package org.eclipse.papyrus.xwt.metadata;
/**
* Common behavior of Property and event
- *
+ *
* @author yyang
*/
public interface IBehavior {
/**
* Getter of the property <tt>name</tt>
- *
+ *
* @return Returns the name.
*/
public String getName();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IEvent.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IEvent.java
index 22b3cefd616..bf77b6f00ab 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IEvent.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IEvent.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,7 +12,7 @@ package org.eclipse.papyrus.xwt.metadata;
/**
* UI event
- *
+ *
* @author yyang
*/
public interface IEvent extends IBehavior {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ILoadingType.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ILoadingType.java
index feed04b275e..1e3592e1ef0 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ILoadingType.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ILoadingType.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -13,7 +13,7 @@ package org.eclipse.papyrus.xwt.metadata;
/**
* This class is used to indicate when the property can be
* initialized during the XML Loading.
- *
+ *
* @author yyang <yves.yang@soyatec.com>
*/
public interface ILoadingType {
@@ -31,14 +31,14 @@ public interface ILoadingType {
/**
* When the property can be loaded.
- *
+ *
* @return
*/
IValueLoading getValueLoading();
/**
* The dependency properties must be loaded before.
- *
+ *
* @return
*/
IProperty[] getDependencies();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IMetaclass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IMetaclass.java
index 8ec251c4353..e90e48f27c3 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IMetaclass.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IMetaclass.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import org.eclipse.papyrus.xwt.IEventGroup;
/**
* UI metaclass
- *
+ *
* @author yyang
*/
public interface IMetaclass {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IObjectInitializer.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IObjectInitializer.java
index afbda63525c..ed7b9f02175 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IObjectInitializer.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IObjectInitializer.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -12,9 +12,9 @@ package org.eclipse.papyrus.xwt.metadata;
/**
* Provide a mechanism to initialize the instance
- *
+ *
* @author yyang
- *
+ *
*/
public interface IObjectInitializer {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IProperty.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IProperty.java
index 07a3ec05df6..54a934d5f35 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IProperty.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IProperty.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,12 +14,12 @@ import java.lang.reflect.InvocationTargetException;
/**
* UI property
- *
+ *
* @author yyang
*/
public interface IProperty extends IBehavior {
- IProperty[] EMPTY_ARRAY = new IProperty[]{};
+ IProperty[] EMPTY_ARRAY = new IProperty[] {};
public Class<?> getType();
@@ -27,7 +27,7 @@ public interface IProperty extends IBehavior {
/**
* Can generate event
- *
+ *
* @return
*/
public void setValue(Object target, Object value) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchFieldException;
@@ -46,7 +46,7 @@ public interface IProperty extends IBehavior {
/**
* use the value ad parent for the children. Table.table, Form.setHeadClient etc
- *
+ *
* @return
*/
public boolean isValueAsParent();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ISetPostAction.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ISetPostAction.java
index 2d26eaead00..436116dd566 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ISetPostAction.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ISetPostAction.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IValueLoading.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IValueLoading.java
index 26b097eb060..68171469907 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IValueLoading.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/IValueLoading.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -13,7 +13,7 @@ package org.eclipse.papyrus.xwt.metadata;
/**
* This class is used to indicate when the property can be
* initialized during the XML Loading.
- *
+ *
* @author yyang <yves.yang@soyatec.com>
*/
public enum IValueLoading {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ModelUtils.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ModelUtils.java
index 0ebc27cf061..9c3ef0be49d 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ModelUtils.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/metadata/ModelUtils.java
@@ -4,16 +4,16 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
package org.eclipse.papyrus.xwt.metadata;
/**
- *
+ *
* @author yyang
- *
+ *
*/
public class ModelUtils {
@@ -22,11 +22,11 @@ public class ModelUtils {
}
public static String normalizePropertyName(String name) {
- if(name == null || name.length() == 0) {
+ if (name == null || name.length() == 0) {
return name;
}
char c = name.charAt(0);
- if(Character.isLowerCase(c)) {
+ if (Character.isLowerCase(c)) {
return name;
}
return Character.toLowerCase(name.charAt(0)) + name.substring(1);
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/NamedColorsUtil.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/NamedColorsUtil.java
index 82e625936c5..4ca4b588478 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/NamedColorsUtil.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/NamedColorsUtil.java
@@ -3,9 +3,9 @@
* 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: *
- * Soyatec - initial API and implementation *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * Contributors: *
+ * Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.utils;
@@ -29,11 +29,11 @@ public class NamedColorsUtil {
static {
List<String> colors = new ArrayList<String>();
Enumeration<String> keys = COLORS.getKeys();
- while(keys.hasMoreElements()) {
+ while (keys.hasMoreElements()) {
String color = keys.nextElement();
colors.add(color);
}
- if(!colors.isEmpty()) {
+ if (!colors.isEmpty()) {
colorNames = colors.toArray(new String[0]);
Arrays.sort(colorNames);
}
@@ -44,34 +44,34 @@ public class NamedColorsUtil {
}
public static String getColorValue(String name) {
- if(!hasColor(name)) {
+ if (!hasColor(name)) {
return null;
}
String value = COLORS.getString(name);
- if(value != null) {
+ if (value != null) {
value = value.trim();
}
return value;
}
public static boolean hasColor(String name) {
- if(name == null) {
+ if (name == null) {
return false;
}
String[] colorNames = getColorNames();
- if(colorNames == null) {
+ if (colorNames == null) {
return false;
}
return Arrays.asList(colorNames).contains(name);
}
public static Color getColor(String name) {
- if(!hasColor(name)) {
+ if (!hasColor(name)) {
return null;
}
String colorValue = getColorValue(name);
- if(colorValue != null) {
- return (Color)ObjectUtil.resolveValue(colorValue, Color.class, null);
+ if (colorValue != null) {
+ return (Color) ObjectUtil.resolveValue(colorValue, Color.class, null);
}
return null;
}
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/OperatorExceptionMessage.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/OperatorExceptionMessage.java
index 5efd85d6b7e..76504962686 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/OperatorExceptionMessage.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/OperatorExceptionMessage.java
@@ -3,7 +3,7 @@
* 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 *
+ * http://www.eclipse.org/legal/epl-v10.html *
* Contributors:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -11,7 +11,7 @@ package org.eclipse.papyrus.xwt.utils;
/**
* @author YaHong.Song(yahong.song@soyatec.com)
- *
+ *
*/
public final class OperatorExceptionMessage {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/PathHelper.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/PathHelper.java
index 4ed66773cd3..27934895c89 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/PathHelper.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/PathHelper.java
@@ -3,9 +3,9 @@
* 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: *
- * Soyatec - initial API and implementation *
+ * http://www.eclipse.org/legal/epl-v10.html *
+ * Contributors: *
+ * Soyatec - initial API and implementation *
*******************************************************************************/
package org.eclipse.papyrus.xwt.utils;
@@ -28,24 +28,24 @@ public class PathHelper {
public static final String WHITE_SPACE_ASCII = "%20";
public static String getRelativePath(String source, String target) {
- if(source == null || target == null) {
+ if (source == null || target == null) {
return target;
}
File sourceFile = new File(source);
- if(!sourceFile.exists()) {
+ if (!sourceFile.exists()) {
return target;
}
File targetFile = new File(target);
- if(!targetFile.exists()) {
+ if (!targetFile.exists()) {
return target;
}
source = switchToForwardSlashes(source);
target = switchToForwardSlashes(target);
int index = target.indexOf(FORWARD_SLASH);
String container = null;
- while(index != -1) {
+ while (index != -1) {
container = target.substring(0, index);
- if(!source.startsWith(container + FORWARD_SLASH)) {
+ if (!source.startsWith(container + FORWARD_SLASH)) {
break;
}
source = source.substring(index + 1);
@@ -53,7 +53,7 @@ public class PathHelper {
index = target.indexOf(FORWARD_SLASH);
}
index = source.indexOf(FORWARD_SLASH);
- while(index != -1) {
+ while (index != -1) {
target = RELATIVE_PATH_SIG + target;
source = source.substring(index + 1);
index = source.indexOf(FORWARD_SLASH);
@@ -71,51 +71,51 @@ public class PathHelper {
}
public static String getAbsolutePath(String source, String relative) {
- if(source.indexOf(WHITE_SPACE_ASCII) != -1) {
+ if (source.indexOf(WHITE_SPACE_ASCII) != -1) {
source = source.replace(WHITE_SPACE_ASCII, " ");
}
- if(relative.indexOf(WHITE_SPACE_ASCII) != -1) {
+ if (relative.indexOf(WHITE_SPACE_ASCII) != -1) {
relative = relative.replace(WHITE_SPACE_ASCII, " ");
}
- if(source.startsWith(FORWARD_SLASH)) {
+ if (source.startsWith(FORWARD_SLASH)) {
source = source.substring(1);
}
String prefix = null;
- if(source.startsWith(URL_IDENTIFY_PREFIX)) {
+ if (source.startsWith(URL_IDENTIFY_PREFIX)) {
prefix = URL_IDENTIFY_PREFIX;
source = source.substring(URL_IDENTIFY_PREFIX.length());
- if(System.getProperty("os.arch").startsWith("Win")) {
+ if (System.getProperty("os.arch").startsWith("Win")) {
source = source.substring(1);
}
}
File file = new File(source);
- if(!file.exists()) {
+ if (!file.exists()) {
return relative;
}
- if(file.isFile()) {
+ if (file.isFile()) {
source = file.getParent();
}
source = switchToForwardSlashes(source);
relative = switchToForwardSlashes(relative);
- if(relative.startsWith(FORWARD_SLASH)) {
+ if (relative.startsWith(FORWARD_SLASH)) {
relative = relative.substring(1);
}
int index = relative.lastIndexOf(FORWARD_SLASH);
- if(index != -1) {
+ if (index != -1) {
String container = relative.substring(0, index);
int i = source.indexOf(container);
- if(i != -1) {
+ if (i != -1) {
source = source.substring(0, i);
} else {
int j = relative.indexOf(RELATIVE_PATH_SIG);
- while(j != -1) {
+ while (j != -1) {
relative = relative.substring(j + RELATIVE_PATH_SIG.length());
source = source.substring(0, source.lastIndexOf(FORWARD_SLASH));
j = relative.indexOf(RELATIVE_PATH_SIG);
}
}
}
- if(System.getProperty("os.arch").startsWith("Win")) {
+ if (System.getProperty("os.arch").startsWith("Win")) {
source = "/" + source;
}
@@ -130,21 +130,23 @@ public class PathHelper {
StringTokenizer baseTokenizer = new StringTokenizer(base, FORWARD_SLASH);
String token1 = "", token2 = "";
//
- while(true) {
- if(!inputTokenizer.hasMoreTokens() || !baseTokenizer.hasMoreTokens())
+ while (true) {
+ if (!inputTokenizer.hasMoreTokens() || !baseTokenizer.hasMoreTokens()) {
break;
+ }
token1 = baseTokenizer.nextToken();
token2 = inputTokenizer.nextToken();
- if(!token1.equals(token2))
+ if (!token1.equals(token2)) {
break;
+ }
}
StringBuilder builder = new StringBuilder();
- while(baseTokenizer.hasMoreTokens()) {
+ while (baseTokenizer.hasMoreTokens()) {
baseTokenizer.nextToken();
builder.append(RELATIVE_PATH_SIG);
}
builder.append(token2);
- while(inputTokenizer.hasMoreTokens()) {
+ while (inputTokenizer.hasMoreTokens()) {
builder.append(FORWARD_SLASH + inputTokenizer.nextToken());
}
return builder.toString();
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/ResourceManager.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/ResourceManager.java
index c447e2584cd..436ae619995 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/ResourceManager.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/utils/ResourceManager.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -49,7 +49,7 @@ public class ResourceManager {
public Color getColor(String colorStr) {
Color color = key2Colors.get(colorStr);
- if(color == null || color.isDisposed()) {
+ if (color == null || color.isDisposed()) {
key2Colors.put(colorStr, color = ColorTool.getColor(colorStr));
}
return color;
@@ -57,14 +57,14 @@ public class ResourceManager {
public Font getFont(String fontStr) {
Font font = key2Fonts.get(fontStr);
- if(font == null || font.isDisposed()) {
+ if (font == null || font.isDisposed()) {
key2Fonts.put(fontStr, font = FontTool.getFont(fontStr));
}
return font;
}
public Image getImage(String imagePath) {
- if(imagePath == null) {
+ if (imagePath == null) {
return null;
}
try {
@@ -77,7 +77,7 @@ public class ResourceManager {
public Image getImage(URL file) {
String key = file.toString();
Image image = key2Images.get(key);
- if(image == null || image.isDisposed()) {
+ if (image == null || image.isDisposed()) {
key2Images.put(key, image = ImageTool.getImage(file));
}
return image;
@@ -86,8 +86,8 @@ public class ResourceManager {
public synchronized void dispose() {
// dispose colors.
Collection<Color> colors = key2Colors.values();
- for(Color color : colors) {
- if(color != null) {
+ for (Color color : colors) {
+ if (color != null) {
color.dispose();
}
}
@@ -95,8 +95,8 @@ public class ResourceManager {
// dispose fonts.
Collection<Font> fonts = key2Fonts.values();
- for(Font font : fonts) {
- if(font != null) {
+ for (Font font : fonts) {
+ if (font != null) {
font.dispose();
}
}
@@ -104,8 +104,8 @@ public class ResourceManager {
// dispose images
Collection<Image> images = key2Images.values();
- for(Image image : images) {
- if(image != null) {
+ for (Image image : images) {
+ if (image != null) {
image.dispose();
}
}
@@ -114,25 +114,25 @@ public class ResourceManager {
static class ColorTool {
static Color getColor(String colorStr) {
- if(NamedColorsUtil.hasColor(colorStr)) {
+ if (NamedColorsUtil.hasColor(colorStr)) {
return NamedColorsUtil.getColor(colorStr);
}
- if(colorStr.toLowerCase().startsWith("swt.")) {
+ if (colorStr.toLowerCase().startsWith("swt.")) {
return getSWTColor(colorStr);
- } else if(colorStr.startsWith("#")) {
+ } else if (colorStr.startsWith("#")) {
try {
int rgb = Integer.parseInt(colorStr.substring(1), 16);
return getColor(rgb);
} catch (NumberFormatException e) {
return null;
}
- } else if(colorStr.indexOf(",") != -1) {
+ } else if (colorStr.indexOf(",") != -1) {
List<String> rgbs = new ArrayList<String>();
StringTokenizer stk = new StringTokenizer(colorStr, ",");
- while(stk.hasMoreTokens()) {
+ while (stk.hasMoreTokens()) {
rgbs.add(stk.nextToken());
}
- if(rgbs.size() == 3) {
+ if (rgbs.size() == 3) {
try {
int r = Integer.parseInt(rgbs.get(0).trim());
int g = Integer.parseInt(rgbs.get(1).trim());
@@ -147,7 +147,7 @@ public class ResourceManager {
}
static Color getColor(int red, int green, int blue) {
- if(red > 255 || green > 255 || blue > 255 || red < 0 || green < 0 || blue < 0) {
+ if (red > 255 || green > 255 || blue > 255 || red < 0 || green < 0 || blue < 0) {
return null;
}
return new Color(Display.getCurrent(), red, green, blue);
@@ -162,8 +162,8 @@ public class ResourceManager {
}
static Color getSWTColor(String colorStr) {
- if(!(colorStr.toLowerCase().startsWith("swt."))) {
- if(!(colorStr.toLowerCase().startsWith("color_"))) {
+ if (!(colorStr.toLowerCase().startsWith("swt."))) {
+ if (!(colorStr.toLowerCase().startsWith("color_"))) {
colorStr = "COLOR_" + colorStr;
}
colorStr = "SWT." + colorStr;
@@ -180,16 +180,16 @@ public class ResourceManager {
static class FontTool {
static Font getFont(String fontStr) {
- if(fontStr.indexOf(",") != -1) {
+ if (fontStr.indexOf(",") != -1) {
StringTokenizer stk = new StringTokenizer(fontStr, ",");
String name = null;
int height = 0;
int style = SWT.NORMAL;
- while(stk.hasMoreTokens()) {
+ while (stk.hasMoreTokens()) {
String token = stk.nextToken().trim();
- if(token.equalsIgnoreCase("normal") || token.equalsIgnoreCase("bold") || token.equalsIgnoreCase("italic") || token.contains("|")) {
- style = (Integer)ObjectUtil.resolveValue(token, Integer.class, style);
- } else if(isInt(token)) {
+ if (token.equalsIgnoreCase("normal") || token.equalsIgnoreCase("bold") || token.equalsIgnoreCase("italic") || token.contains("|")) {
+ style = (Integer) ObjectUtil.resolveValue(token, Integer.class, style);
+ } else if (isInt(token)) {
height = Integer.parseInt(token);
} else {
name = token;
@@ -210,7 +210,7 @@ public class ResourceManager {
}
static Font getFont(String name, int height, int style) {
- if(name == null) {
+ if (name == null) {
return null;
}
return new Font(Display.getCurrent(), name, height, style);
@@ -228,7 +228,7 @@ public class ResourceManager {
}
static Image getImage(URL url) {
- if(url == null) {
+ if (url == null) {
return null;
}
try {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/AbstractValidationRule.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/AbstractValidationRule.java
index 4a31d740b90..fb97c325b4c 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/AbstractValidationRule.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/AbstractValidationRule.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -14,7 +14,7 @@ import org.eclipse.papyrus.xwt.IValidationRule;
/**
* Abstract implementation of {@link IValidationRule}
- *
+ *
* @author hceylan
*/
public abstract class AbstractValidationRule implements IValidationRule {
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/InverseValidationRule.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/InverseValidationRule.java
index e2d94de26e3..fc34bb0d773 100644
--- a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/InverseValidationRule.java
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/validation/InverseValidationRule.java
@@ -4,7 +4,7 @@
* 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:
* Soyatec - initial API and implementation
*******************************************************************************/
@@ -29,7 +29,7 @@ public class InverseValidationRule implements IValidationRule {
* @see org.eclipse.papyrus.xwt.IValueValidator#getBindingMode()
*/
public Direction getBindingMode() {
- switch(delegate.getBindingMode()) {
+ switch (delegate.getBindingMode()) {
case SourceToTarget:
return Direction.TargetToSource;
case TargetToSource:

Back to the top