Skip to content

Commit

Permalink
Revert "Workaround for issue 194 ( fixes eclipse-pde#194) (eclipse-pd…
Browse files Browse the repository at this point in the history
…e#200)"

This reverts commit c9e687a.
  • Loading branch information
HannesWell committed Jul 20, 2022
1 parent 642462b commit df2fd05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -985,10 +985,9 @@ public void handleValidate() {
try {
LaunchValidationOperation fOperation = createValidationOperation();
fOperation.run(new NullProgressMonitor());
Map<Object, Object[]> 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();
Expand All @@ -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<String, IStatus> input = new HashMap<>(1);
input.put(PDEUIMessages.AbstractLauncherToolbar_noProblems, Status.OK_STATUS);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -91,7 +90,6 @@ public void showCancelButton(boolean showCancel) {
}

public void setInput(Map<?, ?> input) {
filterOutMissingConstraintJavaPackages(input);
fInput = input;
}

Expand Down Expand Up @@ -138,39 +136,13 @@ 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));

getShell().setText(PDEUIMessages.PluginStatusDialog_pluginValidation);
Dialog.applyDialogFont(container);
return container;
}
//workaround - filter out missing java package constraint validation error for M1
public static void filterOutMissingConstraintJavaPackages(Map<?, ?> fInput) {
Set<Object> 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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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<Object, Object[]> input = op.getInput();
PluginStatusDialog.filterOutMissingConstraintJavaPackages(input);
if (input.size() == 0) {
dialog.close();
return;
}
dialog.setInput(op.getInput());
result[0] = dialog.open();
});
Expand Down

0 comments on commit df2fd05

Please sign in to comment.