Skip to content

Commit

Permalink
#109 Add a new DiffMerge filter for ReqIf.Text attribute and document
Browse files Browse the repository at this point in the history
about it

Resolves #109

Change-Id: Ic0bdd193d999f007688861bd448a26d363886e6e
Signed-off-by: Tu Ton <minhtutonthat@gmail.com>
  • Loading branch information
minhtutonthat authored and sandupostaru committed Jan 15, 2021
1 parent 64042ee commit 5f68ebf
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,24 @@ <h2>Diff/Merge Dialog</h2>
</p>
</ul>

<b>Display ReqIF Text content in Capella Richtext editor</b>
<b>Ignore differences in ReqIF.Text attributes</b>
<p>
Since v0.12.0, ReqIF.Text attributes are imported in a way that HTML formatting is kept, on the contrary to previous versions where only plain text is imported.
Thus, differences in these attributes will be shown when the same ReqIf model is imported. If you want to ignore these differences during the import, you can choose to activate the ReqIF Text filter, as shown in the image below.
</p>
<p>
<img src="../../images/DiffMerge_Text_Filtering.png" alt="Ignore differences in ReqIF.Text attribute" title="Ignore differences in ReqIF.Text attribute">
</p>

<h2>Display ReqIF Text content in Capella Richtext editor</h2>
<p>
Requirement's ReqIf.Text field when imported into Capella model can be displayed in Capella Richtext editor in the property view as shown in the below image.</div>
</p>
<p>
<img src="../../images/ReqIFText.png" alt="ReqIF Text" title="ReqIF Text">
</p>

