-
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.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 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
39 changes: 39 additions & 0 deletions
39
...file.ui/src/io/github/abelgomez/ps/profile/ui/providers/UpdateOperationLabelProvider.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,39 @@ | ||
package io.github.abelgomez.ps.profile.ui.providers; | ||
|
||
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; | ||
import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider; | ||
import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider; | ||
import org.eclipse.swt.graphics.Image; | ||
import org.eclipse.uml2.uml.UMLFactory; | ||
import org.eclipse.uml2.uml.edit.providers.DataTypeItemProvider; | ||
import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; | ||
|
||
import io.github.abelgomez.ps.UpdateOperation; | ||
|
||
public class UpdateOperationLabelProvider extends EMFLabelProvider implements IFilteredLabelProvider { | ||
|
||
private static final Image PROPERTY_IMAGE = ExtendedImageRegistry.getInstance().getImage(new DataTypeItemProvider( | ||
new UMLItemProviderAdapterFactory()).getImage(UMLFactory.eINSTANCE.createProperty())); | ||
|
||
@Override | ||
public String getText(Object element) { | ||
UpdateOperation updateOperation = (UpdateOperation) element; | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append("(operator = '"); | ||
builder.append(updateOperation.getOperator().getLiteral()); | ||
builder.append("', value = '"); | ||
builder.append(updateOperation.getValue()); | ||
builder.append("')"); | ||
return builder.toString(); | ||
} | ||
|
||
@Override | ||
public boolean accept(Object element) { | ||
return element instanceof UpdateOperation; | ||
} | ||
|
||
@Override | ||
public Image getImage(Object element) { | ||
return PROPERTY_IMAGE; | ||
} | ||
} |