forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1966] Add Selection Description in the View DSL
Bug: eclipse-sirius#1966 Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
- Loading branch information
Showing
23 changed files
with
1,119 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 165 additions & 0 deletions
165
...in/java/org/eclipse/sirius/components/view/provider/SelectionDescriptionItemProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/** | ||
* Copyright (c) 2021, 2023 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*/ | ||
package org.eclipse.sirius.components.view.provider; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import org.eclipse.emf.common.notify.AdapterFactory; | ||
import org.eclipse.emf.common.notify.Notification; | ||
import org.eclipse.emf.common.util.ResourceLocator; | ||
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; | ||
import org.eclipse.emf.edit.provider.IChildCreationExtender; | ||
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; | ||
import org.eclipse.emf.edit.provider.IItemLabelProvider; | ||
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; | ||
import org.eclipse.emf.edit.provider.IItemPropertySource; | ||
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; | ||
import org.eclipse.emf.edit.provider.ITreeItemContentProvider; | ||
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | ||
import org.eclipse.emf.edit.provider.ItemProviderAdapter; | ||
import org.eclipse.emf.edit.provider.ViewerNotification; | ||
import org.eclipse.sirius.components.view.SelectionDescription; | ||
import org.eclipse.sirius.components.view.ViewPackage; | ||
|
||
/** | ||
* This is the item provider adapter for a {@link org.eclipse.sirius.components.view.SelectionDescription} object. <!-- | ||
* begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
public class SelectionDescriptionItemProvider extends ItemProviderAdapter | ||
implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { | ||
/** | ||
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
public SelectionDescriptionItemProvider(AdapterFactory adapterFactory) { | ||
super(adapterFactory); | ||
} | ||
|
||
/** | ||
* This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
@Override | ||
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { | ||
if (this.itemPropertyDescriptors == null) { | ||
super.getPropertyDescriptors(object); | ||
|
||
this.addSelectionCandidatesExpressionPropertyDescriptor(object); | ||
this.addSelectionMessagePropertyDescriptor(object); | ||
} | ||
return this.itemPropertyDescriptors; | ||
} | ||
|
||
/** | ||
* This adds a property descriptor for the Selection Candidates Expression feature. <!-- begin-user-doc --> <!-- | ||
* end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
protected void addSelectionCandidatesExpressionPropertyDescriptor(Object object) { | ||
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), | ||
this.getString("_UI_SelectionDescription_selectionCandidatesExpression_feature"), | ||
this.getString("_UI_PropertyDescriptor_description", "_UI_SelectionDescription_selectionCandidatesExpression_feature", "_UI_SelectionDescription_type"), | ||
ViewPackage.Literals.SELECTION_DESCRIPTION__SELECTION_CANDIDATES_EXPRESSION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); | ||
} | ||
|
||
/** | ||
* This adds a property descriptor for the Selection Message feature. <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
protected void addSelectionMessagePropertyDescriptor(Object object) { | ||
this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), | ||
this.getString("_UI_SelectionDescription_selectionMessage_feature"), | ||
this.getString("_UI_PropertyDescriptor_description", "_UI_SelectionDescription_selectionMessage_feature", "_UI_SelectionDescription_type"), | ||
ViewPackage.Literals.SELECTION_DESCRIPTION__SELECTION_MESSAGE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); | ||
} | ||
|
||
/** | ||
* This returns SelectionDescription.gif. <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
@Override | ||
public Object getImage(Object object) { | ||
return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/SelectionDescription")); | ||
} | ||
|
||
/** | ||
* <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
@Override | ||
protected boolean shouldComposeCreationImage() { | ||
return true; | ||
} | ||
|
||
/** | ||
* This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
@Override | ||
public String getText(Object object) { | ||
String label = ((SelectionDescription) object).getSelectionCandidatesExpression(); | ||
return label == null || label.length() == 0 ? this.getString("_UI_SelectionDescription_type") : this.getString("_UI_SelectionDescription_type") + " " + label; | ||
} | ||
|
||
/** | ||
* This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating | ||
* a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc | ||
* --> | ||
* | ||
* @generated | ||
*/ | ||
@Override | ||
public void notifyChanged(Notification notification) { | ||
this.updateChildren(notification); | ||
|
||
switch (notification.getFeatureID(SelectionDescription.class)) { | ||
case ViewPackage.SELECTION_DESCRIPTION__SELECTION_CANDIDATES_EXPRESSION: | ||
case ViewPackage.SELECTION_DESCRIPTION__SELECTION_MESSAGE: | ||
this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); | ||
return; | ||
} | ||
super.notifyChanged(notification); | ||
} | ||
|
||
/** | ||
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created | ||
* under this object. <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
@Override | ||
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { | ||
super.collectNewChildDescriptors(newChildDescriptors, object); | ||
} | ||
|
||
/** | ||
* Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc --> | ||
* | ||
* @generated | ||
*/ | ||
@Override | ||
public ResourceLocator getResourceLocator() { | ||
return ((IChildCreationExtender) this.adapterFactory).getResourceLocator(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.