diff options
author | Alexander Kurtakov | 2018-04-19 14:56:15 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-04-19 14:56:15 +0000 |
commit | 81e47217447f9525d3320d7d9c8b8fec51801dab (patch) | |
tree | 96044bcaf3768bba6fb9216053fa87121700d52a | |
parent | c1f9bd3b1863e266779d56db02e64ba4ebf543f5 (diff) | |
download | org.eclipse.epp.mpc-81e47217447f9525d3320d7d9c8b8fec51801dab.tar.gz org.eclipse.epp.mpc-81e47217447f9525d3320d7d9c8b8fec51801dab.tar.xz org.eclipse.epp.mpc-81e47217447f9525d3320d7d9c8b8fec51801dab.zip |
Remove redundant type arguments in mpc.ui.
Change-Id: I63679b0aa28de3a2dcf404a213890bf98b670cbc
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
40 files changed, 152 insertions, 154 deletions
diff --git a/org.eclipse.epp.mpc.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.epp.mpc.ui/.settings/org.eclipse.jdt.core.prefs index 43f9a8ee..fe261191 100644 --- a/org.eclipse.epp.mpc.ui/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.epp.mpc.ui/.settings/org.eclipse.jdt.core.prefs @@ -78,7 +78,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore @@ -118,6 +118,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,LOW,HIGH diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogExtensionPointReader.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogExtensionPointReader.java index e0be565f..2c94464e 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogExtensionPointReader.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogExtensionPointReader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,7 +24,7 @@ import org.eclipse.osgi.util.NLS; /** * Read catalog descriptors from the <tt>org.eclipse.epp.mpc.ui.catalog</tt> extension point. - * + * * @author David Green */ class CatalogExtensionPointReader { @@ -35,7 +35,7 @@ class CatalogExtensionPointReader { if (extensionPoint == null) { throw new IllegalStateException(); } - List<CatalogDescriptor> descriptors = new ArrayList<CatalogDescriptor>(); + List<CatalogDescriptor> descriptors = new ArrayList<>(); for (IConfigurationElement element : extensionPoint.getConfigurationElements()) { if (element.getName().equals("catalog")) { //$NON-NLS-1$ try { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java index 5423d590..093fa0cd 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,9 +38,9 @@ public class CatalogRegistry { return instance; } - private final List<CatalogDescriptor> catalogDescriptors = new CopyOnWriteArrayList<CatalogDescriptor>(); + private final List<CatalogDescriptor> catalogDescriptors = new CopyOnWriteArrayList<>(); - private final Map<String, INews> catalogNews = new HashMap<String, INews>(); + private final Map<String, INews> catalogNews = new HashMap<>(); public CatalogRegistry() { catalogDescriptors.addAll(new CatalogExtensionPointReader().getCatalogDescriptors()); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUi.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUi.java index b5aabad0..dbcd2992 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUi.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUi.java @@ -134,7 +134,7 @@ public class MarketplaceClientUi { } public static Map<String, IInstallableUnit> computeInstalledIUsById(IProgressMonitor monitor) { - Map<String, IInstallableUnit> iUs = new HashMap<String, IInstallableUnit>(); + Map<String, IInstallableUnit> iUs = new HashMap<>(); BundleContext bundleContext = MarketplaceClientUi.getBundleContext(); ServiceReference<IProvisioningAgent> serviceReference = bundleContext.getServiceReference(IProvisioningAgent.class); if (serviceReference != null) { @@ -160,7 +160,7 @@ public class MarketplaceClientUi { public static Set<String> computeInstalledFeatures(IProgressMonitor monitor) { Map<String, IInstallableUnit> iusById = computeInstalledIUsById(monitor); - Set<String> features = new HashSet<String>(iusById.keySet()); + Set<String> features = new HashSet<>(iusById.keySet()); if (features.isEmpty()) { // probably a self-hosted environment diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUiPlugin.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUiPlugin.java index 07697e78..e7d21f42 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUiPlugin.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceClientUiPlugin.java @@ -119,12 +119,11 @@ public class MarketplaceClientUiPlugin extends AbstractUIPlugin { instance = this; super.start(context); MarketplaceClientUiPlugin.bundleContext = context; - clientServiceTracker = new ServiceTracker<IMarketplaceClientService, IMarketplaceClientService>(context, - IMarketplaceClientService.class, null); + clientServiceTracker = new ServiceTracker<>(context, IMarketplaceClientService.class, null); clientServiceTracker.open(); resourceProvider = new ResourceProvider(); - Hashtable<String, String> props = new Hashtable<String, String>(2); + Hashtable<String, String> props = new Hashtable<>(2); props.put(org.eclipse.osgi.service.debug.DebugOptions.LISTENER_SYMBOLICNAME, MarketplaceClientUi.BUNDLE_ID); context.registerService(DebugOptionsListener.class.getName(), (DebugOptionsListener) options -> { DebugTrace debugTrace = null; diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceCatalog.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceCatalog.java index f5e18241..02eeebe8 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceCatalog.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceCatalog.java @@ -61,7 +61,7 @@ import org.eclipse.osgi.util.NLS; */ public class MarketplaceCatalog extends Catalog { - private final Map<String, Version> repositoryIuVersionById = new HashMap<String, Version>(); + private final Map<String, Version> repositoryIuVersionById = new HashMap<>(); private INews news; @@ -137,7 +137,7 @@ public class MarketplaceCatalog extends Catalog { SubMonitor progress = SubMonitor.convert(monitor, Messages.MarketplaceCatalog_checkingForUpdates, 10000000); try { Map<String, IInstallableUnit> installedIUs = calculateInstalledIUs(progress.newChild(100000)); - List<MarketplaceNodeCatalogItem> updateCheckNeeded = new ArrayList<MarketplaceNodeCatalogItem>(); + List<MarketplaceNodeCatalogItem> updateCheckNeeded = new ArrayList<>(); for (CatalogItem item : getItems()) { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; @@ -163,7 +163,7 @@ public class MarketplaceCatalog extends Catalog { } private Map<String, IInstallableUnit> calculateInstalledIUs(IProgressMonitor monitor) { - Map<String, IInstallableUnit> installedIUs = new HashMap<String, IInstallableUnit>(); + Map<String, IInstallableUnit> installedIUs = new HashMap<>(); List<AbstractDiscoveryStrategy> discoveryStrategies = getDiscoveryStrategies(); SubMonitor progress = SubMonitor.convert(monitor, discoveryStrategies.size() * 1000); for (AbstractDiscoveryStrategy discoveryStrategy : discoveryStrategies) { @@ -183,7 +183,7 @@ public class MarketplaceCatalog extends Catalog { protected IStatus checkForUpdates(List<MarketplaceNodeCatalogItem> updateCheckNeeded, final Map<String, IInstallableUnit> installedIUs, final IProgressMonitor monitor) { - Map<URI, List<MarketplaceNodeCatalogItem>> installedCatalogItemsByUpdateUri = new HashMap<URI, List<MarketplaceNodeCatalogItem>>(); + Map<URI, List<MarketplaceNodeCatalogItem>> installedCatalogItemsByUpdateUri = new HashMap<>(); for (MarketplaceNodeCatalogItem catalogItem : updateCheckNeeded) { INode node = catalogItem.getData(); @@ -196,7 +196,7 @@ public class MarketplaceCatalog extends Catalog { URI uri = new URI(updateurl); List<MarketplaceNodeCatalogItem> catalogItemsThisSite = installedCatalogItemsByUpdateUri.get(uri); if (catalogItemsThisSite == null) { - catalogItemsThisSite = new ArrayList<MarketplaceNodeCatalogItem>(); + catalogItemsThisSite = new ArrayList<>(); installedCatalogItemsByUpdateUri.put(uri, catalogItemsThisSite); } catalogItemsThisSite.add(catalogItem); @@ -239,7 +239,7 @@ public class MarketplaceCatalog extends Catalog { IQueryResult<IInstallableUnit> result = repository.query(query, pm); // compute highest version for all available IUs. - Map<String, Version> repositoryIuVersionById = new HashMap<String, Version>(); + Map<String, Version> repositoryIuVersionById = new HashMap<>(); for (IInstallableUnit iu : result) { String key1 = createRepositoryIuKey(uri.toString(), iu.getId()); Version version = iu.getVersion(); @@ -366,10 +366,10 @@ public class MarketplaceCatalog extends Catalog { } // reset, keeping no items but the same tags, categories and certifications - List<CatalogItem> items = new ArrayList<CatalogItem>(); - List<CatalogCategory> categories = new ArrayList<CatalogCategory>(getCategories()); - List<Certification> certifications = new ArrayList<Certification>(getCertifications()); - List<Tag> tags = new ArrayList<Tag>(getTags()); + List<CatalogItem> items = new ArrayList<>(); + List<CatalogCategory> categories = new ArrayList<>(getCategories()); + List<Certification> certifications = new ArrayList<>(getCertifications()); + List<Tag> tags = new ArrayList<>(getTags()); if (!refresh) { for (CatalogCategory catalogCategory : categories) { catalogCategory.getItems().clear(); @@ -511,7 +511,7 @@ public class MarketplaceCatalog extends Catalog { } public List<IMarket> getMarkets() { - List<IMarket> markets = new ArrayList<IMarket>(); + List<IMarket> markets = new ArrayList<>(); for (CatalogCategory category : getCategories()) { if (category instanceof MarketplaceCategory) { MarketplaceCategory marketplaceCategory = (MarketplaceCategory) category; diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceDiscoveryStrategy.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceDiscoveryStrategy.java index ed96d5c4..81cb1380 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceDiscoveryStrategy.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceDiscoveryStrategy.java @@ -181,7 +181,7 @@ public class MarketplaceDiscoveryStrategy extends AbstractDiscoveryStrategy { IUserFavoritesService favoritesService = marketplaceService.getUserFavoritesService(); if (favoritesService != null) { if (loginListeners == null) { - loginListeners = new CopyOnWriteArrayList<LoginListener>(); + loginListeners = new CopyOnWriteArrayList<>(); } if (!loginListeners.contains(loginListener)) { loginListeners.add(loginListener); @@ -294,7 +294,7 @@ public class MarketplaceDiscoveryStrategy extends AbstractDiscoveryStrategy { catalogItem.setUserFavorite(userFavoritesSupported ? node.getUserFavorite() : null); IIus ius = node.getIus(); if (ius != null) { - List<MarketplaceNodeInstallableUnitItem> installableUnitItems = new ArrayList<MarketplaceNodeInstallableUnitItem>(); + List<MarketplaceNodeInstallableUnitItem> installableUnitItems = new ArrayList<>(); for (IIu iu : ius.getIuElements()) { MarketplaceNodeInstallableUnitItem iuItem = new MarketplaceNodeInstallableUnitItem(); iuItem.init(iu); @@ -720,7 +720,7 @@ public class MarketplaceDiscoveryStrategy extends AbstractDiscoveryStrategy { MarketplaceCategory catalogCategory = findMarketplaceCategory(progress.newChild(1)); List<CatalogItem> items = catalogCategory.getItems(); if (hasUserFavoritesService()) { - Map<String, INode> nodes = new HashMap<String, INode>(); + Map<String, INode> nodes = new HashMap<>(); for (CatalogItem item : items) { Object data = item.getData(); if (data instanceof INode) { @@ -733,7 +733,7 @@ public class MarketplaceDiscoveryStrategy extends AbstractDiscoveryStrategy { } try { applyShellProvider(); - marketplaceService.userFavorites(new ArrayList<INode>(nodes.values()), progress.newChild(500)); + marketplaceService.userFavorites(new ArrayList<>(nodes.values()), progress.newChild(500)); for (CatalogItem catalogItem : items) { if (catalogItem instanceof MarketplaceNodeCatalogItem) { MarketplaceNodeCatalogItem nodeItem = (MarketplaceNodeCatalogItem) catalogItem; @@ -825,7 +825,7 @@ public class MarketplaceDiscoveryStrategy extends AbstractDiscoveryStrategy { } public void performQuery(IProgressMonitor monitor, Set<String> nodeIds) throws CoreException { - Set<INode> nodes = new HashSet<INode>(); + Set<INode> nodes = new HashSet<>(); for (String nodeId : nodeIds) { Node node = new Node(); node.setId(nodeId); @@ -915,14 +915,14 @@ public class MarketplaceDiscoveryStrategy extends AbstractDiscoveryStrategy { SubMonitor progress = SubMonitor.convert(monitor, Messages.MarketplaceDiscoveryStrategy_sendingErrorNotification, 100); try { - Set<Node> nodes = new HashSet<Node>(); + Set<Node> nodes = new HashSet<>(); for (CatalogItem item : items) { Object data = item.getData(); if (data instanceof INode) { nodes.add((Node) data); } } - Set<String> iuIdsAndVersions = new HashSet<String>(); + Set<String> iuIdsAndVersions = new HashSet<>(); for (IInstallableUnit iu : operationIUs) { String id = iu.getId(); String version = iu.getVersion() == null ? null : iu.getVersion().toString(); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java index 82c9d40a..5aa4fabb 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -57,9 +57,9 @@ public class MarketplaceInfo { private static final String PERSISTENT_FILE = MarketplaceInfo.class.getSimpleName() + ".xml"; //$NON-NLS-1$ - private Map<String, List<String>> nodeKeyToIU = new HashMap<String, List<String>>(); + private Map<String, List<String>> nodeKeyToIU = new HashMap<>(); - private Map<String, List<String>> iuToNodeKey = new HashMap<String, List<String>>(); + private Map<String, List<String>> iuToNodeKey = new HashMap<>(); public MarketplaceInfo() { } @@ -99,7 +99,7 @@ public class MarketplaceInfo { */ @Deprecated public synchronized Set<INode> computeInstalledNodes(URL repositoryUrl, Set<String> installedIus) { - Set<INode> nodes = new HashSet<INode>(); + Set<INode> nodes = new HashSet<>(); String keyPrefix = computeUrlKey(repositoryUrl) + '#'; for (Map.Entry<String, List<String>> entry : nodeKeyToIU.entrySet()) { @@ -128,7 +128,7 @@ public class MarketplaceInfo { * @return a set of node ids, or an empty set if there are no known installed nodes */ public synchronized Set<INode> computeInstalledNodes(URL repositoryUrl, Map<String, IInstallableUnit> installedIus) { - Set<INode> nodes = new HashSet<INode>(); + Set<INode> nodes = new HashSet<>(); String keyPrefix = computeUrlKey(repositoryUrl) + '#'; for (Map.Entry<String, List<String>> entry : nodeKeyToIU.entrySet()) { @@ -193,7 +193,7 @@ public class MarketplaceInfo { public boolean computeInstalled(Set<String> installedFeatures, INode node) { if (node.getIus() != null && !node.getIus().getIuElements().isEmpty()) { boolean all = true; - Set<String> ius = new HashSet<String>(); + Set<String> ius = new HashSet<>(); for (IIu iu : node.getIus().getIuElements()) { if (!iu.isOptional()) { ius.add(iu.getId()); @@ -247,8 +247,8 @@ public class MarketplaceInfo { public synchronized void map(URL marketUrl, INode node) { String itemKey = computeItemKey(marketUrl, node); if (node.getIus() != null && !node.getIus().getIuElements().isEmpty()) { - List<String> ius = new ArrayList<String>(); - Set<String> uniqueIus = new HashSet<String>(); + List<String> ius = new ArrayList<>(); + Set<String> uniqueIus = new HashSet<>(); List<IIu> iuElements = node.getIus().getIuElements(); for (IIu iIu : iuElements) { if (uniqueIus.add(iIu.getId())) { @@ -263,7 +263,7 @@ public class MarketplaceInfo { catalogNodes.add(itemKey); } } else { - catalogNodes = new ArrayList<String>(1); + catalogNodes = new ArrayList<>(1); catalogNodes.add(itemKey); iuToNodeKey.put(iu, catalogNodes); } diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceNodeCatalogItem.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceNodeCatalogItem.java index 1ad17d0e..19fa41f1 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceNodeCatalogItem.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceNodeCatalogItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -58,7 +58,7 @@ public class MarketplaceNodeCatalogItem extends CatalogItem { private Boolean userFavorite; - private List<MarketplaceNodeInstallableUnitItem> installableUnitItems = new ArrayList<MarketplaceNodeInstallableUnitItem>(); + private List<MarketplaceNodeInstallableUnitItem> installableUnitItems = new ArrayList<>(); private transient PropertyChangeSupport propertyChangeSupport; @@ -102,7 +102,7 @@ public class MarketplaceNodeCatalogItem extends CatalogItem { private void updateInstallableUnitItems() { List<IIu> iuElements = getData().getIus().getIuElements(); - List<MarketplaceNodeInstallableUnitItem> installableUnitItems = new ArrayList<MarketplaceNodeInstallableUnitItem>(); + List<MarketplaceNodeInstallableUnitItem> installableUnitItems = new ArrayList<>(); for (String iuId : installableUnits) { MarketplaceNodeInstallableUnitItem iuItem = getInstallableUnitItem(iuId); if (iuItem == null) { @@ -133,8 +133,7 @@ public class MarketplaceNodeCatalogItem extends CatalogItem { } public void setInstallableUnitItems(List<MarketplaceNodeInstallableUnitItem> installableUnitItems) { - doSetInstallableUnitItems(new ArrayList<MarketplaceNodeInstallableUnitItem>( - installableUnitItems)); + doSetInstallableUnitItems(new ArrayList<>(installableUnitItems)); updateInstallableUnits(); } @@ -231,7 +230,7 @@ public class MarketplaceNodeCatalogItem extends CatalogItem { } public List<Operation> getAvailableOperations() { - List<Operation> available = new ArrayList<Operation>(); + List<Operation> available = new ArrayList<>(); if (!getInstallableUnits().isEmpty()) { if (isInstalled()) { if (maybeUpdateAvailable()) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/ResourceProvider.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/ResourceProvider.java index 6d076b08..86a6d17e 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/ResourceProvider.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/ResourceProvider.java @@ -60,7 +60,7 @@ public class ResourceProvider { private final FutureTask<URL> delegate; ResourceFuture(final File dir, final String resourceName) { - delegate = new FutureTask<URL>(() -> { + delegate = new FutureTask<>(() -> { if (input == null) { throw new IllegalStateException(); } @@ -191,7 +191,7 @@ public class ResourceProvider { private File dir; - private final Map<String, ResourceFuture> resources = new ConcurrentHashMap<String, ResourceFuture>(); + private final Map<String, ResourceFuture> resources = new ConcurrentHashMap<>(); public synchronized void init() throws IOException { if (dir != null) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/AbstractMarketplaceWizardCommand.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/AbstractMarketplaceWizardCommand.java index 8d773650..9d75426f 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/AbstractMarketplaceWizardCommand.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/AbstractMarketplaceWizardCommand.java @@ -158,7 +158,7 @@ public abstract class AbstractMarketplaceWizardCommand extends AbstractHandler i public IStatus installRemoteCatalogs() { try { - final AtomicReference<List<? extends ICatalog>> result = new AtomicReference<List<? extends ICatalog>>(); + final AtomicReference<List<? extends ICatalog>> result = new AtomicReference<>(); PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> { try { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/MarketplaceWizardCommand.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/MarketplaceWizardCommand.java index a047a3fe..ca275799 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/MarketplaceWizardCommand.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/commands/MarketplaceWizardCommand.java @@ -68,7 +68,7 @@ public class MarketplaceWizardCommand extends AbstractMarketplaceWizardCommand i final ComboTagFilter marketFilter = new ComboTagFilter() { @Override public void catalogUpdated(boolean wasCancelled) { - List<Tag> choices = new ArrayList<Tag>(); + List<Tag> choices = new ArrayList<>(); List<IMarket> markets = catalog.getMarkets(); for (IMarket market : markets) { Tag marketTag = new Tag(IMarket.class, market.getId(), market.getName()); @@ -136,10 +136,10 @@ public class MarketplaceWizardCommand extends AbstractMarketplaceWizardCommand i } private void updateCategoryChoices(final ComboTagFilter marketCategoryTagFilter, final ComboTagFilter marketFilter) { - Set<Tag> newChoices = new HashSet<Tag>(); - List<Tag> choices = new ArrayList<Tag>(); + Set<Tag> newChoices = new HashSet<>(); + List<Tag> choices = new ArrayList<>(); - Set<IMarket> selectedMarkets = new HashSet<IMarket>(); + Set<IMarket> selectedMarkets = new HashSet<>(); for (Tag marketTag : marketFilter.getSelected()) { selectedMarkets.add((IMarket) marketTag.getData()); } diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/CollectMissingNaturesVisitor.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/CollectMissingNaturesVisitor.java index 758f38be..af1b4b33 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/CollectMissingNaturesVisitor.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/CollectMissingNaturesVisitor.java @@ -21,7 +21,7 @@ import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.runtime.CoreException; final class CollectMissingNaturesVisitor implements IResourceDeltaVisitor { - private final Set<String> missingNatures = new HashSet<String>(); + private final Set<String> missingNatures = new HashSet<>(); @Override public boolean visit(IResourceDelta delta) throws CoreException { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/DiscoverFileSupportJob.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/DiscoverFileSupportJob.java index 7ccf87dc..5de4b1bd 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/DiscoverFileSupportJob.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/DiscoverFileSupportJob.java @@ -73,7 +73,7 @@ final class DiscoverFileSupportJob extends Job { private IStatus run(IMarketplaceService marketplaceService, IProgressMonitor monitor) { final List<String> fileExtensions = getFileExtensions(fileName); - final List<String> fileExtensionTags = new ArrayList<String>(); + final List<String> fileExtensionTags = new ArrayList<>(); for (String string : fileExtensions) { fileExtensionTags.add(getFileExtensionTag(string)); @@ -119,7 +119,7 @@ final class DiscoverFileSupportJob extends Job { Collections.sort(fileExtensionTags, (s1, s2) -> (s2.length() - s2.replace(".", "").length()) - (s1.length() - s1.replace(".", "").length())); - Map<String, List<INode>> nodesByTags = new HashMap<String, List<INode>>(); + Map<String, List<INode>> nodesByTags = new HashMap<>(); for (INode iNode : nodes) { for (ITag nodeTag : iNode.getTags().getTags()) { boolean foundTag = false; @@ -128,7 +128,7 @@ final class DiscoverFileSupportJob extends Job { if (nodesByTags.containsKey(tag)) { nodesByTags.get(tag).add(iNode); } else { - List<INode> newNodeList = new ArrayList<INode>(); + List<INode> newNodeList = new ArrayList<>(); newNodeList.add(iNode); nodesByTags.put(tag, newNodeList); } @@ -141,7 +141,7 @@ final class DiscoverFileSupportJob extends Job { } } } - List<INode> ordered = new ArrayList<INode>(); + List<INode> ordered = new ArrayList<>(); for (String tag : fileExtensionTags) { if (nodesByTags.containsKey(tag)) { ordered.addAll(nodesByTags.get(tag)); @@ -167,7 +167,7 @@ final class DiscoverFileSupportJob extends Job { * eg "file.tar.gz" returns ["file.tar.gz", "tar.gz", "gz"] */ static List<String> getFileExtensions(String fileName) { - List<String> extensions = new ArrayList<String>(); + List<String> extensions = new ArrayList<>(); while (fileName.length() > 0) { extensions.add(fileName); if (fileName.indexOf('.') == -1) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/MissingNatureDetector.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/MissingNatureDetector.java index 40b8ef21..f756e03b 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/MissingNatureDetector.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/MissingNatureDetector.java @@ -39,9 +39,9 @@ public class MissingNatureDetector implements IStartup, IPropertyChangeListener private JobGroup allJobs; - private final Set<String> detectedNatures = new HashSet<String>(); + private final Set<String> detectedNatures = new HashSet<>(); - private final Set<DiscoverNatureSupportJob> lookupJobs = new HashSet<DiscoverNatureSupportJob>(); + private final Set<DiscoverNatureSupportJob> lookupJobs = new HashSet<>(); private final IResourceChangeListener projectOpenListener = event -> { if (event.getDelta() == null) { @@ -99,7 +99,7 @@ public class MissingNatureDetector implements IStartup, IPropertyChangeListener if (!allJobs.getActiveJobs().isEmpty()) { return; } - candidates = new HashMap<String, Collection<INode>>(); + candidates = new HashMap<>(); for (DiscoverNatureSupportJob lookupJob : lookupJobs) { Collection<INode> entryCandidates = lookupJob.getCandidates(); if (entryCandidates != null && !entryCandidates.isEmpty()) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsDialog.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsDialog.java index e4758209..6fdf3111 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsDialog.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsDialog.java @@ -52,7 +52,7 @@ final class ShowNatureProposalsDialog extends TitleAreaDialog { ShowNatureProposalsDialog(Shell parentShell, Map<String, Collection<INode>> candidates) { super(parentShell); this.candidates = candidates; - this.selectedNatures = new LinkedHashSet<String>(candidates.keySet()); + this.selectedNatures = new LinkedHashSet<>(candidates.keySet()); } @Override diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsJob.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsJob.java index b2562ea4..b9b4a7f9 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsJob.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/discovery/ShowNatureProposalsJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -45,7 +45,7 @@ final class ShowNatureProposalsJob extends UIJob { Set<String> natureIds = dialog.getSelectedNatures(); IMarketplaceClientService marketplaceClientService = MarketplaceClient.getMarketplaceClientService(); IMarketplaceClientConfiguration config = marketplaceClientService.newConfiguration(); - Set<INode> allNodes = new HashSet<INode>(); + Set<INode> allNodes = new HashSet<>(); for (String natureId : natureIds) { allNodes.addAll(candidates.get(natureId)); } diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/AbstractProvisioningOperation.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/AbstractProvisioningOperation.java index 1a091ad1..d737ba31 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/AbstractProvisioningOperation.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/AbstractProvisioningOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -52,7 +52,7 @@ public abstract class AbstractProvisioningOperation implements IRunnableWithProg if (installableConnectors == null || installableConnectors.isEmpty()) { throw new IllegalArgumentException(); } - this.items = new ArrayList<CatalogItem>(installableConnectors); + this.items = new ArrayList<>(installableConnectors); this.provisioningUI = ProvisioningUI.getDefaultUI(); } @@ -61,12 +61,12 @@ public abstract class AbstractProvisioningOperation implements IRunnableWithProg // tell p2 that it's okay to use these repositories ProvisioningSession session = ProvisioningUI.getDefaultUI().getSession(); RepositoryTracker repositoryTracker = ProvisioningUI.getDefaultUI().getRepositoryTracker(); - repositoryLocations = new HashSet<URI>(); + repositoryLocations = new HashSet<>(); if (addedRepositoryLocations == null) { - addedRepositoryLocations = new HashSet<URI>(); + addedRepositoryLocations = new HashSet<>(); } - Set<URI> knownRepositories = new HashSet<URI>(Arrays.asList(repositoryTracker.getKnownRepositories(session))); + Set<URI> knownRepositories = new HashSet<>(Arrays.asList(repositoryTracker.getKnownRepositories(session))); monitor.setWorkRemaining(items.size() * 5); for (CatalogItem descriptor : items) { @@ -83,7 +83,7 @@ public abstract class AbstractProvisioningOperation implements IRunnableWithProg } // fetch meta-data for these repositories - ArrayList<IMetadataRepository> repositories = new ArrayList<IMetadataRepository>(); + ArrayList<IMetadataRepository> repositories = new ArrayList<>(); monitor.setWorkRemaining(repositories.size()); IMetadataRepositoryManager manager = (IMetadataRepositoryManager) session.getProvisioningAgent().getService( IMetadataRepositoryManager.SERVICE_NAME); @@ -103,7 +103,7 @@ public abstract class AbstractProvisioningOperation implements IRunnableWithProg */ protected List<IInstallableUnit> queryInstallableUnits(SubMonitor monitor, List<IMetadataRepository> repositories) throws URISyntaxException { - final List<IInstallableUnit> installableUnits = new ArrayList<IInstallableUnit>(); + final List<IInstallableUnit> installableUnits = new ArrayList<>(); monitor.setWorkRemaining(repositories.size()); for (final IMetadataRepository repository : repositories) { @@ -124,7 +124,7 @@ public abstract class AbstractProvisioningOperation implements IRunnableWithProg } private Set<String> getDescriptorIds(final IMetadataRepository repository) throws URISyntaxException { - final Set<String> installableUnitIdsThisRepository = new HashSet<String>(); + final Set<String> installableUnitIdsThisRepository = new HashSet<>(); // determine all installable units for this repository for (CatalogItem descriptor : items) { if (descriptor.getSiteUrl() != null @@ -136,7 +136,7 @@ public abstract class AbstractProvisioningOperation implements IRunnableWithProg } protected Set<String> getFeatureIds(CatalogItem descriptor) { - Set<String> featureIds = new HashSet<String>(); + Set<String> featureIds = new HashSet<>(); for (String id : descriptor.getInstallableUnits()) { if (!id.endsWith(P2_FEATURE_GROUP_SUFFIX)) { id += P2_FEATURE_GROUP_SUFFIX; diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/CompositeProfileChangeOperation.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/CompositeProfileChangeOperation.java index 81d7c9eb..7e62a1ea 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/CompositeProfileChangeOperation.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/CompositeProfileChangeOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,7 +41,7 @@ class CompositeProfileChangeOperation extends InstallOperation { private final ProvisioningSession session; - private final List<ProfileChangeOperation> operations = new ArrayList<ProfileChangeOperation>(); + private final List<ProfileChangeOperation> operations = new ArrayList<>(); public CompositeProfileChangeOperation add(ProfileChangeOperation operation) { operations.add(operation); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ProfileChangeOperationComputer.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ProfileChangeOperationComputer.java index 03562e78..6e5952a3 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ProfileChangeOperationComputer.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ProfileChangeOperationComputer.java @@ -145,7 +145,7 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio if (resolutionStrategy == null) { throw new IllegalArgumentException(); } - this.featureEntries = new ArrayList<FeatureEntry>(featureEntries); + this.featureEntries = new ArrayList<>(featureEntries); this.operationType = operationType; this.resolutionStrategy = resolutionStrategy; this.dependenciesRepository = dependenciesRepository; @@ -253,7 +253,7 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio } private IInstallableUnit[] computeInstalledIus(IInstallableUnit[] ius) { - List<IInstallableUnit> installedIus = new ArrayList<IInstallableUnit>(ius.length); + List<IInstallableUnit> installedIus = new ArrayList<>(ius.length); Map<String, IInstallableUnit> iUsById = MarketplaceClientUi.computeInstalledIUsById(new NullProgressMonitor()); for (IInstallableUnit iu : ius) { @@ -312,7 +312,7 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio private ProfileChangeOperation resolve(IProgressMonitor monitor, ProfileChangeOperationFactory operationFactory, IInstallableUnit[] ius, URI[] repositories) throws CoreException { List<IInstallableUnit> installableUnits = Arrays.asList(ius); - List<ResolutionStrategy> strategies = new ArrayList<ProfileChangeOperationComputer.ResolutionStrategy>(2); + List<ResolutionStrategy> strategies = new ArrayList<>(2); switch (resolutionStrategy) { case FALLBACK_STRATEGY: strategies.add(ResolutionStrategy.SELECTED_REPOSITORIES); @@ -332,7 +332,7 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio SubMonitor subMonitor = SubMonitor.convert(monitor, strategies.size() * workPerStrategy + workPerStrategy); Set<URI> previousRepositoryLocations = null; for (ResolutionStrategy strategy : strategies) { - Set<URI> repositoryLocations = new HashSet<URI>(Arrays.asList(repositories)); + Set<URI> repositoryLocations = new HashSet<>(Arrays.asList(repositories)); if (strategy == ResolutionStrategy.SELECTED_REPOSITORIES) { repositoryLocations.addAll(Arrays.asList(repositories)); } @@ -392,7 +392,7 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio try { // calculate installed ius Map<String, IInstallableUnit> installedIUs = MarketplaceClientUi.computeInstalledIUsById(monitor); - List<IInstallableUnit> installableUnits = new ArrayList<IInstallableUnit>(installedIUs.values()); + List<IInstallableUnit> installableUnits = new ArrayList<>(installedIUs.values()); pruneNonUninstall(installableUnits); @@ -432,7 +432,7 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio } private void pruneNonInstall(List<IInstallableUnit> installableUnits) { - Set<String> installableFeatureIds = new HashSet<String>(); + Set<String> installableFeatureIds = new HashSet<>(); for (FeatureEntry featureEntry : featureEntries) { Operation operation = featureEntry.computeChangeOperation(); if (operation == Operation.INSTALL || operation == Operation.UPDATE) { @@ -449,7 +449,7 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio } private void pruneNonUninstall(List<IInstallableUnit> installableUnits) { - Set<String> installableFeatureIds = new HashSet<String>(); + Set<String> installableFeatureIds = new HashSet<>(); for (FeatureEntry featureEntry : featureEntries) { if (featureEntry.computeChangeOperation() == Operation.UNINSTALL) { installableFeatureIds.add(featureEntry.getFeatureDescriptor().getId()); @@ -471,12 +471,12 @@ public class ProfileChangeOperationComputer extends AbstractProvisioningOperatio */ private void checkForUnavailable(final List<IInstallableUnit> installableUnits) throws CoreException { // at least one selected connector could not be found in a repository - Set<String> foundIds = new HashSet<String>(); + Set<String> foundIds = new HashSet<>(); for (IInstallableUnit unit : installableUnits) { foundIds.add(unit.getId()); } - Set<String> installFeatureIds = new HashSet<String>(); + Set<String> installFeatureIds = new HashSet<>(); for (FeatureEntry entry : featureEntries) { Operation operation = entry.computeChangeOperation(); if (operation == Operation.INSTALL || operation == Operation.UPDATE) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ResolveFeatureNamesOperation.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ResolveFeatureNamesOperation.java index 90f0490e..0210e14d 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ResolveFeatureNamesOperation.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/operations/ResolveFeatureNamesOperation.java @@ -30,9 +30,9 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; */ public class ResolveFeatureNamesOperation extends AbstractProvisioningOperation { - private final Set<FeatureDescriptor> featureDescriptors = new HashSet<FeatureDescriptor>(); + private final Set<FeatureDescriptor> featureDescriptors = new HashSet<>(); - private final Set<FeatureDescriptor> unresolvedFeatureDescriptors = new HashSet<FeatureDescriptor>(); + private final Set<FeatureDescriptor> unresolvedFeatureDescriptors = new HashSet<>(); public ResolveFeatureNamesOperation(List<CatalogItem> installableConnectors) { super(installableConnectors); @@ -46,7 +46,7 @@ public class ResolveFeatureNamesOperation extends AbstractProvisioningOperation try { List<IMetadataRepository> repositories = addRepositories(monitor.newChild(50)); List<IInstallableUnit> installableUnits = queryInstallableUnits(monitor.newChild(50), repositories); - Set<String> resolvedFeatureIds = new HashSet<String>(); + Set<String> resolvedFeatureIds = new HashSet<>(); for (IInstallableUnit iu : installableUnits) { FeatureDescriptor descriptor = new FeatureDescriptor(iu); resolvedFeatureIds.add(descriptor.getId()); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/util/ConcurrentTaskManager.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/util/ConcurrentTaskManager.java index fef2fe2d..044a68fc 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/util/ConcurrentTaskManager.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/util/ConcurrentTaskManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -49,7 +49,7 @@ public class ConcurrentTaskManager { private final java.util.concurrent.ExecutorService executor; - private final List<Future<?>> futures = new ArrayList<Future<?>>(); + private final List<Future<?>> futures = new ArrayList<>(); private final String taskName; diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/AbstractTagFilter.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/AbstractTagFilter.java index b4333957..82461215 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/AbstractTagFilter.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/AbstractTagFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,7 @@ import org.eclipse.equinox.internal.p2.discovery.model.Tag; /** * An abstract implementation of a filter that operates on {@link Tag tags}. - * + * * @author David Green * @see Tag */ @@ -33,7 +33,7 @@ public abstract class AbstractTagFilter extends MarketplaceFilter { private List<Tag> choices; - private final Set<Tag> selected = new HashSet<Tag>(); + private final Set<Tag> selected = new HashSet<>(); private boolean selectAllOnNoSelection; @@ -49,7 +49,7 @@ public abstract class AbstractTagFilter extends MarketplaceFilter { /** * subclasses may override to determine how tagging is detected - * + * * @return true if and only if the given item has one of the selected tags. */ protected boolean hasSelectedTag(CatalogItem item) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/CatalogSwitcher.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/CatalogSwitcher.java index c43541d7..bcfe4f7f 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/CatalogSwitcher.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/CatalogSwitcher.java @@ -63,7 +63,7 @@ public class CatalogSwitcher extends Composite implements ISelectionProvider { private final ImageRegistry imageRegistry = new ImageRegistry(); - private final List<ISelectionChangedListener> listeners = new LinkedList<ISelectionChangedListener>(); + private final List<ISelectionChangedListener> listeners = new LinkedList<>(); private CatalogDescriptor selection; @@ -114,7 +114,7 @@ public class CatalogSwitcher extends Composite implements ISelectionProvider { private void createHeader(Composite parent) { CatalogCategory fakeCategory = new CatalogCategory(); fakeCategory.setName(Messages.CatalogSwitcher_Header); - CategoryItem<CatalogCategory> header = new CategoryItem<CatalogCategory>(parent, SWT.NONE, + CategoryItem<CatalogCategory> header = new CategoryItem<>(parent, SWT.NONE, new DiscoveryResources(parent.getDisplay()), fakeCategory); MarketplaceViewer.setSeparatorVisible(header, false); MarketplaceViewer.fixLayout(header); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/DropDownButton.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/DropDownButton.java index 4faffeb8..efbf752d 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/DropDownButton.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/DropDownButton.java @@ -231,7 +231,7 @@ public class DropDownButton { private DropDownSelectionListenerWrapper findWrapper(final SelectionListener listener) { DropDownSelectionListenerWrapper wrapper = null; if (selectionListenerWrappers == null) { - selectionListenerWrappers = new ArrayList<DropDownButton.DropDownSelectionListenerWrapper>(); + selectionListenerWrappers = new ArrayList<>(); } for (DropDownSelectionListenerWrapper existingWrapper : selectionListenerWrappers) { if (existingWrapper.getDelegate() == listener) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FavoritesViewer.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FavoritesViewer.java index 60910654..bf787df9 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FavoritesViewer.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FavoritesViewer.java @@ -140,7 +140,7 @@ public class FavoritesViewer extends CatalogViewer { Object element = items.next(); if (element instanceof MarketplaceNodeCatalogItem) { if (selectableItems == null) { - selectableItems = new ArrayList<MarketplaceNodeCatalogItem>(); + selectableItems = new ArrayList<>(); } selectableItems.add((MarketplaceNodeCatalogItem) element); } @@ -357,7 +357,7 @@ public class FavoritesViewer extends CatalogViewer { @Override protected void catalogUpdated(boolean wasCancelled, boolean wasError) { List<CatalogItem> items = getCatalog().getItems(); - Set<CatalogItem> selectedItems = new LinkedHashSet<CatalogItem>(); + Set<CatalogItem> selectedItems = new LinkedHashSet<>(); for (CatalogItem catalogItem : items) { if (catalogItem.isSelected()) { selectedItems.add(catalogItem); @@ -365,7 +365,7 @@ public class FavoritesViewer extends CatalogViewer { } setSelection(StructuredSelection.EMPTY); super.catalogUpdated(wasCancelled, wasError); - setSelection(new StructuredSelection(new ArrayList<CatalogItem>(selectedItems))); + setSelection(new StructuredSelection(new ArrayList<>(selectedItems))); } public void setInstallSelected(boolean install) { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FeatureSelectionWizardPage.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FeatureSelectionWizardPage.java index bd749362..3fbbdb35 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FeatureSelectionWizardPage.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/FeatureSelectionWizardPage.java @@ -183,7 +183,7 @@ public class FeatureSelectionWizardPage extends WizardPage implements IWizardBut List<FeatureEntry> filtered; switch (selectedOperation) { case INSTALL: - filtered = new ArrayList<SelectionModel.FeatureEntry>(); + filtered = new ArrayList<>(); for (FeatureEntry featureEntry : children) { if (!featureEntry.isInstalled() || featureEntry.hasUpdateAvailable()) {//FIXME show installed features as disabled filtered.add(featureEntry); @@ -191,7 +191,7 @@ public class FeatureSelectionWizardPage extends WizardPage implements IWizardBut } return filtered; case UPDATE: - filtered = new ArrayList<SelectionModel.FeatureEntry>(); + filtered = new ArrayList<>(); for (FeatureEntry featureEntry : children) { if (featureEntry.hasUpdateAvailable()) { filtered.add(featureEntry); @@ -199,7 +199,7 @@ public class FeatureSelectionWizardPage extends WizardPage implements IWizardBut } return filtered; case UNINSTALL: - filtered = new ArrayList<SelectionModel.FeatureEntry>(); + filtered = new ArrayList<>(); for (FeatureEntry featureEntry : children) { if (featureEntry.isInstalled()) { filtered.add(featureEntry); @@ -390,7 +390,7 @@ public class FeatureSelectionWizardPage extends WizardPage implements IWizardBut return; } viewer.setInput(selectionModel); - ResolveFeatureNamesOperation operation = new ResolveFeatureNamesOperation(new ArrayList<CatalogItem>( + ResolveFeatureNamesOperation operation = new ResolveFeatureNamesOperation(new ArrayList<>( allSelectionCatalogItems)) { Display display = getControl().getDisplay(); @@ -552,7 +552,7 @@ public class FeatureSelectionWizardPage extends WizardPage implements IWizardBut } private void updateSelectionModel(Set<FeatureDescriptor> featureDescriptors) { - Map<String, FeatureDescriptor> descriptorById = new HashMap<String, FeatureDescriptor>(); + Map<String, FeatureDescriptor> descriptorById = new HashMap<>(); for (FeatureDescriptor fd : featureDescriptors) { descriptorById.put(fd.getId(), fd); } @@ -569,8 +569,8 @@ public class FeatureSelectionWizardPage extends WizardPage implements IWizardBut public void computeCheckedViewerState() { // compute which ones should be checked. (update scenario where only part of a feature is installed) - List<Object> checkedElements = new ArrayList<Object>(); - List<Object> grayCheckedElements = new ArrayList<Object>(); + List<Object> checkedElements = new ArrayList<>(); + List<Object> grayCheckedElements = new ArrayList<>(); for (CatalogItemEntry entry : getWizard().getSelectionModel().getCatalogItemEntries()) { int childCheckCount = 0; boolean childGrayed = false; diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesPage.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesPage.java index ffc30e87..fee545cc 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesPage.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesPage.java @@ -140,7 +140,7 @@ public class ImportFavoritesPage extends CatalogPage { if (userFavoritesService == null) { return; } - final List<INode> importNodes = new ArrayList<INode>(); + final List<INode> importNodes = new ArrayList<>(); for (MarketplaceNodeCatalogItem item : importFavorites) { importNodes.add(item.getData()); } @@ -175,7 +175,7 @@ public class ImportFavoritesPage extends CatalogPage { IStructuredSelection selection = getViewer().getSelection(); @SuppressWarnings("unchecked") List<MarketplaceNodeCatalogItem> importFavorites = selection.toList(); - return new ArrayList<MarketplaceNodeCatalogItem>(importFavorites); + return new ArrayList<>(importFavorites); } private IUserFavoritesService findUserFavoritesService() { diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesWizard.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesWizard.java index 032d79a2..ff55cbf1 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesWizard.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ImportFavoritesWizard.java @@ -98,7 +98,7 @@ public class ImportFavoritesWizard extends DiscoveryWizard { MarketplaceCatalogConfiguration catalogConfiguration = getConfiguration(); config.setCatalogDescriptors(catalogConfiguration.getCatalogDescriptors()); config.setCatalogDescriptor(catalogConfiguration.getCatalogDescriptor()); - Map<String, Operation> initialOperations = new HashMap<String, Operation>(); + Map<String, Operation> initialOperations = new HashMap<>(); for (MarketplaceNodeCatalogItem item : selection) { initialOperations.put(item.getData().getId(), Operation.INSTALL); } diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ItemButtonController.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ItemButtonController.java index 027c3f01..994ef59f 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ItemButtonController.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/ItemButtonController.java @@ -243,7 +243,7 @@ class ItemButtonController { break; } if (availableOperations.size() > 1) { - selectableStates = new ArrayList<ButtonState>(availableOperations.size() - 1); + selectableStates = new ArrayList<>(availableOperations.size() - 1); for (Operation operation : availableOperations) { if (operation != primaryOperation) { ButtonState selectableState = ButtonState.forOperation(operation); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceCatalogConfiguration.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceCatalogConfiguration.java index 9b0d9ea3..dee537c4 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceCatalogConfiguration.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceCatalogConfiguration.java @@ -28,7 +28,7 @@ import org.eclipse.osgi.util.NLS; * @author David Green */ public class MarketplaceCatalogConfiguration extends CatalogConfiguration implements IMarketplaceClientConfiguration { - private List<CatalogDescriptor> catalogDescriptors = new ArrayList<CatalogDescriptor>(); + private List<CatalogDescriptor> catalogDescriptors = new ArrayList<>(); private CatalogDescriptor catalogDescriptor; @@ -109,7 +109,7 @@ public class MarketplaceCatalogConfiguration extends CatalogConfiguration implem @Override public void setInitialOperations(Map<String, Operation> initialOperations) { - this.initialOperations = new LinkedHashMap<String, Operation>(initialOperations); + this.initialOperations = new LinkedHashMap<>(initialOperations); } /** diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceFilter.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceFilter.java index e4328594..6917e054 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceFilter.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Composite; public abstract class MarketplaceFilter extends CatalogFilter { private Catalog catalog; - private final List<IPropertyChangeListener> listeners = new CopyOnWriteArrayList<IPropertyChangeListener>(); + private final List<IPropertyChangeListener> listeners = new CopyOnWriteArrayList<>(); public Catalog getCatalog() { return catalog; diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java index 65f772d5..a1cf1127 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java @@ -148,9 +148,9 @@ public class MarketplacePage extends CatalogPage implements IWizardButtonLabelPr private ContentType previousContentType; - private final List<ActionLink> actionLinks = new ArrayList<ActionLink>(); + private final List<ActionLink> actionLinks = new ArrayList<>(); - private final Map<String, ActionLink> actions = new HashMap<String, ActionLink>(); + private final Map<String, ActionLink> actions = new HashMap<>(); public MarketplacePage(MarketplaceCatalog catalog, MarketplaceCatalogConfiguration configuration) { super(catalog); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceViewer.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceViewer.java index d634803c..15da446f 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceViewer.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceViewer.java @@ -109,7 +109,7 @@ public class MarketplaceViewer extends CatalogViewer { public Object[] getElements(Object inputElement) { if (getCatalog() != null) { // don't provide any categories unless it's featured - List<Object> items = new ArrayList<Object>(getCatalog().getItems()); + List<Object> items = new ArrayList<>(getCatalog().getItems()); for (CatalogCategory category : getCatalog().getCategories()) { if (category instanceof MarketplaceCategory) { MarketplaceCategory marketplaceCategory = (MarketplaceCategory) category; @@ -209,7 +209,7 @@ public class MarketplaceViewer extends CatalogViewer { private QueryData queryData = new QueryData(); - private final Map<ContentType, QueryData> tabQueries = new HashMap<MarketplaceViewer.ContentType, MarketplaceViewer.QueryData>(); + private final Map<ContentType, QueryData> tabQueries = new HashMap<>(); private ContentType queryContentType; @@ -219,7 +219,7 @@ public class MarketplaceViewer extends CatalogViewer { private final MarketplaceWizard wizard; - private final List<IPropertyChangeListener> listeners = new LinkedList<IPropertyChangeListener>(); + private final List<IPropertyChangeListener> listeners = new LinkedList<>(); private IDiscoveryItemFactory discoveryItemFactory; @@ -407,8 +407,7 @@ public class MarketplaceViewer extends CatalogViewer { return discoveryItemFactory.createDiscoveryItem(catalogItem, this, parent, getResources(), shellProvider, browser); } - return new DiscoveryItem<CatalogItem>(parent, SWT.NONE, getResources(), browser, catalogItem, - this); + return new DiscoveryItem<>(parent, SWT.NONE, getResources(), browser, catalogItem, this); } public void show(Set<? extends INode> nodes) { @@ -594,7 +593,7 @@ public class MarketplaceViewer extends CatalogViewer { result[0] = getCatalog().userFavorites(false, monitor); break; case SELECTION: - Set<String> nodeIds = new HashSet<String>(); + Set<String> nodeIds = new HashSet<>(); for (CatalogItem item : getSelectionModel().getItemToSelectedOperation().keySet()) { nodeIds.add(((INode) item.getData()).getId()); } @@ -956,7 +955,7 @@ public class MarketplaceViewer extends CatalogViewer { @Override public List<CatalogItem> getCheckedItems() { - List<CatalogItem> items = new ArrayList<CatalogItem>(); + List<CatalogItem> items = new ArrayList<>(); for (Entry<CatalogItem, Operation> entry : getSelectionModel().getItemToSelectedOperation().entrySet()) { if (entry.getValue() != Operation.NONE) { items.add(entry.getKey()); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceWizard.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceWizard.java index 2bb219af..9f3ce459 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceWizard.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplaceWizard.java @@ -291,9 +291,9 @@ public class MarketplaceWizard extends DiscoveryWizard implements InstallProfile } protected void updateSelection() { - List<Entry<CatalogItem, Operation>> itemToSelectedOperation = new ArrayList<Entry<CatalogItem, Operation>>( + List<Entry<CatalogItem, Operation>> itemToSelectedOperation = new ArrayList<>( getSelectionModel().getItemToSelectedOperation().entrySet()); - final List<CatalogItem> noninstallableItems = new ArrayList<CatalogItem>(); + final List<CatalogItem> noninstallableItems = new ArrayList<>(); for (Entry<CatalogItem, Operation> entry : itemToSelectedOperation) { if (entry.getValue() != Operation.NONE) { boolean unavailableInstall = (Boolean.FALSE.equals(entry.getKey().getAvailable()) @@ -648,7 +648,7 @@ public class MarketplaceWizard extends DiscoveryWizard implements InstallProfile IWebBrowser browser = PlatformUI.getWorkbench() .getBrowserSupport() .createBrowser(style, browserId, - catalogDescriptor.getLabel(), catalogDescriptor.getDescription()); + catalogDescriptor.getLabel(), catalogDescriptor.getDescription()); final String originalUrl = url; url = appendWizardState(url); browser.openURL(new URL(url)); // ORDER DEPENDENCY //don't encode/validate URL - browser can be quite lenient @@ -826,7 +826,7 @@ public class MarketplaceWizard extends DiscoveryWizard implements InstallProfile Job job = new Job(Messages.MarketplaceWizard_errorNotificationJob) { IStatus r = result; - Set<CatalogItem> items = new HashSet<CatalogItem>(itemToOperation.keySet()); + Set<CatalogItem> items = new HashSet<>(itemToOperation.keySet()); IInstallableUnit[] ius = operationIUs; @@ -881,11 +881,11 @@ public class MarketplaceWizard extends DiscoveryWizard implements InstallProfile } private Set<CatalogItem> computeNewInstallCatalogItems() { - Set<CatalogItem> items = new HashSet<CatalogItem>(); - Map<CatalogItem, Collection<String>> iusByCatalogItem = new HashMap<CatalogItem, Collection<String>>(); + Set<CatalogItem> items = new HashSet<>(); + Map<CatalogItem, Collection<String>> iusByCatalogItem = new HashMap<>(); for (CatalogItemEntry entry : getSelectionModel().getCatalogItemEntries()) { List<FeatureEntry> features = entry.getChildren(); - Collection<String> featureIds = new ArrayList<String>(features.size()); + Collection<String> featureIds = new ArrayList<>(features.size()); for (FeatureEntry feature : features) { if (feature.computeChangeOperation() == Operation.INSTALL) { featureIds.add(feature.getFeatureDescriptor().getId()); @@ -983,7 +983,7 @@ public class MarketplaceWizard extends DiscoveryWizard implements InstallProfile return true; } final SelectionModel selectionModel = getSelectionModel(); - final Map<String, Operation> nodeIdToOperation = new HashMap<String, Operation>(); + final Map<String, Operation> nodeIdToOperation = new HashMap<>(); nodeIdToOperation.putAll(getSelectionModel().getItemIdToSelectedOperation()); try { nodeIdToOperation.put(URLDecoder.decode(installId, UTF_8), Operation.INSTALL); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/NewsUrlHandler.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/NewsUrlHandler.java index 0520139c..45d5162e 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/NewsUrlHandler.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/NewsUrlHandler.java @@ -77,7 +77,7 @@ public class NewsUrlHandler extends MarketplaceUrlHandler implements LocationLis // Remember document links for navigation handling since we // don't want to deal with URLs from dynamic loading events if (links != null) { - Set<String> documentLinks = new HashSet<String>(); + Set<String> documentLinks = new HashSet<>(); for (Object link : links) { documentLinks.add(link.toString()); } diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/Operation.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/Operation.java index da756596..73c97951 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/Operation.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/Operation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -92,7 +92,7 @@ public enum Operation { if (operations == null) { return null; } - Map<T, Operation> mappedOperations = new LinkedHashMap<T, Operation>(); + Map<T, Operation> mappedOperations = new LinkedHashMap<>(); Set<Map.Entry<T, org.eclipse.epp.mpc.ui.Operation>> entrySet = operations.entrySet(); for (Map.Entry<T, org.eclipse.epp.mpc.ui.Operation> entry : entrySet) { mappedOperations.put(entry.getKey(), map(entry.getValue())); @@ -104,7 +104,7 @@ public enum Operation { if (operations == null) { return null; } - Map<T, org.eclipse.epp.mpc.ui.Operation> mappedOperations = new LinkedHashMap<T, org.eclipse.epp.mpc.ui.Operation>(); + Map<T, org.eclipse.epp.mpc.ui.Operation> mappedOperations = new LinkedHashMap<>(); Set<Map.Entry<T, Operation>> entrySet = operations.entrySet(); for (Map.Entry<T, Operation> entry : entrySet) { mappedOperations.put(entry.getKey(), entry.getValue() == null ? null : entry.getValue().getOperation()); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModel.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModel.java index 4932de77..81c31cef 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModel.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -40,7 +40,7 @@ import org.eclipse.osgi.util.NLS; */ public class SelectionModel { - private final Map<CatalogItem, Operation> itemToOperation = new HashMap<CatalogItem, Operation>(); + private final Map<CatalogItem, Operation> itemToOperation = new HashMap<>(); private List<CatalogItemEntry> entries; @@ -132,7 +132,7 @@ public class SelectionModel { public List<CatalogItemEntry> getCatalogItemEntries() { if (entries == null) { - List<CatalogItemEntry> entries = new ArrayList<CatalogItemEntry>(); + List<CatalogItemEntry> entries = new ArrayList<>(); for (Entry<CatalogItem, Operation> entry : itemToOperation.entrySet()) { CatalogItem item = entry.getKey(); @@ -162,7 +162,7 @@ public class SelectionModel { } private void computeChildren(CatalogItemEntry itemEntry) { - List<FeatureEntry> children = new ArrayList<FeatureEntry>(); + List<FeatureEntry> children = new ArrayList<>(); List<MarketplaceNodeInstallableUnitItem> iuItems = ((MarketplaceNodeCatalogItem) itemEntry.getItem()).getInstallableUnitItems(); if (iuItems != null) { for (MarketplaceNodeInstallableUnitItem iuItem : iuItems) { @@ -434,7 +434,7 @@ public class SelectionModel { */ @Deprecated public Map<CatalogItem, org.eclipse.epp.internal.mpc.ui.wizards.Operation> getItemToOperation() { - Map<CatalogItem, org.eclipse.epp.internal.mpc.ui.wizards.Operation> itemToOperation = new HashMap<CatalogItem, org.eclipse.epp.internal.mpc.ui.wizards.Operation>(); + Map<CatalogItem, org.eclipse.epp.internal.mpc.ui.wizards.Operation> itemToOperation = new HashMap<>(); Set<Entry<CatalogItem, Operation>> entrySet = this.itemToOperation.entrySet(); for (Entry<CatalogItem, Operation> entry : entrySet) { itemToOperation.put(entry.getKey(), org.eclipse.epp.internal.mpc.ui.wizards.Operation.map(entry.getValue())); @@ -448,7 +448,7 @@ public class SelectionModel { public Map<String, Operation> getItemIdToSelectedOperation() { Map<CatalogItem, Operation> itemToSelectedOperation = getItemToSelectedOperation(); - Map<String, Operation> itemIdToOperation = new HashMap<String, Operation>(itemToSelectedOperation.size()); + Map<String, Operation> itemIdToOperation = new HashMap<>(itemToSelectedOperation.size()); for (Entry<CatalogItem, Operation> entry : itemToSelectedOperation.entrySet()) { itemIdToOperation.put(entry.getKey().getId(), entry.getValue()); } @@ -461,7 +461,7 @@ public class SelectionModel { } public Map<FeatureEntry, Operation> getFeatureEntryToOperation(boolean includeNone, boolean verify) { - Map<FeatureEntry, Operation> featureEntries = new HashMap<FeatureEntry, Operation>(); + Map<FeatureEntry, Operation> featureEntries = new HashMap<>(); for (CatalogItemEntry entry : getCatalogItemEntries()) { for (FeatureEntry featureEntry : entry.getChildren()) { Operation operation = featureEntry.computeChangeOperation(); @@ -494,7 +494,7 @@ public class SelectionModel { */ @Deprecated public Set<FeatureDescriptor> getSelectedFeatureDescriptors() { - Set<FeatureDescriptor> featureDescriptors = new HashSet<FeatureDescriptor>(); + Set<FeatureDescriptor> featureDescriptors = new HashSet<>(); Set<FeatureEntry> selectedFeatureEntries = getSelectedFeatureEntries(); for (FeatureEntry featureEntry : selectedFeatureEntries) { featureDescriptors.add(featureEntry.getFeatureDescriptor()); @@ -506,7 +506,7 @@ public class SelectionModel { * Get all catalog items that have at least one feature selected */ public Set<CatalogItem> getSelectedCatalogItems() { - Set<CatalogItem> items = new HashSet<CatalogItem>(); + Set<CatalogItem> items = new HashSet<>(); for (CatalogItemEntry entry : getCatalogItemEntries()) { if (entry.getSelectedOperation() == Operation.NONE) { continue; @@ -620,14 +620,14 @@ public class SelectionModel { private Map<Operation, List<CatalogItem>> computeOperationToItem() { Map<CatalogItem, Operation> itemToOperation = getItemToSelectedOperation(); - Map<Operation, List<CatalogItem>> catalogItemByOperation = new HashMap<Operation, List<CatalogItem>>(); + Map<Operation, List<CatalogItem>> catalogItemByOperation = new HashMap<>(); for (Map.Entry<CatalogItem, Operation> entry : itemToOperation.entrySet()) { if (entry.getValue() == Operation.NONE) { continue; } List<CatalogItem> list = catalogItemByOperation.get(entry.getValue()); if (list == null) { - list = new ArrayList<CatalogItem>(); + list = new ArrayList<>(); catalogItemByOperation.put(entry.getValue(), list); } list.add(entry.getKey()); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModelStateSerializer.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModelStateSerializer.java index 0c887e8c..e9fb073d 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModelStateSerializer.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/SelectionModelStateSerializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 The Eclipse Foundation and others. + * Copyright (c) 2010, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -67,7 +67,7 @@ public class SelectionModelStateSerializer { @Deprecated public void deserialize(IProgressMonitor monitor, String state, Map<String, org.eclipse.epp.internal.mpc.ui.wizards.Operation> operationByNodeIdExtras) { - Map<String, Operation> operationByNodeId = new HashMap<String, Operation>(); + Map<String, Operation> operationByNodeId = new HashMap<>(); for (Entry<String, org.eclipse.epp.internal.mpc.ui.wizards.Operation> entry : operationByNodeIdExtras.entrySet()) { org.eclipse.epp.internal.mpc.ui.wizards.Operation op = entry.getValue(); operationByNodeId.put(entry.getKey(), op == null ? null : op.getOperation()); @@ -84,7 +84,7 @@ public class SelectionModelStateSerializer { */ public void deserialize(String state, Map<String, Operation> operationByNodeExtras, IProgressMonitor monitor) { - Map<String, Operation> operationByNodeId = new HashMap<String, Operation>(); + Map<String, Operation> operationByNodeId = new HashMap<>(); if (state != null && state.length() > 0) { Pattern pattern = Pattern.compile("([^\\s=]+)=(\\S+)"); //$NON-NLS-1$ Matcher matcher = pattern.matcher(state); diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/MarketplaceUrlHandler.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/MarketplaceUrlHandler.java index 36a959ee..0abf63ff 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/MarketplaceUrlHandler.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/mpc/ui/MarketplaceUrlHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 The Eclipse Foundation and others. + * Copyright (c) 2011, 2018 The Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -175,7 +175,7 @@ public abstract class MarketplaceUrlHandler { if (query == null) { return null; } - Map<String, String> values = new LinkedHashMap<String, String>(); + Map<String, String> values = new LinkedHashMap<>(); String[] params = query.split(PARAM_SPLIT_REGEX); for (String param : params) { String[] keyValue = param.split(EQUALS_REGEX); @@ -212,7 +212,7 @@ public abstract class MarketplaceUrlHandler { if (mpcState != null) { command.setWizardState(URLDecoder.decode(mpcState, UTF_8)); } - Map<String, Operation> nodeToOperation = new HashMap<String, Operation>(); + Map<String, Operation> nodeToOperation = new HashMap<>(); nodeToOperation.put(URLDecoder.decode(installId, UTF_8), Operation.INSTALL); command.setOperations(nodeToOperation); } catch (UnsupportedEncodingException e1) { @@ -315,7 +315,7 @@ public abstract class MarketplaceUrlHandler { private boolean handleSolrSearch(CatalogDescriptor descriptor, String url) { try { - Map<String, String> params = new HashMap<String, String>(); + Map<String, String> params = new HashMap<>(); String searchString = parseSearchQuery(descriptor, url, params); return handleSearch(descriptor, url, searchString, params); } catch (MalformedURLException e) { @@ -329,7 +329,7 @@ public abstract class MarketplaceUrlHandler { private boolean handleSiteSearch(CatalogDescriptor descriptor, String url) { try { - Map<String, String> params = new HashMap<String, String>(); + Map<String, String> params = new HashMap<>(); String searchString = parseSearchQuery(descriptor, url, params); // convert queries of this format |