Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more warnings in pde.ui and pde.ds.ui #1398

Merged
merged 2 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.ds.ui;singleton:=true
Bundle-Version: 1.3.500.qualifier
Bundle-Version: 1.3.600.qualifier
Bundle-Activator: org.eclipse.pde.internal.ds.ui.Activator
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.30.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.20.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2015 Code 9 Corporation and others.
* Copyright (c) 2008, 2024 Code 9 Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -113,17 +113,16 @@ public void setAdditionalProposalInfo(String info) {
}

@Override
@SuppressWarnings("restriction")
public IInformationControlCreator getInformationControlCreator() {
if (!BrowserInformationControl.isAvailable(null))
return null;

if (fCreator == null) {
fCreator = new AbstractReusableInformationControlCreator() {

@Override
public IInformationControl doCreateInformationControl(Shell parent) {
return new BrowserInformationControl(parent,
JFaceResources.DIALOG_FONT, false);
return new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT, false);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.internal.ui.packageview.ClassPathContainer;
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.dialogs.Dialog;
Expand Down Expand Up @@ -110,16 +109,12 @@ private void setComponentName() {
}

private IProject getProject(Object element) {
IProject project = null;
if (element instanceof IResource) {
project = ((IResource) element).getProject();
} else if (element instanceof IJavaElement) {
project = ((IJavaElement) element).getJavaProject().getProject();
} else if (element instanceof ClassPathContainer) {
project = ((ClassPathContainer) element).getJavaProject()
.getProject();
if (element instanceof IResource resource) {
return resource.getProject();
} else if (element instanceof IJavaElement javaElement) {
return javaElement.getJavaProject().getProject();
}
return project;
return null;
}

private void setComponentNameText(IProject project) {
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %name
Bundle-SymbolicName: org.eclipse.pde.ui; singleton:=true
Bundle-Version: 3.15.300.qualifier
Bundle-Version: 3.15.400.qualifier
Bundle-Activator: org.eclipse.pde.internal.ui.PDEPlugin
Bundle-Vendor: %provider-name
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2018 IBM Corporation and others.
* Copyright (c) 2003, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -165,9 +165,11 @@ protected void refreshLocal(IProgressMonitor monitor) throws CoreException {

public static void setDefaultValues(IFile generatedFile) {
try {
@SuppressWarnings("restriction")
List<ILaunchConfiguration> configs = AntLaunchShortcut.findExistingLaunchConfigurations(generatedFile);
ILaunchConfigurationWorkingCopy launchCopy;
if (configs.isEmpty()) {
@SuppressWarnings("restriction")
ILaunchConfiguration config = AntLaunchShortcut.createDefaultLaunchConfiguration(generatedFile);
launchCopy = config.getWorkingCopy();
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -261,10 +261,10 @@ private static void addItemsForExtensionWithSchema(MenuManager menu, IPluginExte
}

private static ISchema getSchema(IPluginParent parent) {
if (parent instanceof IPluginExtension) {
return getSchema((IPluginExtension) parent);
} else if (parent instanceof IPluginElement) {
return getSchema((IPluginElement) parent);
if (parent instanceof IPluginExtension pluginExtension) {
return getSchema(pluginExtension);
} else if (parent instanceof IPluginElement pluginElement) {
return getSchema(pluginElement);
} else {
return null;
}
Expand Down Expand Up @@ -1604,35 +1604,27 @@ private boolean canDropMove(IPluginElement targetElementObject, IPluginElement s
if (validateDropMoveParent(targetElementObject, sourceElementObject) == false) {
return false;
}

IDocumentElementNode sourceExtensionNode = (IDocumentElementNode) sourceElementObject;
IDocumentElementNode targetExtensionNode = (IDocumentElementNode) targetElementObject;
if (targetLocation == ViewerDropAdapter.LOCATION_BEFORE) {
IDocumentElementNode previousNode = ((IDocumentElementNode) targetElementObject).getPreviousSibling();
if (sourceElementObject.equals(previousNode)) {
return false;
}
IPluginObject targetParentObject = targetElementObject.getParent();
if ((targetParentObject instanceof IPluginParent) == false) {
if (sourceExtensionNode.equals(targetExtensionNode.getPreviousSibling())) {
return false;
}
// Paste element as a sibling of the other element (before)
return validateDropMoveSchema((IPluginParent) targetParentObject, sourceElementObject);
return targetElementObject.getParent() instanceof IPluginParent targetParent
&& validateDropMoveSchema(targetParent, sourceElementObject);
} else if (targetLocation == ViewerDropAdapter.LOCATION_AFTER) {
IDocumentElementNode nextNode = ((IDocumentElementNode) sourceElementObject).getPreviousSibling();
if (targetElementObject.equals(nextNode)) {
return false;
}
IPluginObject targetParentObject = targetElementObject.getParent();
if ((targetParentObject instanceof IPluginParent) == false) {
if (targetExtensionNode.equals(sourceExtensionNode.getPreviousSibling())) {
return false;
}
// Paste element as a sibling of the other element (after)
return validateDropMoveSchema((IPluginParent) targetParentObject, sourceElementObject);
return targetElementObject.getParent() instanceof IPluginParent targetParent
&& validateDropMoveSchema(targetParent, sourceElementObject);
} else if (targetLocation == ViewerDropAdapter.LOCATION_ON) {
IDocumentElementNode targetExtensionNode = (IDocumentElementNode) targetElementObject;
int childCount = targetExtensionNode.getChildCount();
if (childCount != 0) {
IDocumentElementNode lastNode = targetExtensionNode.getChildAt(childCount - 1);
if (sourceElementObject.equals(lastNode)) {
if (sourceExtensionNode.equals(lastNode)) {
return false;
}
}
Expand All @@ -1658,17 +1650,13 @@ private boolean validateDropMoveParent(IPluginElement targetElementObject, IPlug
}

private boolean canDropMove(IPluginExtension targetExtensionObject, IPluginElement sourceElementObject, int targetLocation) {

if (targetLocation == ViewerDropAdapter.LOCATION_BEFORE) {
return false;
} else if (targetLocation == ViewerDropAdapter.LOCATION_AFTER) {
return false;
} else if (targetLocation == ViewerDropAdapter.LOCATION_ON) {
if (targetLocation == ViewerDropAdapter.LOCATION_ON) {
IDocumentElementNode sourceExtensionNode = (IDocumentElementNode) sourceElementObject;
IDocumentElementNode targetExtensionNode = (IDocumentElementNode) targetExtensionObject;
int childCount = targetExtensionNode.getChildCount();
if (childCount != 0) {
IDocumentElementNode lastNode = targetExtensionNode.getChildAt(childCount - 1);
if (sourceElementObject.equals(lastNode)) {
if (sourceExtensionNode.equals(lastNode)) {
return false;
}
}
Expand Down Expand Up @@ -1704,15 +1692,11 @@ private boolean validateDropMoveSchema(IPluginParent targetPluginObject, IPlugin
// Something is seriously wrong, we are a plug-in parent
return false;
}
// We have a schema complex type. Either the target object has
// We have a schema complex type. Either the target object has
// attributes or the element has children.
// Generate the list of element proposals
TreeSet<ISchemaElement> elementSet = XMLElementProposalComputer.computeElementProposal(schemaElement, targetPluginNode);
// Iterate over set of valid element proposals
Iterator<ISchemaElement> iterator = elementSet.iterator();
while (iterator.hasNext()) {
// Get the proposal element tag name
String targetTagName = iterator.next().getName();
for (ISchemaElement elementProposal : elementSet) {
String targetTagName = elementProposal.getName();
// Only a source element that is found within the set of element
// proposals can be pasted
String sourceNodeTagName = ((IDocumentElementNode) sourcePluginObject).getXMLTagName();
Expand All @@ -1724,25 +1708,17 @@ private boolean validateDropMoveSchema(IPluginParent targetPluginObject, IPlugin
}

private boolean canDropMove(IPluginExtension targetExtensionObject, IPluginExtension sourceExtensionObject, int targetLocation) {

if (targetLocation == ViewerDropAdapter.LOCATION_BEFORE) {
IDocumentElementNode previousNode = ((IDocumentElementNode) targetExtensionObject).getPreviousSibling();
if (sourceExtensionObject.equals(previousNode)) {
return false;
}
IDocumentElementNode targetExtensionNode = (IDocumentElementNode) targetExtensionObject;
IDocumentElementNode sourceExtensionNode = (IDocumentElementNode) sourceExtensionObject;
return switch (targetLocation) {
// Paste extension as sibling of extension (before)
return true;
} else if (targetLocation == ViewerDropAdapter.LOCATION_AFTER) {
IDocumentElementNode nextNode = ((IDocumentElementNode) sourceExtensionObject).getPreviousSibling();
if (targetExtensionObject.equals(nextNode)) {
return false;
}
case ViewerDropAdapter.LOCATION_BEFORE -> !sourceExtensionNode
.equals(targetExtensionNode.getPreviousSibling());
// Paste extension as sibling of extension (after)
return true;
} else if (targetLocation == ViewerDropAdapter.LOCATION_ON) {
return false;
}
return false;
case ViewerDropAdapter.LOCATION_AFTER -> !targetExtensionNode
.equals(sourceExtensionNode.getPreviousSibling());
default -> false;
};
}

@Override
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, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -90,6 +90,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.forms.AbstractFormPart;
import org.eclipse.ui.forms.HyperlinkGroup;
import org.eclipse.ui.forms.IFormPart;
Expand All @@ -100,7 +101,6 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.progress.UIJob;
import org.osgi.service.event.Event;
Expand All @@ -118,7 +118,7 @@
public class TargetEditor extends FormEditor {

private final List<IManagedForm> fManagedFormPages = new ArrayList<>(2);
private ExtensionBasedTextEditor fTextualEditor;
private TextEditor fTextualEditor;
private int fSourceTabIndex;
private IDocument fTargetDocument;
private IDocumentListener fTargetDocumentListener;
Expand Down Expand Up @@ -554,8 +554,11 @@ public void resourceChanged(IResourceChangeEvent event) {
/**
* initializes fTargetDocument and fTargetDocumentListener
*/

private void addTextualEditorPage() throws PartInitException {
fTextualEditor = new ExtensionBasedTextEditor();
@SuppressWarnings("restriction")
TextEditor newEditor = new org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor();
fTextualEditor = newEditor;
fSourceTabIndex = addPage(fTextualEditor, getEditorInput());
Control editorControl = fTextualEditor.getAdapter(Control.class);
PlatformUI.getWorkbench().getHelpSystem().setHelp(editorControl, IHelpContextIds.TARGET_EDITOR_SOURCE_PAGE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2021 IBM Corporation and others.
* Copyright (c) 2009, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -190,6 +190,7 @@ private StyledString getInternalStyledString(Object element) {
} else if (element instanceof IUWrapper) {
styledString = getStyledString(((IUWrapper) element).getIU());
} else if (element instanceof IInstallableUnit iu) {
@SuppressWarnings("restriction")
String name = fTranslations.getIUProperty(iu, IInstallableUnit.PROP_NAME);
if (name == null) {
name = iu.getId();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2017 Red Hat Inc., and others
* Copyright (c) 2014, 2024 Red Hat Inc., and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -33,7 +33,6 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.wizards.importer.ProjectWithJavaResourcesImportConfigurator;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.pde.core.build.IBuildEntry;
import org.eclipse.pde.internal.core.ClasspathComputer;
Expand Down Expand Up @@ -150,8 +149,10 @@ private boolean hasOSGiManifest(IContainer container) {

@Override
public Set<IFolder> getFoldersToIgnore(IProject project, IProgressMonitor monitor) {
Set<IFolder> res = new HashSet<>();
res.addAll(new ProjectWithJavaResourcesImportConfigurator().getFoldersToIgnore(project, monitor));
@SuppressWarnings("restriction")
Set<IFolder> res = new HashSet<>(
new org.eclipse.jdt.internal.ui.wizards.importer.ProjectWithJavaResourcesImportConfigurator()
.getFoldersToIgnore(project, monitor));
IFile buildPropertiesFile = PDEProject.getBuildProperties(project);
Properties buildProperties = new Properties();
if (!buildPropertiesFile.exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
} catch (CoreException e) {
vmArgs = ""; //$NON-NLS-1$
}
vmArgs = AssertionVMArg.enableAssertInArgString(vmArgs);
if (vmArgs.length() > 0)
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs);
@SuppressWarnings("restriction")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire src_samples source folder somehow seems to be related to something like sample.properties files.
Does anybody know anything about that?

It also seems to be associated to a org.eclipse.sdk.samples provided via the site
http://www.eclipse.org/pde/samples/site.xml

But I have never heard of this and assume it's outdated if it is usable at all?

@merks, @iloveeclipse or @akurtakov do you know anything about that or can this entire source folder be removed?

String extraVMArgs = AssertionVMArg.enableAssertInArgString(vmArgs);
if (!extraVMArgs.isEmpty()) {
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, extraVMArgs);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -250,6 +250,7 @@ InstallOperation createInstallOperation(SubMonitor monitor) throws URISyntaxExce
/**
* Apply the profile changes to the currently running configuration.
*/
@SuppressWarnings("restriction")
void applyConfiguration() throws CoreException {
BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
ServiceReference<Configurator> reference = context.getServiceReference(Configurator.class);
Expand Down
Loading