use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.
the class PrimaryKeyPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final PrimaryKey primaryKey = (PrimaryKey) elt;
final PrimaryKeyPropertiesEditionPart primaryKeyPart = (PrimaryKeyPropertiesEditionPart) editingPart;
// init values
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.name))
primaryKeyPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, primaryKey.getName()));
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
columnsSettings = new ReferencesTableSettings(primaryKey, DatabasePackage.eINSTANCE.getPrimaryKey_Columns());
primaryKeyPart.initColumns(columnsSettings);
}
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.comments))
primaryKeyPart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, primaryKey.getComments()));
if (isAccessible(DatabaseViewsRepository.PrimaryKey.Properties.columns)) {
primaryKeyPart.addFilterToColumns(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof EObject)
return (!primaryKeyPart.isContainedInColumnsTable((EObject) element));
return element instanceof String && element.equals("");
}
});
primaryKeyPart.addFilterToColumns(new EObjectStrictFilter(DatabasePackage.Literals.COLUMN));
// Start of user code for additional businessfilters for columns
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.
the class TableConstraintsPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final Table table = (Table) elt;
final ConstraintsPropertiesEditionPart constraintsPart = (ConstraintsPropertiesEditionPart) editingPart;
// init values
if (isAccessible(DatabaseViewsRepository.Constraints.Properties.constraints_)) {
constraintsSettings = new ReferencesTableSettings(table, DatabasePackage.eINSTANCE.getTable_Constraints());
constraintsPart.initConstraints(constraintsSettings);
}
// init filters
if (isAccessible(DatabaseViewsRepository.Constraints.Properties.constraints_)) {
constraintsPart.addFilterToConstraints(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof Constraint);
}
});
// Start of user code for additional businessfilters for constraints
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.
the class TableTablePropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final Table table = (Table) elt;
final TablePropertiesEditionPart tablePart = (TablePropertiesEditionPart) editingPart;
// init values
if (isAccessible(DatabaseViewsRepository.Table.Properties.name))
tablePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, table.getName()));
if (isAccessible(DatabaseViewsRepository.Table.Properties.columns)) {
columnsSettings = new ReferencesTableSettings(table, DatabasePackage.eINSTANCE.getTable_Columns());
tablePart.initColumns(columnsSettings);
}
if (isAccessible(DatabaseViewsRepository.Table.Properties.comments))
tablePart.setComments(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, table.getComments()));
if (isAccessible(DatabaseViewsRepository.Table.Properties.columns)) {
tablePart.addFilterToColumns(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof Column);
}
});
// Start of user code for additional businessfilters for columns
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.
the class StateMachinePropertiesEditionPartForm method createRegionsTableComposition.
/**
* @param container
*/
protected Composite createRegionsTableComposition(FormToolkit widgetFactory, Composite parent) {
this.regions = new ReferencesTable(getDescription(StatemachineViewsRepository.StateMachine_.Properties.regions, StatemachineMessages.StateMachinePropertiesEditionPart_RegionsLabel), new ReferencesTableListener() {
public void handleAdd() {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartForm.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
regions.refresh();
}
public void handleEdit(EObject element) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartForm.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
regions.refresh();
}
public void handleMove(EObject element, int oldIndex, int newIndex) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartForm.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
regions.refresh();
}
public void handleRemove(EObject element) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartForm.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
regions.refresh();
}
public void navigateTo(EObject element) {
}
});
for (ViewerFilter filter : this.regionsFilters) {
this.regions.addFilter(filter);
}
this.regions.setHelpText(propertiesEditionComponent.getHelpContent(StatemachineViewsRepository.StateMachine_.Properties.regions, StatemachineViewsRepository.FORM_KIND));
this.regions.createControls(parent, widgetFactory);
this.regions.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (e.item != null && e.item.getData() instanceof EObject) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartForm.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
}
}
});
GridData regionsData = new GridData(GridData.FILL_HORIZONTAL);
regionsData.horizontalSpan = 3;
this.regions.setLayoutData(regionsData);
this.regions.setLowerBound(0);
this.regions.setUpperBound(-1);
regions.setID(StatemachineViewsRepository.StateMachine_.Properties.regions);
// $NON-NLS-1$
regions.setEEFType("eef::AdvancedTableComposition");
// End of user code
return parent;
}
use of org.eclipse.jface.viewers.ViewerFilter in project InformationSystem by ObeoNetwork.
the class StateMachinePropertiesEditionPartImpl method createRegionsAdvancedTableComposition.
/**
* @param container
*/
protected Composite createRegionsAdvancedTableComposition(Composite parent) {
this.regions = new ReferencesTable(getDescription(StatemachineViewsRepository.StateMachine_.Properties.regions, StatemachineMessages.StateMachinePropertiesEditionPart_RegionsLabel), new ReferencesTableListener() {
public void handleAdd() {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartImpl.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, null));
regions.refresh();
}
public void handleEdit(EObject element) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartImpl.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.EDIT, null, element));
regions.refresh();
}
public void handleMove(EObject element, int oldIndex, int newIndex) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartImpl.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.MOVE, element, newIndex));
regions.refresh();
}
public void handleRemove(EObject element) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartImpl.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.REMOVE, null, element));
regions.refresh();
}
public void navigateTo(EObject element) {
}
});
for (ViewerFilter filter : this.regionsFilters) {
this.regions.addFilter(filter);
}
this.regions.setHelpText(propertiesEditionComponent.getHelpContent(StatemachineViewsRepository.StateMachine_.Properties.regions, StatemachineViewsRepository.SWT_KIND));
this.regions.createControls(parent);
this.regions.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (e.item != null && e.item.getData() instanceof EObject) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StateMachinePropertiesEditionPartImpl.this, StatemachineViewsRepository.StateMachine_.Properties.regions, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SELECTION_CHANGED, null, e.item.getData()));
}
}
});
GridData regionsData = new GridData(GridData.FILL_HORIZONTAL);
regionsData.horizontalSpan = 3;
this.regions.setLayoutData(regionsData);
this.regions.setLowerBound(0);
this.regions.setUpperBound(-1);
regions.setID(StatemachineViewsRepository.StateMachine_.Properties.regions);
// $NON-NLS-1$
regions.setEEFType("eef::AdvancedTableComposition");
// End of user code
return parent;
}
Aggregations