Skip to content

Commit

Permalink
[2143] Reduce REC/RPL usage to semantic elements only
Browse files Browse the repository at this point in the history
Bug: 2143
Change-Id: I4d84a349a1e5ef90c91aff4c88b3809c05adcd06
Signed-off-by: Philippe DUL <philippe.dul@thalesgroup.com>
  • Loading branch information
pdulth committed Aug 9, 2018
1 parent d3baa17 commit 0683715
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
8 changes: 4 additions & 4 deletions common/plugins/org.polarsys.capella.common.re.ui/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright (c) 2006, 2017 THALES GLOBAL SERVICES.
Copyright (c) 2006, 2018 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 Down Expand Up @@ -558,7 +558,7 @@
isTopLevel="true"
name="RPL">
<availableForType
class="org.eclipse.emf.ecore.EObject">
class="org.polarsys.kitalpha.emde.model.Element">
</availableForType>
<targetBrowserId
id="ReferencingElementBrowser">
Expand All @@ -576,7 +576,7 @@
isTopLevel="true"
name="REC">
<availableForType
class="org.eclipse.emf.ecore.EObject">
class="org.polarsys.kitalpha.emde.model.Element">
</availableForType>
<targetBrowserId
id="ReferencingElementBrowser">
Expand All @@ -596,7 +596,7 @@
isTopLevel="true"
name="REC Source Element">
<availableForType
class="org.eclipse.emf.ecore.EObject">
class="org.polarsys.kitalpha.emde.model.Element">
</availableForType>
<targetBrowserId
id="ReferencedElementBrowser">
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 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 Down Expand Up @@ -36,6 +36,13 @@ protected ICommand createCommand(Collection<?> selection, IProgressMonitor progr
@Override
public void setEnabled(Object evaluationContext) {
super.setEnabled(evaluationContext);
}

Collection<?> seleciton = getInitialSelection(evaluationContext);
if (seleciton.isEmpty()) {
setBaseEnabled(false);
return;
}
setBaseEnabled(true);
}

}
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 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 Down Expand Up @@ -36,6 +36,13 @@ protected ICommand createCommand(Collection<?> selection, IProgressMonitor progr
@Override
public void setEnabled(Object evaluationContext) {
super.setEnabled(evaluationContext);

Collection<?> seleciton = getInitialSelection(evaluationContext);
if (seleciton.isEmpty()) {
setBaseEnabled(false);
return;
}
setBaseEnabled(true);
}

}
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 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 Down Expand Up @@ -28,6 +28,7 @@
import org.polarsys.capella.common.helpers.TransactionHelper;
import org.polarsys.capella.common.helpers.operations.LongRunningListenersRegistry;
import org.polarsys.capella.common.mdsofa.common.constant.ICommonConstants;
import org.polarsys.capella.core.model.handler.command.CapellaResourceHelper;

/**
*
Expand All @@ -52,7 +53,6 @@ public Collection<EObject> getSemanticObjects(Collection<?> elements) {

public EObject resolveSemanticObject(Object object) {
EObject semantic = null;

if (object != null) {
if (object instanceof EObject) {
semantic = (EObject) object;
Expand All @@ -63,6 +63,9 @@ public EObject resolveSemanticObject(Object object) {
semantic = (EObject) adapter;
}
}
if (!(CapellaResourceHelper.isSemanticElement(semantic))) {
return null;
}
}
return semantic;
}
Expand Down

0 comments on commit 0683715

Please sign in to comment.