From 3769c3a58ef26efce7ba45a51b847e11dff61dc7 Mon Sep 17 00:00:00 2001 From: Florian Hoelzl <hoelzl@fortiss.org> Date: Wed, 21 Dec 2011 15:02:41 +0000 Subject: [PATCH] Kernel cleanup => YELLOW refs 311 --- .../trunk/META-INF/MANIFEST.MF | 2 +- .../trunk/plugin.xml | 2 +- .../kernel/ui/databinding/package.html | 8 ---- .../tooling/kernel/ui/dnd/package.html | 4 +- .../ui/extension/IModelElementHandler.java | 7 ++- .../kernel/ui/extension/data/package.html | 9 +++- .../kernel/ui/internal/ActionService.java | 2 +- .../kernel/ui/internal/MarkerService.java | 5 +- .../databinding/EObjectObservableValue.java | 2 +- .../properties/IdLabeledPropertySection.java | 4 +- .../NamedCommentedPropertySection.java | 6 +-- .../ui/internal/views/NavigatorViewPart.java | 8 ++-- ...ableMultiPageEditorPageChangeListener.java | 5 +- .../tooling/kernel/ui/listener/package.html | 4 +- .../ModelElementLabelProvider.java | 3 +- .../kernel/ui/util/CopyPasteUtils.java | 20 +++++++- .../kernel/ui/util/DataBindingUtils.java | 46 +++++++++++++++++-- .../kernel/ui/util/DragAndDropUtils.java | 12 +++-- .../kernel/ui/util/EObjectSelectionUtils.java | 12 ++++- .../ObservableUtils.java} | 30 +++++++++--- .../kernel/ui/util/SelectionUtils.java | 17 ++++++- 21 files changed, 152 insertions(+), 56 deletions(-) delete mode 100644 org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/package.html rename org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/{ => internal}/databinding/EObjectObservableValue.java (98%) rename org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/{util => presentation}/ModelElementLabelProvider.java (98%) rename org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/{databinding/ObservableUtil.java => util/ObservableUtils.java} (70%) diff --git a/org.fortiss.tooling.kernel.ui/trunk/META-INF/MANIFEST.MF b/org.fortiss.tooling.kernel.ui/trunk/META-INF/MANIFEST.MF index e0a119e40..1b8dc6f94 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.kernel.ui/trunk/META-INF/MANIFEST.MF @@ -12,11 +12,11 @@ Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: fortiss GmbH Export-Package: org.fortiss.tooling.kernel.ui, - org.fortiss.tooling.kernel.ui.databinding, org.fortiss.tooling.kernel.ui.dnd, org.fortiss.tooling.kernel.ui.extension, org.fortiss.tooling.kernel.ui.extension.base, org.fortiss.tooling.kernel.ui.extension.data, org.fortiss.tooling.kernel.ui.listener, + org.fortiss.tooling.kernel.ui.presentation, org.fortiss.tooling.kernel.ui.service, org.fortiss.tooling.kernel.ui.util diff --git a/org.fortiss.tooling.kernel.ui/trunk/plugin.xml b/org.fortiss.tooling.kernel.ui/trunk/plugin.xml index 5d2cb81d5..5e886d082 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/plugin.xml +++ b/org.fortiss.tooling.kernel.ui/trunk/plugin.xml @@ -46,7 +46,7 @@ point="org.eclipse.ui.views.properties.tabbed.propertyContributor"> <propertyContributor contributorId="org.fortiss.tooling.kernel.ui.properties.Contributor" - labelProvider="org.fortiss.tooling.kernel.ui.util.ModelElementLabelProvider" + labelProvider="org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider" typeMapper="org.conqat.ide.commons.gef.properties.EditPartTypeMapper"> <propertyCategory category="main"></propertyCategory> diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/package.html b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/package.html deleted file mode 100644 index e6cd7c225..000000000 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/package.html +++ /dev/null @@ -1,8 +0,0 @@ -<!-- - $Id$ - @version $Rev$ - @ConQAT.Rating GREEN Hash: 996283773B2EC0D22D4A844A3C9E30A8 ---> -<body> -Support classes for using the data binding mechanism with EMF EObjects. -</body> diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/dnd/package.html b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/dnd/package.html index 7b97c1774..56ff3be05 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/dnd/package.html +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/dnd/package.html @@ -1,10 +1,12 @@ <!-- $Id: package.html 835 2011-06-28 07:31:00Z ratiu $ @version $Rev: 835 $ - @ConQAT.Rating YELLOW Hash: CC56D6574A670E6853219571BF8D1708 + @ConQAT.Rating YELLOW Hash: 3EA4EA7091245D0A40304F5CD8136DA9 --> <body> Support classes for using the SWT-based drag and drop mechanism. We distinguish between DND operation, which should result in calling the element composition, and those, which result in calling the connection composition. +<P> +This package also contains the DND.Transfer objects for DND and for Copy/Paste. </body> diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/IModelElementHandler.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/IModelElementHandler.java index 5f48c2237..0fb3e54c6 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/IModelElementHandler.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/IModelElementHandler.java @@ -38,7 +38,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: EF2C8B5B955C72DE74CB4FCD7A9D67EE + * @ConQAT.Rating YELLOW Hash: 147CEFD0C47F4808CBE08A3A0EA0B0D7 */ public interface IModelElementHandler<T extends EObject> extends IEObjectAware<T> { @@ -88,9 +88,8 @@ public interface IModelElementHandler<T extends EObject> extends List<EObject> getSpecifications(T element); /** - * Returns true if the underlying element should be visible in the navigator - * in the non-expert view. + * Returns true if the underlying element should be hidden in the + * navigator's simplified non-expert view. */ - // TODO @review CD: Naming of method and meaning of comment inconsistent. boolean hiddenInNonExpertView(); } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/data/package.html b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/data/package.html index 15a7b6dbe..09da899cc 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/data/package.html +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/data/package.html @@ -1,8 +1,13 @@ <!-- $Id: package.html 914 2011-07-12 12:16:22Z ratiu $ @version $Rev: 914 $ - @ConQAT.Rating RED Hash: 0E247D0F04DEF8F70072DAEE84BB9B7E + @ConQAT.Rating YELLOW Hash: 4937634A5C7499B64F188C4A364D8A16 --> <body> -Classes for extension of.... +Interfaces and classes for data transfer between the kernel and extensions. +<P> +The classes and interfaces of this package appear as parameter and result types of the +interfaces in the <code>kernel.ui.extension</code> package. Parameter objects resemble +additional context data provided to the extension, while result objects are required from the +extension. </body> diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java index 467f48e5f..b506e5426 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java @@ -44,7 +44,7 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 9B6D34EACABCFC700C86C9D0ED33BDA3 + * @ConQAT.Rating YELLOW Hash: AEE7A59A21CE5A68CAC3BC04EF872569 */ public class ActionService implements IActionService, IPersistencyServiceListener, CommandStackListener { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java index c74cc4af6..11c6b9de8 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/MarkerService.java @@ -52,7 +52,7 @@ import org.fortiss.tooling.kernel.ui.service.IMarkerService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: BFAB62161436A6590B4BD6500FF83134 + * @ConQAT.Rating YELLOW Hash: 4A7ED2A26326797ACB14718C87A7C893 */ public class MarkerService implements IMarkerService, IPersistencyServiceListener, ILightweightLabelDecorator { @@ -198,7 +198,8 @@ public class MarkerService implements IMarkerService, if (element instanceof EObject) { EObject modelElement = (EObject) element; ESeverity highest = getHighestViolationSeverity(modelElement); - // FIXME (FH): use preferences here + // TODO (FH): https://af3.fortiss.org/issues/388 + // use preferences settings here switch (highest) { case FATAL: case ERROR: diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/EObjectObservableValue.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/databinding/EObjectObservableValue.java similarity index 98% rename from org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/EObjectObservableValue.java rename to org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/databinding/EObjectObservableValue.java index 4e9caba24..7832416cc 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/EObjectObservableValue.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/databinding/EObjectObservableValue.java @@ -15,7 +15,7 @@ $Id$ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.databinding; +package org.fortiss.tooling.kernel.ui.internal.databinding; import org.eclipse.core.databinding.observable.Diffs; import org.eclipse.core.databinding.observable.Realm; diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java index 135f34adf..4b90daf63 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/IdLabeledPropertySection.java @@ -25,8 +25,8 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; import org.fortiss.tooling.kernel.model.FortissToolingKernelPackage; import org.fortiss.tooling.kernel.model.IIdLabeled; -import org.fortiss.tooling.kernel.ui.databinding.ObservableUtil; import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; +import org.fortiss.tooling.kernel.ui.util.ObservableUtils; /** * Property section for {@link IIdLabeled} objects. @@ -65,7 +65,7 @@ public class IdLabeledPropertySection extends PropertySectionBase { public void refresh() { super.refresh(); - IObservableValue modelObservable = ObservableUtil + IObservableValue modelObservable = ObservableUtils .observeValue(idLabeled, FortissToolingKernelPackage.Literals.IID_LABELED__ID); dbc.bindValue(SWTObservables.observeText(idText, SWT.None), diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java index 6d8b385e6..de6113d76 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/properties/NamedCommentedPropertySection.java @@ -25,8 +25,8 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; import org.fortiss.tooling.kernel.model.FortissToolingKernelPackage; import org.fortiss.tooling.kernel.model.INamedCommentedElement; -import org.fortiss.tooling.kernel.ui.databinding.ObservableUtil; import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; +import org.fortiss.tooling.kernel.ui.util.ObservableUtils; /** * Property section for {@link INamedCommentedElement} objects. @@ -73,12 +73,12 @@ public class NamedCommentedPropertySection extends PropertySectionBase { public void refresh() { super.refresh(); - IObservableValue modelObservable = ObservableUtil.observeValue( + IObservableValue modelObservable = ObservableUtils.observeValue( namedCommented, FortissToolingKernelPackage.Literals.INAMED_ELEMENT__NAME); dbc.bindValue(SWTObservables.observeText(nameText, SWT.FocusOut), modelObservable, null, null); - modelObservable = ObservableUtil + modelObservable = ObservableUtils .observeValue( namedCommented, FortissToolingKernelPackage.Literals.INAMED_COMMENTED_ELEMENT__COMMENT); diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java index 00250ff51..9d8ca2f1e 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NavigatorViewPart.java @@ -58,12 +58,12 @@ import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider; import org.fortiss.tooling.kernel.ui.internal.NavigatorService; import org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor; import org.fortiss.tooling.kernel.ui.internal.editor.ModelElementEditorInput; +import org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider; import org.fortiss.tooling.kernel.ui.service.IActionService; import org.fortiss.tooling.kernel.ui.service.IContextMenuService; import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService; import org.fortiss.tooling.kernel.ui.service.INavigatorService; import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils; -import org.fortiss.tooling.kernel.ui.util.ModelElementLabelProvider; import org.fortiss.tooling.kernel.ui.util.PropertiesConstantUtils; /** @@ -72,7 +72,7 @@ import org.fortiss.tooling.kernel.ui.util.PropertiesConstantUtils; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: E2257EF3EF370182637ABCD63B471DE8 + * @ConQAT.Rating YELLOW Hash: CA4F79DCA69C654B5D001364DD567D43 */ public final class NavigatorViewPart extends ViewPart implements ISelectionListener, ISelectionChangedListener, IDoubleClickListener, @@ -246,13 +246,15 @@ public final class NavigatorViewPart extends ViewPart implements @Override public void selectionChanged(IWorkbenchPart part, ISelection selection) { IActionService.INSTANCE.refresh(); - // TODO @review CD: Why not also firePropertyChanged here? + // do not fire property change here, since it was not the viewers + // selection that changed but the workbench-wide selection } /** {@inheritDoc} */ @Override public void selectionChanged(SelectionChangedEvent event) { IActionService.INSTANCE.refresh(); + // fire upon viewer selection change firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY); } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/ExtendableMultiPageEditorPageChangeListener.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/ExtendableMultiPageEditorPageChangeListener.java index 96817975e..f9a55667e 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/ExtendableMultiPageEditorPageChangeListener.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/ExtendableMultiPageEditorPageChangeListener.java @@ -25,11 +25,8 @@ import org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor; * @author hoelzl * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating RED Hash: E5A33F5E2AB3135E4ECE4EC8A2240990 + * @ConQAT.Rating YELLOW Hash: B380F2935C54DDB25B96CB845DB96F12 */ -// Future Work (FH): this behavior is too simple, there should be a way for -// plugged code to register with binding editor and receive page changes and -// maybe selection updates, too. public interface ExtendableMultiPageEditorPageChangeListener { /** Indicates a page change. */ diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/package.html b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/package.html index 0e97baca1..679a24c9a 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/package.html +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/listener/package.html @@ -1,8 +1,8 @@ <!-- $Id: package.html 891 2011-07-06 11:00:49Z ratiu $ @version $Rev: 891 $ - @ConQAT.Rating RED Hash: 457E0F02B3896C35209F11262A7D48C2 + @ConQAT.Rating YELLOW Hash: 237049F7912920BD1168A29560DF9C65 --> <body> -Enter package description here... +Listeners for user interface parts. </body> diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ModelElementLabelProvider.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/presentation/ModelElementLabelProvider.java similarity index 98% rename from org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ModelElementLabelProvider.java rename to org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/presentation/ModelElementLabelProvider.java index 2347c98ac..484c8a975 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ModelElementLabelProvider.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/presentation/ModelElementLabelProvider.java @@ -15,7 +15,7 @@ $Id$ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.util; +package org.fortiss.tooling.kernel.ui.presentation; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.IStructuredSelection; @@ -60,7 +60,6 @@ public class ModelElementLabelProvider extends LabelProvider { if (handler != null) return handler.getIcon(); } - return super.getImage(element); } } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java index fca720bdb..aa1b7175c 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/CopyPasteUtils.java @@ -40,11 +40,17 @@ import org.fortiss.tooling.kernel.ui.dnd.CompositionServiceLocalCopyPasteTransfe * * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: BF469D497ADC610E7576492AA12B04CC + * @ConQAT.Rating YELLOW Hash: 41B752DA09FB0A8AF8173D9A6352AB18 */ public class CopyPasteUtils { - /** Copies the given selected objects to the clipboard. */ + /** + * Copies the given selected objects to the clipboard. + * + * @param selection + * the collection of {@link EObject}s to be copyied to the + * clipboard. + */ public static void copyToClipboard(Collection<EObject> selection) { try { EObject[] content = new EObject[selection.size()]; @@ -81,6 +87,11 @@ public class CopyPasteUtils { * Attempts to paste the contents of the clipboard into the given target * object. The given element composition context is forwarded to the element * composition service. + * + * @param target + * the target element to be passed to the compositor + * @param context + * the composition context to be passed to the compositor */ public static void pasteFromClipboard(EObject target, IElementCompositionContext context) { @@ -96,6 +107,11 @@ public class CopyPasteUtils { /** * Returns whether the current clipboard element is pasteable into the given * target using the given composition context. + * + * @param target + * the target element to be passed to the compositor + * @param context + * the composition context to be passed to the compositor */ public static boolean canPasteInto(EObject target, IElementCompositionContext context) { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java index 3207a902b..53ac0ac38 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java @@ -30,7 +30,6 @@ import org.eclipse.jface.databinding.swt.SWTObservables; import org.eclipse.jface.fieldassist.ControlDecoration; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Control; -import org.fortiss.tooling.kernel.ui.databinding.ObservableUtil; /** * Utility methods for data binding support. @@ -38,7 +37,7 @@ import org.fortiss.tooling.kernel.ui.databinding.ObservableUtil; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 74CF19DF807D655A29622CA9B7099A2D + * @ConQAT.Rating YELLOW Hash: 4888BB1252F01761BB835F65D76F948C */ public final class DataBindingUtils { @@ -49,23 +48,45 @@ public final class DataBindingUtils { /** * Bind the {@link Control} and the {@link EObject} together with the given * {@link EStructuralFeature}. + * + * @param dbc + * the data binding context to be used + * @param control + * the SWT control + * @param modelElement + * the model element to be observed + * @param feature + * the element's feature to be observed */ public static void bind(DataBindingContext dbc, Control control, EObject modelElement, EStructuralFeature feature) { performComplexTextBinding(dbc, control, - ObservableUtil.observeValue(modelElement, feature), null, null, - null, null); + ObservableUtils.observeValue(modelElement, feature), null, + null, null, null); } /** * Bind the {@link Control} and the {@link EObject} together with the given * {@link EStructuralFeature} by using the given {@link IConverter}s. + * + * @param dbc + * the data binding context to be used + * @param control + * the SWT control + * @param modelElement + * the model element to be observed + * @param feature + * the element's feature to be observed + * @param modelToTextConverter + * the converter from the element to the control's text + * @param textToModelConverter + * the converter from the control's text to the element */ public static void bind(DataBindingContext dbc, Control control, EObject modelElement, EStructuralFeature feature, IConverter modelToTextConverter, IConverter textToModelConverter) { performComplexTextBinding(dbc, control, - ObservableUtil.observeValue(modelElement, feature), + ObservableUtils.observeValue(modelElement, feature), modelToTextConverter, textToModelConverter, null, null); } @@ -77,6 +98,21 @@ public final class DataBindingUtils { * be always consistent. If the control has a {@link ControlDecoration} * stored under the {@link #DECORATION_KEY} key, this is used to visualize * the validation result. + * + * @param dbc + * the data binding context to be used + * @param control + * the SWT control + * @param modelValue + * the model element value to be observed + * @param modelToTextConverter + * the converter from the element to the control's text + * @param textToModelConverter + * the converter from the control's text to the element + * @param textValidator + * the validator for the control's text + * @param textPostConvertValidator + * the validator for the text after conversion */ public static Binding[] performComplexTextBinding(DataBindingContext dbc, Control control, IObservableValue modelValue, diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java index f6c35a80a..30d3efa2c 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/DragAndDropUtils.java @@ -30,11 +30,16 @@ import org.fortiss.tooling.kernel.ui.dnd.ElementCompositionSource; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 269169E95ACFD1C5644735DE93BE02BD + * @ConQAT.Rating YELLOW Hash: E4479FEB536C23BCF4BAEC1AD8B0A538 */ public final class DragAndDropUtils { - /** Extracts the EObject contained in the given drop object. */ + /** + * Extracts the EObject contained in the given drop object. + * + * @param data + * the transfered object of which to extract the element + */ public static EObject extractDroppedEObject(Object data) { // if the dropped object is a selection, extract content if (data instanceof IStructuredSelection @@ -66,6 +71,7 @@ public final class DragAndDropUtils { * service. */ public static Transfer[] getCompositionServiceTransfers() { - return new Transfer[] { CompositionServiceLocalDNDTransfer.getInstance() }; + return new Transfer[] { CompositionServiceLocalDNDTransfer + .getInstance() }; } } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java index 5e17506c9..c9580a9f6 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/EObjectSelectionUtils.java @@ -34,7 +34,7 @@ import org.eclipse.ui.PlatformUI; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: F4CBD4321A5EB5469553970565C7D854 + * @ConQAT.Rating YELLOW Hash: A70A308C41F17FA6456CF8446E222B46 */ public final class EObjectSelectionUtils { @@ -57,6 +57,9 @@ public final class EObjectSelectionUtils { * Returns the first selected EObject or <code>null</code> if no EObject is * selected. If the selection implements {@link IAdaptable}, it is asked to * adapt to {@link EObject}. + * + * @param selection + * the current selection to be search for an {@link EObject} */ public static EObject getFirstElement(ISelection selection) { if (selection instanceof IStructuredSelection && !selection.isEmpty()) { @@ -86,7 +89,12 @@ public final class EObjectSelectionUtils { .getSelectionService(); } - /** Extracts all {@link EObject}s from the given selection. */ + /** + * Extracts all {@link EObject}s from the given selection. + * + * @param selection + * the selection to be searched for {@link EObject}s + */ public static List<EObject> getEObjectElements(ISelection selection) { List<EObject> result = new ArrayList<EObject>(); if (selection instanceof StructuredSelection) { diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/ObservableUtil.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ObservableUtils.java similarity index 70% rename from org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/ObservableUtil.java rename to org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ObservableUtils.java index f0a53e031..0330d7fe6 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/databinding/ObservableUtil.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/ObservableUtils.java @@ -15,31 +15,49 @@ $Id$ | See the License for the specific language governing permissions and | | limitations under the License. | +--------------------------------------------------------------------------*/ -package org.fortiss.tooling.kernel.ui.databinding; +package org.fortiss.tooling.kernel.ui.util; import org.conqat.lib.commons.assertion.CCSMPre; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.core.databinding.observable.value.IObservableValue; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; +import org.fortiss.tooling.kernel.ui.internal.databinding.EObjectObservableValue; /** - * Observables for {@link EObject} models. + * Utility methods for creating observables for {@link EObject} models. * * @author hummel + * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: 63632A77289A55A011049CA80D7F4F52 + * @ConQAT.Rating YELLOW Hash: C84A431A36A13F0404B0144BFA31CEB4 */ -public class ObservableUtil { +public class ObservableUtils { - /** Returns an observable for the given object and structural feature. */ + /** + * Returns an observable for the given object and structural feature. + * + * @param eObject + * the element to be observed + * @param structuralFeature + * the elements feature to be observed + */ public static IObservableValue observeValue(EObject eObject, EStructuralFeature structuralFeature) { return observeValue(Realm.getDefault(), eObject, structuralFeature); } - /** Returns an observable for the given object and structural feature. */ + /** + * Returns an observable for the given object and structural feature. + * + * @param realm + * the data binding realm to be used + * @param eObject + * the element to be observed + * @param structuralFeature + * the elements feature to be observed + */ public static IObservableValue observeValue(Realm realm, EObject eObject, EStructuralFeature structuralFeature) { CCSMPre.isTrue(eObject != null, "Can not observe null value!"); diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/SelectionUtils.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/SelectionUtils.java index 52af33f78..01be9fec3 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/SelectionUtils.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/util/SelectionUtils.java @@ -33,7 +33,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; * @author ratiu * @author $Author: hoelzl $ * @version $Rev: 18709 $ - * @ConQAT.Rating YELLOW Hash: 041F7585838834DBA7639F59D3577EA8 + * @ConQAT.Rating YELLOW Hash: 11123ADFF9A5D30BC7D38A6510F4FEFB */ public class SelectionUtils { @@ -43,6 +43,11 @@ public class SelectionUtils { * selection returns the first element or <code>null</code> if the selection * is empty. This returns <code>null</code> if the provided selection is * null or the element is not of the required type. + * + * @param selectionProvider + * the selection provider + * @param type + * the type of elements to be returned */ public static <T> T checkAndPickFirst(ISelectionProvider selectionProvider, Class<T> type) { @@ -55,6 +60,11 @@ public class SelectionUtils { * if the selection is empty. This also returns <code>null</code> if the * provided selection is <code>null</code> or the element is not of the * required type. + * + * @param selection + * the current selection + * @param type + * the type of elements to be returned */ @SuppressWarnings("unchecked") public static <T> T checkAndPickFirst(ISelection selection, Class<T> type) { @@ -79,6 +89,11 @@ public class SelectionUtils { /** * Returns a list of all the selected elements that have the given type or * null if selection is null or is not an IStructuredSelection. + * + * @param selection + * the current selection + * @param type + * the type of elements to be returned */ @SuppressWarnings("unchecked") public static <T> List<T> selectAll(ISelection selection, Class<T> type) { -- GitLab