Search in sources :

Example 1 with DiffContentService

use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.

the class RemoveIndexItemProvider method getText.

/**
 * This returns the label text for the adapted class. <!-- begin-user-doc
 * --> <!-- end-user-doc -->
 *
 * @generated NOT
 */
@Override
public String getText(Object object) {
    RemoveIndex removeIndex = (RemoveIndex) object;
    Index index = (Index) removeIndex.getIndex();
    AdapterFactoryItemDelegator delegator = new AdapterFactoryItemDelegator(getRootAdapterFactory());
    final String parentLabel = delegator.getText(index);
    return getString("_UI_RemoveIndex_type", new Object[] { parentLabel, new DiffContentService().getSubDiffs(removeIndex, removeIndex.getMatch().getComparison()).size() });
}
Also used : AdapterFactoryItemDelegator(org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator) Index(org.obeonetwork.dsl.database.Index) RemoveIndex(org.obeonetwork.dsl.database.dbevolution.RemoveIndex) RemoveIndex(org.obeonetwork.dsl.database.dbevolution.RemoveIndex) DiffContentService(org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService)

Example 2 with DiffContentService

use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.

the class AlterTableItemProvider method getText.

/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public String getText(Object object) {
    final AlterTable alterTable = (AlterTable) object;
    final Table table = alterTable.getTable();
    AdapterFactoryItemDelegator delegator = new AdapterFactoryItemDelegator(getRootAdapterFactory());
    final String parentLabel = delegator.getText(table);
    return getString("_UI_AlterTable_type", new Object[] { parentLabel, new DiffContentService().getSubDiffs(alterTable, alterTable.getMatch().getComparison()).size() });
}
Also used : AlterTable(org.obeonetwork.dsl.database.dbevolution.AlterTable) AlterTable(org.obeonetwork.dsl.database.dbevolution.AlterTable) Table(org.obeonetwork.dsl.database.Table) AdapterFactoryItemDelegator(org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator) DiffContentService(org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService)

Example 3 with DiffContentService

use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.

the class AlterViewItemProvider method getText.

/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public String getText(Object object) {
    final AlterView alterView = (AlterView) object;
    final View view = alterView.getView();
    AdapterFactoryItemDelegator delegator = new AdapterFactoryItemDelegator(getRootAdapterFactory());
    final String parentLabel = delegator.getText(view);
    return getString("_UI_AlterView_type", new Object[] { parentLabel, new DiffContentService().getSubDiffs(alterView, alterView.getMatch().getComparison()).size() });
}
Also used : AlterView(org.obeonetwork.dsl.database.dbevolution.AlterView) AdapterFactoryItemDelegator(org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator) View(org.obeonetwork.dsl.database.View) AlterView(org.obeonetwork.dsl.database.dbevolution.AlterView) DiffContentService(org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService)

Example 4 with DiffContentService

use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.

the class AbtractTest method diff.

protected Comparison diff(TableContainer left, TableContainer right) throws Exception {
    Comparison comparison = DatabaseCompareService.compare(left, right);
    assertNotNull(comparison);
    // DatabaseChangeSet databaseChangeSet = null;
    // if (comparison instanceof DatabaseChangeSet) {
    // databaseChangeSet = (DatabaseChangeSet) comparison;
    // }
    // assertNotNull(databaseChangeSet);
    DiffContentService DiffContentService = new DiffContentService();
    System.out.println("---- Print ChangeSet -----");
    for (Diff element : comparison.getDifferences()) {
        System.out.println("\t" + element.eClass().getName());
        List<Diff> subDiffs = DiffContentService.getSubDiffs(element, comparison);
        if (!subDiffs.isEmpty()) {
            for (Diff e : subDiffs) {
                System.out.println("\t\t" + e.eClass().getName() + "(" + e + ")");
            }
        }
    }
    return comparison;
}
Also used : Comparison(org.eclipse.emf.compare.Comparison) Diff(org.eclipse.emf.compare.Diff) DiffContentService(org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService)

Example 5 with DiffContentService

use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.

the class DatabasePostProcessor method postComparison.

@Override
public void postComparison(final Comparison comparison, Monitor monitor) {
    // Create DBDiffs
    new DatabaseDiffExtension().visit(comparison);
    // Delete all empty DBDiffs
    final DiffContentService service = new DiffContentService();
    Collection<Diff> toDelete = Collections2.filter(comparison.getDifferences(), new Predicate<Diff>() {

        public boolean apply(Diff input) {
            return input instanceof DBDiff && service.getSubDiffs(input, comparison).isEmpty() && input.getRefinedBy().isEmpty();
        }
    });
    for (Diff diff : toDelete) {
        // It could be optimized doing diff.eContainer().eContents().delete(diff) since no object references it.
        EcoreUtil.delete(diff);
    }
}
Also used : Diff(org.eclipse.emf.compare.Diff) DBDiff(org.obeonetwork.dsl.database.dbevolution.DBDiff) DiffContentService(org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService) DBDiff(org.obeonetwork.dsl.database.dbevolution.DBDiff)

Aggregations

DiffContentService (org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService)7 AdapterFactoryItemDelegator (org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator)5 Diff (org.eclipse.emf.compare.Diff)2 Comparison (org.eclipse.emf.compare.Comparison)1 Column (org.obeonetwork.dsl.database.Column)1 Index (org.obeonetwork.dsl.database.Index)1 Schema (org.obeonetwork.dsl.database.Schema)1 Table (org.obeonetwork.dsl.database.Table)1 View (org.obeonetwork.dsl.database.View)1 AlterSchema (org.obeonetwork.dsl.database.dbevolution.AlterSchema)1 AlterTable (org.obeonetwork.dsl.database.dbevolution.AlterTable)1 AlterView (org.obeonetwork.dsl.database.dbevolution.AlterView)1 DBDiff (org.obeonetwork.dsl.database.dbevolution.DBDiff)1 RemoveIndex (org.obeonetwork.dsl.database.dbevolution.RemoveIndex)1 UpdateColumnChange (org.obeonetwork.dsl.database.dbevolution.UpdateColumnChange)1