diff options
14 files changed, 264 insertions, 33 deletions
diff --git a/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/.project b/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/.project index 1719e552998..111260f1ead 100644 --- a/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/.project +++ b/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/.project @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>org.eclipse.papyrus.validation.feature</name> + <name>org.eclipse.papyrus.toolsmiths.validation.feature</name> <comment></comment> <projects> </projects> diff --git a/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/feature.xml b/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/feature.xml index 7f0cb1ab9c3..9f93e69baae 100644 --- a/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/feature.xml +++ b/features/papyrus-toolsmiths-features/org.eclipse.papyrus.toolsmiths.validation.feature/feature.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <feature id="org.eclipse.papyrus.toolsmiths.validation.feature" - version="1.0.0.qualifier" label="%featureName" + version="1.0.0.qualifier" provider-name="%providerName" license-feature="org.eclipse.license" license-feature-version="2.0.0"> @@ -19,7 +19,6 @@ %license </license> - <plugin id="org.eclipse.papyrus.toolsmiths.validation.common" download-size="0" @@ -34,5 +33,11 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.papyrus.dev.ui" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> </feature> diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.classpath b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.classpath index 068cc966e03..d251a509afd 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.classpath +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin/"/> diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.settings/org.eclipse.jdt.core.prefs b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.settings/org.eclipse.jdt.core.prefs index 15d5f917b9c..74c6d08d7e4 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/.settings/org.eclipse.jdt.core.prefs @@ -1,16 +1,16 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF index a21f7d03ed4..18d401b4be5 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/META-INF/MANIFEST.MF @@ -1,9 +1,11 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.ui;bundle-version="[3.112.0,4.0.0)", - org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)", + org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)" Export-Package: - org.eclipse.papyrus.toolsmiths.validation.common + org.eclipse.papyrus.toolsmiths.validation.common, + org.eclipse.papyrus.toolsmiths.validation.common.utils Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/Activator.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/Activator.java index fe3a9fdf395..a38884c5e76 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/Activator.java +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/Activator.java @@ -20,16 +20,23 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; /** - * The activator class controls the plug-in life cycle + * The activator class controls the plug-in life cycle. */ public class Activator extends AbstractUIPlugin { - // The plug-in ID + /** + * The plug-in ID. + */ public static final String PLUGIN_ID = "org.eclipse.papyrus.toolsmiths.validation.common"; //$NON-NLS-1$ - // The shared instance + /** + * The shared instance. + */ private static Activator plugin; + /** + * The log helper. + */ public static LogHelper log; /** @@ -38,8 +45,8 @@ public class Activator extends AbstractUIPlugin { public Activator() { } - /* - * (non-Javadoc) + /** + * {@inheritDoc} * * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ @@ -50,8 +57,8 @@ public class Activator extends AbstractUIPlugin { log = new LogHelper(this); } - /* - * (non-Javadoc) + /** + * {@inheritDoc} * * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ @@ -62,9 +69,9 @@ public class Activator extends AbstractUIPlugin { } /** - * Returns the shared instance + * Returns the shared instance. * - * @return the shared instance + * @return the shared instance. */ public static Activator getDefault() { return plugin; diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/utils/ProjectManagementUtils.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/utils/ProjectManagementUtils.java new file mode 100644 index 00000000000..9bf2ba1c374 --- /dev/null +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.common/src/org/eclipse/papyrus/toolsmiths/validation/common/utils/ProjectManagementUtils.java @@ -0,0 +1,78 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.validation.common.utils; + +import java.util.Arrays; +import java.util.Iterator; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.papyrus.toolsmiths.validation.common.Activator; + +/** + * This allows to define utils methods and functions corresponding to project. + */ +public class ProjectManagementUtils { + + /** + * This allows to get the file corresponding to the file name in parameter. + * + * @param container + * The container resource. + * @param foundFile + * The name of the found file. + * @param isExtensionCheck + * <code>true</code> if the found file is an extension to find, <code>false</code> otherwise. + * @return The corresponding file or <code>null</code>. + */ + public static IFile getFileFromProject(final IContainer container, final String foundFile, final boolean isExtensionCheck) { + IFile result = null; + + try { + final Iterator<IResource> members = Arrays.asList(container.members()).iterator(); + while (members.hasNext() && null == result) { + final IResource member = members.next(); + if (member instanceof IFile && isCorrespondingFile((IFile) member, foundFile, isExtensionCheck)) { + result = (IFile) member; + } else if (member instanceof IContainer) { + result = getFileFromProject((IContainer) member, foundFile, isExtensionCheck); + } + } + } catch (final CoreException e) { + Activator.log.error(e); + } + + return result; + } + + /** + * This allows to check if the current file is corresponding to the find one. + * + * @param file + * The current file. + * @param foundFile + * The name of the found file. + * @param isExtensionCheck + * <code>true</code> if the found file is an extension to find, <code>false</code> otherwise. + * @return <code>true</code> if the file is corresponding to the found file, <code>false</code> otherwise. + */ + private static boolean isCorrespondingFile(final IFile file, final String foundFile, final boolean isExtensionCheck) { + return isExtensionCheck ? file.getName().endsWith("." + foundFile) : file.getName().equals(foundFile); + } + +} diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.classpath b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.classpath index 068cc966e03..d251a509afd 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.classpath +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin/"/> diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.settings/org.eclipse.jdt.core.prefs b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.settings/org.eclipse.jdt.core.prefs index 15d5f917b9c..74c6d08d7e4 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/.settings/org.eclipse.jdt.core.prefs @@ -1,16 +1,16 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/META-INF/MANIFEST.MF b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/META-INF/MANIFEST.MF index 985a0257b9a..68fc4c2eb01 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/META-INF/MANIFEST.MF +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/META-INF/MANIFEST.MF @@ -1,9 +1,15 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.ui;bundle-version="[3.112.0,4.0.0)", - org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)", + org.eclipse.core.expressions;bundle-version="[3.6.0,4.0.0)", + org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", + org.eclipse.papyrus.toolsmiths.validation.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.papyrus.dev.ui;bundle-version="[0.0.1,2.0.0)" Export-Package: - org.eclipse.papyrus.toolsmiths.validation.profile + org.eclipse.papyrus.toolsmiths.validation.profile, + org.eclipse.papyrus.toolsmiths.validation.profile.handlers, + org.eclipse.papyrus.toolsmiths.validation.profile.testers Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/plugin.xml b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/plugin.xml index 29a28ce453b..c47680b87f9 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/plugin.xml +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/plugin.xml @@ -17,6 +17,50 @@ --> <plugin> + <extension + point="org.eclipse.ui.menus"> + <menuContribution + allPopups="false" + locationURI="popup:org.eclipse.papyrus.dev.ui.menu?after=additions"> + <command + commandId="org.eclipse.papyrus.toolsmiths.validation.profile.validateCommand" + label="Validate Profile plug-in" + style="push" + tooltip="Validate plug-in with Papyrus profile"> + <visibleWhen + checkEnabled="false"> + <with + variable="selection"> + <iterate> + <test + forcePluginActivation="true" + property="org.eclipse.papyrus.toolsmiths.validation.profile.canValidateProfilePlugin" + value="true"> + </test> + </iterate> + </with> + </visibleWhen> + </command> + </menuContribution> + </extension> + <extension + point="org.eclipse.ui.commands"> + <command + defaultHandler="org.eclipse.papyrus.toolsmiths.validation.profile.handlers.ValidateProfilePluginHandler" + id="org.eclipse.papyrus.toolsmiths.validation.profile.validateCommand" + name="Validate Profile plug-in"> + </command> + </extension> + <extension + point="org.eclipse.core.expressions.propertyTesters"> + <propertyTester + class="org.eclipse.papyrus.toolsmiths.validation.profile.testers.ValidateProfilePluginTester" + id="org.eclipse.papyrus.toolsmiths.validation.profile.canValidateProfilePlugin" + namespace="org.eclipse.papyrus.toolsmiths.validation.profile" + properties="canValidateProfilePlugin" + type="org.eclipse.core.resources.IProject"> + </propertyTester> + </extension> diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/Activator.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/Activator.java index 40e1795378a..c8f22949fb8 100644 --- a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/Activator.java +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/Activator.java @@ -20,16 +20,23 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; /** - * The activator class controls the plug-in life cycle + * The activator class controls the plug-in life cycle. */ public class Activator extends AbstractUIPlugin { - // The plug-in ID + /** + * The plug-in ID. + */ public static final String PLUGIN_ID = "org.eclipse.papyrus.toolsmiths.validation.profile"; //$NON-NLS-1$ - // The shared instance + /** + * The shared instance. + */ private static Activator plugin; + /** + * The log helper. + */ public static LogHelper log; /** @@ -38,8 +45,8 @@ public class Activator extends AbstractUIPlugin { public Activator() { } - /* - * (non-Javadoc) + /** + * {@inheritDoc} * * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) */ @@ -50,8 +57,8 @@ public class Activator extends AbstractUIPlugin { log = new LogHelper(this); } - /* - * (non-Javadoc) + /** + * {@inheritDoc} * * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) */ @@ -62,9 +69,9 @@ public class Activator extends AbstractUIPlugin { } /** - * Returns the shared instance + * Returns the shared instance. * - * @return the shared instance + * @return the shared instance. */ public static Activator getDefault() { return plugin; diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/handlers/ValidateProfilePluginHandler.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/handlers/ValidateProfilePluginHandler.java new file mode 100644 index 00000000000..2c044212e7d --- /dev/null +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/handlers/ValidateProfilePluginHandler.java @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.validation.profile.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * This handler allows to validate papyrus profile plugin. + */ +public class ValidateProfilePluginHandler extends AbstractHandler { + + /** + * This allows to validate a plugin which contains papyrus static profile. + * {@inheritDoc} + * + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(final ExecutionEvent event) throws ExecutionException { + return null; + } + +} diff --git a/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/testers/ValidateProfilePluginTester.java b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/testers/ValidateProfilePluginTester.java new file mode 100644 index 00000000000..b740ea0d661 --- /dev/null +++ b/plugins/toolsmiths/validation/org.eclipse.papyrus.toolsmiths.validation.profile/src/org/eclipse/papyrus/toolsmiths/validation/profile/testers/ValidateProfilePluginTester.java @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.toolsmiths.validation.profile.testers; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IProject; +import org.eclipse.papyrus.toolsmiths.validation.common.utils.ProjectManagementUtils; + +/** + * This allows to test if a selected plug-in contains papyrus profile and its genmodel. + */ +public class ValidateProfilePluginTester extends PropertyTester { + + /** + * This allows to test if the project contains papyrus profile and its genmodel. + * {@inheritDoc} + * + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) + */ + @Override + public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) { + boolean result = false; + + if (receiver instanceof IProject) { + final IProject selectedProject = (IProject) receiver; + result = null != ProjectManagementUtils.getFileFromProject(selectedProject, "profile.uml", true) //$NON-NLS-1$ + && null != ProjectManagementUtils.getFileFromProject(selectedProject, "genmodel", true); //$NON-NLS-1$ + } + return expectedValue instanceof Boolean ? ((Boolean) expectedValue).booleanValue() == result : result; + } + +} |