Skip to content

Commit

Permalink
Merge pull request #193 from /issues/191/pde-access-2.9
Browse files Browse the repository at this point in the history
Compatibility fixes with SimRel 2024-09
  • Loading branch information
ujhelyiz authored Sep 19, 2024
2 parents 1e57f23 + 5d46adb commit 245c63f
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.viatra.query.tooling.core.project.ProjectGenerationHelper;
import org.eclipse.viatra.query.tooling.core.project.ViatraQueryNature;
import org.eclipse.viatra.query.tooling.ui.migrator.JavaProjectMigrator;
import org.eclipse.viatra.query.tooling.ui.migrator.metadata.NatureUpdaterJob;
Expand Down Expand Up @@ -43,7 +43,7 @@ public void afterCreatePartControl(XtextEditor editor) {
if (resource != null) {
final IProject project = resource.getProject();
if (project.isAccessible() && !project.isHidden() && !project.hasNature(ViatraQueryNature.NATURE_ID)) {
String question = (PDE.hasPluginNature(project))
String question = (ProjectGenerationHelper.isOpenPDEProject(project))
? String.format("Do you want to convert project %s to a VIATRA Query Project?",
project.getName())
: String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.viatra.query.patternlanguage.emf.helper.PatternLanguageHelper;
import org.eclipse.viatra.query.patternlanguage.emf.ui.builder.configuration.EMFPatternLanguageBuilderPreferenceAccess;
import org.eclipse.viatra.query.patternlanguage.emf.jvmmodel.EMFPatternLanguageJvmModelInferrerUtil;
Expand Down Expand Up @@ -100,7 +99,7 @@ private void internalFullClean(IBuildContext context, IProgressMonitor monitor)
// clean current model project
List<Pair<String, String>> removableExtensions = new ArrayList<>();
removableExtensions.addAll(GenerateQuerySpecificationExtension.getRemovableExtensionIdentifiers());
if (builderPreferenceAccess.isExtensionGenerationEnabled(modelProject) && PDE.hasPluginNature(modelProject)) {
if (builderPreferenceAccess.isExtensionGenerationEnabled(modelProject) && ProjectGenerationHelper.isOpenPDEProject(modelProject)) {
ProjectGenerationHelper.removeAllExtension(modelProject, removableExtensions);
}
}
Expand Down Expand Up @@ -131,7 +130,7 @@ private void cleanFragment(IProject modelProject, IGenerationFragment fragment)
for (OutputConfiguration config : fsa.getOutputConfigurations().values()) {
cleanFragmentFolder(fragmentProject, config);
}
if (PDE.hasPluginNature(fragmentProject) && builderPreferenceAccess.isExtensionGenerationEnabled(modelProject)) {
if (ProjectGenerationHelper.isOpenPDEProject(fragmentProject) && builderPreferenceAccess.isExtensionGenerationEnabled(modelProject)) {
ProjectGenerationHelper.removeAllExtension(fragmentProject, fragment.getRemovableExtensions());
}
// removing all fragment-related markers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.viatra.query.patternlanguage.emf.ui.builder.configuration.EMFPatternLanguageBuilderPreferenceAccess;
import org.eclipse.viatra.query.tooling.core.generator.ExtensionData;
import org.eclipse.viatra.query.tooling.core.project.ProjectGenerationHelper;
Expand Down Expand Up @@ -94,11 +93,10 @@ public void clean() {
* @param monitor
* @throws CoreException
*/
@SuppressWarnings("restriction")
public void ensure(IProject modelProject, IProgressMonitor monitor) {
// normal code generation done, extensions, packages ready to add to the plug-ins
try {
if (PDE.hasPluginNature(modelProject)) {
if (ProjectGenerationHelper.isOpenPDEProject(modelProject)) {
internalEnsure(modelProject, monitor);
} else {
logger.info(String.format("Project %s is not a plug-in project, metadata has to be managed manually.", modelProject.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.viatra.query.patternlanguage.emf.ui.EMFPatternLanguageUIPlugin;
import org.eclipse.viatra.query.tooling.core.project.ProjectGenerationHelper;
import org.eclipse.viatra.query.tooling.core.project.ViatraQueryNature;
Expand All @@ -48,7 +47,6 @@
* @author Zoltan Ujhelyi
*
*/
@SuppressWarnings("restriction")
public class NatureUpdaterJob extends Job {

private final IProject project;
Expand Down Expand Up @@ -188,7 +186,7 @@ protected IStatus run(IProgressMonitor monitor) {
removeGlobalEiq(project);
renamePatternDefinitionFiles(project);

if (PDE.hasPluginNature(project)) {
if (ProjectGenerationHelper.isOpenPDEProject(project)) {
ProjectGenerationHelper.ensureSourceFolder(project,
outputConfigurationProvider.getOutputConfigurations(), monitor);
ProjectGenerationHelper.ensureSingletonDeclaration(project);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.viatra.query.tooling.core.project.ProjectGenerationHelper;
import org.eclipse.viatra.query.tooling.core.project.ViatraQueryNature;
import org.eclipse.viatra.query.tooling.ui.migrator.MigratorConstants;
import org.eclipse.xtext.ui.XtextProjectHelper;
Expand All @@ -26,7 +26,6 @@
* @author Zoltan Ujhelyi
*
*/
@SuppressWarnings("restriction")
public class QueryProjectVersionTester extends PropertyTester {

private static final String VERSION_TESTER = "outdated";
Expand Down Expand Up @@ -71,7 +70,7 @@ public boolean test(Object receiver, String property, Object[] args, Object expe
return project.findMember(MigratorConstants.GLOBAL_EIQ_PATH) != null
|| hasIncorrectBuildCommandOrdering(project) || hasLog4jDependency(project);
} else {
return project.hasNature(PDE.PLUGIN_NATURE);
return ProjectGenerationHelper.isOpenPDEProject(project);
}
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.pde.internal.core.natures.PDE;
import org.eclipse.viatra.query.patternlanguage.emf.vql.Annotation;
import org.eclipse.viatra.query.patternlanguage.emf.vql.Pattern;
import org.eclipse.viatra.query.tooling.core.project.ProjectGenerationHelper;
Expand Down Expand Up @@ -93,10 +92,9 @@ public IProject getFragmentProject(IProject modelProject, IGenerationFragment fr
return workspaceRoot.getProject(projectName);
}

@SuppressWarnings("restriction")
private String getFragmentProjectName(IProject base, IGenerationFragment fragment) {
String name = "";
if (PDE.hasPluginNature(base)) {
if (ProjectGenerationHelper.isOpenPDEProject(base)) {
name = ProjectGenerationHelper.getBundleSymbolicName(base);
} else {
base.getName();
Expand Down
Loading

0 comments on commit 245c63f

Please sign in to comment.