Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2019-04-16 03:17:18 -0400
committerNicolas FAUVERGUE2019-04-16 07:59:38 -0400
commite207da1a4cf93b8a033c3e003439f474222f2385 (patch)
tree56d607b7bf7ebfaf441983922d84c2b977a6bbaa
parentd413be84de3925644f8782db7da308209e0c2d5c (diff)
downloadorg.eclipse.papyrus-e207da1a4cf93b8a033c3e003439f474222f2385.tar.gz
org.eclipse.papyrus-e207da1a4cf93b8a033c3e003439f474222f2385.tar.xz
org.eclipse.papyrus-e207da1a4cf93b8a033c3e003439f474222f2385.zip
Bug 546239: [Toolsmiths][Validation] Plug-ins to validate profile
plug-in must be implemented - Minor improvements Change-Id: I6b34ee5312b608e8d9717b3591e0a5f69755202a Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
-rw-r--r--plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileDependenciesChecker.java13
-rw-r--r--plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java12
2 files changed, 15 insertions, 10 deletions
diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileDependenciesChecker.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileDependenciesChecker.java
index 7316970190a..157d03aa903 100644
--- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileDependenciesChecker.java
+++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileDependenciesChecker.java
@@ -17,6 +17,7 @@ package org.eclipse.papyrus.toolsmiths.validation.profile.internal.checkers;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -27,6 +28,7 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.URIMappingRegistryImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.osgi.service.resolver.BundleSpecification;
import org.eclipse.papyrus.toolsmiths.validation.common.checkers.IPluginChecker;
import org.eclipse.papyrus.toolsmiths.validation.common.utils.MarkersService;
import org.eclipse.papyrus.toolsmiths.validation.common.utils.ProjectManagementService;
@@ -102,8 +104,11 @@ public class ProfileDependenciesChecker implements IPluginChecker {
// For each external reference, get its plug-in name and search its dependency in the plug-in
final Collection<String> existingRequiredPlugins = new HashSet<>();
- ProjectManagementService.getPluginDependencies(project).stream().forEach(dependency -> existingRequiredPlugins.add(dependency.getName()));
- requiredPlugins.removeIf(requiredPlugin -> existingRequiredPlugins.contains(requiredPlugin));
+ final List<BundleSpecification> dependencies = ProjectManagementService.getPluginDependencies(project);
+ if (null != dependencies && !dependencies.isEmpty()) {
+ ProjectManagementService.getPluginDependencies(project).stream().forEach(dependency -> existingRequiredPlugins.add(dependency.getName()));
+ requiredPlugins.removeIf(requiredPlugin -> existingRequiredPlugins.contains(requiredPlugin));
+ }
// If requiredPlugins is not empty, that means, the dependency is not available in the profile plug-in
// So, create the warning markers
@@ -186,8 +191,8 @@ public class ProfileDependenciesChecker implements IPluginChecker {
final String resourceURI = resource.getURI().toString();
// We don't have to manage references of files from the same plug-in
- if (resourceURI.startsWith("platform:/plugin/" + project.getName()) || //$NON-NLS-1$
- resourceURI.startsWith("platform:/resource/" + project.getName())) { //$NON-NLS-1$
+ if (resourceURI.startsWith("platform:/plugin/" + project.getName() + "/") || //$NON-NLS-1$ //$NON-NLS-2$
+ resourceURI.startsWith("platform:/resource/" + project.getName() + "/")) { //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java
index 9cf424f004a..842db8d0996 100644
--- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java
+++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/internal/checkers/ProfileExtensionsChecker.java
@@ -94,11 +94,11 @@ public class ProfileExtensionsChecker implements IPluginChecker {
while (extensions.hasNext()) {
final IPluginExtension extension = extensions.next();
// Check if the UML profile extension point is managed (warning because this one can be managed outside of this plug-in)
- if (!foundExtensionUMLProfile && extension.getPoint().equals(ProfilePluginValidationConstants.UMLPROFILE_EXTENSION_POINT)) {
+ if (!foundExtensionUMLProfile && ProfilePluginValidationConstants.UMLPROFILE_EXTENSION_POINT.equals(extension.getPoint())) {
for (final IPluginObject pluginObject : extension.getChildren()) {
- if (pluginObject instanceof IPluginElement && pluginObject.getName().equals("profile")) { //$NON-NLS-1$
+ if (pluginObject instanceof IPluginElement && "profile".equals(pluginObject.getName())) { //$NON-NLS-1$
for (final IPluginAttribute pluginAtttribute : ((IPluginElement) pluginObject).getAttributes()) {
- if (pluginAtttribute.getName().equals("path")) { //$NON-NLS-1$
+ if ("path".equals(pluginAtttribute.getName())) { //$NON-NLS-1$
final String locationValue = pluginAtttribute.getValue();
if (locationValue.endsWith(profileFile.getName())) {
foundExtensionUMLProfile = true;
@@ -110,11 +110,11 @@ public class ProfileExtensionsChecker implements IPluginChecker {
}
// Manage the uml profile registration (check only if
- if (!profiles.isEmpty() && extension.getPoint().equals(ProfilePluginValidationConstants.UML_GENERATED_PACKAGE_EXTENSION_POINT)) {
+ if (!profiles.isEmpty() && ProfilePluginValidationConstants.UML_GENERATED_PACKAGE_EXTENSION_POINT.equals(extension.getPoint())) {
for (final IPluginObject pluginObject : extension.getChildren()) {
- if (pluginObject instanceof IPluginElement && pluginObject.getName().equals("profile")) { //$NON-NLS-1$
+ if (pluginObject instanceof IPluginElement && "profile".equals(pluginObject.getName())) { //$NON-NLS-1$
for (final IPluginAttribute pluginAtttribute : ((IPluginElement) pluginObject).getAttributes()) {
- if (pluginAtttribute.getName().equals("location")) { //$NON-NLS-1$
+ if ("location".equals(pluginAtttribute.getName())) { //$NON-NLS-1$
final String locationValue = pluginAtttribute.getValue();
final Iterator<Profile> profilesIt = profiles.iterator();

Back to the top