diff --git a/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF b/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF index 90b7ccc3d9..6e70475a27 100644 --- a/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF +++ b/ds/org.eclipse.pde.ds.ui/META-INF/MANIFEST.MF @@ -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)", diff --git a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/TypeCompletionProposal.java b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/TypeCompletionProposal.java index 46701cb305..83819ccd59 100644 --- a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/TypeCompletionProposal.java +++ b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/editor/contentassist/TypeCompletionProposal.java @@ -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 @@ -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); } }; } diff --git a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java index 027c1071e3..7b72e6202d 100644 --- a/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java +++ b/ds/org.eclipse.pde.ds.ui/src/org/eclipse/pde/internal/ds/ui/wizards/DSFileWizardPage.java @@ -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; @@ -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) { diff --git a/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF b/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF index 9e42470713..5aab28a1b0 100644 --- a/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF +++ b/ui/org.eclipse.pde.ui/META-INF/MANIFEST.MF @@ -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 diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java index 68e8757fae..1fa5bc6cd4 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java @@ -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 @@ -165,9 +165,11 @@ protected void refreshLocal(IProgressMonitor monitor) throws CoreException { public static void setDefaultValues(IFile generatedFile) { try { + @SuppressWarnings("restriction") List configs = AntLaunchShortcut.findExistingLaunchConfigurations(generatedFile); ILaunchConfigurationWorkingCopy launchCopy; if (configs.isEmpty()) { + @SuppressWarnings("restriction") ILaunchConfiguration config = AntLaunchShortcut.createDefaultLaunchConfiguration(generatedFile); launchCopy = config.getWorkingCopy(); } else { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java index 6010c885e7..a132f9cb78 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java @@ -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 @@ -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; } @@ -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; } } @@ -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; } } @@ -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 elementSet = XMLElementProposalComputer.computeElementProposal(schemaElement, targetPluginNode); - // Iterate over set of valid element proposals - Iterator 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(); @@ -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 diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java index 1bf10d5b13..3ac514f8bf 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/TargetEditor.java @@ -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 @@ -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; @@ -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; @@ -118,7 +118,7 @@ public class TargetEditor extends FormEditor { private final List fManagedFormPages = new ArrayList<>(2); - private ExtensionBasedTextEditor fTextualEditor; + private TextEditor fTextualEditor; private int fSourceTabIndex; private IDocument fTargetDocument; private IDocumentListener fTargetDocumentListener; @@ -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); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java index a8d24885f2..6286f810bc 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java @@ -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 @@ -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(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java index fe31d57d4a..f1e00a5742 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/BundleProjectConfigurator.java @@ -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 @@ -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; @@ -150,8 +149,10 @@ private boolean hasOSGiManifest(IContainer container) { @Override public Set getFoldersToIgnore(IProject project, IProgressMonitor monitor) { - Set res = new HashSet<>(); - res.addAll(new ProjectWithJavaResourcesImportConfigurator().getFoldersToIgnore(project, monitor)); + @SuppressWarnings("restriction") + Set 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()) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitTabGroup.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitTabGroup.java index ff63499c88..1abc9e7695 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitTabGroup.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/launcher/JUnitTabGroup.java @@ -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") + String extraVMArgs = AssertionVMArg.enableAssertInArgString(vmArgs); + if (!extraVMArgs.isEmpty()) { + configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, extraVMArgs); + } } } diff --git a/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java b/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java index d83f768f12..130844413b 100644 --- a/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java +++ b/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java @@ -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 @@ -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 reference = context.getServiceReference(Configurator.class);