Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor adaptions for KAMP4aPS4Req #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,6 @@ public void partOpened(IWorkbenchPart p) {
*/
protected EContentAdapter problemIndicationAdapter =
new EContentAdapter() {
protected boolean dispatching;

@Override
public void notifyChanged(Notification notification) {
if (notification.getNotifier() instanceof Resource) {
Expand All @@ -441,7 +439,15 @@ public void notifyChanged(Notification notification) {
else {
resourceToDiagnosticMap.remove(resource);
}
dispatchUpdateProblemIndication();

if (updateProblemIndication) {
getSite().getShell().getDisplay().asyncExec
(new Runnable() {
public void run() {
updateProblemIndication();
}
});
}
break;
}
}
Expand All @@ -451,19 +457,6 @@ public void notifyChanged(Notification notification) {
}
}

protected void dispatchUpdateProblemIndication() {
if (updateProblemIndication && !dispatching) {
dispatching = true;
getSite().getShell().getDisplay().asyncExec
(new Runnable() {
public void run() {
dispatching = false;
updateProblemIndication();
}
});
}
}

@Override
protected void setTarget(Resource target) {
basicSetTarget(target);
Expand All @@ -473,7 +466,14 @@ protected void setTarget(Resource target) {
protected void unsetTarget(Resource target) {
basicUnsetTarget(target);
resourceToDiagnosticMap.remove(target);
dispatchUpdateProblemIndication();
if (updateProblemIndication) {
getSite().getShell().getDisplay().asyncExec
(new Runnable() {
public void run() {
updateProblemIndication();
}
});
}
}
};

Expand Down Expand Up @@ -671,11 +671,14 @@ else if (diagnostic.getSeverity() != Diagnostic.OK) {
}

if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
try {
markerHelper.updateMarkers(diagnostic);
}
catch (CoreException exception) {
DeploymentcontextEditorPlugin.INSTANCE.log(exception);
markerHelper.deleteMarkers(editingDomain.getResourceSet());
if (diagnostic.getSeverity() != Diagnostic.OK) {
try {
markerHelper.createMarkers(diagnostic);
}
catch (CoreException exception) {
DeploymentcontextEditorPlugin.INSTANCE.log(exception);
}
}
}
}
Expand Down Expand Up @@ -1066,7 +1069,6 @@ public void requestActivation() {

selectionViewer = (TreeViewer)viewerPane.getViewer();
selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
selectionViewer.setUseHashlookup(true);

selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
selectionViewer.setInput(editingDomain.getResourceSet());
Expand Down Expand Up @@ -1372,7 +1374,6 @@ public void createControl(Composite parent) {

// Set up the tree viewer.
//
contentOutlineViewer.setUseHashlookup(true);
contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
contentOutlineViewer.setInput(editingDomain.getResourceSet());
Expand Down Expand Up @@ -1520,9 +1521,7 @@ public void execute(IProgressMonitor monitor) {
// Save the resources to the file system.
//
boolean first = true;
List<Resource> resources = editingDomain.getResourceSet().getResources();
for (int i = 0; i < resources.size(); ++i) {
Resource resource = resources.get(i);
for (Resource resource : editingDomain.getResourceSet().getResources()) {
if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
try {
long timeStamp = resource.getTimeStamp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,7 @@ public DeploymentContextModelWizardInitialObjectCreationPage(String pageId) {
* @generated
*/
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
{
Composite composite = new Composite(parent, SWT.NONE); {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 12;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,52 @@ public APSArchitectureVersion(ArchitectureVersionParams params) {
_iecFieldOfActivityRepository = params.iecFieldOfActivityRepository;
_iecModificationMarkRepository = params.iecModificationMarkRepository;
}

public APSArchitectureVersion(String name, FieldOfActivityAnnotationRepository fieldOfActivityRepository,
AbstractKAMP4aPSModificationRepository<?> modificationMarkRepository, Plant aPSPlant, DeploymentContextRepository deploymentContextRepository, Repository iecRepository,
Configuration configuration, IECFieldOfActivityAnnotationsRepository iecFieldOfActivityRepository,
IECModificationRepository iecModificationMarkRepository) {
super(name, modificationMarkRepository);
// Some of the files describing the architecture might not exist; prevent NullPointer
// in propagation algorithm by setting newly created objects (whose EReferences are
// instantiated with empty collections, so the algorithm can handle them)

if (fieldOfActivityRepository == null)
fieldOfActivityRepository = KAMP4aPSFieldofactivityannotationsFactory.eINSTANCE.
createFieldOfActivityAnnotationRepository();

if(deploymentContextRepository == null)
deploymentContextRepository = DeploymentContextFactory.eINSTANCE.createDeploymentContextRepository();
_deploymentContextRepository = deploymentContextRepository;

if (iecRepository == null) {
_IECRepository = IECRepositoryFactory.eINSTANCE.
createRepository();
}
this._IECRepository = iecRepository;
if (configuration == null) {
_configuration = IECModelFactory.eINSTANCE.
createConfiguration();
}
this._configuration = configuration;
if (iecFieldOfActivityRepository == null) {
_iecFieldOfActivityRepository = IECFieldOfActivityAnnotationsFactory.eINSTANCE.
createIECFieldOfActivityAnnotationsRepository();
}
this._iecModificationMarkRepository = iecModificationMarkRepository;
if (iecModificationMarkRepository == null) {
_iecModificationMarkRepository = IECModificationmarksFactory.eINSTANCE.
createIECModificationRepository();
}

_fieldOfActivityRepository = fieldOfActivityRepository;
_aPSPlant = aPSPlant;
_deploymentContextRepository = deploymentContextRepository;
_IECRepository = iecRepository;
_configuration = configuration;
_iecFieldOfActivityRepository = iecFieldOfActivityRepository;
_iecModificationMarkRepository = iecModificationMarkRepository;
}

public FieldOfActivityAnnotationRepository getFieldOfActivityRepository() {
return _fieldOfActivityRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class APSDifferenceCalculation extends AbstractDifferenceCalculation<APSA
private APSArchitectureVersion version;

@Override
protected void checkForDifferencesAndAddToWorkplan(Diff diffElement, List<Activity> workplan) {
public void checkForDifferencesAndAddToWorkplan(Diff diffElement, List<Activity> workplan) {
for (APSActivityElementType elementType : APSActivityElementType.topLevelAPSActivityElementTypes()) {
if (detectionRuleAdded(diffElement, elementType.getElementClass())) {
NamedElement architectureElement = (NamedElement) (((ReferenceChange) diffElement).getValue());
Expand Down Expand Up @@ -105,12 +105,13 @@ private List<Activity> removeDuplicates(List<Activity> plantActivities) {
for(Activity activity : plantActivities){
isContained = false;
for(Activity tmpActivity : newActivities){
if(tmpActivity.getElementName() == null || activity.getElementName() == null)
System.out.println("gnah");
if(tmpActivity.getElementName().equals(activity.getElementName()))
if (tmpActivity == null || activity == null) {
continue;
}
if(tmpActivity.getElementName() != null && activity.getElementName() != null &&
tmpActivity.getElementName().equals(activity.getElementName()))
isContained = true;
}

if(!isContained)
newActivities.add(activity);
}
Expand Down