From 6b819300360c494036bb5efe17fcf0bde1066e9a Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Mon, 18 Jul 2022 23:04:38 +0200 Subject: [PATCH] Revert "Workaround for issue 194 ( fixes #194) (#200)" This reverts commit c9e687a44805f1fb26e422d25a1982f74291bffd. --- .../ui/launcher/AbstractPluginBlock.java | 9 +++-- .../ui/launcher/PluginStatusDialog.java | 34 ++----------------- .../PluginValidationStatusHandler.java | 9 +---- 3 files changed, 8 insertions(+), 44 deletions(-) diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java index 84461b1e85..a31ffb22cb 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/AbstractPluginBlock.java @@ -985,10 +985,9 @@ public void handleValidate() { try { LaunchValidationOperation fOperation = createValidationOperation(); fOperation.run(new NullProgressMonitor()); - Map input2 = fOperation.getInput(); - PluginStatusDialog.filterOutMissingConstraintJavaPackages(input2); + if (fDialog == null) { - if (fOperation.hasErrors() && input2.size() > 0) { + if (fOperation.hasErrors()) { fDialog = new PluginStatusDialog(getShell(), SWT.MODELESS | SWT.CLOSE | SWT.BORDER | SWT.TITLE | SWT.RESIZE); fDialog.setInput(fOperation.getInput()); fDialog.open(); @@ -1006,8 +1005,8 @@ public void handleValidate() { MessageDialog.openInformation(getShell(), PDEUIMessages.PluginStatusDialog_pluginValidation, PDEUIMessages.AbstractLauncherToolbar_noProblems); } } else { - if (input2.size() > 0) { - fDialog.refresh(input2); + if (fOperation.getInput().size() > 0) { + fDialog.refresh(fOperation.getInput()); } else { Map input = new HashMap<>(1); input.put(PDEUIMessages.AbstractLauncherToolbar_noProblems, Status.OK_STATUS); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java index db3c74c809..c23dce33b0 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginStatusDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2022 IBM Corporation and others. + * Copyright (c) 2005, 2016 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,13 +14,12 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.launcher; -import java.util.*; -import java.util.Map.Entry; +import java.util.Map; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.jface.dialogs.*; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.viewers.*; -import org.eclipse.osgi.service.resolver.*; +import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.pde.internal.ui.*; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -91,7 +90,6 @@ public void showCancelButton(boolean showCancel) { } public void setInput(Map input) { - filterOutMissingConstraintJavaPackages(input); fInput = input; } @@ -138,11 +136,6 @@ protected Control createDialogArea(Composite parent) { treeViewer.setContentProvider(new ContentProvider()); treeViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider()); treeViewer.setComparator(new ViewerComparator()); - filterOutMissingConstraintJavaPackages(fInput); - if (fInput.size() == 0) { - this.close(); - return container; - } treeViewer.setInput(fInput); treeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); @@ -150,27 +143,6 @@ protected Control createDialogArea(Composite parent) { Dialog.applyDialogFont(container); return container; } - //workaround - filter out missing java package constraint validation error for M1 - public static void filterOutMissingConstraintJavaPackages(Map fInput) { - Set keySet = new HashSet<>(); // - for (Entry entry : fInput.entrySet()) { - Object key = entry.getKey(); - Object val = entry.getValue(); - if (val instanceof ResolverError[]) { - ResolverError[] re = (ResolverError[]) val; - int count = 0; - for (ResolverError resolverError : re) { - VersionConstraint unsatisfiedConstraint = resolverError.getUnsatisfiedConstraint(); - if (unsatisfiedConstraint instanceof ImportPackageSpecification && - unsatisfiedConstraint.getName().startsWith("java."))//$NON-NLS-1$ - count++; - } - if (re.length == count) - keySet.add(key); - } - } - fInput.keySet().removeAll(keySet); - } @Override public boolean close() { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginValidationStatusHandler.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginValidationStatusHandler.java index edd207fac6..bc2ee4d5e6 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginValidationStatusHandler.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/PluginValidationStatusHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2022 eXXcellent solutions gmbh, EclipseSource Corporation + * Copyright (c) 2009, 2015 eXXcellent solutions gmbh, EclipseSource Corporation * and others. * * This program and the accompanying materials @@ -15,7 +15,6 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.launcher; -import java.util.Map; import org.eclipse.core.runtime.*; import org.eclipse.debug.core.IStatusHandler; import org.eclipse.jface.dialogs.IDialogConstants; @@ -53,12 +52,6 @@ private void displayValidationError(final LaunchValidationOperation op) throws C IShellProvider shellProvider = PlatformUI.getWorkbench().getModalDialogShellProvider(); PluginStatusDialog dialog = new PluginStatusDialog(shellProvider.getShell()); dialog.showCancelButton(true); - Map input = op.getInput(); - PluginStatusDialog.filterOutMissingConstraintJavaPackages(input); - if (input.size() == 0) { - dialog.close(); - return; - } dialog.setInput(op.getInput()); result[0] = dialog.open(); });