<b>Image importing strategies</b>
<p>
For imported images, users can choose one of three strategies: import to an absolute path, import to a relative path or embed image in Base64 format. Here below are the advantages and inconveniences for each approach.
</p>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ http://www.eclipse.org/legal/epl-2.0
/images/migration1.png - org.polarsys.capella.vp.requirements.doc
/images/migration2.png - org.polarsys.capella.vp.requirements.doc
/images/ReqIFText.png - org.polarsys.capella.vp.requirements.doc
/images/ImageImportStrategy.png - org.polarsys.capella.vp.requirements.doc
/images/ImageImportStrategy.png - org.polarsys.capella.vp.requirements.doc
/images/DiffMerge_Text_Filtering.png - org.polarsys.capella.vp.requirements.doc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public void widgetSelected(SelectionEvent e) {
if (Paths.get(absPathText.getText()).toFile().exists() && Paths.get(absPathText.getText()).isAbsolute()) {
enableFinishForAbsPath();
} else {
setMessage(Messages.ImageImportingDialog_DefaultMessage + Messages.ImageImportingDialog_AbsPathMessage);
disableFinish();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.polarsys.capella.vp.requirements.CapellaRequirements.CapellaTypesFolder;
import org.polarsys.capella.vp.requirements.importer.transposer.bridge.categories.EClassCategory;
import org.polarsys.capella.vp.requirements.importer.transposer.bridge.categories.RelationIdentifierCategory;
import org.polarsys.capella.vp.requirements.importer.transposer.bridge.categories.ReqIFTextCategory;
import org.polarsys.kitalpha.emde.model.ElementExtension;
import org.polarsys.kitalpha.vp.requirements.Requirements.ReqIFElement;
import org.polarsys.kitalpha.vp.requirements.Requirements.RequirementsPackage;
Expand Down Expand Up @@ -252,6 +253,7 @@ protected EMFDiffNode createDiffNode(EComparison comparison, EditingDomain domai
set.getChildren().add(typesFolderEClassCategory);

set.getChildren().add(new RelationIdentifierCategory());
set.getChildren().add(new ReqIFTextCategory());

diffNode.getCategoryManager().addCategories(set);
return diffNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017 THALES GLOBAL SERVICES.
* Copyright (c) 2017, 2020 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -18,6 +18,8 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.polarsys.capella.vp.requirements.importer.transposer.bridge.categories.messages"; //$NON-NLS-1$
public static String Categories_Relation_Identifier;
public static String CategoryFormat_Description;
public static String Category_ReqIFText_Description;
public static String Categories_ReqIFText_Identifier;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*******************************************************************************
* Copyright (c) 2020 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.vp.requirements.importer.transposer.bridge.categories;

import org.eclipse.emf.diffmerge.diffdata.EAttributeValuePresence;
import org.eclipse.emf.diffmerge.diffdata.EMatch;
import org.eclipse.emf.diffmerge.generic.api.diff.IDifference;
import org.eclipse.emf.diffmerge.ui.viewers.EMFDiffNode;
import org.eclipse.emf.diffmerge.ui.viewers.categories.AbstractDifferenceCategory;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.polarsys.kitalpha.vp.requirements.Requirements.Requirement;
import org.polarsys.kitalpha.vp.requirements.Requirements.RequirementsPackage;
import org.polarsys.kitalpha.vp.requirements.Requirements.provider.RequirementsEditPlugin;

public class ReqIFTextCategory extends AbstractDifferenceCategory {

/** ID of this category */
public static final String ID = "ReqVP.Text"; //$NON-NLS-1$

protected static final String REQUIREMENT_ICON_PATH = "full/obj16/Requirement.gif"; //$NON-NLS-1$

public ReqIFTextCategory() {
super();
setActive(false);
setInFocusMode(false);
setVisible(true);
setModifiable(true);
}

/**
* @see org.eclipse.emf.diffmerge.ui.viewers.IDifferenceCategory#covers(org.eclipse.emf.diffmerge.api.diff.IDifference,
* org.eclipse.emf.diffmerge.ui.viewers.EMFDiffNode)
*/
public boolean covers(IDifference<?> difference_p, EMFDiffNode node_p) {
boolean result = false;
if (difference_p instanceof EAttributeValuePresence) {
EAttributeValuePresence vp = (EAttributeValuePresence) difference_p;
if (vp.getFeature() == RequirementsPackage.Literals.REQUIREMENT__REQ_IF_TEXT) {
if (vp.eContainer() instanceof EMatch && ((EMatch) vp.eContainer()).getTarget() instanceof Requirement) {
return true;
}
}
}
return result;
}

/**
* @see org.eclipse.emf.diffmerge.ui.viewers.IDifferenceCategoryItem#getDescription(org.eclipse.emf.diffmerge.ui.viewers.EMFDiffNode)
*/
@Override
public String getDescription(EMFDiffNode node_p) {
return Messages.Category_ReqIFText_Description;
}

/**
* @see org.eclipse.emf.diffmerge.ui.viewers.IDifferenceCategory#getID()
*/
@Override
public String getID() {
return ID;
}

/**
* @see org.eclipse.emf.diffmerge.ui.viewers.categories.AbstractDifferenceCategoryItem#getImage(org.eclipse.emf.diffmerge.ui.viewers.EMFDiffNode)
*/
@Override
public Image getImage(EMFDiffNode node_p) {
return ExtendedImageRegistry.getInstance()
.getImage(RequirementsEditPlugin.getPlugin().getImage(REQUIREMENT_ICON_PATH)); // $NON-NLS-1$
}

/**
* @see org.eclipse.emf.diffmerge.ui.viewers.IDifferenceCategory#getText(org.eclipse.emf.diffmerge.ui.viewers.EMFDiffNode)
*/
@Override
public String getText(EMFDiffNode node_p) {
return Messages.Categories_ReqIFText_Identifier;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#===============================================================================
# Copyright (c) 2017 THALES GLOBAL SERVICES.
# Copyright (c) 2017, 2020 THALES GLOBAL SERVICES.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
Expand All @@ -10,3 +10,5 @@
#===============================================================================
Categories_Relation_Identifier=Relation Identifier
CategoryFormat_Description=Handle all differences manipulating Relation Identifiers
Categories_ReqIFText_Identifier=ReqIF Text
Category_ReqIFText_Description=Handle all differences in ReqIF Text attribute

0 comments on commit 5f68ebf

Please sign in to comment.